pdf.worker.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561
  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. handler.send("test", data instanceof Uint8Array && data[0] === 255);
  81. });
  82. handler.on("configure", function wphConfigure(data) {
  83. (0, _util.setVerbosityLevel)(data.verbosity);
  84. });
  85. handler.on("GetDocRequest", function wphSetupDoc(data) {
  86. return WorkerMessageHandler.createDocumentHandler(data, port);
  87. });
  88. }
  89. static createDocumentHandler(docParams, port) {
  90. let pdfManager;
  91. let terminated = false;
  92. let cancelXHRs = null;
  93. const WorkerTasks = [];
  94. const verbosity = (0, _util.getVerbosityLevel)();
  95. const apiVersion = docParams.apiVersion;
  96. const workerVersion = '2.12.313';
  97. if (apiVersion !== workerVersion) {
  98. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  99. }
  100. const enumerableProperties = [];
  101. for (const property in []) {
  102. enumerableProperties.push(property);
  103. }
  104. if (enumerableProperties.length) {
  105. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  106. }
  107. if (typeof ReadableStream === "undefined") {
  108. 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.");
  109. }
  110. const docId = docParams.docId;
  111. const docBaseUrl = docParams.docBaseUrl;
  112. const workerHandlerName = docParams.docId + "_worker";
  113. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  114. function ensureNotTerminated() {
  115. if (terminated) {
  116. throw new Error("Worker was terminated");
  117. }
  118. }
  119. function startWorkerTask(task) {
  120. WorkerTasks.push(task);
  121. }
  122. function finishWorkerTask(task) {
  123. task.finish();
  124. const i = WorkerTasks.indexOf(task);
  125. WorkerTasks.splice(i, 1);
  126. }
  127. async function loadDocument(recoveryMode) {
  128. await pdfManager.ensureDoc("checkHeader");
  129. await pdfManager.ensureDoc("parseStartXRef");
  130. await pdfManager.ensureDoc("parse", [recoveryMode]);
  131. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  132. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  133. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  134. if (isPureXfa) {
  135. const task = new WorkerTask("loadXfaFonts");
  136. startWorkerTask(task);
  137. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  138. }
  139. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  140. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  141. return {
  142. numPages,
  143. fingerprints,
  144. htmlForXfa
  145. };
  146. }
  147. function getPdfManager(data, evaluatorOptions, enableXfa) {
  148. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  149. let newPdfManager;
  150. const source = data.source;
  151. if (source.data) {
  152. try {
  153. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  154. pdfManagerCapability.resolve(newPdfManager);
  155. } catch (ex) {
  156. pdfManagerCapability.reject(ex);
  157. }
  158. return pdfManagerCapability.promise;
  159. }
  160. let pdfStream,
  161. cachedChunks = [];
  162. try {
  163. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  164. } catch (ex) {
  165. pdfManagerCapability.reject(ex);
  166. return pdfManagerCapability.promise;
  167. }
  168. const fullRequest = pdfStream.getFullReader();
  169. fullRequest.headersReady.then(function () {
  170. if (!fullRequest.isRangeSupported) {
  171. return;
  172. }
  173. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  174. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  175. msgHandler: handler,
  176. password: source.password,
  177. length: fullRequest.contentLength,
  178. disableAutoFetch,
  179. rangeChunkSize: source.rangeChunkSize
  180. }, evaluatorOptions, enableXfa, docBaseUrl);
  181. for (let i = 0; i < cachedChunks.length; i++) {
  182. newPdfManager.sendProgressiveData(cachedChunks[i]);
  183. }
  184. cachedChunks = [];
  185. pdfManagerCapability.resolve(newPdfManager);
  186. cancelXHRs = null;
  187. }).catch(function (reason) {
  188. pdfManagerCapability.reject(reason);
  189. cancelXHRs = null;
  190. });
  191. let loaded = 0;
  192. const flushChunks = function () {
  193. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  194. if (source.length && pdfFile.length !== source.length) {
  195. (0, _util.warn)("reported HTTP length is different from actual");
  196. }
  197. try {
  198. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  199. pdfManagerCapability.resolve(newPdfManager);
  200. } catch (ex) {
  201. pdfManagerCapability.reject(ex);
  202. }
  203. cachedChunks = [];
  204. };
  205. const readPromise = new Promise(function (resolve, reject) {
  206. const readChunk = function ({
  207. value,
  208. done
  209. }) {
  210. try {
  211. ensureNotTerminated();
  212. if (done) {
  213. if (!newPdfManager) {
  214. flushChunks();
  215. }
  216. cancelXHRs = null;
  217. return;
  218. }
  219. loaded += (0, _util.arrayByteLength)(value);
  220. if (!fullRequest.isStreamingSupported) {
  221. handler.send("DocProgress", {
  222. loaded,
  223. total: Math.max(loaded, fullRequest.contentLength || 0)
  224. });
  225. }
  226. if (newPdfManager) {
  227. newPdfManager.sendProgressiveData(value);
  228. } else {
  229. cachedChunks.push(value);
  230. }
  231. fullRequest.read().then(readChunk, reject);
  232. } catch (e) {
  233. reject(e);
  234. }
  235. };
  236. fullRequest.read().then(readChunk, reject);
  237. });
  238. readPromise.catch(function (e) {
  239. pdfManagerCapability.reject(e);
  240. cancelXHRs = null;
  241. });
  242. cancelXHRs = function (reason) {
  243. pdfStream.cancelAllRequests(reason);
  244. };
  245. return pdfManagerCapability.promise;
  246. }
  247. function setupDoc(data) {
  248. function onSuccess(doc) {
  249. ensureNotTerminated();
  250. handler.send("GetDoc", {
  251. pdfInfo: doc
  252. });
  253. }
  254. function onFailure(ex) {
  255. ensureNotTerminated();
  256. if (ex instanceof _util.PasswordException) {
  257. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  258. startWorkerTask(task);
  259. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  260. password
  261. }) {
  262. finishWorkerTask(task);
  263. pdfManager.updatePassword(password);
  264. pdfManagerReady();
  265. }).catch(function () {
  266. finishWorkerTask(task);
  267. handler.send("DocException", ex);
  268. });
  269. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  270. handler.send("DocException", ex);
  271. } else {
  272. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  273. }
  274. }
  275. function pdfManagerReady() {
  276. ensureNotTerminated();
  277. loadDocument(false).then(onSuccess, function (reason) {
  278. ensureNotTerminated();
  279. if (!(reason instanceof _core_utils.XRefParseException)) {
  280. onFailure(reason);
  281. return;
  282. }
  283. pdfManager.requestLoadedStream();
  284. pdfManager.onLoadedStream().then(function () {
  285. ensureNotTerminated();
  286. loadDocument(true).then(onSuccess, onFailure);
  287. });
  288. });
  289. }
  290. ensureNotTerminated();
  291. const evaluatorOptions = {
  292. maxImageSize: data.maxImageSize,
  293. disableFontFace: data.disableFontFace,
  294. ignoreErrors: data.ignoreErrors,
  295. isEvalSupported: data.isEvalSupported,
  296. fontExtraProperties: data.fontExtraProperties,
  297. useSystemFonts: data.useSystemFonts,
  298. cMapUrl: data.cMapUrl,
  299. standardFontDataUrl: data.standardFontDataUrl
  300. };
  301. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  302. if (terminated) {
  303. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  304. throw new Error("Worker was terminated");
  305. }
  306. pdfManager = newPdfManager;
  307. pdfManager.onLoadedStream().then(function (stream) {
  308. handler.send("DataLoaded", {
  309. length: stream.bytes.byteLength
  310. });
  311. });
  312. }).then(pdfManagerReady, onFailure);
  313. }
  314. handler.on("GetPage", function wphSetupGetPage(data) {
  315. return pdfManager.getPage(data.pageIndex).then(function (page) {
  316. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  317. return {
  318. rotate,
  319. ref,
  320. userUnit,
  321. view
  322. };
  323. });
  324. });
  325. });
  326. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  327. ref
  328. }) {
  329. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  330. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  331. });
  332. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  333. return pdfManager.ensureCatalog("destinations");
  334. });
  335. handler.on("GetDestination", function wphSetupGetDestination(data) {
  336. return pdfManager.ensureCatalog("getDestination", [data.id]);
  337. });
  338. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  339. return pdfManager.ensureCatalog("pageLabels");
  340. });
  341. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  342. return pdfManager.ensureCatalog("pageLayout");
  343. });
  344. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  345. return pdfManager.ensureCatalog("pageMode");
  346. });
  347. handler.on("GetViewerPreferences", function (data) {
  348. return pdfManager.ensureCatalog("viewerPreferences");
  349. });
  350. handler.on("GetOpenAction", function (data) {
  351. return pdfManager.ensureCatalog("openAction");
  352. });
  353. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  354. return pdfManager.ensureCatalog("attachments");
  355. });
  356. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  357. return pdfManager.ensureCatalog("javaScript");
  358. });
  359. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  360. return pdfManager.ensureCatalog("jsActions");
  361. });
  362. handler.on("GetPageJSActions", function ({
  363. pageIndex
  364. }) {
  365. return pdfManager.getPage(pageIndex).then(function (page) {
  366. return pdfManager.ensure(page, "jsActions");
  367. });
  368. });
  369. handler.on("GetOutline", function wphSetupGetOutline(data) {
  370. return pdfManager.ensureCatalog("documentOutline");
  371. });
  372. handler.on("GetOptionalContentConfig", function (data) {
  373. return pdfManager.ensureCatalog("optionalContentConfig");
  374. });
  375. handler.on("GetPermissions", function (data) {
  376. return pdfManager.ensureCatalog("permissions");
  377. });
  378. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  379. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  380. });
  381. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  382. return pdfManager.ensureCatalog("markInfo");
  383. });
  384. handler.on("GetData", function wphSetupGetData(data) {
  385. pdfManager.requestLoadedStream();
  386. return pdfManager.onLoadedStream().then(function (stream) {
  387. return stream.bytes;
  388. });
  389. });
  390. handler.on("GetAnnotations", function ({
  391. pageIndex,
  392. intent
  393. }) {
  394. return pdfManager.getPage(pageIndex).then(function (page) {
  395. return page.getAnnotationsData(intent);
  396. });
  397. });
  398. handler.on("GetFieldObjects", function (data) {
  399. return pdfManager.ensureDoc("fieldObjects");
  400. });
  401. handler.on("HasJSActions", function (data) {
  402. return pdfManager.ensureDoc("hasJSActions");
  403. });
  404. handler.on("GetCalculationOrderIds", function (data) {
  405. return pdfManager.ensureDoc("calculationOrderIds");
  406. });
  407. handler.on("SaveDocument", function ({
  408. isPureXfa,
  409. numPages,
  410. annotationStorage,
  411. filename
  412. }) {
  413. pdfManager.requestLoadedStream();
  414. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  415. if (isPureXfa) {
  416. promises.push(pdfManager.serializeXfaData(annotationStorage));
  417. } else {
  418. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  419. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  420. const task = new WorkerTask(`Save: page ${pageIndex}`);
  421. return page.save(handler, task, annotationStorage).finally(function () {
  422. finishWorkerTask(task);
  423. });
  424. }));
  425. }
  426. }
  427. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  428. let newRefs = [];
  429. let xfaData = null;
  430. if (isPureXfa) {
  431. xfaData = refs[0];
  432. if (!xfaData) {
  433. return stream.bytes;
  434. }
  435. } else {
  436. for (const ref of refs) {
  437. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  438. }
  439. if (newRefs.length === 0) {
  440. return stream.bytes;
  441. }
  442. }
  443. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  444. let xfaDatasetsRef = null;
  445. let hasXfaDatasetsEntry = false;
  446. if (Array.isArray(xfa)) {
  447. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  448. if (xfa[i] === "datasets") {
  449. xfaDatasetsRef = xfa[i + 1];
  450. acroFormRef = null;
  451. hasXfaDatasetsEntry = true;
  452. }
  453. }
  454. if (xfaDatasetsRef === null) {
  455. xfaDatasetsRef = xref.getNewRef();
  456. }
  457. } else if (xfa) {
  458. acroFormRef = null;
  459. (0, _util.warn)("Unsupported XFA type.");
  460. }
  461. let newXrefInfo = Object.create(null);
  462. if (xref.trailer) {
  463. const infoObj = Object.create(null);
  464. const xrefInfo = xref.trailer.get("Info") || null;
  465. if (xrefInfo instanceof _primitives.Dict) {
  466. xrefInfo.forEach((key, value) => {
  467. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  468. infoObj[key] = (0, _util.stringToPDFString)(value);
  469. }
  470. });
  471. }
  472. newXrefInfo = {
  473. rootRef: xref.trailer.getRaw("Root") || null,
  474. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  475. newRef: xref.getNewRef(),
  476. infoRef: xref.trailer.getRaw("Info") || null,
  477. info: infoObj,
  478. fileIds: xref.trailer.get("ID") || null,
  479. startXRef,
  480. filename
  481. };
  482. }
  483. xref.resetNewRef();
  484. return (0, _writer.incrementalUpdate)({
  485. originalData: stream.bytes,
  486. xrefInfo: newXrefInfo,
  487. newRefs,
  488. xref,
  489. hasXfa: !!xfa,
  490. xfaDatasetsRef,
  491. hasXfaDatasetsEntry,
  492. acroFormRef,
  493. acroForm,
  494. xfaData
  495. });
  496. });
  497. });
  498. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  499. const pageIndex = data.pageIndex;
  500. pdfManager.getPage(pageIndex).then(function (page) {
  501. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  502. startWorkerTask(task);
  503. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  504. page.getOperatorList({
  505. handler,
  506. sink,
  507. task,
  508. intent: data.intent,
  509. cacheKey: data.cacheKey,
  510. annotationStorage: data.annotationStorage
  511. }).then(function (operatorListInfo) {
  512. finishWorkerTask(task);
  513. if (start) {
  514. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  515. }
  516. sink.close();
  517. }, function (reason) {
  518. finishWorkerTask(task);
  519. if (task.terminated) {
  520. return;
  521. }
  522. handler.send("UnsupportedFeature", {
  523. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  524. });
  525. sink.error(reason);
  526. });
  527. });
  528. });
  529. handler.on("GetTextContent", function wphExtractText(data, sink) {
  530. const pageIndex = data.pageIndex;
  531. pdfManager.getPage(pageIndex).then(function (page) {
  532. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  533. startWorkerTask(task);
  534. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  535. page.extractTextContent({
  536. handler,
  537. task,
  538. sink,
  539. normalizeWhitespace: data.normalizeWhitespace,
  540. includeMarkedContent: data.includeMarkedContent,
  541. combineTextItems: data.combineTextItems
  542. }).then(function () {
  543. finishWorkerTask(task);
  544. if (start) {
  545. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  546. }
  547. sink.close();
  548. }, function (reason) {
  549. finishWorkerTask(task);
  550. if (task.terminated) {
  551. return;
  552. }
  553. sink.error(reason);
  554. });
  555. });
  556. });
  557. handler.on("GetStructTree", function wphGetStructTree(data) {
  558. return pdfManager.getPage(data.pageIndex).then(function (page) {
  559. return pdfManager.ensure(page, "getStructTree");
  560. });
  561. });
  562. handler.on("FontFallback", function (data) {
  563. return pdfManager.fontFallback(data.id, handler);
  564. });
  565. handler.on("Cleanup", function wphCleanup(data) {
  566. return pdfManager.cleanup(true);
  567. });
  568. handler.on("Terminate", function wphTerminate(data) {
  569. terminated = true;
  570. const waitOn = [];
  571. if (pdfManager) {
  572. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  573. const cleanupPromise = pdfManager.cleanup();
  574. waitOn.push(cleanupPromise);
  575. pdfManager = null;
  576. } else {
  577. (0, _primitives.clearPrimitiveCaches)();
  578. }
  579. if (cancelXHRs) {
  580. cancelXHRs(new _util.AbortException("Worker was terminated."));
  581. }
  582. for (const task of WorkerTasks) {
  583. waitOn.push(task.finished);
  584. task.terminate();
  585. }
  586. return Promise.all(waitOn).then(function () {
  587. handler.destroy();
  588. handler = null;
  589. });
  590. });
  591. handler.on("Ready", function wphReady(data) {
  592. setupDoc(docParams);
  593. docParams = null;
  594. });
  595. return workerHandlerName;
  596. }
  597. static initializeFromPort(port) {
  598. const handler = new _message_handler.MessageHandler("worker", "main", port);
  599. WorkerMessageHandler.setup(handler, port);
  600. handler.send("ready", null);
  601. }
  602. }
  603. exports.WorkerMessageHandler = WorkerMessageHandler;
  604. function isMessagePort(maybePort) {
  605. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  606. }
  607. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  608. WorkerMessageHandler.initializeFromPort(self);
  609. }
  610. /***/ }),
  611. /* 2 */
  612. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  613. Object.defineProperty(exports, "__esModule", ({
  614. value: true
  615. }));
  616. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = 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;
  617. exports.arrayByteLength = arrayByteLength;
  618. exports.arraysToBytes = arraysToBytes;
  619. exports.assert = assert;
  620. exports.bytesToString = bytesToString;
  621. exports.createObjectURL = createObjectURL;
  622. exports.createPromiseCapability = createPromiseCapability;
  623. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  624. exports.escapeString = escapeString;
  625. exports.getModificationDate = getModificationDate;
  626. exports.getVerbosityLevel = getVerbosityLevel;
  627. exports.info = info;
  628. exports.isArrayBuffer = isArrayBuffer;
  629. exports.isArrayEqual = isArrayEqual;
  630. exports.isAscii = isAscii;
  631. exports.isBool = isBool;
  632. exports.isNum = isNum;
  633. exports.isSameOrigin = isSameOrigin;
  634. exports.isString = isString;
  635. exports.objectFromMap = objectFromMap;
  636. exports.objectSize = objectSize;
  637. exports.removeNullCharacters = removeNullCharacters;
  638. exports.setVerbosityLevel = setVerbosityLevel;
  639. exports.shadow = shadow;
  640. exports.string32 = string32;
  641. exports.stringToBytes = stringToBytes;
  642. exports.stringToPDFString = stringToPDFString;
  643. exports.stringToUTF16BEString = stringToUTF16BEString;
  644. exports.stringToUTF8String = stringToUTF8String;
  645. exports.unreachable = unreachable;
  646. exports.utf8StringToString = utf8StringToString;
  647. exports.warn = warn;
  648. __w_pdfjs_require__(3);
  649. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  650. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  651. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  652. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  653. const RenderingIntentFlag = {
  654. ANY: 0x01,
  655. DISPLAY: 0x02,
  656. PRINT: 0x04,
  657. ANNOTATIONS_FORMS: 0x10,
  658. ANNOTATIONS_STORAGE: 0x20,
  659. ANNOTATIONS_DISABLE: 0x40,
  660. OPLIST: 0x100
  661. };
  662. exports.RenderingIntentFlag = RenderingIntentFlag;
  663. const AnnotationMode = {
  664. DISABLE: 0,
  665. ENABLE: 1,
  666. ENABLE_FORMS: 2,
  667. ENABLE_STORAGE: 3
  668. };
  669. exports.AnnotationMode = AnnotationMode;
  670. const PermissionFlag = {
  671. PRINT: 0x04,
  672. MODIFY_CONTENTS: 0x08,
  673. COPY: 0x10,
  674. MODIFY_ANNOTATIONS: 0x20,
  675. FILL_INTERACTIVE_FORMS: 0x100,
  676. COPY_FOR_ACCESSIBILITY: 0x200,
  677. ASSEMBLE: 0x400,
  678. PRINT_HIGH_QUALITY: 0x800
  679. };
  680. exports.PermissionFlag = PermissionFlag;
  681. const TextRenderingMode = {
  682. FILL: 0,
  683. STROKE: 1,
  684. FILL_STROKE: 2,
  685. INVISIBLE: 3,
  686. FILL_ADD_TO_PATH: 4,
  687. STROKE_ADD_TO_PATH: 5,
  688. FILL_STROKE_ADD_TO_PATH: 6,
  689. ADD_TO_PATH: 7,
  690. FILL_STROKE_MASK: 3,
  691. ADD_TO_PATH_FLAG: 4
  692. };
  693. exports.TextRenderingMode = TextRenderingMode;
  694. const ImageKind = {
  695. GRAYSCALE_1BPP: 1,
  696. RGB_24BPP: 2,
  697. RGBA_32BPP: 3
  698. };
  699. exports.ImageKind = ImageKind;
  700. const AnnotationType = {
  701. TEXT: 1,
  702. LINK: 2,
  703. FREETEXT: 3,
  704. LINE: 4,
  705. SQUARE: 5,
  706. CIRCLE: 6,
  707. POLYGON: 7,
  708. POLYLINE: 8,
  709. HIGHLIGHT: 9,
  710. UNDERLINE: 10,
  711. SQUIGGLY: 11,
  712. STRIKEOUT: 12,
  713. STAMP: 13,
  714. CARET: 14,
  715. INK: 15,
  716. POPUP: 16,
  717. FILEATTACHMENT: 17,
  718. SOUND: 18,
  719. MOVIE: 19,
  720. WIDGET: 20,
  721. SCREEN: 21,
  722. PRINTERMARK: 22,
  723. TRAPNET: 23,
  724. WATERMARK: 24,
  725. THREED: 25,
  726. REDACT: 26
  727. };
  728. exports.AnnotationType = AnnotationType;
  729. const AnnotationStateModelType = {
  730. MARKED: "Marked",
  731. REVIEW: "Review"
  732. };
  733. exports.AnnotationStateModelType = AnnotationStateModelType;
  734. const AnnotationMarkedState = {
  735. MARKED: "Marked",
  736. UNMARKED: "Unmarked"
  737. };
  738. exports.AnnotationMarkedState = AnnotationMarkedState;
  739. const AnnotationReviewState = {
  740. ACCEPTED: "Accepted",
  741. REJECTED: "Rejected",
  742. CANCELLED: "Cancelled",
  743. COMPLETED: "Completed",
  744. NONE: "None"
  745. };
  746. exports.AnnotationReviewState = AnnotationReviewState;
  747. const AnnotationReplyType = {
  748. GROUP: "Group",
  749. REPLY: "R"
  750. };
  751. exports.AnnotationReplyType = AnnotationReplyType;
  752. const AnnotationFlag = {
  753. INVISIBLE: 0x01,
  754. HIDDEN: 0x02,
  755. PRINT: 0x04,
  756. NOZOOM: 0x08,
  757. NOROTATE: 0x10,
  758. NOVIEW: 0x20,
  759. READONLY: 0x40,
  760. LOCKED: 0x80,
  761. TOGGLENOVIEW: 0x100,
  762. LOCKEDCONTENTS: 0x200
  763. };
  764. exports.AnnotationFlag = AnnotationFlag;
  765. const AnnotationFieldFlag = {
  766. READONLY: 0x0000001,
  767. REQUIRED: 0x0000002,
  768. NOEXPORT: 0x0000004,
  769. MULTILINE: 0x0001000,
  770. PASSWORD: 0x0002000,
  771. NOTOGGLETOOFF: 0x0004000,
  772. RADIO: 0x0008000,
  773. PUSHBUTTON: 0x0010000,
  774. COMBO: 0x0020000,
  775. EDIT: 0x0040000,
  776. SORT: 0x0080000,
  777. FILESELECT: 0x0100000,
  778. MULTISELECT: 0x0200000,
  779. DONOTSPELLCHECK: 0x0400000,
  780. DONOTSCROLL: 0x0800000,
  781. COMB: 0x1000000,
  782. RICHTEXT: 0x2000000,
  783. RADIOSINUNISON: 0x2000000,
  784. COMMITONSELCHANGE: 0x4000000
  785. };
  786. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  787. const AnnotationBorderStyleType = {
  788. SOLID: 1,
  789. DASHED: 2,
  790. BEVELED: 3,
  791. INSET: 4,
  792. UNDERLINE: 5
  793. };
  794. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  795. const AnnotationActionEventType = {
  796. E: "Mouse Enter",
  797. X: "Mouse Exit",
  798. D: "Mouse Down",
  799. U: "Mouse Up",
  800. Fo: "Focus",
  801. Bl: "Blur",
  802. PO: "PageOpen",
  803. PC: "PageClose",
  804. PV: "PageVisible",
  805. PI: "PageInvisible",
  806. K: "Keystroke",
  807. F: "Format",
  808. V: "Validate",
  809. C: "Calculate"
  810. };
  811. exports.AnnotationActionEventType = AnnotationActionEventType;
  812. const DocumentActionEventType = {
  813. WC: "WillClose",
  814. WS: "WillSave",
  815. DS: "DidSave",
  816. WP: "WillPrint",
  817. DP: "DidPrint"
  818. };
  819. exports.DocumentActionEventType = DocumentActionEventType;
  820. const PageActionEventType = {
  821. O: "PageOpen",
  822. C: "PageClose"
  823. };
  824. exports.PageActionEventType = PageActionEventType;
  825. const StreamType = {
  826. UNKNOWN: "UNKNOWN",
  827. FLATE: "FLATE",
  828. LZW: "LZW",
  829. DCT: "DCT",
  830. JPX: "JPX",
  831. JBIG: "JBIG",
  832. A85: "A85",
  833. AHX: "AHX",
  834. CCF: "CCF",
  835. RLX: "RLX"
  836. };
  837. exports.StreamType = StreamType;
  838. const FontType = {
  839. UNKNOWN: "UNKNOWN",
  840. TYPE1: "TYPE1",
  841. TYPE1STANDARD: "TYPE1STANDARD",
  842. TYPE1C: "TYPE1C",
  843. CIDFONTTYPE0: "CIDFONTTYPE0",
  844. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  845. TRUETYPE: "TRUETYPE",
  846. CIDFONTTYPE2: "CIDFONTTYPE2",
  847. TYPE3: "TYPE3",
  848. OPENTYPE: "OPENTYPE",
  849. TYPE0: "TYPE0",
  850. MMTYPE1: "MMTYPE1"
  851. };
  852. exports.FontType = FontType;
  853. const VerbosityLevel = {
  854. ERRORS: 0,
  855. WARNINGS: 1,
  856. INFOS: 5
  857. };
  858. exports.VerbosityLevel = VerbosityLevel;
  859. const CMapCompressionType = {
  860. NONE: 0,
  861. BINARY: 1,
  862. STREAM: 2
  863. };
  864. exports.CMapCompressionType = CMapCompressionType;
  865. const OPS = {
  866. dependency: 1,
  867. setLineWidth: 2,
  868. setLineCap: 3,
  869. setLineJoin: 4,
  870. setMiterLimit: 5,
  871. setDash: 6,
  872. setRenderingIntent: 7,
  873. setFlatness: 8,
  874. setGState: 9,
  875. save: 10,
  876. restore: 11,
  877. transform: 12,
  878. moveTo: 13,
  879. lineTo: 14,
  880. curveTo: 15,
  881. curveTo2: 16,
  882. curveTo3: 17,
  883. closePath: 18,
  884. rectangle: 19,
  885. stroke: 20,
  886. closeStroke: 21,
  887. fill: 22,
  888. eoFill: 23,
  889. fillStroke: 24,
  890. eoFillStroke: 25,
  891. closeFillStroke: 26,
  892. closeEOFillStroke: 27,
  893. endPath: 28,
  894. clip: 29,
  895. eoClip: 30,
  896. beginText: 31,
  897. endText: 32,
  898. setCharSpacing: 33,
  899. setWordSpacing: 34,
  900. setHScale: 35,
  901. setLeading: 36,
  902. setFont: 37,
  903. setTextRenderingMode: 38,
  904. setTextRise: 39,
  905. moveText: 40,
  906. setLeadingMoveText: 41,
  907. setTextMatrix: 42,
  908. nextLine: 43,
  909. showText: 44,
  910. showSpacedText: 45,
  911. nextLineShowText: 46,
  912. nextLineSetSpacingShowText: 47,
  913. setCharWidth: 48,
  914. setCharWidthAndBounds: 49,
  915. setStrokeColorSpace: 50,
  916. setFillColorSpace: 51,
  917. setStrokeColor: 52,
  918. setStrokeColorN: 53,
  919. setFillColor: 54,
  920. setFillColorN: 55,
  921. setStrokeGray: 56,
  922. setFillGray: 57,
  923. setStrokeRGBColor: 58,
  924. setFillRGBColor: 59,
  925. setStrokeCMYKColor: 60,
  926. setFillCMYKColor: 61,
  927. shadingFill: 62,
  928. beginInlineImage: 63,
  929. beginImageData: 64,
  930. endInlineImage: 65,
  931. paintXObject: 66,
  932. markPoint: 67,
  933. markPointProps: 68,
  934. beginMarkedContent: 69,
  935. beginMarkedContentProps: 70,
  936. endMarkedContent: 71,
  937. beginCompat: 72,
  938. endCompat: 73,
  939. paintFormXObjectBegin: 74,
  940. paintFormXObjectEnd: 75,
  941. beginGroup: 76,
  942. endGroup: 77,
  943. beginAnnotations: 78,
  944. endAnnotations: 79,
  945. beginAnnotation: 80,
  946. endAnnotation: 81,
  947. paintJpegXObject: 82,
  948. paintImageMaskXObject: 83,
  949. paintImageMaskXObjectGroup: 84,
  950. paintImageXObject: 85,
  951. paintInlineImageXObject: 86,
  952. paintInlineImageXObjectGroup: 87,
  953. paintImageXObjectRepeat: 88,
  954. paintImageMaskXObjectRepeat: 89,
  955. paintSolidColorImageMask: 90,
  956. constructPath: 91
  957. };
  958. exports.OPS = OPS;
  959. const UNSUPPORTED_FEATURES = {
  960. unknown: "unknown",
  961. forms: "forms",
  962. javaScript: "javaScript",
  963. signatures: "signatures",
  964. smask: "smask",
  965. shadingPattern: "shadingPattern",
  966. font: "font",
  967. errorTilingPattern: "errorTilingPattern",
  968. errorExtGState: "errorExtGState",
  969. errorXObject: "errorXObject",
  970. errorFontLoadType3: "errorFontLoadType3",
  971. errorFontState: "errorFontState",
  972. errorFontMissing: "errorFontMissing",
  973. errorFontTranslate: "errorFontTranslate",
  974. errorColorSpace: "errorColorSpace",
  975. errorOperatorList: "errorOperatorList",
  976. errorFontToUnicode: "errorFontToUnicode",
  977. errorFontLoadNative: "errorFontLoadNative",
  978. errorFontBuildPath: "errorFontBuildPath",
  979. errorFontGetPath: "errorFontGetPath",
  980. errorMarkedContent: "errorMarkedContent",
  981. errorContentSubStream: "errorContentSubStream"
  982. };
  983. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  984. const PasswordResponses = {
  985. NEED_PASSWORD: 1,
  986. INCORRECT_PASSWORD: 2
  987. };
  988. exports.PasswordResponses = PasswordResponses;
  989. let verbosity = VerbosityLevel.WARNINGS;
  990. function setVerbosityLevel(level) {
  991. if (Number.isInteger(level)) {
  992. verbosity = level;
  993. }
  994. }
  995. function getVerbosityLevel() {
  996. return verbosity;
  997. }
  998. function info(msg) {
  999. if (verbosity >= VerbosityLevel.INFOS) {
  1000. console.log(`Info: ${msg}`);
  1001. }
  1002. }
  1003. function warn(msg) {
  1004. if (verbosity >= VerbosityLevel.WARNINGS) {
  1005. console.log(`Warning: ${msg}`);
  1006. }
  1007. }
  1008. function unreachable(msg) {
  1009. throw new Error(msg);
  1010. }
  1011. function assert(cond, msg) {
  1012. if (!cond) {
  1013. unreachable(msg);
  1014. }
  1015. }
  1016. function isSameOrigin(baseUrl, otherUrl) {
  1017. let base;
  1018. try {
  1019. base = new URL(baseUrl);
  1020. if (!base.origin || base.origin === "null") {
  1021. return false;
  1022. }
  1023. } catch (e) {
  1024. return false;
  1025. }
  1026. const other = new URL(otherUrl, base);
  1027. return base.origin === other.origin;
  1028. }
  1029. function _isValidProtocol(url) {
  1030. if (!url) {
  1031. return false;
  1032. }
  1033. switch (url.protocol) {
  1034. case "http:":
  1035. case "https:":
  1036. case "ftp:":
  1037. case "mailto:":
  1038. case "tel:":
  1039. return true;
  1040. default:
  1041. return false;
  1042. }
  1043. }
  1044. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1045. if (!url) {
  1046. return null;
  1047. }
  1048. try {
  1049. if (options && typeof url === "string") {
  1050. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1051. const dots = url.match(/\./g);
  1052. if (dots && dots.length >= 2) {
  1053. url = `http://${url}`;
  1054. }
  1055. }
  1056. if (options.tryConvertEncoding) {
  1057. try {
  1058. url = stringToUTF8String(url);
  1059. } catch (ex) {}
  1060. }
  1061. }
  1062. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1063. if (_isValidProtocol(absoluteUrl)) {
  1064. return absoluteUrl;
  1065. }
  1066. } catch (ex) {}
  1067. return null;
  1068. }
  1069. function shadow(obj, prop, value) {
  1070. Object.defineProperty(obj, prop, {
  1071. value,
  1072. enumerable: true,
  1073. configurable: true,
  1074. writable: false
  1075. });
  1076. return value;
  1077. }
  1078. const BaseException = function BaseExceptionClosure() {
  1079. function BaseException(message, name) {
  1080. if (this.constructor === BaseException) {
  1081. unreachable("Cannot initialize BaseException.");
  1082. }
  1083. this.message = message;
  1084. this.name = name;
  1085. }
  1086. BaseException.prototype = new Error();
  1087. BaseException.constructor = BaseException;
  1088. return BaseException;
  1089. }();
  1090. exports.BaseException = BaseException;
  1091. class PasswordException extends BaseException {
  1092. constructor(msg, code) {
  1093. super(msg, "PasswordException");
  1094. this.code = code;
  1095. }
  1096. }
  1097. exports.PasswordException = PasswordException;
  1098. class UnknownErrorException extends BaseException {
  1099. constructor(msg, details) {
  1100. super(msg, "UnknownErrorException");
  1101. this.details = details;
  1102. }
  1103. }
  1104. exports.UnknownErrorException = UnknownErrorException;
  1105. class InvalidPDFException extends BaseException {
  1106. constructor(msg) {
  1107. super(msg, "InvalidPDFException");
  1108. }
  1109. }
  1110. exports.InvalidPDFException = InvalidPDFException;
  1111. class MissingPDFException extends BaseException {
  1112. constructor(msg) {
  1113. super(msg, "MissingPDFException");
  1114. }
  1115. }
  1116. exports.MissingPDFException = MissingPDFException;
  1117. class UnexpectedResponseException extends BaseException {
  1118. constructor(msg, status) {
  1119. super(msg, "UnexpectedResponseException");
  1120. this.status = status;
  1121. }
  1122. }
  1123. exports.UnexpectedResponseException = UnexpectedResponseException;
  1124. class FormatError extends BaseException {
  1125. constructor(msg) {
  1126. super(msg, "FormatError");
  1127. }
  1128. }
  1129. exports.FormatError = FormatError;
  1130. class AbortException extends BaseException {
  1131. constructor(msg) {
  1132. super(msg, "AbortException");
  1133. }
  1134. }
  1135. exports.AbortException = AbortException;
  1136. const NullCharactersRegExp = /\x00+/g;
  1137. const InvisibleCharactersRegExp = /[\x01-\x1F]/g;
  1138. function removeNullCharacters(str, replaceInvisible = false) {
  1139. if (typeof str !== "string") {
  1140. warn("The argument for removeNullCharacters must be a string.");
  1141. return str;
  1142. }
  1143. if (replaceInvisible) {
  1144. str = str.replace(InvisibleCharactersRegExp, " ");
  1145. }
  1146. return str.replace(NullCharactersRegExp, "");
  1147. }
  1148. function bytesToString(bytes) {
  1149. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1150. const length = bytes.length;
  1151. const MAX_ARGUMENT_COUNT = 8192;
  1152. if (length < MAX_ARGUMENT_COUNT) {
  1153. return String.fromCharCode.apply(null, bytes);
  1154. }
  1155. const strBuf = [];
  1156. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1157. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1158. const chunk = bytes.subarray(i, chunkEnd);
  1159. strBuf.push(String.fromCharCode.apply(null, chunk));
  1160. }
  1161. return strBuf.join("");
  1162. }
  1163. function stringToBytes(str) {
  1164. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1165. const length = str.length;
  1166. const bytes = new Uint8Array(length);
  1167. for (let i = 0; i < length; ++i) {
  1168. bytes[i] = str.charCodeAt(i) & 0xff;
  1169. }
  1170. return bytes;
  1171. }
  1172. function arrayByteLength(arr) {
  1173. if (arr.length !== undefined) {
  1174. return arr.length;
  1175. }
  1176. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1177. return arr.byteLength;
  1178. }
  1179. function arraysToBytes(arr) {
  1180. const length = arr.length;
  1181. if (length === 1 && arr[0] instanceof Uint8Array) {
  1182. return arr[0];
  1183. }
  1184. let resultLength = 0;
  1185. for (let i = 0; i < length; i++) {
  1186. resultLength += arrayByteLength(arr[i]);
  1187. }
  1188. let pos = 0;
  1189. const data = new Uint8Array(resultLength);
  1190. for (let i = 0; i < length; i++) {
  1191. let item = arr[i];
  1192. if (!(item instanceof Uint8Array)) {
  1193. if (typeof item === "string") {
  1194. item = stringToBytes(item);
  1195. } else {
  1196. item = new Uint8Array(item);
  1197. }
  1198. }
  1199. const itemLength = item.byteLength;
  1200. data.set(item, pos);
  1201. pos += itemLength;
  1202. }
  1203. return data;
  1204. }
  1205. function string32(value) {
  1206. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1207. }
  1208. function objectSize(obj) {
  1209. return Object.keys(obj).length;
  1210. }
  1211. function objectFromMap(map) {
  1212. const obj = Object.create(null);
  1213. for (const [key, value] of map) {
  1214. obj[key] = value;
  1215. }
  1216. return obj;
  1217. }
  1218. function isLittleEndian() {
  1219. const buffer8 = new Uint8Array(4);
  1220. buffer8[0] = 1;
  1221. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1222. return view32[0] === 1;
  1223. }
  1224. const IsLittleEndianCached = {
  1225. get value() {
  1226. return shadow(this, "value", isLittleEndian());
  1227. }
  1228. };
  1229. exports.IsLittleEndianCached = IsLittleEndianCached;
  1230. function isEvalSupported() {
  1231. try {
  1232. new Function("");
  1233. return true;
  1234. } catch (e) {
  1235. return false;
  1236. }
  1237. }
  1238. const IsEvalSupportedCached = {
  1239. get value() {
  1240. return shadow(this, "value", isEvalSupported());
  1241. }
  1242. };
  1243. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1244. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1245. class Util {
  1246. static makeHexColor(r, g, b) {
  1247. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1248. }
  1249. static transform(m1, m2) {
  1250. 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]];
  1251. }
  1252. static applyTransform(p, m) {
  1253. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1254. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1255. return [xt, yt];
  1256. }
  1257. static applyInverseTransform(p, m) {
  1258. const d = m[0] * m[3] - m[1] * m[2];
  1259. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1260. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1261. return [xt, yt];
  1262. }
  1263. static getAxialAlignedBoundingBox(r, m) {
  1264. const p1 = Util.applyTransform(r, m);
  1265. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1266. const p3 = Util.applyTransform([r[0], r[3]], m);
  1267. const p4 = Util.applyTransform([r[2], r[1]], m);
  1268. 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])];
  1269. }
  1270. static inverseTransform(m) {
  1271. const d = m[0] * m[3] - m[1] * m[2];
  1272. 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];
  1273. }
  1274. static apply3dTransform(m, v) {
  1275. 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]];
  1276. }
  1277. static singularValueDecompose2dScale(m) {
  1278. const transpose = [m[0], m[2], m[1], m[3]];
  1279. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1280. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1281. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1282. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1283. const first = (a + d) / 2;
  1284. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1285. const sx = first + second || 1;
  1286. const sy = first - second || 1;
  1287. return [Math.sqrt(sx), Math.sqrt(sy)];
  1288. }
  1289. static normalizeRect(rect) {
  1290. const r = rect.slice(0);
  1291. if (rect[0] > rect[2]) {
  1292. r[0] = rect[2];
  1293. r[2] = rect[0];
  1294. }
  1295. if (rect[1] > rect[3]) {
  1296. r[1] = rect[3];
  1297. r[3] = rect[1];
  1298. }
  1299. return r;
  1300. }
  1301. static intersect(rect1, rect2) {
  1302. function compare(a, b) {
  1303. return a - b;
  1304. }
  1305. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1306. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1307. const result = [];
  1308. rect1 = Util.normalizeRect(rect1);
  1309. rect2 = Util.normalizeRect(rect2);
  1310. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1311. result[0] = orderedX[1];
  1312. result[2] = orderedX[2];
  1313. } else {
  1314. return null;
  1315. }
  1316. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1317. result[1] = orderedY[1];
  1318. result[3] = orderedY[2];
  1319. } else {
  1320. return null;
  1321. }
  1322. return result;
  1323. }
  1324. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1325. const tvalues = [],
  1326. bounds = [[], []];
  1327. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1328. for (let i = 0; i < 2; ++i) {
  1329. if (i === 0) {
  1330. b = 6 * x0 - 12 * x1 + 6 * x2;
  1331. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1332. c = 3 * x1 - 3 * x0;
  1333. } else {
  1334. b = 6 * y0 - 12 * y1 + 6 * y2;
  1335. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1336. c = 3 * y1 - 3 * y0;
  1337. }
  1338. if (Math.abs(a) < 1e-12) {
  1339. if (Math.abs(b) < 1e-12) {
  1340. continue;
  1341. }
  1342. t = -c / b;
  1343. if (0 < t && t < 1) {
  1344. tvalues.push(t);
  1345. }
  1346. continue;
  1347. }
  1348. b2ac = b * b - 4 * c * a;
  1349. sqrtb2ac = Math.sqrt(b2ac);
  1350. if (b2ac < 0) {
  1351. continue;
  1352. }
  1353. t1 = (-b + sqrtb2ac) / (2 * a);
  1354. if (0 < t1 && t1 < 1) {
  1355. tvalues.push(t1);
  1356. }
  1357. t2 = (-b - sqrtb2ac) / (2 * a);
  1358. if (0 < t2 && t2 < 1) {
  1359. tvalues.push(t2);
  1360. }
  1361. }
  1362. let j = tvalues.length,
  1363. mt;
  1364. const jlen = j;
  1365. while (j--) {
  1366. t = tvalues[j];
  1367. mt = 1 - t;
  1368. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1369. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1370. }
  1371. bounds[0][jlen] = x0;
  1372. bounds[1][jlen] = y0;
  1373. bounds[0][jlen + 1] = x3;
  1374. bounds[1][jlen + 1] = y3;
  1375. bounds[0].length = bounds[1].length = jlen + 2;
  1376. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1377. }
  1378. }
  1379. exports.Util = Util;
  1380. 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];
  1381. function stringToPDFString(str) {
  1382. const length = str.length,
  1383. strBuf = [];
  1384. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1385. for (let i = 2; i < length; i += 2) {
  1386. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1387. }
  1388. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1389. for (let i = 2; i < length; i += 2) {
  1390. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1391. }
  1392. } else {
  1393. for (let i = 0; i < length; ++i) {
  1394. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1395. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1396. }
  1397. }
  1398. return strBuf.join("");
  1399. }
  1400. function escapeString(str) {
  1401. return str.replace(/([()\\\n\r])/g, match => {
  1402. if (match === "\n") {
  1403. return "\\n";
  1404. } else if (match === "\r") {
  1405. return "\\r";
  1406. }
  1407. return `\\${match}`;
  1408. });
  1409. }
  1410. function isAscii(str) {
  1411. return /^[\x00-\x7F]*$/.test(str);
  1412. }
  1413. function stringToUTF16BEString(str) {
  1414. const buf = ["\xFE\xFF"];
  1415. for (let i = 0, ii = str.length; i < ii; i++) {
  1416. const char = str.charCodeAt(i);
  1417. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1418. }
  1419. return buf.join("");
  1420. }
  1421. function stringToUTF8String(str) {
  1422. return decodeURIComponent(escape(str));
  1423. }
  1424. function utf8StringToString(str) {
  1425. return unescape(encodeURIComponent(str));
  1426. }
  1427. function isBool(v) {
  1428. return typeof v === "boolean";
  1429. }
  1430. function isNum(v) {
  1431. return typeof v === "number";
  1432. }
  1433. function isString(v) {
  1434. return typeof v === "string";
  1435. }
  1436. function isArrayBuffer(v) {
  1437. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1438. }
  1439. function isArrayEqual(arr1, arr2) {
  1440. if (arr1.length !== arr2.length) {
  1441. return false;
  1442. }
  1443. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1444. if (arr1[i] !== arr2[i]) {
  1445. return false;
  1446. }
  1447. }
  1448. return true;
  1449. }
  1450. function getModificationDate(date = new Date()) {
  1451. 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")];
  1452. return buffer.join("");
  1453. }
  1454. function createPromiseCapability() {
  1455. const capability = Object.create(null);
  1456. let isSettled = false;
  1457. Object.defineProperty(capability, "settled", {
  1458. get() {
  1459. return isSettled;
  1460. }
  1461. });
  1462. capability.promise = new Promise(function (resolve, reject) {
  1463. capability.resolve = function (data) {
  1464. isSettled = true;
  1465. resolve(data);
  1466. };
  1467. capability.reject = function (reason) {
  1468. isSettled = true;
  1469. reject(reason);
  1470. };
  1471. });
  1472. return capability;
  1473. }
  1474. function createObjectURL(data, contentType = "", forceDataSchema = false) {
  1475. if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
  1476. return URL.createObjectURL(new Blob([data], {
  1477. type: contentType
  1478. }));
  1479. }
  1480. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1481. let buffer = `data:${contentType};base64,`;
  1482. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1483. const b1 = data[i] & 0xff;
  1484. const b2 = data[i + 1] & 0xff;
  1485. const b3 = data[i + 2] & 0xff;
  1486. const d1 = b1 >> 2,
  1487. d2 = (b1 & 3) << 4 | b2 >> 4;
  1488. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1489. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1490. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1491. }
  1492. return buffer;
  1493. }
  1494. /***/ }),
  1495. /* 3 */
  1496. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1497. var _is_node = __w_pdfjs_require__(4);
  1498. ;
  1499. /***/ }),
  1500. /* 4 */
  1501. /***/ ((__unused_webpack_module, exports) => {
  1502. Object.defineProperty(exports, "__esModule", ({
  1503. value: true
  1504. }));
  1505. exports.isNodeJS = void 0;
  1506. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1507. exports.isNodeJS = isNodeJS;
  1508. /***/ }),
  1509. /* 5 */
  1510. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1511. Object.defineProperty(exports, "__esModule", ({
  1512. value: true
  1513. }));
  1514. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1515. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1516. exports.isCmd = isCmd;
  1517. exports.isDict = isDict;
  1518. exports.isName = isName;
  1519. exports.isRef = isRef;
  1520. exports.isRefsEqual = isRefsEqual;
  1521. exports.isStream = isStream;
  1522. var _util = __w_pdfjs_require__(2);
  1523. var _base_stream = __w_pdfjs_require__(6);
  1524. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1525. exports.CIRCULAR_REF = CIRCULAR_REF;
  1526. const EOF = Symbol("EOF");
  1527. exports.EOF = EOF;
  1528. const Name = function NameClosure() {
  1529. let nameCache = Object.create(null);
  1530. class Name {
  1531. constructor(name) {
  1532. this.name = name;
  1533. }
  1534. static get(name) {
  1535. const nameValue = nameCache[name];
  1536. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1537. }
  1538. static _clearCache() {
  1539. nameCache = Object.create(null);
  1540. }
  1541. }
  1542. return Name;
  1543. }();
  1544. exports.Name = Name;
  1545. const Cmd = function CmdClosure() {
  1546. let cmdCache = Object.create(null);
  1547. class Cmd {
  1548. constructor(cmd) {
  1549. this.cmd = cmd;
  1550. }
  1551. static get(cmd) {
  1552. const cmdValue = cmdCache[cmd];
  1553. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1554. }
  1555. static _clearCache() {
  1556. cmdCache = Object.create(null);
  1557. }
  1558. }
  1559. return Cmd;
  1560. }();
  1561. exports.Cmd = Cmd;
  1562. const nonSerializable = function nonSerializableClosure() {
  1563. return nonSerializable;
  1564. };
  1565. class Dict {
  1566. constructor(xref = null) {
  1567. this._map = Object.create(null);
  1568. this.xref = xref;
  1569. this.objId = null;
  1570. this.suppressEncryption = false;
  1571. this.__nonSerializable__ = nonSerializable;
  1572. }
  1573. assignXref(newXref) {
  1574. this.xref = newXref;
  1575. }
  1576. get size() {
  1577. return Object.keys(this._map).length;
  1578. }
  1579. get(key1, key2, key3) {
  1580. let value = this._map[key1];
  1581. if (value === undefined && key2 !== undefined) {
  1582. value = this._map[key2];
  1583. if (value === undefined && key3 !== undefined) {
  1584. value = this._map[key3];
  1585. }
  1586. }
  1587. if (value instanceof Ref && this.xref) {
  1588. return this.xref.fetch(value, this.suppressEncryption);
  1589. }
  1590. return value;
  1591. }
  1592. async getAsync(key1, key2, key3) {
  1593. let value = this._map[key1];
  1594. if (value === undefined && key2 !== undefined) {
  1595. value = this._map[key2];
  1596. if (value === undefined && key3 !== undefined) {
  1597. value = this._map[key3];
  1598. }
  1599. }
  1600. if (value instanceof Ref && this.xref) {
  1601. return this.xref.fetchAsync(value, this.suppressEncryption);
  1602. }
  1603. return value;
  1604. }
  1605. getArray(key1, key2, key3) {
  1606. let value = this._map[key1];
  1607. if (value === undefined && key2 !== undefined) {
  1608. value = this._map[key2];
  1609. if (value === undefined && key3 !== undefined) {
  1610. value = this._map[key3];
  1611. }
  1612. }
  1613. if (value instanceof Ref && this.xref) {
  1614. value = this.xref.fetch(value, this.suppressEncryption);
  1615. }
  1616. if (Array.isArray(value)) {
  1617. value = value.slice();
  1618. for (let i = 0, ii = value.length; i < ii; i++) {
  1619. if (value[i] instanceof Ref && this.xref) {
  1620. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1621. }
  1622. }
  1623. }
  1624. return value;
  1625. }
  1626. getRaw(key) {
  1627. return this._map[key];
  1628. }
  1629. getKeys() {
  1630. return Object.keys(this._map);
  1631. }
  1632. getRawValues() {
  1633. return Object.values(this._map);
  1634. }
  1635. set(key, value) {
  1636. this._map[key] = value;
  1637. }
  1638. has(key) {
  1639. return this._map[key] !== undefined;
  1640. }
  1641. forEach(callback) {
  1642. for (const key in this._map) {
  1643. callback(key, this.get(key));
  1644. }
  1645. }
  1646. static get empty() {
  1647. const emptyDict = new Dict(null);
  1648. emptyDict.set = (key, value) => {
  1649. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1650. };
  1651. return (0, _util.shadow)(this, "empty", emptyDict);
  1652. }
  1653. static merge({
  1654. xref,
  1655. dictArray,
  1656. mergeSubDicts = false
  1657. }) {
  1658. const mergedDict = new Dict(xref),
  1659. properties = new Map();
  1660. for (const dict of dictArray) {
  1661. if (!(dict instanceof Dict)) {
  1662. continue;
  1663. }
  1664. for (const [key, value] of Object.entries(dict._map)) {
  1665. let property = properties.get(key);
  1666. if (property === undefined) {
  1667. property = [];
  1668. properties.set(key, property);
  1669. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1670. continue;
  1671. }
  1672. property.push(value);
  1673. }
  1674. }
  1675. for (const [name, values] of properties) {
  1676. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1677. mergedDict._map[name] = values[0];
  1678. continue;
  1679. }
  1680. const subDict = new Dict(xref);
  1681. for (const dict of values) {
  1682. for (const [key, value] of Object.entries(dict._map)) {
  1683. if (subDict._map[key] === undefined) {
  1684. subDict._map[key] = value;
  1685. }
  1686. }
  1687. }
  1688. if (subDict.size > 0) {
  1689. mergedDict._map[name] = subDict;
  1690. }
  1691. }
  1692. properties.clear();
  1693. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1694. }
  1695. }
  1696. exports.Dict = Dict;
  1697. const Ref = function RefClosure() {
  1698. let refCache = Object.create(null);
  1699. class Ref {
  1700. constructor(num, gen) {
  1701. this.num = num;
  1702. this.gen = gen;
  1703. }
  1704. toString() {
  1705. if (this.gen === 0) {
  1706. return `${this.num}R`;
  1707. }
  1708. return `${this.num}R${this.gen}`;
  1709. }
  1710. static get(num, gen) {
  1711. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1712. const refValue = refCache[key];
  1713. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1714. }
  1715. static _clearCache() {
  1716. refCache = Object.create(null);
  1717. }
  1718. }
  1719. return Ref;
  1720. }();
  1721. exports.Ref = Ref;
  1722. class RefSet {
  1723. constructor(parent = null) {
  1724. this._set = new Set(parent && parent._set);
  1725. }
  1726. has(ref) {
  1727. return this._set.has(ref.toString());
  1728. }
  1729. put(ref) {
  1730. this._set.add(ref.toString());
  1731. }
  1732. remove(ref) {
  1733. this._set.delete(ref.toString());
  1734. }
  1735. forEach(callback) {
  1736. for (const ref of this._set.values()) {
  1737. callback(ref);
  1738. }
  1739. }
  1740. clear() {
  1741. this._set.clear();
  1742. }
  1743. }
  1744. exports.RefSet = RefSet;
  1745. class RefSetCache {
  1746. constructor() {
  1747. this._map = new Map();
  1748. }
  1749. get size() {
  1750. return this._map.size;
  1751. }
  1752. get(ref) {
  1753. return this._map.get(ref.toString());
  1754. }
  1755. has(ref) {
  1756. return this._map.has(ref.toString());
  1757. }
  1758. put(ref, obj) {
  1759. this._map.set(ref.toString(), obj);
  1760. }
  1761. putAlias(ref, aliasRef) {
  1762. this._map.set(ref.toString(), this.get(aliasRef));
  1763. }
  1764. forEach(callback) {
  1765. for (const value of this._map.values()) {
  1766. callback(value);
  1767. }
  1768. }
  1769. clear() {
  1770. this._map.clear();
  1771. }
  1772. }
  1773. exports.RefSetCache = RefSetCache;
  1774. function isName(v, name) {
  1775. return v instanceof Name && (name === undefined || v.name === name);
  1776. }
  1777. function isCmd(v, cmd) {
  1778. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1779. }
  1780. function isDict(v, type) {
  1781. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1782. }
  1783. function isRef(v) {
  1784. return v instanceof Ref;
  1785. }
  1786. function isRefsEqual(v1, v2) {
  1787. return v1.num === v2.num && v1.gen === v2.gen;
  1788. }
  1789. function isStream(v) {
  1790. return v instanceof _base_stream.BaseStream;
  1791. }
  1792. function clearPrimitiveCaches() {
  1793. Cmd._clearCache();
  1794. Name._clearCache();
  1795. Ref._clearCache();
  1796. }
  1797. /***/ }),
  1798. /* 6 */
  1799. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1800. Object.defineProperty(exports, "__esModule", ({
  1801. value: true
  1802. }));
  1803. exports.BaseStream = void 0;
  1804. var _util = __w_pdfjs_require__(2);
  1805. class BaseStream {
  1806. constructor() {
  1807. if (this.constructor === BaseStream) {
  1808. (0, _util.unreachable)("Cannot initialize BaseStream.");
  1809. }
  1810. }
  1811. get length() {
  1812. (0, _util.unreachable)("Abstract getter `length` accessed");
  1813. }
  1814. get isEmpty() {
  1815. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  1816. }
  1817. get isDataLoaded() {
  1818. return (0, _util.shadow)(this, "isDataLoaded", true);
  1819. }
  1820. getByte() {
  1821. (0, _util.unreachable)("Abstract method `getByte` called");
  1822. }
  1823. getBytes(length, forceClamped = false) {
  1824. (0, _util.unreachable)("Abstract method `getBytes` called");
  1825. }
  1826. peekByte() {
  1827. const peekedByte = this.getByte();
  1828. if (peekedByte !== -1) {
  1829. this.pos--;
  1830. }
  1831. return peekedByte;
  1832. }
  1833. peekBytes(length, forceClamped = false) {
  1834. const bytes = this.getBytes(length, forceClamped);
  1835. this.pos -= bytes.length;
  1836. return bytes;
  1837. }
  1838. getUint16() {
  1839. const b0 = this.getByte();
  1840. const b1 = this.getByte();
  1841. if (b0 === -1 || b1 === -1) {
  1842. return -1;
  1843. }
  1844. return (b0 << 8) + b1;
  1845. }
  1846. getInt32() {
  1847. const b0 = this.getByte();
  1848. const b1 = this.getByte();
  1849. const b2 = this.getByte();
  1850. const b3 = this.getByte();
  1851. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1852. }
  1853. getByteRange(begin, end) {
  1854. (0, _util.unreachable)("Abstract method `getByteRange` called");
  1855. }
  1856. getString(length) {
  1857. return (0, _util.bytesToString)(this.getBytes(length, false));
  1858. }
  1859. skip(n) {
  1860. this.pos += n || 1;
  1861. }
  1862. reset() {
  1863. (0, _util.unreachable)("Abstract method `reset` called");
  1864. }
  1865. moveStart() {
  1866. (0, _util.unreachable)("Abstract method `moveStart` called");
  1867. }
  1868. makeSubStream(start, length, dict = null) {
  1869. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  1870. }
  1871. getBaseStreams() {
  1872. return null;
  1873. }
  1874. }
  1875. exports.BaseStream = BaseStream;
  1876. /***/ }),
  1877. /* 7 */
  1878. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1879. Object.defineProperty(exports, "__esModule", ({
  1880. value: true
  1881. }));
  1882. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1883. var _util = __w_pdfjs_require__(2);
  1884. var _chunked_stream = __w_pdfjs_require__(8);
  1885. var _core_utils = __w_pdfjs_require__(9);
  1886. var _document = __w_pdfjs_require__(11);
  1887. var _stream = __w_pdfjs_require__(10);
  1888. function parseDocBaseUrl(url) {
  1889. if (url) {
  1890. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1891. if (absoluteUrl) {
  1892. return absoluteUrl.href;
  1893. }
  1894. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1895. }
  1896. return null;
  1897. }
  1898. class BasePdfManager {
  1899. constructor() {
  1900. if (this.constructor === BasePdfManager) {
  1901. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1902. }
  1903. }
  1904. get docId() {
  1905. return this._docId;
  1906. }
  1907. get password() {
  1908. return this._password;
  1909. }
  1910. get docBaseUrl() {
  1911. return this._docBaseUrl;
  1912. }
  1913. onLoadedStream() {
  1914. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1915. }
  1916. ensureDoc(prop, args) {
  1917. return this.ensure(this.pdfDocument, prop, args);
  1918. }
  1919. ensureXRef(prop, args) {
  1920. return this.ensure(this.pdfDocument.xref, prop, args);
  1921. }
  1922. ensureCatalog(prop, args) {
  1923. return this.ensure(this.pdfDocument.catalog, prop, args);
  1924. }
  1925. getPage(pageIndex) {
  1926. return this.pdfDocument.getPage(pageIndex);
  1927. }
  1928. fontFallback(id, handler) {
  1929. return this.pdfDocument.fontFallback(id, handler);
  1930. }
  1931. loadXfaFonts(handler, task) {
  1932. return this.pdfDocument.loadXfaFonts(handler, task);
  1933. }
  1934. loadXfaImages() {
  1935. return this.pdfDocument.loadXfaImages();
  1936. }
  1937. serializeXfaData(annotationStorage) {
  1938. return this.pdfDocument.serializeXfaData(annotationStorage);
  1939. }
  1940. cleanup(manuallyTriggered = false) {
  1941. return this.pdfDocument.cleanup(manuallyTriggered);
  1942. }
  1943. async ensure(obj, prop, args) {
  1944. (0, _util.unreachable)("Abstract method `ensure` called");
  1945. }
  1946. requestRange(begin, end) {
  1947. (0, _util.unreachable)("Abstract method `requestRange` called");
  1948. }
  1949. requestLoadedStream() {
  1950. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1951. }
  1952. sendProgressiveData(chunk) {
  1953. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1954. }
  1955. updatePassword(password) {
  1956. this._password = password;
  1957. }
  1958. terminate(reason) {
  1959. (0, _util.unreachable)("Abstract method `terminate` called");
  1960. }
  1961. }
  1962. class LocalPdfManager extends BasePdfManager {
  1963. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  1964. super();
  1965. this._docId = docId;
  1966. this._password = password;
  1967. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1968. this.msgHandler = msgHandler;
  1969. this.evaluatorOptions = evaluatorOptions;
  1970. this.enableXfa = enableXfa;
  1971. const stream = new _stream.Stream(data);
  1972. this.pdfDocument = new _document.PDFDocument(this, stream);
  1973. this._loadedStreamPromise = Promise.resolve(stream);
  1974. }
  1975. async ensure(obj, prop, args) {
  1976. const value = obj[prop];
  1977. if (typeof value === "function") {
  1978. return value.apply(obj, args);
  1979. }
  1980. return value;
  1981. }
  1982. requestRange(begin, end) {
  1983. return Promise.resolve();
  1984. }
  1985. requestLoadedStream() {}
  1986. onLoadedStream() {
  1987. return this._loadedStreamPromise;
  1988. }
  1989. terminate(reason) {}
  1990. }
  1991. exports.LocalPdfManager = LocalPdfManager;
  1992. class NetworkPdfManager extends BasePdfManager {
  1993. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1994. super();
  1995. this._docId = docId;
  1996. this._password = args.password;
  1997. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1998. this.msgHandler = args.msgHandler;
  1999. this.evaluatorOptions = evaluatorOptions;
  2000. this.enableXfa = enableXfa;
  2001. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2002. msgHandler: args.msgHandler,
  2003. length: args.length,
  2004. disableAutoFetch: args.disableAutoFetch,
  2005. rangeChunkSize: args.rangeChunkSize
  2006. });
  2007. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2008. }
  2009. async ensure(obj, prop, args) {
  2010. try {
  2011. const value = obj[prop];
  2012. if (typeof value === "function") {
  2013. return value.apply(obj, args);
  2014. }
  2015. return value;
  2016. } catch (ex) {
  2017. if (!(ex instanceof _core_utils.MissingDataException)) {
  2018. throw ex;
  2019. }
  2020. await this.requestRange(ex.begin, ex.end);
  2021. return this.ensure(obj, prop, args);
  2022. }
  2023. }
  2024. requestRange(begin, end) {
  2025. return this.streamManager.requestRange(begin, end);
  2026. }
  2027. requestLoadedStream() {
  2028. this.streamManager.requestAllChunks();
  2029. }
  2030. sendProgressiveData(chunk) {
  2031. this.streamManager.onReceiveData({
  2032. chunk
  2033. });
  2034. }
  2035. onLoadedStream() {
  2036. return this.streamManager.onLoadedStream();
  2037. }
  2038. terminate(reason) {
  2039. this.streamManager.abort(reason);
  2040. }
  2041. }
  2042. exports.NetworkPdfManager = NetworkPdfManager;
  2043. /***/ }),
  2044. /* 8 */
  2045. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2046. Object.defineProperty(exports, "__esModule", ({
  2047. value: true
  2048. }));
  2049. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2050. var _util = __w_pdfjs_require__(2);
  2051. var _core_utils = __w_pdfjs_require__(9);
  2052. var _stream = __w_pdfjs_require__(10);
  2053. class ChunkedStream extends _stream.Stream {
  2054. constructor(length, chunkSize, manager) {
  2055. super(new Uint8Array(length), 0, length, null);
  2056. this.chunkSize = chunkSize;
  2057. this._loadedChunks = new Set();
  2058. this.numChunks = Math.ceil(length / chunkSize);
  2059. this.manager = manager;
  2060. this.progressiveDataLength = 0;
  2061. this.lastSuccessfulEnsureByteChunk = -1;
  2062. }
  2063. getMissingChunks() {
  2064. const chunks = [];
  2065. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2066. if (!this._loadedChunks.has(chunk)) {
  2067. chunks.push(chunk);
  2068. }
  2069. }
  2070. return chunks;
  2071. }
  2072. get numChunksLoaded() {
  2073. return this._loadedChunks.size;
  2074. }
  2075. get isDataLoaded() {
  2076. return this.numChunksLoaded === this.numChunks;
  2077. }
  2078. onReceiveData(begin, chunk) {
  2079. const chunkSize = this.chunkSize;
  2080. if (begin % chunkSize !== 0) {
  2081. throw new Error(`Bad begin offset: ${begin}`);
  2082. }
  2083. const end = begin + chunk.byteLength;
  2084. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2085. throw new Error(`Bad end offset: ${end}`);
  2086. }
  2087. this.bytes.set(new Uint8Array(chunk), begin);
  2088. const beginChunk = Math.floor(begin / chunkSize);
  2089. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2090. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2091. this._loadedChunks.add(curChunk);
  2092. }
  2093. }
  2094. onReceiveProgressiveData(data) {
  2095. let position = this.progressiveDataLength;
  2096. const beginChunk = Math.floor(position / this.chunkSize);
  2097. this.bytes.set(new Uint8Array(data), position);
  2098. position += data.byteLength;
  2099. this.progressiveDataLength = position;
  2100. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2101. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2102. this._loadedChunks.add(curChunk);
  2103. }
  2104. }
  2105. ensureByte(pos) {
  2106. if (pos < this.progressiveDataLength) {
  2107. return;
  2108. }
  2109. const chunk = Math.floor(pos / this.chunkSize);
  2110. if (chunk > this.numChunks) {
  2111. return;
  2112. }
  2113. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2114. return;
  2115. }
  2116. if (!this._loadedChunks.has(chunk)) {
  2117. throw new _core_utils.MissingDataException(pos, pos + 1);
  2118. }
  2119. this.lastSuccessfulEnsureByteChunk = chunk;
  2120. }
  2121. ensureRange(begin, end) {
  2122. if (begin >= end) {
  2123. return;
  2124. }
  2125. if (end <= this.progressiveDataLength) {
  2126. return;
  2127. }
  2128. const beginChunk = Math.floor(begin / this.chunkSize);
  2129. if (beginChunk > this.numChunks) {
  2130. return;
  2131. }
  2132. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2133. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2134. if (!this._loadedChunks.has(chunk)) {
  2135. throw new _core_utils.MissingDataException(begin, end);
  2136. }
  2137. }
  2138. }
  2139. nextEmptyChunk(beginChunk) {
  2140. const numChunks = this.numChunks;
  2141. for (let i = 0; i < numChunks; ++i) {
  2142. const chunk = (beginChunk + i) % numChunks;
  2143. if (!this._loadedChunks.has(chunk)) {
  2144. return chunk;
  2145. }
  2146. }
  2147. return null;
  2148. }
  2149. hasChunk(chunk) {
  2150. return this._loadedChunks.has(chunk);
  2151. }
  2152. getByte() {
  2153. const pos = this.pos;
  2154. if (pos >= this.end) {
  2155. return -1;
  2156. }
  2157. if (pos >= this.progressiveDataLength) {
  2158. this.ensureByte(pos);
  2159. }
  2160. return this.bytes[this.pos++];
  2161. }
  2162. getBytes(length, forceClamped = false) {
  2163. const bytes = this.bytes;
  2164. const pos = this.pos;
  2165. const strEnd = this.end;
  2166. if (!length) {
  2167. if (strEnd > this.progressiveDataLength) {
  2168. this.ensureRange(pos, strEnd);
  2169. }
  2170. const subarray = bytes.subarray(pos, strEnd);
  2171. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2172. }
  2173. let end = pos + length;
  2174. if (end > strEnd) {
  2175. end = strEnd;
  2176. }
  2177. if (end > this.progressiveDataLength) {
  2178. this.ensureRange(pos, end);
  2179. }
  2180. this.pos = end;
  2181. const subarray = bytes.subarray(pos, end);
  2182. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2183. }
  2184. getByteRange(begin, end) {
  2185. if (begin < 0) {
  2186. begin = 0;
  2187. }
  2188. if (end > this.end) {
  2189. end = this.end;
  2190. }
  2191. if (end > this.progressiveDataLength) {
  2192. this.ensureRange(begin, end);
  2193. }
  2194. return this.bytes.subarray(begin, end);
  2195. }
  2196. makeSubStream(start, length, dict = null) {
  2197. if (length) {
  2198. if (start + length > this.progressiveDataLength) {
  2199. this.ensureRange(start, start + length);
  2200. }
  2201. } else {
  2202. if (start >= this.progressiveDataLength) {
  2203. this.ensureByte(start);
  2204. }
  2205. }
  2206. function ChunkedStreamSubstream() {}
  2207. ChunkedStreamSubstream.prototype = Object.create(this);
  2208. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2209. const chunkSize = this.chunkSize;
  2210. const beginChunk = Math.floor(this.start / chunkSize);
  2211. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2212. const missingChunks = [];
  2213. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2214. if (!this._loadedChunks.has(chunk)) {
  2215. missingChunks.push(chunk);
  2216. }
  2217. }
  2218. return missingChunks;
  2219. };
  2220. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2221. get() {
  2222. if (this.numChunksLoaded === this.numChunks) {
  2223. return true;
  2224. }
  2225. return this.getMissingChunks().length === 0;
  2226. },
  2227. configurable: true
  2228. });
  2229. const subStream = new ChunkedStreamSubstream();
  2230. subStream.pos = subStream.start = start;
  2231. subStream.end = start + length || this.end;
  2232. subStream.dict = dict;
  2233. return subStream;
  2234. }
  2235. getBaseStreams() {
  2236. return [this];
  2237. }
  2238. }
  2239. exports.ChunkedStream = ChunkedStream;
  2240. class ChunkedStreamManager {
  2241. constructor(pdfNetworkStream, args) {
  2242. this.length = args.length;
  2243. this.chunkSize = args.rangeChunkSize;
  2244. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2245. this.pdfNetworkStream = pdfNetworkStream;
  2246. this.disableAutoFetch = args.disableAutoFetch;
  2247. this.msgHandler = args.msgHandler;
  2248. this.currRequestId = 0;
  2249. this._chunksNeededByRequest = new Map();
  2250. this._requestsByChunk = new Map();
  2251. this._promisesByRequest = new Map();
  2252. this.progressiveDataLength = 0;
  2253. this.aborted = false;
  2254. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2255. }
  2256. onLoadedStream() {
  2257. return this._loadedStreamCapability.promise;
  2258. }
  2259. sendRequest(begin, end) {
  2260. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2261. if (!rangeReader.isStreamingSupported) {
  2262. rangeReader.onProgress = this.onProgress.bind(this);
  2263. }
  2264. let chunks = [],
  2265. loaded = 0;
  2266. return new Promise((resolve, reject) => {
  2267. const readChunk = chunk => {
  2268. try {
  2269. if (!chunk.done) {
  2270. const data = chunk.value;
  2271. chunks.push(data);
  2272. loaded += (0, _util.arrayByteLength)(data);
  2273. if (rangeReader.isStreamingSupported) {
  2274. this.onProgress({
  2275. loaded
  2276. });
  2277. }
  2278. rangeReader.read().then(readChunk, reject);
  2279. return;
  2280. }
  2281. const chunkData = (0, _util.arraysToBytes)(chunks);
  2282. chunks = null;
  2283. resolve(chunkData);
  2284. } catch (e) {
  2285. reject(e);
  2286. }
  2287. };
  2288. rangeReader.read().then(readChunk, reject);
  2289. }).then(data => {
  2290. if (this.aborted) {
  2291. return;
  2292. }
  2293. this.onReceiveData({
  2294. chunk: data,
  2295. begin
  2296. });
  2297. });
  2298. }
  2299. requestAllChunks() {
  2300. const missingChunks = this.stream.getMissingChunks();
  2301. this._requestChunks(missingChunks);
  2302. return this._loadedStreamCapability.promise;
  2303. }
  2304. _requestChunks(chunks) {
  2305. const requestId = this.currRequestId++;
  2306. const chunksNeeded = new Set();
  2307. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2308. for (const chunk of chunks) {
  2309. if (!this.stream.hasChunk(chunk)) {
  2310. chunksNeeded.add(chunk);
  2311. }
  2312. }
  2313. if (chunksNeeded.size === 0) {
  2314. return Promise.resolve();
  2315. }
  2316. const capability = (0, _util.createPromiseCapability)();
  2317. this._promisesByRequest.set(requestId, capability);
  2318. const chunksToRequest = [];
  2319. for (const chunk of chunksNeeded) {
  2320. let requestIds = this._requestsByChunk.get(chunk);
  2321. if (!requestIds) {
  2322. requestIds = [];
  2323. this._requestsByChunk.set(chunk, requestIds);
  2324. chunksToRequest.push(chunk);
  2325. }
  2326. requestIds.push(requestId);
  2327. }
  2328. if (chunksToRequest.length > 0) {
  2329. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2330. for (const groupedChunk of groupedChunksToRequest) {
  2331. const begin = groupedChunk.beginChunk * this.chunkSize;
  2332. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2333. this.sendRequest(begin, end).catch(capability.reject);
  2334. }
  2335. }
  2336. return capability.promise.catch(reason => {
  2337. if (this.aborted) {
  2338. return;
  2339. }
  2340. throw reason;
  2341. });
  2342. }
  2343. getStream() {
  2344. return this.stream;
  2345. }
  2346. requestRange(begin, end) {
  2347. end = Math.min(end, this.length);
  2348. const beginChunk = this.getBeginChunk(begin);
  2349. const endChunk = this.getEndChunk(end);
  2350. const chunks = [];
  2351. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2352. chunks.push(chunk);
  2353. }
  2354. return this._requestChunks(chunks);
  2355. }
  2356. requestRanges(ranges = []) {
  2357. const chunksToRequest = [];
  2358. for (const range of ranges) {
  2359. const beginChunk = this.getBeginChunk(range.begin);
  2360. const endChunk = this.getEndChunk(range.end);
  2361. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2362. if (!chunksToRequest.includes(chunk)) {
  2363. chunksToRequest.push(chunk);
  2364. }
  2365. }
  2366. }
  2367. chunksToRequest.sort(function (a, b) {
  2368. return a - b;
  2369. });
  2370. return this._requestChunks(chunksToRequest);
  2371. }
  2372. groupChunks(chunks) {
  2373. const groupedChunks = [];
  2374. let beginChunk = -1;
  2375. let prevChunk = -1;
  2376. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2377. const chunk = chunks[i];
  2378. if (beginChunk < 0) {
  2379. beginChunk = chunk;
  2380. }
  2381. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2382. groupedChunks.push({
  2383. beginChunk,
  2384. endChunk: prevChunk + 1
  2385. });
  2386. beginChunk = chunk;
  2387. }
  2388. if (i + 1 === chunks.length) {
  2389. groupedChunks.push({
  2390. beginChunk,
  2391. endChunk: chunk + 1
  2392. });
  2393. }
  2394. prevChunk = chunk;
  2395. }
  2396. return groupedChunks;
  2397. }
  2398. onProgress(args) {
  2399. this.msgHandler.send("DocProgress", {
  2400. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2401. total: this.length
  2402. });
  2403. }
  2404. onReceiveData(args) {
  2405. const chunk = args.chunk;
  2406. const isProgressive = args.begin === undefined;
  2407. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2408. const end = begin + chunk.byteLength;
  2409. const beginChunk = Math.floor(begin / this.chunkSize);
  2410. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2411. if (isProgressive) {
  2412. this.stream.onReceiveProgressiveData(chunk);
  2413. this.progressiveDataLength = end;
  2414. } else {
  2415. this.stream.onReceiveData(begin, chunk);
  2416. }
  2417. if (this.stream.isDataLoaded) {
  2418. this._loadedStreamCapability.resolve(this.stream);
  2419. }
  2420. const loadedRequests = [];
  2421. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2422. const requestIds = this._requestsByChunk.get(curChunk);
  2423. if (!requestIds) {
  2424. continue;
  2425. }
  2426. this._requestsByChunk.delete(curChunk);
  2427. for (const requestId of requestIds) {
  2428. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2429. if (chunksNeeded.has(curChunk)) {
  2430. chunksNeeded.delete(curChunk);
  2431. }
  2432. if (chunksNeeded.size > 0) {
  2433. continue;
  2434. }
  2435. loadedRequests.push(requestId);
  2436. }
  2437. }
  2438. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2439. let nextEmptyChunk;
  2440. if (this.stream.numChunksLoaded === 1) {
  2441. const lastChunk = this.stream.numChunks - 1;
  2442. if (!this.stream.hasChunk(lastChunk)) {
  2443. nextEmptyChunk = lastChunk;
  2444. }
  2445. } else {
  2446. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2447. }
  2448. if (Number.isInteger(nextEmptyChunk)) {
  2449. this._requestChunks([nextEmptyChunk]);
  2450. }
  2451. }
  2452. for (const requestId of loadedRequests) {
  2453. const capability = this._promisesByRequest.get(requestId);
  2454. this._promisesByRequest.delete(requestId);
  2455. capability.resolve();
  2456. }
  2457. this.msgHandler.send("DocProgress", {
  2458. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2459. total: this.length
  2460. });
  2461. }
  2462. onError(err) {
  2463. this._loadedStreamCapability.reject(err);
  2464. }
  2465. getBeginChunk(begin) {
  2466. return Math.floor(begin / this.chunkSize);
  2467. }
  2468. getEndChunk(end) {
  2469. return Math.floor((end - 1) / this.chunkSize) + 1;
  2470. }
  2471. abort(reason) {
  2472. this.aborted = true;
  2473. if (this.pdfNetworkStream) {
  2474. this.pdfNetworkStream.cancelAllRequests(reason);
  2475. }
  2476. for (const capability of this._promisesByRequest.values()) {
  2477. capability.reject(reason);
  2478. }
  2479. }
  2480. }
  2481. exports.ChunkedStreamManager = ChunkedStreamManager;
  2482. /***/ }),
  2483. /* 9 */
  2484. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2485. Object.defineProperty(exports, "__esModule", ({
  2486. value: true
  2487. }));
  2488. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  2489. exports.collectActions = collectActions;
  2490. exports.encodeToXmlString = encodeToXmlString;
  2491. exports.escapePDFName = escapePDFName;
  2492. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2493. exports.getInheritableProperty = getInheritableProperty;
  2494. exports.getLookupTableFactory = getLookupTableFactory;
  2495. exports.isWhiteSpace = isWhiteSpace;
  2496. exports.log2 = log2;
  2497. exports.parseXFAPath = parseXFAPath;
  2498. exports.readInt8 = readInt8;
  2499. exports.readUint16 = readUint16;
  2500. exports.readUint32 = readUint32;
  2501. exports.recoverJsURL = recoverJsURL;
  2502. exports.toRomanNumerals = toRomanNumerals;
  2503. exports.validateCSSFont = validateCSSFont;
  2504. var _util = __w_pdfjs_require__(2);
  2505. var _primitives = __w_pdfjs_require__(5);
  2506. function getLookupTableFactory(initializer) {
  2507. let lookup;
  2508. return function () {
  2509. if (initializer) {
  2510. lookup = Object.create(null);
  2511. initializer(lookup);
  2512. initializer = null;
  2513. }
  2514. return lookup;
  2515. };
  2516. }
  2517. function getArrayLookupTableFactory(initializer) {
  2518. let lookup;
  2519. return function () {
  2520. if (initializer) {
  2521. let arr = initializer();
  2522. initializer = null;
  2523. lookup = Object.create(null);
  2524. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2525. lookup[arr[i]] = arr[i + 1];
  2526. }
  2527. arr = null;
  2528. }
  2529. return lookup;
  2530. };
  2531. }
  2532. class MissingDataException extends _util.BaseException {
  2533. constructor(begin, end) {
  2534. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2535. this.begin = begin;
  2536. this.end = end;
  2537. }
  2538. }
  2539. exports.MissingDataException = MissingDataException;
  2540. class ParserEOFException extends _util.BaseException {
  2541. constructor(msg) {
  2542. super(msg, "ParserEOFException");
  2543. }
  2544. }
  2545. exports.ParserEOFException = ParserEOFException;
  2546. class XRefEntryException extends _util.BaseException {
  2547. constructor(msg) {
  2548. super(msg, "XRefEntryException");
  2549. }
  2550. }
  2551. exports.XRefEntryException = XRefEntryException;
  2552. class XRefParseException extends _util.BaseException {
  2553. constructor(msg) {
  2554. super(msg, "XRefParseException");
  2555. }
  2556. }
  2557. exports.XRefParseException = XRefParseException;
  2558. class DocStats {
  2559. constructor(handler) {
  2560. this._handler = handler;
  2561. this._streamTypes = new Set();
  2562. this._fontTypes = new Set();
  2563. }
  2564. _send() {
  2565. const streamTypes = Object.create(null),
  2566. fontTypes = Object.create(null);
  2567. for (const type of this._streamTypes) {
  2568. streamTypes[type] = true;
  2569. }
  2570. for (const type of this._fontTypes) {
  2571. fontTypes[type] = true;
  2572. }
  2573. this._handler.send("DocStats", {
  2574. streamTypes,
  2575. fontTypes
  2576. });
  2577. }
  2578. addStreamType(type) {
  2579. if (this._streamTypes.has(type)) {
  2580. return;
  2581. }
  2582. this._streamTypes.add(type);
  2583. this._send();
  2584. }
  2585. addFontType(type) {
  2586. if (this._fontTypes.has(type)) {
  2587. return;
  2588. }
  2589. this._fontTypes.add(type);
  2590. this._send();
  2591. }
  2592. }
  2593. exports.DocStats = DocStats;
  2594. function getInheritableProperty({
  2595. dict,
  2596. key,
  2597. getArray = false,
  2598. stopWhenFound = true
  2599. }) {
  2600. let values;
  2601. const visited = new _primitives.RefSet();
  2602. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2603. if (dict.objId) {
  2604. visited.put(dict.objId);
  2605. }
  2606. const value = getArray ? dict.getArray(key) : dict.get(key);
  2607. if (value !== undefined) {
  2608. if (stopWhenFound) {
  2609. return value;
  2610. }
  2611. if (!values) {
  2612. values = [];
  2613. }
  2614. values.push(value);
  2615. }
  2616. dict = dict.get("Parent");
  2617. }
  2618. return values;
  2619. }
  2620. 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"];
  2621. function toRomanNumerals(number, lowerCase = false) {
  2622. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2623. const romanBuf = [];
  2624. let pos;
  2625. while (number >= 1000) {
  2626. number -= 1000;
  2627. romanBuf.push("M");
  2628. }
  2629. pos = number / 100 | 0;
  2630. number %= 100;
  2631. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2632. pos = number / 10 | 0;
  2633. number %= 10;
  2634. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2635. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2636. const romanStr = romanBuf.join("");
  2637. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2638. }
  2639. function log2(x) {
  2640. if (x <= 0) {
  2641. return 0;
  2642. }
  2643. return Math.ceil(Math.log2(x));
  2644. }
  2645. function readInt8(data, offset) {
  2646. return data[offset] << 24 >> 24;
  2647. }
  2648. function readUint16(data, offset) {
  2649. return data[offset] << 8 | data[offset + 1];
  2650. }
  2651. function readUint32(data, offset) {
  2652. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2653. }
  2654. function isWhiteSpace(ch) {
  2655. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2656. }
  2657. function parseXFAPath(path) {
  2658. const positionPattern = /(.+)\[(\d+)\]$/;
  2659. return path.split(".").map(component => {
  2660. const m = component.match(positionPattern);
  2661. if (m) {
  2662. return {
  2663. name: m[1],
  2664. pos: parseInt(m[2], 10)
  2665. };
  2666. }
  2667. return {
  2668. name: component,
  2669. pos: 0
  2670. };
  2671. });
  2672. }
  2673. function escapePDFName(str) {
  2674. const buffer = [];
  2675. let start = 0;
  2676. for (let i = 0, ii = str.length; i < ii; i++) {
  2677. const char = str.charCodeAt(i);
  2678. 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) {
  2679. if (start < i) {
  2680. buffer.push(str.substring(start, i));
  2681. }
  2682. buffer.push(`#${char.toString(16)}`);
  2683. start = i + 1;
  2684. }
  2685. }
  2686. if (buffer.length === 0) {
  2687. return str;
  2688. }
  2689. if (start < str.length) {
  2690. buffer.push(str.substring(start, str.length));
  2691. }
  2692. return buffer.join("");
  2693. }
  2694. function _collectJS(entry, xref, list, parents) {
  2695. if (!entry) {
  2696. return;
  2697. }
  2698. let parent = null;
  2699. if ((0, _primitives.isRef)(entry)) {
  2700. if (parents.has(entry)) {
  2701. return;
  2702. }
  2703. parent = entry;
  2704. parents.put(parent);
  2705. entry = xref.fetch(entry);
  2706. }
  2707. if (Array.isArray(entry)) {
  2708. for (const element of entry) {
  2709. _collectJS(element, xref, list, parents);
  2710. }
  2711. } else if (entry instanceof _primitives.Dict) {
  2712. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2713. const js = entry.get("JS");
  2714. let code;
  2715. if ((0, _primitives.isStream)(js)) {
  2716. code = js.getString();
  2717. } else {
  2718. code = js;
  2719. }
  2720. code = (0, _util.stringToPDFString)(code);
  2721. if (code) {
  2722. list.push(code);
  2723. }
  2724. }
  2725. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2726. }
  2727. if (parent) {
  2728. parents.remove(parent);
  2729. }
  2730. }
  2731. function collectActions(xref, dict, eventType) {
  2732. const actions = Object.create(null);
  2733. const additionalActionsDicts = getInheritableProperty({
  2734. dict,
  2735. key: "AA",
  2736. stopWhenFound: false
  2737. });
  2738. if (additionalActionsDicts) {
  2739. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2740. const additionalActions = additionalActionsDicts[i];
  2741. if (!(additionalActions instanceof _primitives.Dict)) {
  2742. continue;
  2743. }
  2744. for (const key of additionalActions.getKeys()) {
  2745. const action = eventType[key];
  2746. if (!action) {
  2747. continue;
  2748. }
  2749. const actionDict = additionalActions.getRaw(key);
  2750. const parents = new _primitives.RefSet();
  2751. const list = [];
  2752. _collectJS(actionDict, xref, list, parents);
  2753. if (list.length > 0) {
  2754. actions[action] = list;
  2755. }
  2756. }
  2757. }
  2758. }
  2759. if (dict.has("A")) {
  2760. const actionDict = dict.get("A");
  2761. const parents = new _primitives.RefSet();
  2762. const list = [];
  2763. _collectJS(actionDict, xref, list, parents);
  2764. if (list.length > 0) {
  2765. actions.Action = list;
  2766. }
  2767. }
  2768. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2769. }
  2770. const XMLEntities = {
  2771. 0x3c: "&lt;",
  2772. 0x3e: "&gt;",
  2773. 0x26: "&amp;",
  2774. 0x22: "&quot;",
  2775. 0x27: "&apos;"
  2776. };
  2777. function encodeToXmlString(str) {
  2778. const buffer = [];
  2779. let start = 0;
  2780. for (let i = 0, ii = str.length; i < ii; i++) {
  2781. const char = str.codePointAt(i);
  2782. if (0x20 <= char && char <= 0x7e) {
  2783. const entity = XMLEntities[char];
  2784. if (entity) {
  2785. if (start < i) {
  2786. buffer.push(str.substring(start, i));
  2787. }
  2788. buffer.push(entity);
  2789. start = i + 1;
  2790. }
  2791. } else {
  2792. if (start < i) {
  2793. buffer.push(str.substring(start, i));
  2794. }
  2795. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2796. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2797. i++;
  2798. }
  2799. start = i + 1;
  2800. }
  2801. }
  2802. if (buffer.length === 0) {
  2803. return str;
  2804. }
  2805. if (start < str.length) {
  2806. buffer.push(str.substring(start, str.length));
  2807. }
  2808. return buffer.join("");
  2809. }
  2810. function validateCSSFont(cssFontInfo) {
  2811. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2812. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2813. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2814. const {
  2815. fontFamily,
  2816. fontWeight,
  2817. italicAngle
  2818. } = cssFontInfo;
  2819. if (/^".*"$/.test(fontFamily)) {
  2820. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2821. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2822. return false;
  2823. }
  2824. } else if (/^'.*'$/.test(fontFamily)) {
  2825. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2826. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2827. return false;
  2828. }
  2829. } else {
  2830. for (const ident of fontFamily.split(/[ \t]+/)) {
  2831. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2832. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2833. return false;
  2834. }
  2835. }
  2836. }
  2837. const weight = fontWeight ? fontWeight.toString() : "";
  2838. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2839. const angle = parseFloat(italicAngle);
  2840. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2841. return true;
  2842. }
  2843. function recoverJsURL(str) {
  2844. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2845. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2846. const jsUrl = regex.exec(str);
  2847. if (jsUrl && jsUrl[2]) {
  2848. const url = jsUrl[2];
  2849. let newWindow = false;
  2850. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2851. newWindow = true;
  2852. }
  2853. return {
  2854. url,
  2855. newWindow
  2856. };
  2857. }
  2858. return null;
  2859. }
  2860. /***/ }),
  2861. /* 10 */
  2862. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2863. Object.defineProperty(exports, "__esModule", ({
  2864. value: true
  2865. }));
  2866. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2867. var _base_stream = __w_pdfjs_require__(6);
  2868. var _util = __w_pdfjs_require__(2);
  2869. class Stream extends _base_stream.BaseStream {
  2870. constructor(arrayBuffer, start, length, dict) {
  2871. super();
  2872. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2873. this.start = start || 0;
  2874. this.pos = this.start;
  2875. this.end = start + length || this.bytes.length;
  2876. this.dict = dict;
  2877. }
  2878. get length() {
  2879. return this.end - this.start;
  2880. }
  2881. get isEmpty() {
  2882. return this.length === 0;
  2883. }
  2884. getByte() {
  2885. if (this.pos >= this.end) {
  2886. return -1;
  2887. }
  2888. return this.bytes[this.pos++];
  2889. }
  2890. getBytes(length, forceClamped = false) {
  2891. const bytes = this.bytes;
  2892. const pos = this.pos;
  2893. const strEnd = this.end;
  2894. if (!length) {
  2895. const subarray = bytes.subarray(pos, strEnd);
  2896. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2897. }
  2898. let end = pos + length;
  2899. if (end > strEnd) {
  2900. end = strEnd;
  2901. }
  2902. this.pos = end;
  2903. const subarray = bytes.subarray(pos, end);
  2904. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2905. }
  2906. getByteRange(begin, end) {
  2907. if (begin < 0) {
  2908. begin = 0;
  2909. }
  2910. if (end > this.end) {
  2911. end = this.end;
  2912. }
  2913. return this.bytes.subarray(begin, end);
  2914. }
  2915. reset() {
  2916. this.pos = this.start;
  2917. }
  2918. moveStart() {
  2919. this.start = this.pos;
  2920. }
  2921. makeSubStream(start, length, dict = null) {
  2922. return new Stream(this.bytes.buffer, start, length, dict);
  2923. }
  2924. }
  2925. exports.Stream = Stream;
  2926. class StringStream extends Stream {
  2927. constructor(str) {
  2928. super((0, _util.stringToBytes)(str));
  2929. }
  2930. }
  2931. exports.StringStream = StringStream;
  2932. class NullStream extends Stream {
  2933. constructor() {
  2934. super(new Uint8Array(0));
  2935. }
  2936. }
  2937. exports.NullStream = NullStream;
  2938. /***/ }),
  2939. /* 11 */
  2940. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2941. Object.defineProperty(exports, "__esModule", ({
  2942. value: true
  2943. }));
  2944. exports.Page = exports.PDFDocument = void 0;
  2945. var _util = __w_pdfjs_require__(2);
  2946. var _primitives = __w_pdfjs_require__(5);
  2947. var _core_utils = __w_pdfjs_require__(9);
  2948. var _xfa_fonts = __w_pdfjs_require__(12);
  2949. var _stream = __w_pdfjs_require__(10);
  2950. var _annotation = __w_pdfjs_require__(22);
  2951. var _base_stream = __w_pdfjs_require__(6);
  2952. var _crypto = __w_pdfjs_require__(72);
  2953. var _catalog = __w_pdfjs_require__(64);
  2954. var _parser = __w_pdfjs_require__(27);
  2955. var _object_loader = __w_pdfjs_require__(70);
  2956. var _operator_list = __w_pdfjs_require__(62);
  2957. var _evaluator = __w_pdfjs_require__(25);
  2958. var _decode_stream = __w_pdfjs_require__(29);
  2959. var _struct_tree = __w_pdfjs_require__(69);
  2960. var _factory = __w_pdfjs_require__(74);
  2961. var _xref = __w_pdfjs_require__(98);
  2962. const DEFAULT_USER_UNIT = 1.0;
  2963. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2964. class Page {
  2965. constructor({
  2966. pdfManager,
  2967. xref,
  2968. pageIndex,
  2969. pageDict,
  2970. ref,
  2971. globalIdFactory,
  2972. fontCache,
  2973. builtInCMapCache,
  2974. standardFontDataCache,
  2975. globalImageCache,
  2976. nonBlendModesSet,
  2977. xfaFactory
  2978. }) {
  2979. this.pdfManager = pdfManager;
  2980. this.pageIndex = pageIndex;
  2981. this.pageDict = pageDict;
  2982. this.xref = xref;
  2983. this.ref = ref;
  2984. this.fontCache = fontCache;
  2985. this.builtInCMapCache = builtInCMapCache;
  2986. this.standardFontDataCache = standardFontDataCache;
  2987. this.globalImageCache = globalImageCache;
  2988. this.nonBlendModesSet = nonBlendModesSet;
  2989. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2990. this.resourcesPromise = null;
  2991. this.xfaFactory = xfaFactory;
  2992. const idCounters = {
  2993. obj: 0
  2994. };
  2995. this._localIdFactory = class extends globalIdFactory {
  2996. static createObjId() {
  2997. return `p${pageIndex}_${++idCounters.obj}`;
  2998. }
  2999. static getPageObjId() {
  3000. return `page${ref.toString()}`;
  3001. }
  3002. };
  3003. }
  3004. _getInheritableProperty(key, getArray = false) {
  3005. const value = (0, _core_utils.getInheritableProperty)({
  3006. dict: this.pageDict,
  3007. key,
  3008. getArray,
  3009. stopWhenFound: false
  3010. });
  3011. if (!Array.isArray(value)) {
  3012. return value;
  3013. }
  3014. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  3015. return value[0];
  3016. }
  3017. return _primitives.Dict.merge({
  3018. xref: this.xref,
  3019. dictArray: value
  3020. });
  3021. }
  3022. get content() {
  3023. return this.pageDict.getArray("Contents");
  3024. }
  3025. get resources() {
  3026. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  3027. }
  3028. _getBoundingBox(name) {
  3029. if (this.xfaData) {
  3030. return this.xfaData.bbox;
  3031. }
  3032. const box = this._getInheritableProperty(name, true);
  3033. if (Array.isArray(box) && box.length === 4) {
  3034. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3035. return box;
  3036. }
  3037. (0, _util.warn)(`Empty /${name} entry.`);
  3038. }
  3039. return null;
  3040. }
  3041. get mediaBox() {
  3042. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3043. }
  3044. get cropBox() {
  3045. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3046. }
  3047. get userUnit() {
  3048. let obj = this.pageDict.get("UserUnit");
  3049. if (!(0, _util.isNum)(obj) || obj <= 0) {
  3050. obj = DEFAULT_USER_UNIT;
  3051. }
  3052. return (0, _util.shadow)(this, "userUnit", obj);
  3053. }
  3054. get view() {
  3055. const {
  3056. cropBox,
  3057. mediaBox
  3058. } = this;
  3059. let view;
  3060. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3061. view = mediaBox;
  3062. } else {
  3063. const box = _util.Util.intersect(cropBox, mediaBox);
  3064. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3065. view = box;
  3066. } else {
  3067. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3068. }
  3069. }
  3070. return (0, _util.shadow)(this, "view", view || mediaBox);
  3071. }
  3072. get rotate() {
  3073. let rotate = this._getInheritableProperty("Rotate") || 0;
  3074. if (rotate % 90 !== 0) {
  3075. rotate = 0;
  3076. } else if (rotate >= 360) {
  3077. rotate %= 360;
  3078. } else if (rotate < 0) {
  3079. rotate = (rotate % 360 + 360) % 360;
  3080. }
  3081. return (0, _util.shadow)(this, "rotate", rotate);
  3082. }
  3083. _onSubStreamError(handler, reason, objId) {
  3084. if (this.evaluatorOptions.ignoreErrors) {
  3085. handler.send("UnsupportedFeature", {
  3086. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3087. });
  3088. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3089. return;
  3090. }
  3091. throw reason;
  3092. }
  3093. getContentStream(handler) {
  3094. return this.pdfManager.ensure(this, "content").then(content => {
  3095. if (content instanceof _base_stream.BaseStream) {
  3096. return content;
  3097. }
  3098. if (Array.isArray(content)) {
  3099. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3100. }
  3101. return new _stream.NullStream();
  3102. });
  3103. }
  3104. get xfaData() {
  3105. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3106. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3107. } : null);
  3108. }
  3109. save(handler, task, annotationStorage) {
  3110. const partialEvaluator = new _evaluator.PartialEvaluator({
  3111. xref: this.xref,
  3112. handler,
  3113. pageIndex: this.pageIndex,
  3114. idFactory: this._localIdFactory,
  3115. fontCache: this.fontCache,
  3116. builtInCMapCache: this.builtInCMapCache,
  3117. standardFontDataCache: this.standardFontDataCache,
  3118. globalImageCache: this.globalImageCache,
  3119. options: this.evaluatorOptions
  3120. });
  3121. return this._parsedAnnotations.then(function (annotations) {
  3122. const newRefsPromises = [];
  3123. for (const annotation of annotations) {
  3124. if (!annotation.mustBePrinted(annotationStorage)) {
  3125. continue;
  3126. }
  3127. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3128. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3129. return null;
  3130. }));
  3131. }
  3132. return Promise.all(newRefsPromises);
  3133. });
  3134. }
  3135. loadResources(keys) {
  3136. if (!this.resourcesPromise) {
  3137. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3138. }
  3139. return this.resourcesPromise.then(() => {
  3140. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3141. return objectLoader.load();
  3142. });
  3143. }
  3144. getOperatorList({
  3145. handler,
  3146. sink,
  3147. task,
  3148. intent,
  3149. cacheKey,
  3150. annotationStorage = null
  3151. }) {
  3152. const contentStreamPromise = this.getContentStream(handler);
  3153. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3154. const partialEvaluator = new _evaluator.PartialEvaluator({
  3155. xref: this.xref,
  3156. handler,
  3157. pageIndex: this.pageIndex,
  3158. idFactory: this._localIdFactory,
  3159. fontCache: this.fontCache,
  3160. builtInCMapCache: this.builtInCMapCache,
  3161. standardFontDataCache: this.standardFontDataCache,
  3162. globalImageCache: this.globalImageCache,
  3163. options: this.evaluatorOptions
  3164. });
  3165. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3166. const pageListPromise = dataPromises.then(([contentStream]) => {
  3167. const opList = new _operator_list.OperatorList(intent, sink);
  3168. handler.send("StartRenderPage", {
  3169. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3170. pageIndex: this.pageIndex,
  3171. cacheKey
  3172. });
  3173. return partialEvaluator.getOperatorList({
  3174. stream: contentStream,
  3175. task,
  3176. resources: this.resources,
  3177. operatorList: opList
  3178. }).then(function () {
  3179. return opList;
  3180. });
  3181. });
  3182. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3183. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3184. pageOpList.flush(true);
  3185. return {
  3186. length: pageOpList.totalLength
  3187. };
  3188. }
  3189. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3190. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3191. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3192. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3193. const opListPromises = [];
  3194. for (const annotation of annotations) {
  3195. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3196. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3197. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3198. return null;
  3199. }));
  3200. }
  3201. }
  3202. return Promise.all(opListPromises).then(function (opLists) {
  3203. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3204. for (const opList of opLists) {
  3205. pageOpList.addOpList(opList);
  3206. }
  3207. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3208. pageOpList.flush(true);
  3209. return {
  3210. length: pageOpList.totalLength
  3211. };
  3212. });
  3213. });
  3214. }
  3215. extractTextContent({
  3216. handler,
  3217. task,
  3218. normalizeWhitespace,
  3219. includeMarkedContent,
  3220. sink,
  3221. combineTextItems
  3222. }) {
  3223. const contentStreamPromise = this.getContentStream(handler);
  3224. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3225. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3226. return dataPromises.then(([contentStream]) => {
  3227. const partialEvaluator = new _evaluator.PartialEvaluator({
  3228. xref: this.xref,
  3229. handler,
  3230. pageIndex: this.pageIndex,
  3231. idFactory: this._localIdFactory,
  3232. fontCache: this.fontCache,
  3233. builtInCMapCache: this.builtInCMapCache,
  3234. standardFontDataCache: this.standardFontDataCache,
  3235. globalImageCache: this.globalImageCache,
  3236. options: this.evaluatorOptions
  3237. });
  3238. return partialEvaluator.getTextContent({
  3239. stream: contentStream,
  3240. task,
  3241. resources: this.resources,
  3242. normalizeWhitespace,
  3243. includeMarkedContent,
  3244. combineTextItems,
  3245. sink
  3246. });
  3247. });
  3248. }
  3249. async getStructTree() {
  3250. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3251. if (!structTreeRoot) {
  3252. return null;
  3253. }
  3254. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3255. return structTree.serializable;
  3256. }
  3257. _parseStructTree(structTreeRoot) {
  3258. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3259. tree.parse();
  3260. return tree;
  3261. }
  3262. getAnnotationsData(intent) {
  3263. return this._parsedAnnotations.then(function (annotations) {
  3264. const annotationsData = [];
  3265. if (annotations.length === 0) {
  3266. return annotationsData;
  3267. }
  3268. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3269. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3270. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3271. for (const annotation of annotations) {
  3272. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3273. annotationsData.push(annotation.data);
  3274. }
  3275. }
  3276. return annotationsData;
  3277. });
  3278. }
  3279. get annotations() {
  3280. const annots = this._getInheritableProperty("Annots");
  3281. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3282. }
  3283. get _parsedAnnotations() {
  3284. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3285. const annotationPromises = [];
  3286. for (const annotationRef of this.annotations) {
  3287. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3288. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3289. return null;
  3290. }));
  3291. }
  3292. return Promise.all(annotationPromises).then(function (annotations) {
  3293. return annotations.filter(annotation => !!annotation);
  3294. });
  3295. });
  3296. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3297. }
  3298. get jsActions() {
  3299. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3300. return (0, _util.shadow)(this, "jsActions", actions);
  3301. }
  3302. }
  3303. exports.Page = Page;
  3304. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3305. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3306. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3307. const FINGERPRINT_FIRST_BYTES = 1024;
  3308. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3309. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3310. function find(stream, signature, limit = 1024, backwards = false) {
  3311. const signatureLength = signature.length;
  3312. const scanBytes = stream.peekBytes(limit);
  3313. const scanLength = scanBytes.length - signatureLength;
  3314. if (scanLength <= 0) {
  3315. return false;
  3316. }
  3317. if (backwards) {
  3318. const signatureEnd = signatureLength - 1;
  3319. let pos = scanBytes.length - 1;
  3320. while (pos >= signatureEnd) {
  3321. let j = 0;
  3322. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3323. j++;
  3324. }
  3325. if (j >= signatureLength) {
  3326. stream.pos += pos - signatureEnd;
  3327. return true;
  3328. }
  3329. pos--;
  3330. }
  3331. } else {
  3332. let pos = 0;
  3333. while (pos <= scanLength) {
  3334. let j = 0;
  3335. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3336. j++;
  3337. }
  3338. if (j >= signatureLength) {
  3339. stream.pos += pos;
  3340. return true;
  3341. }
  3342. pos++;
  3343. }
  3344. }
  3345. return false;
  3346. }
  3347. class PDFDocument {
  3348. constructor(pdfManager, arg) {
  3349. let stream;
  3350. if ((0, _primitives.isStream)(arg)) {
  3351. stream = arg;
  3352. } else if ((0, _util.isArrayBuffer)(arg)) {
  3353. stream = new _stream.Stream(arg);
  3354. } else {
  3355. throw new Error("PDFDocument: Unknown argument type");
  3356. }
  3357. if (stream.length <= 0) {
  3358. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3359. }
  3360. this.pdfManager = pdfManager;
  3361. this.stream = stream;
  3362. this.xref = new _xref.XRef(stream, pdfManager);
  3363. this._pagePromises = new Map();
  3364. this._version = null;
  3365. const idCounters = {
  3366. font: 0
  3367. };
  3368. this._globalIdFactory = class {
  3369. static getDocId() {
  3370. return `g_${pdfManager.docId}`;
  3371. }
  3372. static createFontId() {
  3373. return `f${++idCounters.font}`;
  3374. }
  3375. static createObjId() {
  3376. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3377. }
  3378. static getPageObjId() {
  3379. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3380. }
  3381. };
  3382. }
  3383. parse(recoveryMode) {
  3384. this.xref.parse(recoveryMode);
  3385. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3386. if (this.catalog.version) {
  3387. this._version = this.catalog.version;
  3388. }
  3389. }
  3390. get linearization() {
  3391. let linearization = null;
  3392. try {
  3393. linearization = _parser.Linearization.create(this.stream);
  3394. } catch (err) {
  3395. if (err instanceof _core_utils.MissingDataException) {
  3396. throw err;
  3397. }
  3398. (0, _util.info)(err);
  3399. }
  3400. return (0, _util.shadow)(this, "linearization", linearization);
  3401. }
  3402. get startXRef() {
  3403. const stream = this.stream;
  3404. let startXRef = 0;
  3405. if (this.linearization) {
  3406. stream.reset();
  3407. if (find(stream, ENDOBJ_SIGNATURE)) {
  3408. startXRef = stream.pos + 6 - stream.start;
  3409. }
  3410. } else {
  3411. const step = 1024;
  3412. const startXRefLength = STARTXREF_SIGNATURE.length;
  3413. let found = false,
  3414. pos = stream.end;
  3415. while (!found && pos > 0) {
  3416. pos -= step - startXRefLength;
  3417. if (pos < 0) {
  3418. pos = 0;
  3419. }
  3420. stream.pos = pos;
  3421. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3422. }
  3423. if (found) {
  3424. stream.skip(9);
  3425. let ch;
  3426. do {
  3427. ch = stream.getByte();
  3428. } while ((0, _core_utils.isWhiteSpace)(ch));
  3429. let str = "";
  3430. while (ch >= 0x20 && ch <= 0x39) {
  3431. str += String.fromCharCode(ch);
  3432. ch = stream.getByte();
  3433. }
  3434. startXRef = parseInt(str, 10);
  3435. if (isNaN(startXRef)) {
  3436. startXRef = 0;
  3437. }
  3438. }
  3439. }
  3440. return (0, _util.shadow)(this, "startXRef", startXRef);
  3441. }
  3442. checkHeader() {
  3443. const stream = this.stream;
  3444. stream.reset();
  3445. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3446. return;
  3447. }
  3448. stream.moveStart();
  3449. const MAX_PDF_VERSION_LENGTH = 12;
  3450. let version = "",
  3451. ch;
  3452. while ((ch = stream.getByte()) > 0x20) {
  3453. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3454. break;
  3455. }
  3456. version += String.fromCharCode(ch);
  3457. }
  3458. if (!this._version) {
  3459. this._version = version.substring(5);
  3460. }
  3461. }
  3462. parseStartXRef() {
  3463. this.xref.setStartXRef(this.startXRef);
  3464. }
  3465. get numPages() {
  3466. let num = 0;
  3467. if (this.catalog.hasActualNumPages) {
  3468. num = this.catalog.numPages;
  3469. } else if (this.xfaFactory) {
  3470. num = this.xfaFactory.getNumPages();
  3471. } else if (this.linearization) {
  3472. num = this.linearization.numPages;
  3473. } else {
  3474. num = this.catalog.numPages;
  3475. }
  3476. return (0, _util.shadow)(this, "numPages", num);
  3477. }
  3478. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3479. const RECURSION_LIMIT = 10;
  3480. if (!Array.isArray(fields)) {
  3481. return false;
  3482. }
  3483. return fields.every(field => {
  3484. field = this.xref.fetchIfRef(field);
  3485. if (!(field instanceof _primitives.Dict)) {
  3486. return false;
  3487. }
  3488. if (field.has("Kids")) {
  3489. if (++recursionDepth > RECURSION_LIMIT) {
  3490. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3491. return false;
  3492. }
  3493. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3494. }
  3495. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3496. const rectangle = field.get("Rect");
  3497. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3498. return isSignature && isInvisible;
  3499. });
  3500. }
  3501. get xfaData() {
  3502. const acroForm = this.catalog.acroForm;
  3503. if (!acroForm) {
  3504. return null;
  3505. }
  3506. const xfa = acroForm.get("XFA");
  3507. const entries = {
  3508. "xdp:xdp": "",
  3509. template: "",
  3510. datasets: "",
  3511. config: "",
  3512. connectionSet: "",
  3513. localeSet: "",
  3514. stylesheet: "",
  3515. "/xdp:xdp": ""
  3516. };
  3517. if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) {
  3518. try {
  3519. entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString());
  3520. return entries;
  3521. } catch (_) {
  3522. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3523. return null;
  3524. }
  3525. }
  3526. if (!Array.isArray(xfa) || xfa.length === 0) {
  3527. return null;
  3528. }
  3529. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3530. let name;
  3531. if (i === 0) {
  3532. name = "xdp:xdp";
  3533. } else if (i === ii - 2) {
  3534. name = "/xdp:xdp";
  3535. } else {
  3536. name = xfa[i];
  3537. }
  3538. if (!entries.hasOwnProperty(name)) {
  3539. continue;
  3540. }
  3541. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3542. if (!(0, _primitives.isStream)(data) || data.isEmpty) {
  3543. continue;
  3544. }
  3545. try {
  3546. entries[name] = (0, _util.stringToUTF8String)(data.getString());
  3547. } catch (_) {
  3548. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3549. return null;
  3550. }
  3551. }
  3552. return entries;
  3553. }
  3554. get xfaFactory() {
  3555. let data;
  3556. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3557. data = this.xfaData;
  3558. }
  3559. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3560. }
  3561. get isPureXfa() {
  3562. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3563. }
  3564. get htmlForXfa() {
  3565. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3566. }
  3567. async loadXfaImages() {
  3568. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3569. if (!xfaImagesDict) {
  3570. return;
  3571. }
  3572. const keys = xfaImagesDict.getKeys();
  3573. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3574. await objectLoader.load();
  3575. const xfaImages = new Map();
  3576. for (const key of keys) {
  3577. const stream = xfaImagesDict.get(key);
  3578. if (!(0, _primitives.isStream)(stream)) {
  3579. continue;
  3580. }
  3581. xfaImages.set(key, stream.getBytes());
  3582. }
  3583. this.xfaFactory.setImages(xfaImages);
  3584. }
  3585. async loadXfaFonts(handler, task) {
  3586. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3587. if (!acroForm) {
  3588. return;
  3589. }
  3590. const resources = await acroForm.getAsync("DR");
  3591. if (!(resources instanceof _primitives.Dict)) {
  3592. return;
  3593. }
  3594. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3595. await objectLoader.load();
  3596. const fontRes = resources.get("Font");
  3597. if (!(fontRes instanceof _primitives.Dict)) {
  3598. return;
  3599. }
  3600. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3601. options.useSystemFonts = false;
  3602. const partialEvaluator = new _evaluator.PartialEvaluator({
  3603. xref: this.xref,
  3604. handler,
  3605. pageIndex: -1,
  3606. idFactory: this._globalIdFactory,
  3607. fontCache: this.catalog.fontCache,
  3608. builtInCMapCache: this.catalog.builtInCMapCache,
  3609. standardFontDataCache: this.catalog.standardFontDataCache,
  3610. options
  3611. });
  3612. const operatorList = new _operator_list.OperatorList();
  3613. const pdfFonts = [];
  3614. const initialState = {
  3615. get font() {
  3616. return pdfFonts[pdfFonts.length - 1];
  3617. },
  3618. set font(font) {
  3619. pdfFonts.push(font);
  3620. },
  3621. clone() {
  3622. return this;
  3623. }
  3624. };
  3625. const fonts = new Map();
  3626. fontRes.forEach((fontName, font) => {
  3627. fonts.set(fontName, font);
  3628. });
  3629. const promises = [];
  3630. for (const [fontName, font] of fonts) {
  3631. const descriptor = font.get("FontDescriptor");
  3632. if (!(descriptor instanceof _primitives.Dict)) {
  3633. continue;
  3634. }
  3635. let fontFamily = descriptor.get("FontFamily");
  3636. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3637. const fontWeight = descriptor.get("FontWeight");
  3638. const italicAngle = -descriptor.get("ItalicAngle");
  3639. const cssFontInfo = {
  3640. fontFamily,
  3641. fontWeight,
  3642. italicAngle
  3643. };
  3644. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3645. continue;
  3646. }
  3647. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3648. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3649. return null;
  3650. }));
  3651. }
  3652. await Promise.all(promises);
  3653. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3654. if (!missingFonts) {
  3655. return;
  3656. }
  3657. options.ignoreErrors = true;
  3658. promises.length = 0;
  3659. pdfFonts.length = 0;
  3660. const reallyMissingFonts = new Set();
  3661. for (const missing of missingFonts) {
  3662. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3663. reallyMissingFonts.add(missing);
  3664. }
  3665. }
  3666. if (reallyMissingFonts.size) {
  3667. missingFonts.push("PdfJS-Fallback");
  3668. }
  3669. for (const missing of missingFonts) {
  3670. if (reallyMissingFonts.has(missing)) {
  3671. continue;
  3672. }
  3673. for (const fontInfo of [{
  3674. name: "Regular",
  3675. fontWeight: 400,
  3676. italicAngle: 0
  3677. }, {
  3678. name: "Bold",
  3679. fontWeight: 700,
  3680. italicAngle: 0
  3681. }, {
  3682. name: "Italic",
  3683. fontWeight: 400,
  3684. italicAngle: 12
  3685. }, {
  3686. name: "BoldItalic",
  3687. fontWeight: 700,
  3688. italicAngle: 12
  3689. }]) {
  3690. const name = `${missing}-${fontInfo.name}`;
  3691. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3692. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3693. fontFamily: missing,
  3694. fontWeight: fontInfo.fontWeight,
  3695. italicAngle: fontInfo.italicAngle
  3696. }).catch(function (reason) {
  3697. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3698. return null;
  3699. }));
  3700. }
  3701. }
  3702. await Promise.all(promises);
  3703. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3704. }
  3705. async serializeXfaData(annotationStorage) {
  3706. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3707. }
  3708. get formInfo() {
  3709. const formInfo = {
  3710. hasFields: false,
  3711. hasAcroForm: false,
  3712. hasXfa: false,
  3713. hasSignatures: false
  3714. };
  3715. const acroForm = this.catalog.acroForm;
  3716. if (!acroForm) {
  3717. return (0, _util.shadow)(this, "formInfo", formInfo);
  3718. }
  3719. try {
  3720. const fields = acroForm.get("Fields");
  3721. const hasFields = Array.isArray(fields) && fields.length > 0;
  3722. formInfo.hasFields = hasFields;
  3723. const xfa = acroForm.get("XFA");
  3724. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3725. const sigFlags = acroForm.get("SigFlags");
  3726. const hasSignatures = !!(sigFlags & 0x1);
  3727. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3728. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3729. formInfo.hasSignatures = hasSignatures;
  3730. } catch (ex) {
  3731. if (ex instanceof _core_utils.MissingDataException) {
  3732. throw ex;
  3733. }
  3734. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3735. }
  3736. return (0, _util.shadow)(this, "formInfo", formInfo);
  3737. }
  3738. get documentInfo() {
  3739. const DocumentInfoValidators = {
  3740. Title: _util.isString,
  3741. Author: _util.isString,
  3742. Subject: _util.isString,
  3743. Keywords: _util.isString,
  3744. Creator: _util.isString,
  3745. Producer: _util.isString,
  3746. CreationDate: _util.isString,
  3747. ModDate: _util.isString,
  3748. Trapped: _primitives.isName
  3749. };
  3750. let version = this._version;
  3751. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3752. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3753. version = null;
  3754. }
  3755. const docInfo = {
  3756. PDFFormatVersion: version,
  3757. Language: this.catalog.lang,
  3758. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3759. IsLinearized: !!this.linearization,
  3760. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3761. IsXFAPresent: this.formInfo.hasXfa,
  3762. IsCollectionPresent: !!this.catalog.collection,
  3763. IsSignaturesPresent: this.formInfo.hasSignatures
  3764. };
  3765. let infoDict;
  3766. try {
  3767. infoDict = this.xref.trailer.get("Info");
  3768. } catch (err) {
  3769. if (err instanceof _core_utils.MissingDataException) {
  3770. throw err;
  3771. }
  3772. (0, _util.info)("The document information dictionary is invalid.");
  3773. }
  3774. if ((0, _primitives.isDict)(infoDict)) {
  3775. for (const key of infoDict.getKeys()) {
  3776. const value = infoDict.get(key);
  3777. if (DocumentInfoValidators[key]) {
  3778. if (DocumentInfoValidators[key](value)) {
  3779. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3780. } else {
  3781. (0, _util.info)(`Bad value in document info for "${key}".`);
  3782. }
  3783. } else if (typeof key === "string") {
  3784. let customValue;
  3785. if ((0, _util.isString)(value)) {
  3786. customValue = (0, _util.stringToPDFString)(value);
  3787. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3788. customValue = value;
  3789. } else {
  3790. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3791. continue;
  3792. }
  3793. if (!docInfo.Custom) {
  3794. docInfo.Custom = Object.create(null);
  3795. }
  3796. docInfo.Custom[key] = customValue;
  3797. }
  3798. }
  3799. }
  3800. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3801. }
  3802. get fingerprints() {
  3803. function validate(data) {
  3804. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3805. }
  3806. function hexString(hash) {
  3807. const buf = [];
  3808. for (let i = 0, ii = hash.length; i < ii; i++) {
  3809. const hex = hash[i].toString(16);
  3810. buf.push(hex.padStart(2, "0"));
  3811. }
  3812. return buf.join("");
  3813. }
  3814. const idArray = this.xref.trailer.get("ID");
  3815. let hashOriginal, hashModified;
  3816. if (Array.isArray(idArray) && validate(idArray[0])) {
  3817. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3818. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3819. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3820. }
  3821. } else {
  3822. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3823. }
  3824. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3825. }
  3826. async _getLinearizationPage(pageIndex) {
  3827. const {
  3828. catalog,
  3829. linearization
  3830. } = this;
  3831. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3832. try {
  3833. const obj = await this.xref.fetchAsync(ref);
  3834. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3835. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3836. catalog.pageKidsCountCache.put(ref, 1);
  3837. }
  3838. return [obj, ref];
  3839. }
  3840. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3841. } catch (reason) {
  3842. (0, _util.info)(reason);
  3843. return catalog.getPageDict(pageIndex);
  3844. }
  3845. }
  3846. getPage(pageIndex) {
  3847. const cachedPromise = this._pagePromises.get(pageIndex);
  3848. if (cachedPromise) {
  3849. return cachedPromise;
  3850. }
  3851. const {
  3852. catalog,
  3853. linearization,
  3854. xfaFactory
  3855. } = this;
  3856. let promise;
  3857. if (xfaFactory) {
  3858. promise = Promise.resolve([_primitives.Dict.empty, null]);
  3859. } else if (linearization && linearization.pageFirst === pageIndex) {
  3860. promise = this._getLinearizationPage(pageIndex);
  3861. } else {
  3862. promise = catalog.getPageDict(pageIndex);
  3863. }
  3864. promise = promise.then(([pageDict, ref]) => {
  3865. return new Page({
  3866. pdfManager: this.pdfManager,
  3867. xref: this.xref,
  3868. pageIndex,
  3869. pageDict,
  3870. ref,
  3871. globalIdFactory: this._globalIdFactory,
  3872. fontCache: catalog.fontCache,
  3873. builtInCMapCache: catalog.builtInCMapCache,
  3874. standardFontDataCache: catalog.standardFontDataCache,
  3875. globalImageCache: catalog.globalImageCache,
  3876. nonBlendModesSet: catalog.nonBlendModesSet,
  3877. xfaFactory
  3878. });
  3879. });
  3880. this._pagePromises.set(pageIndex, promise);
  3881. return promise;
  3882. }
  3883. async checkFirstPage(recoveryMode = false) {
  3884. if (recoveryMode) {
  3885. return;
  3886. }
  3887. try {
  3888. await this.getPage(0);
  3889. } catch (reason) {
  3890. if (reason instanceof _core_utils.XRefEntryException) {
  3891. this._pagePromises.delete(0);
  3892. await this.cleanup();
  3893. throw new _core_utils.XRefParseException();
  3894. }
  3895. }
  3896. }
  3897. async checkLastPage(recoveryMode = false) {
  3898. const {
  3899. catalog,
  3900. pdfManager
  3901. } = this;
  3902. catalog.setActualNumPages();
  3903. let numPages;
  3904. try {
  3905. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  3906. if (this.xfaFactory) {
  3907. return;
  3908. } else if (this.linearization) {
  3909. numPages = this.linearization.numPages;
  3910. } else {
  3911. numPages = catalog.numPages;
  3912. }
  3913. if (!Number.isInteger(numPages)) {
  3914. throw new _util.FormatError("Page count is not an integer.");
  3915. } else if (numPages <= 1) {
  3916. return;
  3917. }
  3918. await this.getPage(numPages - 1);
  3919. } catch (reason) {
  3920. this._pagePromises.delete(numPages - 1);
  3921. await this.cleanup();
  3922. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3923. throw new _core_utils.XRefParseException();
  3924. }
  3925. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  3926. let pagesTree;
  3927. try {
  3928. pagesTree = await pdfManager.ensureCatalog("getAllPageDicts", [recoveryMode]);
  3929. } catch (reasonAll) {
  3930. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3931. throw new _core_utils.XRefParseException();
  3932. }
  3933. catalog.setActualNumPages(1);
  3934. return;
  3935. }
  3936. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  3937. let promise;
  3938. if (pageDict instanceof Error) {
  3939. promise = Promise.reject(pageDict);
  3940. promise.catch(() => {});
  3941. } else {
  3942. promise = Promise.resolve(new Page({
  3943. pdfManager,
  3944. xref: this.xref,
  3945. pageIndex,
  3946. pageDict,
  3947. ref,
  3948. globalIdFactory: this._globalIdFactory,
  3949. fontCache: catalog.fontCache,
  3950. builtInCMapCache: catalog.builtInCMapCache,
  3951. standardFontDataCache: catalog.standardFontDataCache,
  3952. globalImageCache: catalog.globalImageCache,
  3953. nonBlendModesSet: catalog.nonBlendModesSet,
  3954. xfaFactory: null
  3955. }));
  3956. }
  3957. this._pagePromises.set(pageIndex, promise);
  3958. }
  3959. catalog.setActualNumPages(pagesTree.size);
  3960. }
  3961. }
  3962. fontFallback(id, handler) {
  3963. return this.catalog.fontFallback(id, handler);
  3964. }
  3965. async cleanup(manuallyTriggered = false) {
  3966. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3967. }
  3968. _collectFieldObjects(name, fieldRef, promises) {
  3969. const field = this.xref.fetchIfRef(fieldRef);
  3970. if (field.has("T")) {
  3971. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3972. if (name === "") {
  3973. name = partName;
  3974. } else {
  3975. name = `${name}.${partName}`;
  3976. }
  3977. }
  3978. if (!promises.has(name)) {
  3979. promises.set(name, []);
  3980. }
  3981. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3982. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3983. return null;
  3984. }));
  3985. if (field.has("Kids")) {
  3986. const kids = field.get("Kids");
  3987. for (const kid of kids) {
  3988. this._collectFieldObjects(name, kid, promises);
  3989. }
  3990. }
  3991. }
  3992. get fieldObjects() {
  3993. if (!this.formInfo.hasFields) {
  3994. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3995. }
  3996. const allFields = Object.create(null);
  3997. const fieldPromises = new Map();
  3998. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3999. this._collectFieldObjects("", fieldRef, fieldPromises);
  4000. }
  4001. const allPromises = [];
  4002. for (const [name, promises] of fieldPromises) {
  4003. allPromises.push(Promise.all(promises).then(fields => {
  4004. fields = fields.filter(field => !!field);
  4005. if (fields.length > 0) {
  4006. allFields[name] = fields;
  4007. }
  4008. }));
  4009. }
  4010. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4011. }
  4012. get hasJSActions() {
  4013. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4014. return (0, _util.shadow)(this, "hasJSActions", promise);
  4015. }
  4016. async _parseHasJSActions() {
  4017. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4018. if (catalogJsActions) {
  4019. return true;
  4020. }
  4021. if (fieldObjects) {
  4022. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4023. }
  4024. return false;
  4025. }
  4026. get calculationOrderIds() {
  4027. const acroForm = this.catalog.acroForm;
  4028. if (!acroForm || !acroForm.has("CO")) {
  4029. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4030. }
  4031. const calculationOrder = acroForm.get("CO");
  4032. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4033. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4034. }
  4035. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  4036. if (ids.length === 0) {
  4037. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4038. }
  4039. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4040. }
  4041. }
  4042. exports.PDFDocument = PDFDocument;
  4043. /***/ }),
  4044. /* 12 */
  4045. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4046. Object.defineProperty(exports, "__esModule", ({
  4047. value: true
  4048. }));
  4049. exports.getXfaFontDict = getXfaFontDict;
  4050. exports.getXfaFontName = getXfaFontName;
  4051. var _calibri_factors = __w_pdfjs_require__(13);
  4052. var _primitives = __w_pdfjs_require__(5);
  4053. var _helvetica_factors = __w_pdfjs_require__(14);
  4054. var _liberationsans_widths = __w_pdfjs_require__(15);
  4055. var _myriadpro_factors = __w_pdfjs_require__(16);
  4056. var _segoeui_factors = __w_pdfjs_require__(17);
  4057. var _core_utils = __w_pdfjs_require__(9);
  4058. var _fonts_utils = __w_pdfjs_require__(18);
  4059. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  4060. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  4061. name: "LiberationSans-Regular",
  4062. factors: _myriadpro_factors.MyriadProRegularFactors,
  4063. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4064. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4065. metrics: _myriadpro_factors.MyriadProRegularMetrics
  4066. };
  4067. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  4068. name: "LiberationSans-Bold",
  4069. factors: _myriadpro_factors.MyriadProBoldFactors,
  4070. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4071. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4072. metrics: _myriadpro_factors.MyriadProBoldMetrics
  4073. };
  4074. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  4075. name: "LiberationSans-Italic",
  4076. factors: _myriadpro_factors.MyriadProItalicFactors,
  4077. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4078. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4079. metrics: _myriadpro_factors.MyriadProItalicMetrics
  4080. };
  4081. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  4082. name: "LiberationSans-BoldItalic",
  4083. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  4084. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4085. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4086. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  4087. };
  4088. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  4089. name: "LiberationSans-Regular",
  4090. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4091. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  4092. };
  4093. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  4094. name: "LiberationSans-Bold",
  4095. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4096. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  4097. };
  4098. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  4099. name: "LiberationSans-Italic",
  4100. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4101. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  4102. };
  4103. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  4104. name: "LiberationSans-BoldItalic",
  4105. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4106. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  4107. };
  4108. t["Calibri-Regular"] = {
  4109. name: "LiberationSans-Regular",
  4110. factors: _calibri_factors.CalibriRegularFactors,
  4111. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4112. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4113. metrics: _calibri_factors.CalibriRegularMetrics
  4114. };
  4115. t["Calibri-Bold"] = {
  4116. name: "LiberationSans-Bold",
  4117. factors: _calibri_factors.CalibriBoldFactors,
  4118. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4119. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4120. metrics: _calibri_factors.CalibriBoldMetrics
  4121. };
  4122. t["Calibri-Italic"] = {
  4123. name: "LiberationSans-Italic",
  4124. factors: _calibri_factors.CalibriItalicFactors,
  4125. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4126. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4127. metrics: _calibri_factors.CalibriItalicMetrics
  4128. };
  4129. t["Calibri-BoldItalic"] = {
  4130. name: "LiberationSans-BoldItalic",
  4131. factors: _calibri_factors.CalibriBoldItalicFactors,
  4132. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4133. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4134. metrics: _calibri_factors.CalibriBoldItalicMetrics
  4135. };
  4136. t["Segoeui-Regular"] = {
  4137. name: "LiberationSans-Regular",
  4138. factors: _segoeui_factors.SegoeuiRegularFactors,
  4139. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4140. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4141. metrics: _segoeui_factors.SegoeuiRegularMetrics
  4142. };
  4143. t["Segoeui-Bold"] = {
  4144. name: "LiberationSans-Bold",
  4145. factors: _segoeui_factors.SegoeuiBoldFactors,
  4146. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4147. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4148. metrics: _segoeui_factors.SegoeuiBoldMetrics
  4149. };
  4150. t["Segoeui-Italic"] = {
  4151. name: "LiberationSans-Italic",
  4152. factors: _segoeui_factors.SegoeuiItalicFactors,
  4153. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4154. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4155. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4156. };
  4157. t["Segoeui-BoldItalic"] = {
  4158. name: "LiberationSans-BoldItalic",
  4159. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4160. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4161. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4162. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4163. };
  4164. t["Helvetica-Regular"] = t.Helvetica = {
  4165. name: "LiberationSans-Regular",
  4166. factors: _helvetica_factors.HelveticaRegularFactors,
  4167. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4168. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4169. metrics: _helvetica_factors.HelveticaRegularMetrics
  4170. };
  4171. t["Helvetica-Bold"] = {
  4172. name: "LiberationSans-Bold",
  4173. factors: _helvetica_factors.HelveticaBoldFactors,
  4174. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4175. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4176. metrics: _helvetica_factors.HelveticaBoldMetrics
  4177. };
  4178. t["Helvetica-Italic"] = {
  4179. name: "LiberationSans-Italic",
  4180. factors: _helvetica_factors.HelveticaItalicFactors,
  4181. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4182. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4183. metrics: _helvetica_factors.HelveticaItalicMetrics
  4184. };
  4185. t["Helvetica-BoldItalic"] = {
  4186. name: "LiberationSans-BoldItalic",
  4187. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4188. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4189. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4190. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4191. };
  4192. });
  4193. function getXfaFontName(name) {
  4194. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4195. const fontMap = getXFAFontMap();
  4196. return fontMap[fontName];
  4197. }
  4198. function getXfaFontWidths(name) {
  4199. const info = getXfaFontName(name);
  4200. if (!info) {
  4201. return null;
  4202. }
  4203. const {
  4204. baseWidths,
  4205. baseMapping,
  4206. factors
  4207. } = info;
  4208. let rescaledBaseWidths;
  4209. if (!factors) {
  4210. rescaledBaseWidths = baseWidths;
  4211. } else {
  4212. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4213. }
  4214. let currentCode = -2;
  4215. let currentArray;
  4216. const newWidths = [];
  4217. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4218. if (unicode === -1) {
  4219. continue;
  4220. }
  4221. if (unicode === currentCode + 1) {
  4222. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4223. currentCode += 1;
  4224. } else {
  4225. currentCode = unicode;
  4226. currentArray = [rescaledBaseWidths[glyphIndex]];
  4227. newWidths.push(unicode, currentArray);
  4228. }
  4229. }
  4230. return newWidths;
  4231. }
  4232. function getXfaFontDict(name) {
  4233. const widths = getXfaFontWidths(name);
  4234. const dict = new _primitives.Dict(null);
  4235. dict.set("BaseFont", _primitives.Name.get(name));
  4236. dict.set("Type", _primitives.Name.get("Font"));
  4237. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4238. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4239. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4240. dict.set("W", widths);
  4241. dict.set("FirstChar", widths[0]);
  4242. dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1);
  4243. const descriptor = new _primitives.Dict(null);
  4244. dict.set("FontDescriptor", descriptor);
  4245. const systemInfo = new _primitives.Dict(null);
  4246. systemInfo.set("Ordering", "Identity");
  4247. systemInfo.set("Registry", "Adobe");
  4248. systemInfo.set("Supplement", 0);
  4249. dict.set("CIDSystemInfo", systemInfo);
  4250. return dict;
  4251. }
  4252. /***/ }),
  4253. /* 13 */
  4254. /***/ ((__unused_webpack_module, exports) => {
  4255. Object.defineProperty(exports, "__esModule", ({
  4256. value: true
  4257. }));
  4258. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4259. 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];
  4260. exports.CalibriBoldFactors = CalibriBoldFactors;
  4261. const CalibriBoldMetrics = {
  4262. lineHeight: 1.2207,
  4263. lineGap: 0.2207
  4264. };
  4265. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4266. 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];
  4267. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4268. const CalibriBoldItalicMetrics = {
  4269. lineHeight: 1.2207,
  4270. lineGap: 0.2207
  4271. };
  4272. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4273. 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];
  4274. exports.CalibriItalicFactors = CalibriItalicFactors;
  4275. const CalibriItalicMetrics = {
  4276. lineHeight: 1.2207,
  4277. lineGap: 0.2207
  4278. };
  4279. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4280. 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];
  4281. exports.CalibriRegularFactors = CalibriRegularFactors;
  4282. const CalibriRegularMetrics = {
  4283. lineHeight: 1.2207,
  4284. lineGap: 0.2207
  4285. };
  4286. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4287. /***/ }),
  4288. /* 14 */
  4289. /***/ ((__unused_webpack_module, exports) => {
  4290. Object.defineProperty(exports, "__esModule", ({
  4291. value: true
  4292. }));
  4293. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4294. 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];
  4295. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4296. const HelveticaBoldMetrics = {
  4297. lineHeight: 1.2,
  4298. lineGap: 0.2
  4299. };
  4300. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4301. 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];
  4302. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4303. const HelveticaBoldItalicMetrics = {
  4304. lineHeight: 1.35,
  4305. lineGap: 0.2
  4306. };
  4307. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4308. 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];
  4309. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4310. const HelveticaItalicMetrics = {
  4311. lineHeight: 1.35,
  4312. lineGap: 0.2
  4313. };
  4314. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4315. 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];
  4316. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4317. const HelveticaRegularMetrics = {
  4318. lineHeight: 1.2,
  4319. lineGap: 0.2
  4320. };
  4321. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4322. /***/ }),
  4323. /* 15 */
  4324. /***/ ((__unused_webpack_module, exports) => {
  4325. Object.defineProperty(exports, "__esModule", ({
  4326. value: true
  4327. }));
  4328. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4329. 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];
  4330. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4331. 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];
  4332. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4333. 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];
  4334. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4335. 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];
  4336. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4337. 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];
  4338. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4339. 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];
  4340. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4341. 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];
  4342. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4343. 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];
  4344. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4345. /***/ }),
  4346. /* 16 */
  4347. /***/ ((__unused_webpack_module, exports) => {
  4348. Object.defineProperty(exports, "__esModule", ({
  4349. value: true
  4350. }));
  4351. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4352. 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];
  4353. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4354. const MyriadProBoldMetrics = {
  4355. lineHeight: 1.2,
  4356. lineGap: 0.2
  4357. };
  4358. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4359. 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];
  4360. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4361. const MyriadProBoldItalicMetrics = {
  4362. lineHeight: 1.2,
  4363. lineGap: 0.2
  4364. };
  4365. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4366. 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];
  4367. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4368. const MyriadProItalicMetrics = {
  4369. lineHeight: 1.2,
  4370. lineGap: 0.2
  4371. };
  4372. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4373. 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];
  4374. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4375. const MyriadProRegularMetrics = {
  4376. lineHeight: 1.2,
  4377. lineGap: 0.2
  4378. };
  4379. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4380. /***/ }),
  4381. /* 17 */
  4382. /***/ ((__unused_webpack_module, exports) => {
  4383. Object.defineProperty(exports, "__esModule", ({
  4384. value: true
  4385. }));
  4386. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4387. 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];
  4388. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4389. const SegoeuiBoldMetrics = {
  4390. lineHeight: 1.33008,
  4391. lineGap: 0
  4392. };
  4393. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4394. 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];
  4395. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4396. const SegoeuiBoldItalicMetrics = {
  4397. lineHeight: 1.33008,
  4398. lineGap: 0
  4399. };
  4400. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4401. 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];
  4402. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4403. const SegoeuiItalicMetrics = {
  4404. lineHeight: 1.33008,
  4405. lineGap: 0
  4406. };
  4407. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4408. 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];
  4409. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4410. const SegoeuiRegularMetrics = {
  4411. lineHeight: 1.33008,
  4412. lineGap: 0
  4413. };
  4414. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4415. /***/ }),
  4416. /* 18 */
  4417. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4418. Object.defineProperty(exports, "__esModule", ({
  4419. value: true
  4420. }));
  4421. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4422. exports.getFontType = getFontType;
  4423. exports.normalizeFontName = normalizeFontName;
  4424. exports.recoverGlyphName = recoverGlyphName;
  4425. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4426. var _util = __w_pdfjs_require__(2);
  4427. var _encodings = __w_pdfjs_require__(19);
  4428. var _glyphlist = __w_pdfjs_require__(20);
  4429. var _unicode = __w_pdfjs_require__(21);
  4430. const SEAC_ANALYSIS_ENABLED = true;
  4431. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4432. const FontFlags = {
  4433. FixedPitch: 1,
  4434. Serif: 2,
  4435. Symbolic: 4,
  4436. Script: 8,
  4437. Nonsymbolic: 32,
  4438. Italic: 64,
  4439. AllCap: 65536,
  4440. SmallCap: 131072,
  4441. ForceBold: 262144
  4442. };
  4443. exports.FontFlags = FontFlags;
  4444. 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"];
  4445. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4446. function getFontType(type, subtype, isStandardFont = false) {
  4447. switch (type) {
  4448. case "Type1":
  4449. if (isStandardFont) {
  4450. return _util.FontType.TYPE1STANDARD;
  4451. }
  4452. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4453. case "CIDFontType0":
  4454. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4455. case "OpenType":
  4456. return _util.FontType.OPENTYPE;
  4457. case "TrueType":
  4458. return _util.FontType.TRUETYPE;
  4459. case "CIDFontType2":
  4460. return _util.FontType.CIDFONTTYPE2;
  4461. case "MMType1":
  4462. return _util.FontType.MMTYPE1;
  4463. case "Type0":
  4464. return _util.FontType.TYPE0;
  4465. default:
  4466. return _util.FontType.UNKNOWN;
  4467. }
  4468. }
  4469. function recoverGlyphName(name, glyphsUnicodeMap) {
  4470. if (glyphsUnicodeMap[name] !== undefined) {
  4471. return name;
  4472. }
  4473. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4474. if (unicode !== -1) {
  4475. for (const key in glyphsUnicodeMap) {
  4476. if (glyphsUnicodeMap[key] === unicode) {
  4477. return key;
  4478. }
  4479. }
  4480. }
  4481. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4482. return name;
  4483. }
  4484. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4485. const charCodeToGlyphId = Object.create(null);
  4486. let glyphId, charCode, baseEncoding;
  4487. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4488. if (properties.isInternalFont) {
  4489. baseEncoding = builtInEncoding;
  4490. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4491. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4492. if (glyphId >= 0) {
  4493. charCodeToGlyphId[charCode] = glyphId;
  4494. } else {
  4495. charCodeToGlyphId[charCode] = 0;
  4496. }
  4497. }
  4498. } else if (properties.baseEncodingName) {
  4499. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4500. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4501. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4502. if (glyphId >= 0) {
  4503. charCodeToGlyphId[charCode] = glyphId;
  4504. } else {
  4505. charCodeToGlyphId[charCode] = 0;
  4506. }
  4507. }
  4508. } else if (isSymbolicFont) {
  4509. for (charCode in builtInEncoding) {
  4510. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4511. }
  4512. } else {
  4513. baseEncoding = _encodings.StandardEncoding;
  4514. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4515. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4516. if (glyphId >= 0) {
  4517. charCodeToGlyphId[charCode] = glyphId;
  4518. } else {
  4519. charCodeToGlyphId[charCode] = 0;
  4520. }
  4521. }
  4522. }
  4523. const differences = properties.differences;
  4524. let glyphsUnicodeMap;
  4525. if (differences) {
  4526. for (charCode in differences) {
  4527. const glyphName = differences[charCode];
  4528. glyphId = glyphNames.indexOf(glyphName);
  4529. if (glyphId === -1) {
  4530. if (!glyphsUnicodeMap) {
  4531. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4532. }
  4533. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4534. if (standardGlyphName !== glyphName) {
  4535. glyphId = glyphNames.indexOf(standardGlyphName);
  4536. }
  4537. }
  4538. if (glyphId >= 0) {
  4539. charCodeToGlyphId[charCode] = glyphId;
  4540. } else {
  4541. charCodeToGlyphId[charCode] = 0;
  4542. }
  4543. }
  4544. }
  4545. return charCodeToGlyphId;
  4546. }
  4547. function normalizeFontName(name) {
  4548. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4549. }
  4550. /***/ }),
  4551. /* 19 */
  4552. /***/ ((__unused_webpack_module, exports) => {
  4553. Object.defineProperty(exports, "__esModule", ({
  4554. value: true
  4555. }));
  4556. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4557. exports.getEncoding = getEncoding;
  4558. 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"];
  4559. exports.ExpertEncoding = ExpertEncoding;
  4560. 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", "", "", "", ""];
  4561. 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"];
  4562. exports.MacRomanEncoding = MacRomanEncoding;
  4563. 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", "", "", "", ""];
  4564. exports.StandardEncoding = StandardEncoding;
  4565. 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"];
  4566. exports.WinAnsiEncoding = WinAnsiEncoding;
  4567. 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", ""];
  4568. exports.SymbolSetEncoding = SymbolSetEncoding;
  4569. 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", ""];
  4570. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4571. function getEncoding(encodingName) {
  4572. switch (encodingName) {
  4573. case "WinAnsiEncoding":
  4574. return WinAnsiEncoding;
  4575. case "StandardEncoding":
  4576. return StandardEncoding;
  4577. case "MacRomanEncoding":
  4578. return MacRomanEncoding;
  4579. case "SymbolSetEncoding":
  4580. return SymbolSetEncoding;
  4581. case "ZapfDingbatsEncoding":
  4582. return ZapfDingbatsEncoding;
  4583. case "ExpertEncoding":
  4584. return ExpertEncoding;
  4585. case "MacExpertEncoding":
  4586. return MacExpertEncoding;
  4587. default:
  4588. return null;
  4589. }
  4590. }
  4591. /***/ }),
  4592. /* 20 */
  4593. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4594. __w_pdfjs_require__.r(__webpack_exports__);
  4595. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4596. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4597. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4598. /* harmony export */ });
  4599. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  4600. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4601. return [
  4602. "A",
  4603. 0x0041,
  4604. "AE",
  4605. 0x00c6,
  4606. "AEacute",
  4607. 0x01fc,
  4608. "AEmacron",
  4609. 0x01e2,
  4610. "AEsmall",
  4611. 0xf7e6,
  4612. "Aacute",
  4613. 0x00c1,
  4614. "Aacutesmall",
  4615. 0xf7e1,
  4616. "Abreve",
  4617. 0x0102,
  4618. "Abreveacute",
  4619. 0x1eae,
  4620. "Abrevecyrillic",
  4621. 0x04d0,
  4622. "Abrevedotbelow",
  4623. 0x1eb6,
  4624. "Abrevegrave",
  4625. 0x1eb0,
  4626. "Abrevehookabove",
  4627. 0x1eb2,
  4628. "Abrevetilde",
  4629. 0x1eb4,
  4630. "Acaron",
  4631. 0x01cd,
  4632. "Acircle",
  4633. 0x24b6,
  4634. "Acircumflex",
  4635. 0x00c2,
  4636. "Acircumflexacute",
  4637. 0x1ea4,
  4638. "Acircumflexdotbelow",
  4639. 0x1eac,
  4640. "Acircumflexgrave",
  4641. 0x1ea6,
  4642. "Acircumflexhookabove",
  4643. 0x1ea8,
  4644. "Acircumflexsmall",
  4645. 0xf7e2,
  4646. "Acircumflextilde",
  4647. 0x1eaa,
  4648. "Acute",
  4649. 0xf6c9,
  4650. "Acutesmall",
  4651. 0xf7b4,
  4652. "Acyrillic",
  4653. 0x0410,
  4654. "Adblgrave",
  4655. 0x0200,
  4656. "Adieresis",
  4657. 0x00c4,
  4658. "Adieresiscyrillic",
  4659. 0x04d2,
  4660. "Adieresismacron",
  4661. 0x01de,
  4662. "Adieresissmall",
  4663. 0xf7e4,
  4664. "Adotbelow",
  4665. 0x1ea0,
  4666. "Adotmacron",
  4667. 0x01e0,
  4668. "Agrave",
  4669. 0x00c0,
  4670. "Agravesmall",
  4671. 0xf7e0,
  4672. "Ahookabove",
  4673. 0x1ea2,
  4674. "Aiecyrillic",
  4675. 0x04d4,
  4676. "Ainvertedbreve",
  4677. 0x0202,
  4678. "Alpha",
  4679. 0x0391,
  4680. "Alphatonos",
  4681. 0x0386,
  4682. "Amacron",
  4683. 0x0100,
  4684. "Amonospace",
  4685. 0xff21,
  4686. "Aogonek",
  4687. 0x0104,
  4688. "Aring",
  4689. 0x00c5,
  4690. "Aringacute",
  4691. 0x01fa,
  4692. "Aringbelow",
  4693. 0x1e00,
  4694. "Aringsmall",
  4695. 0xf7e5,
  4696. "Asmall",
  4697. 0xf761,
  4698. "Atilde",
  4699. 0x00c3,
  4700. "Atildesmall",
  4701. 0xf7e3,
  4702. "Aybarmenian",
  4703. 0x0531,
  4704. "B",
  4705. 0x0042,
  4706. "Bcircle",
  4707. 0x24b7,
  4708. "Bdotaccent",
  4709. 0x1e02,
  4710. "Bdotbelow",
  4711. 0x1e04,
  4712. "Becyrillic",
  4713. 0x0411,
  4714. "Benarmenian",
  4715. 0x0532,
  4716. "Beta",
  4717. 0x0392,
  4718. "Bhook",
  4719. 0x0181,
  4720. "Blinebelow",
  4721. 0x1e06,
  4722. "Bmonospace",
  4723. 0xff22,
  4724. "Brevesmall",
  4725. 0xf6f4,
  4726. "Bsmall",
  4727. 0xf762,
  4728. "Btopbar",
  4729. 0x0182,
  4730. "C",
  4731. 0x0043,
  4732. "Caarmenian",
  4733. 0x053e,
  4734. "Cacute",
  4735. 0x0106,
  4736. "Caron",
  4737. 0xf6ca,
  4738. "Caronsmall",
  4739. 0xf6f5,
  4740. "Ccaron",
  4741. 0x010c,
  4742. "Ccedilla",
  4743. 0x00c7,
  4744. "Ccedillaacute",
  4745. 0x1e08,
  4746. "Ccedillasmall",
  4747. 0xf7e7,
  4748. "Ccircle",
  4749. 0x24b8,
  4750. "Ccircumflex",
  4751. 0x0108,
  4752. "Cdot",
  4753. 0x010a,
  4754. "Cdotaccent",
  4755. 0x010a,
  4756. "Cedillasmall",
  4757. 0xf7b8,
  4758. "Chaarmenian",
  4759. 0x0549,
  4760. "Cheabkhasiancyrillic",
  4761. 0x04bc,
  4762. "Checyrillic",
  4763. 0x0427,
  4764. "Chedescenderabkhasiancyrillic",
  4765. 0x04be,
  4766. "Chedescendercyrillic",
  4767. 0x04b6,
  4768. "Chedieresiscyrillic",
  4769. 0x04f4,
  4770. "Cheharmenian",
  4771. 0x0543,
  4772. "Chekhakassiancyrillic",
  4773. 0x04cb,
  4774. "Cheverticalstrokecyrillic",
  4775. 0x04b8,
  4776. "Chi",
  4777. 0x03a7,
  4778. "Chook",
  4779. 0x0187,
  4780. "Circumflexsmall",
  4781. 0xf6f6,
  4782. "Cmonospace",
  4783. 0xff23,
  4784. "Coarmenian",
  4785. 0x0551,
  4786. "Csmall",
  4787. 0xf763,
  4788. "D",
  4789. 0x0044,
  4790. "DZ",
  4791. 0x01f1,
  4792. "DZcaron",
  4793. 0x01c4,
  4794. "Daarmenian",
  4795. 0x0534,
  4796. "Dafrican",
  4797. 0x0189,
  4798. "Dcaron",
  4799. 0x010e,
  4800. "Dcedilla",
  4801. 0x1e10,
  4802. "Dcircle",
  4803. 0x24b9,
  4804. "Dcircumflexbelow",
  4805. 0x1e12,
  4806. "Dcroat",
  4807. 0x0110,
  4808. "Ddotaccent",
  4809. 0x1e0a,
  4810. "Ddotbelow",
  4811. 0x1e0c,
  4812. "Decyrillic",
  4813. 0x0414,
  4814. "Deicoptic",
  4815. 0x03ee,
  4816. "Delta",
  4817. 0x2206,
  4818. "Deltagreek",
  4819. 0x0394,
  4820. "Dhook",
  4821. 0x018a,
  4822. "Dieresis",
  4823. 0xf6cb,
  4824. "DieresisAcute",
  4825. 0xf6cc,
  4826. "DieresisGrave",
  4827. 0xf6cd,
  4828. "Dieresissmall",
  4829. 0xf7a8,
  4830. "Digammagreek",
  4831. 0x03dc,
  4832. "Djecyrillic",
  4833. 0x0402,
  4834. "Dlinebelow",
  4835. 0x1e0e,
  4836. "Dmonospace",
  4837. 0xff24,
  4838. "Dotaccentsmall",
  4839. 0xf6f7,
  4840. "Dslash",
  4841. 0x0110,
  4842. "Dsmall",
  4843. 0xf764,
  4844. "Dtopbar",
  4845. 0x018b,
  4846. "Dz",
  4847. 0x01f2,
  4848. "Dzcaron",
  4849. 0x01c5,
  4850. "Dzeabkhasiancyrillic",
  4851. 0x04e0,
  4852. "Dzecyrillic",
  4853. 0x0405,
  4854. "Dzhecyrillic",
  4855. 0x040f,
  4856. "E",
  4857. 0x0045,
  4858. "Eacute",
  4859. 0x00c9,
  4860. "Eacutesmall",
  4861. 0xf7e9,
  4862. "Ebreve",
  4863. 0x0114,
  4864. "Ecaron",
  4865. 0x011a,
  4866. "Ecedillabreve",
  4867. 0x1e1c,
  4868. "Echarmenian",
  4869. 0x0535,
  4870. "Ecircle",
  4871. 0x24ba,
  4872. "Ecircumflex",
  4873. 0x00ca,
  4874. "Ecircumflexacute",
  4875. 0x1ebe,
  4876. "Ecircumflexbelow",
  4877. 0x1e18,
  4878. "Ecircumflexdotbelow",
  4879. 0x1ec6,
  4880. "Ecircumflexgrave",
  4881. 0x1ec0,
  4882. "Ecircumflexhookabove",
  4883. 0x1ec2,
  4884. "Ecircumflexsmall",
  4885. 0xf7ea,
  4886. "Ecircumflextilde",
  4887. 0x1ec4,
  4888. "Ecyrillic",
  4889. 0x0404,
  4890. "Edblgrave",
  4891. 0x0204,
  4892. "Edieresis",
  4893. 0x00cb,
  4894. "Edieresissmall",
  4895. 0xf7eb,
  4896. "Edot",
  4897. 0x0116,
  4898. "Edotaccent",
  4899. 0x0116,
  4900. "Edotbelow",
  4901. 0x1eb8,
  4902. "Efcyrillic",
  4903. 0x0424,
  4904. "Egrave",
  4905. 0x00c8,
  4906. "Egravesmall",
  4907. 0xf7e8,
  4908. "Eharmenian",
  4909. 0x0537,
  4910. "Ehookabove",
  4911. 0x1eba,
  4912. "Eightroman",
  4913. 0x2167,
  4914. "Einvertedbreve",
  4915. 0x0206,
  4916. "Eiotifiedcyrillic",
  4917. 0x0464,
  4918. "Elcyrillic",
  4919. 0x041b,
  4920. "Elevenroman",
  4921. 0x216a,
  4922. "Emacron",
  4923. 0x0112,
  4924. "Emacronacute",
  4925. 0x1e16,
  4926. "Emacrongrave",
  4927. 0x1e14,
  4928. "Emcyrillic",
  4929. 0x041c,
  4930. "Emonospace",
  4931. 0xff25,
  4932. "Encyrillic",
  4933. 0x041d,
  4934. "Endescendercyrillic",
  4935. 0x04a2,
  4936. "Eng",
  4937. 0x014a,
  4938. "Enghecyrillic",
  4939. 0x04a4,
  4940. "Enhookcyrillic",
  4941. 0x04c7,
  4942. "Eogonek",
  4943. 0x0118,
  4944. "Eopen",
  4945. 0x0190,
  4946. "Epsilon",
  4947. 0x0395,
  4948. "Epsilontonos",
  4949. 0x0388,
  4950. "Ercyrillic",
  4951. 0x0420,
  4952. "Ereversed",
  4953. 0x018e,
  4954. "Ereversedcyrillic",
  4955. 0x042d,
  4956. "Escyrillic",
  4957. 0x0421,
  4958. "Esdescendercyrillic",
  4959. 0x04aa,
  4960. "Esh",
  4961. 0x01a9,
  4962. "Esmall",
  4963. 0xf765,
  4964. "Eta",
  4965. 0x0397,
  4966. "Etarmenian",
  4967. 0x0538,
  4968. "Etatonos",
  4969. 0x0389,
  4970. "Eth",
  4971. 0x00d0,
  4972. "Ethsmall",
  4973. 0xf7f0,
  4974. "Etilde",
  4975. 0x1ebc,
  4976. "Etildebelow",
  4977. 0x1e1a,
  4978. "Euro",
  4979. 0x20ac,
  4980. "Ezh",
  4981. 0x01b7,
  4982. "Ezhcaron",
  4983. 0x01ee,
  4984. "Ezhreversed",
  4985. 0x01b8,
  4986. "F",
  4987. 0x0046,
  4988. "Fcircle",
  4989. 0x24bb,
  4990. "Fdotaccent",
  4991. 0x1e1e,
  4992. "Feharmenian",
  4993. 0x0556,
  4994. "Feicoptic",
  4995. 0x03e4,
  4996. "Fhook",
  4997. 0x0191,
  4998. "Fitacyrillic",
  4999. 0x0472,
  5000. "Fiveroman",
  5001. 0x2164,
  5002. "Fmonospace",
  5003. 0xff26,
  5004. "Fourroman",
  5005. 0x2163,
  5006. "Fsmall",
  5007. 0xf766,
  5008. "G",
  5009. 0x0047,
  5010. "GBsquare",
  5011. 0x3387,
  5012. "Gacute",
  5013. 0x01f4,
  5014. "Gamma",
  5015. 0x0393,
  5016. "Gammaafrican",
  5017. 0x0194,
  5018. "Gangiacoptic",
  5019. 0x03ea,
  5020. "Gbreve",
  5021. 0x011e,
  5022. "Gcaron",
  5023. 0x01e6,
  5024. "Gcedilla",
  5025. 0x0122,
  5026. "Gcircle",
  5027. 0x24bc,
  5028. "Gcircumflex",
  5029. 0x011c,
  5030. "Gcommaaccent",
  5031. 0x0122,
  5032. "Gdot",
  5033. 0x0120,
  5034. "Gdotaccent",
  5035. 0x0120,
  5036. "Gecyrillic",
  5037. 0x0413,
  5038. "Ghadarmenian",
  5039. 0x0542,
  5040. "Ghemiddlehookcyrillic",
  5041. 0x0494,
  5042. "Ghestrokecyrillic",
  5043. 0x0492,
  5044. "Gheupturncyrillic",
  5045. 0x0490,
  5046. "Ghook",
  5047. 0x0193,
  5048. "Gimarmenian",
  5049. 0x0533,
  5050. "Gjecyrillic",
  5051. 0x0403,
  5052. "Gmacron",
  5053. 0x1e20,
  5054. "Gmonospace",
  5055. 0xff27,
  5056. "Grave",
  5057. 0xf6ce,
  5058. "Gravesmall",
  5059. 0xf760,
  5060. "Gsmall",
  5061. 0xf767,
  5062. "Gsmallhook",
  5063. 0x029b,
  5064. "Gstroke",
  5065. 0x01e4,
  5066. "H",
  5067. 0x0048,
  5068. "H18533",
  5069. 0x25cf,
  5070. "H18543",
  5071. 0x25aa,
  5072. "H18551",
  5073. 0x25ab,
  5074. "H22073",
  5075. 0x25a1,
  5076. "HPsquare",
  5077. 0x33cb,
  5078. "Haabkhasiancyrillic",
  5079. 0x04a8,
  5080. "Hadescendercyrillic",
  5081. 0x04b2,
  5082. "Hardsigncyrillic",
  5083. 0x042a,
  5084. "Hbar",
  5085. 0x0126,
  5086. "Hbrevebelow",
  5087. 0x1e2a,
  5088. "Hcedilla",
  5089. 0x1e28,
  5090. "Hcircle",
  5091. 0x24bd,
  5092. "Hcircumflex",
  5093. 0x0124,
  5094. "Hdieresis",
  5095. 0x1e26,
  5096. "Hdotaccent",
  5097. 0x1e22,
  5098. "Hdotbelow",
  5099. 0x1e24,
  5100. "Hmonospace",
  5101. 0xff28,
  5102. "Hoarmenian",
  5103. 0x0540,
  5104. "Horicoptic",
  5105. 0x03e8,
  5106. "Hsmall",
  5107. 0xf768,
  5108. "Hungarumlaut",
  5109. 0xf6cf,
  5110. "Hungarumlautsmall",
  5111. 0xf6f8,
  5112. "Hzsquare",
  5113. 0x3390,
  5114. "I",
  5115. 0x0049,
  5116. "IAcyrillic",
  5117. 0x042f,
  5118. "IJ",
  5119. 0x0132,
  5120. "IUcyrillic",
  5121. 0x042e,
  5122. "Iacute",
  5123. 0x00cd,
  5124. "Iacutesmall",
  5125. 0xf7ed,
  5126. "Ibreve",
  5127. 0x012c,
  5128. "Icaron",
  5129. 0x01cf,
  5130. "Icircle",
  5131. 0x24be,
  5132. "Icircumflex",
  5133. 0x00ce,
  5134. "Icircumflexsmall",
  5135. 0xf7ee,
  5136. "Icyrillic",
  5137. 0x0406,
  5138. "Idblgrave",
  5139. 0x0208,
  5140. "Idieresis",
  5141. 0x00cf,
  5142. "Idieresisacute",
  5143. 0x1e2e,
  5144. "Idieresiscyrillic",
  5145. 0x04e4,
  5146. "Idieresissmall",
  5147. 0xf7ef,
  5148. "Idot",
  5149. 0x0130,
  5150. "Idotaccent",
  5151. 0x0130,
  5152. "Idotbelow",
  5153. 0x1eca,
  5154. "Iebrevecyrillic",
  5155. 0x04d6,
  5156. "Iecyrillic",
  5157. 0x0415,
  5158. "Ifraktur",
  5159. 0x2111,
  5160. "Igrave",
  5161. 0x00cc,
  5162. "Igravesmall",
  5163. 0xf7ec,
  5164. "Ihookabove",
  5165. 0x1ec8,
  5166. "Iicyrillic",
  5167. 0x0418,
  5168. "Iinvertedbreve",
  5169. 0x020a,
  5170. "Iishortcyrillic",
  5171. 0x0419,
  5172. "Imacron",
  5173. 0x012a,
  5174. "Imacroncyrillic",
  5175. 0x04e2,
  5176. "Imonospace",
  5177. 0xff29,
  5178. "Iniarmenian",
  5179. 0x053b,
  5180. "Iocyrillic",
  5181. 0x0401,
  5182. "Iogonek",
  5183. 0x012e,
  5184. "Iota",
  5185. 0x0399,
  5186. "Iotaafrican",
  5187. 0x0196,
  5188. "Iotadieresis",
  5189. 0x03aa,
  5190. "Iotatonos",
  5191. 0x038a,
  5192. "Ismall",
  5193. 0xf769,
  5194. "Istroke",
  5195. 0x0197,
  5196. "Itilde",
  5197. 0x0128,
  5198. "Itildebelow",
  5199. 0x1e2c,
  5200. "Izhitsacyrillic",
  5201. 0x0474,
  5202. "Izhitsadblgravecyrillic",
  5203. 0x0476,
  5204. "J",
  5205. 0x004a,
  5206. "Jaarmenian",
  5207. 0x0541,
  5208. "Jcircle",
  5209. 0x24bf,
  5210. "Jcircumflex",
  5211. 0x0134,
  5212. "Jecyrillic",
  5213. 0x0408,
  5214. "Jheharmenian",
  5215. 0x054b,
  5216. "Jmonospace",
  5217. 0xff2a,
  5218. "Jsmall",
  5219. 0xf76a,
  5220. "K",
  5221. 0x004b,
  5222. "KBsquare",
  5223. 0x3385,
  5224. "KKsquare",
  5225. 0x33cd,
  5226. "Kabashkircyrillic",
  5227. 0x04a0,
  5228. "Kacute",
  5229. 0x1e30,
  5230. "Kacyrillic",
  5231. 0x041a,
  5232. "Kadescendercyrillic",
  5233. 0x049a,
  5234. "Kahookcyrillic",
  5235. 0x04c3,
  5236. "Kappa",
  5237. 0x039a,
  5238. "Kastrokecyrillic",
  5239. 0x049e,
  5240. "Kaverticalstrokecyrillic",
  5241. 0x049c,
  5242. "Kcaron",
  5243. 0x01e8,
  5244. "Kcedilla",
  5245. 0x0136,
  5246. "Kcircle",
  5247. 0x24c0,
  5248. "Kcommaaccent",
  5249. 0x0136,
  5250. "Kdotbelow",
  5251. 0x1e32,
  5252. "Keharmenian",
  5253. 0x0554,
  5254. "Kenarmenian",
  5255. 0x053f,
  5256. "Khacyrillic",
  5257. 0x0425,
  5258. "Kheicoptic",
  5259. 0x03e6,
  5260. "Khook",
  5261. 0x0198,
  5262. "Kjecyrillic",
  5263. 0x040c,
  5264. "Klinebelow",
  5265. 0x1e34,
  5266. "Kmonospace",
  5267. 0xff2b,
  5268. "Koppacyrillic",
  5269. 0x0480,
  5270. "Koppagreek",
  5271. 0x03de,
  5272. "Ksicyrillic",
  5273. 0x046e,
  5274. "Ksmall",
  5275. 0xf76b,
  5276. "L",
  5277. 0x004c,
  5278. "LJ",
  5279. 0x01c7,
  5280. "LL",
  5281. 0xf6bf,
  5282. "Lacute",
  5283. 0x0139,
  5284. "Lambda",
  5285. 0x039b,
  5286. "Lcaron",
  5287. 0x013d,
  5288. "Lcedilla",
  5289. 0x013b,
  5290. "Lcircle",
  5291. 0x24c1,
  5292. "Lcircumflexbelow",
  5293. 0x1e3c,
  5294. "Lcommaaccent",
  5295. 0x013b,
  5296. "Ldot",
  5297. 0x013f,
  5298. "Ldotaccent",
  5299. 0x013f,
  5300. "Ldotbelow",
  5301. 0x1e36,
  5302. "Ldotbelowmacron",
  5303. 0x1e38,
  5304. "Liwnarmenian",
  5305. 0x053c,
  5306. "Lj",
  5307. 0x01c8,
  5308. "Ljecyrillic",
  5309. 0x0409,
  5310. "Llinebelow",
  5311. 0x1e3a,
  5312. "Lmonospace",
  5313. 0xff2c,
  5314. "Lslash",
  5315. 0x0141,
  5316. "Lslashsmall",
  5317. 0xf6f9,
  5318. "Lsmall",
  5319. 0xf76c,
  5320. "M",
  5321. 0x004d,
  5322. "MBsquare",
  5323. 0x3386,
  5324. "Macron",
  5325. 0xf6d0,
  5326. "Macronsmall",
  5327. 0xf7af,
  5328. "Macute",
  5329. 0x1e3e,
  5330. "Mcircle",
  5331. 0x24c2,
  5332. "Mdotaccent",
  5333. 0x1e40,
  5334. "Mdotbelow",
  5335. 0x1e42,
  5336. "Menarmenian",
  5337. 0x0544,
  5338. "Mmonospace",
  5339. 0xff2d,
  5340. "Msmall",
  5341. 0xf76d,
  5342. "Mturned",
  5343. 0x019c,
  5344. "Mu",
  5345. 0x039c,
  5346. "N",
  5347. 0x004e,
  5348. "NJ",
  5349. 0x01ca,
  5350. "Nacute",
  5351. 0x0143,
  5352. "Ncaron",
  5353. 0x0147,
  5354. "Ncedilla",
  5355. 0x0145,
  5356. "Ncircle",
  5357. 0x24c3,
  5358. "Ncircumflexbelow",
  5359. 0x1e4a,
  5360. "Ncommaaccent",
  5361. 0x0145,
  5362. "Ndotaccent",
  5363. 0x1e44,
  5364. "Ndotbelow",
  5365. 0x1e46,
  5366. "Nhookleft",
  5367. 0x019d,
  5368. "Nineroman",
  5369. 0x2168,
  5370. "Nj",
  5371. 0x01cb,
  5372. "Njecyrillic",
  5373. 0x040a,
  5374. "Nlinebelow",
  5375. 0x1e48,
  5376. "Nmonospace",
  5377. 0xff2e,
  5378. "Nowarmenian",
  5379. 0x0546,
  5380. "Nsmall",
  5381. 0xf76e,
  5382. "Ntilde",
  5383. 0x00d1,
  5384. "Ntildesmall",
  5385. 0xf7f1,
  5386. "Nu",
  5387. 0x039d,
  5388. "O",
  5389. 0x004f,
  5390. "OE",
  5391. 0x0152,
  5392. "OEsmall",
  5393. 0xf6fa,
  5394. "Oacute",
  5395. 0x00d3,
  5396. "Oacutesmall",
  5397. 0xf7f3,
  5398. "Obarredcyrillic",
  5399. 0x04e8,
  5400. "Obarreddieresiscyrillic",
  5401. 0x04ea,
  5402. "Obreve",
  5403. 0x014e,
  5404. "Ocaron",
  5405. 0x01d1,
  5406. "Ocenteredtilde",
  5407. 0x019f,
  5408. "Ocircle",
  5409. 0x24c4,
  5410. "Ocircumflex",
  5411. 0x00d4,
  5412. "Ocircumflexacute",
  5413. 0x1ed0,
  5414. "Ocircumflexdotbelow",
  5415. 0x1ed8,
  5416. "Ocircumflexgrave",
  5417. 0x1ed2,
  5418. "Ocircumflexhookabove",
  5419. 0x1ed4,
  5420. "Ocircumflexsmall",
  5421. 0xf7f4,
  5422. "Ocircumflextilde",
  5423. 0x1ed6,
  5424. "Ocyrillic",
  5425. 0x041e,
  5426. "Odblacute",
  5427. 0x0150,
  5428. "Odblgrave",
  5429. 0x020c,
  5430. "Odieresis",
  5431. 0x00d6,
  5432. "Odieresiscyrillic",
  5433. 0x04e6,
  5434. "Odieresissmall",
  5435. 0xf7f6,
  5436. "Odotbelow",
  5437. 0x1ecc,
  5438. "Ogoneksmall",
  5439. 0xf6fb,
  5440. "Ograve",
  5441. 0x00d2,
  5442. "Ogravesmall",
  5443. 0xf7f2,
  5444. "Oharmenian",
  5445. 0x0555,
  5446. "Ohm",
  5447. 0x2126,
  5448. "Ohookabove",
  5449. 0x1ece,
  5450. "Ohorn",
  5451. 0x01a0,
  5452. "Ohornacute",
  5453. 0x1eda,
  5454. "Ohorndotbelow",
  5455. 0x1ee2,
  5456. "Ohorngrave",
  5457. 0x1edc,
  5458. "Ohornhookabove",
  5459. 0x1ede,
  5460. "Ohorntilde",
  5461. 0x1ee0,
  5462. "Ohungarumlaut",
  5463. 0x0150,
  5464. "Oi",
  5465. 0x01a2,
  5466. "Oinvertedbreve",
  5467. 0x020e,
  5468. "Omacron",
  5469. 0x014c,
  5470. "Omacronacute",
  5471. 0x1e52,
  5472. "Omacrongrave",
  5473. 0x1e50,
  5474. "Omega",
  5475. 0x2126,
  5476. "Omegacyrillic",
  5477. 0x0460,
  5478. "Omegagreek",
  5479. 0x03a9,
  5480. "Omegaroundcyrillic",
  5481. 0x047a,
  5482. "Omegatitlocyrillic",
  5483. 0x047c,
  5484. "Omegatonos",
  5485. 0x038f,
  5486. "Omicron",
  5487. 0x039f,
  5488. "Omicrontonos",
  5489. 0x038c,
  5490. "Omonospace",
  5491. 0xff2f,
  5492. "Oneroman",
  5493. 0x2160,
  5494. "Oogonek",
  5495. 0x01ea,
  5496. "Oogonekmacron",
  5497. 0x01ec,
  5498. "Oopen",
  5499. 0x0186,
  5500. "Oslash",
  5501. 0x00d8,
  5502. "Oslashacute",
  5503. 0x01fe,
  5504. "Oslashsmall",
  5505. 0xf7f8,
  5506. "Osmall",
  5507. 0xf76f,
  5508. "Ostrokeacute",
  5509. 0x01fe,
  5510. "Otcyrillic",
  5511. 0x047e,
  5512. "Otilde",
  5513. 0x00d5,
  5514. "Otildeacute",
  5515. 0x1e4c,
  5516. "Otildedieresis",
  5517. 0x1e4e,
  5518. "Otildesmall",
  5519. 0xf7f5,
  5520. "P",
  5521. 0x0050,
  5522. "Pacute",
  5523. 0x1e54,
  5524. "Pcircle",
  5525. 0x24c5,
  5526. "Pdotaccent",
  5527. 0x1e56,
  5528. "Pecyrillic",
  5529. 0x041f,
  5530. "Peharmenian",
  5531. 0x054a,
  5532. "Pemiddlehookcyrillic",
  5533. 0x04a6,
  5534. "Phi",
  5535. 0x03a6,
  5536. "Phook",
  5537. 0x01a4,
  5538. "Pi",
  5539. 0x03a0,
  5540. "Piwrarmenian",
  5541. 0x0553,
  5542. "Pmonospace",
  5543. 0xff30,
  5544. "Psi",
  5545. 0x03a8,
  5546. "Psicyrillic",
  5547. 0x0470,
  5548. "Psmall",
  5549. 0xf770,
  5550. "Q",
  5551. 0x0051,
  5552. "Qcircle",
  5553. 0x24c6,
  5554. "Qmonospace",
  5555. 0xff31,
  5556. "Qsmall",
  5557. 0xf771,
  5558. "R",
  5559. 0x0052,
  5560. "Raarmenian",
  5561. 0x054c,
  5562. "Racute",
  5563. 0x0154,
  5564. "Rcaron",
  5565. 0x0158,
  5566. "Rcedilla",
  5567. 0x0156,
  5568. "Rcircle",
  5569. 0x24c7,
  5570. "Rcommaaccent",
  5571. 0x0156,
  5572. "Rdblgrave",
  5573. 0x0210,
  5574. "Rdotaccent",
  5575. 0x1e58,
  5576. "Rdotbelow",
  5577. 0x1e5a,
  5578. "Rdotbelowmacron",
  5579. 0x1e5c,
  5580. "Reharmenian",
  5581. 0x0550,
  5582. "Rfraktur",
  5583. 0x211c,
  5584. "Rho",
  5585. 0x03a1,
  5586. "Ringsmall",
  5587. 0xf6fc,
  5588. "Rinvertedbreve",
  5589. 0x0212,
  5590. "Rlinebelow",
  5591. 0x1e5e,
  5592. "Rmonospace",
  5593. 0xff32,
  5594. "Rsmall",
  5595. 0xf772,
  5596. "Rsmallinverted",
  5597. 0x0281,
  5598. "Rsmallinvertedsuperior",
  5599. 0x02b6,
  5600. "S",
  5601. 0x0053,
  5602. "SF010000",
  5603. 0x250c,
  5604. "SF020000",
  5605. 0x2514,
  5606. "SF030000",
  5607. 0x2510,
  5608. "SF040000",
  5609. 0x2518,
  5610. "SF050000",
  5611. 0x253c,
  5612. "SF060000",
  5613. 0x252c,
  5614. "SF070000",
  5615. 0x2534,
  5616. "SF080000",
  5617. 0x251c,
  5618. "SF090000",
  5619. 0x2524,
  5620. "SF100000",
  5621. 0x2500,
  5622. "SF110000",
  5623. 0x2502,
  5624. "SF190000",
  5625. 0x2561,
  5626. "SF200000",
  5627. 0x2562,
  5628. "SF210000",
  5629. 0x2556,
  5630. "SF220000",
  5631. 0x2555,
  5632. "SF230000",
  5633. 0x2563,
  5634. "SF240000",
  5635. 0x2551,
  5636. "SF250000",
  5637. 0x2557,
  5638. "SF260000",
  5639. 0x255d,
  5640. "SF270000",
  5641. 0x255c,
  5642. "SF280000",
  5643. 0x255b,
  5644. "SF360000",
  5645. 0x255e,
  5646. "SF370000",
  5647. 0x255f,
  5648. "SF380000",
  5649. 0x255a,
  5650. "SF390000",
  5651. 0x2554,
  5652. "SF400000",
  5653. 0x2569,
  5654. "SF410000",
  5655. 0x2566,
  5656. "SF420000",
  5657. 0x2560,
  5658. "SF430000",
  5659. 0x2550,
  5660. "SF440000",
  5661. 0x256c,
  5662. "SF450000",
  5663. 0x2567,
  5664. "SF460000",
  5665. 0x2568,
  5666. "SF470000",
  5667. 0x2564,
  5668. "SF480000",
  5669. 0x2565,
  5670. "SF490000",
  5671. 0x2559,
  5672. "SF500000",
  5673. 0x2558,
  5674. "SF510000",
  5675. 0x2552,
  5676. "SF520000",
  5677. 0x2553,
  5678. "SF530000",
  5679. 0x256b,
  5680. "SF540000",
  5681. 0x256a,
  5682. "Sacute",
  5683. 0x015a,
  5684. "Sacutedotaccent",
  5685. 0x1e64,
  5686. "Sampigreek",
  5687. 0x03e0,
  5688. "Scaron",
  5689. 0x0160,
  5690. "Scarondotaccent",
  5691. 0x1e66,
  5692. "Scaronsmall",
  5693. 0xf6fd,
  5694. "Scedilla",
  5695. 0x015e,
  5696. "Schwa",
  5697. 0x018f,
  5698. "Schwacyrillic",
  5699. 0x04d8,
  5700. "Schwadieresiscyrillic",
  5701. 0x04da,
  5702. "Scircle",
  5703. 0x24c8,
  5704. "Scircumflex",
  5705. 0x015c,
  5706. "Scommaaccent",
  5707. 0x0218,
  5708. "Sdotaccent",
  5709. 0x1e60,
  5710. "Sdotbelow",
  5711. 0x1e62,
  5712. "Sdotbelowdotaccent",
  5713. 0x1e68,
  5714. "Seharmenian",
  5715. 0x054d,
  5716. "Sevenroman",
  5717. 0x2166,
  5718. "Shaarmenian",
  5719. 0x0547,
  5720. "Shacyrillic",
  5721. 0x0428,
  5722. "Shchacyrillic",
  5723. 0x0429,
  5724. "Sheicoptic",
  5725. 0x03e2,
  5726. "Shhacyrillic",
  5727. 0x04ba,
  5728. "Shimacoptic",
  5729. 0x03ec,
  5730. "Sigma",
  5731. 0x03a3,
  5732. "Sixroman",
  5733. 0x2165,
  5734. "Smonospace",
  5735. 0xff33,
  5736. "Softsigncyrillic",
  5737. 0x042c,
  5738. "Ssmall",
  5739. 0xf773,
  5740. "Stigmagreek",
  5741. 0x03da,
  5742. "T",
  5743. 0x0054,
  5744. "Tau",
  5745. 0x03a4,
  5746. "Tbar",
  5747. 0x0166,
  5748. "Tcaron",
  5749. 0x0164,
  5750. "Tcedilla",
  5751. 0x0162,
  5752. "Tcircle",
  5753. 0x24c9,
  5754. "Tcircumflexbelow",
  5755. 0x1e70,
  5756. "Tcommaaccent",
  5757. 0x0162,
  5758. "Tdotaccent",
  5759. 0x1e6a,
  5760. "Tdotbelow",
  5761. 0x1e6c,
  5762. "Tecyrillic",
  5763. 0x0422,
  5764. "Tedescendercyrillic",
  5765. 0x04ac,
  5766. "Tenroman",
  5767. 0x2169,
  5768. "Tetsecyrillic",
  5769. 0x04b4,
  5770. "Theta",
  5771. 0x0398,
  5772. "Thook",
  5773. 0x01ac,
  5774. "Thorn",
  5775. 0x00de,
  5776. "Thornsmall",
  5777. 0xf7fe,
  5778. "Threeroman",
  5779. 0x2162,
  5780. "Tildesmall",
  5781. 0xf6fe,
  5782. "Tiwnarmenian",
  5783. 0x054f,
  5784. "Tlinebelow",
  5785. 0x1e6e,
  5786. "Tmonospace",
  5787. 0xff34,
  5788. "Toarmenian",
  5789. 0x0539,
  5790. "Tonefive",
  5791. 0x01bc,
  5792. "Tonesix",
  5793. 0x0184,
  5794. "Tonetwo",
  5795. 0x01a7,
  5796. "Tretroflexhook",
  5797. 0x01ae,
  5798. "Tsecyrillic",
  5799. 0x0426,
  5800. "Tshecyrillic",
  5801. 0x040b,
  5802. "Tsmall",
  5803. 0xf774,
  5804. "Twelveroman",
  5805. 0x216b,
  5806. "Tworoman",
  5807. 0x2161,
  5808. "U",
  5809. 0x0055,
  5810. "Uacute",
  5811. 0x00da,
  5812. "Uacutesmall",
  5813. 0xf7fa,
  5814. "Ubreve",
  5815. 0x016c,
  5816. "Ucaron",
  5817. 0x01d3,
  5818. "Ucircle",
  5819. 0x24ca,
  5820. "Ucircumflex",
  5821. 0x00db,
  5822. "Ucircumflexbelow",
  5823. 0x1e76,
  5824. "Ucircumflexsmall",
  5825. 0xf7fb,
  5826. "Ucyrillic",
  5827. 0x0423,
  5828. "Udblacute",
  5829. 0x0170,
  5830. "Udblgrave",
  5831. 0x0214,
  5832. "Udieresis",
  5833. 0x00dc,
  5834. "Udieresisacute",
  5835. 0x01d7,
  5836. "Udieresisbelow",
  5837. 0x1e72,
  5838. "Udieresiscaron",
  5839. 0x01d9,
  5840. "Udieresiscyrillic",
  5841. 0x04f0,
  5842. "Udieresisgrave",
  5843. 0x01db,
  5844. "Udieresismacron",
  5845. 0x01d5,
  5846. "Udieresissmall",
  5847. 0xf7fc,
  5848. "Udotbelow",
  5849. 0x1ee4,
  5850. "Ugrave",
  5851. 0x00d9,
  5852. "Ugravesmall",
  5853. 0xf7f9,
  5854. "Uhookabove",
  5855. 0x1ee6,
  5856. "Uhorn",
  5857. 0x01af,
  5858. "Uhornacute",
  5859. 0x1ee8,
  5860. "Uhorndotbelow",
  5861. 0x1ef0,
  5862. "Uhorngrave",
  5863. 0x1eea,
  5864. "Uhornhookabove",
  5865. 0x1eec,
  5866. "Uhorntilde",
  5867. 0x1eee,
  5868. "Uhungarumlaut",
  5869. 0x0170,
  5870. "Uhungarumlautcyrillic",
  5871. 0x04f2,
  5872. "Uinvertedbreve",
  5873. 0x0216,
  5874. "Ukcyrillic",
  5875. 0x0478,
  5876. "Umacron",
  5877. 0x016a,
  5878. "Umacroncyrillic",
  5879. 0x04ee,
  5880. "Umacrondieresis",
  5881. 0x1e7a,
  5882. "Umonospace",
  5883. 0xff35,
  5884. "Uogonek",
  5885. 0x0172,
  5886. "Upsilon",
  5887. 0x03a5,
  5888. "Upsilon1",
  5889. 0x03d2,
  5890. "Upsilonacutehooksymbolgreek",
  5891. 0x03d3,
  5892. "Upsilonafrican",
  5893. 0x01b1,
  5894. "Upsilondieresis",
  5895. 0x03ab,
  5896. "Upsilondieresishooksymbolgreek",
  5897. 0x03d4,
  5898. "Upsilonhooksymbol",
  5899. 0x03d2,
  5900. "Upsilontonos",
  5901. 0x038e,
  5902. "Uring",
  5903. 0x016e,
  5904. "Ushortcyrillic",
  5905. 0x040e,
  5906. "Usmall",
  5907. 0xf775,
  5908. "Ustraightcyrillic",
  5909. 0x04ae,
  5910. "Ustraightstrokecyrillic",
  5911. 0x04b0,
  5912. "Utilde",
  5913. 0x0168,
  5914. "Utildeacute",
  5915. 0x1e78,
  5916. "Utildebelow",
  5917. 0x1e74,
  5918. "V",
  5919. 0x0056,
  5920. "Vcircle",
  5921. 0x24cb,
  5922. "Vdotbelow",
  5923. 0x1e7e,
  5924. "Vecyrillic",
  5925. 0x0412,
  5926. "Vewarmenian",
  5927. 0x054e,
  5928. "Vhook",
  5929. 0x01b2,
  5930. "Vmonospace",
  5931. 0xff36,
  5932. "Voarmenian",
  5933. 0x0548,
  5934. "Vsmall",
  5935. 0xf776,
  5936. "Vtilde",
  5937. 0x1e7c,
  5938. "W",
  5939. 0x0057,
  5940. "Wacute",
  5941. 0x1e82,
  5942. "Wcircle",
  5943. 0x24cc,
  5944. "Wcircumflex",
  5945. 0x0174,
  5946. "Wdieresis",
  5947. 0x1e84,
  5948. "Wdotaccent",
  5949. 0x1e86,
  5950. "Wdotbelow",
  5951. 0x1e88,
  5952. "Wgrave",
  5953. 0x1e80,
  5954. "Wmonospace",
  5955. 0xff37,
  5956. "Wsmall",
  5957. 0xf777,
  5958. "X",
  5959. 0x0058,
  5960. "Xcircle",
  5961. 0x24cd,
  5962. "Xdieresis",
  5963. 0x1e8c,
  5964. "Xdotaccent",
  5965. 0x1e8a,
  5966. "Xeharmenian",
  5967. 0x053d,
  5968. "Xi",
  5969. 0x039e,
  5970. "Xmonospace",
  5971. 0xff38,
  5972. "Xsmall",
  5973. 0xf778,
  5974. "Y",
  5975. 0x0059,
  5976. "Yacute",
  5977. 0x00dd,
  5978. "Yacutesmall",
  5979. 0xf7fd,
  5980. "Yatcyrillic",
  5981. 0x0462,
  5982. "Ycircle",
  5983. 0x24ce,
  5984. "Ycircumflex",
  5985. 0x0176,
  5986. "Ydieresis",
  5987. 0x0178,
  5988. "Ydieresissmall",
  5989. 0xf7ff,
  5990. "Ydotaccent",
  5991. 0x1e8e,
  5992. "Ydotbelow",
  5993. 0x1ef4,
  5994. "Yericyrillic",
  5995. 0x042b,
  5996. "Yerudieresiscyrillic",
  5997. 0x04f8,
  5998. "Ygrave",
  5999. 0x1ef2,
  6000. "Yhook",
  6001. 0x01b3,
  6002. "Yhookabove",
  6003. 0x1ef6,
  6004. "Yiarmenian",
  6005. 0x0545,
  6006. "Yicyrillic",
  6007. 0x0407,
  6008. "Yiwnarmenian",
  6009. 0x0552,
  6010. "Ymonospace",
  6011. 0xff39,
  6012. "Ysmall",
  6013. 0xf779,
  6014. "Ytilde",
  6015. 0x1ef8,
  6016. "Yusbigcyrillic",
  6017. 0x046a,
  6018. "Yusbigiotifiedcyrillic",
  6019. 0x046c,
  6020. "Yuslittlecyrillic",
  6021. 0x0466,
  6022. "Yuslittleiotifiedcyrillic",
  6023. 0x0468,
  6024. "Z",
  6025. 0x005a,
  6026. "Zaarmenian",
  6027. 0x0536,
  6028. "Zacute",
  6029. 0x0179,
  6030. "Zcaron",
  6031. 0x017d,
  6032. "Zcaronsmall",
  6033. 0xf6ff,
  6034. "Zcircle",
  6035. 0x24cf,
  6036. "Zcircumflex",
  6037. 0x1e90,
  6038. "Zdot",
  6039. 0x017b,
  6040. "Zdotaccent",
  6041. 0x017b,
  6042. "Zdotbelow",
  6043. 0x1e92,
  6044. "Zecyrillic",
  6045. 0x0417,
  6046. "Zedescendercyrillic",
  6047. 0x0498,
  6048. "Zedieresiscyrillic",
  6049. 0x04de,
  6050. "Zeta",
  6051. 0x0396,
  6052. "Zhearmenian",
  6053. 0x053a,
  6054. "Zhebrevecyrillic",
  6055. 0x04c1,
  6056. "Zhecyrillic",
  6057. 0x0416,
  6058. "Zhedescendercyrillic",
  6059. 0x0496,
  6060. "Zhedieresiscyrillic",
  6061. 0x04dc,
  6062. "Zlinebelow",
  6063. 0x1e94,
  6064. "Zmonospace",
  6065. 0xff3a,
  6066. "Zsmall",
  6067. 0xf77a,
  6068. "Zstroke",
  6069. 0x01b5,
  6070. "a",
  6071. 0x0061,
  6072. "aabengali",
  6073. 0x0986,
  6074. "aacute",
  6075. 0x00e1,
  6076. "aadeva",
  6077. 0x0906,
  6078. "aagujarati",
  6079. 0x0a86,
  6080. "aagurmukhi",
  6081. 0x0a06,
  6082. "aamatragurmukhi",
  6083. 0x0a3e,
  6084. "aarusquare",
  6085. 0x3303,
  6086. "aavowelsignbengali",
  6087. 0x09be,
  6088. "aavowelsigndeva",
  6089. 0x093e,
  6090. "aavowelsigngujarati",
  6091. 0x0abe,
  6092. "abbreviationmarkarmenian",
  6093. 0x055f,
  6094. "abbreviationsigndeva",
  6095. 0x0970,
  6096. "abengali",
  6097. 0x0985,
  6098. "abopomofo",
  6099. 0x311a,
  6100. "abreve",
  6101. 0x0103,
  6102. "abreveacute",
  6103. 0x1eaf,
  6104. "abrevecyrillic",
  6105. 0x04d1,
  6106. "abrevedotbelow",
  6107. 0x1eb7,
  6108. "abrevegrave",
  6109. 0x1eb1,
  6110. "abrevehookabove",
  6111. 0x1eb3,
  6112. "abrevetilde",
  6113. 0x1eb5,
  6114. "acaron",
  6115. 0x01ce,
  6116. "acircle",
  6117. 0x24d0,
  6118. "acircumflex",
  6119. 0x00e2,
  6120. "acircumflexacute",
  6121. 0x1ea5,
  6122. "acircumflexdotbelow",
  6123. 0x1ead,
  6124. "acircumflexgrave",
  6125. 0x1ea7,
  6126. "acircumflexhookabove",
  6127. 0x1ea9,
  6128. "acircumflextilde",
  6129. 0x1eab,
  6130. "acute",
  6131. 0x00b4,
  6132. "acutebelowcmb",
  6133. 0x0317,
  6134. "acutecmb",
  6135. 0x0301,
  6136. "acutecomb",
  6137. 0x0301,
  6138. "acutedeva",
  6139. 0x0954,
  6140. "acutelowmod",
  6141. 0x02cf,
  6142. "acutetonecmb",
  6143. 0x0341,
  6144. "acyrillic",
  6145. 0x0430,
  6146. "adblgrave",
  6147. 0x0201,
  6148. "addakgurmukhi",
  6149. 0x0a71,
  6150. "adeva",
  6151. 0x0905,
  6152. "adieresis",
  6153. 0x00e4,
  6154. "adieresiscyrillic",
  6155. 0x04d3,
  6156. "adieresismacron",
  6157. 0x01df,
  6158. "adotbelow",
  6159. 0x1ea1,
  6160. "adotmacron",
  6161. 0x01e1,
  6162. "ae",
  6163. 0x00e6,
  6164. "aeacute",
  6165. 0x01fd,
  6166. "aekorean",
  6167. 0x3150,
  6168. "aemacron",
  6169. 0x01e3,
  6170. "afii00208",
  6171. 0x2015,
  6172. "afii08941",
  6173. 0x20a4,
  6174. "afii10017",
  6175. 0x0410,
  6176. "afii10018",
  6177. 0x0411,
  6178. "afii10019",
  6179. 0x0412,
  6180. "afii10020",
  6181. 0x0413,
  6182. "afii10021",
  6183. 0x0414,
  6184. "afii10022",
  6185. 0x0415,
  6186. "afii10023",
  6187. 0x0401,
  6188. "afii10024",
  6189. 0x0416,
  6190. "afii10025",
  6191. 0x0417,
  6192. "afii10026",
  6193. 0x0418,
  6194. "afii10027",
  6195. 0x0419,
  6196. "afii10028",
  6197. 0x041a,
  6198. "afii10029",
  6199. 0x041b,
  6200. "afii10030",
  6201. 0x041c,
  6202. "afii10031",
  6203. 0x041d,
  6204. "afii10032",
  6205. 0x041e,
  6206. "afii10033",
  6207. 0x041f,
  6208. "afii10034",
  6209. 0x0420,
  6210. "afii10035",
  6211. 0x0421,
  6212. "afii10036",
  6213. 0x0422,
  6214. "afii10037",
  6215. 0x0423,
  6216. "afii10038",
  6217. 0x0424,
  6218. "afii10039",
  6219. 0x0425,
  6220. "afii10040",
  6221. 0x0426,
  6222. "afii10041",
  6223. 0x0427,
  6224. "afii10042",
  6225. 0x0428,
  6226. "afii10043",
  6227. 0x0429,
  6228. "afii10044",
  6229. 0x042a,
  6230. "afii10045",
  6231. 0x042b,
  6232. "afii10046",
  6233. 0x042c,
  6234. "afii10047",
  6235. 0x042d,
  6236. "afii10048",
  6237. 0x042e,
  6238. "afii10049",
  6239. 0x042f,
  6240. "afii10050",
  6241. 0x0490,
  6242. "afii10051",
  6243. 0x0402,
  6244. "afii10052",
  6245. 0x0403,
  6246. "afii10053",
  6247. 0x0404,
  6248. "afii10054",
  6249. 0x0405,
  6250. "afii10055",
  6251. 0x0406,
  6252. "afii10056",
  6253. 0x0407,
  6254. "afii10057",
  6255. 0x0408,
  6256. "afii10058",
  6257. 0x0409,
  6258. "afii10059",
  6259. 0x040a,
  6260. "afii10060",
  6261. 0x040b,
  6262. "afii10061",
  6263. 0x040c,
  6264. "afii10062",
  6265. 0x040e,
  6266. "afii10063",
  6267. 0xf6c4,
  6268. "afii10064",
  6269. 0xf6c5,
  6270. "afii10065",
  6271. 0x0430,
  6272. "afii10066",
  6273. 0x0431,
  6274. "afii10067",
  6275. 0x0432,
  6276. "afii10068",
  6277. 0x0433,
  6278. "afii10069",
  6279. 0x0434,
  6280. "afii10070",
  6281. 0x0435,
  6282. "afii10071",
  6283. 0x0451,
  6284. "afii10072",
  6285. 0x0436,
  6286. "afii10073",
  6287. 0x0437,
  6288. "afii10074",
  6289. 0x0438,
  6290. "afii10075",
  6291. 0x0439,
  6292. "afii10076",
  6293. 0x043a,
  6294. "afii10077",
  6295. 0x043b,
  6296. "afii10078",
  6297. 0x043c,
  6298. "afii10079",
  6299. 0x043d,
  6300. "afii10080",
  6301. 0x043e,
  6302. "afii10081",
  6303. 0x043f,
  6304. "afii10082",
  6305. 0x0440,
  6306. "afii10083",
  6307. 0x0441,
  6308. "afii10084",
  6309. 0x0442,
  6310. "afii10085",
  6311. 0x0443,
  6312. "afii10086",
  6313. 0x0444,
  6314. "afii10087",
  6315. 0x0445,
  6316. "afii10088",
  6317. 0x0446,
  6318. "afii10089",
  6319. 0x0447,
  6320. "afii10090",
  6321. 0x0448,
  6322. "afii10091",
  6323. 0x0449,
  6324. "afii10092",
  6325. 0x044a,
  6326. "afii10093",
  6327. 0x044b,
  6328. "afii10094",
  6329. 0x044c,
  6330. "afii10095",
  6331. 0x044d,
  6332. "afii10096",
  6333. 0x044e,
  6334. "afii10097",
  6335. 0x044f,
  6336. "afii10098",
  6337. 0x0491,
  6338. "afii10099",
  6339. 0x0452,
  6340. "afii10100",
  6341. 0x0453,
  6342. "afii10101",
  6343. 0x0454,
  6344. "afii10102",
  6345. 0x0455,
  6346. "afii10103",
  6347. 0x0456,
  6348. "afii10104",
  6349. 0x0457,
  6350. "afii10105",
  6351. 0x0458,
  6352. "afii10106",
  6353. 0x0459,
  6354. "afii10107",
  6355. 0x045a,
  6356. "afii10108",
  6357. 0x045b,
  6358. "afii10109",
  6359. 0x045c,
  6360. "afii10110",
  6361. 0x045e,
  6362. "afii10145",
  6363. 0x040f,
  6364. "afii10146",
  6365. 0x0462,
  6366. "afii10147",
  6367. 0x0472,
  6368. "afii10148",
  6369. 0x0474,
  6370. "afii10192",
  6371. 0xf6c6,
  6372. "afii10193",
  6373. 0x045f,
  6374. "afii10194",
  6375. 0x0463,
  6376. "afii10195",
  6377. 0x0473,
  6378. "afii10196",
  6379. 0x0475,
  6380. "afii10831",
  6381. 0xf6c7,
  6382. "afii10832",
  6383. 0xf6c8,
  6384. "afii10846",
  6385. 0x04d9,
  6386. "afii299",
  6387. 0x200e,
  6388. "afii300",
  6389. 0x200f,
  6390. "afii301",
  6391. 0x200d,
  6392. "afii57381",
  6393. 0x066a,
  6394. "afii57388",
  6395. 0x060c,
  6396. "afii57392",
  6397. 0x0660,
  6398. "afii57393",
  6399. 0x0661,
  6400. "afii57394",
  6401. 0x0662,
  6402. "afii57395",
  6403. 0x0663,
  6404. "afii57396",
  6405. 0x0664,
  6406. "afii57397",
  6407. 0x0665,
  6408. "afii57398",
  6409. 0x0666,
  6410. "afii57399",
  6411. 0x0667,
  6412. "afii57400",
  6413. 0x0668,
  6414. "afii57401",
  6415. 0x0669,
  6416. "afii57403",
  6417. 0x061b,
  6418. "afii57407",
  6419. 0x061f,
  6420. "afii57409",
  6421. 0x0621,
  6422. "afii57410",
  6423. 0x0622,
  6424. "afii57411",
  6425. 0x0623,
  6426. "afii57412",
  6427. 0x0624,
  6428. "afii57413",
  6429. 0x0625,
  6430. "afii57414",
  6431. 0x0626,
  6432. "afii57415",
  6433. 0x0627,
  6434. "afii57416",
  6435. 0x0628,
  6436. "afii57417",
  6437. 0x0629,
  6438. "afii57418",
  6439. 0x062a,
  6440. "afii57419",
  6441. 0x062b,
  6442. "afii57420",
  6443. 0x062c,
  6444. "afii57421",
  6445. 0x062d,
  6446. "afii57422",
  6447. 0x062e,
  6448. "afii57423",
  6449. 0x062f,
  6450. "afii57424",
  6451. 0x0630,
  6452. "afii57425",
  6453. 0x0631,
  6454. "afii57426",
  6455. 0x0632,
  6456. "afii57427",
  6457. 0x0633,
  6458. "afii57428",
  6459. 0x0634,
  6460. "afii57429",
  6461. 0x0635,
  6462. "afii57430",
  6463. 0x0636,
  6464. "afii57431",
  6465. 0x0637,
  6466. "afii57432",
  6467. 0x0638,
  6468. "afii57433",
  6469. 0x0639,
  6470. "afii57434",
  6471. 0x063a,
  6472. "afii57440",
  6473. 0x0640,
  6474. "afii57441",
  6475. 0x0641,
  6476. "afii57442",
  6477. 0x0642,
  6478. "afii57443",
  6479. 0x0643,
  6480. "afii57444",
  6481. 0x0644,
  6482. "afii57445",
  6483. 0x0645,
  6484. "afii57446",
  6485. 0x0646,
  6486. "afii57448",
  6487. 0x0648,
  6488. "afii57449",
  6489. 0x0649,
  6490. "afii57450",
  6491. 0x064a,
  6492. "afii57451",
  6493. 0x064b,
  6494. "afii57452",
  6495. 0x064c,
  6496. "afii57453",
  6497. 0x064d,
  6498. "afii57454",
  6499. 0x064e,
  6500. "afii57455",
  6501. 0x064f,
  6502. "afii57456",
  6503. 0x0650,
  6504. "afii57457",
  6505. 0x0651,
  6506. "afii57458",
  6507. 0x0652,
  6508. "afii57470",
  6509. 0x0647,
  6510. "afii57505",
  6511. 0x06a4,
  6512. "afii57506",
  6513. 0x067e,
  6514. "afii57507",
  6515. 0x0686,
  6516. "afii57508",
  6517. 0x0698,
  6518. "afii57509",
  6519. 0x06af,
  6520. "afii57511",
  6521. 0x0679,
  6522. "afii57512",
  6523. 0x0688,
  6524. "afii57513",
  6525. 0x0691,
  6526. "afii57514",
  6527. 0x06ba,
  6528. "afii57519",
  6529. 0x06d2,
  6530. "afii57534",
  6531. 0x06d5,
  6532. "afii57636",
  6533. 0x20aa,
  6534. "afii57645",
  6535. 0x05be,
  6536. "afii57658",
  6537. 0x05c3,
  6538. "afii57664",
  6539. 0x05d0,
  6540. "afii57665",
  6541. 0x05d1,
  6542. "afii57666",
  6543. 0x05d2,
  6544. "afii57667",
  6545. 0x05d3,
  6546. "afii57668",
  6547. 0x05d4,
  6548. "afii57669",
  6549. 0x05d5,
  6550. "afii57670",
  6551. 0x05d6,
  6552. "afii57671",
  6553. 0x05d7,
  6554. "afii57672",
  6555. 0x05d8,
  6556. "afii57673",
  6557. 0x05d9,
  6558. "afii57674",
  6559. 0x05da,
  6560. "afii57675",
  6561. 0x05db,
  6562. "afii57676",
  6563. 0x05dc,
  6564. "afii57677",
  6565. 0x05dd,
  6566. "afii57678",
  6567. 0x05de,
  6568. "afii57679",
  6569. 0x05df,
  6570. "afii57680",
  6571. 0x05e0,
  6572. "afii57681",
  6573. 0x05e1,
  6574. "afii57682",
  6575. 0x05e2,
  6576. "afii57683",
  6577. 0x05e3,
  6578. "afii57684",
  6579. 0x05e4,
  6580. "afii57685",
  6581. 0x05e5,
  6582. "afii57686",
  6583. 0x05e6,
  6584. "afii57687",
  6585. 0x05e7,
  6586. "afii57688",
  6587. 0x05e8,
  6588. "afii57689",
  6589. 0x05e9,
  6590. "afii57690",
  6591. 0x05ea,
  6592. "afii57694",
  6593. 0xfb2a,
  6594. "afii57695",
  6595. 0xfb2b,
  6596. "afii57700",
  6597. 0xfb4b,
  6598. "afii57705",
  6599. 0xfb1f,
  6600. "afii57716",
  6601. 0x05f0,
  6602. "afii57717",
  6603. 0x05f1,
  6604. "afii57718",
  6605. 0x05f2,
  6606. "afii57723",
  6607. 0xfb35,
  6608. "afii57793",
  6609. 0x05b4,
  6610. "afii57794",
  6611. 0x05b5,
  6612. "afii57795",
  6613. 0x05b6,
  6614. "afii57796",
  6615. 0x05bb,
  6616. "afii57797",
  6617. 0x05b8,
  6618. "afii57798",
  6619. 0x05b7,
  6620. "afii57799",
  6621. 0x05b0,
  6622. "afii57800",
  6623. 0x05b2,
  6624. "afii57801",
  6625. 0x05b1,
  6626. "afii57802",
  6627. 0x05b3,
  6628. "afii57803",
  6629. 0x05c2,
  6630. "afii57804",
  6631. 0x05c1,
  6632. "afii57806",
  6633. 0x05b9,
  6634. "afii57807",
  6635. 0x05bc,
  6636. "afii57839",
  6637. 0x05bd,
  6638. "afii57841",
  6639. 0x05bf,
  6640. "afii57842",
  6641. 0x05c0,
  6642. "afii57929",
  6643. 0x02bc,
  6644. "afii61248",
  6645. 0x2105,
  6646. "afii61289",
  6647. 0x2113,
  6648. "afii61352",
  6649. 0x2116,
  6650. "afii61573",
  6651. 0x202c,
  6652. "afii61574",
  6653. 0x202d,
  6654. "afii61575",
  6655. 0x202e,
  6656. "afii61664",
  6657. 0x200c,
  6658. "afii63167",
  6659. 0x066d,
  6660. "afii64937",
  6661. 0x02bd,
  6662. "agrave",
  6663. 0x00e0,
  6664. "agujarati",
  6665. 0x0a85,
  6666. "agurmukhi",
  6667. 0x0a05,
  6668. "ahiragana",
  6669. 0x3042,
  6670. "ahookabove",
  6671. 0x1ea3,
  6672. "aibengali",
  6673. 0x0990,
  6674. "aibopomofo",
  6675. 0x311e,
  6676. "aideva",
  6677. 0x0910,
  6678. "aiecyrillic",
  6679. 0x04d5,
  6680. "aigujarati",
  6681. 0x0a90,
  6682. "aigurmukhi",
  6683. 0x0a10,
  6684. "aimatragurmukhi",
  6685. 0x0a48,
  6686. "ainarabic",
  6687. 0x0639,
  6688. "ainfinalarabic",
  6689. 0xfeca,
  6690. "aininitialarabic",
  6691. 0xfecb,
  6692. "ainmedialarabic",
  6693. 0xfecc,
  6694. "ainvertedbreve",
  6695. 0x0203,
  6696. "aivowelsignbengali",
  6697. 0x09c8,
  6698. "aivowelsigndeva",
  6699. 0x0948,
  6700. "aivowelsigngujarati",
  6701. 0x0ac8,
  6702. "akatakana",
  6703. 0x30a2,
  6704. "akatakanahalfwidth",
  6705. 0xff71,
  6706. "akorean",
  6707. 0x314f,
  6708. "alef",
  6709. 0x05d0,
  6710. "alefarabic",
  6711. 0x0627,
  6712. "alefdageshhebrew",
  6713. 0xfb30,
  6714. "aleffinalarabic",
  6715. 0xfe8e,
  6716. "alefhamzaabovearabic",
  6717. 0x0623,
  6718. "alefhamzaabovefinalarabic",
  6719. 0xfe84,
  6720. "alefhamzabelowarabic",
  6721. 0x0625,
  6722. "alefhamzabelowfinalarabic",
  6723. 0xfe88,
  6724. "alefhebrew",
  6725. 0x05d0,
  6726. "aleflamedhebrew",
  6727. 0xfb4f,
  6728. "alefmaddaabovearabic",
  6729. 0x0622,
  6730. "alefmaddaabovefinalarabic",
  6731. 0xfe82,
  6732. "alefmaksuraarabic",
  6733. 0x0649,
  6734. "alefmaksurafinalarabic",
  6735. 0xfef0,
  6736. "alefmaksurainitialarabic",
  6737. 0xfef3,
  6738. "alefmaksuramedialarabic",
  6739. 0xfef4,
  6740. "alefpatahhebrew",
  6741. 0xfb2e,
  6742. "alefqamatshebrew",
  6743. 0xfb2f,
  6744. "aleph",
  6745. 0x2135,
  6746. "allequal",
  6747. 0x224c,
  6748. "alpha",
  6749. 0x03b1,
  6750. "alphatonos",
  6751. 0x03ac,
  6752. "amacron",
  6753. 0x0101,
  6754. "amonospace",
  6755. 0xff41,
  6756. "ampersand",
  6757. 0x0026,
  6758. "ampersandmonospace",
  6759. 0xff06,
  6760. "ampersandsmall",
  6761. 0xf726,
  6762. "amsquare",
  6763. 0x33c2,
  6764. "anbopomofo",
  6765. 0x3122,
  6766. "angbopomofo",
  6767. 0x3124,
  6768. "angbracketleft",
  6769. 0x3008,
  6770. "angbracketright",
  6771. 0x3009,
  6772. "angkhankhuthai",
  6773. 0x0e5a,
  6774. "angle",
  6775. 0x2220,
  6776. "anglebracketleft",
  6777. 0x3008,
  6778. "anglebracketleftvertical",
  6779. 0xfe3f,
  6780. "anglebracketright",
  6781. 0x3009,
  6782. "anglebracketrightvertical",
  6783. 0xfe40,
  6784. "angleleft",
  6785. 0x2329,
  6786. "angleright",
  6787. 0x232a,
  6788. "angstrom",
  6789. 0x212b,
  6790. "anoteleia",
  6791. 0x0387,
  6792. "anudattadeva",
  6793. 0x0952,
  6794. "anusvarabengali",
  6795. 0x0982,
  6796. "anusvaradeva",
  6797. 0x0902,
  6798. "anusvaragujarati",
  6799. 0x0a82,
  6800. "aogonek",
  6801. 0x0105,
  6802. "apaatosquare",
  6803. 0x3300,
  6804. "aparen",
  6805. 0x249c,
  6806. "apostrophearmenian",
  6807. 0x055a,
  6808. "apostrophemod",
  6809. 0x02bc,
  6810. "apple",
  6811. 0xf8ff,
  6812. "approaches",
  6813. 0x2250,
  6814. "approxequal",
  6815. 0x2248,
  6816. "approxequalorimage",
  6817. 0x2252,
  6818. "approximatelyequal",
  6819. 0x2245,
  6820. "araeaekorean",
  6821. 0x318e,
  6822. "araeakorean",
  6823. 0x318d,
  6824. "arc",
  6825. 0x2312,
  6826. "arighthalfring",
  6827. 0x1e9a,
  6828. "aring",
  6829. 0x00e5,
  6830. "aringacute",
  6831. 0x01fb,
  6832. "aringbelow",
  6833. 0x1e01,
  6834. "arrowboth",
  6835. 0x2194,
  6836. "arrowdashdown",
  6837. 0x21e3,
  6838. "arrowdashleft",
  6839. 0x21e0,
  6840. "arrowdashright",
  6841. 0x21e2,
  6842. "arrowdashup",
  6843. 0x21e1,
  6844. "arrowdblboth",
  6845. 0x21d4,
  6846. "arrowdbldown",
  6847. 0x21d3,
  6848. "arrowdblleft",
  6849. 0x21d0,
  6850. "arrowdblright",
  6851. 0x21d2,
  6852. "arrowdblup",
  6853. 0x21d1,
  6854. "arrowdown",
  6855. 0x2193,
  6856. "arrowdownleft",
  6857. 0x2199,
  6858. "arrowdownright",
  6859. 0x2198,
  6860. "arrowdownwhite",
  6861. 0x21e9,
  6862. "arrowheaddownmod",
  6863. 0x02c5,
  6864. "arrowheadleftmod",
  6865. 0x02c2,
  6866. "arrowheadrightmod",
  6867. 0x02c3,
  6868. "arrowheadupmod",
  6869. 0x02c4,
  6870. "arrowhorizex",
  6871. 0xf8e7,
  6872. "arrowleft",
  6873. 0x2190,
  6874. "arrowleftdbl",
  6875. 0x21d0,
  6876. "arrowleftdblstroke",
  6877. 0x21cd,
  6878. "arrowleftoverright",
  6879. 0x21c6,
  6880. "arrowleftwhite",
  6881. 0x21e6,
  6882. "arrowright",
  6883. 0x2192,
  6884. "arrowrightdblstroke",
  6885. 0x21cf,
  6886. "arrowrightheavy",
  6887. 0x279e,
  6888. "arrowrightoverleft",
  6889. 0x21c4,
  6890. "arrowrightwhite",
  6891. 0x21e8,
  6892. "arrowtableft",
  6893. 0x21e4,
  6894. "arrowtabright",
  6895. 0x21e5,
  6896. "arrowup",
  6897. 0x2191,
  6898. "arrowupdn",
  6899. 0x2195,
  6900. "arrowupdnbse",
  6901. 0x21a8,
  6902. "arrowupdownbase",
  6903. 0x21a8,
  6904. "arrowupleft",
  6905. 0x2196,
  6906. "arrowupleftofdown",
  6907. 0x21c5,
  6908. "arrowupright",
  6909. 0x2197,
  6910. "arrowupwhite",
  6911. 0x21e7,
  6912. "arrowvertex",
  6913. 0xf8e6,
  6914. "asciicircum",
  6915. 0x005e,
  6916. "asciicircummonospace",
  6917. 0xff3e,
  6918. "asciitilde",
  6919. 0x007e,
  6920. "asciitildemonospace",
  6921. 0xff5e,
  6922. "ascript",
  6923. 0x0251,
  6924. "ascriptturned",
  6925. 0x0252,
  6926. "asmallhiragana",
  6927. 0x3041,
  6928. "asmallkatakana",
  6929. 0x30a1,
  6930. "asmallkatakanahalfwidth",
  6931. 0xff67,
  6932. "asterisk",
  6933. 0x002a,
  6934. "asteriskaltonearabic",
  6935. 0x066d,
  6936. "asteriskarabic",
  6937. 0x066d,
  6938. "asteriskmath",
  6939. 0x2217,
  6940. "asteriskmonospace",
  6941. 0xff0a,
  6942. "asterisksmall",
  6943. 0xfe61,
  6944. "asterism",
  6945. 0x2042,
  6946. "asuperior",
  6947. 0xf6e9,
  6948. "asymptoticallyequal",
  6949. 0x2243,
  6950. "at",
  6951. 0x0040,
  6952. "atilde",
  6953. 0x00e3,
  6954. "atmonospace",
  6955. 0xff20,
  6956. "atsmall",
  6957. 0xfe6b,
  6958. "aturned",
  6959. 0x0250,
  6960. "aubengali",
  6961. 0x0994,
  6962. "aubopomofo",
  6963. 0x3120,
  6964. "audeva",
  6965. 0x0914,
  6966. "augujarati",
  6967. 0x0a94,
  6968. "augurmukhi",
  6969. 0x0a14,
  6970. "aulengthmarkbengali",
  6971. 0x09d7,
  6972. "aumatragurmukhi",
  6973. 0x0a4c,
  6974. "auvowelsignbengali",
  6975. 0x09cc,
  6976. "auvowelsigndeva",
  6977. 0x094c,
  6978. "auvowelsigngujarati",
  6979. 0x0acc,
  6980. "avagrahadeva",
  6981. 0x093d,
  6982. "aybarmenian",
  6983. 0x0561,
  6984. "ayin",
  6985. 0x05e2,
  6986. "ayinaltonehebrew",
  6987. 0xfb20,
  6988. "ayinhebrew",
  6989. 0x05e2,
  6990. "b",
  6991. 0x0062,
  6992. "babengali",
  6993. 0x09ac,
  6994. "backslash",
  6995. 0x005c,
  6996. "backslashmonospace",
  6997. 0xff3c,
  6998. "badeva",
  6999. 0x092c,
  7000. "bagujarati",
  7001. 0x0aac,
  7002. "bagurmukhi",
  7003. 0x0a2c,
  7004. "bahiragana",
  7005. 0x3070,
  7006. "bahtthai",
  7007. 0x0e3f,
  7008. "bakatakana",
  7009. 0x30d0,
  7010. "bar",
  7011. 0x007c,
  7012. "barmonospace",
  7013. 0xff5c,
  7014. "bbopomofo",
  7015. 0x3105,
  7016. "bcircle",
  7017. 0x24d1,
  7018. "bdotaccent",
  7019. 0x1e03,
  7020. "bdotbelow",
  7021. 0x1e05,
  7022. "beamedsixteenthnotes",
  7023. 0x266c,
  7024. "because",
  7025. 0x2235,
  7026. "becyrillic",
  7027. 0x0431,
  7028. "beharabic",
  7029. 0x0628,
  7030. "behfinalarabic",
  7031. 0xfe90,
  7032. "behinitialarabic",
  7033. 0xfe91,
  7034. "behiragana",
  7035. 0x3079,
  7036. "behmedialarabic",
  7037. 0xfe92,
  7038. "behmeeminitialarabic",
  7039. 0xfc9f,
  7040. "behmeemisolatedarabic",
  7041. 0xfc08,
  7042. "behnoonfinalarabic",
  7043. 0xfc6d,
  7044. "bekatakana",
  7045. 0x30d9,
  7046. "benarmenian",
  7047. 0x0562,
  7048. "bet",
  7049. 0x05d1,
  7050. "beta",
  7051. 0x03b2,
  7052. "betasymbolgreek",
  7053. 0x03d0,
  7054. "betdagesh",
  7055. 0xfb31,
  7056. "betdageshhebrew",
  7057. 0xfb31,
  7058. "bethebrew",
  7059. 0x05d1,
  7060. "betrafehebrew",
  7061. 0xfb4c,
  7062. "bhabengali",
  7063. 0x09ad,
  7064. "bhadeva",
  7065. 0x092d,
  7066. "bhagujarati",
  7067. 0x0aad,
  7068. "bhagurmukhi",
  7069. 0x0a2d,
  7070. "bhook",
  7071. 0x0253,
  7072. "bihiragana",
  7073. 0x3073,
  7074. "bikatakana",
  7075. 0x30d3,
  7076. "bilabialclick",
  7077. 0x0298,
  7078. "bindigurmukhi",
  7079. 0x0a02,
  7080. "birusquare",
  7081. 0x3331,
  7082. "blackcircle",
  7083. 0x25cf,
  7084. "blackdiamond",
  7085. 0x25c6,
  7086. "blackdownpointingtriangle",
  7087. 0x25bc,
  7088. "blackleftpointingpointer",
  7089. 0x25c4,
  7090. "blackleftpointingtriangle",
  7091. 0x25c0,
  7092. "blacklenticularbracketleft",
  7093. 0x3010,
  7094. "blacklenticularbracketleftvertical",
  7095. 0xfe3b,
  7096. "blacklenticularbracketright",
  7097. 0x3011,
  7098. "blacklenticularbracketrightvertical",
  7099. 0xfe3c,
  7100. "blacklowerlefttriangle",
  7101. 0x25e3,
  7102. "blacklowerrighttriangle",
  7103. 0x25e2,
  7104. "blackrectangle",
  7105. 0x25ac,
  7106. "blackrightpointingpointer",
  7107. 0x25ba,
  7108. "blackrightpointingtriangle",
  7109. 0x25b6,
  7110. "blacksmallsquare",
  7111. 0x25aa,
  7112. "blacksmilingface",
  7113. 0x263b,
  7114. "blacksquare",
  7115. 0x25a0,
  7116. "blackstar",
  7117. 0x2605,
  7118. "blackupperlefttriangle",
  7119. 0x25e4,
  7120. "blackupperrighttriangle",
  7121. 0x25e5,
  7122. "blackuppointingsmalltriangle",
  7123. 0x25b4,
  7124. "blackuppointingtriangle",
  7125. 0x25b2,
  7126. "blank",
  7127. 0x2423,
  7128. "blinebelow",
  7129. 0x1e07,
  7130. "block",
  7131. 0x2588,
  7132. "bmonospace",
  7133. 0xff42,
  7134. "bobaimaithai",
  7135. 0x0e1a,
  7136. "bohiragana",
  7137. 0x307c,
  7138. "bokatakana",
  7139. 0x30dc,
  7140. "bparen",
  7141. 0x249d,
  7142. "bqsquare",
  7143. 0x33c3,
  7144. "braceex",
  7145. 0xf8f4,
  7146. "braceleft",
  7147. 0x007b,
  7148. "braceleftbt",
  7149. 0xf8f3,
  7150. "braceleftmid",
  7151. 0xf8f2,
  7152. "braceleftmonospace",
  7153. 0xff5b,
  7154. "braceleftsmall",
  7155. 0xfe5b,
  7156. "bracelefttp",
  7157. 0xf8f1,
  7158. "braceleftvertical",
  7159. 0xfe37,
  7160. "braceright",
  7161. 0x007d,
  7162. "bracerightbt",
  7163. 0xf8fe,
  7164. "bracerightmid",
  7165. 0xf8fd,
  7166. "bracerightmonospace",
  7167. 0xff5d,
  7168. "bracerightsmall",
  7169. 0xfe5c,
  7170. "bracerighttp",
  7171. 0xf8fc,
  7172. "bracerightvertical",
  7173. 0xfe38,
  7174. "bracketleft",
  7175. 0x005b,
  7176. "bracketleftbt",
  7177. 0xf8f0,
  7178. "bracketleftex",
  7179. 0xf8ef,
  7180. "bracketleftmonospace",
  7181. 0xff3b,
  7182. "bracketlefttp",
  7183. 0xf8ee,
  7184. "bracketright",
  7185. 0x005d,
  7186. "bracketrightbt",
  7187. 0xf8fb,
  7188. "bracketrightex",
  7189. 0xf8fa,
  7190. "bracketrightmonospace",
  7191. 0xff3d,
  7192. "bracketrighttp",
  7193. 0xf8f9,
  7194. "breve",
  7195. 0x02d8,
  7196. "brevebelowcmb",
  7197. 0x032e,
  7198. "brevecmb",
  7199. 0x0306,
  7200. "breveinvertedbelowcmb",
  7201. 0x032f,
  7202. "breveinvertedcmb",
  7203. 0x0311,
  7204. "breveinverteddoublecmb",
  7205. 0x0361,
  7206. "bridgebelowcmb",
  7207. 0x032a,
  7208. "bridgeinvertedbelowcmb",
  7209. 0x033a,
  7210. "brokenbar",
  7211. 0x00a6,
  7212. "bstroke",
  7213. 0x0180,
  7214. "bsuperior",
  7215. 0xf6ea,
  7216. "btopbar",
  7217. 0x0183,
  7218. "buhiragana",
  7219. 0x3076,
  7220. "bukatakana",
  7221. 0x30d6,
  7222. "bullet",
  7223. 0x2022,
  7224. "bulletinverse",
  7225. 0x25d8,
  7226. "bulletoperator",
  7227. 0x2219,
  7228. "bullseye",
  7229. 0x25ce,
  7230. "c",
  7231. 0x0063,
  7232. "caarmenian",
  7233. 0x056e,
  7234. "cabengali",
  7235. 0x099a,
  7236. "cacute",
  7237. 0x0107,
  7238. "cadeva",
  7239. 0x091a,
  7240. "cagujarati",
  7241. 0x0a9a,
  7242. "cagurmukhi",
  7243. 0x0a1a,
  7244. "calsquare",
  7245. 0x3388,
  7246. "candrabindubengali",
  7247. 0x0981,
  7248. "candrabinducmb",
  7249. 0x0310,
  7250. "candrabindudeva",
  7251. 0x0901,
  7252. "candrabindugujarati",
  7253. 0x0a81,
  7254. "capslock",
  7255. 0x21ea,
  7256. "careof",
  7257. 0x2105,
  7258. "caron",
  7259. 0x02c7,
  7260. "caronbelowcmb",
  7261. 0x032c,
  7262. "caroncmb",
  7263. 0x030c,
  7264. "carriagereturn",
  7265. 0x21b5,
  7266. "cbopomofo",
  7267. 0x3118,
  7268. "ccaron",
  7269. 0x010d,
  7270. "ccedilla",
  7271. 0x00e7,
  7272. "ccedillaacute",
  7273. 0x1e09,
  7274. "ccircle",
  7275. 0x24d2,
  7276. "ccircumflex",
  7277. 0x0109,
  7278. "ccurl",
  7279. 0x0255,
  7280. "cdot",
  7281. 0x010b,
  7282. "cdotaccent",
  7283. 0x010b,
  7284. "cdsquare",
  7285. 0x33c5,
  7286. "cedilla",
  7287. 0x00b8,
  7288. "cedillacmb",
  7289. 0x0327,
  7290. "cent",
  7291. 0x00a2,
  7292. "centigrade",
  7293. 0x2103,
  7294. "centinferior",
  7295. 0xf6df,
  7296. "centmonospace",
  7297. 0xffe0,
  7298. "centoldstyle",
  7299. 0xf7a2,
  7300. "centsuperior",
  7301. 0xf6e0,
  7302. "chaarmenian",
  7303. 0x0579,
  7304. "chabengali",
  7305. 0x099b,
  7306. "chadeva",
  7307. 0x091b,
  7308. "chagujarati",
  7309. 0x0a9b,
  7310. "chagurmukhi",
  7311. 0x0a1b,
  7312. "chbopomofo",
  7313. 0x3114,
  7314. "cheabkhasiancyrillic",
  7315. 0x04bd,
  7316. "checkmark",
  7317. 0x2713,
  7318. "checyrillic",
  7319. 0x0447,
  7320. "chedescenderabkhasiancyrillic",
  7321. 0x04bf,
  7322. "chedescendercyrillic",
  7323. 0x04b7,
  7324. "chedieresiscyrillic",
  7325. 0x04f5,
  7326. "cheharmenian",
  7327. 0x0573,
  7328. "chekhakassiancyrillic",
  7329. 0x04cc,
  7330. "cheverticalstrokecyrillic",
  7331. 0x04b9,
  7332. "chi",
  7333. 0x03c7,
  7334. "chieuchacirclekorean",
  7335. 0x3277,
  7336. "chieuchaparenkorean",
  7337. 0x3217,
  7338. "chieuchcirclekorean",
  7339. 0x3269,
  7340. "chieuchkorean",
  7341. 0x314a,
  7342. "chieuchparenkorean",
  7343. 0x3209,
  7344. "chochangthai",
  7345. 0x0e0a,
  7346. "chochanthai",
  7347. 0x0e08,
  7348. "chochingthai",
  7349. 0x0e09,
  7350. "chochoethai",
  7351. 0x0e0c,
  7352. "chook",
  7353. 0x0188,
  7354. "cieucacirclekorean",
  7355. 0x3276,
  7356. "cieucaparenkorean",
  7357. 0x3216,
  7358. "cieuccirclekorean",
  7359. 0x3268,
  7360. "cieuckorean",
  7361. 0x3148,
  7362. "cieucparenkorean",
  7363. 0x3208,
  7364. "cieucuparenkorean",
  7365. 0x321c,
  7366. "circle",
  7367. 0x25cb,
  7368. "circlecopyrt",
  7369. 0x00a9,
  7370. "circlemultiply",
  7371. 0x2297,
  7372. "circleot",
  7373. 0x2299,
  7374. "circleplus",
  7375. 0x2295,
  7376. "circlepostalmark",
  7377. 0x3036,
  7378. "circlewithlefthalfblack",
  7379. 0x25d0,
  7380. "circlewithrighthalfblack",
  7381. 0x25d1,
  7382. "circumflex",
  7383. 0x02c6,
  7384. "circumflexbelowcmb",
  7385. 0x032d,
  7386. "circumflexcmb",
  7387. 0x0302,
  7388. "clear",
  7389. 0x2327,
  7390. "clickalveolar",
  7391. 0x01c2,
  7392. "clickdental",
  7393. 0x01c0,
  7394. "clicklateral",
  7395. 0x01c1,
  7396. "clickretroflex",
  7397. 0x01c3,
  7398. "club",
  7399. 0x2663,
  7400. "clubsuitblack",
  7401. 0x2663,
  7402. "clubsuitwhite",
  7403. 0x2667,
  7404. "cmcubedsquare",
  7405. 0x33a4,
  7406. "cmonospace",
  7407. 0xff43,
  7408. "cmsquaredsquare",
  7409. 0x33a0,
  7410. "coarmenian",
  7411. 0x0581,
  7412. "colon",
  7413. 0x003a,
  7414. "colonmonetary",
  7415. 0x20a1,
  7416. "colonmonospace",
  7417. 0xff1a,
  7418. "colonsign",
  7419. 0x20a1,
  7420. "colonsmall",
  7421. 0xfe55,
  7422. "colontriangularhalfmod",
  7423. 0x02d1,
  7424. "colontriangularmod",
  7425. 0x02d0,
  7426. "comma",
  7427. 0x002c,
  7428. "commaabovecmb",
  7429. 0x0313,
  7430. "commaaboverightcmb",
  7431. 0x0315,
  7432. "commaaccent",
  7433. 0xf6c3,
  7434. "commaarabic",
  7435. 0x060c,
  7436. "commaarmenian",
  7437. 0x055d,
  7438. "commainferior",
  7439. 0xf6e1,
  7440. "commamonospace",
  7441. 0xff0c,
  7442. "commareversedabovecmb",
  7443. 0x0314,
  7444. "commareversedmod",
  7445. 0x02bd,
  7446. "commasmall",
  7447. 0xfe50,
  7448. "commasuperior",
  7449. 0xf6e2,
  7450. "commaturnedabovecmb",
  7451. 0x0312,
  7452. "commaturnedmod",
  7453. 0x02bb,
  7454. "compass",
  7455. 0x263c,
  7456. "congruent",
  7457. 0x2245,
  7458. "contourintegral",
  7459. 0x222e,
  7460. "control",
  7461. 0x2303,
  7462. "controlACK",
  7463. 0x0006,
  7464. "controlBEL",
  7465. 0x0007,
  7466. "controlBS",
  7467. 0x0008,
  7468. "controlCAN",
  7469. 0x0018,
  7470. "controlCR",
  7471. 0x000d,
  7472. "controlDC1",
  7473. 0x0011,
  7474. "controlDC2",
  7475. 0x0012,
  7476. "controlDC3",
  7477. 0x0013,
  7478. "controlDC4",
  7479. 0x0014,
  7480. "controlDEL",
  7481. 0x007f,
  7482. "controlDLE",
  7483. 0x0010,
  7484. "controlEM",
  7485. 0x0019,
  7486. "controlENQ",
  7487. 0x0005,
  7488. "controlEOT",
  7489. 0x0004,
  7490. "controlESC",
  7491. 0x001b,
  7492. "controlETB",
  7493. 0x0017,
  7494. "controlETX",
  7495. 0x0003,
  7496. "controlFF",
  7497. 0x000c,
  7498. "controlFS",
  7499. 0x001c,
  7500. "controlGS",
  7501. 0x001d,
  7502. "controlHT",
  7503. 0x0009,
  7504. "controlLF",
  7505. 0x000a,
  7506. "controlNAK",
  7507. 0x0015,
  7508. "controlNULL",
  7509. 0x0000,
  7510. "controlRS",
  7511. 0x001e,
  7512. "controlSI",
  7513. 0x000f,
  7514. "controlSO",
  7515. 0x000e,
  7516. "controlSOT",
  7517. 0x0002,
  7518. "controlSTX",
  7519. 0x0001,
  7520. "controlSUB",
  7521. 0x001a,
  7522. "controlSYN",
  7523. 0x0016,
  7524. "controlUS",
  7525. 0x001f,
  7526. "controlVT",
  7527. 0x000b,
  7528. "copyright",
  7529. 0x00a9,
  7530. "copyrightsans",
  7531. 0xf8e9,
  7532. "copyrightserif",
  7533. 0xf6d9,
  7534. "cornerbracketleft",
  7535. 0x300c,
  7536. "cornerbracketlefthalfwidth",
  7537. 0xff62,
  7538. "cornerbracketleftvertical",
  7539. 0xfe41,
  7540. "cornerbracketright",
  7541. 0x300d,
  7542. "cornerbracketrighthalfwidth",
  7543. 0xff63,
  7544. "cornerbracketrightvertical",
  7545. 0xfe42,
  7546. "corporationsquare",
  7547. 0x337f,
  7548. "cosquare",
  7549. 0x33c7,
  7550. "coverkgsquare",
  7551. 0x33c6,
  7552. "cparen",
  7553. 0x249e,
  7554. "cruzeiro",
  7555. 0x20a2,
  7556. "cstretched",
  7557. 0x0297,
  7558. "curlyand",
  7559. 0x22cf,
  7560. "curlyor",
  7561. 0x22ce,
  7562. "currency",
  7563. 0x00a4,
  7564. "cyrBreve",
  7565. 0xf6d1,
  7566. "cyrFlex",
  7567. 0xf6d2,
  7568. "cyrbreve",
  7569. 0xf6d4,
  7570. "cyrflex",
  7571. 0xf6d5,
  7572. "d",
  7573. 0x0064,
  7574. "daarmenian",
  7575. 0x0564,
  7576. "dabengali",
  7577. 0x09a6,
  7578. "dadarabic",
  7579. 0x0636,
  7580. "dadeva",
  7581. 0x0926,
  7582. "dadfinalarabic",
  7583. 0xfebe,
  7584. "dadinitialarabic",
  7585. 0xfebf,
  7586. "dadmedialarabic",
  7587. 0xfec0,
  7588. "dagesh",
  7589. 0x05bc,
  7590. "dageshhebrew",
  7591. 0x05bc,
  7592. "dagger",
  7593. 0x2020,
  7594. "daggerdbl",
  7595. 0x2021,
  7596. "dagujarati",
  7597. 0x0aa6,
  7598. "dagurmukhi",
  7599. 0x0a26,
  7600. "dahiragana",
  7601. 0x3060,
  7602. "dakatakana",
  7603. 0x30c0,
  7604. "dalarabic",
  7605. 0x062f,
  7606. "dalet",
  7607. 0x05d3,
  7608. "daletdagesh",
  7609. 0xfb33,
  7610. "daletdageshhebrew",
  7611. 0xfb33,
  7612. "dalethebrew",
  7613. 0x05d3,
  7614. "dalfinalarabic",
  7615. 0xfeaa,
  7616. "dammaarabic",
  7617. 0x064f,
  7618. "dammalowarabic",
  7619. 0x064f,
  7620. "dammatanaltonearabic",
  7621. 0x064c,
  7622. "dammatanarabic",
  7623. 0x064c,
  7624. "danda",
  7625. 0x0964,
  7626. "dargahebrew",
  7627. 0x05a7,
  7628. "dargalefthebrew",
  7629. 0x05a7,
  7630. "dasiapneumatacyrilliccmb",
  7631. 0x0485,
  7632. "dblGrave",
  7633. 0xf6d3,
  7634. "dblanglebracketleft",
  7635. 0x300a,
  7636. "dblanglebracketleftvertical",
  7637. 0xfe3d,
  7638. "dblanglebracketright",
  7639. 0x300b,
  7640. "dblanglebracketrightvertical",
  7641. 0xfe3e,
  7642. "dblarchinvertedbelowcmb",
  7643. 0x032b,
  7644. "dblarrowleft",
  7645. 0x21d4,
  7646. "dblarrowright",
  7647. 0x21d2,
  7648. "dbldanda",
  7649. 0x0965,
  7650. "dblgrave",
  7651. 0xf6d6,
  7652. "dblgravecmb",
  7653. 0x030f,
  7654. "dblintegral",
  7655. 0x222c,
  7656. "dbllowline",
  7657. 0x2017,
  7658. "dbllowlinecmb",
  7659. 0x0333,
  7660. "dbloverlinecmb",
  7661. 0x033f,
  7662. "dblprimemod",
  7663. 0x02ba,
  7664. "dblverticalbar",
  7665. 0x2016,
  7666. "dblverticallineabovecmb",
  7667. 0x030e,
  7668. "dbopomofo",
  7669. 0x3109,
  7670. "dbsquare",
  7671. 0x33c8,
  7672. "dcaron",
  7673. 0x010f,
  7674. "dcedilla",
  7675. 0x1e11,
  7676. "dcircle",
  7677. 0x24d3,
  7678. "dcircumflexbelow",
  7679. 0x1e13,
  7680. "dcroat",
  7681. 0x0111,
  7682. "ddabengali",
  7683. 0x09a1,
  7684. "ddadeva",
  7685. 0x0921,
  7686. "ddagujarati",
  7687. 0x0aa1,
  7688. "ddagurmukhi",
  7689. 0x0a21,
  7690. "ddalarabic",
  7691. 0x0688,
  7692. "ddalfinalarabic",
  7693. 0xfb89,
  7694. "dddhadeva",
  7695. 0x095c,
  7696. "ddhabengali",
  7697. 0x09a2,
  7698. "ddhadeva",
  7699. 0x0922,
  7700. "ddhagujarati",
  7701. 0x0aa2,
  7702. "ddhagurmukhi",
  7703. 0x0a22,
  7704. "ddotaccent",
  7705. 0x1e0b,
  7706. "ddotbelow",
  7707. 0x1e0d,
  7708. "decimalseparatorarabic",
  7709. 0x066b,
  7710. "decimalseparatorpersian",
  7711. 0x066b,
  7712. "decyrillic",
  7713. 0x0434,
  7714. "degree",
  7715. 0x00b0,
  7716. "dehihebrew",
  7717. 0x05ad,
  7718. "dehiragana",
  7719. 0x3067,
  7720. "deicoptic",
  7721. 0x03ef,
  7722. "dekatakana",
  7723. 0x30c7,
  7724. "deleteleft",
  7725. 0x232b,
  7726. "deleteright",
  7727. 0x2326,
  7728. "delta",
  7729. 0x03b4,
  7730. "deltaturned",
  7731. 0x018d,
  7732. "denominatorminusonenumeratorbengali",
  7733. 0x09f8,
  7734. "dezh",
  7735. 0x02a4,
  7736. "dhabengali",
  7737. 0x09a7,
  7738. "dhadeva",
  7739. 0x0927,
  7740. "dhagujarati",
  7741. 0x0aa7,
  7742. "dhagurmukhi",
  7743. 0x0a27,
  7744. "dhook",
  7745. 0x0257,
  7746. "dialytikatonos",
  7747. 0x0385,
  7748. "dialytikatonoscmb",
  7749. 0x0344,
  7750. "diamond",
  7751. 0x2666,
  7752. "diamondsuitwhite",
  7753. 0x2662,
  7754. "dieresis",
  7755. 0x00a8,
  7756. "dieresisacute",
  7757. 0xf6d7,
  7758. "dieresisbelowcmb",
  7759. 0x0324,
  7760. "dieresiscmb",
  7761. 0x0308,
  7762. "dieresisgrave",
  7763. 0xf6d8,
  7764. "dieresistonos",
  7765. 0x0385,
  7766. "dihiragana",
  7767. 0x3062,
  7768. "dikatakana",
  7769. 0x30c2,
  7770. "dittomark",
  7771. 0x3003,
  7772. "divide",
  7773. 0x00f7,
  7774. "divides",
  7775. 0x2223,
  7776. "divisionslash",
  7777. 0x2215,
  7778. "djecyrillic",
  7779. 0x0452,
  7780. "dkshade",
  7781. 0x2593,
  7782. "dlinebelow",
  7783. 0x1e0f,
  7784. "dlsquare",
  7785. 0x3397,
  7786. "dmacron",
  7787. 0x0111,
  7788. "dmonospace",
  7789. 0xff44,
  7790. "dnblock",
  7791. 0x2584,
  7792. "dochadathai",
  7793. 0x0e0e,
  7794. "dodekthai",
  7795. 0x0e14,
  7796. "dohiragana",
  7797. 0x3069,
  7798. "dokatakana",
  7799. 0x30c9,
  7800. "dollar",
  7801. 0x0024,
  7802. "dollarinferior",
  7803. 0xf6e3,
  7804. "dollarmonospace",
  7805. 0xff04,
  7806. "dollaroldstyle",
  7807. 0xf724,
  7808. "dollarsmall",
  7809. 0xfe69,
  7810. "dollarsuperior",
  7811. 0xf6e4,
  7812. "dong",
  7813. 0x20ab,
  7814. "dorusquare",
  7815. 0x3326,
  7816. "dotaccent",
  7817. 0x02d9,
  7818. "dotaccentcmb",
  7819. 0x0307,
  7820. "dotbelowcmb",
  7821. 0x0323,
  7822. "dotbelowcomb",
  7823. 0x0323,
  7824. "dotkatakana",
  7825. 0x30fb,
  7826. "dotlessi",
  7827. 0x0131,
  7828. "dotlessj",
  7829. 0xf6be,
  7830. "dotlessjstrokehook",
  7831. 0x0284,
  7832. "dotmath",
  7833. 0x22c5,
  7834. "dottedcircle",
  7835. 0x25cc,
  7836. "doubleyodpatah",
  7837. 0xfb1f,
  7838. "doubleyodpatahhebrew",
  7839. 0xfb1f,
  7840. "downtackbelowcmb",
  7841. 0x031e,
  7842. "downtackmod",
  7843. 0x02d5,
  7844. "dparen",
  7845. 0x249f,
  7846. "dsuperior",
  7847. 0xf6eb,
  7848. "dtail",
  7849. 0x0256,
  7850. "dtopbar",
  7851. 0x018c,
  7852. "duhiragana",
  7853. 0x3065,
  7854. "dukatakana",
  7855. 0x30c5,
  7856. "dz",
  7857. 0x01f3,
  7858. "dzaltone",
  7859. 0x02a3,
  7860. "dzcaron",
  7861. 0x01c6,
  7862. "dzcurl",
  7863. 0x02a5,
  7864. "dzeabkhasiancyrillic",
  7865. 0x04e1,
  7866. "dzecyrillic",
  7867. 0x0455,
  7868. "dzhecyrillic",
  7869. 0x045f,
  7870. "e",
  7871. 0x0065,
  7872. "eacute",
  7873. 0x00e9,
  7874. "earth",
  7875. 0x2641,
  7876. "ebengali",
  7877. 0x098f,
  7878. "ebopomofo",
  7879. 0x311c,
  7880. "ebreve",
  7881. 0x0115,
  7882. "ecandradeva",
  7883. 0x090d,
  7884. "ecandragujarati",
  7885. 0x0a8d,
  7886. "ecandravowelsigndeva",
  7887. 0x0945,
  7888. "ecandravowelsigngujarati",
  7889. 0x0ac5,
  7890. "ecaron",
  7891. 0x011b,
  7892. "ecedillabreve",
  7893. 0x1e1d,
  7894. "echarmenian",
  7895. 0x0565,
  7896. "echyiwnarmenian",
  7897. 0x0587,
  7898. "ecircle",
  7899. 0x24d4,
  7900. "ecircumflex",
  7901. 0x00ea,
  7902. "ecircumflexacute",
  7903. 0x1ebf,
  7904. "ecircumflexbelow",
  7905. 0x1e19,
  7906. "ecircumflexdotbelow",
  7907. 0x1ec7,
  7908. "ecircumflexgrave",
  7909. 0x1ec1,
  7910. "ecircumflexhookabove",
  7911. 0x1ec3,
  7912. "ecircumflextilde",
  7913. 0x1ec5,
  7914. "ecyrillic",
  7915. 0x0454,
  7916. "edblgrave",
  7917. 0x0205,
  7918. "edeva",
  7919. 0x090f,
  7920. "edieresis",
  7921. 0x00eb,
  7922. "edot",
  7923. 0x0117,
  7924. "edotaccent",
  7925. 0x0117,
  7926. "edotbelow",
  7927. 0x1eb9,
  7928. "eegurmukhi",
  7929. 0x0a0f,
  7930. "eematragurmukhi",
  7931. 0x0a47,
  7932. "efcyrillic",
  7933. 0x0444,
  7934. "egrave",
  7935. 0x00e8,
  7936. "egujarati",
  7937. 0x0a8f,
  7938. "eharmenian",
  7939. 0x0567,
  7940. "ehbopomofo",
  7941. 0x311d,
  7942. "ehiragana",
  7943. 0x3048,
  7944. "ehookabove",
  7945. 0x1ebb,
  7946. "eibopomofo",
  7947. 0x311f,
  7948. "eight",
  7949. 0x0038,
  7950. "eightarabic",
  7951. 0x0668,
  7952. "eightbengali",
  7953. 0x09ee,
  7954. "eightcircle",
  7955. 0x2467,
  7956. "eightcircleinversesansserif",
  7957. 0x2791,
  7958. "eightdeva",
  7959. 0x096e,
  7960. "eighteencircle",
  7961. 0x2471,
  7962. "eighteenparen",
  7963. 0x2485,
  7964. "eighteenperiod",
  7965. 0x2499,
  7966. "eightgujarati",
  7967. 0x0aee,
  7968. "eightgurmukhi",
  7969. 0x0a6e,
  7970. "eighthackarabic",
  7971. 0x0668,
  7972. "eighthangzhou",
  7973. 0x3028,
  7974. "eighthnotebeamed",
  7975. 0x266b,
  7976. "eightideographicparen",
  7977. 0x3227,
  7978. "eightinferior",
  7979. 0x2088,
  7980. "eightmonospace",
  7981. 0xff18,
  7982. "eightoldstyle",
  7983. 0xf738,
  7984. "eightparen",
  7985. 0x247b,
  7986. "eightperiod",
  7987. 0x248f,
  7988. "eightpersian",
  7989. 0x06f8,
  7990. "eightroman",
  7991. 0x2177,
  7992. "eightsuperior",
  7993. 0x2078,
  7994. "eightthai",
  7995. 0x0e58,
  7996. "einvertedbreve",
  7997. 0x0207,
  7998. "eiotifiedcyrillic",
  7999. 0x0465,
  8000. "ekatakana",
  8001. 0x30a8,
  8002. "ekatakanahalfwidth",
  8003. 0xff74,
  8004. "ekonkargurmukhi",
  8005. 0x0a74,
  8006. "ekorean",
  8007. 0x3154,
  8008. "elcyrillic",
  8009. 0x043b,
  8010. "element",
  8011. 0x2208,
  8012. "elevencircle",
  8013. 0x246a,
  8014. "elevenparen",
  8015. 0x247e,
  8016. "elevenperiod",
  8017. 0x2492,
  8018. "elevenroman",
  8019. 0x217a,
  8020. "ellipsis",
  8021. 0x2026,
  8022. "ellipsisvertical",
  8023. 0x22ee,
  8024. "emacron",
  8025. 0x0113,
  8026. "emacronacute",
  8027. 0x1e17,
  8028. "emacrongrave",
  8029. 0x1e15,
  8030. "emcyrillic",
  8031. 0x043c,
  8032. "emdash",
  8033. 0x2014,
  8034. "emdashvertical",
  8035. 0xfe31,
  8036. "emonospace",
  8037. 0xff45,
  8038. "emphasismarkarmenian",
  8039. 0x055b,
  8040. "emptyset",
  8041. 0x2205,
  8042. "enbopomofo",
  8043. 0x3123,
  8044. "encyrillic",
  8045. 0x043d,
  8046. "endash",
  8047. 0x2013,
  8048. "endashvertical",
  8049. 0xfe32,
  8050. "endescendercyrillic",
  8051. 0x04a3,
  8052. "eng",
  8053. 0x014b,
  8054. "engbopomofo",
  8055. 0x3125,
  8056. "enghecyrillic",
  8057. 0x04a5,
  8058. "enhookcyrillic",
  8059. 0x04c8,
  8060. "enspace",
  8061. 0x2002,
  8062. "eogonek",
  8063. 0x0119,
  8064. "eokorean",
  8065. 0x3153,
  8066. "eopen",
  8067. 0x025b,
  8068. "eopenclosed",
  8069. 0x029a,
  8070. "eopenreversed",
  8071. 0x025c,
  8072. "eopenreversedclosed",
  8073. 0x025e,
  8074. "eopenreversedhook",
  8075. 0x025d,
  8076. "eparen",
  8077. 0x24a0,
  8078. "epsilon",
  8079. 0x03b5,
  8080. "epsilontonos",
  8081. 0x03ad,
  8082. "equal",
  8083. 0x003d,
  8084. "equalmonospace",
  8085. 0xff1d,
  8086. "equalsmall",
  8087. 0xfe66,
  8088. "equalsuperior",
  8089. 0x207c,
  8090. "equivalence",
  8091. 0x2261,
  8092. "erbopomofo",
  8093. 0x3126,
  8094. "ercyrillic",
  8095. 0x0440,
  8096. "ereversed",
  8097. 0x0258,
  8098. "ereversedcyrillic",
  8099. 0x044d,
  8100. "escyrillic",
  8101. 0x0441,
  8102. "esdescendercyrillic",
  8103. 0x04ab,
  8104. "esh",
  8105. 0x0283,
  8106. "eshcurl",
  8107. 0x0286,
  8108. "eshortdeva",
  8109. 0x090e,
  8110. "eshortvowelsigndeva",
  8111. 0x0946,
  8112. "eshreversedloop",
  8113. 0x01aa,
  8114. "eshsquatreversed",
  8115. 0x0285,
  8116. "esmallhiragana",
  8117. 0x3047,
  8118. "esmallkatakana",
  8119. 0x30a7,
  8120. "esmallkatakanahalfwidth",
  8121. 0xff6a,
  8122. "estimated",
  8123. 0x212e,
  8124. "esuperior",
  8125. 0xf6ec,
  8126. "eta",
  8127. 0x03b7,
  8128. "etarmenian",
  8129. 0x0568,
  8130. "etatonos",
  8131. 0x03ae,
  8132. "eth",
  8133. 0x00f0,
  8134. "etilde",
  8135. 0x1ebd,
  8136. "etildebelow",
  8137. 0x1e1b,
  8138. "etnahtafoukhhebrew",
  8139. 0x0591,
  8140. "etnahtafoukhlefthebrew",
  8141. 0x0591,
  8142. "etnahtahebrew",
  8143. 0x0591,
  8144. "etnahtalefthebrew",
  8145. 0x0591,
  8146. "eturned",
  8147. 0x01dd,
  8148. "eukorean",
  8149. 0x3161,
  8150. "euro",
  8151. 0x20ac,
  8152. "evowelsignbengali",
  8153. 0x09c7,
  8154. "evowelsigndeva",
  8155. 0x0947,
  8156. "evowelsigngujarati",
  8157. 0x0ac7,
  8158. "exclam",
  8159. 0x0021,
  8160. "exclamarmenian",
  8161. 0x055c,
  8162. "exclamdbl",
  8163. 0x203c,
  8164. "exclamdown",
  8165. 0x00a1,
  8166. "exclamdownsmall",
  8167. 0xf7a1,
  8168. "exclammonospace",
  8169. 0xff01,
  8170. "exclamsmall",
  8171. 0xf721,
  8172. "existential",
  8173. 0x2203,
  8174. "ezh",
  8175. 0x0292,
  8176. "ezhcaron",
  8177. 0x01ef,
  8178. "ezhcurl",
  8179. 0x0293,
  8180. "ezhreversed",
  8181. 0x01b9,
  8182. "ezhtail",
  8183. 0x01ba,
  8184. "f",
  8185. 0x0066,
  8186. "fadeva",
  8187. 0x095e,
  8188. "fagurmukhi",
  8189. 0x0a5e,
  8190. "fahrenheit",
  8191. 0x2109,
  8192. "fathaarabic",
  8193. 0x064e,
  8194. "fathalowarabic",
  8195. 0x064e,
  8196. "fathatanarabic",
  8197. 0x064b,
  8198. "fbopomofo",
  8199. 0x3108,
  8200. "fcircle",
  8201. 0x24d5,
  8202. "fdotaccent",
  8203. 0x1e1f,
  8204. "feharabic",
  8205. 0x0641,
  8206. "feharmenian",
  8207. 0x0586,
  8208. "fehfinalarabic",
  8209. 0xfed2,
  8210. "fehinitialarabic",
  8211. 0xfed3,
  8212. "fehmedialarabic",
  8213. 0xfed4,
  8214. "feicoptic",
  8215. 0x03e5,
  8216. "female",
  8217. 0x2640,
  8218. "ff",
  8219. 0xfb00,
  8220. "f_f",
  8221. 0xfb00,
  8222. "ffi",
  8223. 0xfb03,
  8224. "ffl",
  8225. 0xfb04,
  8226. "fi",
  8227. 0xfb01,
  8228. "fifteencircle",
  8229. 0x246e,
  8230. "fifteenparen",
  8231. 0x2482,
  8232. "fifteenperiod",
  8233. 0x2496,
  8234. "figuredash",
  8235. 0x2012,
  8236. "filledbox",
  8237. 0x25a0,
  8238. "filledrect",
  8239. 0x25ac,
  8240. "finalkaf",
  8241. 0x05da,
  8242. "finalkafdagesh",
  8243. 0xfb3a,
  8244. "finalkafdageshhebrew",
  8245. 0xfb3a,
  8246. "finalkafhebrew",
  8247. 0x05da,
  8248. "finalmem",
  8249. 0x05dd,
  8250. "finalmemhebrew",
  8251. 0x05dd,
  8252. "finalnun",
  8253. 0x05df,
  8254. "finalnunhebrew",
  8255. 0x05df,
  8256. "finalpe",
  8257. 0x05e3,
  8258. "finalpehebrew",
  8259. 0x05e3,
  8260. "finaltsadi",
  8261. 0x05e5,
  8262. "finaltsadihebrew",
  8263. 0x05e5,
  8264. "firsttonechinese",
  8265. 0x02c9,
  8266. "fisheye",
  8267. 0x25c9,
  8268. "fitacyrillic",
  8269. 0x0473,
  8270. "five",
  8271. 0x0035,
  8272. "fivearabic",
  8273. 0x0665,
  8274. "fivebengali",
  8275. 0x09eb,
  8276. "fivecircle",
  8277. 0x2464,
  8278. "fivecircleinversesansserif",
  8279. 0x278e,
  8280. "fivedeva",
  8281. 0x096b,
  8282. "fiveeighths",
  8283. 0x215d,
  8284. "fivegujarati",
  8285. 0x0aeb,
  8286. "fivegurmukhi",
  8287. 0x0a6b,
  8288. "fivehackarabic",
  8289. 0x0665,
  8290. "fivehangzhou",
  8291. 0x3025,
  8292. "fiveideographicparen",
  8293. 0x3224,
  8294. "fiveinferior",
  8295. 0x2085,
  8296. "fivemonospace",
  8297. 0xff15,
  8298. "fiveoldstyle",
  8299. 0xf735,
  8300. "fiveparen",
  8301. 0x2478,
  8302. "fiveperiod",
  8303. 0x248c,
  8304. "fivepersian",
  8305. 0x06f5,
  8306. "fiveroman",
  8307. 0x2174,
  8308. "fivesuperior",
  8309. 0x2075,
  8310. "fivethai",
  8311. 0x0e55,
  8312. "fl",
  8313. 0xfb02,
  8314. "florin",
  8315. 0x0192,
  8316. "fmonospace",
  8317. 0xff46,
  8318. "fmsquare",
  8319. 0x3399,
  8320. "fofanthai",
  8321. 0x0e1f,
  8322. "fofathai",
  8323. 0x0e1d,
  8324. "fongmanthai",
  8325. 0x0e4f,
  8326. "forall",
  8327. 0x2200,
  8328. "four",
  8329. 0x0034,
  8330. "fourarabic",
  8331. 0x0664,
  8332. "fourbengali",
  8333. 0x09ea,
  8334. "fourcircle",
  8335. 0x2463,
  8336. "fourcircleinversesansserif",
  8337. 0x278d,
  8338. "fourdeva",
  8339. 0x096a,
  8340. "fourgujarati",
  8341. 0x0aea,
  8342. "fourgurmukhi",
  8343. 0x0a6a,
  8344. "fourhackarabic",
  8345. 0x0664,
  8346. "fourhangzhou",
  8347. 0x3024,
  8348. "fourideographicparen",
  8349. 0x3223,
  8350. "fourinferior",
  8351. 0x2084,
  8352. "fourmonospace",
  8353. 0xff14,
  8354. "fournumeratorbengali",
  8355. 0x09f7,
  8356. "fouroldstyle",
  8357. 0xf734,
  8358. "fourparen",
  8359. 0x2477,
  8360. "fourperiod",
  8361. 0x248b,
  8362. "fourpersian",
  8363. 0x06f4,
  8364. "fourroman",
  8365. 0x2173,
  8366. "foursuperior",
  8367. 0x2074,
  8368. "fourteencircle",
  8369. 0x246d,
  8370. "fourteenparen",
  8371. 0x2481,
  8372. "fourteenperiod",
  8373. 0x2495,
  8374. "fourthai",
  8375. 0x0e54,
  8376. "fourthtonechinese",
  8377. 0x02cb,
  8378. "fparen",
  8379. 0x24a1,
  8380. "fraction",
  8381. 0x2044,
  8382. "franc",
  8383. 0x20a3,
  8384. "g",
  8385. 0x0067,
  8386. "gabengali",
  8387. 0x0997,
  8388. "gacute",
  8389. 0x01f5,
  8390. "gadeva",
  8391. 0x0917,
  8392. "gafarabic",
  8393. 0x06af,
  8394. "gaffinalarabic",
  8395. 0xfb93,
  8396. "gafinitialarabic",
  8397. 0xfb94,
  8398. "gafmedialarabic",
  8399. 0xfb95,
  8400. "gagujarati",
  8401. 0x0a97,
  8402. "gagurmukhi",
  8403. 0x0a17,
  8404. "gahiragana",
  8405. 0x304c,
  8406. "gakatakana",
  8407. 0x30ac,
  8408. "gamma",
  8409. 0x03b3,
  8410. "gammalatinsmall",
  8411. 0x0263,
  8412. "gammasuperior",
  8413. 0x02e0,
  8414. "gangiacoptic",
  8415. 0x03eb,
  8416. "gbopomofo",
  8417. 0x310d,
  8418. "gbreve",
  8419. 0x011f,
  8420. "gcaron",
  8421. 0x01e7,
  8422. "gcedilla",
  8423. 0x0123,
  8424. "gcircle",
  8425. 0x24d6,
  8426. "gcircumflex",
  8427. 0x011d,
  8428. "gcommaaccent",
  8429. 0x0123,
  8430. "gdot",
  8431. 0x0121,
  8432. "gdotaccent",
  8433. 0x0121,
  8434. "gecyrillic",
  8435. 0x0433,
  8436. "gehiragana",
  8437. 0x3052,
  8438. "gekatakana",
  8439. 0x30b2,
  8440. "geometricallyequal",
  8441. 0x2251,
  8442. "gereshaccenthebrew",
  8443. 0x059c,
  8444. "gereshhebrew",
  8445. 0x05f3,
  8446. "gereshmuqdamhebrew",
  8447. 0x059d,
  8448. "germandbls",
  8449. 0x00df,
  8450. "gershayimaccenthebrew",
  8451. 0x059e,
  8452. "gershayimhebrew",
  8453. 0x05f4,
  8454. "getamark",
  8455. 0x3013,
  8456. "ghabengali",
  8457. 0x0998,
  8458. "ghadarmenian",
  8459. 0x0572,
  8460. "ghadeva",
  8461. 0x0918,
  8462. "ghagujarati",
  8463. 0x0a98,
  8464. "ghagurmukhi",
  8465. 0x0a18,
  8466. "ghainarabic",
  8467. 0x063a,
  8468. "ghainfinalarabic",
  8469. 0xfece,
  8470. "ghaininitialarabic",
  8471. 0xfecf,
  8472. "ghainmedialarabic",
  8473. 0xfed0,
  8474. "ghemiddlehookcyrillic",
  8475. 0x0495,
  8476. "ghestrokecyrillic",
  8477. 0x0493,
  8478. "gheupturncyrillic",
  8479. 0x0491,
  8480. "ghhadeva",
  8481. 0x095a,
  8482. "ghhagurmukhi",
  8483. 0x0a5a,
  8484. "ghook",
  8485. 0x0260,
  8486. "ghzsquare",
  8487. 0x3393,
  8488. "gihiragana",
  8489. 0x304e,
  8490. "gikatakana",
  8491. 0x30ae,
  8492. "gimarmenian",
  8493. 0x0563,
  8494. "gimel",
  8495. 0x05d2,
  8496. "gimeldagesh",
  8497. 0xfb32,
  8498. "gimeldageshhebrew",
  8499. 0xfb32,
  8500. "gimelhebrew",
  8501. 0x05d2,
  8502. "gjecyrillic",
  8503. 0x0453,
  8504. "glottalinvertedstroke",
  8505. 0x01be,
  8506. "glottalstop",
  8507. 0x0294,
  8508. "glottalstopinverted",
  8509. 0x0296,
  8510. "glottalstopmod",
  8511. 0x02c0,
  8512. "glottalstopreversed",
  8513. 0x0295,
  8514. "glottalstopreversedmod",
  8515. 0x02c1,
  8516. "glottalstopreversedsuperior",
  8517. 0x02e4,
  8518. "glottalstopstroke",
  8519. 0x02a1,
  8520. "glottalstopstrokereversed",
  8521. 0x02a2,
  8522. "gmacron",
  8523. 0x1e21,
  8524. "gmonospace",
  8525. 0xff47,
  8526. "gohiragana",
  8527. 0x3054,
  8528. "gokatakana",
  8529. 0x30b4,
  8530. "gparen",
  8531. 0x24a2,
  8532. "gpasquare",
  8533. 0x33ac,
  8534. "gradient",
  8535. 0x2207,
  8536. "grave",
  8537. 0x0060,
  8538. "gravebelowcmb",
  8539. 0x0316,
  8540. "gravecmb",
  8541. 0x0300,
  8542. "gravecomb",
  8543. 0x0300,
  8544. "gravedeva",
  8545. 0x0953,
  8546. "gravelowmod",
  8547. 0x02ce,
  8548. "gravemonospace",
  8549. 0xff40,
  8550. "gravetonecmb",
  8551. 0x0340,
  8552. "greater",
  8553. 0x003e,
  8554. "greaterequal",
  8555. 0x2265,
  8556. "greaterequalorless",
  8557. 0x22db,
  8558. "greatermonospace",
  8559. 0xff1e,
  8560. "greaterorequivalent",
  8561. 0x2273,
  8562. "greaterorless",
  8563. 0x2277,
  8564. "greateroverequal",
  8565. 0x2267,
  8566. "greatersmall",
  8567. 0xfe65,
  8568. "gscript",
  8569. 0x0261,
  8570. "gstroke",
  8571. 0x01e5,
  8572. "guhiragana",
  8573. 0x3050,
  8574. "guillemotleft",
  8575. 0x00ab,
  8576. "guillemotright",
  8577. 0x00bb,
  8578. "guilsinglleft",
  8579. 0x2039,
  8580. "guilsinglright",
  8581. 0x203a,
  8582. "gukatakana",
  8583. 0x30b0,
  8584. "guramusquare",
  8585. 0x3318,
  8586. "gysquare",
  8587. 0x33c9,
  8588. "h",
  8589. 0x0068,
  8590. "haabkhasiancyrillic",
  8591. 0x04a9,
  8592. "haaltonearabic",
  8593. 0x06c1,
  8594. "habengali",
  8595. 0x09b9,
  8596. "hadescendercyrillic",
  8597. 0x04b3,
  8598. "hadeva",
  8599. 0x0939,
  8600. "hagujarati",
  8601. 0x0ab9,
  8602. "hagurmukhi",
  8603. 0x0a39,
  8604. "haharabic",
  8605. 0x062d,
  8606. "hahfinalarabic",
  8607. 0xfea2,
  8608. "hahinitialarabic",
  8609. 0xfea3,
  8610. "hahiragana",
  8611. 0x306f,
  8612. "hahmedialarabic",
  8613. 0xfea4,
  8614. "haitusquare",
  8615. 0x332a,
  8616. "hakatakana",
  8617. 0x30cf,
  8618. "hakatakanahalfwidth",
  8619. 0xff8a,
  8620. "halantgurmukhi",
  8621. 0x0a4d,
  8622. "hamzaarabic",
  8623. 0x0621,
  8624. "hamzalowarabic",
  8625. 0x0621,
  8626. "hangulfiller",
  8627. 0x3164,
  8628. "hardsigncyrillic",
  8629. 0x044a,
  8630. "harpoonleftbarbup",
  8631. 0x21bc,
  8632. "harpoonrightbarbup",
  8633. 0x21c0,
  8634. "hasquare",
  8635. 0x33ca,
  8636. "hatafpatah",
  8637. 0x05b2,
  8638. "hatafpatah16",
  8639. 0x05b2,
  8640. "hatafpatah23",
  8641. 0x05b2,
  8642. "hatafpatah2f",
  8643. 0x05b2,
  8644. "hatafpatahhebrew",
  8645. 0x05b2,
  8646. "hatafpatahnarrowhebrew",
  8647. 0x05b2,
  8648. "hatafpatahquarterhebrew",
  8649. 0x05b2,
  8650. "hatafpatahwidehebrew",
  8651. 0x05b2,
  8652. "hatafqamats",
  8653. 0x05b3,
  8654. "hatafqamats1b",
  8655. 0x05b3,
  8656. "hatafqamats28",
  8657. 0x05b3,
  8658. "hatafqamats34",
  8659. 0x05b3,
  8660. "hatafqamatshebrew",
  8661. 0x05b3,
  8662. "hatafqamatsnarrowhebrew",
  8663. 0x05b3,
  8664. "hatafqamatsquarterhebrew",
  8665. 0x05b3,
  8666. "hatafqamatswidehebrew",
  8667. 0x05b3,
  8668. "hatafsegol",
  8669. 0x05b1,
  8670. "hatafsegol17",
  8671. 0x05b1,
  8672. "hatafsegol24",
  8673. 0x05b1,
  8674. "hatafsegol30",
  8675. 0x05b1,
  8676. "hatafsegolhebrew",
  8677. 0x05b1,
  8678. "hatafsegolnarrowhebrew",
  8679. 0x05b1,
  8680. "hatafsegolquarterhebrew",
  8681. 0x05b1,
  8682. "hatafsegolwidehebrew",
  8683. 0x05b1,
  8684. "hbar",
  8685. 0x0127,
  8686. "hbopomofo",
  8687. 0x310f,
  8688. "hbrevebelow",
  8689. 0x1e2b,
  8690. "hcedilla",
  8691. 0x1e29,
  8692. "hcircle",
  8693. 0x24d7,
  8694. "hcircumflex",
  8695. 0x0125,
  8696. "hdieresis",
  8697. 0x1e27,
  8698. "hdotaccent",
  8699. 0x1e23,
  8700. "hdotbelow",
  8701. 0x1e25,
  8702. "he",
  8703. 0x05d4,
  8704. "heart",
  8705. 0x2665,
  8706. "heartsuitblack",
  8707. 0x2665,
  8708. "heartsuitwhite",
  8709. 0x2661,
  8710. "hedagesh",
  8711. 0xfb34,
  8712. "hedageshhebrew",
  8713. 0xfb34,
  8714. "hehaltonearabic",
  8715. 0x06c1,
  8716. "heharabic",
  8717. 0x0647,
  8718. "hehebrew",
  8719. 0x05d4,
  8720. "hehfinalaltonearabic",
  8721. 0xfba7,
  8722. "hehfinalalttwoarabic",
  8723. 0xfeea,
  8724. "hehfinalarabic",
  8725. 0xfeea,
  8726. "hehhamzaabovefinalarabic",
  8727. 0xfba5,
  8728. "hehhamzaaboveisolatedarabic",
  8729. 0xfba4,
  8730. "hehinitialaltonearabic",
  8731. 0xfba8,
  8732. "hehinitialarabic",
  8733. 0xfeeb,
  8734. "hehiragana",
  8735. 0x3078,
  8736. "hehmedialaltonearabic",
  8737. 0xfba9,
  8738. "hehmedialarabic",
  8739. 0xfeec,
  8740. "heiseierasquare",
  8741. 0x337b,
  8742. "hekatakana",
  8743. 0x30d8,
  8744. "hekatakanahalfwidth",
  8745. 0xff8d,
  8746. "hekutaarusquare",
  8747. 0x3336,
  8748. "henghook",
  8749. 0x0267,
  8750. "herutusquare",
  8751. 0x3339,
  8752. "het",
  8753. 0x05d7,
  8754. "hethebrew",
  8755. 0x05d7,
  8756. "hhook",
  8757. 0x0266,
  8758. "hhooksuperior",
  8759. 0x02b1,
  8760. "hieuhacirclekorean",
  8761. 0x327b,
  8762. "hieuhaparenkorean",
  8763. 0x321b,
  8764. "hieuhcirclekorean",
  8765. 0x326d,
  8766. "hieuhkorean",
  8767. 0x314e,
  8768. "hieuhparenkorean",
  8769. 0x320d,
  8770. "hihiragana",
  8771. 0x3072,
  8772. "hikatakana",
  8773. 0x30d2,
  8774. "hikatakanahalfwidth",
  8775. 0xff8b,
  8776. "hiriq",
  8777. 0x05b4,
  8778. "hiriq14",
  8779. 0x05b4,
  8780. "hiriq21",
  8781. 0x05b4,
  8782. "hiriq2d",
  8783. 0x05b4,
  8784. "hiriqhebrew",
  8785. 0x05b4,
  8786. "hiriqnarrowhebrew",
  8787. 0x05b4,
  8788. "hiriqquarterhebrew",
  8789. 0x05b4,
  8790. "hiriqwidehebrew",
  8791. 0x05b4,
  8792. "hlinebelow",
  8793. 0x1e96,
  8794. "hmonospace",
  8795. 0xff48,
  8796. "hoarmenian",
  8797. 0x0570,
  8798. "hohipthai",
  8799. 0x0e2b,
  8800. "hohiragana",
  8801. 0x307b,
  8802. "hokatakana",
  8803. 0x30db,
  8804. "hokatakanahalfwidth",
  8805. 0xff8e,
  8806. "holam",
  8807. 0x05b9,
  8808. "holam19",
  8809. 0x05b9,
  8810. "holam26",
  8811. 0x05b9,
  8812. "holam32",
  8813. 0x05b9,
  8814. "holamhebrew",
  8815. 0x05b9,
  8816. "holamnarrowhebrew",
  8817. 0x05b9,
  8818. "holamquarterhebrew",
  8819. 0x05b9,
  8820. "holamwidehebrew",
  8821. 0x05b9,
  8822. "honokhukthai",
  8823. 0x0e2e,
  8824. "hookabovecomb",
  8825. 0x0309,
  8826. "hookcmb",
  8827. 0x0309,
  8828. "hookpalatalizedbelowcmb",
  8829. 0x0321,
  8830. "hookretroflexbelowcmb",
  8831. 0x0322,
  8832. "hoonsquare",
  8833. 0x3342,
  8834. "horicoptic",
  8835. 0x03e9,
  8836. "horizontalbar",
  8837. 0x2015,
  8838. "horncmb",
  8839. 0x031b,
  8840. "hotsprings",
  8841. 0x2668,
  8842. "house",
  8843. 0x2302,
  8844. "hparen",
  8845. 0x24a3,
  8846. "hsuperior",
  8847. 0x02b0,
  8848. "hturned",
  8849. 0x0265,
  8850. "huhiragana",
  8851. 0x3075,
  8852. "huiitosquare",
  8853. 0x3333,
  8854. "hukatakana",
  8855. 0x30d5,
  8856. "hukatakanahalfwidth",
  8857. 0xff8c,
  8858. "hungarumlaut",
  8859. 0x02dd,
  8860. "hungarumlautcmb",
  8861. 0x030b,
  8862. "hv",
  8863. 0x0195,
  8864. "hyphen",
  8865. 0x002d,
  8866. "hypheninferior",
  8867. 0xf6e5,
  8868. "hyphenmonospace",
  8869. 0xff0d,
  8870. "hyphensmall",
  8871. 0xfe63,
  8872. "hyphensuperior",
  8873. 0xf6e6,
  8874. "hyphentwo",
  8875. 0x2010,
  8876. "i",
  8877. 0x0069,
  8878. "iacute",
  8879. 0x00ed,
  8880. "iacyrillic",
  8881. 0x044f,
  8882. "ibengali",
  8883. 0x0987,
  8884. "ibopomofo",
  8885. 0x3127,
  8886. "ibreve",
  8887. 0x012d,
  8888. "icaron",
  8889. 0x01d0,
  8890. "icircle",
  8891. 0x24d8,
  8892. "icircumflex",
  8893. 0x00ee,
  8894. "icyrillic",
  8895. 0x0456,
  8896. "idblgrave",
  8897. 0x0209,
  8898. "ideographearthcircle",
  8899. 0x328f,
  8900. "ideographfirecircle",
  8901. 0x328b,
  8902. "ideographicallianceparen",
  8903. 0x323f,
  8904. "ideographiccallparen",
  8905. 0x323a,
  8906. "ideographiccentrecircle",
  8907. 0x32a5,
  8908. "ideographicclose",
  8909. 0x3006,
  8910. "ideographiccomma",
  8911. 0x3001,
  8912. "ideographiccommaleft",
  8913. 0xff64,
  8914. "ideographiccongratulationparen",
  8915. 0x3237,
  8916. "ideographiccorrectcircle",
  8917. 0x32a3,
  8918. "ideographicearthparen",
  8919. 0x322f,
  8920. "ideographicenterpriseparen",
  8921. 0x323d,
  8922. "ideographicexcellentcircle",
  8923. 0x329d,
  8924. "ideographicfestivalparen",
  8925. 0x3240,
  8926. "ideographicfinancialcircle",
  8927. 0x3296,
  8928. "ideographicfinancialparen",
  8929. 0x3236,
  8930. "ideographicfireparen",
  8931. 0x322b,
  8932. "ideographichaveparen",
  8933. 0x3232,
  8934. "ideographichighcircle",
  8935. 0x32a4,
  8936. "ideographiciterationmark",
  8937. 0x3005,
  8938. "ideographiclaborcircle",
  8939. 0x3298,
  8940. "ideographiclaborparen",
  8941. 0x3238,
  8942. "ideographicleftcircle",
  8943. 0x32a7,
  8944. "ideographiclowcircle",
  8945. 0x32a6,
  8946. "ideographicmedicinecircle",
  8947. 0x32a9,
  8948. "ideographicmetalparen",
  8949. 0x322e,
  8950. "ideographicmoonparen",
  8951. 0x322a,
  8952. "ideographicnameparen",
  8953. 0x3234,
  8954. "ideographicperiod",
  8955. 0x3002,
  8956. "ideographicprintcircle",
  8957. 0x329e,
  8958. "ideographicreachparen",
  8959. 0x3243,
  8960. "ideographicrepresentparen",
  8961. 0x3239,
  8962. "ideographicresourceparen",
  8963. 0x323e,
  8964. "ideographicrightcircle",
  8965. 0x32a8,
  8966. "ideographicsecretcircle",
  8967. 0x3299,
  8968. "ideographicselfparen",
  8969. 0x3242,
  8970. "ideographicsocietyparen",
  8971. 0x3233,
  8972. "ideographicspace",
  8973. 0x3000,
  8974. "ideographicspecialparen",
  8975. 0x3235,
  8976. "ideographicstockparen",
  8977. 0x3231,
  8978. "ideographicstudyparen",
  8979. 0x323b,
  8980. "ideographicsunparen",
  8981. 0x3230,
  8982. "ideographicsuperviseparen",
  8983. 0x323c,
  8984. "ideographicwaterparen",
  8985. 0x322c,
  8986. "ideographicwoodparen",
  8987. 0x322d,
  8988. "ideographiczero",
  8989. 0x3007,
  8990. "ideographmetalcircle",
  8991. 0x328e,
  8992. "ideographmooncircle",
  8993. 0x328a,
  8994. "ideographnamecircle",
  8995. 0x3294,
  8996. "ideographsuncircle",
  8997. 0x3290,
  8998. "ideographwatercircle",
  8999. 0x328c,
  9000. "ideographwoodcircle",
  9001. 0x328d,
  9002. "ideva",
  9003. 0x0907,
  9004. "idieresis",
  9005. 0x00ef,
  9006. "idieresisacute",
  9007. 0x1e2f,
  9008. "idieresiscyrillic",
  9009. 0x04e5,
  9010. "idotbelow",
  9011. 0x1ecb,
  9012. "iebrevecyrillic",
  9013. 0x04d7,
  9014. "iecyrillic",
  9015. 0x0435,
  9016. "ieungacirclekorean",
  9017. 0x3275,
  9018. "ieungaparenkorean",
  9019. 0x3215,
  9020. "ieungcirclekorean",
  9021. 0x3267,
  9022. "ieungkorean",
  9023. 0x3147,
  9024. "ieungparenkorean",
  9025. 0x3207,
  9026. "igrave",
  9027. 0x00ec,
  9028. "igujarati",
  9029. 0x0a87,
  9030. "igurmukhi",
  9031. 0x0a07,
  9032. "ihiragana",
  9033. 0x3044,
  9034. "ihookabove",
  9035. 0x1ec9,
  9036. "iibengali",
  9037. 0x0988,
  9038. "iicyrillic",
  9039. 0x0438,
  9040. "iideva",
  9041. 0x0908,
  9042. "iigujarati",
  9043. 0x0a88,
  9044. "iigurmukhi",
  9045. 0x0a08,
  9046. "iimatragurmukhi",
  9047. 0x0a40,
  9048. "iinvertedbreve",
  9049. 0x020b,
  9050. "iishortcyrillic",
  9051. 0x0439,
  9052. "iivowelsignbengali",
  9053. 0x09c0,
  9054. "iivowelsigndeva",
  9055. 0x0940,
  9056. "iivowelsigngujarati",
  9057. 0x0ac0,
  9058. "ij",
  9059. 0x0133,
  9060. "ikatakana",
  9061. 0x30a4,
  9062. "ikatakanahalfwidth",
  9063. 0xff72,
  9064. "ikorean",
  9065. 0x3163,
  9066. "ilde",
  9067. 0x02dc,
  9068. "iluyhebrew",
  9069. 0x05ac,
  9070. "imacron",
  9071. 0x012b,
  9072. "imacroncyrillic",
  9073. 0x04e3,
  9074. "imageorapproximatelyequal",
  9075. 0x2253,
  9076. "imatragurmukhi",
  9077. 0x0a3f,
  9078. "imonospace",
  9079. 0xff49,
  9080. "increment",
  9081. 0x2206,
  9082. "infinity",
  9083. 0x221e,
  9084. "iniarmenian",
  9085. 0x056b,
  9086. "integral",
  9087. 0x222b,
  9088. "integralbottom",
  9089. 0x2321,
  9090. "integralbt",
  9091. 0x2321,
  9092. "integralex",
  9093. 0xf8f5,
  9094. "integraltop",
  9095. 0x2320,
  9096. "integraltp",
  9097. 0x2320,
  9098. "intersection",
  9099. 0x2229,
  9100. "intisquare",
  9101. 0x3305,
  9102. "invbullet",
  9103. 0x25d8,
  9104. "invcircle",
  9105. 0x25d9,
  9106. "invsmileface",
  9107. 0x263b,
  9108. "iocyrillic",
  9109. 0x0451,
  9110. "iogonek",
  9111. 0x012f,
  9112. "iota",
  9113. 0x03b9,
  9114. "iotadieresis",
  9115. 0x03ca,
  9116. "iotadieresistonos",
  9117. 0x0390,
  9118. "iotalatin",
  9119. 0x0269,
  9120. "iotatonos",
  9121. 0x03af,
  9122. "iparen",
  9123. 0x24a4,
  9124. "irigurmukhi",
  9125. 0x0a72,
  9126. "ismallhiragana",
  9127. 0x3043,
  9128. "ismallkatakana",
  9129. 0x30a3,
  9130. "ismallkatakanahalfwidth",
  9131. 0xff68,
  9132. "issharbengali",
  9133. 0x09fa,
  9134. "istroke",
  9135. 0x0268,
  9136. "isuperior",
  9137. 0xf6ed,
  9138. "iterationhiragana",
  9139. 0x309d,
  9140. "iterationkatakana",
  9141. 0x30fd,
  9142. "itilde",
  9143. 0x0129,
  9144. "itildebelow",
  9145. 0x1e2d,
  9146. "iubopomofo",
  9147. 0x3129,
  9148. "iucyrillic",
  9149. 0x044e,
  9150. "ivowelsignbengali",
  9151. 0x09bf,
  9152. "ivowelsigndeva",
  9153. 0x093f,
  9154. "ivowelsigngujarati",
  9155. 0x0abf,
  9156. "izhitsacyrillic",
  9157. 0x0475,
  9158. "izhitsadblgravecyrillic",
  9159. 0x0477,
  9160. "j",
  9161. 0x006a,
  9162. "jaarmenian",
  9163. 0x0571,
  9164. "jabengali",
  9165. 0x099c,
  9166. "jadeva",
  9167. 0x091c,
  9168. "jagujarati",
  9169. 0x0a9c,
  9170. "jagurmukhi",
  9171. 0x0a1c,
  9172. "jbopomofo",
  9173. 0x3110,
  9174. "jcaron",
  9175. 0x01f0,
  9176. "jcircle",
  9177. 0x24d9,
  9178. "jcircumflex",
  9179. 0x0135,
  9180. "jcrossedtail",
  9181. 0x029d,
  9182. "jdotlessstroke",
  9183. 0x025f,
  9184. "jecyrillic",
  9185. 0x0458,
  9186. "jeemarabic",
  9187. 0x062c,
  9188. "jeemfinalarabic",
  9189. 0xfe9e,
  9190. "jeeminitialarabic",
  9191. 0xfe9f,
  9192. "jeemmedialarabic",
  9193. 0xfea0,
  9194. "jeharabic",
  9195. 0x0698,
  9196. "jehfinalarabic",
  9197. 0xfb8b,
  9198. "jhabengali",
  9199. 0x099d,
  9200. "jhadeva",
  9201. 0x091d,
  9202. "jhagujarati",
  9203. 0x0a9d,
  9204. "jhagurmukhi",
  9205. 0x0a1d,
  9206. "jheharmenian",
  9207. 0x057b,
  9208. "jis",
  9209. 0x3004,
  9210. "jmonospace",
  9211. 0xff4a,
  9212. "jparen",
  9213. 0x24a5,
  9214. "jsuperior",
  9215. 0x02b2,
  9216. "k",
  9217. 0x006b,
  9218. "kabashkircyrillic",
  9219. 0x04a1,
  9220. "kabengali",
  9221. 0x0995,
  9222. "kacute",
  9223. 0x1e31,
  9224. "kacyrillic",
  9225. 0x043a,
  9226. "kadescendercyrillic",
  9227. 0x049b,
  9228. "kadeva",
  9229. 0x0915,
  9230. "kaf",
  9231. 0x05db,
  9232. "kafarabic",
  9233. 0x0643,
  9234. "kafdagesh",
  9235. 0xfb3b,
  9236. "kafdageshhebrew",
  9237. 0xfb3b,
  9238. "kaffinalarabic",
  9239. 0xfeda,
  9240. "kafhebrew",
  9241. 0x05db,
  9242. "kafinitialarabic",
  9243. 0xfedb,
  9244. "kafmedialarabic",
  9245. 0xfedc,
  9246. "kafrafehebrew",
  9247. 0xfb4d,
  9248. "kagujarati",
  9249. 0x0a95,
  9250. "kagurmukhi",
  9251. 0x0a15,
  9252. "kahiragana",
  9253. 0x304b,
  9254. "kahookcyrillic",
  9255. 0x04c4,
  9256. "kakatakana",
  9257. 0x30ab,
  9258. "kakatakanahalfwidth",
  9259. 0xff76,
  9260. "kappa",
  9261. 0x03ba,
  9262. "kappasymbolgreek",
  9263. 0x03f0,
  9264. "kapyeounmieumkorean",
  9265. 0x3171,
  9266. "kapyeounphieuphkorean",
  9267. 0x3184,
  9268. "kapyeounpieupkorean",
  9269. 0x3178,
  9270. "kapyeounssangpieupkorean",
  9271. 0x3179,
  9272. "karoriisquare",
  9273. 0x330d,
  9274. "kashidaautoarabic",
  9275. 0x0640,
  9276. "kashidaautonosidebearingarabic",
  9277. 0x0640,
  9278. "kasmallkatakana",
  9279. 0x30f5,
  9280. "kasquare",
  9281. 0x3384,
  9282. "kasraarabic",
  9283. 0x0650,
  9284. "kasratanarabic",
  9285. 0x064d,
  9286. "kastrokecyrillic",
  9287. 0x049f,
  9288. "katahiraprolongmarkhalfwidth",
  9289. 0xff70,
  9290. "kaverticalstrokecyrillic",
  9291. 0x049d,
  9292. "kbopomofo",
  9293. 0x310e,
  9294. "kcalsquare",
  9295. 0x3389,
  9296. "kcaron",
  9297. 0x01e9,
  9298. "kcedilla",
  9299. 0x0137,
  9300. "kcircle",
  9301. 0x24da,
  9302. "kcommaaccent",
  9303. 0x0137,
  9304. "kdotbelow",
  9305. 0x1e33,
  9306. "keharmenian",
  9307. 0x0584,
  9308. "kehiragana",
  9309. 0x3051,
  9310. "kekatakana",
  9311. 0x30b1,
  9312. "kekatakanahalfwidth",
  9313. 0xff79,
  9314. "kenarmenian",
  9315. 0x056f,
  9316. "kesmallkatakana",
  9317. 0x30f6,
  9318. "kgreenlandic",
  9319. 0x0138,
  9320. "khabengali",
  9321. 0x0996,
  9322. "khacyrillic",
  9323. 0x0445,
  9324. "khadeva",
  9325. 0x0916,
  9326. "khagujarati",
  9327. 0x0a96,
  9328. "khagurmukhi",
  9329. 0x0a16,
  9330. "khaharabic",
  9331. 0x062e,
  9332. "khahfinalarabic",
  9333. 0xfea6,
  9334. "khahinitialarabic",
  9335. 0xfea7,
  9336. "khahmedialarabic",
  9337. 0xfea8,
  9338. "kheicoptic",
  9339. 0x03e7,
  9340. "khhadeva",
  9341. 0x0959,
  9342. "khhagurmukhi",
  9343. 0x0a59,
  9344. "khieukhacirclekorean",
  9345. 0x3278,
  9346. "khieukhaparenkorean",
  9347. 0x3218,
  9348. "khieukhcirclekorean",
  9349. 0x326a,
  9350. "khieukhkorean",
  9351. 0x314b,
  9352. "khieukhparenkorean",
  9353. 0x320a,
  9354. "khokhaithai",
  9355. 0x0e02,
  9356. "khokhonthai",
  9357. 0x0e05,
  9358. "khokhuatthai",
  9359. 0x0e03,
  9360. "khokhwaithai",
  9361. 0x0e04,
  9362. "khomutthai",
  9363. 0x0e5b,
  9364. "khook",
  9365. 0x0199,
  9366. "khorakhangthai",
  9367. 0x0e06,
  9368. "khzsquare",
  9369. 0x3391,
  9370. "kihiragana",
  9371. 0x304d,
  9372. "kikatakana",
  9373. 0x30ad,
  9374. "kikatakanahalfwidth",
  9375. 0xff77,
  9376. "kiroguramusquare",
  9377. 0x3315,
  9378. "kiromeetorusquare",
  9379. 0x3316,
  9380. "kirosquare",
  9381. 0x3314,
  9382. "kiyeokacirclekorean",
  9383. 0x326e,
  9384. "kiyeokaparenkorean",
  9385. 0x320e,
  9386. "kiyeokcirclekorean",
  9387. 0x3260,
  9388. "kiyeokkorean",
  9389. 0x3131,
  9390. "kiyeokparenkorean",
  9391. 0x3200,
  9392. "kiyeoksioskorean",
  9393. 0x3133,
  9394. "kjecyrillic",
  9395. 0x045c,
  9396. "klinebelow",
  9397. 0x1e35,
  9398. "klsquare",
  9399. 0x3398,
  9400. "kmcubedsquare",
  9401. 0x33a6,
  9402. "kmonospace",
  9403. 0xff4b,
  9404. "kmsquaredsquare",
  9405. 0x33a2,
  9406. "kohiragana",
  9407. 0x3053,
  9408. "kohmsquare",
  9409. 0x33c0,
  9410. "kokaithai",
  9411. 0x0e01,
  9412. "kokatakana",
  9413. 0x30b3,
  9414. "kokatakanahalfwidth",
  9415. 0xff7a,
  9416. "kooposquare",
  9417. 0x331e,
  9418. "koppacyrillic",
  9419. 0x0481,
  9420. "koreanstandardsymbol",
  9421. 0x327f,
  9422. "koroniscmb",
  9423. 0x0343,
  9424. "kparen",
  9425. 0x24a6,
  9426. "kpasquare",
  9427. 0x33aa,
  9428. "ksicyrillic",
  9429. 0x046f,
  9430. "ktsquare",
  9431. 0x33cf,
  9432. "kturned",
  9433. 0x029e,
  9434. "kuhiragana",
  9435. 0x304f,
  9436. "kukatakana",
  9437. 0x30af,
  9438. "kukatakanahalfwidth",
  9439. 0xff78,
  9440. "kvsquare",
  9441. 0x33b8,
  9442. "kwsquare",
  9443. 0x33be,
  9444. "l",
  9445. 0x006c,
  9446. "labengali",
  9447. 0x09b2,
  9448. "lacute",
  9449. 0x013a,
  9450. "ladeva",
  9451. 0x0932,
  9452. "lagujarati",
  9453. 0x0ab2,
  9454. "lagurmukhi",
  9455. 0x0a32,
  9456. "lakkhangyaothai",
  9457. 0x0e45,
  9458. "lamaleffinalarabic",
  9459. 0xfefc,
  9460. "lamalefhamzaabovefinalarabic",
  9461. 0xfef8,
  9462. "lamalefhamzaaboveisolatedarabic",
  9463. 0xfef7,
  9464. "lamalefhamzabelowfinalarabic",
  9465. 0xfefa,
  9466. "lamalefhamzabelowisolatedarabic",
  9467. 0xfef9,
  9468. "lamalefisolatedarabic",
  9469. 0xfefb,
  9470. "lamalefmaddaabovefinalarabic",
  9471. 0xfef6,
  9472. "lamalefmaddaaboveisolatedarabic",
  9473. 0xfef5,
  9474. "lamarabic",
  9475. 0x0644,
  9476. "lambda",
  9477. 0x03bb,
  9478. "lambdastroke",
  9479. 0x019b,
  9480. "lamed",
  9481. 0x05dc,
  9482. "lameddagesh",
  9483. 0xfb3c,
  9484. "lameddageshhebrew",
  9485. 0xfb3c,
  9486. "lamedhebrew",
  9487. 0x05dc,
  9488. "lamfinalarabic",
  9489. 0xfede,
  9490. "lamhahinitialarabic",
  9491. 0xfcca,
  9492. "laminitialarabic",
  9493. 0xfedf,
  9494. "lamjeeminitialarabic",
  9495. 0xfcc9,
  9496. "lamkhahinitialarabic",
  9497. 0xfccb,
  9498. "lamlamhehisolatedarabic",
  9499. 0xfdf2,
  9500. "lammedialarabic",
  9501. 0xfee0,
  9502. "lammeemhahinitialarabic",
  9503. 0xfd88,
  9504. "lammeeminitialarabic",
  9505. 0xfccc,
  9506. "largecircle",
  9507. 0x25ef,
  9508. "lbar",
  9509. 0x019a,
  9510. "lbelt",
  9511. 0x026c,
  9512. "lbopomofo",
  9513. 0x310c,
  9514. "lcaron",
  9515. 0x013e,
  9516. "lcedilla",
  9517. 0x013c,
  9518. "lcircle",
  9519. 0x24db,
  9520. "lcircumflexbelow",
  9521. 0x1e3d,
  9522. "lcommaaccent",
  9523. 0x013c,
  9524. "ldot",
  9525. 0x0140,
  9526. "ldotaccent",
  9527. 0x0140,
  9528. "ldotbelow",
  9529. 0x1e37,
  9530. "ldotbelowmacron",
  9531. 0x1e39,
  9532. "leftangleabovecmb",
  9533. 0x031a,
  9534. "lefttackbelowcmb",
  9535. 0x0318,
  9536. "less",
  9537. 0x003c,
  9538. "lessequal",
  9539. 0x2264,
  9540. "lessequalorgreater",
  9541. 0x22da,
  9542. "lessmonospace",
  9543. 0xff1c,
  9544. "lessorequivalent",
  9545. 0x2272,
  9546. "lessorgreater",
  9547. 0x2276,
  9548. "lessoverequal",
  9549. 0x2266,
  9550. "lesssmall",
  9551. 0xfe64,
  9552. "lezh",
  9553. 0x026e,
  9554. "lfblock",
  9555. 0x258c,
  9556. "lhookretroflex",
  9557. 0x026d,
  9558. "lira",
  9559. 0x20a4,
  9560. "liwnarmenian",
  9561. 0x056c,
  9562. "lj",
  9563. 0x01c9,
  9564. "ljecyrillic",
  9565. 0x0459,
  9566. "ll",
  9567. 0xf6c0,
  9568. "lladeva",
  9569. 0x0933,
  9570. "llagujarati",
  9571. 0x0ab3,
  9572. "llinebelow",
  9573. 0x1e3b,
  9574. "llladeva",
  9575. 0x0934,
  9576. "llvocalicbengali",
  9577. 0x09e1,
  9578. "llvocalicdeva",
  9579. 0x0961,
  9580. "llvocalicvowelsignbengali",
  9581. 0x09e3,
  9582. "llvocalicvowelsigndeva",
  9583. 0x0963,
  9584. "lmiddletilde",
  9585. 0x026b,
  9586. "lmonospace",
  9587. 0xff4c,
  9588. "lmsquare",
  9589. 0x33d0,
  9590. "lochulathai",
  9591. 0x0e2c,
  9592. "logicaland",
  9593. 0x2227,
  9594. "logicalnot",
  9595. 0x00ac,
  9596. "logicalnotreversed",
  9597. 0x2310,
  9598. "logicalor",
  9599. 0x2228,
  9600. "lolingthai",
  9601. 0x0e25,
  9602. "longs",
  9603. 0x017f,
  9604. "lowlinecenterline",
  9605. 0xfe4e,
  9606. "lowlinecmb",
  9607. 0x0332,
  9608. "lowlinedashed",
  9609. 0xfe4d,
  9610. "lozenge",
  9611. 0x25ca,
  9612. "lparen",
  9613. 0x24a7,
  9614. "lslash",
  9615. 0x0142,
  9616. "lsquare",
  9617. 0x2113,
  9618. "lsuperior",
  9619. 0xf6ee,
  9620. "ltshade",
  9621. 0x2591,
  9622. "luthai",
  9623. 0x0e26,
  9624. "lvocalicbengali",
  9625. 0x098c,
  9626. "lvocalicdeva",
  9627. 0x090c,
  9628. "lvocalicvowelsignbengali",
  9629. 0x09e2,
  9630. "lvocalicvowelsigndeva",
  9631. 0x0962,
  9632. "lxsquare",
  9633. 0x33d3,
  9634. "m",
  9635. 0x006d,
  9636. "mabengali",
  9637. 0x09ae,
  9638. "macron",
  9639. 0x00af,
  9640. "macronbelowcmb",
  9641. 0x0331,
  9642. "macroncmb",
  9643. 0x0304,
  9644. "macronlowmod",
  9645. 0x02cd,
  9646. "macronmonospace",
  9647. 0xffe3,
  9648. "macute",
  9649. 0x1e3f,
  9650. "madeva",
  9651. 0x092e,
  9652. "magujarati",
  9653. 0x0aae,
  9654. "magurmukhi",
  9655. 0x0a2e,
  9656. "mahapakhhebrew",
  9657. 0x05a4,
  9658. "mahapakhlefthebrew",
  9659. 0x05a4,
  9660. "mahiragana",
  9661. 0x307e,
  9662. "maichattawalowleftthai",
  9663. 0xf895,
  9664. "maichattawalowrightthai",
  9665. 0xf894,
  9666. "maichattawathai",
  9667. 0x0e4b,
  9668. "maichattawaupperleftthai",
  9669. 0xf893,
  9670. "maieklowleftthai",
  9671. 0xf88c,
  9672. "maieklowrightthai",
  9673. 0xf88b,
  9674. "maiekthai",
  9675. 0x0e48,
  9676. "maiekupperleftthai",
  9677. 0xf88a,
  9678. "maihanakatleftthai",
  9679. 0xf884,
  9680. "maihanakatthai",
  9681. 0x0e31,
  9682. "maitaikhuleftthai",
  9683. 0xf889,
  9684. "maitaikhuthai",
  9685. 0x0e47,
  9686. "maitholowleftthai",
  9687. 0xf88f,
  9688. "maitholowrightthai",
  9689. 0xf88e,
  9690. "maithothai",
  9691. 0x0e49,
  9692. "maithoupperleftthai",
  9693. 0xf88d,
  9694. "maitrilowleftthai",
  9695. 0xf892,
  9696. "maitrilowrightthai",
  9697. 0xf891,
  9698. "maitrithai",
  9699. 0x0e4a,
  9700. "maitriupperleftthai",
  9701. 0xf890,
  9702. "maiyamokthai",
  9703. 0x0e46,
  9704. "makatakana",
  9705. 0x30de,
  9706. "makatakanahalfwidth",
  9707. 0xff8f,
  9708. "male",
  9709. 0x2642,
  9710. "mansyonsquare",
  9711. 0x3347,
  9712. "maqafhebrew",
  9713. 0x05be,
  9714. "mars",
  9715. 0x2642,
  9716. "masoracirclehebrew",
  9717. 0x05af,
  9718. "masquare",
  9719. 0x3383,
  9720. "mbopomofo",
  9721. 0x3107,
  9722. "mbsquare",
  9723. 0x33d4,
  9724. "mcircle",
  9725. 0x24dc,
  9726. "mcubedsquare",
  9727. 0x33a5,
  9728. "mdotaccent",
  9729. 0x1e41,
  9730. "mdotbelow",
  9731. 0x1e43,
  9732. "meemarabic",
  9733. 0x0645,
  9734. "meemfinalarabic",
  9735. 0xfee2,
  9736. "meeminitialarabic",
  9737. 0xfee3,
  9738. "meemmedialarabic",
  9739. 0xfee4,
  9740. "meemmeeminitialarabic",
  9741. 0xfcd1,
  9742. "meemmeemisolatedarabic",
  9743. 0xfc48,
  9744. "meetorusquare",
  9745. 0x334d,
  9746. "mehiragana",
  9747. 0x3081,
  9748. "meizierasquare",
  9749. 0x337e,
  9750. "mekatakana",
  9751. 0x30e1,
  9752. "mekatakanahalfwidth",
  9753. 0xff92,
  9754. "mem",
  9755. 0x05de,
  9756. "memdagesh",
  9757. 0xfb3e,
  9758. "memdageshhebrew",
  9759. 0xfb3e,
  9760. "memhebrew",
  9761. 0x05de,
  9762. "menarmenian",
  9763. 0x0574,
  9764. "merkhahebrew",
  9765. 0x05a5,
  9766. "merkhakefulahebrew",
  9767. 0x05a6,
  9768. "merkhakefulalefthebrew",
  9769. 0x05a6,
  9770. "merkhalefthebrew",
  9771. 0x05a5,
  9772. "mhook",
  9773. 0x0271,
  9774. "mhzsquare",
  9775. 0x3392,
  9776. "middledotkatakanahalfwidth",
  9777. 0xff65,
  9778. "middot",
  9779. 0x00b7,
  9780. "mieumacirclekorean",
  9781. 0x3272,
  9782. "mieumaparenkorean",
  9783. 0x3212,
  9784. "mieumcirclekorean",
  9785. 0x3264,
  9786. "mieumkorean",
  9787. 0x3141,
  9788. "mieumpansioskorean",
  9789. 0x3170,
  9790. "mieumparenkorean",
  9791. 0x3204,
  9792. "mieumpieupkorean",
  9793. 0x316e,
  9794. "mieumsioskorean",
  9795. 0x316f,
  9796. "mihiragana",
  9797. 0x307f,
  9798. "mikatakana",
  9799. 0x30df,
  9800. "mikatakanahalfwidth",
  9801. 0xff90,
  9802. "minus",
  9803. 0x2212,
  9804. "minusbelowcmb",
  9805. 0x0320,
  9806. "minuscircle",
  9807. 0x2296,
  9808. "minusmod",
  9809. 0x02d7,
  9810. "minusplus",
  9811. 0x2213,
  9812. "minute",
  9813. 0x2032,
  9814. "miribaarusquare",
  9815. 0x334a,
  9816. "mirisquare",
  9817. 0x3349,
  9818. "mlonglegturned",
  9819. 0x0270,
  9820. "mlsquare",
  9821. 0x3396,
  9822. "mmcubedsquare",
  9823. 0x33a3,
  9824. "mmonospace",
  9825. 0xff4d,
  9826. "mmsquaredsquare",
  9827. 0x339f,
  9828. "mohiragana",
  9829. 0x3082,
  9830. "mohmsquare",
  9831. 0x33c1,
  9832. "mokatakana",
  9833. 0x30e2,
  9834. "mokatakanahalfwidth",
  9835. 0xff93,
  9836. "molsquare",
  9837. 0x33d6,
  9838. "momathai",
  9839. 0x0e21,
  9840. "moverssquare",
  9841. 0x33a7,
  9842. "moverssquaredsquare",
  9843. 0x33a8,
  9844. "mparen",
  9845. 0x24a8,
  9846. "mpasquare",
  9847. 0x33ab,
  9848. "mssquare",
  9849. 0x33b3,
  9850. "msuperior",
  9851. 0xf6ef,
  9852. "mturned",
  9853. 0x026f,
  9854. "mu",
  9855. 0x00b5,
  9856. "mu1",
  9857. 0x00b5,
  9858. "muasquare",
  9859. 0x3382,
  9860. "muchgreater",
  9861. 0x226b,
  9862. "muchless",
  9863. 0x226a,
  9864. "mufsquare",
  9865. 0x338c,
  9866. "mugreek",
  9867. 0x03bc,
  9868. "mugsquare",
  9869. 0x338d,
  9870. "muhiragana",
  9871. 0x3080,
  9872. "mukatakana",
  9873. 0x30e0,
  9874. "mukatakanahalfwidth",
  9875. 0xff91,
  9876. "mulsquare",
  9877. 0x3395,
  9878. "multiply",
  9879. 0x00d7,
  9880. "mumsquare",
  9881. 0x339b,
  9882. "munahhebrew",
  9883. 0x05a3,
  9884. "munahlefthebrew",
  9885. 0x05a3,
  9886. "musicalnote",
  9887. 0x266a,
  9888. "musicalnotedbl",
  9889. 0x266b,
  9890. "musicflatsign",
  9891. 0x266d,
  9892. "musicsharpsign",
  9893. 0x266f,
  9894. "mussquare",
  9895. 0x33b2,
  9896. "muvsquare",
  9897. 0x33b6,
  9898. "muwsquare",
  9899. 0x33bc,
  9900. "mvmegasquare",
  9901. 0x33b9,
  9902. "mvsquare",
  9903. 0x33b7,
  9904. "mwmegasquare",
  9905. 0x33bf,
  9906. "mwsquare",
  9907. 0x33bd,
  9908. "n",
  9909. 0x006e,
  9910. "nabengali",
  9911. 0x09a8,
  9912. "nabla",
  9913. 0x2207,
  9914. "nacute",
  9915. 0x0144,
  9916. "nadeva",
  9917. 0x0928,
  9918. "nagujarati",
  9919. 0x0aa8,
  9920. "nagurmukhi",
  9921. 0x0a28,
  9922. "nahiragana",
  9923. 0x306a,
  9924. "nakatakana",
  9925. 0x30ca,
  9926. "nakatakanahalfwidth",
  9927. 0xff85,
  9928. "napostrophe",
  9929. 0x0149,
  9930. "nasquare",
  9931. 0x3381,
  9932. "nbopomofo",
  9933. 0x310b,
  9934. "nbspace",
  9935. 0x00a0,
  9936. "ncaron",
  9937. 0x0148,
  9938. "ncedilla",
  9939. 0x0146,
  9940. "ncircle",
  9941. 0x24dd,
  9942. "ncircumflexbelow",
  9943. 0x1e4b,
  9944. "ncommaaccent",
  9945. 0x0146,
  9946. "ndotaccent",
  9947. 0x1e45,
  9948. "ndotbelow",
  9949. 0x1e47,
  9950. "nehiragana",
  9951. 0x306d,
  9952. "nekatakana",
  9953. 0x30cd,
  9954. "nekatakanahalfwidth",
  9955. 0xff88,
  9956. "newsheqelsign",
  9957. 0x20aa,
  9958. "nfsquare",
  9959. 0x338b,
  9960. "ngabengali",
  9961. 0x0999,
  9962. "ngadeva",
  9963. 0x0919,
  9964. "ngagujarati",
  9965. 0x0a99,
  9966. "ngagurmukhi",
  9967. 0x0a19,
  9968. "ngonguthai",
  9969. 0x0e07,
  9970. "nhiragana",
  9971. 0x3093,
  9972. "nhookleft",
  9973. 0x0272,
  9974. "nhookretroflex",
  9975. 0x0273,
  9976. "nieunacirclekorean",
  9977. 0x326f,
  9978. "nieunaparenkorean",
  9979. 0x320f,
  9980. "nieuncieuckorean",
  9981. 0x3135,
  9982. "nieuncirclekorean",
  9983. 0x3261,
  9984. "nieunhieuhkorean",
  9985. 0x3136,
  9986. "nieunkorean",
  9987. 0x3134,
  9988. "nieunpansioskorean",
  9989. 0x3168,
  9990. "nieunparenkorean",
  9991. 0x3201,
  9992. "nieunsioskorean",
  9993. 0x3167,
  9994. "nieuntikeutkorean",
  9995. 0x3166,
  9996. "nihiragana",
  9997. 0x306b,
  9998. "nikatakana",
  9999. 0x30cb,
  10000. "nikatakanahalfwidth",
  10001. 0xff86,
  10002. "nikhahitleftthai",
  10003. 0xf899,
  10004. "nikhahitthai",
  10005. 0x0e4d,
  10006. "nine",
  10007. 0x0039,
  10008. "ninearabic",
  10009. 0x0669,
  10010. "ninebengali",
  10011. 0x09ef,
  10012. "ninecircle",
  10013. 0x2468,
  10014. "ninecircleinversesansserif",
  10015. 0x2792,
  10016. "ninedeva",
  10017. 0x096f,
  10018. "ninegujarati",
  10019. 0x0aef,
  10020. "ninegurmukhi",
  10021. 0x0a6f,
  10022. "ninehackarabic",
  10023. 0x0669,
  10024. "ninehangzhou",
  10025. 0x3029,
  10026. "nineideographicparen",
  10027. 0x3228,
  10028. "nineinferior",
  10029. 0x2089,
  10030. "ninemonospace",
  10031. 0xff19,
  10032. "nineoldstyle",
  10033. 0xf739,
  10034. "nineparen",
  10035. 0x247c,
  10036. "nineperiod",
  10037. 0x2490,
  10038. "ninepersian",
  10039. 0x06f9,
  10040. "nineroman",
  10041. 0x2178,
  10042. "ninesuperior",
  10043. 0x2079,
  10044. "nineteencircle",
  10045. 0x2472,
  10046. "nineteenparen",
  10047. 0x2486,
  10048. "nineteenperiod",
  10049. 0x249a,
  10050. "ninethai",
  10051. 0x0e59,
  10052. "nj",
  10053. 0x01cc,
  10054. "njecyrillic",
  10055. 0x045a,
  10056. "nkatakana",
  10057. 0x30f3,
  10058. "nkatakanahalfwidth",
  10059. 0xff9d,
  10060. "nlegrightlong",
  10061. 0x019e,
  10062. "nlinebelow",
  10063. 0x1e49,
  10064. "nmonospace",
  10065. 0xff4e,
  10066. "nmsquare",
  10067. 0x339a,
  10068. "nnabengali",
  10069. 0x09a3,
  10070. "nnadeva",
  10071. 0x0923,
  10072. "nnagujarati",
  10073. 0x0aa3,
  10074. "nnagurmukhi",
  10075. 0x0a23,
  10076. "nnnadeva",
  10077. 0x0929,
  10078. "nohiragana",
  10079. 0x306e,
  10080. "nokatakana",
  10081. 0x30ce,
  10082. "nokatakanahalfwidth",
  10083. 0xff89,
  10084. "nonbreakingspace",
  10085. 0x00a0,
  10086. "nonenthai",
  10087. 0x0e13,
  10088. "nonuthai",
  10089. 0x0e19,
  10090. "noonarabic",
  10091. 0x0646,
  10092. "noonfinalarabic",
  10093. 0xfee6,
  10094. "noonghunnaarabic",
  10095. 0x06ba,
  10096. "noonghunnafinalarabic",
  10097. 0xfb9f,
  10098. "nooninitialarabic",
  10099. 0xfee7,
  10100. "noonjeeminitialarabic",
  10101. 0xfcd2,
  10102. "noonjeemisolatedarabic",
  10103. 0xfc4b,
  10104. "noonmedialarabic",
  10105. 0xfee8,
  10106. "noonmeeminitialarabic",
  10107. 0xfcd5,
  10108. "noonmeemisolatedarabic",
  10109. 0xfc4e,
  10110. "noonnoonfinalarabic",
  10111. 0xfc8d,
  10112. "notcontains",
  10113. 0x220c,
  10114. "notelement",
  10115. 0x2209,
  10116. "notelementof",
  10117. 0x2209,
  10118. "notequal",
  10119. 0x2260,
  10120. "notgreater",
  10121. 0x226f,
  10122. "notgreaternorequal",
  10123. 0x2271,
  10124. "notgreaternorless",
  10125. 0x2279,
  10126. "notidentical",
  10127. 0x2262,
  10128. "notless",
  10129. 0x226e,
  10130. "notlessnorequal",
  10131. 0x2270,
  10132. "notparallel",
  10133. 0x2226,
  10134. "notprecedes",
  10135. 0x2280,
  10136. "notsubset",
  10137. 0x2284,
  10138. "notsucceeds",
  10139. 0x2281,
  10140. "notsuperset",
  10141. 0x2285,
  10142. "nowarmenian",
  10143. 0x0576,
  10144. "nparen",
  10145. 0x24a9,
  10146. "nssquare",
  10147. 0x33b1,
  10148. "nsuperior",
  10149. 0x207f,
  10150. "ntilde",
  10151. 0x00f1,
  10152. "nu",
  10153. 0x03bd,
  10154. "nuhiragana",
  10155. 0x306c,
  10156. "nukatakana",
  10157. 0x30cc,
  10158. "nukatakanahalfwidth",
  10159. 0xff87,
  10160. "nuktabengali",
  10161. 0x09bc,
  10162. "nuktadeva",
  10163. 0x093c,
  10164. "nuktagujarati",
  10165. 0x0abc,
  10166. "nuktagurmukhi",
  10167. 0x0a3c,
  10168. "numbersign",
  10169. 0x0023,
  10170. "numbersignmonospace",
  10171. 0xff03,
  10172. "numbersignsmall",
  10173. 0xfe5f,
  10174. "numeralsigngreek",
  10175. 0x0374,
  10176. "numeralsignlowergreek",
  10177. 0x0375,
  10178. "numero",
  10179. 0x2116,
  10180. "nun",
  10181. 0x05e0,
  10182. "nundagesh",
  10183. 0xfb40,
  10184. "nundageshhebrew",
  10185. 0xfb40,
  10186. "nunhebrew",
  10187. 0x05e0,
  10188. "nvsquare",
  10189. 0x33b5,
  10190. "nwsquare",
  10191. 0x33bb,
  10192. "nyabengali",
  10193. 0x099e,
  10194. "nyadeva",
  10195. 0x091e,
  10196. "nyagujarati",
  10197. 0x0a9e,
  10198. "nyagurmukhi",
  10199. 0x0a1e,
  10200. "o",
  10201. 0x006f,
  10202. "oacute",
  10203. 0x00f3,
  10204. "oangthai",
  10205. 0x0e2d,
  10206. "obarred",
  10207. 0x0275,
  10208. "obarredcyrillic",
  10209. 0x04e9,
  10210. "obarreddieresiscyrillic",
  10211. 0x04eb,
  10212. "obengali",
  10213. 0x0993,
  10214. "obopomofo",
  10215. 0x311b,
  10216. "obreve",
  10217. 0x014f,
  10218. "ocandradeva",
  10219. 0x0911,
  10220. "ocandragujarati",
  10221. 0x0a91,
  10222. "ocandravowelsigndeva",
  10223. 0x0949,
  10224. "ocandravowelsigngujarati",
  10225. 0x0ac9,
  10226. "ocaron",
  10227. 0x01d2,
  10228. "ocircle",
  10229. 0x24de,
  10230. "ocircumflex",
  10231. 0x00f4,
  10232. "ocircumflexacute",
  10233. 0x1ed1,
  10234. "ocircumflexdotbelow",
  10235. 0x1ed9,
  10236. "ocircumflexgrave",
  10237. 0x1ed3,
  10238. "ocircumflexhookabove",
  10239. 0x1ed5,
  10240. "ocircumflextilde",
  10241. 0x1ed7,
  10242. "ocyrillic",
  10243. 0x043e,
  10244. "odblacute",
  10245. 0x0151,
  10246. "odblgrave",
  10247. 0x020d,
  10248. "odeva",
  10249. 0x0913,
  10250. "odieresis",
  10251. 0x00f6,
  10252. "odieresiscyrillic",
  10253. 0x04e7,
  10254. "odotbelow",
  10255. 0x1ecd,
  10256. "oe",
  10257. 0x0153,
  10258. "oekorean",
  10259. 0x315a,
  10260. "ogonek",
  10261. 0x02db,
  10262. "ogonekcmb",
  10263. 0x0328,
  10264. "ograve",
  10265. 0x00f2,
  10266. "ogujarati",
  10267. 0x0a93,
  10268. "oharmenian",
  10269. 0x0585,
  10270. "ohiragana",
  10271. 0x304a,
  10272. "ohookabove",
  10273. 0x1ecf,
  10274. "ohorn",
  10275. 0x01a1,
  10276. "ohornacute",
  10277. 0x1edb,
  10278. "ohorndotbelow",
  10279. 0x1ee3,
  10280. "ohorngrave",
  10281. 0x1edd,
  10282. "ohornhookabove",
  10283. 0x1edf,
  10284. "ohorntilde",
  10285. 0x1ee1,
  10286. "ohungarumlaut",
  10287. 0x0151,
  10288. "oi",
  10289. 0x01a3,
  10290. "oinvertedbreve",
  10291. 0x020f,
  10292. "okatakana",
  10293. 0x30aa,
  10294. "okatakanahalfwidth",
  10295. 0xff75,
  10296. "okorean",
  10297. 0x3157,
  10298. "olehebrew",
  10299. 0x05ab,
  10300. "omacron",
  10301. 0x014d,
  10302. "omacronacute",
  10303. 0x1e53,
  10304. "omacrongrave",
  10305. 0x1e51,
  10306. "omdeva",
  10307. 0x0950,
  10308. "omega",
  10309. 0x03c9,
  10310. "omega1",
  10311. 0x03d6,
  10312. "omegacyrillic",
  10313. 0x0461,
  10314. "omegalatinclosed",
  10315. 0x0277,
  10316. "omegaroundcyrillic",
  10317. 0x047b,
  10318. "omegatitlocyrillic",
  10319. 0x047d,
  10320. "omegatonos",
  10321. 0x03ce,
  10322. "omgujarati",
  10323. 0x0ad0,
  10324. "omicron",
  10325. 0x03bf,
  10326. "omicrontonos",
  10327. 0x03cc,
  10328. "omonospace",
  10329. 0xff4f,
  10330. "one",
  10331. 0x0031,
  10332. "onearabic",
  10333. 0x0661,
  10334. "onebengali",
  10335. 0x09e7,
  10336. "onecircle",
  10337. 0x2460,
  10338. "onecircleinversesansserif",
  10339. 0x278a,
  10340. "onedeva",
  10341. 0x0967,
  10342. "onedotenleader",
  10343. 0x2024,
  10344. "oneeighth",
  10345. 0x215b,
  10346. "onefitted",
  10347. 0xf6dc,
  10348. "onegujarati",
  10349. 0x0ae7,
  10350. "onegurmukhi",
  10351. 0x0a67,
  10352. "onehackarabic",
  10353. 0x0661,
  10354. "onehalf",
  10355. 0x00bd,
  10356. "onehangzhou",
  10357. 0x3021,
  10358. "oneideographicparen",
  10359. 0x3220,
  10360. "oneinferior",
  10361. 0x2081,
  10362. "onemonospace",
  10363. 0xff11,
  10364. "onenumeratorbengali",
  10365. 0x09f4,
  10366. "oneoldstyle",
  10367. 0xf731,
  10368. "oneparen",
  10369. 0x2474,
  10370. "oneperiod",
  10371. 0x2488,
  10372. "onepersian",
  10373. 0x06f1,
  10374. "onequarter",
  10375. 0x00bc,
  10376. "oneroman",
  10377. 0x2170,
  10378. "onesuperior",
  10379. 0x00b9,
  10380. "onethai",
  10381. 0x0e51,
  10382. "onethird",
  10383. 0x2153,
  10384. "oogonek",
  10385. 0x01eb,
  10386. "oogonekmacron",
  10387. 0x01ed,
  10388. "oogurmukhi",
  10389. 0x0a13,
  10390. "oomatragurmukhi",
  10391. 0x0a4b,
  10392. "oopen",
  10393. 0x0254,
  10394. "oparen",
  10395. 0x24aa,
  10396. "openbullet",
  10397. 0x25e6,
  10398. "option",
  10399. 0x2325,
  10400. "ordfeminine",
  10401. 0x00aa,
  10402. "ordmasculine",
  10403. 0x00ba,
  10404. "orthogonal",
  10405. 0x221f,
  10406. "oshortdeva",
  10407. 0x0912,
  10408. "oshortvowelsigndeva",
  10409. 0x094a,
  10410. "oslash",
  10411. 0x00f8,
  10412. "oslashacute",
  10413. 0x01ff,
  10414. "osmallhiragana",
  10415. 0x3049,
  10416. "osmallkatakana",
  10417. 0x30a9,
  10418. "osmallkatakanahalfwidth",
  10419. 0xff6b,
  10420. "ostrokeacute",
  10421. 0x01ff,
  10422. "osuperior",
  10423. 0xf6f0,
  10424. "otcyrillic",
  10425. 0x047f,
  10426. "otilde",
  10427. 0x00f5,
  10428. "otildeacute",
  10429. 0x1e4d,
  10430. "otildedieresis",
  10431. 0x1e4f,
  10432. "oubopomofo",
  10433. 0x3121,
  10434. "overline",
  10435. 0x203e,
  10436. "overlinecenterline",
  10437. 0xfe4a,
  10438. "overlinecmb",
  10439. 0x0305,
  10440. "overlinedashed",
  10441. 0xfe49,
  10442. "overlinedblwavy",
  10443. 0xfe4c,
  10444. "overlinewavy",
  10445. 0xfe4b,
  10446. "overscore",
  10447. 0x00af,
  10448. "ovowelsignbengali",
  10449. 0x09cb,
  10450. "ovowelsigndeva",
  10451. 0x094b,
  10452. "ovowelsigngujarati",
  10453. 0x0acb,
  10454. "p",
  10455. 0x0070,
  10456. "paampssquare",
  10457. 0x3380,
  10458. "paasentosquare",
  10459. 0x332b,
  10460. "pabengali",
  10461. 0x09aa,
  10462. "pacute",
  10463. 0x1e55,
  10464. "padeva",
  10465. 0x092a,
  10466. "pagedown",
  10467. 0x21df,
  10468. "pageup",
  10469. 0x21de,
  10470. "pagujarati",
  10471. 0x0aaa,
  10472. "pagurmukhi",
  10473. 0x0a2a,
  10474. "pahiragana",
  10475. 0x3071,
  10476. "paiyannoithai",
  10477. 0x0e2f,
  10478. "pakatakana",
  10479. 0x30d1,
  10480. "palatalizationcyrilliccmb",
  10481. 0x0484,
  10482. "palochkacyrillic",
  10483. 0x04c0,
  10484. "pansioskorean",
  10485. 0x317f,
  10486. "paragraph",
  10487. 0x00b6,
  10488. "parallel",
  10489. 0x2225,
  10490. "parenleft",
  10491. 0x0028,
  10492. "parenleftaltonearabic",
  10493. 0xfd3e,
  10494. "parenleftbt",
  10495. 0xf8ed,
  10496. "parenleftex",
  10497. 0xf8ec,
  10498. "parenleftinferior",
  10499. 0x208d,
  10500. "parenleftmonospace",
  10501. 0xff08,
  10502. "parenleftsmall",
  10503. 0xfe59,
  10504. "parenleftsuperior",
  10505. 0x207d,
  10506. "parenlefttp",
  10507. 0xf8eb,
  10508. "parenleftvertical",
  10509. 0xfe35,
  10510. "parenright",
  10511. 0x0029,
  10512. "parenrightaltonearabic",
  10513. 0xfd3f,
  10514. "parenrightbt",
  10515. 0xf8f8,
  10516. "parenrightex",
  10517. 0xf8f7,
  10518. "parenrightinferior",
  10519. 0x208e,
  10520. "parenrightmonospace",
  10521. 0xff09,
  10522. "parenrightsmall",
  10523. 0xfe5a,
  10524. "parenrightsuperior",
  10525. 0x207e,
  10526. "parenrighttp",
  10527. 0xf8f6,
  10528. "parenrightvertical",
  10529. 0xfe36,
  10530. "partialdiff",
  10531. 0x2202,
  10532. "paseqhebrew",
  10533. 0x05c0,
  10534. "pashtahebrew",
  10535. 0x0599,
  10536. "pasquare",
  10537. 0x33a9,
  10538. "patah",
  10539. 0x05b7,
  10540. "patah11",
  10541. 0x05b7,
  10542. "patah1d",
  10543. 0x05b7,
  10544. "patah2a",
  10545. 0x05b7,
  10546. "patahhebrew",
  10547. 0x05b7,
  10548. "patahnarrowhebrew",
  10549. 0x05b7,
  10550. "patahquarterhebrew",
  10551. 0x05b7,
  10552. "patahwidehebrew",
  10553. 0x05b7,
  10554. "pazerhebrew",
  10555. 0x05a1,
  10556. "pbopomofo",
  10557. 0x3106,
  10558. "pcircle",
  10559. 0x24df,
  10560. "pdotaccent",
  10561. 0x1e57,
  10562. "pe",
  10563. 0x05e4,
  10564. "pecyrillic",
  10565. 0x043f,
  10566. "pedagesh",
  10567. 0xfb44,
  10568. "pedageshhebrew",
  10569. 0xfb44,
  10570. "peezisquare",
  10571. 0x333b,
  10572. "pefinaldageshhebrew",
  10573. 0xfb43,
  10574. "peharabic",
  10575. 0x067e,
  10576. "peharmenian",
  10577. 0x057a,
  10578. "pehebrew",
  10579. 0x05e4,
  10580. "pehfinalarabic",
  10581. 0xfb57,
  10582. "pehinitialarabic",
  10583. 0xfb58,
  10584. "pehiragana",
  10585. 0x307a,
  10586. "pehmedialarabic",
  10587. 0xfb59,
  10588. "pekatakana",
  10589. 0x30da,
  10590. "pemiddlehookcyrillic",
  10591. 0x04a7,
  10592. "perafehebrew",
  10593. 0xfb4e,
  10594. "percent",
  10595. 0x0025,
  10596. "percentarabic",
  10597. 0x066a,
  10598. "percentmonospace",
  10599. 0xff05,
  10600. "percentsmall",
  10601. 0xfe6a,
  10602. "period",
  10603. 0x002e,
  10604. "periodarmenian",
  10605. 0x0589,
  10606. "periodcentered",
  10607. 0x00b7,
  10608. "periodhalfwidth",
  10609. 0xff61,
  10610. "periodinferior",
  10611. 0xf6e7,
  10612. "periodmonospace",
  10613. 0xff0e,
  10614. "periodsmall",
  10615. 0xfe52,
  10616. "periodsuperior",
  10617. 0xf6e8,
  10618. "perispomenigreekcmb",
  10619. 0x0342,
  10620. "perpendicular",
  10621. 0x22a5,
  10622. "perthousand",
  10623. 0x2030,
  10624. "peseta",
  10625. 0x20a7,
  10626. "pfsquare",
  10627. 0x338a,
  10628. "phabengali",
  10629. 0x09ab,
  10630. "phadeva",
  10631. 0x092b,
  10632. "phagujarati",
  10633. 0x0aab,
  10634. "phagurmukhi",
  10635. 0x0a2b,
  10636. "phi",
  10637. 0x03c6,
  10638. "phi1",
  10639. 0x03d5,
  10640. "phieuphacirclekorean",
  10641. 0x327a,
  10642. "phieuphaparenkorean",
  10643. 0x321a,
  10644. "phieuphcirclekorean",
  10645. 0x326c,
  10646. "phieuphkorean",
  10647. 0x314d,
  10648. "phieuphparenkorean",
  10649. 0x320c,
  10650. "philatin",
  10651. 0x0278,
  10652. "phinthuthai",
  10653. 0x0e3a,
  10654. "phisymbolgreek",
  10655. 0x03d5,
  10656. "phook",
  10657. 0x01a5,
  10658. "phophanthai",
  10659. 0x0e1e,
  10660. "phophungthai",
  10661. 0x0e1c,
  10662. "phosamphaothai",
  10663. 0x0e20,
  10664. "pi",
  10665. 0x03c0,
  10666. "pieupacirclekorean",
  10667. 0x3273,
  10668. "pieupaparenkorean",
  10669. 0x3213,
  10670. "pieupcieuckorean",
  10671. 0x3176,
  10672. "pieupcirclekorean",
  10673. 0x3265,
  10674. "pieupkiyeokkorean",
  10675. 0x3172,
  10676. "pieupkorean",
  10677. 0x3142,
  10678. "pieupparenkorean",
  10679. 0x3205,
  10680. "pieupsioskiyeokkorean",
  10681. 0x3174,
  10682. "pieupsioskorean",
  10683. 0x3144,
  10684. "pieupsiostikeutkorean",
  10685. 0x3175,
  10686. "pieupthieuthkorean",
  10687. 0x3177,
  10688. "pieuptikeutkorean",
  10689. 0x3173,
  10690. "pihiragana",
  10691. 0x3074,
  10692. "pikatakana",
  10693. 0x30d4,
  10694. "pisymbolgreek",
  10695. 0x03d6,
  10696. "piwrarmenian",
  10697. 0x0583,
  10698. "plus",
  10699. 0x002b,
  10700. "plusbelowcmb",
  10701. 0x031f,
  10702. "pluscircle",
  10703. 0x2295,
  10704. "plusminus",
  10705. 0x00b1,
  10706. "plusmod",
  10707. 0x02d6,
  10708. "plusmonospace",
  10709. 0xff0b,
  10710. "plussmall",
  10711. 0xfe62,
  10712. "plussuperior",
  10713. 0x207a,
  10714. "pmonospace",
  10715. 0xff50,
  10716. "pmsquare",
  10717. 0x33d8,
  10718. "pohiragana",
  10719. 0x307d,
  10720. "pointingindexdownwhite",
  10721. 0x261f,
  10722. "pointingindexleftwhite",
  10723. 0x261c,
  10724. "pointingindexrightwhite",
  10725. 0x261e,
  10726. "pointingindexupwhite",
  10727. 0x261d,
  10728. "pokatakana",
  10729. 0x30dd,
  10730. "poplathai",
  10731. 0x0e1b,
  10732. "postalmark",
  10733. 0x3012,
  10734. "postalmarkface",
  10735. 0x3020,
  10736. "pparen",
  10737. 0x24ab,
  10738. "precedes",
  10739. 0x227a,
  10740. "prescription",
  10741. 0x211e,
  10742. "primemod",
  10743. 0x02b9,
  10744. "primereversed",
  10745. 0x2035,
  10746. "product",
  10747. 0x220f,
  10748. "projective",
  10749. 0x2305,
  10750. "prolongedkana",
  10751. 0x30fc,
  10752. "propellor",
  10753. 0x2318,
  10754. "propersubset",
  10755. 0x2282,
  10756. "propersuperset",
  10757. 0x2283,
  10758. "proportion",
  10759. 0x2237,
  10760. "proportional",
  10761. 0x221d,
  10762. "psi",
  10763. 0x03c8,
  10764. "psicyrillic",
  10765. 0x0471,
  10766. "psilipneumatacyrilliccmb",
  10767. 0x0486,
  10768. "pssquare",
  10769. 0x33b0,
  10770. "puhiragana",
  10771. 0x3077,
  10772. "pukatakana",
  10773. 0x30d7,
  10774. "pvsquare",
  10775. 0x33b4,
  10776. "pwsquare",
  10777. 0x33ba,
  10778. "q",
  10779. 0x0071,
  10780. "qadeva",
  10781. 0x0958,
  10782. "qadmahebrew",
  10783. 0x05a8,
  10784. "qafarabic",
  10785. 0x0642,
  10786. "qaffinalarabic",
  10787. 0xfed6,
  10788. "qafinitialarabic",
  10789. 0xfed7,
  10790. "qafmedialarabic",
  10791. 0xfed8,
  10792. "qamats",
  10793. 0x05b8,
  10794. "qamats10",
  10795. 0x05b8,
  10796. "qamats1a",
  10797. 0x05b8,
  10798. "qamats1c",
  10799. 0x05b8,
  10800. "qamats27",
  10801. 0x05b8,
  10802. "qamats29",
  10803. 0x05b8,
  10804. "qamats33",
  10805. 0x05b8,
  10806. "qamatsde",
  10807. 0x05b8,
  10808. "qamatshebrew",
  10809. 0x05b8,
  10810. "qamatsnarrowhebrew",
  10811. 0x05b8,
  10812. "qamatsqatanhebrew",
  10813. 0x05b8,
  10814. "qamatsqatannarrowhebrew",
  10815. 0x05b8,
  10816. "qamatsqatanquarterhebrew",
  10817. 0x05b8,
  10818. "qamatsqatanwidehebrew",
  10819. 0x05b8,
  10820. "qamatsquarterhebrew",
  10821. 0x05b8,
  10822. "qamatswidehebrew",
  10823. 0x05b8,
  10824. "qarneyparahebrew",
  10825. 0x059f,
  10826. "qbopomofo",
  10827. 0x3111,
  10828. "qcircle",
  10829. 0x24e0,
  10830. "qhook",
  10831. 0x02a0,
  10832. "qmonospace",
  10833. 0xff51,
  10834. "qof",
  10835. 0x05e7,
  10836. "qofdagesh",
  10837. 0xfb47,
  10838. "qofdageshhebrew",
  10839. 0xfb47,
  10840. "qofhebrew",
  10841. 0x05e7,
  10842. "qparen",
  10843. 0x24ac,
  10844. "quarternote",
  10845. 0x2669,
  10846. "qubuts",
  10847. 0x05bb,
  10848. "qubuts18",
  10849. 0x05bb,
  10850. "qubuts25",
  10851. 0x05bb,
  10852. "qubuts31",
  10853. 0x05bb,
  10854. "qubutshebrew",
  10855. 0x05bb,
  10856. "qubutsnarrowhebrew",
  10857. 0x05bb,
  10858. "qubutsquarterhebrew",
  10859. 0x05bb,
  10860. "qubutswidehebrew",
  10861. 0x05bb,
  10862. "question",
  10863. 0x003f,
  10864. "questionarabic",
  10865. 0x061f,
  10866. "questionarmenian",
  10867. 0x055e,
  10868. "questiondown",
  10869. 0x00bf,
  10870. "questiondownsmall",
  10871. 0xf7bf,
  10872. "questiongreek",
  10873. 0x037e,
  10874. "questionmonospace",
  10875. 0xff1f,
  10876. "questionsmall",
  10877. 0xf73f,
  10878. "quotedbl",
  10879. 0x0022,
  10880. "quotedblbase",
  10881. 0x201e,
  10882. "quotedblleft",
  10883. 0x201c,
  10884. "quotedblmonospace",
  10885. 0xff02,
  10886. "quotedblprime",
  10887. 0x301e,
  10888. "quotedblprimereversed",
  10889. 0x301d,
  10890. "quotedblright",
  10891. 0x201d,
  10892. "quoteleft",
  10893. 0x2018,
  10894. "quoteleftreversed",
  10895. 0x201b,
  10896. "quotereversed",
  10897. 0x201b,
  10898. "quoteright",
  10899. 0x2019,
  10900. "quoterightn",
  10901. 0x0149,
  10902. "quotesinglbase",
  10903. 0x201a,
  10904. "quotesingle",
  10905. 0x0027,
  10906. "quotesinglemonospace",
  10907. 0xff07,
  10908. "r",
  10909. 0x0072,
  10910. "raarmenian",
  10911. 0x057c,
  10912. "rabengali",
  10913. 0x09b0,
  10914. "racute",
  10915. 0x0155,
  10916. "radeva",
  10917. 0x0930,
  10918. "radical",
  10919. 0x221a,
  10920. "radicalex",
  10921. 0xf8e5,
  10922. "radoverssquare",
  10923. 0x33ae,
  10924. "radoverssquaredsquare",
  10925. 0x33af,
  10926. "radsquare",
  10927. 0x33ad,
  10928. "rafe",
  10929. 0x05bf,
  10930. "rafehebrew",
  10931. 0x05bf,
  10932. "ragujarati",
  10933. 0x0ab0,
  10934. "ragurmukhi",
  10935. 0x0a30,
  10936. "rahiragana",
  10937. 0x3089,
  10938. "rakatakana",
  10939. 0x30e9,
  10940. "rakatakanahalfwidth",
  10941. 0xff97,
  10942. "ralowerdiagonalbengali",
  10943. 0x09f1,
  10944. "ramiddlediagonalbengali",
  10945. 0x09f0,
  10946. "ramshorn",
  10947. 0x0264,
  10948. "ratio",
  10949. 0x2236,
  10950. "rbopomofo",
  10951. 0x3116,
  10952. "rcaron",
  10953. 0x0159,
  10954. "rcedilla",
  10955. 0x0157,
  10956. "rcircle",
  10957. 0x24e1,
  10958. "rcommaaccent",
  10959. 0x0157,
  10960. "rdblgrave",
  10961. 0x0211,
  10962. "rdotaccent",
  10963. 0x1e59,
  10964. "rdotbelow",
  10965. 0x1e5b,
  10966. "rdotbelowmacron",
  10967. 0x1e5d,
  10968. "referencemark",
  10969. 0x203b,
  10970. "reflexsubset",
  10971. 0x2286,
  10972. "reflexsuperset",
  10973. 0x2287,
  10974. "registered",
  10975. 0x00ae,
  10976. "registersans",
  10977. 0xf8e8,
  10978. "registerserif",
  10979. 0xf6da,
  10980. "reharabic",
  10981. 0x0631,
  10982. "reharmenian",
  10983. 0x0580,
  10984. "rehfinalarabic",
  10985. 0xfeae,
  10986. "rehiragana",
  10987. 0x308c,
  10988. "rekatakana",
  10989. 0x30ec,
  10990. "rekatakanahalfwidth",
  10991. 0xff9a,
  10992. "resh",
  10993. 0x05e8,
  10994. "reshdageshhebrew",
  10995. 0xfb48,
  10996. "reshhebrew",
  10997. 0x05e8,
  10998. "reversedtilde",
  10999. 0x223d,
  11000. "reviahebrew",
  11001. 0x0597,
  11002. "reviamugrashhebrew",
  11003. 0x0597,
  11004. "revlogicalnot",
  11005. 0x2310,
  11006. "rfishhook",
  11007. 0x027e,
  11008. "rfishhookreversed",
  11009. 0x027f,
  11010. "rhabengali",
  11011. 0x09dd,
  11012. "rhadeva",
  11013. 0x095d,
  11014. "rho",
  11015. 0x03c1,
  11016. "rhook",
  11017. 0x027d,
  11018. "rhookturned",
  11019. 0x027b,
  11020. "rhookturnedsuperior",
  11021. 0x02b5,
  11022. "rhosymbolgreek",
  11023. 0x03f1,
  11024. "rhotichookmod",
  11025. 0x02de,
  11026. "rieulacirclekorean",
  11027. 0x3271,
  11028. "rieulaparenkorean",
  11029. 0x3211,
  11030. "rieulcirclekorean",
  11031. 0x3263,
  11032. "rieulhieuhkorean",
  11033. 0x3140,
  11034. "rieulkiyeokkorean",
  11035. 0x313a,
  11036. "rieulkiyeoksioskorean",
  11037. 0x3169,
  11038. "rieulkorean",
  11039. 0x3139,
  11040. "rieulmieumkorean",
  11041. 0x313b,
  11042. "rieulpansioskorean",
  11043. 0x316c,
  11044. "rieulparenkorean",
  11045. 0x3203,
  11046. "rieulphieuphkorean",
  11047. 0x313f,
  11048. "rieulpieupkorean",
  11049. 0x313c,
  11050. "rieulpieupsioskorean",
  11051. 0x316b,
  11052. "rieulsioskorean",
  11053. 0x313d,
  11054. "rieulthieuthkorean",
  11055. 0x313e,
  11056. "rieultikeutkorean",
  11057. 0x316a,
  11058. "rieulyeorinhieuhkorean",
  11059. 0x316d,
  11060. "rightangle",
  11061. 0x221f,
  11062. "righttackbelowcmb",
  11063. 0x0319,
  11064. "righttriangle",
  11065. 0x22bf,
  11066. "rihiragana",
  11067. 0x308a,
  11068. "rikatakana",
  11069. 0x30ea,
  11070. "rikatakanahalfwidth",
  11071. 0xff98,
  11072. "ring",
  11073. 0x02da,
  11074. "ringbelowcmb",
  11075. 0x0325,
  11076. "ringcmb",
  11077. 0x030a,
  11078. "ringhalfleft",
  11079. 0x02bf,
  11080. "ringhalfleftarmenian",
  11081. 0x0559,
  11082. "ringhalfleftbelowcmb",
  11083. 0x031c,
  11084. "ringhalfleftcentered",
  11085. 0x02d3,
  11086. "ringhalfright",
  11087. 0x02be,
  11088. "ringhalfrightbelowcmb",
  11089. 0x0339,
  11090. "ringhalfrightcentered",
  11091. 0x02d2,
  11092. "rinvertedbreve",
  11093. 0x0213,
  11094. "rittorusquare",
  11095. 0x3351,
  11096. "rlinebelow",
  11097. 0x1e5f,
  11098. "rlongleg",
  11099. 0x027c,
  11100. "rlonglegturned",
  11101. 0x027a,
  11102. "rmonospace",
  11103. 0xff52,
  11104. "rohiragana",
  11105. 0x308d,
  11106. "rokatakana",
  11107. 0x30ed,
  11108. "rokatakanahalfwidth",
  11109. 0xff9b,
  11110. "roruathai",
  11111. 0x0e23,
  11112. "rparen",
  11113. 0x24ad,
  11114. "rrabengali",
  11115. 0x09dc,
  11116. "rradeva",
  11117. 0x0931,
  11118. "rragurmukhi",
  11119. 0x0a5c,
  11120. "rreharabic",
  11121. 0x0691,
  11122. "rrehfinalarabic",
  11123. 0xfb8d,
  11124. "rrvocalicbengali",
  11125. 0x09e0,
  11126. "rrvocalicdeva",
  11127. 0x0960,
  11128. "rrvocalicgujarati",
  11129. 0x0ae0,
  11130. "rrvocalicvowelsignbengali",
  11131. 0x09c4,
  11132. "rrvocalicvowelsigndeva",
  11133. 0x0944,
  11134. "rrvocalicvowelsigngujarati",
  11135. 0x0ac4,
  11136. "rsuperior",
  11137. 0xf6f1,
  11138. "rtblock",
  11139. 0x2590,
  11140. "rturned",
  11141. 0x0279,
  11142. "rturnedsuperior",
  11143. 0x02b4,
  11144. "ruhiragana",
  11145. 0x308b,
  11146. "rukatakana",
  11147. 0x30eb,
  11148. "rukatakanahalfwidth",
  11149. 0xff99,
  11150. "rupeemarkbengali",
  11151. 0x09f2,
  11152. "rupeesignbengali",
  11153. 0x09f3,
  11154. "rupiah",
  11155. 0xf6dd,
  11156. "ruthai",
  11157. 0x0e24,
  11158. "rvocalicbengali",
  11159. 0x098b,
  11160. "rvocalicdeva",
  11161. 0x090b,
  11162. "rvocalicgujarati",
  11163. 0x0a8b,
  11164. "rvocalicvowelsignbengali",
  11165. 0x09c3,
  11166. "rvocalicvowelsigndeva",
  11167. 0x0943,
  11168. "rvocalicvowelsigngujarati",
  11169. 0x0ac3,
  11170. "s",
  11171. 0x0073,
  11172. "sabengali",
  11173. 0x09b8,
  11174. "sacute",
  11175. 0x015b,
  11176. "sacutedotaccent",
  11177. 0x1e65,
  11178. "sadarabic",
  11179. 0x0635,
  11180. "sadeva",
  11181. 0x0938,
  11182. "sadfinalarabic",
  11183. 0xfeba,
  11184. "sadinitialarabic",
  11185. 0xfebb,
  11186. "sadmedialarabic",
  11187. 0xfebc,
  11188. "sagujarati",
  11189. 0x0ab8,
  11190. "sagurmukhi",
  11191. 0x0a38,
  11192. "sahiragana",
  11193. 0x3055,
  11194. "sakatakana",
  11195. 0x30b5,
  11196. "sakatakanahalfwidth",
  11197. 0xff7b,
  11198. "sallallahoualayhewasallamarabic",
  11199. 0xfdfa,
  11200. "samekh",
  11201. 0x05e1,
  11202. "samekhdagesh",
  11203. 0xfb41,
  11204. "samekhdageshhebrew",
  11205. 0xfb41,
  11206. "samekhhebrew",
  11207. 0x05e1,
  11208. "saraaathai",
  11209. 0x0e32,
  11210. "saraaethai",
  11211. 0x0e41,
  11212. "saraaimaimalaithai",
  11213. 0x0e44,
  11214. "saraaimaimuanthai",
  11215. 0x0e43,
  11216. "saraamthai",
  11217. 0x0e33,
  11218. "saraathai",
  11219. 0x0e30,
  11220. "saraethai",
  11221. 0x0e40,
  11222. "saraiileftthai",
  11223. 0xf886,
  11224. "saraiithai",
  11225. 0x0e35,
  11226. "saraileftthai",
  11227. 0xf885,
  11228. "saraithai",
  11229. 0x0e34,
  11230. "saraothai",
  11231. 0x0e42,
  11232. "saraueeleftthai",
  11233. 0xf888,
  11234. "saraueethai",
  11235. 0x0e37,
  11236. "saraueleftthai",
  11237. 0xf887,
  11238. "sarauethai",
  11239. 0x0e36,
  11240. "sarauthai",
  11241. 0x0e38,
  11242. "sarauuthai",
  11243. 0x0e39,
  11244. "sbopomofo",
  11245. 0x3119,
  11246. "scaron",
  11247. 0x0161,
  11248. "scarondotaccent",
  11249. 0x1e67,
  11250. "scedilla",
  11251. 0x015f,
  11252. "schwa",
  11253. 0x0259,
  11254. "schwacyrillic",
  11255. 0x04d9,
  11256. "schwadieresiscyrillic",
  11257. 0x04db,
  11258. "schwahook",
  11259. 0x025a,
  11260. "scircle",
  11261. 0x24e2,
  11262. "scircumflex",
  11263. 0x015d,
  11264. "scommaaccent",
  11265. 0x0219,
  11266. "sdotaccent",
  11267. 0x1e61,
  11268. "sdotbelow",
  11269. 0x1e63,
  11270. "sdotbelowdotaccent",
  11271. 0x1e69,
  11272. "seagullbelowcmb",
  11273. 0x033c,
  11274. "second",
  11275. 0x2033,
  11276. "secondtonechinese",
  11277. 0x02ca,
  11278. "section",
  11279. 0x00a7,
  11280. "seenarabic",
  11281. 0x0633,
  11282. "seenfinalarabic",
  11283. 0xfeb2,
  11284. "seeninitialarabic",
  11285. 0xfeb3,
  11286. "seenmedialarabic",
  11287. 0xfeb4,
  11288. "segol",
  11289. 0x05b6,
  11290. "segol13",
  11291. 0x05b6,
  11292. "segol1f",
  11293. 0x05b6,
  11294. "segol2c",
  11295. 0x05b6,
  11296. "segolhebrew",
  11297. 0x05b6,
  11298. "segolnarrowhebrew",
  11299. 0x05b6,
  11300. "segolquarterhebrew",
  11301. 0x05b6,
  11302. "segoltahebrew",
  11303. 0x0592,
  11304. "segolwidehebrew",
  11305. 0x05b6,
  11306. "seharmenian",
  11307. 0x057d,
  11308. "sehiragana",
  11309. 0x305b,
  11310. "sekatakana",
  11311. 0x30bb,
  11312. "sekatakanahalfwidth",
  11313. 0xff7e,
  11314. "semicolon",
  11315. 0x003b,
  11316. "semicolonarabic",
  11317. 0x061b,
  11318. "semicolonmonospace",
  11319. 0xff1b,
  11320. "semicolonsmall",
  11321. 0xfe54,
  11322. "semivoicedmarkkana",
  11323. 0x309c,
  11324. "semivoicedmarkkanahalfwidth",
  11325. 0xff9f,
  11326. "sentisquare",
  11327. 0x3322,
  11328. "sentosquare",
  11329. 0x3323,
  11330. "seven",
  11331. 0x0037,
  11332. "sevenarabic",
  11333. 0x0667,
  11334. "sevenbengali",
  11335. 0x09ed,
  11336. "sevencircle",
  11337. 0x2466,
  11338. "sevencircleinversesansserif",
  11339. 0x2790,
  11340. "sevendeva",
  11341. 0x096d,
  11342. "seveneighths",
  11343. 0x215e,
  11344. "sevengujarati",
  11345. 0x0aed,
  11346. "sevengurmukhi",
  11347. 0x0a6d,
  11348. "sevenhackarabic",
  11349. 0x0667,
  11350. "sevenhangzhou",
  11351. 0x3027,
  11352. "sevenideographicparen",
  11353. 0x3226,
  11354. "seveninferior",
  11355. 0x2087,
  11356. "sevenmonospace",
  11357. 0xff17,
  11358. "sevenoldstyle",
  11359. 0xf737,
  11360. "sevenparen",
  11361. 0x247a,
  11362. "sevenperiod",
  11363. 0x248e,
  11364. "sevenpersian",
  11365. 0x06f7,
  11366. "sevenroman",
  11367. 0x2176,
  11368. "sevensuperior",
  11369. 0x2077,
  11370. "seventeencircle",
  11371. 0x2470,
  11372. "seventeenparen",
  11373. 0x2484,
  11374. "seventeenperiod",
  11375. 0x2498,
  11376. "seventhai",
  11377. 0x0e57,
  11378. "sfthyphen",
  11379. 0x00ad,
  11380. "shaarmenian",
  11381. 0x0577,
  11382. "shabengali",
  11383. 0x09b6,
  11384. "shacyrillic",
  11385. 0x0448,
  11386. "shaddaarabic",
  11387. 0x0651,
  11388. "shaddadammaarabic",
  11389. 0xfc61,
  11390. "shaddadammatanarabic",
  11391. 0xfc5e,
  11392. "shaddafathaarabic",
  11393. 0xfc60,
  11394. "shaddakasraarabic",
  11395. 0xfc62,
  11396. "shaddakasratanarabic",
  11397. 0xfc5f,
  11398. "shade",
  11399. 0x2592,
  11400. "shadedark",
  11401. 0x2593,
  11402. "shadelight",
  11403. 0x2591,
  11404. "shademedium",
  11405. 0x2592,
  11406. "shadeva",
  11407. 0x0936,
  11408. "shagujarati",
  11409. 0x0ab6,
  11410. "shagurmukhi",
  11411. 0x0a36,
  11412. "shalshelethebrew",
  11413. 0x0593,
  11414. "shbopomofo",
  11415. 0x3115,
  11416. "shchacyrillic",
  11417. 0x0449,
  11418. "sheenarabic",
  11419. 0x0634,
  11420. "sheenfinalarabic",
  11421. 0xfeb6,
  11422. "sheeninitialarabic",
  11423. 0xfeb7,
  11424. "sheenmedialarabic",
  11425. 0xfeb8,
  11426. "sheicoptic",
  11427. 0x03e3,
  11428. "sheqel",
  11429. 0x20aa,
  11430. "sheqelhebrew",
  11431. 0x20aa,
  11432. "sheva",
  11433. 0x05b0,
  11434. "sheva115",
  11435. 0x05b0,
  11436. "sheva15",
  11437. 0x05b0,
  11438. "sheva22",
  11439. 0x05b0,
  11440. "sheva2e",
  11441. 0x05b0,
  11442. "shevahebrew",
  11443. 0x05b0,
  11444. "shevanarrowhebrew",
  11445. 0x05b0,
  11446. "shevaquarterhebrew",
  11447. 0x05b0,
  11448. "shevawidehebrew",
  11449. 0x05b0,
  11450. "shhacyrillic",
  11451. 0x04bb,
  11452. "shimacoptic",
  11453. 0x03ed,
  11454. "shin",
  11455. 0x05e9,
  11456. "shindagesh",
  11457. 0xfb49,
  11458. "shindageshhebrew",
  11459. 0xfb49,
  11460. "shindageshshindot",
  11461. 0xfb2c,
  11462. "shindageshshindothebrew",
  11463. 0xfb2c,
  11464. "shindageshsindot",
  11465. 0xfb2d,
  11466. "shindageshsindothebrew",
  11467. 0xfb2d,
  11468. "shindothebrew",
  11469. 0x05c1,
  11470. "shinhebrew",
  11471. 0x05e9,
  11472. "shinshindot",
  11473. 0xfb2a,
  11474. "shinshindothebrew",
  11475. 0xfb2a,
  11476. "shinsindot",
  11477. 0xfb2b,
  11478. "shinsindothebrew",
  11479. 0xfb2b,
  11480. "shook",
  11481. 0x0282,
  11482. "sigma",
  11483. 0x03c3,
  11484. "sigma1",
  11485. 0x03c2,
  11486. "sigmafinal",
  11487. 0x03c2,
  11488. "sigmalunatesymbolgreek",
  11489. 0x03f2,
  11490. "sihiragana",
  11491. 0x3057,
  11492. "sikatakana",
  11493. 0x30b7,
  11494. "sikatakanahalfwidth",
  11495. 0xff7c,
  11496. "siluqhebrew",
  11497. 0x05bd,
  11498. "siluqlefthebrew",
  11499. 0x05bd,
  11500. "similar",
  11501. 0x223c,
  11502. "sindothebrew",
  11503. 0x05c2,
  11504. "siosacirclekorean",
  11505. 0x3274,
  11506. "siosaparenkorean",
  11507. 0x3214,
  11508. "sioscieuckorean",
  11509. 0x317e,
  11510. "sioscirclekorean",
  11511. 0x3266,
  11512. "sioskiyeokkorean",
  11513. 0x317a,
  11514. "sioskorean",
  11515. 0x3145,
  11516. "siosnieunkorean",
  11517. 0x317b,
  11518. "siosparenkorean",
  11519. 0x3206,
  11520. "siospieupkorean",
  11521. 0x317d,
  11522. "siostikeutkorean",
  11523. 0x317c,
  11524. "six",
  11525. 0x0036,
  11526. "sixarabic",
  11527. 0x0666,
  11528. "sixbengali",
  11529. 0x09ec,
  11530. "sixcircle",
  11531. 0x2465,
  11532. "sixcircleinversesansserif",
  11533. 0x278f,
  11534. "sixdeva",
  11535. 0x096c,
  11536. "sixgujarati",
  11537. 0x0aec,
  11538. "sixgurmukhi",
  11539. 0x0a6c,
  11540. "sixhackarabic",
  11541. 0x0666,
  11542. "sixhangzhou",
  11543. 0x3026,
  11544. "sixideographicparen",
  11545. 0x3225,
  11546. "sixinferior",
  11547. 0x2086,
  11548. "sixmonospace",
  11549. 0xff16,
  11550. "sixoldstyle",
  11551. 0xf736,
  11552. "sixparen",
  11553. 0x2479,
  11554. "sixperiod",
  11555. 0x248d,
  11556. "sixpersian",
  11557. 0x06f6,
  11558. "sixroman",
  11559. 0x2175,
  11560. "sixsuperior",
  11561. 0x2076,
  11562. "sixteencircle",
  11563. 0x246f,
  11564. "sixteencurrencydenominatorbengali",
  11565. 0x09f9,
  11566. "sixteenparen",
  11567. 0x2483,
  11568. "sixteenperiod",
  11569. 0x2497,
  11570. "sixthai",
  11571. 0x0e56,
  11572. "slash",
  11573. 0x002f,
  11574. "slashmonospace",
  11575. 0xff0f,
  11576. "slong",
  11577. 0x017f,
  11578. "slongdotaccent",
  11579. 0x1e9b,
  11580. "smileface",
  11581. 0x263a,
  11582. "smonospace",
  11583. 0xff53,
  11584. "sofpasuqhebrew",
  11585. 0x05c3,
  11586. "softhyphen",
  11587. 0x00ad,
  11588. "softsigncyrillic",
  11589. 0x044c,
  11590. "sohiragana",
  11591. 0x305d,
  11592. "sokatakana",
  11593. 0x30bd,
  11594. "sokatakanahalfwidth",
  11595. 0xff7f,
  11596. "soliduslongoverlaycmb",
  11597. 0x0338,
  11598. "solidusshortoverlaycmb",
  11599. 0x0337,
  11600. "sorusithai",
  11601. 0x0e29,
  11602. "sosalathai",
  11603. 0x0e28,
  11604. "sosothai",
  11605. 0x0e0b,
  11606. "sosuathai",
  11607. 0x0e2a,
  11608. "space",
  11609. 0x0020,
  11610. "spacehackarabic",
  11611. 0x0020,
  11612. "spade",
  11613. 0x2660,
  11614. "spadesuitblack",
  11615. 0x2660,
  11616. "spadesuitwhite",
  11617. 0x2664,
  11618. "sparen",
  11619. 0x24ae,
  11620. "squarebelowcmb",
  11621. 0x033b,
  11622. "squarecc",
  11623. 0x33c4,
  11624. "squarecm",
  11625. 0x339d,
  11626. "squarediagonalcrosshatchfill",
  11627. 0x25a9,
  11628. "squarehorizontalfill",
  11629. 0x25a4,
  11630. "squarekg",
  11631. 0x338f,
  11632. "squarekm",
  11633. 0x339e,
  11634. "squarekmcapital",
  11635. 0x33ce,
  11636. "squareln",
  11637. 0x33d1,
  11638. "squarelog",
  11639. 0x33d2,
  11640. "squaremg",
  11641. 0x338e,
  11642. "squaremil",
  11643. 0x33d5,
  11644. "squaremm",
  11645. 0x339c,
  11646. "squaremsquared",
  11647. 0x33a1,
  11648. "squareorthogonalcrosshatchfill",
  11649. 0x25a6,
  11650. "squareupperlefttolowerrightfill",
  11651. 0x25a7,
  11652. "squareupperrighttolowerleftfill",
  11653. 0x25a8,
  11654. "squareverticalfill",
  11655. 0x25a5,
  11656. "squarewhitewithsmallblack",
  11657. 0x25a3,
  11658. "srsquare",
  11659. 0x33db,
  11660. "ssabengali",
  11661. 0x09b7,
  11662. "ssadeva",
  11663. 0x0937,
  11664. "ssagujarati",
  11665. 0x0ab7,
  11666. "ssangcieuckorean",
  11667. 0x3149,
  11668. "ssanghieuhkorean",
  11669. 0x3185,
  11670. "ssangieungkorean",
  11671. 0x3180,
  11672. "ssangkiyeokkorean",
  11673. 0x3132,
  11674. "ssangnieunkorean",
  11675. 0x3165,
  11676. "ssangpieupkorean",
  11677. 0x3143,
  11678. "ssangsioskorean",
  11679. 0x3146,
  11680. "ssangtikeutkorean",
  11681. 0x3138,
  11682. "ssuperior",
  11683. 0xf6f2,
  11684. "sterling",
  11685. 0x00a3,
  11686. "sterlingmonospace",
  11687. 0xffe1,
  11688. "strokelongoverlaycmb",
  11689. 0x0336,
  11690. "strokeshortoverlaycmb",
  11691. 0x0335,
  11692. "subset",
  11693. 0x2282,
  11694. "subsetnotequal",
  11695. 0x228a,
  11696. "subsetorequal",
  11697. 0x2286,
  11698. "succeeds",
  11699. 0x227b,
  11700. "suchthat",
  11701. 0x220b,
  11702. "suhiragana",
  11703. 0x3059,
  11704. "sukatakana",
  11705. 0x30b9,
  11706. "sukatakanahalfwidth",
  11707. 0xff7d,
  11708. "sukunarabic",
  11709. 0x0652,
  11710. "summation",
  11711. 0x2211,
  11712. "sun",
  11713. 0x263c,
  11714. "superset",
  11715. 0x2283,
  11716. "supersetnotequal",
  11717. 0x228b,
  11718. "supersetorequal",
  11719. 0x2287,
  11720. "svsquare",
  11721. 0x33dc,
  11722. "syouwaerasquare",
  11723. 0x337c,
  11724. "t",
  11725. 0x0074,
  11726. "tabengali",
  11727. 0x09a4,
  11728. "tackdown",
  11729. 0x22a4,
  11730. "tackleft",
  11731. 0x22a3,
  11732. "tadeva",
  11733. 0x0924,
  11734. "tagujarati",
  11735. 0x0aa4,
  11736. "tagurmukhi",
  11737. 0x0a24,
  11738. "taharabic",
  11739. 0x0637,
  11740. "tahfinalarabic",
  11741. 0xfec2,
  11742. "tahinitialarabic",
  11743. 0xfec3,
  11744. "tahiragana",
  11745. 0x305f,
  11746. "tahmedialarabic",
  11747. 0xfec4,
  11748. "taisyouerasquare",
  11749. 0x337d,
  11750. "takatakana",
  11751. 0x30bf,
  11752. "takatakanahalfwidth",
  11753. 0xff80,
  11754. "tatweelarabic",
  11755. 0x0640,
  11756. "tau",
  11757. 0x03c4,
  11758. "tav",
  11759. 0x05ea,
  11760. "tavdages",
  11761. 0xfb4a,
  11762. "tavdagesh",
  11763. 0xfb4a,
  11764. "tavdageshhebrew",
  11765. 0xfb4a,
  11766. "tavhebrew",
  11767. 0x05ea,
  11768. "tbar",
  11769. 0x0167,
  11770. "tbopomofo",
  11771. 0x310a,
  11772. "tcaron",
  11773. 0x0165,
  11774. "tccurl",
  11775. 0x02a8,
  11776. "tcedilla",
  11777. 0x0163,
  11778. "tcheharabic",
  11779. 0x0686,
  11780. "tchehfinalarabic",
  11781. 0xfb7b,
  11782. "tchehinitialarabic",
  11783. 0xfb7c,
  11784. "tchehmedialarabic",
  11785. 0xfb7d,
  11786. "tcircle",
  11787. 0x24e3,
  11788. "tcircumflexbelow",
  11789. 0x1e71,
  11790. "tcommaaccent",
  11791. 0x0163,
  11792. "tdieresis",
  11793. 0x1e97,
  11794. "tdotaccent",
  11795. 0x1e6b,
  11796. "tdotbelow",
  11797. 0x1e6d,
  11798. "tecyrillic",
  11799. 0x0442,
  11800. "tedescendercyrillic",
  11801. 0x04ad,
  11802. "teharabic",
  11803. 0x062a,
  11804. "tehfinalarabic",
  11805. 0xfe96,
  11806. "tehhahinitialarabic",
  11807. 0xfca2,
  11808. "tehhahisolatedarabic",
  11809. 0xfc0c,
  11810. "tehinitialarabic",
  11811. 0xfe97,
  11812. "tehiragana",
  11813. 0x3066,
  11814. "tehjeeminitialarabic",
  11815. 0xfca1,
  11816. "tehjeemisolatedarabic",
  11817. 0xfc0b,
  11818. "tehmarbutaarabic",
  11819. 0x0629,
  11820. "tehmarbutafinalarabic",
  11821. 0xfe94,
  11822. "tehmedialarabic",
  11823. 0xfe98,
  11824. "tehmeeminitialarabic",
  11825. 0xfca4,
  11826. "tehmeemisolatedarabic",
  11827. 0xfc0e,
  11828. "tehnoonfinalarabic",
  11829. 0xfc73,
  11830. "tekatakana",
  11831. 0x30c6,
  11832. "tekatakanahalfwidth",
  11833. 0xff83,
  11834. "telephone",
  11835. 0x2121,
  11836. "telephoneblack",
  11837. 0x260e,
  11838. "telishagedolahebrew",
  11839. 0x05a0,
  11840. "telishaqetanahebrew",
  11841. 0x05a9,
  11842. "tencircle",
  11843. 0x2469,
  11844. "tenideographicparen",
  11845. 0x3229,
  11846. "tenparen",
  11847. 0x247d,
  11848. "tenperiod",
  11849. 0x2491,
  11850. "tenroman",
  11851. 0x2179,
  11852. "tesh",
  11853. 0x02a7,
  11854. "tet",
  11855. 0x05d8,
  11856. "tetdagesh",
  11857. 0xfb38,
  11858. "tetdageshhebrew",
  11859. 0xfb38,
  11860. "tethebrew",
  11861. 0x05d8,
  11862. "tetsecyrillic",
  11863. 0x04b5,
  11864. "tevirhebrew",
  11865. 0x059b,
  11866. "tevirlefthebrew",
  11867. 0x059b,
  11868. "thabengali",
  11869. 0x09a5,
  11870. "thadeva",
  11871. 0x0925,
  11872. "thagujarati",
  11873. 0x0aa5,
  11874. "thagurmukhi",
  11875. 0x0a25,
  11876. "thalarabic",
  11877. 0x0630,
  11878. "thalfinalarabic",
  11879. 0xfeac,
  11880. "thanthakhatlowleftthai",
  11881. 0xf898,
  11882. "thanthakhatlowrightthai",
  11883. 0xf897,
  11884. "thanthakhatthai",
  11885. 0x0e4c,
  11886. "thanthakhatupperleftthai",
  11887. 0xf896,
  11888. "theharabic",
  11889. 0x062b,
  11890. "thehfinalarabic",
  11891. 0xfe9a,
  11892. "thehinitialarabic",
  11893. 0xfe9b,
  11894. "thehmedialarabic",
  11895. 0xfe9c,
  11896. "thereexists",
  11897. 0x2203,
  11898. "therefore",
  11899. 0x2234,
  11900. "theta",
  11901. 0x03b8,
  11902. "theta1",
  11903. 0x03d1,
  11904. "thetasymbolgreek",
  11905. 0x03d1,
  11906. "thieuthacirclekorean",
  11907. 0x3279,
  11908. "thieuthaparenkorean",
  11909. 0x3219,
  11910. "thieuthcirclekorean",
  11911. 0x326b,
  11912. "thieuthkorean",
  11913. 0x314c,
  11914. "thieuthparenkorean",
  11915. 0x320b,
  11916. "thirteencircle",
  11917. 0x246c,
  11918. "thirteenparen",
  11919. 0x2480,
  11920. "thirteenperiod",
  11921. 0x2494,
  11922. "thonangmonthothai",
  11923. 0x0e11,
  11924. "thook",
  11925. 0x01ad,
  11926. "thophuthaothai",
  11927. 0x0e12,
  11928. "thorn",
  11929. 0x00fe,
  11930. "thothahanthai",
  11931. 0x0e17,
  11932. "thothanthai",
  11933. 0x0e10,
  11934. "thothongthai",
  11935. 0x0e18,
  11936. "thothungthai",
  11937. 0x0e16,
  11938. "thousandcyrillic",
  11939. 0x0482,
  11940. "thousandsseparatorarabic",
  11941. 0x066c,
  11942. "thousandsseparatorpersian",
  11943. 0x066c,
  11944. "three",
  11945. 0x0033,
  11946. "threearabic",
  11947. 0x0663,
  11948. "threebengali",
  11949. 0x09e9,
  11950. "threecircle",
  11951. 0x2462,
  11952. "threecircleinversesansserif",
  11953. 0x278c,
  11954. "threedeva",
  11955. 0x0969,
  11956. "threeeighths",
  11957. 0x215c,
  11958. "threegujarati",
  11959. 0x0ae9,
  11960. "threegurmukhi",
  11961. 0x0a69,
  11962. "threehackarabic",
  11963. 0x0663,
  11964. "threehangzhou",
  11965. 0x3023,
  11966. "threeideographicparen",
  11967. 0x3222,
  11968. "threeinferior",
  11969. 0x2083,
  11970. "threemonospace",
  11971. 0xff13,
  11972. "threenumeratorbengali",
  11973. 0x09f6,
  11974. "threeoldstyle",
  11975. 0xf733,
  11976. "threeparen",
  11977. 0x2476,
  11978. "threeperiod",
  11979. 0x248a,
  11980. "threepersian",
  11981. 0x06f3,
  11982. "threequarters",
  11983. 0x00be,
  11984. "threequartersemdash",
  11985. 0xf6de,
  11986. "threeroman",
  11987. 0x2172,
  11988. "threesuperior",
  11989. 0x00b3,
  11990. "threethai",
  11991. 0x0e53,
  11992. "thzsquare",
  11993. 0x3394,
  11994. "tihiragana",
  11995. 0x3061,
  11996. "tikatakana",
  11997. 0x30c1,
  11998. "tikatakanahalfwidth",
  11999. 0xff81,
  12000. "tikeutacirclekorean",
  12001. 0x3270,
  12002. "tikeutaparenkorean",
  12003. 0x3210,
  12004. "tikeutcirclekorean",
  12005. 0x3262,
  12006. "tikeutkorean",
  12007. 0x3137,
  12008. "tikeutparenkorean",
  12009. 0x3202,
  12010. "tilde",
  12011. 0x02dc,
  12012. "tildebelowcmb",
  12013. 0x0330,
  12014. "tildecmb",
  12015. 0x0303,
  12016. "tildecomb",
  12017. 0x0303,
  12018. "tildedoublecmb",
  12019. 0x0360,
  12020. "tildeoperator",
  12021. 0x223c,
  12022. "tildeoverlaycmb",
  12023. 0x0334,
  12024. "tildeverticalcmb",
  12025. 0x033e,
  12026. "timescircle",
  12027. 0x2297,
  12028. "tipehahebrew",
  12029. 0x0596,
  12030. "tipehalefthebrew",
  12031. 0x0596,
  12032. "tippigurmukhi",
  12033. 0x0a70,
  12034. "titlocyrilliccmb",
  12035. 0x0483,
  12036. "tiwnarmenian",
  12037. 0x057f,
  12038. "tlinebelow",
  12039. 0x1e6f,
  12040. "tmonospace",
  12041. 0xff54,
  12042. "toarmenian",
  12043. 0x0569,
  12044. "tohiragana",
  12045. 0x3068,
  12046. "tokatakana",
  12047. 0x30c8,
  12048. "tokatakanahalfwidth",
  12049. 0xff84,
  12050. "tonebarextrahighmod",
  12051. 0x02e5,
  12052. "tonebarextralowmod",
  12053. 0x02e9,
  12054. "tonebarhighmod",
  12055. 0x02e6,
  12056. "tonebarlowmod",
  12057. 0x02e8,
  12058. "tonebarmidmod",
  12059. 0x02e7,
  12060. "tonefive",
  12061. 0x01bd,
  12062. "tonesix",
  12063. 0x0185,
  12064. "tonetwo",
  12065. 0x01a8,
  12066. "tonos",
  12067. 0x0384,
  12068. "tonsquare",
  12069. 0x3327,
  12070. "topatakthai",
  12071. 0x0e0f,
  12072. "tortoiseshellbracketleft",
  12073. 0x3014,
  12074. "tortoiseshellbracketleftsmall",
  12075. 0xfe5d,
  12076. "tortoiseshellbracketleftvertical",
  12077. 0xfe39,
  12078. "tortoiseshellbracketright",
  12079. 0x3015,
  12080. "tortoiseshellbracketrightsmall",
  12081. 0xfe5e,
  12082. "tortoiseshellbracketrightvertical",
  12083. 0xfe3a,
  12084. "totaothai",
  12085. 0x0e15,
  12086. "tpalatalhook",
  12087. 0x01ab,
  12088. "tparen",
  12089. 0x24af,
  12090. "trademark",
  12091. 0x2122,
  12092. "trademarksans",
  12093. 0xf8ea,
  12094. "trademarkserif",
  12095. 0xf6db,
  12096. "tretroflexhook",
  12097. 0x0288,
  12098. "triagdn",
  12099. 0x25bc,
  12100. "triaglf",
  12101. 0x25c4,
  12102. "triagrt",
  12103. 0x25ba,
  12104. "triagup",
  12105. 0x25b2,
  12106. "ts",
  12107. 0x02a6,
  12108. "tsadi",
  12109. 0x05e6,
  12110. "tsadidagesh",
  12111. 0xfb46,
  12112. "tsadidageshhebrew",
  12113. 0xfb46,
  12114. "tsadihebrew",
  12115. 0x05e6,
  12116. "tsecyrillic",
  12117. 0x0446,
  12118. "tsere",
  12119. 0x05b5,
  12120. "tsere12",
  12121. 0x05b5,
  12122. "tsere1e",
  12123. 0x05b5,
  12124. "tsere2b",
  12125. 0x05b5,
  12126. "tserehebrew",
  12127. 0x05b5,
  12128. "tserenarrowhebrew",
  12129. 0x05b5,
  12130. "tserequarterhebrew",
  12131. 0x05b5,
  12132. "tserewidehebrew",
  12133. 0x05b5,
  12134. "tshecyrillic",
  12135. 0x045b,
  12136. "tsuperior",
  12137. 0xf6f3,
  12138. "ttabengali",
  12139. 0x099f,
  12140. "ttadeva",
  12141. 0x091f,
  12142. "ttagujarati",
  12143. 0x0a9f,
  12144. "ttagurmukhi",
  12145. 0x0a1f,
  12146. "tteharabic",
  12147. 0x0679,
  12148. "ttehfinalarabic",
  12149. 0xfb67,
  12150. "ttehinitialarabic",
  12151. 0xfb68,
  12152. "ttehmedialarabic",
  12153. 0xfb69,
  12154. "tthabengali",
  12155. 0x09a0,
  12156. "tthadeva",
  12157. 0x0920,
  12158. "tthagujarati",
  12159. 0x0aa0,
  12160. "tthagurmukhi",
  12161. 0x0a20,
  12162. "tturned",
  12163. 0x0287,
  12164. "tuhiragana",
  12165. 0x3064,
  12166. "tukatakana",
  12167. 0x30c4,
  12168. "tukatakanahalfwidth",
  12169. 0xff82,
  12170. "tusmallhiragana",
  12171. 0x3063,
  12172. "tusmallkatakana",
  12173. 0x30c3,
  12174. "tusmallkatakanahalfwidth",
  12175. 0xff6f,
  12176. "twelvecircle",
  12177. 0x246b,
  12178. "twelveparen",
  12179. 0x247f,
  12180. "twelveperiod",
  12181. 0x2493,
  12182. "twelveroman",
  12183. 0x217b,
  12184. "twentycircle",
  12185. 0x2473,
  12186. "twentyhangzhou",
  12187. 0x5344,
  12188. "twentyparen",
  12189. 0x2487,
  12190. "twentyperiod",
  12191. 0x249b,
  12192. "two",
  12193. 0x0032,
  12194. "twoarabic",
  12195. 0x0662,
  12196. "twobengali",
  12197. 0x09e8,
  12198. "twocircle",
  12199. 0x2461,
  12200. "twocircleinversesansserif",
  12201. 0x278b,
  12202. "twodeva",
  12203. 0x0968,
  12204. "twodotenleader",
  12205. 0x2025,
  12206. "twodotleader",
  12207. 0x2025,
  12208. "twodotleadervertical",
  12209. 0xfe30,
  12210. "twogujarati",
  12211. 0x0ae8,
  12212. "twogurmukhi",
  12213. 0x0a68,
  12214. "twohackarabic",
  12215. 0x0662,
  12216. "twohangzhou",
  12217. 0x3022,
  12218. "twoideographicparen",
  12219. 0x3221,
  12220. "twoinferior",
  12221. 0x2082,
  12222. "twomonospace",
  12223. 0xff12,
  12224. "twonumeratorbengali",
  12225. 0x09f5,
  12226. "twooldstyle",
  12227. 0xf732,
  12228. "twoparen",
  12229. 0x2475,
  12230. "twoperiod",
  12231. 0x2489,
  12232. "twopersian",
  12233. 0x06f2,
  12234. "tworoman",
  12235. 0x2171,
  12236. "twostroke",
  12237. 0x01bb,
  12238. "twosuperior",
  12239. 0x00b2,
  12240. "twothai",
  12241. 0x0e52,
  12242. "twothirds",
  12243. 0x2154,
  12244. "u",
  12245. 0x0075,
  12246. "uacute",
  12247. 0x00fa,
  12248. "ubar",
  12249. 0x0289,
  12250. "ubengali",
  12251. 0x0989,
  12252. "ubopomofo",
  12253. 0x3128,
  12254. "ubreve",
  12255. 0x016d,
  12256. "ucaron",
  12257. 0x01d4,
  12258. "ucircle",
  12259. 0x24e4,
  12260. "ucircumflex",
  12261. 0x00fb,
  12262. "ucircumflexbelow",
  12263. 0x1e77,
  12264. "ucyrillic",
  12265. 0x0443,
  12266. "udattadeva",
  12267. 0x0951,
  12268. "udblacute",
  12269. 0x0171,
  12270. "udblgrave",
  12271. 0x0215,
  12272. "udeva",
  12273. 0x0909,
  12274. "udieresis",
  12275. 0x00fc,
  12276. "udieresisacute",
  12277. 0x01d8,
  12278. "udieresisbelow",
  12279. 0x1e73,
  12280. "udieresiscaron",
  12281. 0x01da,
  12282. "udieresiscyrillic",
  12283. 0x04f1,
  12284. "udieresisgrave",
  12285. 0x01dc,
  12286. "udieresismacron",
  12287. 0x01d6,
  12288. "udotbelow",
  12289. 0x1ee5,
  12290. "ugrave",
  12291. 0x00f9,
  12292. "ugujarati",
  12293. 0x0a89,
  12294. "ugurmukhi",
  12295. 0x0a09,
  12296. "uhiragana",
  12297. 0x3046,
  12298. "uhookabove",
  12299. 0x1ee7,
  12300. "uhorn",
  12301. 0x01b0,
  12302. "uhornacute",
  12303. 0x1ee9,
  12304. "uhorndotbelow",
  12305. 0x1ef1,
  12306. "uhorngrave",
  12307. 0x1eeb,
  12308. "uhornhookabove",
  12309. 0x1eed,
  12310. "uhorntilde",
  12311. 0x1eef,
  12312. "uhungarumlaut",
  12313. 0x0171,
  12314. "uhungarumlautcyrillic",
  12315. 0x04f3,
  12316. "uinvertedbreve",
  12317. 0x0217,
  12318. "ukatakana",
  12319. 0x30a6,
  12320. "ukatakanahalfwidth",
  12321. 0xff73,
  12322. "ukcyrillic",
  12323. 0x0479,
  12324. "ukorean",
  12325. 0x315c,
  12326. "umacron",
  12327. 0x016b,
  12328. "umacroncyrillic",
  12329. 0x04ef,
  12330. "umacrondieresis",
  12331. 0x1e7b,
  12332. "umatragurmukhi",
  12333. 0x0a41,
  12334. "umonospace",
  12335. 0xff55,
  12336. "underscore",
  12337. 0x005f,
  12338. "underscoredbl",
  12339. 0x2017,
  12340. "underscoremonospace",
  12341. 0xff3f,
  12342. "underscorevertical",
  12343. 0xfe33,
  12344. "underscorewavy",
  12345. 0xfe4f,
  12346. "union",
  12347. 0x222a,
  12348. "universal",
  12349. 0x2200,
  12350. "uogonek",
  12351. 0x0173,
  12352. "uparen",
  12353. 0x24b0,
  12354. "upblock",
  12355. 0x2580,
  12356. "upperdothebrew",
  12357. 0x05c4,
  12358. "upsilon",
  12359. 0x03c5,
  12360. "upsilondieresis",
  12361. 0x03cb,
  12362. "upsilondieresistonos",
  12363. 0x03b0,
  12364. "upsilonlatin",
  12365. 0x028a,
  12366. "upsilontonos",
  12367. 0x03cd,
  12368. "uptackbelowcmb",
  12369. 0x031d,
  12370. "uptackmod",
  12371. 0x02d4,
  12372. "uragurmukhi",
  12373. 0x0a73,
  12374. "uring",
  12375. 0x016f,
  12376. "ushortcyrillic",
  12377. 0x045e,
  12378. "usmallhiragana",
  12379. 0x3045,
  12380. "usmallkatakana",
  12381. 0x30a5,
  12382. "usmallkatakanahalfwidth",
  12383. 0xff69,
  12384. "ustraightcyrillic",
  12385. 0x04af,
  12386. "ustraightstrokecyrillic",
  12387. 0x04b1,
  12388. "utilde",
  12389. 0x0169,
  12390. "utildeacute",
  12391. 0x1e79,
  12392. "utildebelow",
  12393. 0x1e75,
  12394. "uubengali",
  12395. 0x098a,
  12396. "uudeva",
  12397. 0x090a,
  12398. "uugujarati",
  12399. 0x0a8a,
  12400. "uugurmukhi",
  12401. 0x0a0a,
  12402. "uumatragurmukhi",
  12403. 0x0a42,
  12404. "uuvowelsignbengali",
  12405. 0x09c2,
  12406. "uuvowelsigndeva",
  12407. 0x0942,
  12408. "uuvowelsigngujarati",
  12409. 0x0ac2,
  12410. "uvowelsignbengali",
  12411. 0x09c1,
  12412. "uvowelsigndeva",
  12413. 0x0941,
  12414. "uvowelsigngujarati",
  12415. 0x0ac1,
  12416. "v",
  12417. 0x0076,
  12418. "vadeva",
  12419. 0x0935,
  12420. "vagujarati",
  12421. 0x0ab5,
  12422. "vagurmukhi",
  12423. 0x0a35,
  12424. "vakatakana",
  12425. 0x30f7,
  12426. "vav",
  12427. 0x05d5,
  12428. "vavdagesh",
  12429. 0xfb35,
  12430. "vavdagesh65",
  12431. 0xfb35,
  12432. "vavdageshhebrew",
  12433. 0xfb35,
  12434. "vavhebrew",
  12435. 0x05d5,
  12436. "vavholam",
  12437. 0xfb4b,
  12438. "vavholamhebrew",
  12439. 0xfb4b,
  12440. "vavvavhebrew",
  12441. 0x05f0,
  12442. "vavyodhebrew",
  12443. 0x05f1,
  12444. "vcircle",
  12445. 0x24e5,
  12446. "vdotbelow",
  12447. 0x1e7f,
  12448. "vecyrillic",
  12449. 0x0432,
  12450. "veharabic",
  12451. 0x06a4,
  12452. "vehfinalarabic",
  12453. 0xfb6b,
  12454. "vehinitialarabic",
  12455. 0xfb6c,
  12456. "vehmedialarabic",
  12457. 0xfb6d,
  12458. "vekatakana",
  12459. 0x30f9,
  12460. "venus",
  12461. 0x2640,
  12462. "verticalbar",
  12463. 0x007c,
  12464. "verticallineabovecmb",
  12465. 0x030d,
  12466. "verticallinebelowcmb",
  12467. 0x0329,
  12468. "verticallinelowmod",
  12469. 0x02cc,
  12470. "verticallinemod",
  12471. 0x02c8,
  12472. "vewarmenian",
  12473. 0x057e,
  12474. "vhook",
  12475. 0x028b,
  12476. "vikatakana",
  12477. 0x30f8,
  12478. "viramabengali",
  12479. 0x09cd,
  12480. "viramadeva",
  12481. 0x094d,
  12482. "viramagujarati",
  12483. 0x0acd,
  12484. "visargabengali",
  12485. 0x0983,
  12486. "visargadeva",
  12487. 0x0903,
  12488. "visargagujarati",
  12489. 0x0a83,
  12490. "vmonospace",
  12491. 0xff56,
  12492. "voarmenian",
  12493. 0x0578,
  12494. "voicediterationhiragana",
  12495. 0x309e,
  12496. "voicediterationkatakana",
  12497. 0x30fe,
  12498. "voicedmarkkana",
  12499. 0x309b,
  12500. "voicedmarkkanahalfwidth",
  12501. 0xff9e,
  12502. "vokatakana",
  12503. 0x30fa,
  12504. "vparen",
  12505. 0x24b1,
  12506. "vtilde",
  12507. 0x1e7d,
  12508. "vturned",
  12509. 0x028c,
  12510. "vuhiragana",
  12511. 0x3094,
  12512. "vukatakana",
  12513. 0x30f4,
  12514. "w",
  12515. 0x0077,
  12516. "wacute",
  12517. 0x1e83,
  12518. "waekorean",
  12519. 0x3159,
  12520. "wahiragana",
  12521. 0x308f,
  12522. "wakatakana",
  12523. 0x30ef,
  12524. "wakatakanahalfwidth",
  12525. 0xff9c,
  12526. "wakorean",
  12527. 0x3158,
  12528. "wasmallhiragana",
  12529. 0x308e,
  12530. "wasmallkatakana",
  12531. 0x30ee,
  12532. "wattosquare",
  12533. 0x3357,
  12534. "wavedash",
  12535. 0x301c,
  12536. "wavyunderscorevertical",
  12537. 0xfe34,
  12538. "wawarabic",
  12539. 0x0648,
  12540. "wawfinalarabic",
  12541. 0xfeee,
  12542. "wawhamzaabovearabic",
  12543. 0x0624,
  12544. "wawhamzaabovefinalarabic",
  12545. 0xfe86,
  12546. "wbsquare",
  12547. 0x33dd,
  12548. "wcircle",
  12549. 0x24e6,
  12550. "wcircumflex",
  12551. 0x0175,
  12552. "wdieresis",
  12553. 0x1e85,
  12554. "wdotaccent",
  12555. 0x1e87,
  12556. "wdotbelow",
  12557. 0x1e89,
  12558. "wehiragana",
  12559. 0x3091,
  12560. "weierstrass",
  12561. 0x2118,
  12562. "wekatakana",
  12563. 0x30f1,
  12564. "wekorean",
  12565. 0x315e,
  12566. "weokorean",
  12567. 0x315d,
  12568. "wgrave",
  12569. 0x1e81,
  12570. "whitebullet",
  12571. 0x25e6,
  12572. "whitecircle",
  12573. 0x25cb,
  12574. "whitecircleinverse",
  12575. 0x25d9,
  12576. "whitecornerbracketleft",
  12577. 0x300e,
  12578. "whitecornerbracketleftvertical",
  12579. 0xfe43,
  12580. "whitecornerbracketright",
  12581. 0x300f,
  12582. "whitecornerbracketrightvertical",
  12583. 0xfe44,
  12584. "whitediamond",
  12585. 0x25c7,
  12586. "whitediamondcontainingblacksmalldiamond",
  12587. 0x25c8,
  12588. "whitedownpointingsmalltriangle",
  12589. 0x25bf,
  12590. "whitedownpointingtriangle",
  12591. 0x25bd,
  12592. "whiteleftpointingsmalltriangle",
  12593. 0x25c3,
  12594. "whiteleftpointingtriangle",
  12595. 0x25c1,
  12596. "whitelenticularbracketleft",
  12597. 0x3016,
  12598. "whitelenticularbracketright",
  12599. 0x3017,
  12600. "whiterightpointingsmalltriangle",
  12601. 0x25b9,
  12602. "whiterightpointingtriangle",
  12603. 0x25b7,
  12604. "whitesmallsquare",
  12605. 0x25ab,
  12606. "whitesmilingface",
  12607. 0x263a,
  12608. "whitesquare",
  12609. 0x25a1,
  12610. "whitestar",
  12611. 0x2606,
  12612. "whitetelephone",
  12613. 0x260f,
  12614. "whitetortoiseshellbracketleft",
  12615. 0x3018,
  12616. "whitetortoiseshellbracketright",
  12617. 0x3019,
  12618. "whiteuppointingsmalltriangle",
  12619. 0x25b5,
  12620. "whiteuppointingtriangle",
  12621. 0x25b3,
  12622. "wihiragana",
  12623. 0x3090,
  12624. "wikatakana",
  12625. 0x30f0,
  12626. "wikorean",
  12627. 0x315f,
  12628. "wmonospace",
  12629. 0xff57,
  12630. "wohiragana",
  12631. 0x3092,
  12632. "wokatakana",
  12633. 0x30f2,
  12634. "wokatakanahalfwidth",
  12635. 0xff66,
  12636. "won",
  12637. 0x20a9,
  12638. "wonmonospace",
  12639. 0xffe6,
  12640. "wowaenthai",
  12641. 0x0e27,
  12642. "wparen",
  12643. 0x24b2,
  12644. "wring",
  12645. 0x1e98,
  12646. "wsuperior",
  12647. 0x02b7,
  12648. "wturned",
  12649. 0x028d,
  12650. "wynn",
  12651. 0x01bf,
  12652. "x",
  12653. 0x0078,
  12654. "xabovecmb",
  12655. 0x033d,
  12656. "xbopomofo",
  12657. 0x3112,
  12658. "xcircle",
  12659. 0x24e7,
  12660. "xdieresis",
  12661. 0x1e8d,
  12662. "xdotaccent",
  12663. 0x1e8b,
  12664. "xeharmenian",
  12665. 0x056d,
  12666. "xi",
  12667. 0x03be,
  12668. "xmonospace",
  12669. 0xff58,
  12670. "xparen",
  12671. 0x24b3,
  12672. "xsuperior",
  12673. 0x02e3,
  12674. "y",
  12675. 0x0079,
  12676. "yaadosquare",
  12677. 0x334e,
  12678. "yabengali",
  12679. 0x09af,
  12680. "yacute",
  12681. 0x00fd,
  12682. "yadeva",
  12683. 0x092f,
  12684. "yaekorean",
  12685. 0x3152,
  12686. "yagujarati",
  12687. 0x0aaf,
  12688. "yagurmukhi",
  12689. 0x0a2f,
  12690. "yahiragana",
  12691. 0x3084,
  12692. "yakatakana",
  12693. 0x30e4,
  12694. "yakatakanahalfwidth",
  12695. 0xff94,
  12696. "yakorean",
  12697. 0x3151,
  12698. "yamakkanthai",
  12699. 0x0e4e,
  12700. "yasmallhiragana",
  12701. 0x3083,
  12702. "yasmallkatakana",
  12703. 0x30e3,
  12704. "yasmallkatakanahalfwidth",
  12705. 0xff6c,
  12706. "yatcyrillic",
  12707. 0x0463,
  12708. "ycircle",
  12709. 0x24e8,
  12710. "ycircumflex",
  12711. 0x0177,
  12712. "ydieresis",
  12713. 0x00ff,
  12714. "ydotaccent",
  12715. 0x1e8f,
  12716. "ydotbelow",
  12717. 0x1ef5,
  12718. "yeharabic",
  12719. 0x064a,
  12720. "yehbarreearabic",
  12721. 0x06d2,
  12722. "yehbarreefinalarabic",
  12723. 0xfbaf,
  12724. "yehfinalarabic",
  12725. 0xfef2,
  12726. "yehhamzaabovearabic",
  12727. 0x0626,
  12728. "yehhamzaabovefinalarabic",
  12729. 0xfe8a,
  12730. "yehhamzaaboveinitialarabic",
  12731. 0xfe8b,
  12732. "yehhamzaabovemedialarabic",
  12733. 0xfe8c,
  12734. "yehinitialarabic",
  12735. 0xfef3,
  12736. "yehmedialarabic",
  12737. 0xfef4,
  12738. "yehmeeminitialarabic",
  12739. 0xfcdd,
  12740. "yehmeemisolatedarabic",
  12741. 0xfc58,
  12742. "yehnoonfinalarabic",
  12743. 0xfc94,
  12744. "yehthreedotsbelowarabic",
  12745. 0x06d1,
  12746. "yekorean",
  12747. 0x3156,
  12748. "yen",
  12749. 0x00a5,
  12750. "yenmonospace",
  12751. 0xffe5,
  12752. "yeokorean",
  12753. 0x3155,
  12754. "yeorinhieuhkorean",
  12755. 0x3186,
  12756. "yerahbenyomohebrew",
  12757. 0x05aa,
  12758. "yerahbenyomolefthebrew",
  12759. 0x05aa,
  12760. "yericyrillic",
  12761. 0x044b,
  12762. "yerudieresiscyrillic",
  12763. 0x04f9,
  12764. "yesieungkorean",
  12765. 0x3181,
  12766. "yesieungpansioskorean",
  12767. 0x3183,
  12768. "yesieungsioskorean",
  12769. 0x3182,
  12770. "yetivhebrew",
  12771. 0x059a,
  12772. "ygrave",
  12773. 0x1ef3,
  12774. "yhook",
  12775. 0x01b4,
  12776. "yhookabove",
  12777. 0x1ef7,
  12778. "yiarmenian",
  12779. 0x0575,
  12780. "yicyrillic",
  12781. 0x0457,
  12782. "yikorean",
  12783. 0x3162,
  12784. "yinyang",
  12785. 0x262f,
  12786. "yiwnarmenian",
  12787. 0x0582,
  12788. "ymonospace",
  12789. 0xff59,
  12790. "yod",
  12791. 0x05d9,
  12792. "yoddagesh",
  12793. 0xfb39,
  12794. "yoddageshhebrew",
  12795. 0xfb39,
  12796. "yodhebrew",
  12797. 0x05d9,
  12798. "yodyodhebrew",
  12799. 0x05f2,
  12800. "yodyodpatahhebrew",
  12801. 0xfb1f,
  12802. "yohiragana",
  12803. 0x3088,
  12804. "yoikorean",
  12805. 0x3189,
  12806. "yokatakana",
  12807. 0x30e8,
  12808. "yokatakanahalfwidth",
  12809. 0xff96,
  12810. "yokorean",
  12811. 0x315b,
  12812. "yosmallhiragana",
  12813. 0x3087,
  12814. "yosmallkatakana",
  12815. 0x30e7,
  12816. "yosmallkatakanahalfwidth",
  12817. 0xff6e,
  12818. "yotgreek",
  12819. 0x03f3,
  12820. "yoyaekorean",
  12821. 0x3188,
  12822. "yoyakorean",
  12823. 0x3187,
  12824. "yoyakthai",
  12825. 0x0e22,
  12826. "yoyingthai",
  12827. 0x0e0d,
  12828. "yparen",
  12829. 0x24b4,
  12830. "ypogegrammeni",
  12831. 0x037a,
  12832. "ypogegrammenigreekcmb",
  12833. 0x0345,
  12834. "yr",
  12835. 0x01a6,
  12836. "yring",
  12837. 0x1e99,
  12838. "ysuperior",
  12839. 0x02b8,
  12840. "ytilde",
  12841. 0x1ef9,
  12842. "yturned",
  12843. 0x028e,
  12844. "yuhiragana",
  12845. 0x3086,
  12846. "yuikorean",
  12847. 0x318c,
  12848. "yukatakana",
  12849. 0x30e6,
  12850. "yukatakanahalfwidth",
  12851. 0xff95,
  12852. "yukorean",
  12853. 0x3160,
  12854. "yusbigcyrillic",
  12855. 0x046b,
  12856. "yusbigiotifiedcyrillic",
  12857. 0x046d,
  12858. "yuslittlecyrillic",
  12859. 0x0467,
  12860. "yuslittleiotifiedcyrillic",
  12861. 0x0469,
  12862. "yusmallhiragana",
  12863. 0x3085,
  12864. "yusmallkatakana",
  12865. 0x30e5,
  12866. "yusmallkatakanahalfwidth",
  12867. 0xff6d,
  12868. "yuyekorean",
  12869. 0x318b,
  12870. "yuyeokorean",
  12871. 0x318a,
  12872. "yyabengali",
  12873. 0x09df,
  12874. "yyadeva",
  12875. 0x095f,
  12876. "z",
  12877. 0x007a,
  12878. "zaarmenian",
  12879. 0x0566,
  12880. "zacute",
  12881. 0x017a,
  12882. "zadeva",
  12883. 0x095b,
  12884. "zagurmukhi",
  12885. 0x0a5b,
  12886. "zaharabic",
  12887. 0x0638,
  12888. "zahfinalarabic",
  12889. 0xfec6,
  12890. "zahinitialarabic",
  12891. 0xfec7,
  12892. "zahiragana",
  12893. 0x3056,
  12894. "zahmedialarabic",
  12895. 0xfec8,
  12896. "zainarabic",
  12897. 0x0632,
  12898. "zainfinalarabic",
  12899. 0xfeb0,
  12900. "zakatakana",
  12901. 0x30b6,
  12902. "zaqefgadolhebrew",
  12903. 0x0595,
  12904. "zaqefqatanhebrew",
  12905. 0x0594,
  12906. "zarqahebrew",
  12907. 0x0598,
  12908. "zayin",
  12909. 0x05d6,
  12910. "zayindagesh",
  12911. 0xfb36,
  12912. "zayindageshhebrew",
  12913. 0xfb36,
  12914. "zayinhebrew",
  12915. 0x05d6,
  12916. "zbopomofo",
  12917. 0x3117,
  12918. "zcaron",
  12919. 0x017e,
  12920. "zcircle",
  12921. 0x24e9,
  12922. "zcircumflex",
  12923. 0x1e91,
  12924. "zcurl",
  12925. 0x0291,
  12926. "zdot",
  12927. 0x017c,
  12928. "zdotaccent",
  12929. 0x017c,
  12930. "zdotbelow",
  12931. 0x1e93,
  12932. "zecyrillic",
  12933. 0x0437,
  12934. "zedescendercyrillic",
  12935. 0x0499,
  12936. "zedieresiscyrillic",
  12937. 0x04df,
  12938. "zehiragana",
  12939. 0x305c,
  12940. "zekatakana",
  12941. 0x30bc,
  12942. "zero",
  12943. 0x0030,
  12944. "zeroarabic",
  12945. 0x0660,
  12946. "zerobengali",
  12947. 0x09e6,
  12948. "zerodeva",
  12949. 0x0966,
  12950. "zerogujarati",
  12951. 0x0ae6,
  12952. "zerogurmukhi",
  12953. 0x0a66,
  12954. "zerohackarabic",
  12955. 0x0660,
  12956. "zeroinferior",
  12957. 0x2080,
  12958. "zeromonospace",
  12959. 0xff10,
  12960. "zerooldstyle",
  12961. 0xf730,
  12962. "zeropersian",
  12963. 0x06f0,
  12964. "zerosuperior",
  12965. 0x2070,
  12966. "zerothai",
  12967. 0x0e50,
  12968. "zerowidthjoiner",
  12969. 0xfeff,
  12970. "zerowidthnonjoiner",
  12971. 0x200c,
  12972. "zerowidthspace",
  12973. 0x200b,
  12974. "zeta",
  12975. 0x03b6,
  12976. "zhbopomofo",
  12977. 0x3113,
  12978. "zhearmenian",
  12979. 0x056a,
  12980. "zhebrevecyrillic",
  12981. 0x04c2,
  12982. "zhecyrillic",
  12983. 0x0436,
  12984. "zhedescendercyrillic",
  12985. 0x0497,
  12986. "zhedieresiscyrillic",
  12987. 0x04dd,
  12988. "zihiragana",
  12989. 0x3058,
  12990. "zikatakana",
  12991. 0x30b8,
  12992. "zinorhebrew",
  12993. 0x05ae,
  12994. "zlinebelow",
  12995. 0x1e95,
  12996. "zmonospace",
  12997. 0xff5a,
  12998. "zohiragana",
  12999. 0x305e,
  13000. "zokatakana",
  13001. 0x30be,
  13002. "zparen",
  13003. 0x24b5,
  13004. "zretroflexhook",
  13005. 0x0290,
  13006. "zstroke",
  13007. 0x01b6,
  13008. "zuhiragana",
  13009. 0x305a,
  13010. "zukatakana",
  13011. 0x30ba,
  13012. ".notdef",
  13013. 0x0000,
  13014. "angbracketleftbig",
  13015. 0x2329,
  13016. "angbracketleftBig",
  13017. 0x2329,
  13018. "angbracketleftbigg",
  13019. 0x2329,
  13020. "angbracketleftBigg",
  13021. 0x2329,
  13022. "angbracketrightBig",
  13023. 0x232a,
  13024. "angbracketrightbig",
  13025. 0x232a,
  13026. "angbracketrightBigg",
  13027. 0x232a,
  13028. "angbracketrightbigg",
  13029. 0x232a,
  13030. "arrowhookleft",
  13031. 0x21aa,
  13032. "arrowhookright",
  13033. 0x21a9,
  13034. "arrowlefttophalf",
  13035. 0x21bc,
  13036. "arrowleftbothalf",
  13037. 0x21bd,
  13038. "arrownortheast",
  13039. 0x2197,
  13040. "arrownorthwest",
  13041. 0x2196,
  13042. "arrowrighttophalf",
  13043. 0x21c0,
  13044. "arrowrightbothalf",
  13045. 0x21c1,
  13046. "arrowsoutheast",
  13047. 0x2198,
  13048. "arrowsouthwest",
  13049. 0x2199,
  13050. "backslashbig",
  13051. 0x2216,
  13052. "backslashBig",
  13053. 0x2216,
  13054. "backslashBigg",
  13055. 0x2216,
  13056. "backslashbigg",
  13057. 0x2216,
  13058. "bardbl",
  13059. 0x2016,
  13060. "bracehtipdownleft",
  13061. 0xfe37,
  13062. "bracehtipdownright",
  13063. 0xfe37,
  13064. "bracehtipupleft",
  13065. 0xfe38,
  13066. "bracehtipupright",
  13067. 0xfe38,
  13068. "braceleftBig",
  13069. 0x007b,
  13070. "braceleftbig",
  13071. 0x007b,
  13072. "braceleftbigg",
  13073. 0x007b,
  13074. "braceleftBigg",
  13075. 0x007b,
  13076. "bracerightBig",
  13077. 0x007d,
  13078. "bracerightbig",
  13079. 0x007d,
  13080. "bracerightbigg",
  13081. 0x007d,
  13082. "bracerightBigg",
  13083. 0x007d,
  13084. "bracketleftbig",
  13085. 0x005b,
  13086. "bracketleftBig",
  13087. 0x005b,
  13088. "bracketleftbigg",
  13089. 0x005b,
  13090. "bracketleftBigg",
  13091. 0x005b,
  13092. "bracketrightBig",
  13093. 0x005d,
  13094. "bracketrightbig",
  13095. 0x005d,
  13096. "bracketrightbigg",
  13097. 0x005d,
  13098. "bracketrightBigg",
  13099. 0x005d,
  13100. "ceilingleftbig",
  13101. 0x2308,
  13102. "ceilingleftBig",
  13103. 0x2308,
  13104. "ceilingleftBigg",
  13105. 0x2308,
  13106. "ceilingleftbigg",
  13107. 0x2308,
  13108. "ceilingrightbig",
  13109. 0x2309,
  13110. "ceilingrightBig",
  13111. 0x2309,
  13112. "ceilingrightbigg",
  13113. 0x2309,
  13114. "ceilingrightBigg",
  13115. 0x2309,
  13116. "circledotdisplay",
  13117. 0x2299,
  13118. "circledottext",
  13119. 0x2299,
  13120. "circlemultiplydisplay",
  13121. 0x2297,
  13122. "circlemultiplytext",
  13123. 0x2297,
  13124. "circleplusdisplay",
  13125. 0x2295,
  13126. "circleplustext",
  13127. 0x2295,
  13128. "contintegraldisplay",
  13129. 0x222e,
  13130. "contintegraltext",
  13131. 0x222e,
  13132. "coproductdisplay",
  13133. 0x2210,
  13134. "coproducttext",
  13135. 0x2210,
  13136. "floorleftBig",
  13137. 0x230a,
  13138. "floorleftbig",
  13139. 0x230a,
  13140. "floorleftbigg",
  13141. 0x230a,
  13142. "floorleftBigg",
  13143. 0x230a,
  13144. "floorrightbig",
  13145. 0x230b,
  13146. "floorrightBig",
  13147. 0x230b,
  13148. "floorrightBigg",
  13149. 0x230b,
  13150. "floorrightbigg",
  13151. 0x230b,
  13152. "hatwide",
  13153. 0x0302,
  13154. "hatwider",
  13155. 0x0302,
  13156. "hatwidest",
  13157. 0x0302,
  13158. "intercal",
  13159. 0x1d40,
  13160. "integraldisplay",
  13161. 0x222b,
  13162. "integraltext",
  13163. 0x222b,
  13164. "intersectiondisplay",
  13165. 0x22c2,
  13166. "intersectiontext",
  13167. 0x22c2,
  13168. "logicalanddisplay",
  13169. 0x2227,
  13170. "logicalandtext",
  13171. 0x2227,
  13172. "logicalordisplay",
  13173. 0x2228,
  13174. "logicalortext",
  13175. 0x2228,
  13176. "parenleftBig",
  13177. 0x0028,
  13178. "parenleftbig",
  13179. 0x0028,
  13180. "parenleftBigg",
  13181. 0x0028,
  13182. "parenleftbigg",
  13183. 0x0028,
  13184. "parenrightBig",
  13185. 0x0029,
  13186. "parenrightbig",
  13187. 0x0029,
  13188. "parenrightBigg",
  13189. 0x0029,
  13190. "parenrightbigg",
  13191. 0x0029,
  13192. "prime",
  13193. 0x2032,
  13194. "productdisplay",
  13195. 0x220f,
  13196. "producttext",
  13197. 0x220f,
  13198. "radicalbig",
  13199. 0x221a,
  13200. "radicalBig",
  13201. 0x221a,
  13202. "radicalBigg",
  13203. 0x221a,
  13204. "radicalbigg",
  13205. 0x221a,
  13206. "radicalbt",
  13207. 0x221a,
  13208. "radicaltp",
  13209. 0x221a,
  13210. "radicalvertex",
  13211. 0x221a,
  13212. "slashbig",
  13213. 0x002f,
  13214. "slashBig",
  13215. 0x002f,
  13216. "slashBigg",
  13217. 0x002f,
  13218. "slashbigg",
  13219. 0x002f,
  13220. "summationdisplay",
  13221. 0x2211,
  13222. "summationtext",
  13223. 0x2211,
  13224. "tildewide",
  13225. 0x02dc,
  13226. "tildewider",
  13227. 0x02dc,
  13228. "tildewidest",
  13229. 0x02dc,
  13230. "uniondisplay",
  13231. 0x22c3,
  13232. "unionmultidisplay",
  13233. 0x228e,
  13234. "unionmultitext",
  13235. 0x228e,
  13236. "unionsqdisplay",
  13237. 0x2294,
  13238. "unionsqtext",
  13239. 0x2294,
  13240. "uniontext",
  13241. 0x22c3,
  13242. "vextenddouble",
  13243. 0x2225,
  13244. "vextendsingle",
  13245. 0x2223
  13246. ];
  13247. });
  13248. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13249. return [
  13250. "space",
  13251. 0x0020,
  13252. "a1",
  13253. 0x2701,
  13254. "a2",
  13255. 0x2702,
  13256. "a202",
  13257. 0x2703,
  13258. "a3",
  13259. 0x2704,
  13260. "a4",
  13261. 0x260e,
  13262. "a5",
  13263. 0x2706,
  13264. "a119",
  13265. 0x2707,
  13266. "a118",
  13267. 0x2708,
  13268. "a117",
  13269. 0x2709,
  13270. "a11",
  13271. 0x261b,
  13272. "a12",
  13273. 0x261e,
  13274. "a13",
  13275. 0x270c,
  13276. "a14",
  13277. 0x270d,
  13278. "a15",
  13279. 0x270e,
  13280. "a16",
  13281. 0x270f,
  13282. "a105",
  13283. 0x2710,
  13284. "a17",
  13285. 0x2711,
  13286. "a18",
  13287. 0x2712,
  13288. "a19",
  13289. 0x2713,
  13290. "a20",
  13291. 0x2714,
  13292. "a21",
  13293. 0x2715,
  13294. "a22",
  13295. 0x2716,
  13296. "a23",
  13297. 0x2717,
  13298. "a24",
  13299. 0x2718,
  13300. "a25",
  13301. 0x2719,
  13302. "a26",
  13303. 0x271a,
  13304. "a27",
  13305. 0x271b,
  13306. "a28",
  13307. 0x271c,
  13308. "a6",
  13309. 0x271d,
  13310. "a7",
  13311. 0x271e,
  13312. "a8",
  13313. 0x271f,
  13314. "a9",
  13315. 0x2720,
  13316. "a10",
  13317. 0x2721,
  13318. "a29",
  13319. 0x2722,
  13320. "a30",
  13321. 0x2723,
  13322. "a31",
  13323. 0x2724,
  13324. "a32",
  13325. 0x2725,
  13326. "a33",
  13327. 0x2726,
  13328. "a34",
  13329. 0x2727,
  13330. "a35",
  13331. 0x2605,
  13332. "a36",
  13333. 0x2729,
  13334. "a37",
  13335. 0x272a,
  13336. "a38",
  13337. 0x272b,
  13338. "a39",
  13339. 0x272c,
  13340. "a40",
  13341. 0x272d,
  13342. "a41",
  13343. 0x272e,
  13344. "a42",
  13345. 0x272f,
  13346. "a43",
  13347. 0x2730,
  13348. "a44",
  13349. 0x2731,
  13350. "a45",
  13351. 0x2732,
  13352. "a46",
  13353. 0x2733,
  13354. "a47",
  13355. 0x2734,
  13356. "a48",
  13357. 0x2735,
  13358. "a49",
  13359. 0x2736,
  13360. "a50",
  13361. 0x2737,
  13362. "a51",
  13363. 0x2738,
  13364. "a52",
  13365. 0x2739,
  13366. "a53",
  13367. 0x273a,
  13368. "a54",
  13369. 0x273b,
  13370. "a55",
  13371. 0x273c,
  13372. "a56",
  13373. 0x273d,
  13374. "a57",
  13375. 0x273e,
  13376. "a58",
  13377. 0x273f,
  13378. "a59",
  13379. 0x2740,
  13380. "a60",
  13381. 0x2741,
  13382. "a61",
  13383. 0x2742,
  13384. "a62",
  13385. 0x2743,
  13386. "a63",
  13387. 0x2744,
  13388. "a64",
  13389. 0x2745,
  13390. "a65",
  13391. 0x2746,
  13392. "a66",
  13393. 0x2747,
  13394. "a67",
  13395. 0x2748,
  13396. "a68",
  13397. 0x2749,
  13398. "a69",
  13399. 0x274a,
  13400. "a70",
  13401. 0x274b,
  13402. "a71",
  13403. 0x25cf,
  13404. "a72",
  13405. 0x274d,
  13406. "a73",
  13407. 0x25a0,
  13408. "a74",
  13409. 0x274f,
  13410. "a203",
  13411. 0x2750,
  13412. "a75",
  13413. 0x2751,
  13414. "a204",
  13415. 0x2752,
  13416. "a76",
  13417. 0x25b2,
  13418. "a77",
  13419. 0x25bc,
  13420. "a78",
  13421. 0x25c6,
  13422. "a79",
  13423. 0x2756,
  13424. "a81",
  13425. 0x25d7,
  13426. "a82",
  13427. 0x2758,
  13428. "a83",
  13429. 0x2759,
  13430. "a84",
  13431. 0x275a,
  13432. "a97",
  13433. 0x275b,
  13434. "a98",
  13435. 0x275c,
  13436. "a99",
  13437. 0x275d,
  13438. "a100",
  13439. 0x275e,
  13440. "a101",
  13441. 0x2761,
  13442. "a102",
  13443. 0x2762,
  13444. "a103",
  13445. 0x2763,
  13446. "a104",
  13447. 0x2764,
  13448. "a106",
  13449. 0x2765,
  13450. "a107",
  13451. 0x2766,
  13452. "a108",
  13453. 0x2767,
  13454. "a112",
  13455. 0x2663,
  13456. "a111",
  13457. 0x2666,
  13458. "a110",
  13459. 0x2665,
  13460. "a109",
  13461. 0x2660,
  13462. "a120",
  13463. 0x2460,
  13464. "a121",
  13465. 0x2461,
  13466. "a122",
  13467. 0x2462,
  13468. "a123",
  13469. 0x2463,
  13470. "a124",
  13471. 0x2464,
  13472. "a125",
  13473. 0x2465,
  13474. "a126",
  13475. 0x2466,
  13476. "a127",
  13477. 0x2467,
  13478. "a128",
  13479. 0x2468,
  13480. "a129",
  13481. 0x2469,
  13482. "a130",
  13483. 0x2776,
  13484. "a131",
  13485. 0x2777,
  13486. "a132",
  13487. 0x2778,
  13488. "a133",
  13489. 0x2779,
  13490. "a134",
  13491. 0x277a,
  13492. "a135",
  13493. 0x277b,
  13494. "a136",
  13495. 0x277c,
  13496. "a137",
  13497. 0x277d,
  13498. "a138",
  13499. 0x277e,
  13500. "a139",
  13501. 0x277f,
  13502. "a140",
  13503. 0x2780,
  13504. "a141",
  13505. 0x2781,
  13506. "a142",
  13507. 0x2782,
  13508. "a143",
  13509. 0x2783,
  13510. "a144",
  13511. 0x2784,
  13512. "a145",
  13513. 0x2785,
  13514. "a146",
  13515. 0x2786,
  13516. "a147",
  13517. 0x2787,
  13518. "a148",
  13519. 0x2788,
  13520. "a149",
  13521. 0x2789,
  13522. "a150",
  13523. 0x278a,
  13524. "a151",
  13525. 0x278b,
  13526. "a152",
  13527. 0x278c,
  13528. "a153",
  13529. 0x278d,
  13530. "a154",
  13531. 0x278e,
  13532. "a155",
  13533. 0x278f,
  13534. "a156",
  13535. 0x2790,
  13536. "a157",
  13537. 0x2791,
  13538. "a158",
  13539. 0x2792,
  13540. "a159",
  13541. 0x2793,
  13542. "a160",
  13543. 0x2794,
  13544. "a161",
  13545. 0x2192,
  13546. "a163",
  13547. 0x2194,
  13548. "a164",
  13549. 0x2195,
  13550. "a196",
  13551. 0x2798,
  13552. "a165",
  13553. 0x2799,
  13554. "a192",
  13555. 0x279a,
  13556. "a166",
  13557. 0x279b,
  13558. "a167",
  13559. 0x279c,
  13560. "a168",
  13561. 0x279d,
  13562. "a169",
  13563. 0x279e,
  13564. "a170",
  13565. 0x279f,
  13566. "a171",
  13567. 0x27a0,
  13568. "a172",
  13569. 0x27a1,
  13570. "a173",
  13571. 0x27a2,
  13572. "a162",
  13573. 0x27a3,
  13574. "a174",
  13575. 0x27a4,
  13576. "a175",
  13577. 0x27a5,
  13578. "a176",
  13579. 0x27a6,
  13580. "a177",
  13581. 0x27a7,
  13582. "a178",
  13583. 0x27a8,
  13584. "a179",
  13585. 0x27a9,
  13586. "a193",
  13587. 0x27aa,
  13588. "a180",
  13589. 0x27ab,
  13590. "a199",
  13591. 0x27ac,
  13592. "a181",
  13593. 0x27ad,
  13594. "a200",
  13595. 0x27ae,
  13596. "a182",
  13597. 0x27af,
  13598. "a201",
  13599. 0x27b1,
  13600. "a183",
  13601. 0x27b2,
  13602. "a184",
  13603. 0x27b3,
  13604. "a197",
  13605. 0x27b4,
  13606. "a185",
  13607. 0x27b5,
  13608. "a194",
  13609. 0x27b6,
  13610. "a198",
  13611. 0x27b7,
  13612. "a186",
  13613. 0x27b8,
  13614. "a195",
  13615. 0x27b9,
  13616. "a187",
  13617. 0x27ba,
  13618. "a188",
  13619. 0x27bb,
  13620. "a189",
  13621. 0x27bc,
  13622. "a190",
  13623. 0x27bd,
  13624. "a191",
  13625. 0x27be,
  13626. "a89",
  13627. 0x2768,
  13628. "a90",
  13629. 0x2769,
  13630. "a93",
  13631. 0x276a,
  13632. "a94",
  13633. 0x276b,
  13634. "a91",
  13635. 0x276c,
  13636. "a92",
  13637. 0x276d,
  13638. "a205",
  13639. 0x276e,
  13640. "a85",
  13641. 0x276f,
  13642. "a206",
  13643. 0x2770,
  13644. "a86",
  13645. 0x2771,
  13646. "a87",
  13647. 0x2772,
  13648. "a88",
  13649. 0x2773,
  13650. "a95",
  13651. 0x2774,
  13652. "a96",
  13653. 0x2775,
  13654. ".notdef",
  13655. 0x0000
  13656. ];
  13657. });
  13658. /***/ }),
  13659. /* 21 */
  13660. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13661. __w_pdfjs_require__.r(__webpack_exports__);
  13662. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13663. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13664. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13665. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13666. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13667. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13668. /* harmony export */ });
  13669. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  13670. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13671. t[63721] = 0x00a9;
  13672. t[63193] = 0x00a9;
  13673. t[63720] = 0x00ae;
  13674. t[63194] = 0x00ae;
  13675. t[63722] = 0x2122;
  13676. t[63195] = 0x2122;
  13677. t[63729] = 0x23a7;
  13678. t[63730] = 0x23a8;
  13679. t[63731] = 0x23a9;
  13680. t[63740] = 0x23ab;
  13681. t[63741] = 0x23ac;
  13682. t[63742] = 0x23ad;
  13683. t[63726] = 0x23a1;
  13684. t[63727] = 0x23a2;
  13685. t[63728] = 0x23a3;
  13686. t[63737] = 0x23a4;
  13687. t[63738] = 0x23a5;
  13688. t[63739] = 0x23a6;
  13689. t[63723] = 0x239b;
  13690. t[63724] = 0x239c;
  13691. t[63725] = 0x239d;
  13692. t[63734] = 0x239e;
  13693. t[63735] = 0x239f;
  13694. t[63736] = 0x23a0;
  13695. });
  13696. function mapSpecialUnicodeValues(code) {
  13697. if (code >= 0xfff0 && code <= 0xffff) {
  13698. return 0;
  13699. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13700. return getSpecialPUASymbols()[code] || code;
  13701. } else if (code === 0x00ad) {
  13702. return 0x002d;
  13703. }
  13704. return code;
  13705. }
  13706. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13707. let unicode = glyphsUnicodeMap[name];
  13708. if (unicode !== undefined) {
  13709. return unicode;
  13710. }
  13711. if (!name) {
  13712. return -1;
  13713. }
  13714. if (name[0] === "u") {
  13715. const nameLen = name.length;
  13716. let hexStr;
  13717. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13718. hexStr = name.substring(3);
  13719. } else if (nameLen >= 5 && nameLen <= 7) {
  13720. hexStr = name.substring(1);
  13721. } else {
  13722. return -1;
  13723. }
  13724. if (hexStr === hexStr.toUpperCase()) {
  13725. unicode = parseInt(hexStr, 16);
  13726. if (unicode >= 0) {
  13727. return unicode;
  13728. }
  13729. }
  13730. }
  13731. return -1;
  13732. }
  13733. const UnicodeRanges = [
  13734. {
  13735. begin: 0x0000,
  13736. end: 0x007f
  13737. },
  13738. {
  13739. begin: 0x0080,
  13740. end: 0x00ff
  13741. },
  13742. {
  13743. begin: 0x0100,
  13744. end: 0x017f
  13745. },
  13746. {
  13747. begin: 0x0180,
  13748. end: 0x024f
  13749. },
  13750. {
  13751. begin: 0x0250,
  13752. end: 0x02af
  13753. },
  13754. {
  13755. begin: 0x02b0,
  13756. end: 0x02ff
  13757. },
  13758. {
  13759. begin: 0x0300,
  13760. end: 0x036f
  13761. },
  13762. {
  13763. begin: 0x0370,
  13764. end: 0x03ff
  13765. },
  13766. {
  13767. begin: 0x2c80,
  13768. end: 0x2cff
  13769. },
  13770. {
  13771. begin: 0x0400,
  13772. end: 0x04ff
  13773. },
  13774. {
  13775. begin: 0x0530,
  13776. end: 0x058f
  13777. },
  13778. {
  13779. begin: 0x0590,
  13780. end: 0x05ff
  13781. },
  13782. {
  13783. begin: 0xa500,
  13784. end: 0xa63f
  13785. },
  13786. {
  13787. begin: 0x0600,
  13788. end: 0x06ff
  13789. },
  13790. {
  13791. begin: 0x07c0,
  13792. end: 0x07ff
  13793. },
  13794. {
  13795. begin: 0x0900,
  13796. end: 0x097f
  13797. },
  13798. {
  13799. begin: 0x0980,
  13800. end: 0x09ff
  13801. },
  13802. {
  13803. begin: 0x0a00,
  13804. end: 0x0a7f
  13805. },
  13806. {
  13807. begin: 0x0a80,
  13808. end: 0x0aff
  13809. },
  13810. {
  13811. begin: 0x0b00,
  13812. end: 0x0b7f
  13813. },
  13814. {
  13815. begin: 0x0b80,
  13816. end: 0x0bff
  13817. },
  13818. {
  13819. begin: 0x0c00,
  13820. end: 0x0c7f
  13821. },
  13822. {
  13823. begin: 0x0c80,
  13824. end: 0x0cff
  13825. },
  13826. {
  13827. begin: 0x0d00,
  13828. end: 0x0d7f
  13829. },
  13830. {
  13831. begin: 0x0e00,
  13832. end: 0x0e7f
  13833. },
  13834. {
  13835. begin: 0x0e80,
  13836. end: 0x0eff
  13837. },
  13838. {
  13839. begin: 0x10a0,
  13840. end: 0x10ff
  13841. },
  13842. {
  13843. begin: 0x1b00,
  13844. end: 0x1b7f
  13845. },
  13846. {
  13847. begin: 0x1100,
  13848. end: 0x11ff
  13849. },
  13850. {
  13851. begin: 0x1e00,
  13852. end: 0x1eff
  13853. },
  13854. {
  13855. begin: 0x1f00,
  13856. end: 0x1fff
  13857. },
  13858. {
  13859. begin: 0x2000,
  13860. end: 0x206f
  13861. },
  13862. {
  13863. begin: 0x2070,
  13864. end: 0x209f
  13865. },
  13866. {
  13867. begin: 0x20a0,
  13868. end: 0x20cf
  13869. },
  13870. {
  13871. begin: 0x20d0,
  13872. end: 0x20ff
  13873. },
  13874. {
  13875. begin: 0x2100,
  13876. end: 0x214f
  13877. },
  13878. {
  13879. begin: 0x2150,
  13880. end: 0x218f
  13881. },
  13882. {
  13883. begin: 0x2190,
  13884. end: 0x21ff
  13885. },
  13886. {
  13887. begin: 0x2200,
  13888. end: 0x22ff
  13889. },
  13890. {
  13891. begin: 0x2300,
  13892. end: 0x23ff
  13893. },
  13894. {
  13895. begin: 0x2400,
  13896. end: 0x243f
  13897. },
  13898. {
  13899. begin: 0x2440,
  13900. end: 0x245f
  13901. },
  13902. {
  13903. begin: 0x2460,
  13904. end: 0x24ff
  13905. },
  13906. {
  13907. begin: 0x2500,
  13908. end: 0x257f
  13909. },
  13910. {
  13911. begin: 0x2580,
  13912. end: 0x259f
  13913. },
  13914. {
  13915. begin: 0x25a0,
  13916. end: 0x25ff
  13917. },
  13918. {
  13919. begin: 0x2600,
  13920. end: 0x26ff
  13921. },
  13922. {
  13923. begin: 0x2700,
  13924. end: 0x27bf
  13925. },
  13926. {
  13927. begin: 0x3000,
  13928. end: 0x303f
  13929. },
  13930. {
  13931. begin: 0x3040,
  13932. end: 0x309f
  13933. },
  13934. {
  13935. begin: 0x30a0,
  13936. end: 0x30ff
  13937. },
  13938. {
  13939. begin: 0x3100,
  13940. end: 0x312f
  13941. },
  13942. {
  13943. begin: 0x3130,
  13944. end: 0x318f
  13945. },
  13946. {
  13947. begin: 0xa840,
  13948. end: 0xa87f
  13949. },
  13950. {
  13951. begin: 0x3200,
  13952. end: 0x32ff
  13953. },
  13954. {
  13955. begin: 0x3300,
  13956. end: 0x33ff
  13957. },
  13958. {
  13959. begin: 0xac00,
  13960. end: 0xd7af
  13961. },
  13962. {
  13963. begin: 0xd800,
  13964. end: 0xdfff
  13965. },
  13966. {
  13967. begin: 0x10900,
  13968. end: 0x1091f
  13969. },
  13970. {
  13971. begin: 0x4e00,
  13972. end: 0x9fff
  13973. },
  13974. {
  13975. begin: 0xe000,
  13976. end: 0xf8ff
  13977. },
  13978. {
  13979. begin: 0x31c0,
  13980. end: 0x31ef
  13981. },
  13982. {
  13983. begin: 0xfb00,
  13984. end: 0xfb4f
  13985. },
  13986. {
  13987. begin: 0xfb50,
  13988. end: 0xfdff
  13989. },
  13990. {
  13991. begin: 0xfe20,
  13992. end: 0xfe2f
  13993. },
  13994. {
  13995. begin: 0xfe10,
  13996. end: 0xfe1f
  13997. },
  13998. {
  13999. begin: 0xfe50,
  14000. end: 0xfe6f
  14001. },
  14002. {
  14003. begin: 0xfe70,
  14004. end: 0xfeff
  14005. },
  14006. {
  14007. begin: 0xff00,
  14008. end: 0xffef
  14009. },
  14010. {
  14011. begin: 0xfff0,
  14012. end: 0xffff
  14013. },
  14014. {
  14015. begin: 0x0f00,
  14016. end: 0x0fff
  14017. },
  14018. {
  14019. begin: 0x0700,
  14020. end: 0x074f
  14021. },
  14022. {
  14023. begin: 0x0780,
  14024. end: 0x07bf
  14025. },
  14026. {
  14027. begin: 0x0d80,
  14028. end: 0x0dff
  14029. },
  14030. {
  14031. begin: 0x1000,
  14032. end: 0x109f
  14033. },
  14034. {
  14035. begin: 0x1200,
  14036. end: 0x137f
  14037. },
  14038. {
  14039. begin: 0x13a0,
  14040. end: 0x13ff
  14041. },
  14042. {
  14043. begin: 0x1400,
  14044. end: 0x167f
  14045. },
  14046. {
  14047. begin: 0x1680,
  14048. end: 0x169f
  14049. },
  14050. {
  14051. begin: 0x16a0,
  14052. end: 0x16ff
  14053. },
  14054. {
  14055. begin: 0x1780,
  14056. end: 0x17ff
  14057. },
  14058. {
  14059. begin: 0x1800,
  14060. end: 0x18af
  14061. },
  14062. {
  14063. begin: 0x2800,
  14064. end: 0x28ff
  14065. },
  14066. {
  14067. begin: 0xa000,
  14068. end: 0xa48f
  14069. },
  14070. {
  14071. begin: 0x1700,
  14072. end: 0x171f
  14073. },
  14074. {
  14075. begin: 0x10300,
  14076. end: 0x1032f
  14077. },
  14078. {
  14079. begin: 0x10330,
  14080. end: 0x1034f
  14081. },
  14082. {
  14083. begin: 0x10400,
  14084. end: 0x1044f
  14085. },
  14086. {
  14087. begin: 0x1d000,
  14088. end: 0x1d0ff
  14089. },
  14090. {
  14091. begin: 0x1d400,
  14092. end: 0x1d7ff
  14093. },
  14094. {
  14095. begin: 0xff000,
  14096. end: 0xffffd
  14097. },
  14098. {
  14099. begin: 0xfe00,
  14100. end: 0xfe0f
  14101. },
  14102. {
  14103. begin: 0xe0000,
  14104. end: 0xe007f
  14105. },
  14106. {
  14107. begin: 0x1900,
  14108. end: 0x194f
  14109. },
  14110. {
  14111. begin: 0x1950,
  14112. end: 0x197f
  14113. },
  14114. {
  14115. begin: 0x1980,
  14116. end: 0x19df
  14117. },
  14118. {
  14119. begin: 0x1a00,
  14120. end: 0x1a1f
  14121. },
  14122. {
  14123. begin: 0x2c00,
  14124. end: 0x2c5f
  14125. },
  14126. {
  14127. begin: 0x2d30,
  14128. end: 0x2d7f
  14129. },
  14130. {
  14131. begin: 0x4dc0,
  14132. end: 0x4dff
  14133. },
  14134. {
  14135. begin: 0xa800,
  14136. end: 0xa82f
  14137. },
  14138. {
  14139. begin: 0x10000,
  14140. end: 0x1007f
  14141. },
  14142. {
  14143. begin: 0x10140,
  14144. end: 0x1018f
  14145. },
  14146. {
  14147. begin: 0x10380,
  14148. end: 0x1039f
  14149. },
  14150. {
  14151. begin: 0x103a0,
  14152. end: 0x103df
  14153. },
  14154. {
  14155. begin: 0x10450,
  14156. end: 0x1047f
  14157. },
  14158. {
  14159. begin: 0x10480,
  14160. end: 0x104af
  14161. },
  14162. {
  14163. begin: 0x10800,
  14164. end: 0x1083f
  14165. },
  14166. {
  14167. begin: 0x10a00,
  14168. end: 0x10a5f
  14169. },
  14170. {
  14171. begin: 0x1d300,
  14172. end: 0x1d35f
  14173. },
  14174. {
  14175. begin: 0x12000,
  14176. end: 0x123ff
  14177. },
  14178. {
  14179. begin: 0x1d360,
  14180. end: 0x1d37f
  14181. },
  14182. {
  14183. begin: 0x1b80,
  14184. end: 0x1bbf
  14185. },
  14186. {
  14187. begin: 0x1c00,
  14188. end: 0x1c4f
  14189. },
  14190. {
  14191. begin: 0x1c50,
  14192. end: 0x1c7f
  14193. },
  14194. {
  14195. begin: 0xa880,
  14196. end: 0xa8df
  14197. },
  14198. {
  14199. begin: 0xa900,
  14200. end: 0xa92f
  14201. },
  14202. {
  14203. begin: 0xa930,
  14204. end: 0xa95f
  14205. },
  14206. {
  14207. begin: 0xaa00,
  14208. end: 0xaa5f
  14209. },
  14210. {
  14211. begin: 0x10190,
  14212. end: 0x101cf
  14213. },
  14214. {
  14215. begin: 0x101d0,
  14216. end: 0x101ff
  14217. },
  14218. {
  14219. begin: 0x102a0,
  14220. end: 0x102df
  14221. },
  14222. {
  14223. begin: 0x1f030,
  14224. end: 0x1f09f
  14225. }
  14226. ];
  14227. function getUnicodeRangeFor(value) {
  14228. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14229. const range = UnicodeRanges[i];
  14230. if (value >= range.begin && value < range.end) {
  14231. return i;
  14232. }
  14233. }
  14234. return -1;
  14235. }
  14236. function isRTLRangeFor(value) {
  14237. let range = UnicodeRanges[13];
  14238. if (value >= range.begin && value < range.end) {
  14239. return true;
  14240. }
  14241. range = UnicodeRanges[11];
  14242. if (value >= range.begin && value < range.end) {
  14243. return true;
  14244. }
  14245. return false;
  14246. }
  14247. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14248. return [
  14249. "\u00A8",
  14250. "\u0020\u0308",
  14251. "\u00AF",
  14252. "\u0020\u0304",
  14253. "\u00B4",
  14254. "\u0020\u0301",
  14255. "\u00B5",
  14256. "\u03BC",
  14257. "\u00B8",
  14258. "\u0020\u0327",
  14259. "\u0132",
  14260. "\u0049\u004A",
  14261. "\u0133",
  14262. "\u0069\u006A",
  14263. "\u013F",
  14264. "\u004C\u00B7",
  14265. "\u0140",
  14266. "\u006C\u00B7",
  14267. "\u0149",
  14268. "\u02BC\u006E",
  14269. "\u017F",
  14270. "\u0073",
  14271. "\u01C4",
  14272. "\u0044\u017D",
  14273. "\u01C5",
  14274. "\u0044\u017E",
  14275. "\u01C6",
  14276. "\u0064\u017E",
  14277. "\u01C7",
  14278. "\u004C\u004A",
  14279. "\u01C8",
  14280. "\u004C\u006A",
  14281. "\u01C9",
  14282. "\u006C\u006A",
  14283. "\u01CA",
  14284. "\u004E\u004A",
  14285. "\u01CB",
  14286. "\u004E\u006A",
  14287. "\u01CC",
  14288. "\u006E\u006A",
  14289. "\u01F1",
  14290. "\u0044\u005A",
  14291. "\u01F2",
  14292. "\u0044\u007A",
  14293. "\u01F3",
  14294. "\u0064\u007A",
  14295. "\u02D8",
  14296. "\u0020\u0306",
  14297. "\u02D9",
  14298. "\u0020\u0307",
  14299. "\u02DA",
  14300. "\u0020\u030A",
  14301. "\u02DB",
  14302. "\u0020\u0328",
  14303. "\u02DC",
  14304. "\u0020\u0303",
  14305. "\u02DD",
  14306. "\u0020\u030B",
  14307. "\u037A",
  14308. "\u0020\u0345",
  14309. "\u0384",
  14310. "\u0020\u0301",
  14311. "\u03D0",
  14312. "\u03B2",
  14313. "\u03D1",
  14314. "\u03B8",
  14315. "\u03D2",
  14316. "\u03A5",
  14317. "\u03D5",
  14318. "\u03C6",
  14319. "\u03D6",
  14320. "\u03C0",
  14321. "\u03F0",
  14322. "\u03BA",
  14323. "\u03F1",
  14324. "\u03C1",
  14325. "\u03F2",
  14326. "\u03C2",
  14327. "\u03F4",
  14328. "\u0398",
  14329. "\u03F5",
  14330. "\u03B5",
  14331. "\u03F9",
  14332. "\u03A3",
  14333. "\u0587",
  14334. "\u0565\u0582",
  14335. "\u0675",
  14336. "\u0627\u0674",
  14337. "\u0676",
  14338. "\u0648\u0674",
  14339. "\u0677",
  14340. "\u06C7\u0674",
  14341. "\u0678",
  14342. "\u064A\u0674",
  14343. "\u0E33",
  14344. "\u0E4D\u0E32",
  14345. "\u0EB3",
  14346. "\u0ECD\u0EB2",
  14347. "\u0EDC",
  14348. "\u0EAB\u0E99",
  14349. "\u0EDD",
  14350. "\u0EAB\u0EA1",
  14351. "\u0F77",
  14352. "\u0FB2\u0F81",
  14353. "\u0F79",
  14354. "\u0FB3\u0F81",
  14355. "\u1E9A",
  14356. "\u0061\u02BE",
  14357. "\u1FBD",
  14358. "\u0020\u0313",
  14359. "\u1FBF",
  14360. "\u0020\u0313",
  14361. "\u1FC0",
  14362. "\u0020\u0342",
  14363. "\u1FFE",
  14364. "\u0020\u0314",
  14365. "\u2002",
  14366. "\u0020",
  14367. "\u2003",
  14368. "\u0020",
  14369. "\u2004",
  14370. "\u0020",
  14371. "\u2005",
  14372. "\u0020",
  14373. "\u2006",
  14374. "\u0020",
  14375. "\u2008",
  14376. "\u0020",
  14377. "\u2009",
  14378. "\u0020",
  14379. "\u200A",
  14380. "\u0020",
  14381. "\u2017",
  14382. "\u0020\u0333",
  14383. "\u2024",
  14384. "\u002E",
  14385. "\u2025",
  14386. "\u002E\u002E",
  14387. "\u2026",
  14388. "\u002E\u002E\u002E",
  14389. "\u2033",
  14390. "\u2032\u2032",
  14391. "\u2034",
  14392. "\u2032\u2032\u2032",
  14393. "\u2036",
  14394. "\u2035\u2035",
  14395. "\u2037",
  14396. "\u2035\u2035\u2035",
  14397. "\u203C",
  14398. "\u0021\u0021",
  14399. "\u203E",
  14400. "\u0020\u0305",
  14401. "\u2047",
  14402. "\u003F\u003F",
  14403. "\u2048",
  14404. "\u003F\u0021",
  14405. "\u2049",
  14406. "\u0021\u003F",
  14407. "\u2057",
  14408. "\u2032\u2032\u2032\u2032",
  14409. "\u205F",
  14410. "\u0020",
  14411. "\u20A8",
  14412. "\u0052\u0073",
  14413. "\u2100",
  14414. "\u0061\u002F\u0063",
  14415. "\u2101",
  14416. "\u0061\u002F\u0073",
  14417. "\u2103",
  14418. "\u00B0\u0043",
  14419. "\u2105",
  14420. "\u0063\u002F\u006F",
  14421. "\u2106",
  14422. "\u0063\u002F\u0075",
  14423. "\u2107",
  14424. "\u0190",
  14425. "\u2109",
  14426. "\u00B0\u0046",
  14427. "\u2116",
  14428. "\u004E\u006F",
  14429. "\u2121",
  14430. "\u0054\u0045\u004C",
  14431. "\u2135",
  14432. "\u05D0",
  14433. "\u2136",
  14434. "\u05D1",
  14435. "\u2137",
  14436. "\u05D2",
  14437. "\u2138",
  14438. "\u05D3",
  14439. "\u213B",
  14440. "\u0046\u0041\u0058",
  14441. "\u2160",
  14442. "\u0049",
  14443. "\u2161",
  14444. "\u0049\u0049",
  14445. "\u2162",
  14446. "\u0049\u0049\u0049",
  14447. "\u2163",
  14448. "\u0049\u0056",
  14449. "\u2164",
  14450. "\u0056",
  14451. "\u2165",
  14452. "\u0056\u0049",
  14453. "\u2166",
  14454. "\u0056\u0049\u0049",
  14455. "\u2167",
  14456. "\u0056\u0049\u0049\u0049",
  14457. "\u2168",
  14458. "\u0049\u0058",
  14459. "\u2169",
  14460. "\u0058",
  14461. "\u216A",
  14462. "\u0058\u0049",
  14463. "\u216B",
  14464. "\u0058\u0049\u0049",
  14465. "\u216C",
  14466. "\u004C",
  14467. "\u216D",
  14468. "\u0043",
  14469. "\u216E",
  14470. "\u0044",
  14471. "\u216F",
  14472. "\u004D",
  14473. "\u2170",
  14474. "\u0069",
  14475. "\u2171",
  14476. "\u0069\u0069",
  14477. "\u2172",
  14478. "\u0069\u0069\u0069",
  14479. "\u2173",
  14480. "\u0069\u0076",
  14481. "\u2174",
  14482. "\u0076",
  14483. "\u2175",
  14484. "\u0076\u0069",
  14485. "\u2176",
  14486. "\u0076\u0069\u0069",
  14487. "\u2177",
  14488. "\u0076\u0069\u0069\u0069",
  14489. "\u2178",
  14490. "\u0069\u0078",
  14491. "\u2179",
  14492. "\u0078",
  14493. "\u217A",
  14494. "\u0078\u0069",
  14495. "\u217B",
  14496. "\u0078\u0069\u0069",
  14497. "\u217C",
  14498. "\u006C",
  14499. "\u217D",
  14500. "\u0063",
  14501. "\u217E",
  14502. "\u0064",
  14503. "\u217F",
  14504. "\u006D",
  14505. "\u222C",
  14506. "\u222B\u222B",
  14507. "\u222D",
  14508. "\u222B\u222B\u222B",
  14509. "\u222F",
  14510. "\u222E\u222E",
  14511. "\u2230",
  14512. "\u222E\u222E\u222E",
  14513. "\u2474",
  14514. "\u0028\u0031\u0029",
  14515. "\u2475",
  14516. "\u0028\u0032\u0029",
  14517. "\u2476",
  14518. "\u0028\u0033\u0029",
  14519. "\u2477",
  14520. "\u0028\u0034\u0029",
  14521. "\u2478",
  14522. "\u0028\u0035\u0029",
  14523. "\u2479",
  14524. "\u0028\u0036\u0029",
  14525. "\u247A",
  14526. "\u0028\u0037\u0029",
  14527. "\u247B",
  14528. "\u0028\u0038\u0029",
  14529. "\u247C",
  14530. "\u0028\u0039\u0029",
  14531. "\u247D",
  14532. "\u0028\u0031\u0030\u0029",
  14533. "\u247E",
  14534. "\u0028\u0031\u0031\u0029",
  14535. "\u247F",
  14536. "\u0028\u0031\u0032\u0029",
  14537. "\u2480",
  14538. "\u0028\u0031\u0033\u0029",
  14539. "\u2481",
  14540. "\u0028\u0031\u0034\u0029",
  14541. "\u2482",
  14542. "\u0028\u0031\u0035\u0029",
  14543. "\u2483",
  14544. "\u0028\u0031\u0036\u0029",
  14545. "\u2484",
  14546. "\u0028\u0031\u0037\u0029",
  14547. "\u2485",
  14548. "\u0028\u0031\u0038\u0029",
  14549. "\u2486",
  14550. "\u0028\u0031\u0039\u0029",
  14551. "\u2487",
  14552. "\u0028\u0032\u0030\u0029",
  14553. "\u2488",
  14554. "\u0031\u002E",
  14555. "\u2489",
  14556. "\u0032\u002E",
  14557. "\u248A",
  14558. "\u0033\u002E",
  14559. "\u248B",
  14560. "\u0034\u002E",
  14561. "\u248C",
  14562. "\u0035\u002E",
  14563. "\u248D",
  14564. "\u0036\u002E",
  14565. "\u248E",
  14566. "\u0037\u002E",
  14567. "\u248F",
  14568. "\u0038\u002E",
  14569. "\u2490",
  14570. "\u0039\u002E",
  14571. "\u2491",
  14572. "\u0031\u0030\u002E",
  14573. "\u2492",
  14574. "\u0031\u0031\u002E",
  14575. "\u2493",
  14576. "\u0031\u0032\u002E",
  14577. "\u2494",
  14578. "\u0031\u0033\u002E",
  14579. "\u2495",
  14580. "\u0031\u0034\u002E",
  14581. "\u2496",
  14582. "\u0031\u0035\u002E",
  14583. "\u2497",
  14584. "\u0031\u0036\u002E",
  14585. "\u2498",
  14586. "\u0031\u0037\u002E",
  14587. "\u2499",
  14588. "\u0031\u0038\u002E",
  14589. "\u249A",
  14590. "\u0031\u0039\u002E",
  14591. "\u249B",
  14592. "\u0032\u0030\u002E",
  14593. "\u249C",
  14594. "\u0028\u0061\u0029",
  14595. "\u249D",
  14596. "\u0028\u0062\u0029",
  14597. "\u249E",
  14598. "\u0028\u0063\u0029",
  14599. "\u249F",
  14600. "\u0028\u0064\u0029",
  14601. "\u24A0",
  14602. "\u0028\u0065\u0029",
  14603. "\u24A1",
  14604. "\u0028\u0066\u0029",
  14605. "\u24A2",
  14606. "\u0028\u0067\u0029",
  14607. "\u24A3",
  14608. "\u0028\u0068\u0029",
  14609. "\u24A4",
  14610. "\u0028\u0069\u0029",
  14611. "\u24A5",
  14612. "\u0028\u006A\u0029",
  14613. "\u24A6",
  14614. "\u0028\u006B\u0029",
  14615. "\u24A7",
  14616. "\u0028\u006C\u0029",
  14617. "\u24A8",
  14618. "\u0028\u006D\u0029",
  14619. "\u24A9",
  14620. "\u0028\u006E\u0029",
  14621. "\u24AA",
  14622. "\u0028\u006F\u0029",
  14623. "\u24AB",
  14624. "\u0028\u0070\u0029",
  14625. "\u24AC",
  14626. "\u0028\u0071\u0029",
  14627. "\u24AD",
  14628. "\u0028\u0072\u0029",
  14629. "\u24AE",
  14630. "\u0028\u0073\u0029",
  14631. "\u24AF",
  14632. "\u0028\u0074\u0029",
  14633. "\u24B0",
  14634. "\u0028\u0075\u0029",
  14635. "\u24B1",
  14636. "\u0028\u0076\u0029",
  14637. "\u24B2",
  14638. "\u0028\u0077\u0029",
  14639. "\u24B3",
  14640. "\u0028\u0078\u0029",
  14641. "\u24B4",
  14642. "\u0028\u0079\u0029",
  14643. "\u24B5",
  14644. "\u0028\u007A\u0029",
  14645. "\u2A0C",
  14646. "\u222B\u222B\u222B\u222B",
  14647. "\u2A74",
  14648. "\u003A\u003A\u003D",
  14649. "\u2A75",
  14650. "\u003D\u003D",
  14651. "\u2A76",
  14652. "\u003D\u003D\u003D",
  14653. "\u2E9F",
  14654. "\u6BCD",
  14655. "\u2EF3",
  14656. "\u9F9F",
  14657. "\u2F00",
  14658. "\u4E00",
  14659. "\u2F01",
  14660. "\u4E28",
  14661. "\u2F02",
  14662. "\u4E36",
  14663. "\u2F03",
  14664. "\u4E3F",
  14665. "\u2F04",
  14666. "\u4E59",
  14667. "\u2F05",
  14668. "\u4E85",
  14669. "\u2F06",
  14670. "\u4E8C",
  14671. "\u2F07",
  14672. "\u4EA0",
  14673. "\u2F08",
  14674. "\u4EBA",
  14675. "\u2F09",
  14676. "\u513F",
  14677. "\u2F0A",
  14678. "\u5165",
  14679. "\u2F0B",
  14680. "\u516B",
  14681. "\u2F0C",
  14682. "\u5182",
  14683. "\u2F0D",
  14684. "\u5196",
  14685. "\u2F0E",
  14686. "\u51AB",
  14687. "\u2F0F",
  14688. "\u51E0",
  14689. "\u2F10",
  14690. "\u51F5",
  14691. "\u2F11",
  14692. "\u5200",
  14693. "\u2F12",
  14694. "\u529B",
  14695. "\u2F13",
  14696. "\u52F9",
  14697. "\u2F14",
  14698. "\u5315",
  14699. "\u2F15",
  14700. "\u531A",
  14701. "\u2F16",
  14702. "\u5338",
  14703. "\u2F17",
  14704. "\u5341",
  14705. "\u2F18",
  14706. "\u535C",
  14707. "\u2F19",
  14708. "\u5369",
  14709. "\u2F1A",
  14710. "\u5382",
  14711. "\u2F1B",
  14712. "\u53B6",
  14713. "\u2F1C",
  14714. "\u53C8",
  14715. "\u2F1D",
  14716. "\u53E3",
  14717. "\u2F1E",
  14718. "\u56D7",
  14719. "\u2F1F",
  14720. "\u571F",
  14721. "\u2F20",
  14722. "\u58EB",
  14723. "\u2F21",
  14724. "\u5902",
  14725. "\u2F22",
  14726. "\u590A",
  14727. "\u2F23",
  14728. "\u5915",
  14729. "\u2F24",
  14730. "\u5927",
  14731. "\u2F25",
  14732. "\u5973",
  14733. "\u2F26",
  14734. "\u5B50",
  14735. "\u2F27",
  14736. "\u5B80",
  14737. "\u2F28",
  14738. "\u5BF8",
  14739. "\u2F29",
  14740. "\u5C0F",
  14741. "\u2F2A",
  14742. "\u5C22",
  14743. "\u2F2B",
  14744. "\u5C38",
  14745. "\u2F2C",
  14746. "\u5C6E",
  14747. "\u2F2D",
  14748. "\u5C71",
  14749. "\u2F2E",
  14750. "\u5DDB",
  14751. "\u2F2F",
  14752. "\u5DE5",
  14753. "\u2F30",
  14754. "\u5DF1",
  14755. "\u2F31",
  14756. "\u5DFE",
  14757. "\u2F32",
  14758. "\u5E72",
  14759. "\u2F33",
  14760. "\u5E7A",
  14761. "\u2F34",
  14762. "\u5E7F",
  14763. "\u2F35",
  14764. "\u5EF4",
  14765. "\u2F36",
  14766. "\u5EFE",
  14767. "\u2F37",
  14768. "\u5F0B",
  14769. "\u2F38",
  14770. "\u5F13",
  14771. "\u2F39",
  14772. "\u5F50",
  14773. "\u2F3A",
  14774. "\u5F61",
  14775. "\u2F3B",
  14776. "\u5F73",
  14777. "\u2F3C",
  14778. "\u5FC3",
  14779. "\u2F3D",
  14780. "\u6208",
  14781. "\u2F3E",
  14782. "\u6236",
  14783. "\u2F3F",
  14784. "\u624B",
  14785. "\u2F40",
  14786. "\u652F",
  14787. "\u2F41",
  14788. "\u6534",
  14789. "\u2F42",
  14790. "\u6587",
  14791. "\u2F43",
  14792. "\u6597",
  14793. "\u2F44",
  14794. "\u65A4",
  14795. "\u2F45",
  14796. "\u65B9",
  14797. "\u2F46",
  14798. "\u65E0",
  14799. "\u2F47",
  14800. "\u65E5",
  14801. "\u2F48",
  14802. "\u66F0",
  14803. "\u2F49",
  14804. "\u6708",
  14805. "\u2F4A",
  14806. "\u6728",
  14807. "\u2F4B",
  14808. "\u6B20",
  14809. "\u2F4C",
  14810. "\u6B62",
  14811. "\u2F4D",
  14812. "\u6B79",
  14813. "\u2F4E",
  14814. "\u6BB3",
  14815. "\u2F4F",
  14816. "\u6BCB",
  14817. "\u2F50",
  14818. "\u6BD4",
  14819. "\u2F51",
  14820. "\u6BDB",
  14821. "\u2F52",
  14822. "\u6C0F",
  14823. "\u2F53",
  14824. "\u6C14",
  14825. "\u2F54",
  14826. "\u6C34",
  14827. "\u2F55",
  14828. "\u706B",
  14829. "\u2F56",
  14830. "\u722A",
  14831. "\u2F57",
  14832. "\u7236",
  14833. "\u2F58",
  14834. "\u723B",
  14835. "\u2F59",
  14836. "\u723F",
  14837. "\u2F5A",
  14838. "\u7247",
  14839. "\u2F5B",
  14840. "\u7259",
  14841. "\u2F5C",
  14842. "\u725B",
  14843. "\u2F5D",
  14844. "\u72AC",
  14845. "\u2F5E",
  14846. "\u7384",
  14847. "\u2F5F",
  14848. "\u7389",
  14849. "\u2F60",
  14850. "\u74DC",
  14851. "\u2F61",
  14852. "\u74E6",
  14853. "\u2F62",
  14854. "\u7518",
  14855. "\u2F63",
  14856. "\u751F",
  14857. "\u2F64",
  14858. "\u7528",
  14859. "\u2F65",
  14860. "\u7530",
  14861. "\u2F66",
  14862. "\u758B",
  14863. "\u2F67",
  14864. "\u7592",
  14865. "\u2F68",
  14866. "\u7676",
  14867. "\u2F69",
  14868. "\u767D",
  14869. "\u2F6A",
  14870. "\u76AE",
  14871. "\u2F6B",
  14872. "\u76BF",
  14873. "\u2F6C",
  14874. "\u76EE",
  14875. "\u2F6D",
  14876. "\u77DB",
  14877. "\u2F6E",
  14878. "\u77E2",
  14879. "\u2F6F",
  14880. "\u77F3",
  14881. "\u2F70",
  14882. "\u793A",
  14883. "\u2F71",
  14884. "\u79B8",
  14885. "\u2F72",
  14886. "\u79BE",
  14887. "\u2F73",
  14888. "\u7A74",
  14889. "\u2F74",
  14890. "\u7ACB",
  14891. "\u2F75",
  14892. "\u7AF9",
  14893. "\u2F76",
  14894. "\u7C73",
  14895. "\u2F77",
  14896. "\u7CF8",
  14897. "\u2F78",
  14898. "\u7F36",
  14899. "\u2F79",
  14900. "\u7F51",
  14901. "\u2F7A",
  14902. "\u7F8A",
  14903. "\u2F7B",
  14904. "\u7FBD",
  14905. "\u2F7C",
  14906. "\u8001",
  14907. "\u2F7D",
  14908. "\u800C",
  14909. "\u2F7E",
  14910. "\u8012",
  14911. "\u2F7F",
  14912. "\u8033",
  14913. "\u2F80",
  14914. "\u807F",
  14915. "\u2F81",
  14916. "\u8089",
  14917. "\u2F82",
  14918. "\u81E3",
  14919. "\u2F83",
  14920. "\u81EA",
  14921. "\u2F84",
  14922. "\u81F3",
  14923. "\u2F85",
  14924. "\u81FC",
  14925. "\u2F86",
  14926. "\u820C",
  14927. "\u2F87",
  14928. "\u821B",
  14929. "\u2F88",
  14930. "\u821F",
  14931. "\u2F89",
  14932. "\u826E",
  14933. "\u2F8A",
  14934. "\u8272",
  14935. "\u2F8B",
  14936. "\u8278",
  14937. "\u2F8C",
  14938. "\u864D",
  14939. "\u2F8D",
  14940. "\u866B",
  14941. "\u2F8E",
  14942. "\u8840",
  14943. "\u2F8F",
  14944. "\u884C",
  14945. "\u2F90",
  14946. "\u8863",
  14947. "\u2F91",
  14948. "\u897E",
  14949. "\u2F92",
  14950. "\u898B",
  14951. "\u2F93",
  14952. "\u89D2",
  14953. "\u2F94",
  14954. "\u8A00",
  14955. "\u2F95",
  14956. "\u8C37",
  14957. "\u2F96",
  14958. "\u8C46",
  14959. "\u2F97",
  14960. "\u8C55",
  14961. "\u2F98",
  14962. "\u8C78",
  14963. "\u2F99",
  14964. "\u8C9D",
  14965. "\u2F9A",
  14966. "\u8D64",
  14967. "\u2F9B",
  14968. "\u8D70",
  14969. "\u2F9C",
  14970. "\u8DB3",
  14971. "\u2F9D",
  14972. "\u8EAB",
  14973. "\u2F9E",
  14974. "\u8ECA",
  14975. "\u2F9F",
  14976. "\u8F9B",
  14977. "\u2FA0",
  14978. "\u8FB0",
  14979. "\u2FA1",
  14980. "\u8FB5",
  14981. "\u2FA2",
  14982. "\u9091",
  14983. "\u2FA3",
  14984. "\u9149",
  14985. "\u2FA4",
  14986. "\u91C6",
  14987. "\u2FA5",
  14988. "\u91CC",
  14989. "\u2FA6",
  14990. "\u91D1",
  14991. "\u2FA7",
  14992. "\u9577",
  14993. "\u2FA8",
  14994. "\u9580",
  14995. "\u2FA9",
  14996. "\u961C",
  14997. "\u2FAA",
  14998. "\u96B6",
  14999. "\u2FAB",
  15000. "\u96B9",
  15001. "\u2FAC",
  15002. "\u96E8",
  15003. "\u2FAD",
  15004. "\u9751",
  15005. "\u2FAE",
  15006. "\u975E",
  15007. "\u2FAF",
  15008. "\u9762",
  15009. "\u2FB0",
  15010. "\u9769",
  15011. "\u2FB1",
  15012. "\u97CB",
  15013. "\u2FB2",
  15014. "\u97ED",
  15015. "\u2FB3",
  15016. "\u97F3",
  15017. "\u2FB4",
  15018. "\u9801",
  15019. "\u2FB5",
  15020. "\u98A8",
  15021. "\u2FB6",
  15022. "\u98DB",
  15023. "\u2FB7",
  15024. "\u98DF",
  15025. "\u2FB8",
  15026. "\u9996",
  15027. "\u2FB9",
  15028. "\u9999",
  15029. "\u2FBA",
  15030. "\u99AC",
  15031. "\u2FBB",
  15032. "\u9AA8",
  15033. "\u2FBC",
  15034. "\u9AD8",
  15035. "\u2FBD",
  15036. "\u9ADF",
  15037. "\u2FBE",
  15038. "\u9B25",
  15039. "\u2FBF",
  15040. "\u9B2F",
  15041. "\u2FC0",
  15042. "\u9B32",
  15043. "\u2FC1",
  15044. "\u9B3C",
  15045. "\u2FC2",
  15046. "\u9B5A",
  15047. "\u2FC3",
  15048. "\u9CE5",
  15049. "\u2FC4",
  15050. "\u9E75",
  15051. "\u2FC5",
  15052. "\u9E7F",
  15053. "\u2FC6",
  15054. "\u9EA5",
  15055. "\u2FC7",
  15056. "\u9EBB",
  15057. "\u2FC8",
  15058. "\u9EC3",
  15059. "\u2FC9",
  15060. "\u9ECD",
  15061. "\u2FCA",
  15062. "\u9ED1",
  15063. "\u2FCB",
  15064. "\u9EF9",
  15065. "\u2FCC",
  15066. "\u9EFD",
  15067. "\u2FCD",
  15068. "\u9F0E",
  15069. "\u2FCE",
  15070. "\u9F13",
  15071. "\u2FCF",
  15072. "\u9F20",
  15073. "\u2FD0",
  15074. "\u9F3B",
  15075. "\u2FD1",
  15076. "\u9F4A",
  15077. "\u2FD2",
  15078. "\u9F52",
  15079. "\u2FD3",
  15080. "\u9F8D",
  15081. "\u2FD4",
  15082. "\u9F9C",
  15083. "\u2FD5",
  15084. "\u9FA0",
  15085. "\u3036",
  15086. "\u3012",
  15087. "\u3038",
  15088. "\u5341",
  15089. "\u3039",
  15090. "\u5344",
  15091. "\u303A",
  15092. "\u5345",
  15093. "\u309B",
  15094. "\u0020\u3099",
  15095. "\u309C",
  15096. "\u0020\u309A",
  15097. "\u3131",
  15098. "\u1100",
  15099. "\u3132",
  15100. "\u1101",
  15101. "\u3133",
  15102. "\u11AA",
  15103. "\u3134",
  15104. "\u1102",
  15105. "\u3135",
  15106. "\u11AC",
  15107. "\u3136",
  15108. "\u11AD",
  15109. "\u3137",
  15110. "\u1103",
  15111. "\u3138",
  15112. "\u1104",
  15113. "\u3139",
  15114. "\u1105",
  15115. "\u313A",
  15116. "\u11B0",
  15117. "\u313B",
  15118. "\u11B1",
  15119. "\u313C",
  15120. "\u11B2",
  15121. "\u313D",
  15122. "\u11B3",
  15123. "\u313E",
  15124. "\u11B4",
  15125. "\u313F",
  15126. "\u11B5",
  15127. "\u3140",
  15128. "\u111A",
  15129. "\u3141",
  15130. "\u1106",
  15131. "\u3142",
  15132. "\u1107",
  15133. "\u3143",
  15134. "\u1108",
  15135. "\u3144",
  15136. "\u1121",
  15137. "\u3145",
  15138. "\u1109",
  15139. "\u3146",
  15140. "\u110A",
  15141. "\u3147",
  15142. "\u110B",
  15143. "\u3148",
  15144. "\u110C",
  15145. "\u3149",
  15146. "\u110D",
  15147. "\u314A",
  15148. "\u110E",
  15149. "\u314B",
  15150. "\u110F",
  15151. "\u314C",
  15152. "\u1110",
  15153. "\u314D",
  15154. "\u1111",
  15155. "\u314E",
  15156. "\u1112",
  15157. "\u314F",
  15158. "\u1161",
  15159. "\u3150",
  15160. "\u1162",
  15161. "\u3151",
  15162. "\u1163",
  15163. "\u3152",
  15164. "\u1164",
  15165. "\u3153",
  15166. "\u1165",
  15167. "\u3154",
  15168. "\u1166",
  15169. "\u3155",
  15170. "\u1167",
  15171. "\u3156",
  15172. "\u1168",
  15173. "\u3157",
  15174. "\u1169",
  15175. "\u3158",
  15176. "\u116A",
  15177. "\u3159",
  15178. "\u116B",
  15179. "\u315A",
  15180. "\u116C",
  15181. "\u315B",
  15182. "\u116D",
  15183. "\u315C",
  15184. "\u116E",
  15185. "\u315D",
  15186. "\u116F",
  15187. "\u315E",
  15188. "\u1170",
  15189. "\u315F",
  15190. "\u1171",
  15191. "\u3160",
  15192. "\u1172",
  15193. "\u3161",
  15194. "\u1173",
  15195. "\u3162",
  15196. "\u1174",
  15197. "\u3163",
  15198. "\u1175",
  15199. "\u3164",
  15200. "\u1160",
  15201. "\u3165",
  15202. "\u1114",
  15203. "\u3166",
  15204. "\u1115",
  15205. "\u3167",
  15206. "\u11C7",
  15207. "\u3168",
  15208. "\u11C8",
  15209. "\u3169",
  15210. "\u11CC",
  15211. "\u316A",
  15212. "\u11CE",
  15213. "\u316B",
  15214. "\u11D3",
  15215. "\u316C",
  15216. "\u11D7",
  15217. "\u316D",
  15218. "\u11D9",
  15219. "\u316E",
  15220. "\u111C",
  15221. "\u316F",
  15222. "\u11DD",
  15223. "\u3170",
  15224. "\u11DF",
  15225. "\u3171",
  15226. "\u111D",
  15227. "\u3172",
  15228. "\u111E",
  15229. "\u3173",
  15230. "\u1120",
  15231. "\u3174",
  15232. "\u1122",
  15233. "\u3175",
  15234. "\u1123",
  15235. "\u3176",
  15236. "\u1127",
  15237. "\u3177",
  15238. "\u1129",
  15239. "\u3178",
  15240. "\u112B",
  15241. "\u3179",
  15242. "\u112C",
  15243. "\u317A",
  15244. "\u112D",
  15245. "\u317B",
  15246. "\u112E",
  15247. "\u317C",
  15248. "\u112F",
  15249. "\u317D",
  15250. "\u1132",
  15251. "\u317E",
  15252. "\u1136",
  15253. "\u317F",
  15254. "\u1140",
  15255. "\u3180",
  15256. "\u1147",
  15257. "\u3181",
  15258. "\u114C",
  15259. "\u3182",
  15260. "\u11F1",
  15261. "\u3183",
  15262. "\u11F2",
  15263. "\u3184",
  15264. "\u1157",
  15265. "\u3185",
  15266. "\u1158",
  15267. "\u3186",
  15268. "\u1159",
  15269. "\u3187",
  15270. "\u1184",
  15271. "\u3188",
  15272. "\u1185",
  15273. "\u3189",
  15274. "\u1188",
  15275. "\u318A",
  15276. "\u1191",
  15277. "\u318B",
  15278. "\u1192",
  15279. "\u318C",
  15280. "\u1194",
  15281. "\u318D",
  15282. "\u119E",
  15283. "\u318E",
  15284. "\u11A1",
  15285. "\u3200",
  15286. "\u0028\u1100\u0029",
  15287. "\u3201",
  15288. "\u0028\u1102\u0029",
  15289. "\u3202",
  15290. "\u0028\u1103\u0029",
  15291. "\u3203",
  15292. "\u0028\u1105\u0029",
  15293. "\u3204",
  15294. "\u0028\u1106\u0029",
  15295. "\u3205",
  15296. "\u0028\u1107\u0029",
  15297. "\u3206",
  15298. "\u0028\u1109\u0029",
  15299. "\u3207",
  15300. "\u0028\u110B\u0029",
  15301. "\u3208",
  15302. "\u0028\u110C\u0029",
  15303. "\u3209",
  15304. "\u0028\u110E\u0029",
  15305. "\u320A",
  15306. "\u0028\u110F\u0029",
  15307. "\u320B",
  15308. "\u0028\u1110\u0029",
  15309. "\u320C",
  15310. "\u0028\u1111\u0029",
  15311. "\u320D",
  15312. "\u0028\u1112\u0029",
  15313. "\u320E",
  15314. "\u0028\u1100\u1161\u0029",
  15315. "\u320F",
  15316. "\u0028\u1102\u1161\u0029",
  15317. "\u3210",
  15318. "\u0028\u1103\u1161\u0029",
  15319. "\u3211",
  15320. "\u0028\u1105\u1161\u0029",
  15321. "\u3212",
  15322. "\u0028\u1106\u1161\u0029",
  15323. "\u3213",
  15324. "\u0028\u1107\u1161\u0029",
  15325. "\u3214",
  15326. "\u0028\u1109\u1161\u0029",
  15327. "\u3215",
  15328. "\u0028\u110B\u1161\u0029",
  15329. "\u3216",
  15330. "\u0028\u110C\u1161\u0029",
  15331. "\u3217",
  15332. "\u0028\u110E\u1161\u0029",
  15333. "\u3218",
  15334. "\u0028\u110F\u1161\u0029",
  15335. "\u3219",
  15336. "\u0028\u1110\u1161\u0029",
  15337. "\u321A",
  15338. "\u0028\u1111\u1161\u0029",
  15339. "\u321B",
  15340. "\u0028\u1112\u1161\u0029",
  15341. "\u321C",
  15342. "\u0028\u110C\u116E\u0029",
  15343. "\u321D",
  15344. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15345. "\u321E",
  15346. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15347. "\u3220",
  15348. "\u0028\u4E00\u0029",
  15349. "\u3221",
  15350. "\u0028\u4E8C\u0029",
  15351. "\u3222",
  15352. "\u0028\u4E09\u0029",
  15353. "\u3223",
  15354. "\u0028\u56DB\u0029",
  15355. "\u3224",
  15356. "\u0028\u4E94\u0029",
  15357. "\u3225",
  15358. "\u0028\u516D\u0029",
  15359. "\u3226",
  15360. "\u0028\u4E03\u0029",
  15361. "\u3227",
  15362. "\u0028\u516B\u0029",
  15363. "\u3228",
  15364. "\u0028\u4E5D\u0029",
  15365. "\u3229",
  15366. "\u0028\u5341\u0029",
  15367. "\u322A",
  15368. "\u0028\u6708\u0029",
  15369. "\u322B",
  15370. "\u0028\u706B\u0029",
  15371. "\u322C",
  15372. "\u0028\u6C34\u0029",
  15373. "\u322D",
  15374. "\u0028\u6728\u0029",
  15375. "\u322E",
  15376. "\u0028\u91D1\u0029",
  15377. "\u322F",
  15378. "\u0028\u571F\u0029",
  15379. "\u3230",
  15380. "\u0028\u65E5\u0029",
  15381. "\u3231",
  15382. "\u0028\u682A\u0029",
  15383. "\u3232",
  15384. "\u0028\u6709\u0029",
  15385. "\u3233",
  15386. "\u0028\u793E\u0029",
  15387. "\u3234",
  15388. "\u0028\u540D\u0029",
  15389. "\u3235",
  15390. "\u0028\u7279\u0029",
  15391. "\u3236",
  15392. "\u0028\u8CA1\u0029",
  15393. "\u3237",
  15394. "\u0028\u795D\u0029",
  15395. "\u3238",
  15396. "\u0028\u52B4\u0029",
  15397. "\u3239",
  15398. "\u0028\u4EE3\u0029",
  15399. "\u323A",
  15400. "\u0028\u547C\u0029",
  15401. "\u323B",
  15402. "\u0028\u5B66\u0029",
  15403. "\u323C",
  15404. "\u0028\u76E3\u0029",
  15405. "\u323D",
  15406. "\u0028\u4F01\u0029",
  15407. "\u323E",
  15408. "\u0028\u8CC7\u0029",
  15409. "\u323F",
  15410. "\u0028\u5354\u0029",
  15411. "\u3240",
  15412. "\u0028\u796D\u0029",
  15413. "\u3241",
  15414. "\u0028\u4F11\u0029",
  15415. "\u3242",
  15416. "\u0028\u81EA\u0029",
  15417. "\u3243",
  15418. "\u0028\u81F3\u0029",
  15419. "\u32C0",
  15420. "\u0031\u6708",
  15421. "\u32C1",
  15422. "\u0032\u6708",
  15423. "\u32C2",
  15424. "\u0033\u6708",
  15425. "\u32C3",
  15426. "\u0034\u6708",
  15427. "\u32C4",
  15428. "\u0035\u6708",
  15429. "\u32C5",
  15430. "\u0036\u6708",
  15431. "\u32C6",
  15432. "\u0037\u6708",
  15433. "\u32C7",
  15434. "\u0038\u6708",
  15435. "\u32C8",
  15436. "\u0039\u6708",
  15437. "\u32C9",
  15438. "\u0031\u0030\u6708",
  15439. "\u32CA",
  15440. "\u0031\u0031\u6708",
  15441. "\u32CB",
  15442. "\u0031\u0032\u6708",
  15443. "\u3358",
  15444. "\u0030\u70B9",
  15445. "\u3359",
  15446. "\u0031\u70B9",
  15447. "\u335A",
  15448. "\u0032\u70B9",
  15449. "\u335B",
  15450. "\u0033\u70B9",
  15451. "\u335C",
  15452. "\u0034\u70B9",
  15453. "\u335D",
  15454. "\u0035\u70B9",
  15455. "\u335E",
  15456. "\u0036\u70B9",
  15457. "\u335F",
  15458. "\u0037\u70B9",
  15459. "\u3360",
  15460. "\u0038\u70B9",
  15461. "\u3361",
  15462. "\u0039\u70B9",
  15463. "\u3362",
  15464. "\u0031\u0030\u70B9",
  15465. "\u3363",
  15466. "\u0031\u0031\u70B9",
  15467. "\u3364",
  15468. "\u0031\u0032\u70B9",
  15469. "\u3365",
  15470. "\u0031\u0033\u70B9",
  15471. "\u3366",
  15472. "\u0031\u0034\u70B9",
  15473. "\u3367",
  15474. "\u0031\u0035\u70B9",
  15475. "\u3368",
  15476. "\u0031\u0036\u70B9",
  15477. "\u3369",
  15478. "\u0031\u0037\u70B9",
  15479. "\u336A",
  15480. "\u0031\u0038\u70B9",
  15481. "\u336B",
  15482. "\u0031\u0039\u70B9",
  15483. "\u336C",
  15484. "\u0032\u0030\u70B9",
  15485. "\u336D",
  15486. "\u0032\u0031\u70B9",
  15487. "\u336E",
  15488. "\u0032\u0032\u70B9",
  15489. "\u336F",
  15490. "\u0032\u0033\u70B9",
  15491. "\u3370",
  15492. "\u0032\u0034\u70B9",
  15493. "\u33E0",
  15494. "\u0031\u65E5",
  15495. "\u33E1",
  15496. "\u0032\u65E5",
  15497. "\u33E2",
  15498. "\u0033\u65E5",
  15499. "\u33E3",
  15500. "\u0034\u65E5",
  15501. "\u33E4",
  15502. "\u0035\u65E5",
  15503. "\u33E5",
  15504. "\u0036\u65E5",
  15505. "\u33E6",
  15506. "\u0037\u65E5",
  15507. "\u33E7",
  15508. "\u0038\u65E5",
  15509. "\u33E8",
  15510. "\u0039\u65E5",
  15511. "\u33E9",
  15512. "\u0031\u0030\u65E5",
  15513. "\u33EA",
  15514. "\u0031\u0031\u65E5",
  15515. "\u33EB",
  15516. "\u0031\u0032\u65E5",
  15517. "\u33EC",
  15518. "\u0031\u0033\u65E5",
  15519. "\u33ED",
  15520. "\u0031\u0034\u65E5",
  15521. "\u33EE",
  15522. "\u0031\u0035\u65E5",
  15523. "\u33EF",
  15524. "\u0031\u0036\u65E5",
  15525. "\u33F0",
  15526. "\u0031\u0037\u65E5",
  15527. "\u33F1",
  15528. "\u0031\u0038\u65E5",
  15529. "\u33F2",
  15530. "\u0031\u0039\u65E5",
  15531. "\u33F3",
  15532. "\u0032\u0030\u65E5",
  15533. "\u33F4",
  15534. "\u0032\u0031\u65E5",
  15535. "\u33F5",
  15536. "\u0032\u0032\u65E5",
  15537. "\u33F6",
  15538. "\u0032\u0033\u65E5",
  15539. "\u33F7",
  15540. "\u0032\u0034\u65E5",
  15541. "\u33F8",
  15542. "\u0032\u0035\u65E5",
  15543. "\u33F9",
  15544. "\u0032\u0036\u65E5",
  15545. "\u33FA",
  15546. "\u0032\u0037\u65E5",
  15547. "\u33FB",
  15548. "\u0032\u0038\u65E5",
  15549. "\u33FC",
  15550. "\u0032\u0039\u65E5",
  15551. "\u33FD",
  15552. "\u0033\u0030\u65E5",
  15553. "\u33FE",
  15554. "\u0033\u0031\u65E5",
  15555. "\uFB00",
  15556. "\u0066\u0066",
  15557. "\uFB01",
  15558. "\u0066\u0069",
  15559. "\uFB02",
  15560. "\u0066\u006C",
  15561. "\uFB03",
  15562. "\u0066\u0066\u0069",
  15563. "\uFB04",
  15564. "\u0066\u0066\u006C",
  15565. "\uFB05",
  15566. "\u017F\u0074",
  15567. "\uFB06",
  15568. "\u0073\u0074",
  15569. "\uFB13",
  15570. "\u0574\u0576",
  15571. "\uFB14",
  15572. "\u0574\u0565",
  15573. "\uFB15",
  15574. "\u0574\u056B",
  15575. "\uFB16",
  15576. "\u057E\u0576",
  15577. "\uFB17",
  15578. "\u0574\u056D",
  15579. "\uFB4F",
  15580. "\u05D0\u05DC",
  15581. "\uFB50",
  15582. "\u0671",
  15583. "\uFB51",
  15584. "\u0671",
  15585. "\uFB52",
  15586. "\u067B",
  15587. "\uFB53",
  15588. "\u067B",
  15589. "\uFB54",
  15590. "\u067B",
  15591. "\uFB55",
  15592. "\u067B",
  15593. "\uFB56",
  15594. "\u067E",
  15595. "\uFB57",
  15596. "\u067E",
  15597. "\uFB58",
  15598. "\u067E",
  15599. "\uFB59",
  15600. "\u067E",
  15601. "\uFB5A",
  15602. "\u0680",
  15603. "\uFB5B",
  15604. "\u0680",
  15605. "\uFB5C",
  15606. "\u0680",
  15607. "\uFB5D",
  15608. "\u0680",
  15609. "\uFB5E",
  15610. "\u067A",
  15611. "\uFB5F",
  15612. "\u067A",
  15613. "\uFB60",
  15614. "\u067A",
  15615. "\uFB61",
  15616. "\u067A",
  15617. "\uFB62",
  15618. "\u067F",
  15619. "\uFB63",
  15620. "\u067F",
  15621. "\uFB64",
  15622. "\u067F",
  15623. "\uFB65",
  15624. "\u067F",
  15625. "\uFB66",
  15626. "\u0679",
  15627. "\uFB67",
  15628. "\u0679",
  15629. "\uFB68",
  15630. "\u0679",
  15631. "\uFB69",
  15632. "\u0679",
  15633. "\uFB6A",
  15634. "\u06A4",
  15635. "\uFB6B",
  15636. "\u06A4",
  15637. "\uFB6C",
  15638. "\u06A4",
  15639. "\uFB6D",
  15640. "\u06A4",
  15641. "\uFB6E",
  15642. "\u06A6",
  15643. "\uFB6F",
  15644. "\u06A6",
  15645. "\uFB70",
  15646. "\u06A6",
  15647. "\uFB71",
  15648. "\u06A6",
  15649. "\uFB72",
  15650. "\u0684",
  15651. "\uFB73",
  15652. "\u0684",
  15653. "\uFB74",
  15654. "\u0684",
  15655. "\uFB75",
  15656. "\u0684",
  15657. "\uFB76",
  15658. "\u0683",
  15659. "\uFB77",
  15660. "\u0683",
  15661. "\uFB78",
  15662. "\u0683",
  15663. "\uFB79",
  15664. "\u0683",
  15665. "\uFB7A",
  15666. "\u0686",
  15667. "\uFB7B",
  15668. "\u0686",
  15669. "\uFB7C",
  15670. "\u0686",
  15671. "\uFB7D",
  15672. "\u0686",
  15673. "\uFB7E",
  15674. "\u0687",
  15675. "\uFB7F",
  15676. "\u0687",
  15677. "\uFB80",
  15678. "\u0687",
  15679. "\uFB81",
  15680. "\u0687",
  15681. "\uFB82",
  15682. "\u068D",
  15683. "\uFB83",
  15684. "\u068D",
  15685. "\uFB84",
  15686. "\u068C",
  15687. "\uFB85",
  15688. "\u068C",
  15689. "\uFB86",
  15690. "\u068E",
  15691. "\uFB87",
  15692. "\u068E",
  15693. "\uFB88",
  15694. "\u0688",
  15695. "\uFB89",
  15696. "\u0688",
  15697. "\uFB8A",
  15698. "\u0698",
  15699. "\uFB8B",
  15700. "\u0698",
  15701. "\uFB8C",
  15702. "\u0691",
  15703. "\uFB8D",
  15704. "\u0691",
  15705. "\uFB8E",
  15706. "\u06A9",
  15707. "\uFB8F",
  15708. "\u06A9",
  15709. "\uFB90",
  15710. "\u06A9",
  15711. "\uFB91",
  15712. "\u06A9",
  15713. "\uFB92",
  15714. "\u06AF",
  15715. "\uFB93",
  15716. "\u06AF",
  15717. "\uFB94",
  15718. "\u06AF",
  15719. "\uFB95",
  15720. "\u06AF",
  15721. "\uFB96",
  15722. "\u06B3",
  15723. "\uFB97",
  15724. "\u06B3",
  15725. "\uFB98",
  15726. "\u06B3",
  15727. "\uFB99",
  15728. "\u06B3",
  15729. "\uFB9A",
  15730. "\u06B1",
  15731. "\uFB9B",
  15732. "\u06B1",
  15733. "\uFB9C",
  15734. "\u06B1",
  15735. "\uFB9D",
  15736. "\u06B1",
  15737. "\uFB9E",
  15738. "\u06BA",
  15739. "\uFB9F",
  15740. "\u06BA",
  15741. "\uFBA0",
  15742. "\u06BB",
  15743. "\uFBA1",
  15744. "\u06BB",
  15745. "\uFBA2",
  15746. "\u06BB",
  15747. "\uFBA3",
  15748. "\u06BB",
  15749. "\uFBA4",
  15750. "\u06C0",
  15751. "\uFBA5",
  15752. "\u06C0",
  15753. "\uFBA6",
  15754. "\u06C1",
  15755. "\uFBA7",
  15756. "\u06C1",
  15757. "\uFBA8",
  15758. "\u06C1",
  15759. "\uFBA9",
  15760. "\u06C1",
  15761. "\uFBAA",
  15762. "\u06BE",
  15763. "\uFBAB",
  15764. "\u06BE",
  15765. "\uFBAC",
  15766. "\u06BE",
  15767. "\uFBAD",
  15768. "\u06BE",
  15769. "\uFBAE",
  15770. "\u06D2",
  15771. "\uFBAF",
  15772. "\u06D2",
  15773. "\uFBB0",
  15774. "\u06D3",
  15775. "\uFBB1",
  15776. "\u06D3",
  15777. "\uFBD3",
  15778. "\u06AD",
  15779. "\uFBD4",
  15780. "\u06AD",
  15781. "\uFBD5",
  15782. "\u06AD",
  15783. "\uFBD6",
  15784. "\u06AD",
  15785. "\uFBD7",
  15786. "\u06C7",
  15787. "\uFBD8",
  15788. "\u06C7",
  15789. "\uFBD9",
  15790. "\u06C6",
  15791. "\uFBDA",
  15792. "\u06C6",
  15793. "\uFBDB",
  15794. "\u06C8",
  15795. "\uFBDC",
  15796. "\u06C8",
  15797. "\uFBDD",
  15798. "\u0677",
  15799. "\uFBDE",
  15800. "\u06CB",
  15801. "\uFBDF",
  15802. "\u06CB",
  15803. "\uFBE0",
  15804. "\u06C5",
  15805. "\uFBE1",
  15806. "\u06C5",
  15807. "\uFBE2",
  15808. "\u06C9",
  15809. "\uFBE3",
  15810. "\u06C9",
  15811. "\uFBE4",
  15812. "\u06D0",
  15813. "\uFBE5",
  15814. "\u06D0",
  15815. "\uFBE6",
  15816. "\u06D0",
  15817. "\uFBE7",
  15818. "\u06D0",
  15819. "\uFBE8",
  15820. "\u0649",
  15821. "\uFBE9",
  15822. "\u0649",
  15823. "\uFBEA",
  15824. "\u0626\u0627",
  15825. "\uFBEB",
  15826. "\u0626\u0627",
  15827. "\uFBEC",
  15828. "\u0626\u06D5",
  15829. "\uFBED",
  15830. "\u0626\u06D5",
  15831. "\uFBEE",
  15832. "\u0626\u0648",
  15833. "\uFBEF",
  15834. "\u0626\u0648",
  15835. "\uFBF0",
  15836. "\u0626\u06C7",
  15837. "\uFBF1",
  15838. "\u0626\u06C7",
  15839. "\uFBF2",
  15840. "\u0626\u06C6",
  15841. "\uFBF3",
  15842. "\u0626\u06C6",
  15843. "\uFBF4",
  15844. "\u0626\u06C8",
  15845. "\uFBF5",
  15846. "\u0626\u06C8",
  15847. "\uFBF6",
  15848. "\u0626\u06D0",
  15849. "\uFBF7",
  15850. "\u0626\u06D0",
  15851. "\uFBF8",
  15852. "\u0626\u06D0",
  15853. "\uFBF9",
  15854. "\u0626\u0649",
  15855. "\uFBFA",
  15856. "\u0626\u0649",
  15857. "\uFBFB",
  15858. "\u0626\u0649",
  15859. "\uFBFC",
  15860. "\u06CC",
  15861. "\uFBFD",
  15862. "\u06CC",
  15863. "\uFBFE",
  15864. "\u06CC",
  15865. "\uFBFF",
  15866. "\u06CC",
  15867. "\uFC00",
  15868. "\u0626\u062C",
  15869. "\uFC01",
  15870. "\u0626\u062D",
  15871. "\uFC02",
  15872. "\u0626\u0645",
  15873. "\uFC03",
  15874. "\u0626\u0649",
  15875. "\uFC04",
  15876. "\u0626\u064A",
  15877. "\uFC05",
  15878. "\u0628\u062C",
  15879. "\uFC06",
  15880. "\u0628\u062D",
  15881. "\uFC07",
  15882. "\u0628\u062E",
  15883. "\uFC08",
  15884. "\u0628\u0645",
  15885. "\uFC09",
  15886. "\u0628\u0649",
  15887. "\uFC0A",
  15888. "\u0628\u064A",
  15889. "\uFC0B",
  15890. "\u062A\u062C",
  15891. "\uFC0C",
  15892. "\u062A\u062D",
  15893. "\uFC0D",
  15894. "\u062A\u062E",
  15895. "\uFC0E",
  15896. "\u062A\u0645",
  15897. "\uFC0F",
  15898. "\u062A\u0649",
  15899. "\uFC10",
  15900. "\u062A\u064A",
  15901. "\uFC11",
  15902. "\u062B\u062C",
  15903. "\uFC12",
  15904. "\u062B\u0645",
  15905. "\uFC13",
  15906. "\u062B\u0649",
  15907. "\uFC14",
  15908. "\u062B\u064A",
  15909. "\uFC15",
  15910. "\u062C\u062D",
  15911. "\uFC16",
  15912. "\u062C\u0645",
  15913. "\uFC17",
  15914. "\u062D\u062C",
  15915. "\uFC18",
  15916. "\u062D\u0645",
  15917. "\uFC19",
  15918. "\u062E\u062C",
  15919. "\uFC1A",
  15920. "\u062E\u062D",
  15921. "\uFC1B",
  15922. "\u062E\u0645",
  15923. "\uFC1C",
  15924. "\u0633\u062C",
  15925. "\uFC1D",
  15926. "\u0633\u062D",
  15927. "\uFC1E",
  15928. "\u0633\u062E",
  15929. "\uFC1F",
  15930. "\u0633\u0645",
  15931. "\uFC20",
  15932. "\u0635\u062D",
  15933. "\uFC21",
  15934. "\u0635\u0645",
  15935. "\uFC22",
  15936. "\u0636\u062C",
  15937. "\uFC23",
  15938. "\u0636\u062D",
  15939. "\uFC24",
  15940. "\u0636\u062E",
  15941. "\uFC25",
  15942. "\u0636\u0645",
  15943. "\uFC26",
  15944. "\u0637\u062D",
  15945. "\uFC27",
  15946. "\u0637\u0645",
  15947. "\uFC28",
  15948. "\u0638\u0645",
  15949. "\uFC29",
  15950. "\u0639\u062C",
  15951. "\uFC2A",
  15952. "\u0639\u0645",
  15953. "\uFC2B",
  15954. "\u063A\u062C",
  15955. "\uFC2C",
  15956. "\u063A\u0645",
  15957. "\uFC2D",
  15958. "\u0641\u062C",
  15959. "\uFC2E",
  15960. "\u0641\u062D",
  15961. "\uFC2F",
  15962. "\u0641\u062E",
  15963. "\uFC30",
  15964. "\u0641\u0645",
  15965. "\uFC31",
  15966. "\u0641\u0649",
  15967. "\uFC32",
  15968. "\u0641\u064A",
  15969. "\uFC33",
  15970. "\u0642\u062D",
  15971. "\uFC34",
  15972. "\u0642\u0645",
  15973. "\uFC35",
  15974. "\u0642\u0649",
  15975. "\uFC36",
  15976. "\u0642\u064A",
  15977. "\uFC37",
  15978. "\u0643\u0627",
  15979. "\uFC38",
  15980. "\u0643\u062C",
  15981. "\uFC39",
  15982. "\u0643\u062D",
  15983. "\uFC3A",
  15984. "\u0643\u062E",
  15985. "\uFC3B",
  15986. "\u0643\u0644",
  15987. "\uFC3C",
  15988. "\u0643\u0645",
  15989. "\uFC3D",
  15990. "\u0643\u0649",
  15991. "\uFC3E",
  15992. "\u0643\u064A",
  15993. "\uFC3F",
  15994. "\u0644\u062C",
  15995. "\uFC40",
  15996. "\u0644\u062D",
  15997. "\uFC41",
  15998. "\u0644\u062E",
  15999. "\uFC42",
  16000. "\u0644\u0645",
  16001. "\uFC43",
  16002. "\u0644\u0649",
  16003. "\uFC44",
  16004. "\u0644\u064A",
  16005. "\uFC45",
  16006. "\u0645\u062C",
  16007. "\uFC46",
  16008. "\u0645\u062D",
  16009. "\uFC47",
  16010. "\u0645\u062E",
  16011. "\uFC48",
  16012. "\u0645\u0645",
  16013. "\uFC49",
  16014. "\u0645\u0649",
  16015. "\uFC4A",
  16016. "\u0645\u064A",
  16017. "\uFC4B",
  16018. "\u0646\u062C",
  16019. "\uFC4C",
  16020. "\u0646\u062D",
  16021. "\uFC4D",
  16022. "\u0646\u062E",
  16023. "\uFC4E",
  16024. "\u0646\u0645",
  16025. "\uFC4F",
  16026. "\u0646\u0649",
  16027. "\uFC50",
  16028. "\u0646\u064A",
  16029. "\uFC51",
  16030. "\u0647\u062C",
  16031. "\uFC52",
  16032. "\u0647\u0645",
  16033. "\uFC53",
  16034. "\u0647\u0649",
  16035. "\uFC54",
  16036. "\u0647\u064A",
  16037. "\uFC55",
  16038. "\u064A\u062C",
  16039. "\uFC56",
  16040. "\u064A\u062D",
  16041. "\uFC57",
  16042. "\u064A\u062E",
  16043. "\uFC58",
  16044. "\u064A\u0645",
  16045. "\uFC59",
  16046. "\u064A\u0649",
  16047. "\uFC5A",
  16048. "\u064A\u064A",
  16049. "\uFC5B",
  16050. "\u0630\u0670",
  16051. "\uFC5C",
  16052. "\u0631\u0670",
  16053. "\uFC5D",
  16054. "\u0649\u0670",
  16055. "\uFC5E",
  16056. "\u0020\u064C\u0651",
  16057. "\uFC5F",
  16058. "\u0020\u064D\u0651",
  16059. "\uFC60",
  16060. "\u0020\u064E\u0651",
  16061. "\uFC61",
  16062. "\u0020\u064F\u0651",
  16063. "\uFC62",
  16064. "\u0020\u0650\u0651",
  16065. "\uFC63",
  16066. "\u0020\u0651\u0670",
  16067. "\uFC64",
  16068. "\u0626\u0631",
  16069. "\uFC65",
  16070. "\u0626\u0632",
  16071. "\uFC66",
  16072. "\u0626\u0645",
  16073. "\uFC67",
  16074. "\u0626\u0646",
  16075. "\uFC68",
  16076. "\u0626\u0649",
  16077. "\uFC69",
  16078. "\u0626\u064A",
  16079. "\uFC6A",
  16080. "\u0628\u0631",
  16081. "\uFC6B",
  16082. "\u0628\u0632",
  16083. "\uFC6C",
  16084. "\u0628\u0645",
  16085. "\uFC6D",
  16086. "\u0628\u0646",
  16087. "\uFC6E",
  16088. "\u0628\u0649",
  16089. "\uFC6F",
  16090. "\u0628\u064A",
  16091. "\uFC70",
  16092. "\u062A\u0631",
  16093. "\uFC71",
  16094. "\u062A\u0632",
  16095. "\uFC72",
  16096. "\u062A\u0645",
  16097. "\uFC73",
  16098. "\u062A\u0646",
  16099. "\uFC74",
  16100. "\u062A\u0649",
  16101. "\uFC75",
  16102. "\u062A\u064A",
  16103. "\uFC76",
  16104. "\u062B\u0631",
  16105. "\uFC77",
  16106. "\u062B\u0632",
  16107. "\uFC78",
  16108. "\u062B\u0645",
  16109. "\uFC79",
  16110. "\u062B\u0646",
  16111. "\uFC7A",
  16112. "\u062B\u0649",
  16113. "\uFC7B",
  16114. "\u062B\u064A",
  16115. "\uFC7C",
  16116. "\u0641\u0649",
  16117. "\uFC7D",
  16118. "\u0641\u064A",
  16119. "\uFC7E",
  16120. "\u0642\u0649",
  16121. "\uFC7F",
  16122. "\u0642\u064A",
  16123. "\uFC80",
  16124. "\u0643\u0627",
  16125. "\uFC81",
  16126. "\u0643\u0644",
  16127. "\uFC82",
  16128. "\u0643\u0645",
  16129. "\uFC83",
  16130. "\u0643\u0649",
  16131. "\uFC84",
  16132. "\u0643\u064A",
  16133. "\uFC85",
  16134. "\u0644\u0645",
  16135. "\uFC86",
  16136. "\u0644\u0649",
  16137. "\uFC87",
  16138. "\u0644\u064A",
  16139. "\uFC88",
  16140. "\u0645\u0627",
  16141. "\uFC89",
  16142. "\u0645\u0645",
  16143. "\uFC8A",
  16144. "\u0646\u0631",
  16145. "\uFC8B",
  16146. "\u0646\u0632",
  16147. "\uFC8C",
  16148. "\u0646\u0645",
  16149. "\uFC8D",
  16150. "\u0646\u0646",
  16151. "\uFC8E",
  16152. "\u0646\u0649",
  16153. "\uFC8F",
  16154. "\u0646\u064A",
  16155. "\uFC90",
  16156. "\u0649\u0670",
  16157. "\uFC91",
  16158. "\u064A\u0631",
  16159. "\uFC92",
  16160. "\u064A\u0632",
  16161. "\uFC93",
  16162. "\u064A\u0645",
  16163. "\uFC94",
  16164. "\u064A\u0646",
  16165. "\uFC95",
  16166. "\u064A\u0649",
  16167. "\uFC96",
  16168. "\u064A\u064A",
  16169. "\uFC97",
  16170. "\u0626\u062C",
  16171. "\uFC98",
  16172. "\u0626\u062D",
  16173. "\uFC99",
  16174. "\u0626\u062E",
  16175. "\uFC9A",
  16176. "\u0626\u0645",
  16177. "\uFC9B",
  16178. "\u0626\u0647",
  16179. "\uFC9C",
  16180. "\u0628\u062C",
  16181. "\uFC9D",
  16182. "\u0628\u062D",
  16183. "\uFC9E",
  16184. "\u0628\u062E",
  16185. "\uFC9F",
  16186. "\u0628\u0645",
  16187. "\uFCA0",
  16188. "\u0628\u0647",
  16189. "\uFCA1",
  16190. "\u062A\u062C",
  16191. "\uFCA2",
  16192. "\u062A\u062D",
  16193. "\uFCA3",
  16194. "\u062A\u062E",
  16195. "\uFCA4",
  16196. "\u062A\u0645",
  16197. "\uFCA5",
  16198. "\u062A\u0647",
  16199. "\uFCA6",
  16200. "\u062B\u0645",
  16201. "\uFCA7",
  16202. "\u062C\u062D",
  16203. "\uFCA8",
  16204. "\u062C\u0645",
  16205. "\uFCA9",
  16206. "\u062D\u062C",
  16207. "\uFCAA",
  16208. "\u062D\u0645",
  16209. "\uFCAB",
  16210. "\u062E\u062C",
  16211. "\uFCAC",
  16212. "\u062E\u0645",
  16213. "\uFCAD",
  16214. "\u0633\u062C",
  16215. "\uFCAE",
  16216. "\u0633\u062D",
  16217. "\uFCAF",
  16218. "\u0633\u062E",
  16219. "\uFCB0",
  16220. "\u0633\u0645",
  16221. "\uFCB1",
  16222. "\u0635\u062D",
  16223. "\uFCB2",
  16224. "\u0635\u062E",
  16225. "\uFCB3",
  16226. "\u0635\u0645",
  16227. "\uFCB4",
  16228. "\u0636\u062C",
  16229. "\uFCB5",
  16230. "\u0636\u062D",
  16231. "\uFCB6",
  16232. "\u0636\u062E",
  16233. "\uFCB7",
  16234. "\u0636\u0645",
  16235. "\uFCB8",
  16236. "\u0637\u062D",
  16237. "\uFCB9",
  16238. "\u0638\u0645",
  16239. "\uFCBA",
  16240. "\u0639\u062C",
  16241. "\uFCBB",
  16242. "\u0639\u0645",
  16243. "\uFCBC",
  16244. "\u063A\u062C",
  16245. "\uFCBD",
  16246. "\u063A\u0645",
  16247. "\uFCBE",
  16248. "\u0641\u062C",
  16249. "\uFCBF",
  16250. "\u0641\u062D",
  16251. "\uFCC0",
  16252. "\u0641\u062E",
  16253. "\uFCC1",
  16254. "\u0641\u0645",
  16255. "\uFCC2",
  16256. "\u0642\u062D",
  16257. "\uFCC3",
  16258. "\u0642\u0645",
  16259. "\uFCC4",
  16260. "\u0643\u062C",
  16261. "\uFCC5",
  16262. "\u0643\u062D",
  16263. "\uFCC6",
  16264. "\u0643\u062E",
  16265. "\uFCC7",
  16266. "\u0643\u0644",
  16267. "\uFCC8",
  16268. "\u0643\u0645",
  16269. "\uFCC9",
  16270. "\u0644\u062C",
  16271. "\uFCCA",
  16272. "\u0644\u062D",
  16273. "\uFCCB",
  16274. "\u0644\u062E",
  16275. "\uFCCC",
  16276. "\u0644\u0645",
  16277. "\uFCCD",
  16278. "\u0644\u0647",
  16279. "\uFCCE",
  16280. "\u0645\u062C",
  16281. "\uFCCF",
  16282. "\u0645\u062D",
  16283. "\uFCD0",
  16284. "\u0645\u062E",
  16285. "\uFCD1",
  16286. "\u0645\u0645",
  16287. "\uFCD2",
  16288. "\u0646\u062C",
  16289. "\uFCD3",
  16290. "\u0646\u062D",
  16291. "\uFCD4",
  16292. "\u0646\u062E",
  16293. "\uFCD5",
  16294. "\u0646\u0645",
  16295. "\uFCD6",
  16296. "\u0646\u0647",
  16297. "\uFCD7",
  16298. "\u0647\u062C",
  16299. "\uFCD8",
  16300. "\u0647\u0645",
  16301. "\uFCD9",
  16302. "\u0647\u0670",
  16303. "\uFCDA",
  16304. "\u064A\u062C",
  16305. "\uFCDB",
  16306. "\u064A\u062D",
  16307. "\uFCDC",
  16308. "\u064A\u062E",
  16309. "\uFCDD",
  16310. "\u064A\u0645",
  16311. "\uFCDE",
  16312. "\u064A\u0647",
  16313. "\uFCDF",
  16314. "\u0626\u0645",
  16315. "\uFCE0",
  16316. "\u0626\u0647",
  16317. "\uFCE1",
  16318. "\u0628\u0645",
  16319. "\uFCE2",
  16320. "\u0628\u0647",
  16321. "\uFCE3",
  16322. "\u062A\u0645",
  16323. "\uFCE4",
  16324. "\u062A\u0647",
  16325. "\uFCE5",
  16326. "\u062B\u0645",
  16327. "\uFCE6",
  16328. "\u062B\u0647",
  16329. "\uFCE7",
  16330. "\u0633\u0645",
  16331. "\uFCE8",
  16332. "\u0633\u0647",
  16333. "\uFCE9",
  16334. "\u0634\u0645",
  16335. "\uFCEA",
  16336. "\u0634\u0647",
  16337. "\uFCEB",
  16338. "\u0643\u0644",
  16339. "\uFCEC",
  16340. "\u0643\u0645",
  16341. "\uFCED",
  16342. "\u0644\u0645",
  16343. "\uFCEE",
  16344. "\u0646\u0645",
  16345. "\uFCEF",
  16346. "\u0646\u0647",
  16347. "\uFCF0",
  16348. "\u064A\u0645",
  16349. "\uFCF1",
  16350. "\u064A\u0647",
  16351. "\uFCF2",
  16352. "\u0640\u064E\u0651",
  16353. "\uFCF3",
  16354. "\u0640\u064F\u0651",
  16355. "\uFCF4",
  16356. "\u0640\u0650\u0651",
  16357. "\uFCF5",
  16358. "\u0637\u0649",
  16359. "\uFCF6",
  16360. "\u0637\u064A",
  16361. "\uFCF7",
  16362. "\u0639\u0649",
  16363. "\uFCF8",
  16364. "\u0639\u064A",
  16365. "\uFCF9",
  16366. "\u063A\u0649",
  16367. "\uFCFA",
  16368. "\u063A\u064A",
  16369. "\uFCFB",
  16370. "\u0633\u0649",
  16371. "\uFCFC",
  16372. "\u0633\u064A",
  16373. "\uFCFD",
  16374. "\u0634\u0649",
  16375. "\uFCFE",
  16376. "\u0634\u064A",
  16377. "\uFCFF",
  16378. "\u062D\u0649",
  16379. "\uFD00",
  16380. "\u062D\u064A",
  16381. "\uFD01",
  16382. "\u062C\u0649",
  16383. "\uFD02",
  16384. "\u062C\u064A",
  16385. "\uFD03",
  16386. "\u062E\u0649",
  16387. "\uFD04",
  16388. "\u062E\u064A",
  16389. "\uFD05",
  16390. "\u0635\u0649",
  16391. "\uFD06",
  16392. "\u0635\u064A",
  16393. "\uFD07",
  16394. "\u0636\u0649",
  16395. "\uFD08",
  16396. "\u0636\u064A",
  16397. "\uFD09",
  16398. "\u0634\u062C",
  16399. "\uFD0A",
  16400. "\u0634\u062D",
  16401. "\uFD0B",
  16402. "\u0634\u062E",
  16403. "\uFD0C",
  16404. "\u0634\u0645",
  16405. "\uFD0D",
  16406. "\u0634\u0631",
  16407. "\uFD0E",
  16408. "\u0633\u0631",
  16409. "\uFD0F",
  16410. "\u0635\u0631",
  16411. "\uFD10",
  16412. "\u0636\u0631",
  16413. "\uFD11",
  16414. "\u0637\u0649",
  16415. "\uFD12",
  16416. "\u0637\u064A",
  16417. "\uFD13",
  16418. "\u0639\u0649",
  16419. "\uFD14",
  16420. "\u0639\u064A",
  16421. "\uFD15",
  16422. "\u063A\u0649",
  16423. "\uFD16",
  16424. "\u063A\u064A",
  16425. "\uFD17",
  16426. "\u0633\u0649",
  16427. "\uFD18",
  16428. "\u0633\u064A",
  16429. "\uFD19",
  16430. "\u0634\u0649",
  16431. "\uFD1A",
  16432. "\u0634\u064A",
  16433. "\uFD1B",
  16434. "\u062D\u0649",
  16435. "\uFD1C",
  16436. "\u062D\u064A",
  16437. "\uFD1D",
  16438. "\u062C\u0649",
  16439. "\uFD1E",
  16440. "\u062C\u064A",
  16441. "\uFD1F",
  16442. "\u062E\u0649",
  16443. "\uFD20",
  16444. "\u062E\u064A",
  16445. "\uFD21",
  16446. "\u0635\u0649",
  16447. "\uFD22",
  16448. "\u0635\u064A",
  16449. "\uFD23",
  16450. "\u0636\u0649",
  16451. "\uFD24",
  16452. "\u0636\u064A",
  16453. "\uFD25",
  16454. "\u0634\u062C",
  16455. "\uFD26",
  16456. "\u0634\u062D",
  16457. "\uFD27",
  16458. "\u0634\u062E",
  16459. "\uFD28",
  16460. "\u0634\u0645",
  16461. "\uFD29",
  16462. "\u0634\u0631",
  16463. "\uFD2A",
  16464. "\u0633\u0631",
  16465. "\uFD2B",
  16466. "\u0635\u0631",
  16467. "\uFD2C",
  16468. "\u0636\u0631",
  16469. "\uFD2D",
  16470. "\u0634\u062C",
  16471. "\uFD2E",
  16472. "\u0634\u062D",
  16473. "\uFD2F",
  16474. "\u0634\u062E",
  16475. "\uFD30",
  16476. "\u0634\u0645",
  16477. "\uFD31",
  16478. "\u0633\u0647",
  16479. "\uFD32",
  16480. "\u0634\u0647",
  16481. "\uFD33",
  16482. "\u0637\u0645",
  16483. "\uFD34",
  16484. "\u0633\u062C",
  16485. "\uFD35",
  16486. "\u0633\u062D",
  16487. "\uFD36",
  16488. "\u0633\u062E",
  16489. "\uFD37",
  16490. "\u0634\u062C",
  16491. "\uFD38",
  16492. "\u0634\u062D",
  16493. "\uFD39",
  16494. "\u0634\u062E",
  16495. "\uFD3A",
  16496. "\u0637\u0645",
  16497. "\uFD3B",
  16498. "\u0638\u0645",
  16499. "\uFD3C",
  16500. "\u0627\u064B",
  16501. "\uFD3D",
  16502. "\u0627\u064B",
  16503. "\uFD50",
  16504. "\u062A\u062C\u0645",
  16505. "\uFD51",
  16506. "\u062A\u062D\u062C",
  16507. "\uFD52",
  16508. "\u062A\u062D\u062C",
  16509. "\uFD53",
  16510. "\u062A\u062D\u0645",
  16511. "\uFD54",
  16512. "\u062A\u062E\u0645",
  16513. "\uFD55",
  16514. "\u062A\u0645\u062C",
  16515. "\uFD56",
  16516. "\u062A\u0645\u062D",
  16517. "\uFD57",
  16518. "\u062A\u0645\u062E",
  16519. "\uFD58",
  16520. "\u062C\u0645\u062D",
  16521. "\uFD59",
  16522. "\u062C\u0645\u062D",
  16523. "\uFD5A",
  16524. "\u062D\u0645\u064A",
  16525. "\uFD5B",
  16526. "\u062D\u0645\u0649",
  16527. "\uFD5C",
  16528. "\u0633\u062D\u062C",
  16529. "\uFD5D",
  16530. "\u0633\u062C\u062D",
  16531. "\uFD5E",
  16532. "\u0633\u062C\u0649",
  16533. "\uFD5F",
  16534. "\u0633\u0645\u062D",
  16535. "\uFD60",
  16536. "\u0633\u0645\u062D",
  16537. "\uFD61",
  16538. "\u0633\u0645\u062C",
  16539. "\uFD62",
  16540. "\u0633\u0645\u0645",
  16541. "\uFD63",
  16542. "\u0633\u0645\u0645",
  16543. "\uFD64",
  16544. "\u0635\u062D\u062D",
  16545. "\uFD65",
  16546. "\u0635\u062D\u062D",
  16547. "\uFD66",
  16548. "\u0635\u0645\u0645",
  16549. "\uFD67",
  16550. "\u0634\u062D\u0645",
  16551. "\uFD68",
  16552. "\u0634\u062D\u0645",
  16553. "\uFD69",
  16554. "\u0634\u062C\u064A",
  16555. "\uFD6A",
  16556. "\u0634\u0645\u062E",
  16557. "\uFD6B",
  16558. "\u0634\u0645\u062E",
  16559. "\uFD6C",
  16560. "\u0634\u0645\u0645",
  16561. "\uFD6D",
  16562. "\u0634\u0645\u0645",
  16563. "\uFD6E",
  16564. "\u0636\u062D\u0649",
  16565. "\uFD6F",
  16566. "\u0636\u062E\u0645",
  16567. "\uFD70",
  16568. "\u0636\u062E\u0645",
  16569. "\uFD71",
  16570. "\u0637\u0645\u062D",
  16571. "\uFD72",
  16572. "\u0637\u0645\u062D",
  16573. "\uFD73",
  16574. "\u0637\u0645\u0645",
  16575. "\uFD74",
  16576. "\u0637\u0645\u064A",
  16577. "\uFD75",
  16578. "\u0639\u062C\u0645",
  16579. "\uFD76",
  16580. "\u0639\u0645\u0645",
  16581. "\uFD77",
  16582. "\u0639\u0645\u0645",
  16583. "\uFD78",
  16584. "\u0639\u0645\u0649",
  16585. "\uFD79",
  16586. "\u063A\u0645\u0645",
  16587. "\uFD7A",
  16588. "\u063A\u0645\u064A",
  16589. "\uFD7B",
  16590. "\u063A\u0645\u0649",
  16591. "\uFD7C",
  16592. "\u0641\u062E\u0645",
  16593. "\uFD7D",
  16594. "\u0641\u062E\u0645",
  16595. "\uFD7E",
  16596. "\u0642\u0645\u062D",
  16597. "\uFD7F",
  16598. "\u0642\u0645\u0645",
  16599. "\uFD80",
  16600. "\u0644\u062D\u0645",
  16601. "\uFD81",
  16602. "\u0644\u062D\u064A",
  16603. "\uFD82",
  16604. "\u0644\u062D\u0649",
  16605. "\uFD83",
  16606. "\u0644\u062C\u062C",
  16607. "\uFD84",
  16608. "\u0644\u062C\u062C",
  16609. "\uFD85",
  16610. "\u0644\u062E\u0645",
  16611. "\uFD86",
  16612. "\u0644\u062E\u0645",
  16613. "\uFD87",
  16614. "\u0644\u0645\u062D",
  16615. "\uFD88",
  16616. "\u0644\u0645\u062D",
  16617. "\uFD89",
  16618. "\u0645\u062D\u062C",
  16619. "\uFD8A",
  16620. "\u0645\u062D\u0645",
  16621. "\uFD8B",
  16622. "\u0645\u062D\u064A",
  16623. "\uFD8C",
  16624. "\u0645\u062C\u062D",
  16625. "\uFD8D",
  16626. "\u0645\u062C\u0645",
  16627. "\uFD8E",
  16628. "\u0645\u062E\u062C",
  16629. "\uFD8F",
  16630. "\u0645\u062E\u0645",
  16631. "\uFD92",
  16632. "\u0645\u062C\u062E",
  16633. "\uFD93",
  16634. "\u0647\u0645\u062C",
  16635. "\uFD94",
  16636. "\u0647\u0645\u0645",
  16637. "\uFD95",
  16638. "\u0646\u062D\u0645",
  16639. "\uFD96",
  16640. "\u0646\u062D\u0649",
  16641. "\uFD97",
  16642. "\u0646\u062C\u0645",
  16643. "\uFD98",
  16644. "\u0646\u062C\u0645",
  16645. "\uFD99",
  16646. "\u0646\u062C\u0649",
  16647. "\uFD9A",
  16648. "\u0646\u0645\u064A",
  16649. "\uFD9B",
  16650. "\u0646\u0645\u0649",
  16651. "\uFD9C",
  16652. "\u064A\u0645\u0645",
  16653. "\uFD9D",
  16654. "\u064A\u0645\u0645",
  16655. "\uFD9E",
  16656. "\u0628\u062E\u064A",
  16657. "\uFD9F",
  16658. "\u062A\u062C\u064A",
  16659. "\uFDA0",
  16660. "\u062A\u062C\u0649",
  16661. "\uFDA1",
  16662. "\u062A\u062E\u064A",
  16663. "\uFDA2",
  16664. "\u062A\u062E\u0649",
  16665. "\uFDA3",
  16666. "\u062A\u0645\u064A",
  16667. "\uFDA4",
  16668. "\u062A\u0645\u0649",
  16669. "\uFDA5",
  16670. "\u062C\u0645\u064A",
  16671. "\uFDA6",
  16672. "\u062C\u062D\u0649",
  16673. "\uFDA7",
  16674. "\u062C\u0645\u0649",
  16675. "\uFDA8",
  16676. "\u0633\u062E\u0649",
  16677. "\uFDA9",
  16678. "\u0635\u062D\u064A",
  16679. "\uFDAA",
  16680. "\u0634\u062D\u064A",
  16681. "\uFDAB",
  16682. "\u0636\u062D\u064A",
  16683. "\uFDAC",
  16684. "\u0644\u062C\u064A",
  16685. "\uFDAD",
  16686. "\u0644\u0645\u064A",
  16687. "\uFDAE",
  16688. "\u064A\u062D\u064A",
  16689. "\uFDAF",
  16690. "\u064A\u062C\u064A",
  16691. "\uFDB0",
  16692. "\u064A\u0645\u064A",
  16693. "\uFDB1",
  16694. "\u0645\u0645\u064A",
  16695. "\uFDB2",
  16696. "\u0642\u0645\u064A",
  16697. "\uFDB3",
  16698. "\u0646\u062D\u064A",
  16699. "\uFDB4",
  16700. "\u0642\u0645\u062D",
  16701. "\uFDB5",
  16702. "\u0644\u062D\u0645",
  16703. "\uFDB6",
  16704. "\u0639\u0645\u064A",
  16705. "\uFDB7",
  16706. "\u0643\u0645\u064A",
  16707. "\uFDB8",
  16708. "\u0646\u062C\u062D",
  16709. "\uFDB9",
  16710. "\u0645\u062E\u064A",
  16711. "\uFDBA",
  16712. "\u0644\u062C\u0645",
  16713. "\uFDBB",
  16714. "\u0643\u0645\u0645",
  16715. "\uFDBC",
  16716. "\u0644\u062C\u0645",
  16717. "\uFDBD",
  16718. "\u0646\u062C\u062D",
  16719. "\uFDBE",
  16720. "\u062C\u062D\u064A",
  16721. "\uFDBF",
  16722. "\u062D\u062C\u064A",
  16723. "\uFDC0",
  16724. "\u0645\u062C\u064A",
  16725. "\uFDC1",
  16726. "\u0641\u0645\u064A",
  16727. "\uFDC2",
  16728. "\u0628\u062D\u064A",
  16729. "\uFDC3",
  16730. "\u0643\u0645\u0645",
  16731. "\uFDC4",
  16732. "\u0639\u062C\u0645",
  16733. "\uFDC5",
  16734. "\u0635\u0645\u0645",
  16735. "\uFDC6",
  16736. "\u0633\u062E\u064A",
  16737. "\uFDC7",
  16738. "\u0646\u062C\u064A",
  16739. "\uFE49",
  16740. "\u203E",
  16741. "\uFE4A",
  16742. "\u203E",
  16743. "\uFE4B",
  16744. "\u203E",
  16745. "\uFE4C",
  16746. "\u203E",
  16747. "\uFE4D",
  16748. "\u005F",
  16749. "\uFE4E",
  16750. "\u005F",
  16751. "\uFE4F",
  16752. "\u005F",
  16753. "\uFE80",
  16754. "\u0621",
  16755. "\uFE81",
  16756. "\u0622",
  16757. "\uFE82",
  16758. "\u0622",
  16759. "\uFE83",
  16760. "\u0623",
  16761. "\uFE84",
  16762. "\u0623",
  16763. "\uFE85",
  16764. "\u0624",
  16765. "\uFE86",
  16766. "\u0624",
  16767. "\uFE87",
  16768. "\u0625",
  16769. "\uFE88",
  16770. "\u0625",
  16771. "\uFE89",
  16772. "\u0626",
  16773. "\uFE8A",
  16774. "\u0626",
  16775. "\uFE8B",
  16776. "\u0626",
  16777. "\uFE8C",
  16778. "\u0626",
  16779. "\uFE8D",
  16780. "\u0627",
  16781. "\uFE8E",
  16782. "\u0627",
  16783. "\uFE8F",
  16784. "\u0628",
  16785. "\uFE90",
  16786. "\u0628",
  16787. "\uFE91",
  16788. "\u0628",
  16789. "\uFE92",
  16790. "\u0628",
  16791. "\uFE93",
  16792. "\u0629",
  16793. "\uFE94",
  16794. "\u0629",
  16795. "\uFE95",
  16796. "\u062A",
  16797. "\uFE96",
  16798. "\u062A",
  16799. "\uFE97",
  16800. "\u062A",
  16801. "\uFE98",
  16802. "\u062A",
  16803. "\uFE99",
  16804. "\u062B",
  16805. "\uFE9A",
  16806. "\u062B",
  16807. "\uFE9B",
  16808. "\u062B",
  16809. "\uFE9C",
  16810. "\u062B",
  16811. "\uFE9D",
  16812. "\u062C",
  16813. "\uFE9E",
  16814. "\u062C",
  16815. "\uFE9F",
  16816. "\u062C",
  16817. "\uFEA0",
  16818. "\u062C",
  16819. "\uFEA1",
  16820. "\u062D",
  16821. "\uFEA2",
  16822. "\u062D",
  16823. "\uFEA3",
  16824. "\u062D",
  16825. "\uFEA4",
  16826. "\u062D",
  16827. "\uFEA5",
  16828. "\u062E",
  16829. "\uFEA6",
  16830. "\u062E",
  16831. "\uFEA7",
  16832. "\u062E",
  16833. "\uFEA8",
  16834. "\u062E",
  16835. "\uFEA9",
  16836. "\u062F",
  16837. "\uFEAA",
  16838. "\u062F",
  16839. "\uFEAB",
  16840. "\u0630",
  16841. "\uFEAC",
  16842. "\u0630",
  16843. "\uFEAD",
  16844. "\u0631",
  16845. "\uFEAE",
  16846. "\u0631",
  16847. "\uFEAF",
  16848. "\u0632",
  16849. "\uFEB0",
  16850. "\u0632",
  16851. "\uFEB1",
  16852. "\u0633",
  16853. "\uFEB2",
  16854. "\u0633",
  16855. "\uFEB3",
  16856. "\u0633",
  16857. "\uFEB4",
  16858. "\u0633",
  16859. "\uFEB5",
  16860. "\u0634",
  16861. "\uFEB6",
  16862. "\u0634",
  16863. "\uFEB7",
  16864. "\u0634",
  16865. "\uFEB8",
  16866. "\u0634",
  16867. "\uFEB9",
  16868. "\u0635",
  16869. "\uFEBA",
  16870. "\u0635",
  16871. "\uFEBB",
  16872. "\u0635",
  16873. "\uFEBC",
  16874. "\u0635",
  16875. "\uFEBD",
  16876. "\u0636",
  16877. "\uFEBE",
  16878. "\u0636",
  16879. "\uFEBF",
  16880. "\u0636",
  16881. "\uFEC0",
  16882. "\u0636",
  16883. "\uFEC1",
  16884. "\u0637",
  16885. "\uFEC2",
  16886. "\u0637",
  16887. "\uFEC3",
  16888. "\u0637",
  16889. "\uFEC4",
  16890. "\u0637",
  16891. "\uFEC5",
  16892. "\u0638",
  16893. "\uFEC6",
  16894. "\u0638",
  16895. "\uFEC7",
  16896. "\u0638",
  16897. "\uFEC8",
  16898. "\u0638",
  16899. "\uFEC9",
  16900. "\u0639",
  16901. "\uFECA",
  16902. "\u0639",
  16903. "\uFECB",
  16904. "\u0639",
  16905. "\uFECC",
  16906. "\u0639",
  16907. "\uFECD",
  16908. "\u063A",
  16909. "\uFECE",
  16910. "\u063A",
  16911. "\uFECF",
  16912. "\u063A",
  16913. "\uFED0",
  16914. "\u063A",
  16915. "\uFED1",
  16916. "\u0641",
  16917. "\uFED2",
  16918. "\u0641",
  16919. "\uFED3",
  16920. "\u0641",
  16921. "\uFED4",
  16922. "\u0641",
  16923. "\uFED5",
  16924. "\u0642",
  16925. "\uFED6",
  16926. "\u0642",
  16927. "\uFED7",
  16928. "\u0642",
  16929. "\uFED8",
  16930. "\u0642",
  16931. "\uFED9",
  16932. "\u0643",
  16933. "\uFEDA",
  16934. "\u0643",
  16935. "\uFEDB",
  16936. "\u0643",
  16937. "\uFEDC",
  16938. "\u0643",
  16939. "\uFEDD",
  16940. "\u0644",
  16941. "\uFEDE",
  16942. "\u0644",
  16943. "\uFEDF",
  16944. "\u0644",
  16945. "\uFEE0",
  16946. "\u0644",
  16947. "\uFEE1",
  16948. "\u0645",
  16949. "\uFEE2",
  16950. "\u0645",
  16951. "\uFEE3",
  16952. "\u0645",
  16953. "\uFEE4",
  16954. "\u0645",
  16955. "\uFEE5",
  16956. "\u0646",
  16957. "\uFEE6",
  16958. "\u0646",
  16959. "\uFEE7",
  16960. "\u0646",
  16961. "\uFEE8",
  16962. "\u0646",
  16963. "\uFEE9",
  16964. "\u0647",
  16965. "\uFEEA",
  16966. "\u0647",
  16967. "\uFEEB",
  16968. "\u0647",
  16969. "\uFEEC",
  16970. "\u0647",
  16971. "\uFEED",
  16972. "\u0648",
  16973. "\uFEEE",
  16974. "\u0648",
  16975. "\uFEEF",
  16976. "\u0649",
  16977. "\uFEF0",
  16978. "\u0649",
  16979. "\uFEF1",
  16980. "\u064A",
  16981. "\uFEF2",
  16982. "\u064A",
  16983. "\uFEF3",
  16984. "\u064A",
  16985. "\uFEF4",
  16986. "\u064A",
  16987. "\uFEF5",
  16988. "\u0644\u0622",
  16989. "\uFEF6",
  16990. "\u0644\u0622",
  16991. "\uFEF7",
  16992. "\u0644\u0623",
  16993. "\uFEF8",
  16994. "\u0644\u0623",
  16995. "\uFEF9",
  16996. "\u0644\u0625",
  16997. "\uFEFA",
  16998. "\u0644\u0625",
  16999. "\uFEFB",
  17000. "\u0644\u0627",
  17001. "\uFEFC",
  17002. "\u0644\u0627"
  17003. ];
  17004. });
  17005. function reverseIfRtl(chars) {
  17006. const charsLength = chars.length;
  17007. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  17008. return chars;
  17009. }
  17010. const buf = [];
  17011. for (let ii = charsLength - 1; ii >= 0; ii--) {
  17012. buf.push(chars[ii]);
  17013. }
  17014. return buf.join("");
  17015. }
  17016. /***/ }),
  17017. /* 22 */
  17018. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17019. Object.defineProperty(exports, "__esModule", ({
  17020. value: true
  17021. }));
  17022. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  17023. exports.getQuadPoints = getQuadPoints;
  17024. var _util = __w_pdfjs_require__(2);
  17025. var _core_utils = __w_pdfjs_require__(9);
  17026. var _default_appearance = __w_pdfjs_require__(23);
  17027. var _primitives = __w_pdfjs_require__(5);
  17028. var _bidi = __w_pdfjs_require__(59);
  17029. var _catalog = __w_pdfjs_require__(64);
  17030. var _colorspace = __w_pdfjs_require__(24);
  17031. var _file_spec = __w_pdfjs_require__(66);
  17032. var _object_loader = __w_pdfjs_require__(70);
  17033. var _operator_list = __w_pdfjs_require__(62);
  17034. var _stream = __w_pdfjs_require__(10);
  17035. var _writer = __w_pdfjs_require__(71);
  17036. var _factory = __w_pdfjs_require__(74);
  17037. class AnnotationFactory {
  17038. static create(xref, ref, pdfManager, idFactory, collectFields) {
  17039. 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]));
  17040. }
  17041. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) {
  17042. const dict = xref.fetchIfRef(ref);
  17043. if (!(0, _primitives.isDict)(dict)) {
  17044. return undefined;
  17045. }
  17046. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  17047. let subtype = dict.get("Subtype");
  17048. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  17049. const parameters = {
  17050. xref,
  17051. ref,
  17052. dict,
  17053. subtype,
  17054. id,
  17055. pdfManager,
  17056. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  17057. collectFields,
  17058. pageIndex
  17059. };
  17060. switch (subtype) {
  17061. case "Link":
  17062. return new LinkAnnotation(parameters);
  17063. case "Text":
  17064. return new TextAnnotation(parameters);
  17065. case "Widget":
  17066. let fieldType = (0, _core_utils.getInheritableProperty)({
  17067. dict,
  17068. key: "FT"
  17069. });
  17070. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  17071. switch (fieldType) {
  17072. case "Tx":
  17073. return new TextWidgetAnnotation(parameters);
  17074. case "Btn":
  17075. return new ButtonWidgetAnnotation(parameters);
  17076. case "Ch":
  17077. return new ChoiceWidgetAnnotation(parameters);
  17078. case "Sig":
  17079. return new SignatureWidgetAnnotation(parameters);
  17080. }
  17081. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  17082. return new WidgetAnnotation(parameters);
  17083. case "Popup":
  17084. return new PopupAnnotation(parameters);
  17085. case "FreeText":
  17086. return new FreeTextAnnotation(parameters);
  17087. case "Line":
  17088. return new LineAnnotation(parameters);
  17089. case "Square":
  17090. return new SquareAnnotation(parameters);
  17091. case "Circle":
  17092. return new CircleAnnotation(parameters);
  17093. case "PolyLine":
  17094. return new PolylineAnnotation(parameters);
  17095. case "Polygon":
  17096. return new PolygonAnnotation(parameters);
  17097. case "Caret":
  17098. return new CaretAnnotation(parameters);
  17099. case "Ink":
  17100. return new InkAnnotation(parameters);
  17101. case "Highlight":
  17102. return new HighlightAnnotation(parameters);
  17103. case "Underline":
  17104. return new UnderlineAnnotation(parameters);
  17105. case "Squiggly":
  17106. return new SquigglyAnnotation(parameters);
  17107. case "StrikeOut":
  17108. return new StrikeOutAnnotation(parameters);
  17109. case "Stamp":
  17110. return new StampAnnotation(parameters);
  17111. case "FileAttachment":
  17112. return new FileAttachmentAnnotation(parameters);
  17113. default:
  17114. if (!collectFields) {
  17115. if (!subtype) {
  17116. (0, _util.warn)("Annotation is missing the required /Subtype.");
  17117. } else {
  17118. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  17119. }
  17120. }
  17121. return new Annotation(parameters);
  17122. }
  17123. }
  17124. static async _getPageIndex(xref, ref, pdfManager) {
  17125. try {
  17126. const annotDict = await xref.fetchIfRefAsync(ref);
  17127. if (!(0, _primitives.isDict)(annotDict)) {
  17128. return -1;
  17129. }
  17130. const pageRef = annotDict.getRaw("P");
  17131. if (!(0, _primitives.isRef)(pageRef)) {
  17132. return -1;
  17133. }
  17134. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  17135. return pageIndex;
  17136. } catch (ex) {
  17137. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  17138. return -1;
  17139. }
  17140. }
  17141. }
  17142. exports.AnnotationFactory = AnnotationFactory;
  17143. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  17144. if (!Array.isArray(color)) {
  17145. return defaultColor;
  17146. }
  17147. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  17148. switch (color.length) {
  17149. case 0:
  17150. return null;
  17151. case 1:
  17152. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  17153. return rgbColor;
  17154. case 3:
  17155. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17156. return rgbColor;
  17157. case 4:
  17158. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17159. return rgbColor;
  17160. default:
  17161. return defaultColor;
  17162. }
  17163. }
  17164. function getQuadPoints(dict, rect) {
  17165. if (!dict.has("QuadPoints")) {
  17166. return null;
  17167. }
  17168. const quadPoints = dict.getArray("QuadPoints");
  17169. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17170. return null;
  17171. }
  17172. const quadPointsLists = [];
  17173. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17174. quadPointsLists.push([]);
  17175. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17176. const x = quadPoints[j];
  17177. const y = quadPoints[j + 1];
  17178. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17179. return null;
  17180. }
  17181. quadPointsLists[i].push({
  17182. x,
  17183. y
  17184. });
  17185. }
  17186. }
  17187. return quadPointsLists.map(quadPointsList => {
  17188. 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]);
  17189. return [{
  17190. x: minX,
  17191. y: maxY
  17192. }, {
  17193. x: maxX,
  17194. y: maxY
  17195. }, {
  17196. x: minX,
  17197. y: minY
  17198. }, {
  17199. x: maxX,
  17200. y: minY
  17201. }];
  17202. });
  17203. }
  17204. function getTransformMatrix(rect, bbox, matrix) {
  17205. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17206. if (minX === maxX || minY === maxY) {
  17207. return [1, 0, 0, 1, rect[0], rect[1]];
  17208. }
  17209. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17210. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17211. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17212. }
  17213. class Annotation {
  17214. constructor(params) {
  17215. const dict = params.dict;
  17216. this.setTitle(dict.get("T"));
  17217. this.setContents(dict.get("Contents"));
  17218. this.setModificationDate(dict.get("M"));
  17219. this.setFlags(dict.get("F"));
  17220. this.setRectangle(dict.getArray("Rect"));
  17221. this.setColor(dict.getArray("C"));
  17222. this.setBorderStyle(dict);
  17223. this.setAppearance(dict);
  17224. this.setBorderAndBackgroundColors(dict.get("MK"));
  17225. this._streams = [];
  17226. if (this.appearance) {
  17227. this._streams.push(this.appearance);
  17228. }
  17229. this.data = {
  17230. annotationFlags: this.flags,
  17231. borderStyle: this.borderStyle,
  17232. color: this.color,
  17233. backgroundColor: this.backgroundColor,
  17234. borderColor: this.borderColor,
  17235. contentsObj: this._contents,
  17236. hasAppearance: !!this.appearance,
  17237. id: params.id,
  17238. modificationDate: this.modificationDate,
  17239. rect: this.rectangle,
  17240. subtype: params.subtype,
  17241. hasOwnCanvas: false
  17242. };
  17243. if (params.collectFields) {
  17244. const kids = dict.get("Kids");
  17245. if (Array.isArray(kids)) {
  17246. const kidIds = [];
  17247. for (const kid of kids) {
  17248. if ((0, _primitives.isRef)(kid)) {
  17249. kidIds.push(kid.toString());
  17250. }
  17251. }
  17252. if (kidIds.length !== 0) {
  17253. this.data.kidIds = kidIds;
  17254. }
  17255. }
  17256. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17257. this.data.fieldName = this._constructFieldName(dict);
  17258. this.data.pageIndex = params.pageIndex;
  17259. }
  17260. this._fallbackFontDict = null;
  17261. }
  17262. _hasFlag(flags, flag) {
  17263. return !!(flags & flag);
  17264. }
  17265. _isViewable(flags) {
  17266. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17267. }
  17268. _isPrintable(flags) {
  17269. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17270. }
  17271. mustBeViewed(annotationStorage) {
  17272. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17273. if (storageEntry && storageEntry.hidden !== undefined) {
  17274. return !storageEntry.hidden;
  17275. }
  17276. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17277. }
  17278. mustBePrinted(annotationStorage) {
  17279. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17280. if (storageEntry && storageEntry.print !== undefined) {
  17281. return storageEntry.print;
  17282. }
  17283. return this.printable;
  17284. }
  17285. get viewable() {
  17286. if (this.data.quadPoints === null) {
  17287. return false;
  17288. }
  17289. if (this.flags === 0) {
  17290. return true;
  17291. }
  17292. return this._isViewable(this.flags);
  17293. }
  17294. get printable() {
  17295. if (this.data.quadPoints === null) {
  17296. return false;
  17297. }
  17298. if (this.flags === 0) {
  17299. return false;
  17300. }
  17301. return this._isPrintable(this.flags);
  17302. }
  17303. _parseStringHelper(data) {
  17304. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17305. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17306. return {
  17307. str,
  17308. dir
  17309. };
  17310. }
  17311. setTitle(title) {
  17312. this._title = this._parseStringHelper(title);
  17313. }
  17314. setContents(contents) {
  17315. this._contents = this._parseStringHelper(contents);
  17316. }
  17317. setModificationDate(modificationDate) {
  17318. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  17319. }
  17320. setFlags(flags) {
  17321. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17322. }
  17323. hasFlag(flag) {
  17324. return this._hasFlag(this.flags, flag);
  17325. }
  17326. setRectangle(rectangle) {
  17327. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17328. this.rectangle = _util.Util.normalizeRect(rectangle);
  17329. } else {
  17330. this.rectangle = [0, 0, 0, 0];
  17331. }
  17332. }
  17333. setColor(color) {
  17334. this.color = getRgbColor(color);
  17335. }
  17336. setBorderAndBackgroundColors(mk) {
  17337. if (mk instanceof _primitives.Dict) {
  17338. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17339. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17340. } else {
  17341. this.borderColor = this.backgroundColor = null;
  17342. }
  17343. }
  17344. setBorderStyle(borderStyle) {
  17345. this.borderStyle = new AnnotationBorderStyle();
  17346. if (!(0, _primitives.isDict)(borderStyle)) {
  17347. return;
  17348. }
  17349. if (borderStyle.has("BS")) {
  17350. const dict = borderStyle.get("BS");
  17351. const dictType = dict.get("Type");
  17352. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17353. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17354. this.borderStyle.setStyle(dict.get("S"));
  17355. this.borderStyle.setDashArray(dict.getArray("D"));
  17356. }
  17357. } else if (borderStyle.has("Border")) {
  17358. const array = borderStyle.getArray("Border");
  17359. if (Array.isArray(array) && array.length >= 3) {
  17360. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17361. this.borderStyle.setVerticalCornerRadius(array[1]);
  17362. this.borderStyle.setWidth(array[2], this.rectangle);
  17363. if (array.length === 4) {
  17364. this.borderStyle.setDashArray(array[3], true);
  17365. }
  17366. }
  17367. } else {
  17368. this.borderStyle.setWidth(0);
  17369. }
  17370. }
  17371. setAppearance(dict) {
  17372. this.appearance = null;
  17373. const appearanceStates = dict.get("AP");
  17374. if (!(0, _primitives.isDict)(appearanceStates)) {
  17375. return;
  17376. }
  17377. const normalAppearanceState = appearanceStates.get("N");
  17378. if ((0, _primitives.isStream)(normalAppearanceState)) {
  17379. this.appearance = normalAppearanceState;
  17380. return;
  17381. }
  17382. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  17383. return;
  17384. }
  17385. const as = dict.get("AS");
  17386. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  17387. return;
  17388. }
  17389. this.appearance = normalAppearanceState.get(as.name);
  17390. }
  17391. loadResources(keys, appearance) {
  17392. return appearance.dict.getAsync("Resources").then(resources => {
  17393. if (!resources) {
  17394. return undefined;
  17395. }
  17396. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17397. return objectLoader.load().then(function () {
  17398. return resources;
  17399. });
  17400. });
  17401. }
  17402. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17403. const data = this.data;
  17404. let appearance = this.appearance;
  17405. const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY;
  17406. if (!appearance) {
  17407. if (!isUsingOwnCanvas) {
  17408. return Promise.resolve(new _operator_list.OperatorList());
  17409. }
  17410. appearance = new _stream.StringStream("");
  17411. appearance.dict = new _primitives.Dict();
  17412. }
  17413. const appearanceDict = appearance.dict;
  17414. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  17415. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17416. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17417. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17418. return resourcesPromise.then(resources => {
  17419. const opList = new _operator_list.OperatorList();
  17420. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  17421. return evaluator.getOperatorList({
  17422. stream: appearance,
  17423. task,
  17424. resources,
  17425. operatorList: opList,
  17426. fallbackFontDict: this._fallbackFontDict
  17427. }).then(() => {
  17428. opList.addOp(_util.OPS.endAnnotation, []);
  17429. this.reset();
  17430. return opList;
  17431. });
  17432. });
  17433. }
  17434. async save(evaluator, task, annotationStorage) {
  17435. return null;
  17436. }
  17437. getFieldObject() {
  17438. if (this.data.kidIds) {
  17439. return {
  17440. id: this.data.id,
  17441. actions: this.data.actions,
  17442. name: this.data.fieldName,
  17443. strokeColor: this.data.borderColor,
  17444. fillColor: this.data.backgroundColor,
  17445. type: "",
  17446. kidIds: this.data.kidIds,
  17447. page: this.data.pageIndex
  17448. };
  17449. }
  17450. return null;
  17451. }
  17452. reset() {
  17453. for (const stream of this._streams) {
  17454. stream.reset();
  17455. }
  17456. }
  17457. _constructFieldName(dict) {
  17458. if (!dict.has("T") && !dict.has("Parent")) {
  17459. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17460. return "";
  17461. }
  17462. if (!dict.has("Parent")) {
  17463. return (0, _util.stringToPDFString)(dict.get("T"));
  17464. }
  17465. const fieldName = [];
  17466. if (dict.has("T")) {
  17467. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17468. }
  17469. let loopDict = dict;
  17470. const visited = new _primitives.RefSet();
  17471. if (dict.objId) {
  17472. visited.put(dict.objId);
  17473. }
  17474. while (loopDict.has("Parent")) {
  17475. loopDict = loopDict.get("Parent");
  17476. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17477. break;
  17478. }
  17479. if (loopDict.objId) {
  17480. visited.put(loopDict.objId);
  17481. }
  17482. if (loopDict.has("T")) {
  17483. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17484. }
  17485. }
  17486. return fieldName.join(".");
  17487. }
  17488. }
  17489. exports.Annotation = Annotation;
  17490. class AnnotationBorderStyle {
  17491. constructor() {
  17492. this.width = 1;
  17493. this.style = _util.AnnotationBorderStyleType.SOLID;
  17494. this.dashArray = [3];
  17495. this.horizontalCornerRadius = 0;
  17496. this.verticalCornerRadius = 0;
  17497. }
  17498. setWidth(width, rect = [0, 0, 0, 0]) {
  17499. if ((0, _primitives.isName)(width)) {
  17500. this.width = 0;
  17501. return;
  17502. }
  17503. if (Number.isInteger(width)) {
  17504. if (width > 0) {
  17505. const maxWidth = (rect[2] - rect[0]) / 2;
  17506. const maxHeight = (rect[3] - rect[1]) / 2;
  17507. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17508. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17509. width = 1;
  17510. }
  17511. }
  17512. this.width = width;
  17513. }
  17514. }
  17515. setStyle(style) {
  17516. if (!(0, _primitives.isName)(style)) {
  17517. return;
  17518. }
  17519. switch (style.name) {
  17520. case "S":
  17521. this.style = _util.AnnotationBorderStyleType.SOLID;
  17522. break;
  17523. case "D":
  17524. this.style = _util.AnnotationBorderStyleType.DASHED;
  17525. break;
  17526. case "B":
  17527. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17528. break;
  17529. case "I":
  17530. this.style = _util.AnnotationBorderStyleType.INSET;
  17531. break;
  17532. case "U":
  17533. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17534. break;
  17535. default:
  17536. break;
  17537. }
  17538. }
  17539. setDashArray(dashArray, forceStyle = false) {
  17540. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17541. let isValid = true;
  17542. let allZeros = true;
  17543. for (const element of dashArray) {
  17544. const validNumber = +element >= 0;
  17545. if (!validNumber) {
  17546. isValid = false;
  17547. break;
  17548. } else if (element > 0) {
  17549. allZeros = false;
  17550. }
  17551. }
  17552. if (isValid && !allZeros) {
  17553. this.dashArray = dashArray;
  17554. if (forceStyle) {
  17555. this.setStyle(_primitives.Name.get("D"));
  17556. }
  17557. } else {
  17558. this.width = 0;
  17559. }
  17560. } else if (dashArray) {
  17561. this.width = 0;
  17562. }
  17563. }
  17564. setHorizontalCornerRadius(radius) {
  17565. if (Number.isInteger(radius)) {
  17566. this.horizontalCornerRadius = radius;
  17567. }
  17568. }
  17569. setVerticalCornerRadius(radius) {
  17570. if (Number.isInteger(radius)) {
  17571. this.verticalCornerRadius = radius;
  17572. }
  17573. }
  17574. }
  17575. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17576. class MarkupAnnotation extends Annotation {
  17577. constructor(parameters) {
  17578. super(parameters);
  17579. const dict = parameters.dict;
  17580. if (dict.has("IRT")) {
  17581. const rawIRT = dict.getRaw("IRT");
  17582. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  17583. const rt = dict.get("RT");
  17584. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  17585. }
  17586. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17587. const parent = dict.get("IRT");
  17588. this.setTitle(parent.get("T"));
  17589. this.data.titleObj = this._title;
  17590. this.setContents(parent.get("Contents"));
  17591. this.data.contentsObj = this._contents;
  17592. if (!parent.has("CreationDate")) {
  17593. this.data.creationDate = null;
  17594. } else {
  17595. this.setCreationDate(parent.get("CreationDate"));
  17596. this.data.creationDate = this.creationDate;
  17597. }
  17598. if (!parent.has("M")) {
  17599. this.data.modificationDate = null;
  17600. } else {
  17601. this.setModificationDate(parent.get("M"));
  17602. this.data.modificationDate = this.modificationDate;
  17603. }
  17604. this.data.hasPopup = parent.has("Popup");
  17605. if (!parent.has("C")) {
  17606. this.data.color = null;
  17607. } else {
  17608. this.setColor(parent.getArray("C"));
  17609. this.data.color = this.color;
  17610. }
  17611. } else {
  17612. this.data.titleObj = this._title;
  17613. this.setCreationDate(dict.get("CreationDate"));
  17614. this.data.creationDate = this.creationDate;
  17615. this.data.hasPopup = dict.has("Popup");
  17616. if (!dict.has("C")) {
  17617. this.data.color = null;
  17618. }
  17619. }
  17620. if (dict.has("RC")) {
  17621. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  17622. }
  17623. }
  17624. setCreationDate(creationDate) {
  17625. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  17626. }
  17627. _setDefaultAppearance({
  17628. xref,
  17629. extra,
  17630. strokeColor,
  17631. fillColor,
  17632. blendMode,
  17633. strokeAlpha,
  17634. fillAlpha,
  17635. pointsCallback
  17636. }) {
  17637. let minX = Number.MAX_VALUE;
  17638. let minY = Number.MAX_VALUE;
  17639. let maxX = Number.MIN_VALUE;
  17640. let maxY = Number.MIN_VALUE;
  17641. const buffer = ["q"];
  17642. if (extra) {
  17643. buffer.push(extra);
  17644. }
  17645. if (strokeColor) {
  17646. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17647. }
  17648. if (fillColor) {
  17649. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17650. }
  17651. let pointsArray = this.data.quadPoints;
  17652. if (!pointsArray) {
  17653. pointsArray = [[{
  17654. x: this.rectangle[0],
  17655. y: this.rectangle[3]
  17656. }, {
  17657. x: this.rectangle[2],
  17658. y: this.rectangle[3]
  17659. }, {
  17660. x: this.rectangle[0],
  17661. y: this.rectangle[1]
  17662. }, {
  17663. x: this.rectangle[2],
  17664. y: this.rectangle[1]
  17665. }]];
  17666. }
  17667. for (const points of pointsArray) {
  17668. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17669. minX = Math.min(minX, mX);
  17670. maxX = Math.max(maxX, MX);
  17671. minY = Math.min(minY, mY);
  17672. maxY = Math.max(maxY, MY);
  17673. }
  17674. buffer.push("Q");
  17675. const formDict = new _primitives.Dict(xref);
  17676. const appearanceStreamDict = new _primitives.Dict(xref);
  17677. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17678. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17679. appearanceStream.dict = appearanceStreamDict;
  17680. formDict.set("Fm0", appearanceStream);
  17681. const gsDict = new _primitives.Dict(xref);
  17682. if (blendMode) {
  17683. gsDict.set("BM", _primitives.Name.get(blendMode));
  17684. }
  17685. if (typeof strokeAlpha === "number") {
  17686. gsDict.set("CA", strokeAlpha);
  17687. }
  17688. if (typeof fillAlpha === "number") {
  17689. gsDict.set("ca", fillAlpha);
  17690. }
  17691. const stateDict = new _primitives.Dict(xref);
  17692. stateDict.set("GS0", gsDict);
  17693. const resources = new _primitives.Dict(xref);
  17694. resources.set("ExtGState", stateDict);
  17695. resources.set("XObject", formDict);
  17696. const appearanceDict = new _primitives.Dict(xref);
  17697. appearanceDict.set("Resources", resources);
  17698. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  17699. appearanceDict.set("BBox", bbox);
  17700. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  17701. this.appearance.dict = appearanceDict;
  17702. this._streams.push(this.appearance, appearanceStream);
  17703. }
  17704. }
  17705. exports.MarkupAnnotation = MarkupAnnotation;
  17706. class WidgetAnnotation extends Annotation {
  17707. constructor(params) {
  17708. super(params);
  17709. const dict = params.dict;
  17710. const data = this.data;
  17711. this.ref = params.ref;
  17712. data.annotationType = _util.AnnotationType.WIDGET;
  17713. if (data.fieldName === undefined) {
  17714. data.fieldName = this._constructFieldName(dict);
  17715. }
  17716. if (data.actions === undefined) {
  17717. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17718. }
  17719. const fieldValue = (0, _core_utils.getInheritableProperty)({
  17720. dict,
  17721. key: "V",
  17722. getArray: true
  17723. });
  17724. data.fieldValue = this._decodeFormValue(fieldValue);
  17725. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  17726. dict,
  17727. key: "DV",
  17728. getArray: true
  17729. });
  17730. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  17731. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  17732. data.fieldValue = data.defaultFieldValue;
  17733. }
  17734. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  17735. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  17736. dict,
  17737. key: "DA"
  17738. }) || params.acroForm.get("DA");
  17739. this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  17740. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  17741. const fieldType = (0, _core_utils.getInheritableProperty)({
  17742. dict,
  17743. key: "FT"
  17744. });
  17745. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  17746. const localResources = (0, _core_utils.getInheritableProperty)({
  17747. dict,
  17748. key: "DR"
  17749. });
  17750. const acroFormResources = params.acroForm.get("DR");
  17751. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17752. this._fieldResources = {
  17753. localResources,
  17754. acroFormResources,
  17755. appearanceResources,
  17756. mergedResources: _primitives.Dict.merge({
  17757. xref: params.xref,
  17758. dictArray: [localResources, appearanceResources, acroFormResources],
  17759. mergeSubDicts: true
  17760. })
  17761. };
  17762. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17763. dict,
  17764. key: "Ff"
  17765. });
  17766. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17767. data.fieldFlags = 0;
  17768. }
  17769. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17770. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17771. }
  17772. _decodeFormValue(formValue) {
  17773. if (Array.isArray(formValue)) {
  17774. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  17775. } else if ((0, _primitives.isName)(formValue)) {
  17776. return (0, _util.stringToPDFString)(formValue.name);
  17777. } else if ((0, _util.isString)(formValue)) {
  17778. return (0, _util.stringToPDFString)(formValue);
  17779. }
  17780. return null;
  17781. }
  17782. hasFieldFlag(flag) {
  17783. return !!(this.data.fieldFlags & flag);
  17784. }
  17785. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17786. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  17787. return Promise.resolve(new _operator_list.OperatorList());
  17788. }
  17789. if (!this._hasText) {
  17790. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17791. }
  17792. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17793. if (this.appearance && content === null) {
  17794. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17795. }
  17796. const operatorList = new _operator_list.OperatorList();
  17797. if (!this._defaultAppearance || content === null) {
  17798. return operatorList;
  17799. }
  17800. const matrix = [1, 0, 0, 1, 0, 0];
  17801. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17802. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17803. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  17804. const stream = new _stream.StringStream(content);
  17805. return evaluator.getOperatorList({
  17806. stream,
  17807. task,
  17808. resources: this._fieldResources.mergedResources,
  17809. operatorList
  17810. }).then(function () {
  17811. operatorList.addOp(_util.OPS.endAnnotation, []);
  17812. return operatorList;
  17813. });
  17814. });
  17815. }
  17816. async save(evaluator, task, annotationStorage) {
  17817. if (!annotationStorage) {
  17818. return null;
  17819. }
  17820. const storageEntry = annotationStorage.get(this.data.id);
  17821. const value = storageEntry && storageEntry.value;
  17822. if (value === this.data.fieldValue || value === undefined) {
  17823. return null;
  17824. }
  17825. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17826. if (appearance === null) {
  17827. return null;
  17828. }
  17829. const {
  17830. xref
  17831. } = evaluator;
  17832. const dict = xref.fetchIfRef(this.ref);
  17833. if (!(0, _primitives.isDict)(dict)) {
  17834. return null;
  17835. }
  17836. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17837. const xfa = {
  17838. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17839. value
  17840. };
  17841. const newRef = xref.getNewRef();
  17842. const AP = new _primitives.Dict(xref);
  17843. AP.set("N", newRef);
  17844. const encrypt = xref.encrypt;
  17845. let originalTransform = null;
  17846. let newTransform = null;
  17847. if (encrypt) {
  17848. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17849. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17850. appearance = newTransform.encryptString(appearance);
  17851. }
  17852. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  17853. dict.set("AP", AP);
  17854. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17855. const appearanceDict = new _primitives.Dict(xref);
  17856. appearanceDict.set("Length", appearance.length);
  17857. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17858. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17859. appearanceDict.set("BBox", bbox);
  17860. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17861. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17862. bufferOriginal.push("\nendobj\n");
  17863. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17864. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17865. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  17866. return [{
  17867. ref: this.ref,
  17868. data: bufferOriginal.join(""),
  17869. xfa
  17870. }, {
  17871. ref: newRef,
  17872. data: bufferNew.join(""),
  17873. xfa: null
  17874. }];
  17875. }
  17876. async _getAppearance(evaluator, task, annotationStorage) {
  17877. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17878. if (!annotationStorage || isPassword) {
  17879. return null;
  17880. }
  17881. const storageEntry = annotationStorage.get(this.data.id);
  17882. let value = storageEntry && storageEntry.value;
  17883. if (value === undefined) {
  17884. return null;
  17885. }
  17886. value = value.trim();
  17887. if (value === "") {
  17888. return "";
  17889. }
  17890. let lineCount = -1;
  17891. if (this.data.multiLine) {
  17892. lineCount = value.split(/\r\n|\r|\n/).length;
  17893. }
  17894. const defaultPadding = 2;
  17895. const hPadding = defaultPadding;
  17896. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17897. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17898. if (!this._defaultAppearance) {
  17899. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  17900. }
  17901. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount);
  17902. const font = await this._getFontData(evaluator, task);
  17903. let descent = font.descent;
  17904. if (isNaN(descent)) {
  17905. descent = 0;
  17906. }
  17907. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  17908. const alignment = this.data.textAlignment;
  17909. if (this.data.multiLine) {
  17910. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  17911. }
  17912. const encodedString = font.encodeString(value).join("");
  17913. if (this.data.comb) {
  17914. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  17915. }
  17916. if (alignment === 0 || alignment > 2) {
  17917. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  17918. }
  17919. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  17920. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  17921. }
  17922. async _getFontData(evaluator, task) {
  17923. const operatorList = new _operator_list.OperatorList();
  17924. const initialState = {
  17925. font: null,
  17926. clone() {
  17927. return this;
  17928. }
  17929. };
  17930. const {
  17931. fontName,
  17932. fontSize
  17933. } = this.data.defaultAppearanceData;
  17934. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  17935. return initialState.font;
  17936. }
  17937. _computeFontSize(height, lineCount) {
  17938. let {
  17939. fontSize
  17940. } = this.data.defaultAppearanceData;
  17941. if (!fontSize) {
  17942. const roundWithOneDigit = x => Math.round(x * 10) / 10;
  17943. const FONT_FACTOR = 0.8;
  17944. if (lineCount === -1) {
  17945. fontSize = roundWithOneDigit(FONT_FACTOR * height);
  17946. } else {
  17947. fontSize = 10;
  17948. let lineHeight = fontSize / FONT_FACTOR;
  17949. let numberOfLines = Math.round(height / lineHeight);
  17950. numberOfLines = Math.max(numberOfLines, lineCount);
  17951. lineHeight = height / numberOfLines;
  17952. fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight);
  17953. }
  17954. const {
  17955. fontName,
  17956. fontColor
  17957. } = this.data.defaultAppearanceData;
  17958. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  17959. fontSize,
  17960. fontName,
  17961. fontColor
  17962. });
  17963. }
  17964. return [this._defaultAppearance, fontSize];
  17965. }
  17966. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  17967. const glyphs = font.charsToGlyphs(text);
  17968. const scale = fontSize / 1000;
  17969. let width = 0;
  17970. for (const glyph of glyphs) {
  17971. width += glyph.width * scale;
  17972. }
  17973. let shift;
  17974. if (alignment === 1) {
  17975. shift = (totalWidth - width) / 2;
  17976. } else if (alignment === 2) {
  17977. shift = totalWidth - width - hPadding;
  17978. } else {
  17979. shift = hPadding;
  17980. }
  17981. shift = shift.toFixed(2);
  17982. vPadding = vPadding.toFixed(2);
  17983. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  17984. }
  17985. _getSaveFieldResources(xref) {
  17986. const {
  17987. localResources,
  17988. appearanceResources,
  17989. acroFormResources
  17990. } = this._fieldResources;
  17991. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  17992. if (!fontName) {
  17993. return localResources || _primitives.Dict.empty;
  17994. }
  17995. for (const resources of [localResources, appearanceResources]) {
  17996. if (resources instanceof _primitives.Dict) {
  17997. const localFont = resources.get("Font");
  17998. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  17999. return resources;
  18000. }
  18001. }
  18002. }
  18003. if (acroFormResources instanceof _primitives.Dict) {
  18004. const acroFormFont = acroFormResources.get("Font");
  18005. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  18006. const subFontDict = new _primitives.Dict(xref);
  18007. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  18008. const subResourcesDict = new _primitives.Dict(xref);
  18009. subResourcesDict.set("Font", subFontDict);
  18010. return _primitives.Dict.merge({
  18011. xref,
  18012. dictArray: [subResourcesDict, localResources],
  18013. mergeSubDicts: true
  18014. });
  18015. }
  18016. }
  18017. return localResources || _primitives.Dict.empty;
  18018. }
  18019. getFieldObject() {
  18020. return null;
  18021. }
  18022. }
  18023. class TextWidgetAnnotation extends WidgetAnnotation {
  18024. constructor(params) {
  18025. super(params);
  18026. this._hasText = true;
  18027. const dict = params.dict;
  18028. if (!(0, _util.isString)(this.data.fieldValue)) {
  18029. this.data.fieldValue = "";
  18030. }
  18031. let alignment = (0, _core_utils.getInheritableProperty)({
  18032. dict,
  18033. key: "Q"
  18034. });
  18035. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  18036. alignment = null;
  18037. }
  18038. this.data.textAlignment = alignment;
  18039. let maximumLength = (0, _core_utils.getInheritableProperty)({
  18040. dict,
  18041. key: "MaxLen"
  18042. });
  18043. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  18044. maximumLength = null;
  18045. }
  18046. this.data.maxLen = maximumLength;
  18047. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  18048. 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;
  18049. }
  18050. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  18051. const combWidth = (width / this.data.maxLen).toFixed(2);
  18052. const buf = [];
  18053. const positions = font.getCharPositions(text);
  18054. for (const [start, end] of positions) {
  18055. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  18056. }
  18057. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  18058. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  18059. }
  18060. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  18061. const lines = text.split(/\r\n|\r|\n/);
  18062. const buf = [];
  18063. const totalWidth = width - 2 * hPadding;
  18064. for (const line of lines) {
  18065. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  18066. for (const chunk of chunks) {
  18067. const padding = buf.length === 0 ? hPadding : 0;
  18068. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  18069. }
  18070. }
  18071. const renderedText = buf.join("\n");
  18072. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  18073. }
  18074. _splitLine(line, font, fontSize, width) {
  18075. line = font.encodeString(line).join("");
  18076. const glyphs = font.charsToGlyphs(line);
  18077. if (glyphs.length <= 1) {
  18078. return [line];
  18079. }
  18080. const positions = font.getCharPositions(line);
  18081. const scale = fontSize / 1000;
  18082. const chunks = [];
  18083. let lastSpacePosInStringStart = -1,
  18084. lastSpacePosInStringEnd = -1,
  18085. lastSpacePos = -1,
  18086. startChunk = 0,
  18087. currentWidth = 0;
  18088. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  18089. const [start, end] = positions[i];
  18090. const glyph = glyphs[i];
  18091. const glyphWidth = glyph.width * scale;
  18092. if (glyph.unicode === " ") {
  18093. if (currentWidth + glyphWidth > width) {
  18094. chunks.push(line.substring(startChunk, start));
  18095. startChunk = start;
  18096. currentWidth = glyphWidth;
  18097. lastSpacePosInStringStart = -1;
  18098. lastSpacePos = -1;
  18099. } else {
  18100. currentWidth += glyphWidth;
  18101. lastSpacePosInStringStart = start;
  18102. lastSpacePosInStringEnd = end;
  18103. lastSpacePos = i;
  18104. }
  18105. } else {
  18106. if (currentWidth + glyphWidth > width) {
  18107. if (lastSpacePosInStringStart !== -1) {
  18108. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  18109. startChunk = lastSpacePosInStringEnd;
  18110. i = lastSpacePos + 1;
  18111. lastSpacePosInStringStart = -1;
  18112. currentWidth = 0;
  18113. } else {
  18114. chunks.push(line.substring(startChunk, start));
  18115. startChunk = start;
  18116. currentWidth = glyphWidth;
  18117. }
  18118. } else {
  18119. currentWidth += glyphWidth;
  18120. }
  18121. }
  18122. }
  18123. if (startChunk < line.length) {
  18124. chunks.push(line.substring(startChunk, line.length));
  18125. }
  18126. return chunks;
  18127. }
  18128. getFieldObject() {
  18129. return {
  18130. id: this.data.id,
  18131. value: this.data.fieldValue,
  18132. defaultValue: this.data.defaultFieldValue,
  18133. multiline: this.data.multiLine,
  18134. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  18135. charLimit: this.data.maxLen,
  18136. comb: this.data.comb,
  18137. editable: !this.data.readOnly,
  18138. hidden: this.data.hidden,
  18139. name: this.data.fieldName,
  18140. rect: this.data.rect,
  18141. actions: this.data.actions,
  18142. page: this.data.pageIndex,
  18143. strokeColor: this.data.borderColor,
  18144. fillColor: this.data.backgroundColor,
  18145. type: "text"
  18146. };
  18147. }
  18148. }
  18149. class ButtonWidgetAnnotation extends WidgetAnnotation {
  18150. constructor(params) {
  18151. super(params);
  18152. this.checkedAppearance = null;
  18153. this.uncheckedAppearance = null;
  18154. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18155. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18156. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18157. this.data.isTooltipOnly = false;
  18158. if (this.data.checkBox) {
  18159. this._processCheckBox(params);
  18160. } else if (this.data.radioButton) {
  18161. this._processRadioButton(params);
  18162. } else if (this.data.pushButton) {
  18163. this.data.hasOwnCanvas = true;
  18164. this._processPushButton(params);
  18165. } else {
  18166. (0, _util.warn)("Invalid field flags for button widget annotation");
  18167. }
  18168. }
  18169. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18170. if (this.data.pushButton) {
  18171. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  18172. }
  18173. let value = null;
  18174. if (annotationStorage) {
  18175. const storageEntry = annotationStorage.get(this.data.id);
  18176. value = storageEntry ? storageEntry.value : null;
  18177. }
  18178. if (value === null) {
  18179. if (this.appearance) {
  18180. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18181. }
  18182. if (this.data.checkBox) {
  18183. value = this.data.fieldValue === this.data.exportValue;
  18184. } else {
  18185. value = this.data.fieldValue === this.data.buttonValue;
  18186. }
  18187. }
  18188. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18189. if (appearance) {
  18190. const savedAppearance = this.appearance;
  18191. this.appearance = appearance;
  18192. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18193. this.appearance = savedAppearance;
  18194. return operatorList;
  18195. }
  18196. return new _operator_list.OperatorList();
  18197. }
  18198. async save(evaluator, task, annotationStorage) {
  18199. if (this.data.checkBox) {
  18200. return this._saveCheckbox(evaluator, task, annotationStorage);
  18201. }
  18202. if (this.data.radioButton) {
  18203. return this._saveRadioButton(evaluator, task, annotationStorage);
  18204. }
  18205. return null;
  18206. }
  18207. async _saveCheckbox(evaluator, task, annotationStorage) {
  18208. if (!annotationStorage) {
  18209. return null;
  18210. }
  18211. const storageEntry = annotationStorage.get(this.data.id);
  18212. const value = storageEntry && storageEntry.value;
  18213. if (value === undefined) {
  18214. return null;
  18215. }
  18216. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18217. if (defaultValue === value) {
  18218. return null;
  18219. }
  18220. const dict = evaluator.xref.fetchIfRef(this.ref);
  18221. if (!(0, _primitives.isDict)(dict)) {
  18222. return null;
  18223. }
  18224. const xfa = {
  18225. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18226. value: value ? this.data.exportValue : ""
  18227. };
  18228. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18229. dict.set("V", name);
  18230. dict.set("AS", name);
  18231. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18232. const encrypt = evaluator.xref.encrypt;
  18233. let originalTransform = null;
  18234. if (encrypt) {
  18235. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18236. }
  18237. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18238. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18239. buffer.push("\nendobj\n");
  18240. return [{
  18241. ref: this.ref,
  18242. data: buffer.join(""),
  18243. xfa
  18244. }];
  18245. }
  18246. async _saveRadioButton(evaluator, task, annotationStorage) {
  18247. if (!annotationStorage) {
  18248. return null;
  18249. }
  18250. const storageEntry = annotationStorage.get(this.data.id);
  18251. const value = storageEntry && storageEntry.value;
  18252. if (value === undefined) {
  18253. return null;
  18254. }
  18255. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18256. if (defaultValue === value) {
  18257. return null;
  18258. }
  18259. const dict = evaluator.xref.fetchIfRef(this.ref);
  18260. if (!(0, _primitives.isDict)(dict)) {
  18261. return null;
  18262. }
  18263. const xfa = {
  18264. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18265. value: value ? this.data.buttonValue : ""
  18266. };
  18267. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18268. let parentBuffer = null;
  18269. const encrypt = evaluator.xref.encrypt;
  18270. if (value) {
  18271. if ((0, _primitives.isRef)(this.parent)) {
  18272. const parent = evaluator.xref.fetch(this.parent);
  18273. let parentTransform = null;
  18274. if (encrypt) {
  18275. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18276. }
  18277. parent.set("V", name);
  18278. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18279. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18280. parentBuffer.push("\nendobj\n");
  18281. } else if ((0, _primitives.isDict)(this.parent)) {
  18282. this.parent.set("V", name);
  18283. }
  18284. }
  18285. dict.set("AS", name);
  18286. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18287. let originalTransform = null;
  18288. if (encrypt) {
  18289. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18290. }
  18291. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18292. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18293. buffer.push("\nendobj\n");
  18294. const newRefs = [{
  18295. ref: this.ref,
  18296. data: buffer.join(""),
  18297. xfa
  18298. }];
  18299. if (parentBuffer !== null) {
  18300. newRefs.push({
  18301. ref: this.parent,
  18302. data: parentBuffer.join(""),
  18303. xfa: null
  18304. });
  18305. }
  18306. return newRefs;
  18307. }
  18308. _getDefaultCheckedAppearance(params, type) {
  18309. const width = this.data.rect[2] - this.data.rect[0];
  18310. const height = this.data.rect[3] - this.data.rect[1];
  18311. const bbox = [0, 0, width, height];
  18312. const FONT_RATIO = 0.8;
  18313. const fontSize = Math.min(width, height) * FONT_RATIO;
  18314. let metrics, char;
  18315. if (type === "check") {
  18316. metrics = {
  18317. width: 0.755 * fontSize,
  18318. height: 0.705 * fontSize
  18319. };
  18320. char = "\x33";
  18321. } else if (type === "disc") {
  18322. metrics = {
  18323. width: 0.791 * fontSize,
  18324. height: 0.705 * fontSize
  18325. };
  18326. char = "\x6C";
  18327. } else {
  18328. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18329. }
  18330. const xShift = (width - metrics.width) / 2;
  18331. const yShift = (height - metrics.height) / 2;
  18332. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18333. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18334. appearanceStreamDict.set("FormType", 1);
  18335. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18336. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18337. appearanceStreamDict.set("BBox", bbox);
  18338. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18339. appearanceStreamDict.set("Length", appearance.length);
  18340. const resources = new _primitives.Dict(params.xref);
  18341. const font = new _primitives.Dict(params.xref);
  18342. font.set("PdfJsZaDb", this.fallbackFontDict);
  18343. resources.set("Font", font);
  18344. appearanceStreamDict.set("Resources", resources);
  18345. this.checkedAppearance = new _stream.StringStream(appearance);
  18346. this.checkedAppearance.dict = appearanceStreamDict;
  18347. this._streams.push(this.checkedAppearance);
  18348. }
  18349. _processCheckBox(params) {
  18350. const customAppearance = params.dict.get("AP");
  18351. if (!(0, _primitives.isDict)(customAppearance)) {
  18352. return;
  18353. }
  18354. const normalAppearance = customAppearance.get("N");
  18355. if (!(0, _primitives.isDict)(normalAppearance)) {
  18356. return;
  18357. }
  18358. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18359. if (typeof asValue === "string") {
  18360. this.data.fieldValue = asValue;
  18361. }
  18362. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18363. const exportValues = normalAppearance.getKeys();
  18364. if (exportValues.length === 0) {
  18365. exportValues.push("Off", yes);
  18366. } else if (exportValues.length === 1) {
  18367. if (exportValues[0] === "Off") {
  18368. exportValues.push(yes);
  18369. } else {
  18370. exportValues.unshift("Off");
  18371. }
  18372. } else if (exportValues.includes(yes)) {
  18373. exportValues.length = 0;
  18374. exportValues.push("Off", yes);
  18375. } else {
  18376. const otherYes = exportValues.find(v => v !== "Off");
  18377. exportValues.length = 0;
  18378. exportValues.push("Off", otherYes);
  18379. }
  18380. if (!exportValues.includes(this.data.fieldValue)) {
  18381. this.data.fieldValue = "Off";
  18382. }
  18383. this.data.exportValue = exportValues[1];
  18384. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18385. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18386. if (this.checkedAppearance) {
  18387. this._streams.push(this.checkedAppearance);
  18388. } else {
  18389. this._getDefaultCheckedAppearance(params, "check");
  18390. }
  18391. if (this.uncheckedAppearance) {
  18392. this._streams.push(this.uncheckedAppearance);
  18393. }
  18394. this._fallbackFontDict = this.fallbackFontDict;
  18395. }
  18396. _processRadioButton(params) {
  18397. this.data.fieldValue = this.data.buttonValue = null;
  18398. const fieldParent = params.dict.get("Parent");
  18399. if ((0, _primitives.isDict)(fieldParent)) {
  18400. this.parent = params.dict.getRaw("Parent");
  18401. const fieldParentValue = fieldParent.get("V");
  18402. if ((0, _primitives.isName)(fieldParentValue)) {
  18403. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18404. }
  18405. }
  18406. const appearanceStates = params.dict.get("AP");
  18407. if (!(0, _primitives.isDict)(appearanceStates)) {
  18408. return;
  18409. }
  18410. const normalAppearance = appearanceStates.get("N");
  18411. if (!(0, _primitives.isDict)(normalAppearance)) {
  18412. return;
  18413. }
  18414. for (const key of normalAppearance.getKeys()) {
  18415. if (key !== "Off") {
  18416. this.data.buttonValue = this._decodeFormValue(key);
  18417. break;
  18418. }
  18419. }
  18420. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18421. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18422. if (this.checkedAppearance) {
  18423. this._streams.push(this.checkedAppearance);
  18424. } else {
  18425. this._getDefaultCheckedAppearance(params, "disc");
  18426. }
  18427. if (this.uncheckedAppearance) {
  18428. this._streams.push(this.uncheckedAppearance);
  18429. }
  18430. this._fallbackFontDict = this.fallbackFontDict;
  18431. }
  18432. _processPushButton(params) {
  18433. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18434. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18435. return;
  18436. }
  18437. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18438. _catalog.Catalog.parseDestDictionary({
  18439. destDict: params.dict,
  18440. resultObj: this.data,
  18441. docBaseUrl: params.pdfManager.docBaseUrl
  18442. });
  18443. }
  18444. getFieldObject() {
  18445. let type = "button";
  18446. let exportValues;
  18447. if (this.data.checkBox) {
  18448. type = "checkbox";
  18449. exportValues = this.data.exportValue;
  18450. } else if (this.data.radioButton) {
  18451. type = "radiobutton";
  18452. exportValues = this.data.buttonValue;
  18453. }
  18454. return {
  18455. id: this.data.id,
  18456. value: this.data.fieldValue || "Off",
  18457. defaultValue: this.data.defaultFieldValue,
  18458. exportValues,
  18459. editable: !this.data.readOnly,
  18460. name: this.data.fieldName,
  18461. rect: this.data.rect,
  18462. hidden: this.data.hidden,
  18463. actions: this.data.actions,
  18464. page: this.data.pageIndex,
  18465. strokeColor: this.data.borderColor,
  18466. fillColor: this.data.backgroundColor,
  18467. type
  18468. };
  18469. }
  18470. get fallbackFontDict() {
  18471. const dict = new _primitives.Dict();
  18472. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  18473. dict.set("Type", _primitives.Name.get("FallbackType"));
  18474. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18475. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  18476. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  18477. }
  18478. }
  18479. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  18480. constructor(params) {
  18481. super(params);
  18482. this.data.options = [];
  18483. const options = (0, _core_utils.getInheritableProperty)({
  18484. dict: params.dict,
  18485. key: "Opt"
  18486. });
  18487. if (Array.isArray(options)) {
  18488. const xref = params.xref;
  18489. for (let i = 0, ii = options.length; i < ii; i++) {
  18490. const option = xref.fetchIfRef(options[i]);
  18491. const isOptionArray = Array.isArray(option);
  18492. this.data.options[i] = {
  18493. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  18494. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  18495. };
  18496. }
  18497. }
  18498. if ((0, _util.isString)(this.data.fieldValue)) {
  18499. this.data.fieldValue = [this.data.fieldValue];
  18500. } else if (!this.data.fieldValue) {
  18501. this.data.fieldValue = [];
  18502. }
  18503. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  18504. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  18505. this._hasText = true;
  18506. }
  18507. getFieldObject() {
  18508. const type = this.data.combo ? "combobox" : "listbox";
  18509. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  18510. return {
  18511. id: this.data.id,
  18512. value,
  18513. defaultValue: this.data.defaultFieldValue,
  18514. editable: !this.data.readOnly,
  18515. name: this.data.fieldName,
  18516. rect: this.data.rect,
  18517. numItems: this.data.fieldValue.length,
  18518. multipleSelection: this.data.multiSelect,
  18519. hidden: this.data.hidden,
  18520. actions: this.data.actions,
  18521. items: this.data.options,
  18522. page: this.data.pageIndex,
  18523. strokeColor: this.data.borderColor,
  18524. fillColor: this.data.backgroundColor,
  18525. type
  18526. };
  18527. }
  18528. }
  18529. class SignatureWidgetAnnotation extends WidgetAnnotation {
  18530. constructor(params) {
  18531. super(params);
  18532. this.data.fieldValue = null;
  18533. }
  18534. getFieldObject() {
  18535. return {
  18536. id: this.data.id,
  18537. value: null,
  18538. page: this.data.pageIndex,
  18539. type: "signature"
  18540. };
  18541. }
  18542. }
  18543. class TextAnnotation extends MarkupAnnotation {
  18544. constructor(parameters) {
  18545. const DEFAULT_ICON_SIZE = 22;
  18546. super(parameters);
  18547. const dict = parameters.dict;
  18548. this.data.annotationType = _util.AnnotationType.TEXT;
  18549. if (this.data.hasAppearance) {
  18550. this.data.name = "NoIcon";
  18551. } else {
  18552. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  18553. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  18554. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  18555. }
  18556. if (dict.has("State")) {
  18557. this.data.state = dict.get("State") || null;
  18558. this.data.stateModel = dict.get("StateModel") || null;
  18559. } else {
  18560. this.data.state = null;
  18561. this.data.stateModel = null;
  18562. }
  18563. }
  18564. }
  18565. class LinkAnnotation extends Annotation {
  18566. constructor(params) {
  18567. super(params);
  18568. this.data.annotationType = _util.AnnotationType.LINK;
  18569. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  18570. if (quadPoints) {
  18571. this.data.quadPoints = quadPoints;
  18572. }
  18573. _catalog.Catalog.parseDestDictionary({
  18574. destDict: params.dict,
  18575. resultObj: this.data,
  18576. docBaseUrl: params.pdfManager.docBaseUrl
  18577. });
  18578. }
  18579. }
  18580. class PopupAnnotation extends Annotation {
  18581. constructor(parameters) {
  18582. super(parameters);
  18583. this.data.annotationType = _util.AnnotationType.POPUP;
  18584. let parentItem = parameters.dict.get("Parent");
  18585. if (!parentItem) {
  18586. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  18587. return;
  18588. }
  18589. const parentSubtype = parentItem.get("Subtype");
  18590. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  18591. const rawParent = parameters.dict.getRaw("Parent");
  18592. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  18593. const parentRect = parentItem.getArray("Rect");
  18594. if (Array.isArray(parentRect) && parentRect.length === 4) {
  18595. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  18596. } else {
  18597. this.data.parentRect = [0, 0, 0, 0];
  18598. }
  18599. const rt = parentItem.get("RT");
  18600. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  18601. parentItem = parentItem.get("IRT");
  18602. }
  18603. if (!parentItem.has("M")) {
  18604. this.data.modificationDate = null;
  18605. } else {
  18606. this.setModificationDate(parentItem.get("M"));
  18607. this.data.modificationDate = this.modificationDate;
  18608. }
  18609. if (!parentItem.has("C")) {
  18610. this.data.color = null;
  18611. } else {
  18612. this.setColor(parentItem.getArray("C"));
  18613. this.data.color = this.color;
  18614. }
  18615. if (!this.viewable) {
  18616. const parentFlags = parentItem.get("F");
  18617. if (this._isViewable(parentFlags)) {
  18618. this.setFlags(parentFlags);
  18619. }
  18620. }
  18621. this.setTitle(parentItem.get("T"));
  18622. this.data.titleObj = this._title;
  18623. this.setContents(parentItem.get("Contents"));
  18624. this.data.contentsObj = this._contents;
  18625. if (parentItem.has("RC")) {
  18626. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  18627. }
  18628. }
  18629. }
  18630. class FreeTextAnnotation extends MarkupAnnotation {
  18631. constructor(parameters) {
  18632. super(parameters);
  18633. this.data.annotationType = _util.AnnotationType.FREETEXT;
  18634. }
  18635. }
  18636. class LineAnnotation extends MarkupAnnotation {
  18637. constructor(parameters) {
  18638. super(parameters);
  18639. this.data.annotationType = _util.AnnotationType.LINE;
  18640. const lineCoordinates = parameters.dict.getArray("L");
  18641. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  18642. if (!this.appearance) {
  18643. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18644. const strokeAlpha = parameters.dict.get("CA");
  18645. let fillColor = null,
  18646. interiorColor = parameters.dict.getArray("IC");
  18647. if (interiorColor) {
  18648. interiorColor = getRgbColor(interiorColor, null);
  18649. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18650. }
  18651. const fillAlpha = fillColor ? strokeAlpha : null;
  18652. const borderWidth = this.borderStyle.width || 1,
  18653. borderAdjust = 2 * borderWidth;
  18654. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  18655. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18656. this.rectangle = bbox;
  18657. }
  18658. this._setDefaultAppearance({
  18659. xref: parameters.xref,
  18660. extra: `${borderWidth} w`,
  18661. strokeColor,
  18662. fillColor,
  18663. strokeAlpha,
  18664. fillAlpha,
  18665. pointsCallback: (buffer, points) => {
  18666. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  18667. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  18668. }
  18669. });
  18670. }
  18671. }
  18672. }
  18673. class SquareAnnotation extends MarkupAnnotation {
  18674. constructor(parameters) {
  18675. super(parameters);
  18676. this.data.annotationType = _util.AnnotationType.SQUARE;
  18677. if (!this.appearance) {
  18678. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18679. const strokeAlpha = parameters.dict.get("CA");
  18680. let fillColor = null,
  18681. interiorColor = parameters.dict.getArray("IC");
  18682. if (interiorColor) {
  18683. interiorColor = getRgbColor(interiorColor, null);
  18684. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18685. }
  18686. const fillAlpha = fillColor ? strokeAlpha : null;
  18687. if (this.borderStyle.width === 0 && !fillColor) {
  18688. return;
  18689. }
  18690. this._setDefaultAppearance({
  18691. xref: parameters.xref,
  18692. extra: `${this.borderStyle.width} w`,
  18693. strokeColor,
  18694. fillColor,
  18695. strokeAlpha,
  18696. fillAlpha,
  18697. pointsCallback: (buffer, points) => {
  18698. const x = points[2].x + this.borderStyle.width / 2;
  18699. const y = points[2].y + this.borderStyle.width / 2;
  18700. const width = points[3].x - points[2].x - this.borderStyle.width;
  18701. const height = points[1].y - points[3].y - this.borderStyle.width;
  18702. buffer.push(`${x} ${y} ${width} ${height} re`);
  18703. if (fillColor) {
  18704. buffer.push("B");
  18705. } else {
  18706. buffer.push("S");
  18707. }
  18708. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18709. }
  18710. });
  18711. }
  18712. }
  18713. }
  18714. class CircleAnnotation extends MarkupAnnotation {
  18715. constructor(parameters) {
  18716. super(parameters);
  18717. this.data.annotationType = _util.AnnotationType.CIRCLE;
  18718. if (!this.appearance) {
  18719. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18720. const strokeAlpha = parameters.dict.get("CA");
  18721. let fillColor = null;
  18722. let interiorColor = parameters.dict.getArray("IC");
  18723. if (interiorColor) {
  18724. interiorColor = getRgbColor(interiorColor, null);
  18725. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18726. }
  18727. const fillAlpha = fillColor ? strokeAlpha : null;
  18728. if (this.borderStyle.width === 0 && !fillColor) {
  18729. return;
  18730. }
  18731. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  18732. this._setDefaultAppearance({
  18733. xref: parameters.xref,
  18734. extra: `${this.borderStyle.width} w`,
  18735. strokeColor,
  18736. fillColor,
  18737. strokeAlpha,
  18738. fillAlpha,
  18739. pointsCallback: (buffer, points) => {
  18740. const x0 = points[0].x + this.borderStyle.width / 2;
  18741. const y0 = points[0].y - this.borderStyle.width / 2;
  18742. const x1 = points[3].x - this.borderStyle.width / 2;
  18743. const y1 = points[3].y + this.borderStyle.width / 2;
  18744. const xMid = x0 + (x1 - x0) / 2;
  18745. const yMid = y0 + (y1 - y0) / 2;
  18746. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  18747. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  18748. 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");
  18749. if (fillColor) {
  18750. buffer.push("B");
  18751. } else {
  18752. buffer.push("S");
  18753. }
  18754. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18755. }
  18756. });
  18757. }
  18758. }
  18759. }
  18760. class PolylineAnnotation extends MarkupAnnotation {
  18761. constructor(parameters) {
  18762. super(parameters);
  18763. this.data.annotationType = _util.AnnotationType.POLYLINE;
  18764. this.data.vertices = [];
  18765. const rawVertices = parameters.dict.getArray("Vertices");
  18766. if (!Array.isArray(rawVertices)) {
  18767. return;
  18768. }
  18769. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  18770. this.data.vertices.push({
  18771. x: rawVertices[i],
  18772. y: rawVertices[i + 1]
  18773. });
  18774. }
  18775. if (!this.appearance) {
  18776. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18777. const strokeAlpha = parameters.dict.get("CA");
  18778. const borderWidth = this.borderStyle.width || 1,
  18779. borderAdjust = 2 * borderWidth;
  18780. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18781. for (const vertex of this.data.vertices) {
  18782. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18783. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18784. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18785. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18786. }
  18787. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18788. this.rectangle = bbox;
  18789. }
  18790. this._setDefaultAppearance({
  18791. xref: parameters.xref,
  18792. extra: `${borderWidth} w`,
  18793. strokeColor,
  18794. strokeAlpha,
  18795. pointsCallback: (buffer, points) => {
  18796. const vertices = this.data.vertices;
  18797. for (let i = 0, ii = vertices.length; i < ii; i++) {
  18798. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  18799. }
  18800. buffer.push("S");
  18801. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18802. }
  18803. });
  18804. }
  18805. }
  18806. }
  18807. class PolygonAnnotation extends PolylineAnnotation {
  18808. constructor(parameters) {
  18809. super(parameters);
  18810. this.data.annotationType = _util.AnnotationType.POLYGON;
  18811. }
  18812. }
  18813. class CaretAnnotation extends MarkupAnnotation {
  18814. constructor(parameters) {
  18815. super(parameters);
  18816. this.data.annotationType = _util.AnnotationType.CARET;
  18817. }
  18818. }
  18819. class InkAnnotation extends MarkupAnnotation {
  18820. constructor(parameters) {
  18821. super(parameters);
  18822. this.data.annotationType = _util.AnnotationType.INK;
  18823. this.data.inkLists = [];
  18824. const rawInkLists = parameters.dict.getArray("InkList");
  18825. if (!Array.isArray(rawInkLists)) {
  18826. return;
  18827. }
  18828. const xref = parameters.xref;
  18829. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  18830. this.data.inkLists.push([]);
  18831. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  18832. this.data.inkLists[i].push({
  18833. x: xref.fetchIfRef(rawInkLists[i][j]),
  18834. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  18835. });
  18836. }
  18837. }
  18838. if (!this.appearance) {
  18839. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18840. const strokeAlpha = parameters.dict.get("CA");
  18841. const borderWidth = this.borderStyle.width || 1,
  18842. borderAdjust = 2 * borderWidth;
  18843. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18844. for (const inkLists of this.data.inkLists) {
  18845. for (const vertex of inkLists) {
  18846. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18847. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18848. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18849. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18850. }
  18851. }
  18852. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18853. this.rectangle = bbox;
  18854. }
  18855. this._setDefaultAppearance({
  18856. xref: parameters.xref,
  18857. extra: `${borderWidth} w`,
  18858. strokeColor,
  18859. strokeAlpha,
  18860. pointsCallback: (buffer, points) => {
  18861. for (const inkList of this.data.inkLists) {
  18862. for (let i = 0, ii = inkList.length; i < ii; i++) {
  18863. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  18864. }
  18865. buffer.push("S");
  18866. }
  18867. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18868. }
  18869. });
  18870. }
  18871. }
  18872. }
  18873. class HighlightAnnotation extends MarkupAnnotation {
  18874. constructor(parameters) {
  18875. super(parameters);
  18876. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  18877. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18878. if (quadPoints) {
  18879. const resources = this.appearance && this.appearance.dict.get("Resources");
  18880. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  18881. if (this.appearance) {
  18882. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  18883. }
  18884. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  18885. const fillAlpha = parameters.dict.get("CA");
  18886. this._setDefaultAppearance({
  18887. xref: parameters.xref,
  18888. fillColor,
  18889. blendMode: "Multiply",
  18890. fillAlpha,
  18891. pointsCallback: (buffer, points) => {
  18892. 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");
  18893. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18894. }
  18895. });
  18896. }
  18897. } else {
  18898. this.data.hasPopup = false;
  18899. }
  18900. }
  18901. }
  18902. class UnderlineAnnotation extends MarkupAnnotation {
  18903. constructor(parameters) {
  18904. super(parameters);
  18905. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  18906. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18907. if (quadPoints) {
  18908. if (!this.appearance) {
  18909. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18910. const strokeAlpha = parameters.dict.get("CA");
  18911. this._setDefaultAppearance({
  18912. xref: parameters.xref,
  18913. extra: "[] 0 d 1 w",
  18914. strokeColor,
  18915. strokeAlpha,
  18916. pointsCallback: (buffer, points) => {
  18917. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  18918. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18919. }
  18920. });
  18921. }
  18922. } else {
  18923. this.data.hasPopup = false;
  18924. }
  18925. }
  18926. }
  18927. class SquigglyAnnotation extends MarkupAnnotation {
  18928. constructor(parameters) {
  18929. super(parameters);
  18930. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  18931. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18932. if (quadPoints) {
  18933. if (!this.appearance) {
  18934. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18935. const strokeAlpha = parameters.dict.get("CA");
  18936. this._setDefaultAppearance({
  18937. xref: parameters.xref,
  18938. extra: "[] 0 d 1 w",
  18939. strokeColor,
  18940. strokeAlpha,
  18941. pointsCallback: (buffer, points) => {
  18942. const dy = (points[0].y - points[2].y) / 6;
  18943. let shift = dy;
  18944. let x = points[2].x;
  18945. const y = points[2].y;
  18946. const xEnd = points[3].x;
  18947. buffer.push(`${x} ${y + shift} m`);
  18948. do {
  18949. x += 2;
  18950. shift = shift === 0 ? dy : 0;
  18951. buffer.push(`${x} ${y + shift} l`);
  18952. } while (x < xEnd);
  18953. buffer.push("S");
  18954. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  18955. }
  18956. });
  18957. }
  18958. } else {
  18959. this.data.hasPopup = false;
  18960. }
  18961. }
  18962. }
  18963. class StrikeOutAnnotation extends MarkupAnnotation {
  18964. constructor(parameters) {
  18965. super(parameters);
  18966. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  18967. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18968. if (quadPoints) {
  18969. if (!this.appearance) {
  18970. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18971. const strokeAlpha = parameters.dict.get("CA");
  18972. this._setDefaultAppearance({
  18973. xref: parameters.xref,
  18974. extra: "[] 0 d 1 w",
  18975. strokeColor,
  18976. strokeAlpha,
  18977. pointsCallback: (buffer, points) => {
  18978. 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");
  18979. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18980. }
  18981. });
  18982. }
  18983. } else {
  18984. this.data.hasPopup = false;
  18985. }
  18986. }
  18987. }
  18988. class StampAnnotation extends MarkupAnnotation {
  18989. constructor(parameters) {
  18990. super(parameters);
  18991. this.data.annotationType = _util.AnnotationType.STAMP;
  18992. }
  18993. }
  18994. class FileAttachmentAnnotation extends MarkupAnnotation {
  18995. constructor(parameters) {
  18996. super(parameters);
  18997. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  18998. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  18999. this.data.file = file.serializable;
  19000. }
  19001. }
  19002. /***/ }),
  19003. /* 23 */
  19004. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19005. Object.defineProperty(exports, "__esModule", ({
  19006. value: true
  19007. }));
  19008. exports.createDefaultAppearance = createDefaultAppearance;
  19009. exports.parseDefaultAppearance = parseDefaultAppearance;
  19010. var _util = __w_pdfjs_require__(2);
  19011. var _colorspace = __w_pdfjs_require__(24);
  19012. var _core_utils = __w_pdfjs_require__(9);
  19013. var _evaluator = __w_pdfjs_require__(25);
  19014. var _primitives = __w_pdfjs_require__(5);
  19015. var _stream = __w_pdfjs_require__(10);
  19016. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  19017. constructor(str) {
  19018. super(new _stream.StringStream(str));
  19019. }
  19020. parse() {
  19021. const operation = {
  19022. fn: 0,
  19023. args: []
  19024. };
  19025. const result = {
  19026. fontSize: 0,
  19027. fontName: "",
  19028. fontColor: new Uint8ClampedArray(3)
  19029. };
  19030. try {
  19031. while (true) {
  19032. operation.args.length = 0;
  19033. if (!this.read(operation)) {
  19034. break;
  19035. }
  19036. if (this.savedStatesDepth !== 0) {
  19037. continue;
  19038. }
  19039. const {
  19040. fn,
  19041. args
  19042. } = operation;
  19043. switch (fn | 0) {
  19044. case _util.OPS.setFont:
  19045. const [fontName, fontSize] = args;
  19046. if (fontName instanceof _primitives.Name) {
  19047. result.fontName = fontName.name;
  19048. }
  19049. if (typeof fontSize === "number" && fontSize > 0) {
  19050. result.fontSize = fontSize;
  19051. }
  19052. break;
  19053. case _util.OPS.setFillRGBColor:
  19054. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  19055. break;
  19056. case _util.OPS.setFillGray:
  19057. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  19058. break;
  19059. case _util.OPS.setFillColorSpace:
  19060. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  19061. break;
  19062. }
  19063. }
  19064. } catch (reason) {
  19065. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  19066. }
  19067. return result;
  19068. }
  19069. }
  19070. function parseDefaultAppearance(str) {
  19071. return new DefaultAppearanceEvaluator(str).parse();
  19072. }
  19073. function createDefaultAppearance({
  19074. fontSize,
  19075. fontName,
  19076. fontColor
  19077. }) {
  19078. let colorCmd;
  19079. if (fontColor.every(c => c === 0)) {
  19080. colorCmd = "0 g";
  19081. } else {
  19082. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  19083. }
  19084. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  19085. }
  19086. /***/ }),
  19087. /* 24 */
  19088. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19089. Object.defineProperty(exports, "__esModule", ({
  19090. value: true
  19091. }));
  19092. exports.ColorSpace = void 0;
  19093. var _util = __w_pdfjs_require__(2);
  19094. var _primitives = __w_pdfjs_require__(5);
  19095. var _core_utils = __w_pdfjs_require__(9);
  19096. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  19097. const COMPONENTS = 3;
  19098. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  19099. const xRatio = w1 / w2;
  19100. const yRatio = h1 / h2;
  19101. let newIndex = 0,
  19102. oldIndex;
  19103. const xScaled = new Uint16Array(w2);
  19104. const w1Scanline = w1 * COMPONENTS;
  19105. for (let i = 0; i < w2; i++) {
  19106. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  19107. }
  19108. for (let i = 0; i < h2; i++) {
  19109. const py = Math.floor(i * yRatio) * w1Scanline;
  19110. for (let j = 0; j < w2; j++) {
  19111. oldIndex = py + xScaled[j];
  19112. dest[newIndex++] = src[oldIndex++];
  19113. dest[newIndex++] = src[oldIndex++];
  19114. dest[newIndex++] = src[oldIndex++];
  19115. newIndex += alpha01;
  19116. }
  19117. }
  19118. }
  19119. class ColorSpace {
  19120. constructor(name, numComps) {
  19121. if (this.constructor === ColorSpace) {
  19122. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  19123. }
  19124. this.name = name;
  19125. this.numComps = numComps;
  19126. }
  19127. getRgb(src, srcOffset) {
  19128. const rgb = new Uint8ClampedArray(3);
  19129. this.getRgbItem(src, srcOffset, rgb, 0);
  19130. return rgb;
  19131. }
  19132. getRgbItem(src, srcOffset, dest, destOffset) {
  19133. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  19134. }
  19135. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19136. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  19137. }
  19138. getOutputLength(inputLength, alpha01) {
  19139. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  19140. }
  19141. isPassthrough(bits) {
  19142. return false;
  19143. }
  19144. isDefaultDecode(decodeMap, bpc) {
  19145. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  19146. }
  19147. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  19148. const count = originalWidth * originalHeight;
  19149. let rgbBuf = null;
  19150. const numComponentColors = 1 << bpc;
  19151. const needsResizing = originalHeight !== height || originalWidth !== width;
  19152. if (this.isPassthrough(bpc)) {
  19153. rgbBuf = comps;
  19154. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  19155. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  19156. for (let i = 0; i < numComponentColors; i++) {
  19157. allColors[i] = i;
  19158. }
  19159. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  19160. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  19161. if (!needsResizing) {
  19162. let destPos = 0;
  19163. for (let i = 0; i < count; ++i) {
  19164. const key = comps[i] * 3;
  19165. dest[destPos++] = colorMap[key];
  19166. dest[destPos++] = colorMap[key + 1];
  19167. dest[destPos++] = colorMap[key + 2];
  19168. destPos += alpha01;
  19169. }
  19170. } else {
  19171. rgbBuf = new Uint8Array(count * 3);
  19172. let rgbPos = 0;
  19173. for (let i = 0; i < count; ++i) {
  19174. const key = comps[i] * 3;
  19175. rgbBuf[rgbPos++] = colorMap[key];
  19176. rgbBuf[rgbPos++] = colorMap[key + 1];
  19177. rgbBuf[rgbPos++] = colorMap[key + 2];
  19178. }
  19179. }
  19180. } else {
  19181. if (!needsResizing) {
  19182. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  19183. } else {
  19184. rgbBuf = new Uint8ClampedArray(count * 3);
  19185. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  19186. }
  19187. }
  19188. if (rgbBuf) {
  19189. if (needsResizing) {
  19190. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  19191. } else {
  19192. let destPos = 0,
  19193. rgbPos = 0;
  19194. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  19195. dest[destPos++] = rgbBuf[rgbPos++];
  19196. dest[destPos++] = rgbBuf[rgbPos++];
  19197. dest[destPos++] = rgbBuf[rgbPos++];
  19198. destPos += alpha01;
  19199. }
  19200. }
  19201. }
  19202. }
  19203. get usesZeroToOneRange() {
  19204. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  19205. }
  19206. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  19207. if (!localColorSpaceCache) {
  19208. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  19209. }
  19210. if (!parsedColorSpace) {
  19211. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  19212. }
  19213. let csName, csRef;
  19214. if (cacheKey instanceof _primitives.Ref) {
  19215. csRef = cacheKey;
  19216. cacheKey = xref.fetch(cacheKey);
  19217. }
  19218. if (cacheKey instanceof _primitives.Name) {
  19219. csName = cacheKey.name;
  19220. }
  19221. if (csName || csRef) {
  19222. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  19223. }
  19224. }
  19225. static getCached(cacheKey, xref, localColorSpaceCache) {
  19226. if (!localColorSpaceCache) {
  19227. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  19228. }
  19229. if (cacheKey instanceof _primitives.Ref) {
  19230. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  19231. if (localColorSpace) {
  19232. return localColorSpace;
  19233. }
  19234. try {
  19235. cacheKey = xref.fetch(cacheKey);
  19236. } catch (ex) {
  19237. if (ex instanceof _core_utils.MissingDataException) {
  19238. throw ex;
  19239. }
  19240. }
  19241. }
  19242. if (cacheKey instanceof _primitives.Name) {
  19243. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  19244. if (localColorSpace) {
  19245. return localColorSpace;
  19246. }
  19247. }
  19248. return null;
  19249. }
  19250. static async parseAsync({
  19251. cs,
  19252. xref,
  19253. resources = null,
  19254. pdfFunctionFactory,
  19255. localColorSpaceCache
  19256. }) {
  19257. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19258. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19259. return parsedColorSpace;
  19260. }
  19261. static parse({
  19262. cs,
  19263. xref,
  19264. resources = null,
  19265. pdfFunctionFactory,
  19266. localColorSpaceCache
  19267. }) {
  19268. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  19269. if (cachedColorSpace) {
  19270. return cachedColorSpace;
  19271. }
  19272. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19273. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19274. return parsedColorSpace;
  19275. }
  19276. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  19277. cs = xref.fetchIfRef(cs);
  19278. if ((0, _primitives.isName)(cs)) {
  19279. switch (cs.name) {
  19280. case "G":
  19281. case "DeviceGray":
  19282. return this.singletons.gray;
  19283. case "RGB":
  19284. case "DeviceRGB":
  19285. return this.singletons.rgb;
  19286. case "CMYK":
  19287. case "DeviceCMYK":
  19288. return this.singletons.cmyk;
  19289. case "Pattern":
  19290. return new PatternCS(null);
  19291. default:
  19292. if ((0, _primitives.isDict)(resources)) {
  19293. const colorSpaces = resources.get("ColorSpace");
  19294. if ((0, _primitives.isDict)(colorSpaces)) {
  19295. const resourcesCS = colorSpaces.get(cs.name);
  19296. if (resourcesCS) {
  19297. if ((0, _primitives.isName)(resourcesCS)) {
  19298. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  19299. }
  19300. cs = resourcesCS;
  19301. break;
  19302. }
  19303. }
  19304. }
  19305. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  19306. }
  19307. }
  19308. if (Array.isArray(cs)) {
  19309. const mode = xref.fetchIfRef(cs[0]).name;
  19310. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  19311. switch (mode) {
  19312. case "G":
  19313. case "DeviceGray":
  19314. return this.singletons.gray;
  19315. case "RGB":
  19316. case "DeviceRGB":
  19317. return this.singletons.rgb;
  19318. case "CMYK":
  19319. case "DeviceCMYK":
  19320. return this.singletons.cmyk;
  19321. case "CalGray":
  19322. params = xref.fetchIfRef(cs[1]);
  19323. whitePoint = params.getArray("WhitePoint");
  19324. blackPoint = params.getArray("BlackPoint");
  19325. gamma = params.get("Gamma");
  19326. return new CalGrayCS(whitePoint, blackPoint, gamma);
  19327. case "CalRGB":
  19328. params = xref.fetchIfRef(cs[1]);
  19329. whitePoint = params.getArray("WhitePoint");
  19330. blackPoint = params.getArray("BlackPoint");
  19331. gamma = params.getArray("Gamma");
  19332. const matrix = params.getArray("Matrix");
  19333. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  19334. case "ICCBased":
  19335. const stream = xref.fetchIfRef(cs[1]);
  19336. const dict = stream.dict;
  19337. numComps = dict.get("N");
  19338. const alt = dict.get("Alternate");
  19339. if (alt) {
  19340. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  19341. if (altCS.numComps === numComps) {
  19342. return altCS;
  19343. }
  19344. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  19345. }
  19346. if (numComps === 1) {
  19347. return this.singletons.gray;
  19348. } else if (numComps === 3) {
  19349. return this.singletons.rgb;
  19350. } else if (numComps === 4) {
  19351. return this.singletons.cmyk;
  19352. }
  19353. break;
  19354. case "Pattern":
  19355. baseCS = cs[1] || null;
  19356. if (baseCS) {
  19357. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  19358. }
  19359. return new PatternCS(baseCS);
  19360. case "I":
  19361. case "Indexed":
  19362. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  19363. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  19364. const lookup = xref.fetchIfRef(cs[3]);
  19365. return new IndexedCS(baseCS, hiVal, lookup);
  19366. case "Separation":
  19367. case "DeviceN":
  19368. const name = xref.fetchIfRef(cs[1]);
  19369. numComps = Array.isArray(name) ? name.length : 1;
  19370. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  19371. const tintFn = pdfFunctionFactory.create(cs[3]);
  19372. return new AlternateCS(numComps, baseCS, tintFn);
  19373. case "Lab":
  19374. params = xref.fetchIfRef(cs[1]);
  19375. whitePoint = params.getArray("WhitePoint");
  19376. blackPoint = params.getArray("BlackPoint");
  19377. const range = params.getArray("Range");
  19378. return new LabCS(whitePoint, blackPoint, range);
  19379. default:
  19380. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  19381. }
  19382. }
  19383. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  19384. }
  19385. static isDefaultDecode(decode, numComps) {
  19386. if (!Array.isArray(decode)) {
  19387. return true;
  19388. }
  19389. if (numComps * 2 !== decode.length) {
  19390. (0, _util.warn)("The decode map is not the correct length");
  19391. return true;
  19392. }
  19393. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  19394. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  19395. return false;
  19396. }
  19397. }
  19398. return true;
  19399. }
  19400. static get singletons() {
  19401. return (0, _util.shadow)(this, "singletons", {
  19402. get gray() {
  19403. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  19404. },
  19405. get rgb() {
  19406. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  19407. },
  19408. get cmyk() {
  19409. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  19410. }
  19411. });
  19412. }
  19413. }
  19414. exports.ColorSpace = ColorSpace;
  19415. class AlternateCS extends ColorSpace {
  19416. constructor(numComps, base, tintFn) {
  19417. super("Alternate", numComps);
  19418. this.base = base;
  19419. this.tintFn = tintFn;
  19420. this.tmpBuf = new Float32Array(base.numComps);
  19421. }
  19422. getRgbItem(src, srcOffset, dest, destOffset) {
  19423. const tmpBuf = this.tmpBuf;
  19424. this.tintFn(src, srcOffset, tmpBuf, 0);
  19425. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  19426. }
  19427. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19428. const tintFn = this.tintFn;
  19429. const base = this.base;
  19430. const scale = 1 / ((1 << bits) - 1);
  19431. const baseNumComps = base.numComps;
  19432. const usesZeroToOneRange = base.usesZeroToOneRange;
  19433. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  19434. let pos = isPassthrough ? destOffset : 0;
  19435. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  19436. const numComps = this.numComps;
  19437. const scaled = new Float32Array(numComps);
  19438. const tinted = new Float32Array(baseNumComps);
  19439. let i, j;
  19440. for (i = 0; i < count; i++) {
  19441. for (j = 0; j < numComps; j++) {
  19442. scaled[j] = src[srcOffset++] * scale;
  19443. }
  19444. tintFn(scaled, 0, tinted, 0);
  19445. if (usesZeroToOneRange) {
  19446. for (j = 0; j < baseNumComps; j++) {
  19447. baseBuf[pos++] = tinted[j] * 255;
  19448. }
  19449. } else {
  19450. base.getRgbItem(tinted, 0, baseBuf, pos);
  19451. pos += baseNumComps;
  19452. }
  19453. }
  19454. if (!isPassthrough) {
  19455. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  19456. }
  19457. }
  19458. getOutputLength(inputLength, alpha01) {
  19459. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  19460. }
  19461. }
  19462. class PatternCS extends ColorSpace {
  19463. constructor(baseCS) {
  19464. super("Pattern", null);
  19465. this.base = baseCS;
  19466. }
  19467. isDefaultDecode(decodeMap, bpc) {
  19468. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  19469. }
  19470. }
  19471. class IndexedCS extends ColorSpace {
  19472. constructor(base, highVal, lookup) {
  19473. super("Indexed", 1);
  19474. this.base = base;
  19475. this.highVal = highVal;
  19476. const length = base.numComps * highVal;
  19477. this.lookup = new Uint8Array(length);
  19478. if ((0, _primitives.isStream)(lookup)) {
  19479. const bytes = lookup.getBytes(length);
  19480. this.lookup.set(bytes);
  19481. } else if (typeof lookup === "string") {
  19482. for (let i = 0; i < length; ++i) {
  19483. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  19484. }
  19485. } else {
  19486. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  19487. }
  19488. }
  19489. getRgbItem(src, srcOffset, dest, destOffset) {
  19490. const numComps = this.base.numComps;
  19491. const start = src[srcOffset] * numComps;
  19492. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  19493. }
  19494. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19495. const base = this.base;
  19496. const numComps = base.numComps;
  19497. const outputDelta = base.getOutputLength(numComps, alpha01);
  19498. const lookup = this.lookup;
  19499. for (let i = 0; i < count; ++i) {
  19500. const lookupPos = src[srcOffset++] * numComps;
  19501. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  19502. destOffset += outputDelta;
  19503. }
  19504. }
  19505. getOutputLength(inputLength, alpha01) {
  19506. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  19507. }
  19508. isDefaultDecode(decodeMap, bpc) {
  19509. if (!Array.isArray(decodeMap)) {
  19510. return true;
  19511. }
  19512. if (decodeMap.length !== 2) {
  19513. (0, _util.warn)("Decode map length is not correct");
  19514. return true;
  19515. }
  19516. if (!Number.isInteger(bpc) || bpc < 1) {
  19517. (0, _util.warn)("Bits per component is not correct");
  19518. return true;
  19519. }
  19520. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  19521. }
  19522. }
  19523. class DeviceGrayCS extends ColorSpace {
  19524. constructor() {
  19525. super("DeviceGray", 1);
  19526. }
  19527. getRgbItem(src, srcOffset, dest, destOffset) {
  19528. const c = src[srcOffset] * 255;
  19529. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  19530. }
  19531. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19532. const scale = 255 / ((1 << bits) - 1);
  19533. let j = srcOffset,
  19534. q = destOffset;
  19535. for (let i = 0; i < count; ++i) {
  19536. const c = scale * src[j++];
  19537. dest[q++] = c;
  19538. dest[q++] = c;
  19539. dest[q++] = c;
  19540. q += alpha01;
  19541. }
  19542. }
  19543. getOutputLength(inputLength, alpha01) {
  19544. return inputLength * (3 + alpha01);
  19545. }
  19546. }
  19547. class DeviceRgbCS extends ColorSpace {
  19548. constructor() {
  19549. super("DeviceRGB", 3);
  19550. }
  19551. getRgbItem(src, srcOffset, dest, destOffset) {
  19552. dest[destOffset] = src[srcOffset] * 255;
  19553. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  19554. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  19555. }
  19556. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19557. if (bits === 8 && alpha01 === 0) {
  19558. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  19559. return;
  19560. }
  19561. const scale = 255 / ((1 << bits) - 1);
  19562. let j = srcOffset,
  19563. q = destOffset;
  19564. for (let i = 0; i < count; ++i) {
  19565. dest[q++] = scale * src[j++];
  19566. dest[q++] = scale * src[j++];
  19567. dest[q++] = scale * src[j++];
  19568. q += alpha01;
  19569. }
  19570. }
  19571. getOutputLength(inputLength, alpha01) {
  19572. return inputLength * (3 + alpha01) / 3 | 0;
  19573. }
  19574. isPassthrough(bits) {
  19575. return bits === 8;
  19576. }
  19577. }
  19578. const DeviceCmykCS = function DeviceCmykCSClosure() {
  19579. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  19580. const c = src[srcOffset] * srcScale;
  19581. const m = src[srcOffset + 1] * srcScale;
  19582. const y = src[srcOffset + 2] * srcScale;
  19583. const k = src[srcOffset + 3] * srcScale;
  19584. 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);
  19585. 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);
  19586. 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);
  19587. }
  19588. class DeviceCmykCS extends ColorSpace {
  19589. constructor() {
  19590. super("DeviceCMYK", 4);
  19591. }
  19592. getRgbItem(src, srcOffset, dest, destOffset) {
  19593. convertToRgb(src, srcOffset, 1, dest, destOffset);
  19594. }
  19595. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19596. const scale = 1 / ((1 << bits) - 1);
  19597. for (let i = 0; i < count; i++) {
  19598. convertToRgb(src, srcOffset, scale, dest, destOffset);
  19599. srcOffset += 4;
  19600. destOffset += 3 + alpha01;
  19601. }
  19602. }
  19603. getOutputLength(inputLength, alpha01) {
  19604. return inputLength / 4 * (3 + alpha01) | 0;
  19605. }
  19606. }
  19607. return DeviceCmykCS;
  19608. }();
  19609. const CalGrayCS = function CalGrayCSClosure() {
  19610. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19611. const A = src[srcOffset] * scale;
  19612. const AG = A ** cs.G;
  19613. const L = cs.YW * AG;
  19614. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  19615. dest[destOffset] = val;
  19616. dest[destOffset + 1] = val;
  19617. dest[destOffset + 2] = val;
  19618. }
  19619. class CalGrayCS extends ColorSpace {
  19620. constructor(whitePoint, blackPoint, gamma) {
  19621. super("CalGray", 1);
  19622. if (!whitePoint) {
  19623. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  19624. }
  19625. blackPoint = blackPoint || [0, 0, 0];
  19626. gamma = gamma || 1;
  19627. this.XW = whitePoint[0];
  19628. this.YW = whitePoint[1];
  19629. this.ZW = whitePoint[2];
  19630. this.XB = blackPoint[0];
  19631. this.YB = blackPoint[1];
  19632. this.ZB = blackPoint[2];
  19633. this.G = gamma;
  19634. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19635. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19636. }
  19637. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19638. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  19639. this.XB = this.YB = this.ZB = 0;
  19640. }
  19641. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  19642. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  19643. }
  19644. if (this.G < 1) {
  19645. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  19646. this.G = 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 += 1;
  19657. destOffset += 3 + alpha01;
  19658. }
  19659. }
  19660. getOutputLength(inputLength, alpha01) {
  19661. return inputLength * (3 + alpha01);
  19662. }
  19663. }
  19664. return CalGrayCS;
  19665. }();
  19666. const CalRGBCS = function CalRGBCSClosure() {
  19667. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  19668. 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]);
  19669. 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]);
  19670. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  19671. const tempNormalizeMatrix = new Float32Array(3);
  19672. const tempConvertMatrix1 = new Float32Array(3);
  19673. const tempConvertMatrix2 = new Float32Array(3);
  19674. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  19675. function matrixProduct(a, b, result) {
  19676. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  19677. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  19678. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  19679. }
  19680. function convertToFlat(sourceWhitePoint, LMS, result) {
  19681. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  19682. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  19683. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  19684. }
  19685. function convertToD65(sourceWhitePoint, LMS, result) {
  19686. const D65X = 0.95047;
  19687. const D65Y = 1;
  19688. const D65Z = 1.08883;
  19689. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  19690. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  19691. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  19692. }
  19693. function sRGBTransferFunction(color) {
  19694. if (color <= 0.0031308) {
  19695. return adjustToRange(0, 1, 12.92 * color);
  19696. }
  19697. if (color >= 0.99554525) {
  19698. return 1;
  19699. }
  19700. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  19701. }
  19702. function adjustToRange(min, max, value) {
  19703. return Math.max(min, Math.min(max, value));
  19704. }
  19705. function decodeL(L) {
  19706. if (L < 0) {
  19707. return -decodeL(-L);
  19708. }
  19709. if (L > 8.0) {
  19710. return ((L + 16) / 116) ** 3;
  19711. }
  19712. return L * DECODE_L_CONSTANT;
  19713. }
  19714. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  19715. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  19716. result[0] = XYZ_Flat[0];
  19717. result[1] = XYZ_Flat[1];
  19718. result[2] = XYZ_Flat[2];
  19719. return;
  19720. }
  19721. const zeroDecodeL = decodeL(0);
  19722. const X_DST = zeroDecodeL;
  19723. const X_SRC = decodeL(sourceBlackPoint[0]);
  19724. const Y_DST = zeroDecodeL;
  19725. const Y_SRC = decodeL(sourceBlackPoint[1]);
  19726. const Z_DST = zeroDecodeL;
  19727. const Z_SRC = decodeL(sourceBlackPoint[2]);
  19728. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  19729. const X_Offset = 1 - X_Scale;
  19730. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  19731. const Y_Offset = 1 - Y_Scale;
  19732. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  19733. const Z_Offset = 1 - Z_Scale;
  19734. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  19735. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  19736. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  19737. }
  19738. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  19739. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  19740. result[0] = XYZ_In[0];
  19741. result[1] = XYZ_In[1];
  19742. result[2] = XYZ_In[2];
  19743. return;
  19744. }
  19745. const LMS = result;
  19746. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19747. const LMS_Flat = tempNormalizeMatrix;
  19748. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  19749. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  19750. }
  19751. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  19752. const LMS = result;
  19753. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19754. const LMS_D65 = tempNormalizeMatrix;
  19755. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  19756. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  19757. }
  19758. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19759. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  19760. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  19761. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  19762. const AGR = A === 1 ? 1 : A ** cs.GR;
  19763. const BGG = B === 1 ? 1 : B ** cs.GG;
  19764. const CGB = C === 1 ? 1 : C ** cs.GB;
  19765. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  19766. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  19767. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  19768. const XYZ = tempConvertMatrix1;
  19769. XYZ[0] = X;
  19770. XYZ[1] = Y;
  19771. XYZ[2] = Z;
  19772. const XYZ_Flat = tempConvertMatrix2;
  19773. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  19774. const XYZ_Black = tempConvertMatrix1;
  19775. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  19776. const XYZ_D65 = tempConvertMatrix2;
  19777. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  19778. const SRGB = tempConvertMatrix1;
  19779. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  19780. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  19781. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  19782. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  19783. }
  19784. class CalRGBCS extends ColorSpace {
  19785. constructor(whitePoint, blackPoint, gamma, matrix) {
  19786. super("CalRGB", 3);
  19787. if (!whitePoint) {
  19788. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  19789. }
  19790. blackPoint = blackPoint || new Float32Array(3);
  19791. gamma = gamma || new Float32Array([1, 1, 1]);
  19792. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  19793. const XW = whitePoint[0];
  19794. const YW = whitePoint[1];
  19795. const ZW = whitePoint[2];
  19796. this.whitePoint = whitePoint;
  19797. const XB = blackPoint[0];
  19798. const YB = blackPoint[1];
  19799. const ZB = blackPoint[2];
  19800. this.blackPoint = blackPoint;
  19801. this.GR = gamma[0];
  19802. this.GG = gamma[1];
  19803. this.GB = gamma[2];
  19804. this.MXA = matrix[0];
  19805. this.MYA = matrix[1];
  19806. this.MZA = matrix[2];
  19807. this.MXB = matrix[3];
  19808. this.MYB = matrix[4];
  19809. this.MZB = matrix[5];
  19810. this.MXC = matrix[6];
  19811. this.MYC = matrix[7];
  19812. this.MZC = matrix[8];
  19813. if (XW < 0 || ZW < 0 || YW !== 1) {
  19814. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19815. }
  19816. if (XB < 0 || YB < 0 || ZB < 0) {
  19817. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  19818. this.blackPoint = new Float32Array(3);
  19819. }
  19820. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  19821. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  19822. this.GR = this.GG = this.GB = 1;
  19823. }
  19824. }
  19825. getRgbItem(src, srcOffset, dest, destOffset) {
  19826. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19827. }
  19828. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19829. const scale = 1 / ((1 << bits) - 1);
  19830. for (let i = 0; i < count; ++i) {
  19831. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19832. srcOffset += 3;
  19833. destOffset += 3 + alpha01;
  19834. }
  19835. }
  19836. getOutputLength(inputLength, alpha01) {
  19837. return inputLength * (3 + alpha01) / 3 | 0;
  19838. }
  19839. }
  19840. return CalRGBCS;
  19841. }();
  19842. const LabCS = function LabCSClosure() {
  19843. function fn_g(x) {
  19844. let result;
  19845. if (x >= 6 / 29) {
  19846. result = x ** 3;
  19847. } else {
  19848. result = 108 / 841 * (x - 4 / 29);
  19849. }
  19850. return result;
  19851. }
  19852. function decode(value, high1, low2, high2) {
  19853. return low2 + value * (high2 - low2) / high1;
  19854. }
  19855. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  19856. let Ls = src[srcOffset];
  19857. let as = src[srcOffset + 1];
  19858. let bs = src[srcOffset + 2];
  19859. if (maxVal !== false) {
  19860. Ls = decode(Ls, maxVal, 0, 100);
  19861. as = decode(as, maxVal, cs.amin, cs.amax);
  19862. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  19863. }
  19864. if (as > cs.amax) {
  19865. as = cs.amax;
  19866. } else if (as < cs.amin) {
  19867. as = cs.amin;
  19868. }
  19869. if (bs > cs.bmax) {
  19870. bs = cs.bmax;
  19871. } else if (bs < cs.bmin) {
  19872. bs = cs.bmin;
  19873. }
  19874. const M = (Ls + 16) / 116;
  19875. const L = M + as / 500;
  19876. const N = M - bs / 200;
  19877. const X = cs.XW * fn_g(L);
  19878. const Y = cs.YW * fn_g(M);
  19879. const Z = cs.ZW * fn_g(N);
  19880. let r, g, b;
  19881. if (cs.ZW < 1) {
  19882. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  19883. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  19884. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  19885. } else {
  19886. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  19887. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  19888. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  19889. }
  19890. dest[destOffset] = Math.sqrt(r) * 255;
  19891. dest[destOffset + 1] = Math.sqrt(g) * 255;
  19892. dest[destOffset + 2] = Math.sqrt(b) * 255;
  19893. }
  19894. class LabCS extends ColorSpace {
  19895. constructor(whitePoint, blackPoint, range) {
  19896. super("Lab", 3);
  19897. if (!whitePoint) {
  19898. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  19899. }
  19900. blackPoint = blackPoint || [0, 0, 0];
  19901. range = range || [-100, 100, -100, 100];
  19902. this.XW = whitePoint[0];
  19903. this.YW = whitePoint[1];
  19904. this.ZW = whitePoint[2];
  19905. this.amin = range[0];
  19906. this.amax = range[1];
  19907. this.bmin = range[2];
  19908. this.bmax = range[3];
  19909. this.XB = blackPoint[0];
  19910. this.YB = blackPoint[1];
  19911. this.ZB = blackPoint[2];
  19912. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19913. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  19914. }
  19915. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19916. (0, _util.info)("Invalid BlackPoint, falling back to default");
  19917. this.XB = this.YB = this.ZB = 0;
  19918. }
  19919. if (this.amin > this.amax || this.bmin > this.bmax) {
  19920. (0, _util.info)("Invalid Range, falling back to defaults");
  19921. this.amin = -100;
  19922. this.amax = 100;
  19923. this.bmin = -100;
  19924. this.bmax = 100;
  19925. }
  19926. }
  19927. getRgbItem(src, srcOffset, dest, destOffset) {
  19928. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  19929. }
  19930. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19931. const maxVal = (1 << bits) - 1;
  19932. for (let i = 0; i < count; i++) {
  19933. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  19934. srcOffset += 3;
  19935. destOffset += 3 + alpha01;
  19936. }
  19937. }
  19938. getOutputLength(inputLength, alpha01) {
  19939. return inputLength * (3 + alpha01) / 3 | 0;
  19940. }
  19941. isDefaultDecode(decodeMap, bpc) {
  19942. return true;
  19943. }
  19944. get usesZeroToOneRange() {
  19945. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  19946. }
  19947. }
  19948. return LabCS;
  19949. }();
  19950. /***/ }),
  19951. /* 25 */
  19952. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19953. Object.defineProperty(exports, "__esModule", ({
  19954. value: true
  19955. }));
  19956. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  19957. var _util = __w_pdfjs_require__(2);
  19958. var _cmap = __w_pdfjs_require__(26);
  19959. var _primitives = __w_pdfjs_require__(5);
  19960. var _fonts = __w_pdfjs_require__(44);
  19961. var _fonts_utils = __w_pdfjs_require__(18);
  19962. var _encodings = __w_pdfjs_require__(19);
  19963. var _standard_fonts = __w_pdfjs_require__(47);
  19964. var _unicode = __w_pdfjs_require__(21);
  19965. var _pattern = __w_pdfjs_require__(55);
  19966. var _xfa_fonts = __w_pdfjs_require__(12);
  19967. var _to_unicode_map = __w_pdfjs_require__(48);
  19968. var _function = __w_pdfjs_require__(56);
  19969. var _parser = __w_pdfjs_require__(27);
  19970. var _image_utils = __w_pdfjs_require__(58);
  19971. var _stream = __w_pdfjs_require__(10);
  19972. var _base_stream = __w_pdfjs_require__(6);
  19973. var _bidi = __w_pdfjs_require__(59);
  19974. var _colorspace = __w_pdfjs_require__(24);
  19975. var _decode_stream = __w_pdfjs_require__(29);
  19976. var _glyphlist = __w_pdfjs_require__(20);
  19977. var _core_utils = __w_pdfjs_require__(9);
  19978. var _metrics = __w_pdfjs_require__(60);
  19979. var _murmurhash = __w_pdfjs_require__(61);
  19980. var _operator_list = __w_pdfjs_require__(62);
  19981. var _image = __w_pdfjs_require__(63);
  19982. const DefaultPartialEvaluatorOptions = Object.freeze({
  19983. maxImageSize: -1,
  19984. disableFontFace: false,
  19985. ignoreErrors: false,
  19986. isEvalSupported: true,
  19987. fontExtraProperties: false,
  19988. useSystemFonts: true,
  19989. cMapUrl: null,
  19990. standardFontDataUrl: null
  19991. });
  19992. const PatternType = {
  19993. TILING: 1,
  19994. SHADING: 2
  19995. };
  19996. const TEXT_CHUNK_BATCH_SIZE = 10;
  19997. const deferred = Promise.resolve();
  19998. function normalizeBlendMode(value, parsingArray = false) {
  19999. if (Array.isArray(value)) {
  20000. for (let i = 0, ii = value.length; i < ii; i++) {
  20001. const maybeBM = normalizeBlendMode(value[i], true);
  20002. if (maybeBM) {
  20003. return maybeBM;
  20004. }
  20005. }
  20006. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  20007. return "source-over";
  20008. }
  20009. if (!(0, _primitives.isName)(value)) {
  20010. if (parsingArray) {
  20011. return null;
  20012. }
  20013. return "source-over";
  20014. }
  20015. switch (value.name) {
  20016. case "Normal":
  20017. case "Compatible":
  20018. return "source-over";
  20019. case "Multiply":
  20020. return "multiply";
  20021. case "Screen":
  20022. return "screen";
  20023. case "Overlay":
  20024. return "overlay";
  20025. case "Darken":
  20026. return "darken";
  20027. case "Lighten":
  20028. return "lighten";
  20029. case "ColorDodge":
  20030. return "color-dodge";
  20031. case "ColorBurn":
  20032. return "color-burn";
  20033. case "HardLight":
  20034. return "hard-light";
  20035. case "SoftLight":
  20036. return "soft-light";
  20037. case "Difference":
  20038. return "difference";
  20039. case "Exclusion":
  20040. return "exclusion";
  20041. case "Hue":
  20042. return "hue";
  20043. case "Saturation":
  20044. return "saturation";
  20045. case "Color":
  20046. return "color";
  20047. case "Luminosity":
  20048. return "luminosity";
  20049. }
  20050. if (parsingArray) {
  20051. return null;
  20052. }
  20053. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  20054. return "source-over";
  20055. }
  20056. class TimeSlotManager {
  20057. static get TIME_SLOT_DURATION_MS() {
  20058. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  20059. }
  20060. static get CHECK_TIME_EVERY() {
  20061. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  20062. }
  20063. constructor() {
  20064. this.reset();
  20065. }
  20066. check() {
  20067. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  20068. return false;
  20069. }
  20070. this.checked = 0;
  20071. return this.endTime <= Date.now();
  20072. }
  20073. reset() {
  20074. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  20075. this.checked = 0;
  20076. }
  20077. }
  20078. class PartialEvaluator {
  20079. constructor({
  20080. xref,
  20081. handler,
  20082. pageIndex,
  20083. idFactory,
  20084. fontCache,
  20085. builtInCMapCache,
  20086. standardFontDataCache,
  20087. globalImageCache,
  20088. options = null
  20089. }) {
  20090. this.xref = xref;
  20091. this.handler = handler;
  20092. this.pageIndex = pageIndex;
  20093. this.idFactory = idFactory;
  20094. this.fontCache = fontCache;
  20095. this.builtInCMapCache = builtInCMapCache;
  20096. this.standardFontDataCache = standardFontDataCache;
  20097. this.globalImageCache = globalImageCache;
  20098. this.options = options || DefaultPartialEvaluatorOptions;
  20099. this.parsingType3Font = false;
  20100. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  20101. }
  20102. get _pdfFunctionFactory() {
  20103. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  20104. xref: this.xref,
  20105. isEvalSupported: this.options.isEvalSupported
  20106. });
  20107. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  20108. }
  20109. clone(newOptions = null) {
  20110. const newEvaluator = Object.create(this);
  20111. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  20112. return newEvaluator;
  20113. }
  20114. hasBlendModes(resources, nonBlendModesSet) {
  20115. if (!(resources instanceof _primitives.Dict)) {
  20116. return false;
  20117. }
  20118. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  20119. return false;
  20120. }
  20121. const processed = new _primitives.RefSet(nonBlendModesSet);
  20122. if (resources.objId) {
  20123. processed.put(resources.objId);
  20124. }
  20125. const nodes = [resources],
  20126. xref = this.xref;
  20127. while (nodes.length) {
  20128. const node = nodes.shift();
  20129. const graphicStates = node.get("ExtGState");
  20130. if (graphicStates instanceof _primitives.Dict) {
  20131. for (let graphicState of graphicStates.getRawValues()) {
  20132. if (graphicState instanceof _primitives.Ref) {
  20133. if (processed.has(graphicState)) {
  20134. continue;
  20135. }
  20136. try {
  20137. graphicState = xref.fetch(graphicState);
  20138. } catch (ex) {
  20139. processed.put(graphicState);
  20140. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  20141. continue;
  20142. }
  20143. }
  20144. if (!(graphicState instanceof _primitives.Dict)) {
  20145. continue;
  20146. }
  20147. if (graphicState.objId) {
  20148. processed.put(graphicState.objId);
  20149. }
  20150. const bm = graphicState.get("BM");
  20151. if (bm instanceof _primitives.Name) {
  20152. if (bm.name !== "Normal") {
  20153. return true;
  20154. }
  20155. continue;
  20156. }
  20157. if (bm !== undefined && Array.isArray(bm)) {
  20158. for (const element of bm) {
  20159. if (element instanceof _primitives.Name && element.name !== "Normal") {
  20160. return true;
  20161. }
  20162. }
  20163. }
  20164. }
  20165. }
  20166. const xObjects = node.get("XObject");
  20167. if (!(xObjects instanceof _primitives.Dict)) {
  20168. continue;
  20169. }
  20170. for (let xObject of xObjects.getRawValues()) {
  20171. if (xObject instanceof _primitives.Ref) {
  20172. if (processed.has(xObject)) {
  20173. continue;
  20174. }
  20175. try {
  20176. xObject = xref.fetch(xObject);
  20177. } catch (ex) {
  20178. processed.put(xObject);
  20179. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  20180. continue;
  20181. }
  20182. }
  20183. if (!(0, _primitives.isStream)(xObject)) {
  20184. continue;
  20185. }
  20186. if (xObject.dict.objId) {
  20187. processed.put(xObject.dict.objId);
  20188. }
  20189. const xResources = xObject.dict.get("Resources");
  20190. if (!(xResources instanceof _primitives.Dict)) {
  20191. continue;
  20192. }
  20193. if (xResources.objId && processed.has(xResources.objId)) {
  20194. continue;
  20195. }
  20196. nodes.push(xResources);
  20197. if (xResources.objId) {
  20198. processed.put(xResources.objId);
  20199. }
  20200. }
  20201. }
  20202. processed.forEach(ref => {
  20203. nonBlendModesSet.put(ref);
  20204. });
  20205. return false;
  20206. }
  20207. async fetchBuiltInCMap(name) {
  20208. const cachedData = this.builtInCMapCache.get(name);
  20209. if (cachedData) {
  20210. return cachedData;
  20211. }
  20212. let data;
  20213. if (this.options.cMapUrl !== null) {
  20214. const url = `${this.options.cMapUrl}${name}.bcmap`;
  20215. const response = await fetch(url);
  20216. if (!response.ok) {
  20217. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  20218. }
  20219. data = {
  20220. cMapData: new Uint8Array(await response.arrayBuffer()),
  20221. compressionType: _util.CMapCompressionType.BINARY
  20222. };
  20223. } else {
  20224. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  20225. name
  20226. });
  20227. }
  20228. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  20229. this.builtInCMapCache.set(name, data);
  20230. }
  20231. return data;
  20232. }
  20233. async fetchStandardFontData(name) {
  20234. const cachedData = this.standardFontDataCache.get(name);
  20235. if (cachedData) {
  20236. return new _stream.Stream(cachedData);
  20237. }
  20238. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  20239. return null;
  20240. }
  20241. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  20242. filename = standardFontNameToFileName[name];
  20243. let data;
  20244. if (this.options.standardFontDataUrl !== null) {
  20245. const url = `${this.options.standardFontDataUrl}${filename}`;
  20246. const response = await fetch(url);
  20247. if (!response.ok) {
  20248. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  20249. } else {
  20250. data = await response.arrayBuffer();
  20251. }
  20252. } else {
  20253. try {
  20254. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  20255. filename
  20256. });
  20257. } catch (e) {
  20258. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  20259. }
  20260. }
  20261. if (!data) {
  20262. return null;
  20263. }
  20264. this.standardFontDataCache.set(name, data);
  20265. return new _stream.Stream(data);
  20266. }
  20267. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  20268. const dict = xobj.dict;
  20269. const matrix = dict.getArray("Matrix");
  20270. let bbox = dict.getArray("BBox");
  20271. if (Array.isArray(bbox) && bbox.length === 4) {
  20272. bbox = _util.Util.normalizeRect(bbox);
  20273. } else {
  20274. bbox = null;
  20275. }
  20276. let optionalContent, groupOptions;
  20277. if (dict.has("OC")) {
  20278. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20279. }
  20280. if (optionalContent !== undefined) {
  20281. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20282. }
  20283. const group = dict.get("Group");
  20284. if (group) {
  20285. groupOptions = {
  20286. matrix,
  20287. bbox,
  20288. smask,
  20289. isolated: false,
  20290. knockout: false
  20291. };
  20292. const groupSubtype = group.get("S");
  20293. let colorSpace = null;
  20294. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  20295. groupOptions.isolated = group.get("I") || false;
  20296. groupOptions.knockout = group.get("K") || false;
  20297. if (group.has("CS")) {
  20298. const cs = group.getRaw("CS");
  20299. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  20300. if (cachedColorSpace) {
  20301. colorSpace = cachedColorSpace;
  20302. } else {
  20303. colorSpace = await this.parseColorSpace({
  20304. cs,
  20305. resources,
  20306. localColorSpaceCache
  20307. });
  20308. }
  20309. }
  20310. }
  20311. if (smask && smask.backdrop) {
  20312. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  20313. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  20314. }
  20315. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  20316. }
  20317. const args = group ? [matrix, null] : [matrix, bbox];
  20318. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  20319. return this.getOperatorList({
  20320. stream: xobj,
  20321. task,
  20322. resources: dict.get("Resources") || resources,
  20323. operatorList,
  20324. initialState
  20325. }).then(function () {
  20326. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  20327. if (group) {
  20328. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  20329. }
  20330. if (optionalContent !== undefined) {
  20331. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20332. }
  20333. });
  20334. }
  20335. _sendImgData(objId, imgData, cacheGlobally = false) {
  20336. const transfers = imgData ? [imgData.data.buffer] : null;
  20337. if (this.parsingType3Font || cacheGlobally) {
  20338. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  20339. }
  20340. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  20341. }
  20342. async buildPaintImageXObject({
  20343. resources,
  20344. image,
  20345. isInline = false,
  20346. operatorList,
  20347. cacheKey,
  20348. localImageCache,
  20349. localColorSpaceCache
  20350. }) {
  20351. const dict = image.dict;
  20352. const imageRef = dict.objId;
  20353. const w = dict.get("W", "Width");
  20354. const h = dict.get("H", "Height");
  20355. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  20356. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  20357. return;
  20358. }
  20359. const maxImageSize = this.options.maxImageSize;
  20360. if (maxImageSize !== -1 && w * h > maxImageSize) {
  20361. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  20362. return;
  20363. }
  20364. let optionalContent;
  20365. if (dict.has("OC")) {
  20366. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20367. }
  20368. if (optionalContent !== undefined) {
  20369. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20370. }
  20371. const imageMask = dict.get("IM", "ImageMask") || false;
  20372. const interpolate = dict.get("I", "Interpolate");
  20373. let imgData, args;
  20374. if (imageMask) {
  20375. const bitStrideLength = w + 7 >> 3;
  20376. const imgArray = image.getBytes(bitStrideLength * h, true);
  20377. const decode = dict.getArray("D", "Decode");
  20378. imgData = _image.PDFImage.createMask({
  20379. imgArray,
  20380. width: w,
  20381. height: h,
  20382. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20383. inverseDecode: !!decode && decode[0] > 0,
  20384. interpolate
  20385. });
  20386. imgData.cached = !!cacheKey;
  20387. args = [imgData];
  20388. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  20389. if (cacheKey) {
  20390. localImageCache.set(cacheKey, imageRef, {
  20391. fn: _util.OPS.paintImageMaskXObject,
  20392. args
  20393. });
  20394. }
  20395. if (optionalContent !== undefined) {
  20396. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20397. }
  20398. return;
  20399. }
  20400. const softMask = dict.get("SM", "SMask") || false;
  20401. const mask = dict.get("Mask") || false;
  20402. const SMALL_IMAGE_DIMENSIONS = 200;
  20403. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  20404. const imageObj = new _image.PDFImage({
  20405. xref: this.xref,
  20406. res: resources,
  20407. image,
  20408. isInline,
  20409. pdfFunctionFactory: this._pdfFunctionFactory,
  20410. localColorSpaceCache
  20411. });
  20412. imgData = imageObj.createImageData(true);
  20413. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  20414. if (optionalContent !== undefined) {
  20415. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20416. }
  20417. return;
  20418. }
  20419. let objId = `img_${this.idFactory.createObjId()}`,
  20420. cacheGlobally = false;
  20421. if (this.parsingType3Font) {
  20422. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  20423. } else if (imageRef) {
  20424. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  20425. if (cacheGlobally) {
  20426. objId = `${this.idFactory.getDocId()}_${objId}`;
  20427. }
  20428. }
  20429. operatorList.addDependency(objId);
  20430. args = [objId, w, h];
  20431. _image.PDFImage.buildImage({
  20432. xref: this.xref,
  20433. res: resources,
  20434. image,
  20435. isInline,
  20436. pdfFunctionFactory: this._pdfFunctionFactory,
  20437. localColorSpaceCache
  20438. }).then(imageObj => {
  20439. imgData = imageObj.createImageData(false);
  20440. if (cacheKey && imageRef && cacheGlobally) {
  20441. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  20442. }
  20443. return this._sendImgData(objId, imgData, cacheGlobally);
  20444. }).catch(reason => {
  20445. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  20446. return this._sendImgData(objId, null, cacheGlobally);
  20447. });
  20448. operatorList.addOp(_util.OPS.paintImageXObject, args);
  20449. if (cacheKey) {
  20450. localImageCache.set(cacheKey, imageRef, {
  20451. fn: _util.OPS.paintImageXObject,
  20452. args
  20453. });
  20454. if (imageRef) {
  20455. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  20456. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  20457. if (cacheGlobally) {
  20458. this.globalImageCache.setData(imageRef, {
  20459. objId,
  20460. fn: _util.OPS.paintImageXObject,
  20461. args,
  20462. byteSize: 0
  20463. });
  20464. }
  20465. }
  20466. }
  20467. if (optionalContent !== undefined) {
  20468. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20469. }
  20470. }
  20471. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  20472. const smaskContent = smask.get("G");
  20473. const smaskOptions = {
  20474. subtype: smask.get("S").name,
  20475. backdrop: smask.get("BC")
  20476. };
  20477. const transferObj = smask.get("TR");
  20478. if ((0, _function.isPDFFunction)(transferObj)) {
  20479. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20480. const transferMap = new Uint8Array(256);
  20481. const tmp = new Float32Array(1);
  20482. for (let i = 0; i < 256; i++) {
  20483. tmp[0] = i / 255;
  20484. transferFn(tmp, 0, tmp, 0);
  20485. transferMap[i] = tmp[0] * 255 | 0;
  20486. }
  20487. smaskOptions.transferMap = transferMap;
  20488. }
  20489. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  20490. }
  20491. handleTransferFunction(tr) {
  20492. let transferArray;
  20493. if (Array.isArray(tr)) {
  20494. transferArray = tr;
  20495. } else if ((0, _function.isPDFFunction)(tr)) {
  20496. transferArray = [tr];
  20497. } else {
  20498. return null;
  20499. }
  20500. const transferMaps = [];
  20501. let numFns = 0,
  20502. numEffectfulFns = 0;
  20503. for (const entry of transferArray) {
  20504. const transferObj = this.xref.fetchIfRef(entry);
  20505. numFns++;
  20506. if ((0, _primitives.isName)(transferObj, "Identity")) {
  20507. transferMaps.push(null);
  20508. continue;
  20509. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  20510. return null;
  20511. }
  20512. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20513. const transferMap = new Uint8Array(256),
  20514. tmp = new Float32Array(1);
  20515. for (let j = 0; j < 256; j++) {
  20516. tmp[0] = j / 255;
  20517. transferFn(tmp, 0, tmp, 0);
  20518. transferMap[j] = tmp[0] * 255 | 0;
  20519. }
  20520. transferMaps.push(transferMap);
  20521. numEffectfulFns++;
  20522. }
  20523. if (!(numFns === 1 || numFns === 4)) {
  20524. return null;
  20525. }
  20526. if (numEffectfulFns === 0) {
  20527. return null;
  20528. }
  20529. return transferMaps;
  20530. }
  20531. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  20532. const tilingOpList = new _operator_list.OperatorList();
  20533. const patternResources = _primitives.Dict.merge({
  20534. xref: this.xref,
  20535. dictArray: [patternDict.get("Resources"), resources]
  20536. });
  20537. return this.getOperatorList({
  20538. stream: pattern,
  20539. task,
  20540. resources: patternResources,
  20541. operatorList: tilingOpList
  20542. }).then(function () {
  20543. const operatorListIR = tilingOpList.getIR();
  20544. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  20545. operatorList.addDependencies(tilingOpList.dependencies);
  20546. operatorList.addOp(fn, tilingPatternIR);
  20547. if (patternDict.objId) {
  20548. localTilingPatternCache.set(null, patternDict.objId, {
  20549. operatorListIR,
  20550. dict: patternDict
  20551. });
  20552. }
  20553. }).catch(reason => {
  20554. if (reason instanceof _util.AbortException) {
  20555. return;
  20556. }
  20557. if (this.options.ignoreErrors) {
  20558. this.handler.send("UnsupportedFeature", {
  20559. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  20560. });
  20561. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  20562. return;
  20563. }
  20564. throw reason;
  20565. });
  20566. }
  20567. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  20568. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  20569. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  20570. if (!translated.font.isType3Font) {
  20571. return translated;
  20572. }
  20573. return translated.loadType3Data(this, resources, task).then(function () {
  20574. operatorList.addDependencies(translated.type3Dependencies);
  20575. return translated;
  20576. }).catch(reason => {
  20577. this.handler.send("UnsupportedFeature", {
  20578. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  20579. });
  20580. return new TranslatedFont({
  20581. loadedName: "g_font_error",
  20582. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  20583. dict: translated.font,
  20584. evaluatorOptions: this.options
  20585. });
  20586. });
  20587. }).then(translated => {
  20588. state.font = translated.font;
  20589. translated.send(this.handler);
  20590. return translated.loadedName;
  20591. });
  20592. }
  20593. handleText(chars, state) {
  20594. const font = state.font;
  20595. const glyphs = font.charsToGlyphs(chars);
  20596. if (font.data) {
  20597. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  20598. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  20599. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  20600. }
  20601. }
  20602. return glyphs;
  20603. }
  20604. ensureStateFont(state) {
  20605. if (state.font) {
  20606. return;
  20607. }
  20608. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  20609. if (this.options.ignoreErrors) {
  20610. this.handler.send("UnsupportedFeature", {
  20611. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  20612. });
  20613. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  20614. return;
  20615. }
  20616. throw reason;
  20617. }
  20618. async setGState({
  20619. resources,
  20620. gState,
  20621. operatorList,
  20622. cacheKey,
  20623. task,
  20624. stateManager,
  20625. localGStateCache,
  20626. localColorSpaceCache
  20627. }) {
  20628. const gStateRef = gState.objId;
  20629. let isSimpleGState = true;
  20630. const gStateObj = [];
  20631. const gStateKeys = gState.getKeys();
  20632. let promise = Promise.resolve();
  20633. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  20634. const key = gStateKeys[i];
  20635. const value = gState.get(key);
  20636. switch (key) {
  20637. case "Type":
  20638. break;
  20639. case "LW":
  20640. case "LC":
  20641. case "LJ":
  20642. case "ML":
  20643. case "D":
  20644. case "RI":
  20645. case "FL":
  20646. case "CA":
  20647. case "ca":
  20648. gStateObj.push([key, value]);
  20649. break;
  20650. case "Font":
  20651. isSimpleGState = false;
  20652. promise = promise.then(() => {
  20653. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  20654. operatorList.addDependency(loadedName);
  20655. gStateObj.push([key, [loadedName, value[1]]]);
  20656. });
  20657. });
  20658. break;
  20659. case "BM":
  20660. gStateObj.push([key, normalizeBlendMode(value)]);
  20661. break;
  20662. case "SMask":
  20663. if ((0, _primitives.isName)(value, "None")) {
  20664. gStateObj.push([key, false]);
  20665. break;
  20666. }
  20667. if ((0, _primitives.isDict)(value)) {
  20668. isSimpleGState = false;
  20669. promise = promise.then(() => {
  20670. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  20671. });
  20672. gStateObj.push([key, true]);
  20673. } else {
  20674. (0, _util.warn)("Unsupported SMask type");
  20675. }
  20676. break;
  20677. case "TR":
  20678. const transferMaps = this.handleTransferFunction(value);
  20679. gStateObj.push([key, transferMaps]);
  20680. break;
  20681. case "OP":
  20682. case "op":
  20683. case "OPM":
  20684. case "BG":
  20685. case "BG2":
  20686. case "UCR":
  20687. case "UCR2":
  20688. case "TR2":
  20689. case "HT":
  20690. case "SM":
  20691. case "SA":
  20692. case "AIS":
  20693. case "TK":
  20694. (0, _util.info)("graphic state operator " + key);
  20695. break;
  20696. default:
  20697. (0, _util.info)("Unknown graphic state operator " + key);
  20698. break;
  20699. }
  20700. }
  20701. return promise.then(function () {
  20702. if (gStateObj.length > 0) {
  20703. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  20704. }
  20705. if (isSimpleGState) {
  20706. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  20707. }
  20708. });
  20709. }
  20710. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  20711. const errorFont = async () => {
  20712. return new TranslatedFont({
  20713. loadedName: "g_font_error",
  20714. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  20715. dict: font,
  20716. evaluatorOptions: this.options
  20717. });
  20718. };
  20719. const xref = this.xref;
  20720. let fontRef;
  20721. if (font) {
  20722. if (!(0, _primitives.isRef)(font)) {
  20723. throw new _util.FormatError('The "font" object should be a reference.');
  20724. }
  20725. fontRef = font;
  20726. } else {
  20727. const fontRes = resources.get("Font");
  20728. if (fontRes) {
  20729. fontRef = fontRes.getRaw(fontName);
  20730. }
  20731. }
  20732. if (!fontRef) {
  20733. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  20734. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  20735. (0, _util.warn)(`${partialMsg}.`);
  20736. return errorFont();
  20737. }
  20738. this.handler.send("UnsupportedFeature", {
  20739. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  20740. });
  20741. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  20742. if (fallbackFontDict) {
  20743. fontRef = fallbackFontDict;
  20744. } else {
  20745. fontRef = PartialEvaluator.fallbackFontDict;
  20746. }
  20747. }
  20748. if (this.fontCache.has(fontRef)) {
  20749. return this.fontCache.get(fontRef);
  20750. }
  20751. font = xref.fetchIfRef(fontRef);
  20752. if (!(0, _primitives.isDict)(font)) {
  20753. return errorFont();
  20754. }
  20755. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  20756. return this.fontCache.get(font.cacheKey);
  20757. }
  20758. const fontCapability = (0, _util.createPromiseCapability)();
  20759. let preEvaluatedFont;
  20760. try {
  20761. preEvaluatedFont = this.preEvaluateFont(font);
  20762. preEvaluatedFont.cssFontInfo = cssFontInfo;
  20763. } catch (reason) {
  20764. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  20765. return errorFont();
  20766. }
  20767. const {
  20768. descriptor,
  20769. hash
  20770. } = preEvaluatedFont;
  20771. const fontRefIsRef = (0, _primitives.isRef)(fontRef);
  20772. let fontID;
  20773. if (fontRefIsRef) {
  20774. fontID = `f${fontRef.toString()}`;
  20775. }
  20776. if (hash && (0, _primitives.isDict)(descriptor)) {
  20777. if (!descriptor.fontAliases) {
  20778. descriptor.fontAliases = Object.create(null);
  20779. }
  20780. const fontAliases = descriptor.fontAliases;
  20781. if (fontAliases[hash]) {
  20782. const aliasFontRef = fontAliases[hash].aliasRef;
  20783. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  20784. this.fontCache.putAlias(fontRef, aliasFontRef);
  20785. return this.fontCache.get(fontRef);
  20786. }
  20787. } else {
  20788. fontAliases[hash] = {
  20789. fontID: this.idFactory.createFontId()
  20790. };
  20791. }
  20792. if (fontRefIsRef) {
  20793. fontAliases[hash].aliasRef = fontRef;
  20794. }
  20795. fontID = fontAliases[hash].fontID;
  20796. }
  20797. if (fontRefIsRef) {
  20798. this.fontCache.put(fontRef, fontCapability.promise);
  20799. } else {
  20800. if (!fontID) {
  20801. fontID = this.idFactory.createFontId();
  20802. }
  20803. font.cacheKey = `cacheKey_${fontID}`;
  20804. this.fontCache.put(font.cacheKey, fontCapability.promise);
  20805. }
  20806. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  20807. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  20808. this.translateFont(preEvaluatedFont).then(translatedFont => {
  20809. if (translatedFont.fontType !== undefined) {
  20810. xref.stats.addFontType(translatedFont.fontType);
  20811. }
  20812. fontCapability.resolve(new TranslatedFont({
  20813. loadedName: font.loadedName,
  20814. font: translatedFont,
  20815. dict: font,
  20816. evaluatorOptions: this.options
  20817. }));
  20818. }).catch(reason => {
  20819. this.handler.send("UnsupportedFeature", {
  20820. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  20821. });
  20822. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  20823. try {
  20824. const fontFile3 = descriptor && descriptor.get("FontFile3");
  20825. const subtype = fontFile3 && fontFile3.get("Subtype");
  20826. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  20827. if (fontType !== undefined) {
  20828. xref.stats.addFontType(fontType);
  20829. }
  20830. } catch (ex) {}
  20831. fontCapability.resolve(new TranslatedFont({
  20832. loadedName: font.loadedName,
  20833. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  20834. dict: font,
  20835. evaluatorOptions: this.options
  20836. }));
  20837. });
  20838. return fontCapability.promise;
  20839. }
  20840. buildPath(operatorList, fn, args, parsingText = false) {
  20841. const lastIndex = operatorList.length - 1;
  20842. if (!args) {
  20843. args = [];
  20844. }
  20845. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  20846. if (parsingText) {
  20847. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  20848. operatorList.addOp(_util.OPS.save, null);
  20849. }
  20850. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  20851. if (parsingText) {
  20852. operatorList.addOp(_util.OPS.restore, null);
  20853. }
  20854. } else {
  20855. const opArgs = operatorList.argsArray[lastIndex];
  20856. opArgs[0].push(fn);
  20857. Array.prototype.push.apply(opArgs[1], args);
  20858. }
  20859. }
  20860. parseColorSpace({
  20861. cs,
  20862. resources,
  20863. localColorSpaceCache
  20864. }) {
  20865. return _colorspace.ColorSpace.parseAsync({
  20866. cs,
  20867. xref: this.xref,
  20868. resources,
  20869. pdfFunctionFactory: this._pdfFunctionFactory,
  20870. localColorSpaceCache
  20871. }).catch(reason => {
  20872. if (reason instanceof _util.AbortException) {
  20873. return null;
  20874. }
  20875. if (this.options.ignoreErrors) {
  20876. this.handler.send("UnsupportedFeature", {
  20877. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  20878. });
  20879. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  20880. return null;
  20881. }
  20882. throw reason;
  20883. });
  20884. }
  20885. parseShading({
  20886. shading,
  20887. resources,
  20888. localColorSpaceCache,
  20889. localShadingPatternCache
  20890. }) {
  20891. let id = localShadingPatternCache.get(shading);
  20892. if (!id) {
  20893. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  20894. const patternIR = shadingFill.getIR();
  20895. id = `pattern_${this.idFactory.createObjId()}`;
  20896. localShadingPatternCache.set(shading, id);
  20897. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  20898. }
  20899. return id;
  20900. }
  20901. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  20902. const patternName = args.pop();
  20903. if (patternName instanceof _primitives.Name) {
  20904. const rawPattern = patterns.getRaw(patternName.name);
  20905. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  20906. if (localTilingPattern) {
  20907. try {
  20908. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20909. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  20910. operatorList.addOp(fn, tilingPatternIR);
  20911. return undefined;
  20912. } catch (ex) {}
  20913. }
  20914. const pattern = this.xref.fetchIfRef(rawPattern);
  20915. if (pattern) {
  20916. const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  20917. const typeNum = dict.get("PatternType");
  20918. if (typeNum === PatternType.TILING) {
  20919. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20920. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  20921. } else if (typeNum === PatternType.SHADING) {
  20922. const shading = dict.get("Shading");
  20923. const matrix = dict.getArray("Matrix");
  20924. const objId = this.parseShading({
  20925. shading,
  20926. resources,
  20927. localColorSpaceCache,
  20928. localShadingPatternCache
  20929. });
  20930. operatorList.addOp(fn, ["Shading", objId, matrix]);
  20931. return undefined;
  20932. }
  20933. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  20934. }
  20935. }
  20936. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  20937. }
  20938. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  20939. const MAX_NESTING = 10;
  20940. if (++nestingCounter > MAX_NESTING) {
  20941. (0, _util.warn)("Visibility expression is too deeply nested");
  20942. return;
  20943. }
  20944. const length = array.length;
  20945. const operator = this.xref.fetchIfRef(array[0]);
  20946. if (length < 2 || !(0, _primitives.isName)(operator)) {
  20947. (0, _util.warn)("Invalid visibility expression");
  20948. return;
  20949. }
  20950. switch (operator.name) {
  20951. case "And":
  20952. case "Or":
  20953. case "Not":
  20954. currentResult.push(operator.name);
  20955. break;
  20956. default:
  20957. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  20958. return;
  20959. }
  20960. for (let i = 1; i < length; i++) {
  20961. const raw = array[i];
  20962. const object = this.xref.fetchIfRef(raw);
  20963. if (Array.isArray(object)) {
  20964. const nestedResult = [];
  20965. currentResult.push(nestedResult);
  20966. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  20967. } else if ((0, _primitives.isRef)(raw)) {
  20968. currentResult.push(raw.toString());
  20969. }
  20970. }
  20971. }
  20972. async parseMarkedContentProps(contentProperties, resources) {
  20973. let optionalContent;
  20974. if ((0, _primitives.isName)(contentProperties)) {
  20975. const properties = resources.get("Properties");
  20976. optionalContent = properties.get(contentProperties.name);
  20977. } else if ((0, _primitives.isDict)(contentProperties)) {
  20978. optionalContent = contentProperties;
  20979. } else {
  20980. throw new _util.FormatError("Optional content properties malformed.");
  20981. }
  20982. const optionalContentType = optionalContent.get("Type").name;
  20983. if (optionalContentType === "OCG") {
  20984. return {
  20985. type: optionalContentType,
  20986. id: optionalContent.objId
  20987. };
  20988. } else if (optionalContentType === "OCMD") {
  20989. const expression = optionalContent.get("VE");
  20990. if (Array.isArray(expression)) {
  20991. const result = [];
  20992. this._parseVisibilityExpression(expression, 0, result);
  20993. if (result.length > 0) {
  20994. return {
  20995. type: "OCMD",
  20996. expression: result
  20997. };
  20998. }
  20999. }
  21000. const optionalContentGroups = optionalContent.get("OCGs");
  21001. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  21002. const groupIds = [];
  21003. if (Array.isArray(optionalContentGroups)) {
  21004. for (const ocg of optionalContentGroups) {
  21005. groupIds.push(ocg.toString());
  21006. }
  21007. } else {
  21008. groupIds.push(optionalContentGroups.objId);
  21009. }
  21010. return {
  21011. type: optionalContentType,
  21012. ids: groupIds,
  21013. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  21014. expression: null
  21015. };
  21016. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  21017. return {
  21018. type: optionalContentType,
  21019. id: optionalContentGroups.toString()
  21020. };
  21021. }
  21022. }
  21023. return null;
  21024. }
  21025. getOperatorList({
  21026. stream,
  21027. task,
  21028. resources,
  21029. operatorList,
  21030. initialState = null,
  21031. fallbackFontDict = null
  21032. }) {
  21033. resources = resources || _primitives.Dict.empty;
  21034. initialState = initialState || new EvalState();
  21035. if (!operatorList) {
  21036. throw new Error('getOperatorList: missing "operatorList" parameter');
  21037. }
  21038. const self = this;
  21039. const xref = this.xref;
  21040. let parsingText = false;
  21041. const localImageCache = new _image_utils.LocalImageCache();
  21042. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  21043. const localGStateCache = new _image_utils.LocalGStateCache();
  21044. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  21045. const localShadingPatternCache = new Map();
  21046. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21047. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  21048. const stateManager = new StateManager(initialState);
  21049. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21050. const timeSlotManager = new TimeSlotManager();
  21051. function closePendingRestoreOPS(argument) {
  21052. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  21053. operatorList.addOp(_util.OPS.restore, []);
  21054. }
  21055. }
  21056. return new Promise(function promiseBody(resolve, reject) {
  21057. const next = function (promise) {
  21058. Promise.all([promise, operatorList.ready]).then(function () {
  21059. try {
  21060. promiseBody(resolve, reject);
  21061. } catch (ex) {
  21062. reject(ex);
  21063. }
  21064. }, reject);
  21065. };
  21066. task.ensureNotTerminated();
  21067. timeSlotManager.reset();
  21068. const operation = {};
  21069. let stop, i, ii, cs, name, isValidName;
  21070. while (!(stop = timeSlotManager.check())) {
  21071. operation.args = null;
  21072. if (!preprocessor.read(operation)) {
  21073. break;
  21074. }
  21075. let args = operation.args;
  21076. let fn = operation.fn;
  21077. switch (fn | 0) {
  21078. case _util.OPS.paintXObject:
  21079. isValidName = args[0] instanceof _primitives.Name;
  21080. name = args[0].name;
  21081. if (isValidName) {
  21082. const localImage = localImageCache.getByName(name);
  21083. if (localImage) {
  21084. operatorList.addOp(localImage.fn, localImage.args);
  21085. args = null;
  21086. continue;
  21087. }
  21088. }
  21089. next(new Promise(function (resolveXObject, rejectXObject) {
  21090. if (!isValidName) {
  21091. throw new _util.FormatError("XObject must be referred to by name.");
  21092. }
  21093. let xobj = xobjs.getRaw(name);
  21094. if (xobj instanceof _primitives.Ref) {
  21095. const localImage = localImageCache.getByRef(xobj);
  21096. if (localImage) {
  21097. operatorList.addOp(localImage.fn, localImage.args);
  21098. resolveXObject();
  21099. return;
  21100. }
  21101. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  21102. if (globalImage) {
  21103. operatorList.addDependency(globalImage.objId);
  21104. operatorList.addOp(globalImage.fn, globalImage.args);
  21105. resolveXObject();
  21106. return;
  21107. }
  21108. xobj = xref.fetch(xobj);
  21109. }
  21110. if (!(0, _primitives.isStream)(xobj)) {
  21111. throw new _util.FormatError("XObject should be a stream");
  21112. }
  21113. const type = xobj.dict.get("Subtype");
  21114. if (!(0, _primitives.isName)(type)) {
  21115. throw new _util.FormatError("XObject should have a Name subtype");
  21116. }
  21117. if (type.name === "Form") {
  21118. stateManager.save();
  21119. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  21120. stateManager.restore();
  21121. resolveXObject();
  21122. }, rejectXObject);
  21123. return;
  21124. } else if (type.name === "Image") {
  21125. self.buildPaintImageXObject({
  21126. resources,
  21127. image: xobj,
  21128. operatorList,
  21129. cacheKey: name,
  21130. localImageCache,
  21131. localColorSpaceCache
  21132. }).then(resolveXObject, rejectXObject);
  21133. return;
  21134. } else if (type.name === "PS") {
  21135. (0, _util.info)("Ignored XObject subtype PS");
  21136. } else {
  21137. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  21138. }
  21139. resolveXObject();
  21140. }).catch(function (reason) {
  21141. if (reason instanceof _util.AbortException) {
  21142. return;
  21143. }
  21144. if (self.options.ignoreErrors) {
  21145. self.handler.send("UnsupportedFeature", {
  21146. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  21147. });
  21148. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  21149. return;
  21150. }
  21151. throw reason;
  21152. }));
  21153. return;
  21154. case _util.OPS.setFont:
  21155. var fontSize = args[1];
  21156. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  21157. operatorList.addDependency(loadedName);
  21158. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  21159. }));
  21160. return;
  21161. case _util.OPS.beginText:
  21162. parsingText = true;
  21163. break;
  21164. case _util.OPS.endText:
  21165. parsingText = false;
  21166. break;
  21167. case _util.OPS.endInlineImage:
  21168. var cacheKey = args[0].cacheKey;
  21169. if (cacheKey) {
  21170. const localImage = localImageCache.getByName(cacheKey);
  21171. if (localImage) {
  21172. operatorList.addOp(localImage.fn, localImage.args);
  21173. args = null;
  21174. continue;
  21175. }
  21176. }
  21177. next(self.buildPaintImageXObject({
  21178. resources,
  21179. image: args[0],
  21180. isInline: true,
  21181. operatorList,
  21182. cacheKey,
  21183. localImageCache,
  21184. localColorSpaceCache
  21185. }));
  21186. return;
  21187. case _util.OPS.showText:
  21188. if (!stateManager.state.font) {
  21189. self.ensureStateFont(stateManager.state);
  21190. continue;
  21191. }
  21192. args[0] = self.handleText(args[0], stateManager.state);
  21193. break;
  21194. case _util.OPS.showSpacedText:
  21195. if (!stateManager.state.font) {
  21196. self.ensureStateFont(stateManager.state);
  21197. continue;
  21198. }
  21199. var arr = args[0];
  21200. var combinedGlyphs = [];
  21201. var arrLength = arr.length;
  21202. var state = stateManager.state;
  21203. for (i = 0; i < arrLength; ++i) {
  21204. const arrItem = arr[i];
  21205. if ((0, _util.isString)(arrItem)) {
  21206. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  21207. } else if ((0, _util.isNum)(arrItem)) {
  21208. combinedGlyphs.push(arrItem);
  21209. }
  21210. }
  21211. args[0] = combinedGlyphs;
  21212. fn = _util.OPS.showText;
  21213. break;
  21214. case _util.OPS.nextLineShowText:
  21215. if (!stateManager.state.font) {
  21216. self.ensureStateFont(stateManager.state);
  21217. continue;
  21218. }
  21219. operatorList.addOp(_util.OPS.nextLine);
  21220. args[0] = self.handleText(args[0], stateManager.state);
  21221. fn = _util.OPS.showText;
  21222. break;
  21223. case _util.OPS.nextLineSetSpacingShowText:
  21224. if (!stateManager.state.font) {
  21225. self.ensureStateFont(stateManager.state);
  21226. continue;
  21227. }
  21228. operatorList.addOp(_util.OPS.nextLine);
  21229. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  21230. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  21231. args[0] = self.handleText(args[0], stateManager.state);
  21232. fn = _util.OPS.showText;
  21233. break;
  21234. case _util.OPS.setTextRenderingMode:
  21235. stateManager.state.textRenderingMode = args[0];
  21236. break;
  21237. case _util.OPS.setFillColorSpace:
  21238. {
  21239. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21240. if (cachedColorSpace) {
  21241. stateManager.state.fillColorSpace = cachedColorSpace;
  21242. continue;
  21243. }
  21244. next(self.parseColorSpace({
  21245. cs: args[0],
  21246. resources,
  21247. localColorSpaceCache
  21248. }).then(function (colorSpace) {
  21249. if (colorSpace) {
  21250. stateManager.state.fillColorSpace = colorSpace;
  21251. }
  21252. }));
  21253. return;
  21254. }
  21255. case _util.OPS.setStrokeColorSpace:
  21256. {
  21257. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21258. if (cachedColorSpace) {
  21259. stateManager.state.strokeColorSpace = cachedColorSpace;
  21260. continue;
  21261. }
  21262. next(self.parseColorSpace({
  21263. cs: args[0],
  21264. resources,
  21265. localColorSpaceCache
  21266. }).then(function (colorSpace) {
  21267. if (colorSpace) {
  21268. stateManager.state.strokeColorSpace = colorSpace;
  21269. }
  21270. }));
  21271. return;
  21272. }
  21273. case _util.OPS.setFillColor:
  21274. cs = stateManager.state.fillColorSpace;
  21275. args = cs.getRgb(args, 0);
  21276. fn = _util.OPS.setFillRGBColor;
  21277. break;
  21278. case _util.OPS.setStrokeColor:
  21279. cs = stateManager.state.strokeColorSpace;
  21280. args = cs.getRgb(args, 0);
  21281. fn = _util.OPS.setStrokeRGBColor;
  21282. break;
  21283. case _util.OPS.setFillGray:
  21284. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  21285. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21286. fn = _util.OPS.setFillRGBColor;
  21287. break;
  21288. case _util.OPS.setStrokeGray:
  21289. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  21290. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21291. fn = _util.OPS.setStrokeRGBColor;
  21292. break;
  21293. case _util.OPS.setFillCMYKColor:
  21294. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21295. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21296. fn = _util.OPS.setFillRGBColor;
  21297. break;
  21298. case _util.OPS.setStrokeCMYKColor:
  21299. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21300. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21301. fn = _util.OPS.setStrokeRGBColor;
  21302. break;
  21303. case _util.OPS.setFillRGBColor:
  21304. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21305. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21306. break;
  21307. case _util.OPS.setStrokeRGBColor:
  21308. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21309. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21310. break;
  21311. case _util.OPS.setFillColorN:
  21312. cs = stateManager.state.fillColorSpace;
  21313. if (cs.name === "Pattern") {
  21314. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21315. return;
  21316. }
  21317. args = cs.getRgb(args, 0);
  21318. fn = _util.OPS.setFillRGBColor;
  21319. break;
  21320. case _util.OPS.setStrokeColorN:
  21321. cs = stateManager.state.strokeColorSpace;
  21322. if (cs.name === "Pattern") {
  21323. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21324. return;
  21325. }
  21326. args = cs.getRgb(args, 0);
  21327. fn = _util.OPS.setStrokeRGBColor;
  21328. break;
  21329. case _util.OPS.shadingFill:
  21330. var shadingRes = resources.get("Shading");
  21331. if (!shadingRes) {
  21332. throw new _util.FormatError("No shading resource found");
  21333. }
  21334. var shading = shadingRes.get(args[0].name);
  21335. if (!shading) {
  21336. throw new _util.FormatError("No shading object found");
  21337. }
  21338. const patternId = self.parseShading({
  21339. shading,
  21340. resources,
  21341. localColorSpaceCache,
  21342. localShadingPatternCache
  21343. });
  21344. args = [patternId];
  21345. fn = _util.OPS.shadingFill;
  21346. break;
  21347. case _util.OPS.setGState:
  21348. isValidName = args[0] instanceof _primitives.Name;
  21349. name = args[0].name;
  21350. if (isValidName) {
  21351. const localGStateObj = localGStateCache.getByName(name);
  21352. if (localGStateObj) {
  21353. if (localGStateObj.length > 0) {
  21354. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  21355. }
  21356. args = null;
  21357. continue;
  21358. }
  21359. }
  21360. next(new Promise(function (resolveGState, rejectGState) {
  21361. if (!isValidName) {
  21362. throw new _util.FormatError("GState must be referred to by name.");
  21363. }
  21364. const extGState = resources.get("ExtGState");
  21365. if (!(extGState instanceof _primitives.Dict)) {
  21366. throw new _util.FormatError("ExtGState should be a dictionary.");
  21367. }
  21368. const gState = extGState.get(name);
  21369. if (!(gState instanceof _primitives.Dict)) {
  21370. throw new _util.FormatError("GState should be a dictionary.");
  21371. }
  21372. self.setGState({
  21373. resources,
  21374. gState,
  21375. operatorList,
  21376. cacheKey: name,
  21377. task,
  21378. stateManager,
  21379. localGStateCache,
  21380. localColorSpaceCache
  21381. }).then(resolveGState, rejectGState);
  21382. }).catch(function (reason) {
  21383. if (reason instanceof _util.AbortException) {
  21384. return;
  21385. }
  21386. if (self.options.ignoreErrors) {
  21387. self.handler.send("UnsupportedFeature", {
  21388. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  21389. });
  21390. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  21391. return;
  21392. }
  21393. throw reason;
  21394. }));
  21395. return;
  21396. case _util.OPS.moveTo:
  21397. case _util.OPS.lineTo:
  21398. case _util.OPS.curveTo:
  21399. case _util.OPS.curveTo2:
  21400. case _util.OPS.curveTo3:
  21401. case _util.OPS.closePath:
  21402. case _util.OPS.rectangle:
  21403. self.buildPath(operatorList, fn, args, parsingText);
  21404. continue;
  21405. case _util.OPS.markPoint:
  21406. case _util.OPS.markPointProps:
  21407. case _util.OPS.beginCompat:
  21408. case _util.OPS.endCompat:
  21409. continue;
  21410. case _util.OPS.beginMarkedContentProps:
  21411. if (!(0, _primitives.isName)(args[0])) {
  21412. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  21413. continue;
  21414. }
  21415. if (args[0].name === "OC") {
  21416. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  21417. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  21418. }).catch(reason => {
  21419. if (reason instanceof _util.AbortException) {
  21420. return;
  21421. }
  21422. if (self.options.ignoreErrors) {
  21423. self.handler.send("UnsupportedFeature", {
  21424. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  21425. });
  21426. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  21427. return;
  21428. }
  21429. throw reason;
  21430. }));
  21431. return;
  21432. }
  21433. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  21434. break;
  21435. case _util.OPS.beginMarkedContent:
  21436. case _util.OPS.endMarkedContent:
  21437. default:
  21438. if (args !== null) {
  21439. for (i = 0, ii = args.length; i < ii; i++) {
  21440. if (args[i] instanceof _primitives.Dict) {
  21441. break;
  21442. }
  21443. }
  21444. if (i < ii) {
  21445. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  21446. continue;
  21447. }
  21448. }
  21449. }
  21450. operatorList.addOp(fn, args);
  21451. }
  21452. if (stop) {
  21453. next(deferred);
  21454. return;
  21455. }
  21456. closePendingRestoreOPS();
  21457. resolve();
  21458. }).catch(reason => {
  21459. if (reason instanceof _util.AbortException) {
  21460. return;
  21461. }
  21462. if (this.options.ignoreErrors) {
  21463. this.handler.send("UnsupportedFeature", {
  21464. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  21465. });
  21466. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  21467. closePendingRestoreOPS();
  21468. return;
  21469. }
  21470. throw reason;
  21471. });
  21472. }
  21473. getTextContent({
  21474. stream,
  21475. task,
  21476. resources,
  21477. stateManager = null,
  21478. normalizeWhitespace = false,
  21479. combineTextItems = false,
  21480. includeMarkedContent = false,
  21481. sink,
  21482. seenStyles = new Set()
  21483. }) {
  21484. resources = resources || _primitives.Dict.empty;
  21485. stateManager = stateManager || new StateManager(new TextState());
  21486. const WhitespaceRegexp = /\s/g;
  21487. const DiacriticRegExp = new RegExp("^\\p{Mn}$", "u");
  21488. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  21489. const textContent = {
  21490. items: [],
  21491. styles: Object.create(null)
  21492. };
  21493. const textContentItem = {
  21494. initialized: false,
  21495. str: [],
  21496. totalWidth: 0,
  21497. totalHeight: 0,
  21498. width: 0,
  21499. height: 0,
  21500. vertical: false,
  21501. prevTransform: null,
  21502. textAdvanceScale: 0,
  21503. spaceInFlowMin: 0,
  21504. spaceInFlowMax: 0,
  21505. trackingSpaceMin: Infinity,
  21506. negativeSpaceMax: -Infinity,
  21507. transform: null,
  21508. fontName: null,
  21509. hasEOL: false
  21510. };
  21511. const TRACKING_SPACE_FACTOR = 0.1;
  21512. const NEGATIVE_SPACE_FACTOR = -0.2;
  21513. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  21514. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  21515. const self = this;
  21516. const xref = this.xref;
  21517. const showSpacedTextBuffer = [];
  21518. let xobjs = null;
  21519. const emptyXObjectCache = new _image_utils.LocalImageCache();
  21520. const emptyGStateCache = new _image_utils.LocalGStateCache();
  21521. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21522. let textState;
  21523. function getCurrentTextTransform() {
  21524. const font = textState.font;
  21525. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  21526. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  21527. const glyphHeight = font.bbox[3] - font.bbox[1];
  21528. if (glyphHeight > 0) {
  21529. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  21530. }
  21531. }
  21532. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  21533. }
  21534. function ensureTextContentItem() {
  21535. if (textContentItem.initialized) {
  21536. return textContentItem;
  21537. }
  21538. const font = textState.font,
  21539. loadedName = font.loadedName;
  21540. if (!seenStyles.has(loadedName)) {
  21541. seenStyles.add(loadedName);
  21542. textContent.styles[loadedName] = {
  21543. fontFamily: font.fallbackName,
  21544. ascent: font.ascent,
  21545. descent: font.descent,
  21546. vertical: font.vertical
  21547. };
  21548. }
  21549. textContentItem.fontName = loadedName;
  21550. const trm = textContentItem.transform = getCurrentTextTransform();
  21551. if (!font.vertical) {
  21552. textContentItem.width = textContentItem.totalWidth = 0;
  21553. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  21554. textContentItem.vertical = false;
  21555. } else {
  21556. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  21557. textContentItem.height = textContentItem.totalHeight = 0;
  21558. textContentItem.vertical = true;
  21559. }
  21560. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21561. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21562. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  21563. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  21564. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  21565. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  21566. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  21567. textContentItem.hasEOL = false;
  21568. textContentItem.initialized = true;
  21569. return textContentItem;
  21570. }
  21571. function updateAdvanceScale() {
  21572. if (!textContentItem.initialized) {
  21573. return;
  21574. }
  21575. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21576. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21577. const scaleFactor = scaleCtmX * scaleLineX;
  21578. if (scaleFactor === textContentItem.textAdvanceScale) {
  21579. return;
  21580. }
  21581. if (!textContentItem.vertical) {
  21582. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21583. textContentItem.width = 0;
  21584. } else {
  21585. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21586. textContentItem.height = 0;
  21587. }
  21588. textContentItem.textAdvanceScale = scaleFactor;
  21589. }
  21590. function replaceWhitespace(str) {
  21591. const ii = str.length;
  21592. let i = 0,
  21593. code;
  21594. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  21595. i++;
  21596. }
  21597. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  21598. }
  21599. function runBidiTransform(textChunk) {
  21600. const text = textChunk.str.join("");
  21601. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  21602. const str = normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str;
  21603. return {
  21604. str,
  21605. dir: bidiResult.dir,
  21606. width: textChunk.totalWidth,
  21607. height: textChunk.totalHeight,
  21608. transform: textChunk.transform,
  21609. fontName: textChunk.fontName,
  21610. hasEOL: textChunk.hasEOL
  21611. };
  21612. }
  21613. function handleSetFont(fontName, fontRef) {
  21614. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  21615. if (!translated.font.isType3Font) {
  21616. return translated;
  21617. }
  21618. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  21619. return translated;
  21620. });
  21621. }).then(function (translated) {
  21622. textState.font = translated.font;
  21623. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21624. });
  21625. }
  21626. function compareWithLastPosition() {
  21627. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  21628. return;
  21629. }
  21630. const currentTransform = getCurrentTextTransform();
  21631. let posX = currentTransform[4];
  21632. let posY = currentTransform[5];
  21633. let lastPosX = textContentItem.prevTransform[4];
  21634. let lastPosY = textContentItem.prevTransform[5];
  21635. if (lastPosX === posX && lastPosY === posY) {
  21636. return;
  21637. }
  21638. let rotate = 0;
  21639. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  21640. rotate = currentTransform[0] > 0 ? 0 : 180;
  21641. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  21642. rotate += currentTransform[1] > 0 ? 90 : 270;
  21643. }
  21644. if (rotate !== 0) {
  21645. switch (rotate) {
  21646. case 90:
  21647. [posX, posY] = [posY, posX];
  21648. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  21649. break;
  21650. case 180:
  21651. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  21652. break;
  21653. case 270:
  21654. [posX, posY] = [-posY, -posX];
  21655. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  21656. break;
  21657. }
  21658. }
  21659. if (textState.font.vertical) {
  21660. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  21661. const advanceX = posX - lastPosX;
  21662. if (advanceY < textContentItem.negativeSpaceMax) {
  21663. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  21664. appendEOL();
  21665. return;
  21666. }
  21667. flushTextContentItem();
  21668. return;
  21669. }
  21670. if (Math.abs(advanceX) > textContentItem.height) {
  21671. appendEOL();
  21672. return;
  21673. }
  21674. if (advanceY <= textContentItem.trackingSpaceMin) {
  21675. textContentItem.height += advanceY;
  21676. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform)) {
  21677. if (textContentItem.str.length === 0) {
  21678. textContent.items.push({
  21679. str: " ",
  21680. dir: "ltr",
  21681. width: 0,
  21682. height: advanceY,
  21683. transform: textContentItem.prevTransform,
  21684. fontName: textContentItem.fontName,
  21685. hasEOL: false
  21686. });
  21687. } else {
  21688. textContentItem.height += advanceY;
  21689. }
  21690. }
  21691. return;
  21692. }
  21693. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  21694. const advanceY = posY - lastPosY;
  21695. if (advanceX < textContentItem.negativeSpaceMax) {
  21696. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  21697. appendEOL();
  21698. return;
  21699. }
  21700. flushTextContentItem();
  21701. return;
  21702. }
  21703. if (Math.abs(advanceY) > textContentItem.height) {
  21704. appendEOL();
  21705. return;
  21706. }
  21707. if (advanceX <= textContentItem.trackingSpaceMin) {
  21708. textContentItem.width += advanceX;
  21709. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform)) {
  21710. if (textContentItem.str.length === 0) {
  21711. textContent.items.push({
  21712. str: " ",
  21713. dir: "ltr",
  21714. width: advanceX,
  21715. height: 0,
  21716. transform: textContentItem.prevTransform,
  21717. fontName: textContentItem.fontName,
  21718. hasEOL: false
  21719. });
  21720. } else {
  21721. textContentItem.width += advanceX;
  21722. }
  21723. }
  21724. }
  21725. function buildTextContentItem({
  21726. chars,
  21727. extraSpacing
  21728. }) {
  21729. const font = textState.font;
  21730. if (!chars) {
  21731. const charSpacing = textState.charSpacing + extraSpacing;
  21732. if (charSpacing) {
  21733. if (!font.vertical) {
  21734. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21735. } else {
  21736. textState.translateTextMatrix(0, -charSpacing);
  21737. }
  21738. }
  21739. return;
  21740. }
  21741. const glyphs = font.charsToGlyphs(chars);
  21742. const scale = textState.fontMatrix[0] * textState.fontSize;
  21743. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  21744. const glyph = glyphs[i];
  21745. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  21746. let glyphWidth = glyph.width;
  21747. if (font.vertical) {
  21748. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  21749. }
  21750. let scaledDim = glyphWidth * scale;
  21751. let glyphUnicode = glyph.unicode;
  21752. if (glyphUnicode === " " && (i === 0 || i + 1 === ii || glyphs[i - 1].unicode === " " || glyphs[i + 1].unicode === " " || extraSpacing)) {
  21753. if (!font.vertical) {
  21754. charSpacing += scaledDim + textState.wordSpacing;
  21755. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21756. } else {
  21757. charSpacing += -scaledDim + textState.wordSpacing;
  21758. textState.translateTextMatrix(0, -charSpacing);
  21759. }
  21760. continue;
  21761. }
  21762. compareWithLastPosition();
  21763. const textChunk = ensureTextContentItem();
  21764. if (DiacriticRegExp.test(glyph.unicode)) {
  21765. scaledDim = 0;
  21766. }
  21767. if (!font.vertical) {
  21768. scaledDim *= textState.textHScale;
  21769. textState.translateTextMatrix(scaledDim, 0);
  21770. textChunk.width += scaledDim;
  21771. } else {
  21772. textState.translateTextMatrix(0, scaledDim);
  21773. scaledDim = Math.abs(scaledDim);
  21774. textChunk.height += scaledDim;
  21775. }
  21776. if (scaledDim) {
  21777. textChunk.prevTransform = getCurrentTextTransform();
  21778. }
  21779. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  21780. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  21781. textChunk.str.push(glyphUnicode);
  21782. if (charSpacing) {
  21783. if (!font.vertical) {
  21784. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21785. } else {
  21786. textState.translateTextMatrix(0, -charSpacing);
  21787. }
  21788. }
  21789. }
  21790. }
  21791. function appendEOL() {
  21792. if (textContentItem.initialized) {
  21793. textContentItem.hasEOL = true;
  21794. flushTextContentItem();
  21795. } else {
  21796. textContent.items.push({
  21797. str: "",
  21798. dir: "ltr",
  21799. width: 0,
  21800. height: 0,
  21801. transform: getCurrentTextTransform(),
  21802. fontName: textState.font.loadedName,
  21803. hasEOL: true
  21804. });
  21805. }
  21806. }
  21807. function addFakeSpaces(width, transf) {
  21808. if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
  21809. if (textContentItem.initialized) {
  21810. textContentItem.str.push(" ");
  21811. }
  21812. return false;
  21813. }
  21814. const fontName = textContentItem.fontName;
  21815. let height = 0;
  21816. if (textContentItem.vertical) {
  21817. height = width;
  21818. width = 0;
  21819. }
  21820. flushTextContentItem();
  21821. textContent.items.push({
  21822. str: " ",
  21823. dir: "ltr",
  21824. width,
  21825. height,
  21826. transform: transf || getCurrentTextTransform(),
  21827. fontName,
  21828. hasEOL: false
  21829. });
  21830. return true;
  21831. }
  21832. function flushTextContentItem() {
  21833. if (!textContentItem.initialized || !textContentItem.str) {
  21834. return;
  21835. }
  21836. if (!textContentItem.vertical) {
  21837. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21838. } else {
  21839. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21840. }
  21841. textContent.items.push(runBidiTransform(textContentItem));
  21842. textContentItem.initialized = false;
  21843. textContentItem.str.length = 0;
  21844. }
  21845. function enqueueChunk(batch = false) {
  21846. const length = textContent.items.length;
  21847. if (length === 0) {
  21848. return;
  21849. }
  21850. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  21851. return;
  21852. }
  21853. sink.enqueue(textContent, length);
  21854. textContent.items = [];
  21855. textContent.styles = Object.create(null);
  21856. }
  21857. const timeSlotManager = new TimeSlotManager();
  21858. return new Promise(function promiseBody(resolve, reject) {
  21859. const next = function (promise) {
  21860. enqueueChunk(true);
  21861. Promise.all([promise, sink.ready]).then(function () {
  21862. try {
  21863. promiseBody(resolve, reject);
  21864. } catch (ex) {
  21865. reject(ex);
  21866. }
  21867. }, reject);
  21868. };
  21869. task.ensureNotTerminated();
  21870. timeSlotManager.reset();
  21871. const operation = {};
  21872. let stop,
  21873. args = [];
  21874. while (!(stop = timeSlotManager.check())) {
  21875. args.length = 0;
  21876. operation.args = args;
  21877. if (!preprocessor.read(operation)) {
  21878. break;
  21879. }
  21880. textState = stateManager.state;
  21881. const fn = operation.fn;
  21882. args = operation.args;
  21883. switch (fn | 0) {
  21884. case _util.OPS.setFont:
  21885. var fontNameArg = args[0].name,
  21886. fontSizeArg = args[1];
  21887. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  21888. break;
  21889. }
  21890. flushTextContentItem();
  21891. textState.fontName = fontNameArg;
  21892. textState.fontSize = fontSizeArg;
  21893. next(handleSetFont(fontNameArg, null));
  21894. return;
  21895. case _util.OPS.setTextRise:
  21896. textState.textRise = args[0];
  21897. break;
  21898. case _util.OPS.setHScale:
  21899. textState.textHScale = args[0] / 100;
  21900. break;
  21901. case _util.OPS.setLeading:
  21902. textState.leading = args[0];
  21903. break;
  21904. case _util.OPS.moveText:
  21905. textState.translateTextLineMatrix(args[0], args[1]);
  21906. textState.textMatrix = textState.textLineMatrix.slice();
  21907. break;
  21908. case _util.OPS.setLeadingMoveText:
  21909. textState.leading = -args[1];
  21910. textState.translateTextLineMatrix(args[0], args[1]);
  21911. textState.textMatrix = textState.textLineMatrix.slice();
  21912. break;
  21913. case _util.OPS.nextLine:
  21914. textState.carriageReturn();
  21915. break;
  21916. case _util.OPS.setTextMatrix:
  21917. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21918. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21919. updateAdvanceScale();
  21920. break;
  21921. case _util.OPS.setCharSpacing:
  21922. textState.charSpacing = args[0];
  21923. break;
  21924. case _util.OPS.setWordSpacing:
  21925. textState.wordSpacing = args[0];
  21926. break;
  21927. case _util.OPS.beginText:
  21928. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  21929. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  21930. break;
  21931. case _util.OPS.showSpacedText:
  21932. if (!stateManager.state.font) {
  21933. self.ensureStateFont(stateManager.state);
  21934. continue;
  21935. }
  21936. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  21937. const elements = args[0];
  21938. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  21939. const item = elements[i];
  21940. if (typeof item === "string") {
  21941. showSpacedTextBuffer.push(item);
  21942. } else if (typeof item === "number" && item !== 0) {
  21943. const str = showSpacedTextBuffer.join("");
  21944. showSpacedTextBuffer.length = 0;
  21945. buildTextContentItem({
  21946. chars: str,
  21947. extraSpacing: item * spaceFactor
  21948. });
  21949. }
  21950. }
  21951. const item = elements[elements.length - 1];
  21952. if (typeof item === "string") {
  21953. showSpacedTextBuffer.push(item);
  21954. }
  21955. if (showSpacedTextBuffer.length > 0) {
  21956. const str = showSpacedTextBuffer.join("");
  21957. showSpacedTextBuffer.length = 0;
  21958. buildTextContentItem({
  21959. chars: str,
  21960. extraSpacing: 0
  21961. });
  21962. }
  21963. break;
  21964. case _util.OPS.showText:
  21965. if (!stateManager.state.font) {
  21966. self.ensureStateFont(stateManager.state);
  21967. continue;
  21968. }
  21969. buildTextContentItem({
  21970. chars: args[0],
  21971. extraSpacing: 0
  21972. });
  21973. break;
  21974. case _util.OPS.nextLineShowText:
  21975. if (!stateManager.state.font) {
  21976. self.ensureStateFont(stateManager.state);
  21977. continue;
  21978. }
  21979. textState.carriageReturn();
  21980. buildTextContentItem({
  21981. chars: args[0],
  21982. extraSpacing: 0
  21983. });
  21984. break;
  21985. case _util.OPS.nextLineSetSpacingShowText:
  21986. if (!stateManager.state.font) {
  21987. self.ensureStateFont(stateManager.state);
  21988. continue;
  21989. }
  21990. textState.wordSpacing = args[0];
  21991. textState.charSpacing = args[1];
  21992. textState.carriageReturn();
  21993. buildTextContentItem({
  21994. chars: args[2],
  21995. extraSpacing: 0
  21996. });
  21997. break;
  21998. case _util.OPS.paintXObject:
  21999. flushTextContentItem();
  22000. if (!xobjs) {
  22001. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  22002. }
  22003. var isValidName = args[0] instanceof _primitives.Name;
  22004. var name = args[0].name;
  22005. if (isValidName && emptyXObjectCache.getByName(name)) {
  22006. break;
  22007. }
  22008. next(new Promise(function (resolveXObject, rejectXObject) {
  22009. if (!isValidName) {
  22010. throw new _util.FormatError("XObject must be referred to by name.");
  22011. }
  22012. let xobj = xobjs.getRaw(name);
  22013. if (xobj instanceof _primitives.Ref) {
  22014. if (emptyXObjectCache.getByRef(xobj)) {
  22015. resolveXObject();
  22016. return;
  22017. }
  22018. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22019. if (globalImage) {
  22020. resolveXObject();
  22021. return;
  22022. }
  22023. xobj = xref.fetch(xobj);
  22024. }
  22025. if (!(0, _primitives.isStream)(xobj)) {
  22026. throw new _util.FormatError("XObject should be a stream");
  22027. }
  22028. const type = xobj.dict.get("Subtype");
  22029. if (!(0, _primitives.isName)(type)) {
  22030. throw new _util.FormatError("XObject should have a Name subtype");
  22031. }
  22032. if (type.name !== "Form") {
  22033. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22034. resolveXObject();
  22035. return;
  22036. }
  22037. const currentState = stateManager.state.clone();
  22038. const xObjStateManager = new StateManager(currentState);
  22039. const matrix = xobj.dict.getArray("Matrix");
  22040. if (Array.isArray(matrix) && matrix.length === 6) {
  22041. xObjStateManager.transform(matrix);
  22042. }
  22043. enqueueChunk();
  22044. const sinkWrapper = {
  22045. enqueueInvoked: false,
  22046. enqueue(chunk, size) {
  22047. this.enqueueInvoked = true;
  22048. sink.enqueue(chunk, size);
  22049. },
  22050. get desiredSize() {
  22051. return sink.desiredSize;
  22052. },
  22053. get ready() {
  22054. return sink.ready;
  22055. }
  22056. };
  22057. self.getTextContent({
  22058. stream: xobj,
  22059. task,
  22060. resources: xobj.dict.get("Resources") || resources,
  22061. stateManager: xObjStateManager,
  22062. normalizeWhitespace,
  22063. combineTextItems,
  22064. includeMarkedContent,
  22065. sink: sinkWrapper,
  22066. seenStyles
  22067. }).then(function () {
  22068. if (!sinkWrapper.enqueueInvoked) {
  22069. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22070. }
  22071. resolveXObject();
  22072. }, rejectXObject);
  22073. }).catch(function (reason) {
  22074. if (reason instanceof _util.AbortException) {
  22075. return;
  22076. }
  22077. if (self.options.ignoreErrors) {
  22078. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  22079. return;
  22080. }
  22081. throw reason;
  22082. }));
  22083. return;
  22084. case _util.OPS.setGState:
  22085. isValidName = args[0] instanceof _primitives.Name;
  22086. name = args[0].name;
  22087. if (isValidName && emptyGStateCache.getByName(name)) {
  22088. break;
  22089. }
  22090. next(new Promise(function (resolveGState, rejectGState) {
  22091. if (!isValidName) {
  22092. throw new _util.FormatError("GState must be referred to by name.");
  22093. }
  22094. const extGState = resources.get("ExtGState");
  22095. if (!(extGState instanceof _primitives.Dict)) {
  22096. throw new _util.FormatError("ExtGState should be a dictionary.");
  22097. }
  22098. const gState = extGState.get(name);
  22099. if (!(gState instanceof _primitives.Dict)) {
  22100. throw new _util.FormatError("GState should be a dictionary.");
  22101. }
  22102. const gStateFont = gState.get("Font");
  22103. if (!gStateFont) {
  22104. emptyGStateCache.set(name, gState.objId, true);
  22105. resolveGState();
  22106. return;
  22107. }
  22108. flushTextContentItem();
  22109. textState.fontName = null;
  22110. textState.fontSize = gStateFont[1];
  22111. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  22112. }).catch(function (reason) {
  22113. if (reason instanceof _util.AbortException) {
  22114. return;
  22115. }
  22116. if (self.options.ignoreErrors) {
  22117. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  22118. return;
  22119. }
  22120. throw reason;
  22121. }));
  22122. return;
  22123. case _util.OPS.beginMarkedContent:
  22124. if (includeMarkedContent) {
  22125. textContent.items.push({
  22126. type: "beginMarkedContent",
  22127. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  22128. });
  22129. }
  22130. break;
  22131. case _util.OPS.beginMarkedContentProps:
  22132. if (includeMarkedContent) {
  22133. flushTextContentItem();
  22134. let mcid = null;
  22135. if ((0, _primitives.isDict)(args[1])) {
  22136. mcid = args[1].get("MCID");
  22137. }
  22138. textContent.items.push({
  22139. type: "beginMarkedContentProps",
  22140. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  22141. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  22142. });
  22143. }
  22144. break;
  22145. case _util.OPS.endMarkedContent:
  22146. if (includeMarkedContent) {
  22147. flushTextContentItem();
  22148. textContent.items.push({
  22149. type: "endMarkedContent"
  22150. });
  22151. }
  22152. break;
  22153. }
  22154. if (textContent.items.length >= sink.desiredSize) {
  22155. stop = true;
  22156. break;
  22157. }
  22158. }
  22159. if (stop) {
  22160. next(deferred);
  22161. return;
  22162. }
  22163. flushTextContentItem();
  22164. enqueueChunk();
  22165. resolve();
  22166. }).catch(reason => {
  22167. if (reason instanceof _util.AbortException) {
  22168. return;
  22169. }
  22170. if (this.options.ignoreErrors) {
  22171. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22172. flushTextContentItem();
  22173. enqueueChunk();
  22174. return;
  22175. }
  22176. throw reason;
  22177. });
  22178. }
  22179. extractDataStructures(dict, baseDict, properties) {
  22180. const xref = this.xref;
  22181. let cidToGidBytes;
  22182. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  22183. if (properties.composite) {
  22184. const cidSystemInfo = dict.get("CIDSystemInfo");
  22185. if ((0, _primitives.isDict)(cidSystemInfo)) {
  22186. properties.cidSystemInfo = {
  22187. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  22188. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  22189. supplement: cidSystemInfo.get("Supplement")
  22190. };
  22191. }
  22192. const cidToGidMap = dict.get("CIDToGIDMap");
  22193. if (cidToGidMap instanceof _base_stream.BaseStream) {
  22194. cidToGidBytes = cidToGidMap.getBytes();
  22195. }
  22196. }
  22197. const differences = [];
  22198. let baseEncodingName = null;
  22199. let encoding;
  22200. if (dict.has("Encoding")) {
  22201. encoding = dict.get("Encoding");
  22202. if ((0, _primitives.isDict)(encoding)) {
  22203. baseEncodingName = encoding.get("BaseEncoding");
  22204. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  22205. if (encoding.has("Differences")) {
  22206. const diffEncoding = encoding.get("Differences");
  22207. let index = 0;
  22208. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  22209. const data = xref.fetchIfRef(diffEncoding[j]);
  22210. if ((0, _util.isNum)(data)) {
  22211. index = data;
  22212. } else if ((0, _primitives.isName)(data)) {
  22213. differences[index++] = data.name;
  22214. } else {
  22215. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  22216. }
  22217. }
  22218. }
  22219. } else if ((0, _primitives.isName)(encoding)) {
  22220. baseEncodingName = encoding.name;
  22221. } else {
  22222. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  22223. }
  22224. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  22225. baseEncodingName = null;
  22226. }
  22227. }
  22228. if (baseEncodingName) {
  22229. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22230. } else {
  22231. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  22232. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  22233. encoding = _encodings.StandardEncoding;
  22234. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  22235. encoding = _encodings.WinAnsiEncoding;
  22236. }
  22237. if (isSymbolicFont) {
  22238. encoding = _encodings.MacRomanEncoding;
  22239. if (!properties.file || properties.isInternalFont) {
  22240. if (/Symbol/i.test(properties.name)) {
  22241. encoding = _encodings.SymbolSetEncoding;
  22242. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  22243. encoding = _encodings.ZapfDingbatsEncoding;
  22244. }
  22245. }
  22246. }
  22247. properties.defaultEncoding = encoding;
  22248. }
  22249. properties.differences = differences;
  22250. properties.baseEncodingName = baseEncodingName;
  22251. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  22252. properties.dict = dict;
  22253. return toUnicodePromise.then(readToUnicode => {
  22254. properties.toUnicode = readToUnicode;
  22255. return this.buildToUnicode(properties);
  22256. }).then(builtToUnicode => {
  22257. properties.toUnicode = builtToUnicode;
  22258. if (cidToGidBytes) {
  22259. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  22260. }
  22261. return properties;
  22262. });
  22263. }
  22264. _simpleFontToUnicode(properties, forceGlyphs = false) {
  22265. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  22266. const toUnicode = [];
  22267. const encoding = properties.defaultEncoding.slice();
  22268. const baseEncodingName = properties.baseEncodingName;
  22269. const differences = properties.differences;
  22270. for (const charcode in differences) {
  22271. const glyphName = differences[charcode];
  22272. if (glyphName === ".notdef") {
  22273. continue;
  22274. }
  22275. encoding[charcode] = glyphName;
  22276. }
  22277. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22278. for (const charcode in encoding) {
  22279. let glyphName = encoding[charcode];
  22280. if (glyphName === "") {
  22281. continue;
  22282. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  22283. let code = 0;
  22284. switch (glyphName[0]) {
  22285. case "G":
  22286. if (glyphName.length === 3) {
  22287. code = parseInt(glyphName.substring(1), 16);
  22288. }
  22289. break;
  22290. case "g":
  22291. if (glyphName.length === 5) {
  22292. code = parseInt(glyphName.substring(1), 16);
  22293. }
  22294. break;
  22295. case "C":
  22296. case "c":
  22297. if (glyphName.length >= 3 && glyphName.length <= 4) {
  22298. const codeStr = glyphName.substring(1);
  22299. if (forceGlyphs) {
  22300. code = parseInt(codeStr, 16);
  22301. break;
  22302. }
  22303. code = +codeStr;
  22304. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  22305. return this._simpleFontToUnicode(properties, true);
  22306. }
  22307. }
  22308. break;
  22309. default:
  22310. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22311. if (unicode !== -1) {
  22312. code = unicode;
  22313. }
  22314. }
  22315. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  22316. if (baseEncodingName && code === +charcode) {
  22317. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22318. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  22319. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22320. continue;
  22321. }
  22322. }
  22323. toUnicode[charcode] = String.fromCodePoint(code);
  22324. }
  22325. continue;
  22326. }
  22327. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22328. }
  22329. return toUnicode;
  22330. }
  22331. async buildToUnicode(properties) {
  22332. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  22333. if (properties.hasIncludedToUnicodeMap) {
  22334. if (!properties.composite && properties.hasEncoding) {
  22335. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  22336. }
  22337. return properties.toUnicode;
  22338. }
  22339. if (!properties.composite) {
  22340. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  22341. }
  22342. 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"))) {
  22343. const {
  22344. registry,
  22345. ordering
  22346. } = properties.cidSystemInfo;
  22347. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  22348. const ucs2CMap = await _cmap.CMapFactory.create({
  22349. encoding: ucs2CMapName,
  22350. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22351. useCMap: null
  22352. });
  22353. const toUnicode = [];
  22354. properties.cMap.forEach(function (charcode, cid) {
  22355. if (cid > 0xffff) {
  22356. throw new _util.FormatError("Max size of CID is 65,535");
  22357. }
  22358. const ucs2 = ucs2CMap.lookup(cid);
  22359. if (ucs2) {
  22360. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  22361. }
  22362. });
  22363. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  22364. }
  22365. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  22366. }
  22367. readToUnicode(cmapObj) {
  22368. if (!cmapObj) {
  22369. return Promise.resolve(null);
  22370. }
  22371. if ((0, _primitives.isName)(cmapObj)) {
  22372. return _cmap.CMapFactory.create({
  22373. encoding: cmapObj,
  22374. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22375. useCMap: null
  22376. }).then(function (cmap) {
  22377. if (cmap instanceof _cmap.IdentityCMap) {
  22378. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22379. }
  22380. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  22381. });
  22382. } else if ((0, _primitives.isStream)(cmapObj)) {
  22383. return _cmap.CMapFactory.create({
  22384. encoding: cmapObj,
  22385. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22386. useCMap: null
  22387. }).then(function (cmap) {
  22388. if (cmap instanceof _cmap.IdentityCMap) {
  22389. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22390. }
  22391. const map = new Array(cmap.length);
  22392. cmap.forEach(function (charCode, token) {
  22393. if (typeof token === "number") {
  22394. map[charCode] = String.fromCodePoint(token);
  22395. return;
  22396. }
  22397. const str = [];
  22398. for (let k = 0; k < token.length; k += 2) {
  22399. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22400. if ((w1 & 0xf800) !== 0xd800) {
  22401. str.push(w1);
  22402. continue;
  22403. }
  22404. k += 2;
  22405. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22406. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  22407. }
  22408. map[charCode] = String.fromCodePoint.apply(String, str);
  22409. });
  22410. return new _to_unicode_map.ToUnicodeMap(map);
  22411. }, reason => {
  22412. if (reason instanceof _util.AbortException) {
  22413. return null;
  22414. }
  22415. if (this.options.ignoreErrors) {
  22416. this.handler.send("UnsupportedFeature", {
  22417. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  22418. });
  22419. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  22420. return null;
  22421. }
  22422. throw reason;
  22423. });
  22424. }
  22425. return Promise.resolve(null);
  22426. }
  22427. readCidToGidMap(glyphsData, toUnicode) {
  22428. const result = [];
  22429. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  22430. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  22431. const code = j >> 1;
  22432. if (glyphID === 0 && !toUnicode.has(code)) {
  22433. continue;
  22434. }
  22435. result[code] = glyphID;
  22436. }
  22437. return result;
  22438. }
  22439. extractWidths(dict, descriptor, properties) {
  22440. const xref = this.xref;
  22441. let glyphsWidths = [];
  22442. let defaultWidth = 0;
  22443. const glyphsVMetrics = [];
  22444. let defaultVMetrics;
  22445. let i, ii, j, jj, start, code, widths;
  22446. if (properties.composite) {
  22447. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  22448. widths = dict.get("W");
  22449. if (widths) {
  22450. for (i = 0, ii = widths.length; i < ii; i++) {
  22451. start = xref.fetchIfRef(widths[i++]);
  22452. code = xref.fetchIfRef(widths[i]);
  22453. if (Array.isArray(code)) {
  22454. for (j = 0, jj = code.length; j < jj; j++) {
  22455. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  22456. }
  22457. } else {
  22458. const width = xref.fetchIfRef(widths[++i]);
  22459. for (j = start; j <= code; j++) {
  22460. glyphsWidths[j] = width;
  22461. }
  22462. }
  22463. }
  22464. }
  22465. if (properties.vertical) {
  22466. let vmetrics = dict.getArray("DW2") || [880, -1000];
  22467. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  22468. vmetrics = dict.get("W2");
  22469. if (vmetrics) {
  22470. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  22471. start = xref.fetchIfRef(vmetrics[i++]);
  22472. code = xref.fetchIfRef(vmetrics[i]);
  22473. if (Array.isArray(code)) {
  22474. for (j = 0, jj = code.length; j < jj; j++) {
  22475. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  22476. }
  22477. } else {
  22478. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  22479. for (j = start; j <= code; j++) {
  22480. glyphsVMetrics[j] = vmetric;
  22481. }
  22482. }
  22483. }
  22484. }
  22485. }
  22486. } else {
  22487. const firstChar = properties.firstChar;
  22488. widths = dict.get("Widths");
  22489. if (widths) {
  22490. j = firstChar;
  22491. for (i = 0, ii = widths.length; i < ii; i++) {
  22492. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  22493. }
  22494. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  22495. } else {
  22496. const baseFontName = dict.get("BaseFont");
  22497. if ((0, _primitives.isName)(baseFontName)) {
  22498. const metrics = this.getBaseFontMetrics(baseFontName.name);
  22499. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  22500. defaultWidth = metrics.defaultWidth;
  22501. }
  22502. }
  22503. }
  22504. let isMonospace = true;
  22505. let firstWidth = defaultWidth;
  22506. for (const glyph in glyphsWidths) {
  22507. const glyphWidth = glyphsWidths[glyph];
  22508. if (!glyphWidth) {
  22509. continue;
  22510. }
  22511. if (!firstWidth) {
  22512. firstWidth = glyphWidth;
  22513. continue;
  22514. }
  22515. if (firstWidth !== glyphWidth) {
  22516. isMonospace = false;
  22517. break;
  22518. }
  22519. }
  22520. if (isMonospace) {
  22521. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  22522. }
  22523. properties.defaultWidth = defaultWidth;
  22524. properties.widths = glyphsWidths;
  22525. properties.defaultVMetrics = defaultVMetrics;
  22526. properties.vmetrics = glyphsVMetrics;
  22527. }
  22528. isSerifFont(baseFontName) {
  22529. const fontNameWoStyle = baseFontName.split("-")[0];
  22530. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  22531. }
  22532. getBaseFontMetrics(name) {
  22533. let defaultWidth = 0;
  22534. let widths = Object.create(null);
  22535. let monospace = false;
  22536. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  22537. let lookupName = stdFontMap[name] || name;
  22538. const Metrics = (0, _metrics.getMetrics)();
  22539. if (!(lookupName in Metrics)) {
  22540. if (this.isSerifFont(name)) {
  22541. lookupName = "Times-Roman";
  22542. } else {
  22543. lookupName = "Helvetica";
  22544. }
  22545. }
  22546. const glyphWidths = Metrics[lookupName];
  22547. if ((0, _util.isNum)(glyphWidths)) {
  22548. defaultWidth = glyphWidths;
  22549. monospace = true;
  22550. } else {
  22551. widths = glyphWidths();
  22552. }
  22553. return {
  22554. defaultWidth,
  22555. monospace,
  22556. widths
  22557. };
  22558. }
  22559. buildCharCodeToWidth(widthsByGlyphName, properties) {
  22560. const widths = Object.create(null);
  22561. const differences = properties.differences;
  22562. const encoding = properties.defaultEncoding;
  22563. for (let charCode = 0; charCode < 256; charCode++) {
  22564. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  22565. widths[charCode] = widthsByGlyphName[differences[charCode]];
  22566. continue;
  22567. }
  22568. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  22569. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  22570. continue;
  22571. }
  22572. }
  22573. return widths;
  22574. }
  22575. preEvaluateFont(dict) {
  22576. const baseDict = dict;
  22577. let type = dict.get("Subtype");
  22578. if (!(0, _primitives.isName)(type)) {
  22579. throw new _util.FormatError("invalid font Subtype");
  22580. }
  22581. let composite = false;
  22582. let hash, toUnicode;
  22583. if (type.name === "Type0") {
  22584. const df = dict.get("DescendantFonts");
  22585. if (!df) {
  22586. throw new _util.FormatError("Descendant fonts are not specified");
  22587. }
  22588. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  22589. if (!(dict instanceof _primitives.Dict)) {
  22590. throw new _util.FormatError("Descendant font is not a dictionary.");
  22591. }
  22592. type = dict.get("Subtype");
  22593. if (!(0, _primitives.isName)(type)) {
  22594. throw new _util.FormatError("invalid font Subtype");
  22595. }
  22596. composite = true;
  22597. }
  22598. const firstChar = dict.get("FirstChar") || 0,
  22599. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  22600. const descriptor = dict.get("FontDescriptor");
  22601. if (descriptor) {
  22602. hash = new _murmurhash.MurmurHash3_64();
  22603. const encoding = baseDict.getRaw("Encoding");
  22604. if ((0, _primitives.isName)(encoding)) {
  22605. hash.update(encoding.name);
  22606. } else if ((0, _primitives.isRef)(encoding)) {
  22607. hash.update(encoding.toString());
  22608. } else if ((0, _primitives.isDict)(encoding)) {
  22609. for (const entry of encoding.getRawValues()) {
  22610. if ((0, _primitives.isName)(entry)) {
  22611. hash.update(entry.name);
  22612. } else if ((0, _primitives.isRef)(entry)) {
  22613. hash.update(entry.toString());
  22614. } else if (Array.isArray(entry)) {
  22615. const diffLength = entry.length,
  22616. diffBuf = new Array(diffLength);
  22617. for (let j = 0; j < diffLength; j++) {
  22618. const diffEntry = entry[j];
  22619. if ((0, _primitives.isName)(diffEntry)) {
  22620. diffBuf[j] = diffEntry.name;
  22621. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  22622. diffBuf[j] = diffEntry.toString();
  22623. }
  22624. }
  22625. hash.update(diffBuf.join());
  22626. }
  22627. }
  22628. }
  22629. hash.update(`${firstChar}-${lastChar}`);
  22630. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  22631. if ((0, _primitives.isStream)(toUnicode)) {
  22632. const stream = toUnicode.str || toUnicode;
  22633. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  22634. hash.update(uint8array);
  22635. } else if ((0, _primitives.isName)(toUnicode)) {
  22636. hash.update(toUnicode.name);
  22637. }
  22638. const widths = dict.get("Widths") || baseDict.get("Widths");
  22639. if (Array.isArray(widths)) {
  22640. const widthsBuf = [];
  22641. for (const entry of widths) {
  22642. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  22643. widthsBuf.push(entry.toString());
  22644. }
  22645. }
  22646. hash.update(widthsBuf.join());
  22647. }
  22648. if (composite) {
  22649. hash.update("compositeFont");
  22650. const compositeWidths = dict.get("W") || baseDict.get("W");
  22651. if (Array.isArray(compositeWidths)) {
  22652. const widthsBuf = [];
  22653. for (const entry of compositeWidths) {
  22654. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  22655. widthsBuf.push(entry.toString());
  22656. } else if (Array.isArray(entry)) {
  22657. const subWidthsBuf = [];
  22658. for (const element of entry) {
  22659. if ((0, _util.isNum)(element) || (0, _primitives.isRef)(element)) {
  22660. subWidthsBuf.push(element.toString());
  22661. }
  22662. }
  22663. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  22664. }
  22665. }
  22666. hash.update(widthsBuf.join());
  22667. }
  22668. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  22669. if (cidToGidMap instanceof _primitives.Name) {
  22670. hash.update(cidToGidMap.name);
  22671. } else if (cidToGidMap instanceof _primitives.Ref) {
  22672. hash.update(cidToGidMap.toString());
  22673. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  22674. hash.update(cidToGidMap.peekBytes());
  22675. }
  22676. }
  22677. }
  22678. return {
  22679. descriptor,
  22680. dict,
  22681. baseDict,
  22682. composite,
  22683. type: type.name,
  22684. firstChar,
  22685. lastChar,
  22686. toUnicode,
  22687. hash: hash ? hash.hexdigest() : ""
  22688. };
  22689. }
  22690. async translateFont({
  22691. descriptor,
  22692. dict,
  22693. baseDict,
  22694. composite,
  22695. type,
  22696. firstChar,
  22697. lastChar,
  22698. toUnicode,
  22699. cssFontInfo
  22700. }) {
  22701. const isType3Font = type === "Type3";
  22702. let properties;
  22703. if (!descriptor) {
  22704. if (isType3Font) {
  22705. descriptor = new _primitives.Dict(null);
  22706. descriptor.set("FontName", _primitives.Name.get(type));
  22707. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  22708. } else {
  22709. let baseFontName = dict.get("BaseFont");
  22710. if (!(0, _primitives.isName)(baseFontName)) {
  22711. throw new _util.FormatError("Base font is not specified");
  22712. }
  22713. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  22714. const metrics = this.getBaseFontMetrics(baseFontName);
  22715. const fontNameWoStyle = baseFontName.split("-")[0];
  22716. 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);
  22717. properties = {
  22718. type,
  22719. name: baseFontName,
  22720. loadedName: baseDict.loadedName,
  22721. widths: metrics.widths,
  22722. defaultWidth: metrics.defaultWidth,
  22723. isSimulatedFlags: true,
  22724. flags,
  22725. firstChar,
  22726. lastChar,
  22727. toUnicode,
  22728. xHeight: 0,
  22729. capHeight: 0,
  22730. italicAngle: 0,
  22731. isType3Font
  22732. };
  22733. const widths = dict.get("Widths");
  22734. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  22735. let file = null;
  22736. if (standardFontName) {
  22737. properties.isStandardFont = true;
  22738. file = await this.fetchStandardFontData(standardFontName);
  22739. properties.isInternalFont = !!file;
  22740. }
  22741. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  22742. if (widths) {
  22743. const glyphWidths = [];
  22744. let j = firstChar;
  22745. for (let i = 0, ii = widths.length; i < ii; i++) {
  22746. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  22747. }
  22748. newProperties.widths = glyphWidths;
  22749. } else {
  22750. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  22751. }
  22752. return new _fonts.Font(baseFontName, file, newProperties);
  22753. });
  22754. }
  22755. }
  22756. let fontName = descriptor.get("FontName");
  22757. let baseFont = dict.get("BaseFont");
  22758. if ((0, _util.isString)(fontName)) {
  22759. fontName = _primitives.Name.get(fontName);
  22760. }
  22761. if ((0, _util.isString)(baseFont)) {
  22762. baseFont = _primitives.Name.get(baseFont);
  22763. }
  22764. if (!isType3Font) {
  22765. const fontNameStr = fontName && fontName.name;
  22766. const baseFontStr = baseFont && baseFont.name;
  22767. if (fontNameStr !== baseFontStr) {
  22768. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  22769. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  22770. fontName = baseFont;
  22771. }
  22772. }
  22773. }
  22774. fontName = fontName || baseFont;
  22775. if (!(0, _primitives.isName)(fontName)) {
  22776. throw new _util.FormatError("invalid font name");
  22777. }
  22778. let fontFile, subtype, length1, length2, length3;
  22779. try {
  22780. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  22781. } catch (ex) {
  22782. if (!this.options.ignoreErrors) {
  22783. throw ex;
  22784. }
  22785. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  22786. fontFile = new _stream.NullStream();
  22787. }
  22788. let isStandardFont = false;
  22789. let isInternalFont = false;
  22790. let glyphScaleFactors = null;
  22791. if (fontFile) {
  22792. if (fontFile.dict) {
  22793. const subtypeEntry = fontFile.dict.get("Subtype");
  22794. if (subtypeEntry instanceof _primitives.Name) {
  22795. subtype = subtypeEntry.name;
  22796. }
  22797. length1 = fontFile.dict.get("Length1");
  22798. length2 = fontFile.dict.get("Length2");
  22799. length3 = fontFile.dict.get("Length3");
  22800. }
  22801. } else if (cssFontInfo) {
  22802. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  22803. if (standardFontName) {
  22804. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  22805. cssFontInfo.metrics = standardFontName.metrics || null;
  22806. glyphScaleFactors = standardFontName.factors || null;
  22807. fontFile = await this.fetchStandardFontData(standardFontName.name);
  22808. isInternalFont = !!fontFile;
  22809. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  22810. composite = true;
  22811. }
  22812. } else if (!isType3Font) {
  22813. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  22814. if (standardFontName) {
  22815. isStandardFont = true;
  22816. fontFile = await this.fetchStandardFontData(standardFontName);
  22817. isInternalFont = !!fontFile;
  22818. }
  22819. }
  22820. properties = {
  22821. type,
  22822. name: fontName.name,
  22823. subtype,
  22824. file: fontFile,
  22825. length1,
  22826. length2,
  22827. length3,
  22828. isStandardFont,
  22829. isInternalFont,
  22830. loadedName: baseDict.loadedName,
  22831. composite,
  22832. fixedPitch: false,
  22833. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  22834. firstChar,
  22835. lastChar,
  22836. toUnicode,
  22837. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  22838. ascent: descriptor.get("Ascent"),
  22839. descent: descriptor.get("Descent"),
  22840. xHeight: descriptor.get("XHeight") || 0,
  22841. capHeight: descriptor.get("CapHeight") || 0,
  22842. flags: descriptor.get("Flags"),
  22843. italicAngle: descriptor.get("ItalicAngle") || 0,
  22844. isType3Font,
  22845. cssFontInfo,
  22846. scaleFactors: glyphScaleFactors
  22847. };
  22848. if (composite) {
  22849. const cidEncoding = baseDict.get("Encoding");
  22850. if ((0, _primitives.isName)(cidEncoding)) {
  22851. properties.cidEncoding = cidEncoding.name;
  22852. }
  22853. const cMap = await _cmap.CMapFactory.create({
  22854. encoding: cidEncoding,
  22855. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22856. useCMap: null
  22857. });
  22858. properties.cMap = cMap;
  22859. properties.vertical = properties.cMap.vertical;
  22860. }
  22861. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  22862. this.extractWidths(dict, descriptor, newProperties);
  22863. return new _fonts.Font(fontName.name, fontFile, newProperties);
  22864. });
  22865. }
  22866. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  22867. function buildPath(fontChar) {
  22868. const glyphName = `${font.loadedName}_path_${fontChar}`;
  22869. try {
  22870. if (font.renderer.hasBuiltPath(fontChar)) {
  22871. return;
  22872. }
  22873. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  22874. } catch (reason) {
  22875. if (evaluatorOptions.ignoreErrors) {
  22876. handler.send("UnsupportedFeature", {
  22877. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  22878. });
  22879. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  22880. return;
  22881. }
  22882. throw reason;
  22883. }
  22884. }
  22885. for (const glyph of glyphs) {
  22886. buildPath(glyph.fontChar);
  22887. const accent = glyph.accent;
  22888. if (accent && accent.fontChar) {
  22889. buildPath(accent.fontChar);
  22890. }
  22891. }
  22892. }
  22893. static get fallbackFontDict() {
  22894. const dict = new _primitives.Dict();
  22895. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  22896. dict.set("Type", _primitives.Name.get("FallbackType"));
  22897. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  22898. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  22899. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  22900. }
  22901. }
  22902. exports.PartialEvaluator = PartialEvaluator;
  22903. class TranslatedFont {
  22904. constructor({
  22905. loadedName,
  22906. font,
  22907. dict,
  22908. evaluatorOptions
  22909. }) {
  22910. this.loadedName = loadedName;
  22911. this.font = font;
  22912. this.dict = dict;
  22913. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  22914. this.type3Loaded = null;
  22915. this.type3Dependencies = font.isType3Font ? new Set() : null;
  22916. this.sent = false;
  22917. }
  22918. send(handler) {
  22919. if (this.sent) {
  22920. return;
  22921. }
  22922. this.sent = true;
  22923. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  22924. }
  22925. fallback(handler) {
  22926. if (!this.font.data) {
  22927. return;
  22928. }
  22929. this.font.disableFontFace = true;
  22930. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  22931. }
  22932. loadType3Data(evaluator, resources, task) {
  22933. if (this.type3Loaded) {
  22934. return this.type3Loaded;
  22935. }
  22936. if (!this.font.isType3Font) {
  22937. throw new Error("Must be a Type3 font.");
  22938. }
  22939. const type3Evaluator = evaluator.clone({
  22940. ignoreErrors: false
  22941. });
  22942. type3Evaluator.parsingType3Font = true;
  22943. const translatedFont = this.font,
  22944. type3Dependencies = this.type3Dependencies;
  22945. let loadCharProcsPromise = Promise.resolve();
  22946. const charProcs = this.dict.get("CharProcs");
  22947. const fontResources = this.dict.get("Resources") || resources;
  22948. const charProcOperatorList = Object.create(null);
  22949. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  22950. for (const key of charProcs.getKeys()) {
  22951. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  22952. const glyphStream = charProcs.get(key);
  22953. const operatorList = new _operator_list.OperatorList();
  22954. return type3Evaluator.getOperatorList({
  22955. stream: glyphStream,
  22956. task,
  22957. resources: fontResources,
  22958. operatorList
  22959. }).then(() => {
  22960. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  22961. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  22962. }
  22963. charProcOperatorList[key] = operatorList.getIR();
  22964. for (const dependency of operatorList.dependencies) {
  22965. type3Dependencies.add(dependency);
  22966. }
  22967. }).catch(function (reason) {
  22968. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  22969. const dummyOperatorList = new _operator_list.OperatorList();
  22970. charProcOperatorList[key] = dummyOperatorList.getIR();
  22971. });
  22972. });
  22973. }
  22974. this.type3Loaded = loadCharProcsPromise.then(() => {
  22975. translatedFont.charProcOperatorList = charProcOperatorList;
  22976. if (this._bbox) {
  22977. translatedFont.isCharBBox = true;
  22978. translatedFont.bbox = this._bbox;
  22979. }
  22980. });
  22981. return this.type3Loaded;
  22982. }
  22983. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  22984. if (isEmptyBBox) {
  22985. if (!this._bbox) {
  22986. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  22987. }
  22988. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  22989. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  22990. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  22991. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  22992. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  22993. }
  22994. let i = 1,
  22995. ii = operatorList.length;
  22996. while (i < ii) {
  22997. switch (operatorList.fnArray[i]) {
  22998. case _util.OPS.setStrokeColorSpace:
  22999. case _util.OPS.setFillColorSpace:
  23000. case _util.OPS.setStrokeColor:
  23001. case _util.OPS.setStrokeColorN:
  23002. case _util.OPS.setFillColor:
  23003. case _util.OPS.setFillColorN:
  23004. case _util.OPS.setStrokeGray:
  23005. case _util.OPS.setFillGray:
  23006. case _util.OPS.setStrokeRGBColor:
  23007. case _util.OPS.setFillRGBColor:
  23008. case _util.OPS.setStrokeCMYKColor:
  23009. case _util.OPS.setFillCMYKColor:
  23010. case _util.OPS.shadingFill:
  23011. case _util.OPS.setRenderingIntent:
  23012. operatorList.fnArray.splice(i, 1);
  23013. operatorList.argsArray.splice(i, 1);
  23014. ii--;
  23015. continue;
  23016. case _util.OPS.setGState:
  23017. const [gStateObj] = operatorList.argsArray[i];
  23018. let j = 0,
  23019. jj = gStateObj.length;
  23020. while (j < jj) {
  23021. const [gStateKey] = gStateObj[j];
  23022. switch (gStateKey) {
  23023. case "TR":
  23024. case "TR2":
  23025. case "HT":
  23026. case "BG":
  23027. case "BG2":
  23028. case "UCR":
  23029. case "UCR2":
  23030. gStateObj.splice(j, 1);
  23031. jj--;
  23032. continue;
  23033. }
  23034. j++;
  23035. }
  23036. break;
  23037. }
  23038. i++;
  23039. }
  23040. }
  23041. }
  23042. class StateManager {
  23043. constructor(initialState = new EvalState()) {
  23044. this.state = initialState;
  23045. this.stateStack = [];
  23046. }
  23047. save() {
  23048. const old = this.state;
  23049. this.stateStack.push(this.state);
  23050. this.state = old.clone();
  23051. }
  23052. restore() {
  23053. const prev = this.stateStack.pop();
  23054. if (prev) {
  23055. this.state = prev;
  23056. }
  23057. }
  23058. transform(args) {
  23059. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  23060. }
  23061. }
  23062. class TextState {
  23063. constructor() {
  23064. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23065. this.fontName = null;
  23066. this.fontSize = 0;
  23067. this.font = null;
  23068. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  23069. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  23070. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  23071. this.charSpacing = 0;
  23072. this.wordSpacing = 0;
  23073. this.leading = 0;
  23074. this.textHScale = 1;
  23075. this.textRise = 0;
  23076. }
  23077. setTextMatrix(a, b, c, d, e, f) {
  23078. const m = this.textMatrix;
  23079. m[0] = a;
  23080. m[1] = b;
  23081. m[2] = c;
  23082. m[3] = d;
  23083. m[4] = e;
  23084. m[5] = f;
  23085. }
  23086. setTextLineMatrix(a, b, c, d, e, f) {
  23087. const m = this.textLineMatrix;
  23088. m[0] = a;
  23089. m[1] = b;
  23090. m[2] = c;
  23091. m[3] = d;
  23092. m[4] = e;
  23093. m[5] = f;
  23094. }
  23095. translateTextMatrix(x, y) {
  23096. const m = this.textMatrix;
  23097. m[4] = m[0] * x + m[2] * y + m[4];
  23098. m[5] = m[1] * x + m[3] * y + m[5];
  23099. }
  23100. translateTextLineMatrix(x, y) {
  23101. const m = this.textLineMatrix;
  23102. m[4] = m[0] * x + m[2] * y + m[4];
  23103. m[5] = m[1] * x + m[3] * y + m[5];
  23104. }
  23105. carriageReturn() {
  23106. this.translateTextLineMatrix(0, -this.leading);
  23107. this.textMatrix = this.textLineMatrix.slice();
  23108. }
  23109. clone() {
  23110. const clone = Object.create(this);
  23111. clone.textMatrix = this.textMatrix.slice();
  23112. clone.textLineMatrix = this.textLineMatrix.slice();
  23113. clone.fontMatrix = this.fontMatrix.slice();
  23114. return clone;
  23115. }
  23116. }
  23117. class EvalState {
  23118. constructor() {
  23119. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23120. this.font = null;
  23121. this.textRenderingMode = _util.TextRenderingMode.FILL;
  23122. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  23123. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  23124. }
  23125. clone() {
  23126. return Object.create(this);
  23127. }
  23128. }
  23129. class EvaluatorPreprocessor {
  23130. static get opMap() {
  23131. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  23132. t.w = {
  23133. id: _util.OPS.setLineWidth,
  23134. numArgs: 1,
  23135. variableArgs: false
  23136. };
  23137. t.J = {
  23138. id: _util.OPS.setLineCap,
  23139. numArgs: 1,
  23140. variableArgs: false
  23141. };
  23142. t.j = {
  23143. id: _util.OPS.setLineJoin,
  23144. numArgs: 1,
  23145. variableArgs: false
  23146. };
  23147. t.M = {
  23148. id: _util.OPS.setMiterLimit,
  23149. numArgs: 1,
  23150. variableArgs: false
  23151. };
  23152. t.d = {
  23153. id: _util.OPS.setDash,
  23154. numArgs: 2,
  23155. variableArgs: false
  23156. };
  23157. t.ri = {
  23158. id: _util.OPS.setRenderingIntent,
  23159. numArgs: 1,
  23160. variableArgs: false
  23161. };
  23162. t.i = {
  23163. id: _util.OPS.setFlatness,
  23164. numArgs: 1,
  23165. variableArgs: false
  23166. };
  23167. t.gs = {
  23168. id: _util.OPS.setGState,
  23169. numArgs: 1,
  23170. variableArgs: false
  23171. };
  23172. t.q = {
  23173. id: _util.OPS.save,
  23174. numArgs: 0,
  23175. variableArgs: false
  23176. };
  23177. t.Q = {
  23178. id: _util.OPS.restore,
  23179. numArgs: 0,
  23180. variableArgs: false
  23181. };
  23182. t.cm = {
  23183. id: _util.OPS.transform,
  23184. numArgs: 6,
  23185. variableArgs: false
  23186. };
  23187. t.m = {
  23188. id: _util.OPS.moveTo,
  23189. numArgs: 2,
  23190. variableArgs: false
  23191. };
  23192. t.l = {
  23193. id: _util.OPS.lineTo,
  23194. numArgs: 2,
  23195. variableArgs: false
  23196. };
  23197. t.c = {
  23198. id: _util.OPS.curveTo,
  23199. numArgs: 6,
  23200. variableArgs: false
  23201. };
  23202. t.v = {
  23203. id: _util.OPS.curveTo2,
  23204. numArgs: 4,
  23205. variableArgs: false
  23206. };
  23207. t.y = {
  23208. id: _util.OPS.curveTo3,
  23209. numArgs: 4,
  23210. variableArgs: false
  23211. };
  23212. t.h = {
  23213. id: _util.OPS.closePath,
  23214. numArgs: 0,
  23215. variableArgs: false
  23216. };
  23217. t.re = {
  23218. id: _util.OPS.rectangle,
  23219. numArgs: 4,
  23220. variableArgs: false
  23221. };
  23222. t.S = {
  23223. id: _util.OPS.stroke,
  23224. numArgs: 0,
  23225. variableArgs: false
  23226. };
  23227. t.s = {
  23228. id: _util.OPS.closeStroke,
  23229. numArgs: 0,
  23230. variableArgs: false
  23231. };
  23232. t.f = {
  23233. id: _util.OPS.fill,
  23234. numArgs: 0,
  23235. variableArgs: false
  23236. };
  23237. t.F = {
  23238. id: _util.OPS.fill,
  23239. numArgs: 0,
  23240. variableArgs: false
  23241. };
  23242. t["f*"] = {
  23243. id: _util.OPS.eoFill,
  23244. numArgs: 0,
  23245. variableArgs: false
  23246. };
  23247. t.B = {
  23248. id: _util.OPS.fillStroke,
  23249. numArgs: 0,
  23250. variableArgs: false
  23251. };
  23252. t["B*"] = {
  23253. id: _util.OPS.eoFillStroke,
  23254. numArgs: 0,
  23255. variableArgs: false
  23256. };
  23257. t.b = {
  23258. id: _util.OPS.closeFillStroke,
  23259. numArgs: 0,
  23260. variableArgs: false
  23261. };
  23262. t["b*"] = {
  23263. id: _util.OPS.closeEOFillStroke,
  23264. numArgs: 0,
  23265. variableArgs: false
  23266. };
  23267. t.n = {
  23268. id: _util.OPS.endPath,
  23269. numArgs: 0,
  23270. variableArgs: false
  23271. };
  23272. t.W = {
  23273. id: _util.OPS.clip,
  23274. numArgs: 0,
  23275. variableArgs: false
  23276. };
  23277. t["W*"] = {
  23278. id: _util.OPS.eoClip,
  23279. numArgs: 0,
  23280. variableArgs: false
  23281. };
  23282. t.BT = {
  23283. id: _util.OPS.beginText,
  23284. numArgs: 0,
  23285. variableArgs: false
  23286. };
  23287. t.ET = {
  23288. id: _util.OPS.endText,
  23289. numArgs: 0,
  23290. variableArgs: false
  23291. };
  23292. t.Tc = {
  23293. id: _util.OPS.setCharSpacing,
  23294. numArgs: 1,
  23295. variableArgs: false
  23296. };
  23297. t.Tw = {
  23298. id: _util.OPS.setWordSpacing,
  23299. numArgs: 1,
  23300. variableArgs: false
  23301. };
  23302. t.Tz = {
  23303. id: _util.OPS.setHScale,
  23304. numArgs: 1,
  23305. variableArgs: false
  23306. };
  23307. t.TL = {
  23308. id: _util.OPS.setLeading,
  23309. numArgs: 1,
  23310. variableArgs: false
  23311. };
  23312. t.Tf = {
  23313. id: _util.OPS.setFont,
  23314. numArgs: 2,
  23315. variableArgs: false
  23316. };
  23317. t.Tr = {
  23318. id: _util.OPS.setTextRenderingMode,
  23319. numArgs: 1,
  23320. variableArgs: false
  23321. };
  23322. t.Ts = {
  23323. id: _util.OPS.setTextRise,
  23324. numArgs: 1,
  23325. variableArgs: false
  23326. };
  23327. t.Td = {
  23328. id: _util.OPS.moveText,
  23329. numArgs: 2,
  23330. variableArgs: false
  23331. };
  23332. t.TD = {
  23333. id: _util.OPS.setLeadingMoveText,
  23334. numArgs: 2,
  23335. variableArgs: false
  23336. };
  23337. t.Tm = {
  23338. id: _util.OPS.setTextMatrix,
  23339. numArgs: 6,
  23340. variableArgs: false
  23341. };
  23342. t["T*"] = {
  23343. id: _util.OPS.nextLine,
  23344. numArgs: 0,
  23345. variableArgs: false
  23346. };
  23347. t.Tj = {
  23348. id: _util.OPS.showText,
  23349. numArgs: 1,
  23350. variableArgs: false
  23351. };
  23352. t.TJ = {
  23353. id: _util.OPS.showSpacedText,
  23354. numArgs: 1,
  23355. variableArgs: false
  23356. };
  23357. t["'"] = {
  23358. id: _util.OPS.nextLineShowText,
  23359. numArgs: 1,
  23360. variableArgs: false
  23361. };
  23362. t['"'] = {
  23363. id: _util.OPS.nextLineSetSpacingShowText,
  23364. numArgs: 3,
  23365. variableArgs: false
  23366. };
  23367. t.d0 = {
  23368. id: _util.OPS.setCharWidth,
  23369. numArgs: 2,
  23370. variableArgs: false
  23371. };
  23372. t.d1 = {
  23373. id: _util.OPS.setCharWidthAndBounds,
  23374. numArgs: 6,
  23375. variableArgs: false
  23376. };
  23377. t.CS = {
  23378. id: _util.OPS.setStrokeColorSpace,
  23379. numArgs: 1,
  23380. variableArgs: false
  23381. };
  23382. t.cs = {
  23383. id: _util.OPS.setFillColorSpace,
  23384. numArgs: 1,
  23385. variableArgs: false
  23386. };
  23387. t.SC = {
  23388. id: _util.OPS.setStrokeColor,
  23389. numArgs: 4,
  23390. variableArgs: true
  23391. };
  23392. t.SCN = {
  23393. id: _util.OPS.setStrokeColorN,
  23394. numArgs: 33,
  23395. variableArgs: true
  23396. };
  23397. t.sc = {
  23398. id: _util.OPS.setFillColor,
  23399. numArgs: 4,
  23400. variableArgs: true
  23401. };
  23402. t.scn = {
  23403. id: _util.OPS.setFillColorN,
  23404. numArgs: 33,
  23405. variableArgs: true
  23406. };
  23407. t.G = {
  23408. id: _util.OPS.setStrokeGray,
  23409. numArgs: 1,
  23410. variableArgs: false
  23411. };
  23412. t.g = {
  23413. id: _util.OPS.setFillGray,
  23414. numArgs: 1,
  23415. variableArgs: false
  23416. };
  23417. t.RG = {
  23418. id: _util.OPS.setStrokeRGBColor,
  23419. numArgs: 3,
  23420. variableArgs: false
  23421. };
  23422. t.rg = {
  23423. id: _util.OPS.setFillRGBColor,
  23424. numArgs: 3,
  23425. variableArgs: false
  23426. };
  23427. t.K = {
  23428. id: _util.OPS.setStrokeCMYKColor,
  23429. numArgs: 4,
  23430. variableArgs: false
  23431. };
  23432. t.k = {
  23433. id: _util.OPS.setFillCMYKColor,
  23434. numArgs: 4,
  23435. variableArgs: false
  23436. };
  23437. t.sh = {
  23438. id: _util.OPS.shadingFill,
  23439. numArgs: 1,
  23440. variableArgs: false
  23441. };
  23442. t.BI = {
  23443. id: _util.OPS.beginInlineImage,
  23444. numArgs: 0,
  23445. variableArgs: false
  23446. };
  23447. t.ID = {
  23448. id: _util.OPS.beginImageData,
  23449. numArgs: 0,
  23450. variableArgs: false
  23451. };
  23452. t.EI = {
  23453. id: _util.OPS.endInlineImage,
  23454. numArgs: 1,
  23455. variableArgs: false
  23456. };
  23457. t.Do = {
  23458. id: _util.OPS.paintXObject,
  23459. numArgs: 1,
  23460. variableArgs: false
  23461. };
  23462. t.MP = {
  23463. id: _util.OPS.markPoint,
  23464. numArgs: 1,
  23465. variableArgs: false
  23466. };
  23467. t.DP = {
  23468. id: _util.OPS.markPointProps,
  23469. numArgs: 2,
  23470. variableArgs: false
  23471. };
  23472. t.BMC = {
  23473. id: _util.OPS.beginMarkedContent,
  23474. numArgs: 1,
  23475. variableArgs: false
  23476. };
  23477. t.BDC = {
  23478. id: _util.OPS.beginMarkedContentProps,
  23479. numArgs: 2,
  23480. variableArgs: false
  23481. };
  23482. t.EMC = {
  23483. id: _util.OPS.endMarkedContent,
  23484. numArgs: 0,
  23485. variableArgs: false
  23486. };
  23487. t.BX = {
  23488. id: _util.OPS.beginCompat,
  23489. numArgs: 0,
  23490. variableArgs: false
  23491. };
  23492. t.EX = {
  23493. id: _util.OPS.endCompat,
  23494. numArgs: 0,
  23495. variableArgs: false
  23496. };
  23497. t.BM = null;
  23498. t.BD = null;
  23499. t.true = null;
  23500. t.fa = null;
  23501. t.fal = null;
  23502. t.fals = null;
  23503. t.false = null;
  23504. t.nu = null;
  23505. t.nul = null;
  23506. t.null = null;
  23507. });
  23508. return (0, _util.shadow)(this, "opMap", getOPMap());
  23509. }
  23510. static get MAX_INVALID_PATH_OPS() {
  23511. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  23512. }
  23513. constructor(stream, xref, stateManager = new StateManager()) {
  23514. this.parser = new _parser.Parser({
  23515. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  23516. xref
  23517. });
  23518. this.stateManager = stateManager;
  23519. this.nonProcessedArgs = [];
  23520. this._numInvalidPathOPS = 0;
  23521. }
  23522. get savedStatesDepth() {
  23523. return this.stateManager.stateStack.length;
  23524. }
  23525. read(operation) {
  23526. let args = operation.args;
  23527. while (true) {
  23528. const obj = this.parser.getObj();
  23529. if (obj instanceof _primitives.Cmd) {
  23530. const cmd = obj.cmd;
  23531. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  23532. if (!opSpec) {
  23533. (0, _util.warn)(`Unknown command "${cmd}".`);
  23534. continue;
  23535. }
  23536. const fn = opSpec.id;
  23537. const numArgs = opSpec.numArgs;
  23538. let argsLength = args !== null ? args.length : 0;
  23539. if (!opSpec.variableArgs) {
  23540. if (argsLength !== numArgs) {
  23541. const nonProcessedArgs = this.nonProcessedArgs;
  23542. while (argsLength > numArgs) {
  23543. nonProcessedArgs.push(args.shift());
  23544. argsLength--;
  23545. }
  23546. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  23547. if (args === null) {
  23548. args = [];
  23549. }
  23550. args.unshift(nonProcessedArgs.pop());
  23551. argsLength++;
  23552. }
  23553. }
  23554. if (argsLength < numArgs) {
  23555. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  23556. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  23557. throw new _util.FormatError(`Invalid ${partialMsg}`);
  23558. }
  23559. (0, _util.warn)(`Skipping ${partialMsg}`);
  23560. if (args !== null) {
  23561. args.length = 0;
  23562. }
  23563. continue;
  23564. }
  23565. } else if (argsLength > numArgs) {
  23566. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  23567. }
  23568. this.preprocessCommand(fn, args);
  23569. operation.fn = fn;
  23570. operation.args = args;
  23571. return true;
  23572. }
  23573. if (obj === _primitives.EOF) {
  23574. return false;
  23575. }
  23576. if (obj !== null) {
  23577. if (args === null) {
  23578. args = [];
  23579. }
  23580. args.push(obj);
  23581. if (args.length > 33) {
  23582. throw new _util.FormatError("Too many arguments");
  23583. }
  23584. }
  23585. }
  23586. }
  23587. preprocessCommand(fn, args) {
  23588. switch (fn | 0) {
  23589. case _util.OPS.save:
  23590. this.stateManager.save();
  23591. break;
  23592. case _util.OPS.restore:
  23593. this.stateManager.restore();
  23594. break;
  23595. case _util.OPS.transform:
  23596. this.stateManager.transform(args);
  23597. break;
  23598. }
  23599. }
  23600. }
  23601. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  23602. /***/ }),
  23603. /* 26 */
  23604. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23605. Object.defineProperty(exports, "__esModule", ({
  23606. value: true
  23607. }));
  23608. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  23609. var _util = __w_pdfjs_require__(2);
  23610. var _primitives = __w_pdfjs_require__(5);
  23611. var _parser = __w_pdfjs_require__(27);
  23612. var _core_utils = __w_pdfjs_require__(9);
  23613. var _stream = __w_pdfjs_require__(10);
  23614. 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"];
  23615. const MAX_MAP_RANGE = 2 ** 24 - 1;
  23616. class CMap {
  23617. constructor(builtInCMap = false) {
  23618. this.codespaceRanges = [[], [], [], []];
  23619. this.numCodespaceRanges = 0;
  23620. this._map = [];
  23621. this.name = "";
  23622. this.vertical = false;
  23623. this.useCMap = null;
  23624. this.builtInCMap = builtInCMap;
  23625. }
  23626. addCodespaceRange(n, low, high) {
  23627. this.codespaceRanges[n - 1].push(low, high);
  23628. this.numCodespaceRanges++;
  23629. }
  23630. mapCidRange(low, high, dstLow) {
  23631. if (high - low > MAX_MAP_RANGE) {
  23632. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  23633. }
  23634. while (low <= high) {
  23635. this._map[low++] = dstLow++;
  23636. }
  23637. }
  23638. mapBfRange(low, high, dstLow) {
  23639. if (high - low > MAX_MAP_RANGE) {
  23640. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  23641. }
  23642. const lastByte = dstLow.length - 1;
  23643. while (low <= high) {
  23644. this._map[low++] = dstLow;
  23645. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  23646. if (nextCharCode > 0xff) {
  23647. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  23648. continue;
  23649. }
  23650. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  23651. }
  23652. }
  23653. mapBfRangeToArray(low, high, array) {
  23654. if (high - low > MAX_MAP_RANGE) {
  23655. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  23656. }
  23657. const ii = array.length;
  23658. let i = 0;
  23659. while (low <= high && i < ii) {
  23660. this._map[low] = array[i++];
  23661. ++low;
  23662. }
  23663. }
  23664. mapOne(src, dst) {
  23665. this._map[src] = dst;
  23666. }
  23667. lookup(code) {
  23668. return this._map[code];
  23669. }
  23670. contains(code) {
  23671. return this._map[code] !== undefined;
  23672. }
  23673. forEach(callback) {
  23674. const map = this._map;
  23675. const length = map.length;
  23676. if (length <= 0x10000) {
  23677. for (let i = 0; i < length; i++) {
  23678. if (map[i] !== undefined) {
  23679. callback(i, map[i]);
  23680. }
  23681. }
  23682. } else {
  23683. for (const i in map) {
  23684. callback(i, map[i]);
  23685. }
  23686. }
  23687. }
  23688. charCodeOf(value) {
  23689. const map = this._map;
  23690. if (map.length <= 0x10000) {
  23691. return map.indexOf(value);
  23692. }
  23693. for (const charCode in map) {
  23694. if (map[charCode] === value) {
  23695. return charCode | 0;
  23696. }
  23697. }
  23698. return -1;
  23699. }
  23700. getMap() {
  23701. return this._map;
  23702. }
  23703. readCharCode(str, offset, out) {
  23704. let c = 0;
  23705. const codespaceRanges = this.codespaceRanges;
  23706. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23707. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  23708. const codespaceRange = codespaceRanges[n];
  23709. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23710. const low = codespaceRange[k++];
  23711. const high = codespaceRange[k++];
  23712. if (c >= low && c <= high) {
  23713. out.charcode = c;
  23714. out.length = n + 1;
  23715. return;
  23716. }
  23717. }
  23718. }
  23719. out.charcode = 0;
  23720. out.length = 1;
  23721. }
  23722. getCharCodeLength(charCode) {
  23723. const codespaceRanges = this.codespaceRanges;
  23724. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23725. const codespaceRange = codespaceRanges[n];
  23726. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23727. const low = codespaceRange[k++];
  23728. const high = codespaceRange[k++];
  23729. if (charCode >= low && charCode <= high) {
  23730. return n + 1;
  23731. }
  23732. }
  23733. }
  23734. return 1;
  23735. }
  23736. get length() {
  23737. return this._map.length;
  23738. }
  23739. get isIdentityCMap() {
  23740. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  23741. return false;
  23742. }
  23743. if (this._map.length !== 0x10000) {
  23744. return false;
  23745. }
  23746. for (let i = 0; i < 0x10000; i++) {
  23747. if (this._map[i] !== i) {
  23748. return false;
  23749. }
  23750. }
  23751. return true;
  23752. }
  23753. }
  23754. exports.CMap = CMap;
  23755. class IdentityCMap extends CMap {
  23756. constructor(vertical, n) {
  23757. super();
  23758. this.vertical = vertical;
  23759. this.addCodespaceRange(n, 0, 0xffff);
  23760. }
  23761. mapCidRange(low, high, dstLow) {
  23762. (0, _util.unreachable)("should not call mapCidRange");
  23763. }
  23764. mapBfRange(low, high, dstLow) {
  23765. (0, _util.unreachable)("should not call mapBfRange");
  23766. }
  23767. mapBfRangeToArray(low, high, array) {
  23768. (0, _util.unreachable)("should not call mapBfRangeToArray");
  23769. }
  23770. mapOne(src, dst) {
  23771. (0, _util.unreachable)("should not call mapCidOne");
  23772. }
  23773. lookup(code) {
  23774. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  23775. }
  23776. contains(code) {
  23777. return Number.isInteger(code) && code <= 0xffff;
  23778. }
  23779. forEach(callback) {
  23780. for (let i = 0; i <= 0xffff; i++) {
  23781. callback(i, i);
  23782. }
  23783. }
  23784. charCodeOf(value) {
  23785. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  23786. }
  23787. getMap() {
  23788. const map = new Array(0x10000);
  23789. for (let i = 0; i <= 0xffff; i++) {
  23790. map[i] = i;
  23791. }
  23792. return map;
  23793. }
  23794. get length() {
  23795. return 0x10000;
  23796. }
  23797. get isIdentityCMap() {
  23798. (0, _util.unreachable)("should not access .isIdentityCMap");
  23799. }
  23800. }
  23801. exports.IdentityCMap = IdentityCMap;
  23802. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  23803. function hexToInt(a, size) {
  23804. let n = 0;
  23805. for (let i = 0; i <= size; i++) {
  23806. n = n << 8 | a[i];
  23807. }
  23808. return n >>> 0;
  23809. }
  23810. function hexToStr(a, size) {
  23811. if (size === 1) {
  23812. return String.fromCharCode(a[0], a[1]);
  23813. }
  23814. if (size === 3) {
  23815. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  23816. }
  23817. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  23818. }
  23819. function addHex(a, b, size) {
  23820. let c = 0;
  23821. for (let i = size; i >= 0; i--) {
  23822. c += a[i] + b[i];
  23823. a[i] = c & 255;
  23824. c >>= 8;
  23825. }
  23826. }
  23827. function incHex(a, size) {
  23828. let c = 1;
  23829. for (let i = size; i >= 0 && c > 0; i--) {
  23830. c += a[i];
  23831. a[i] = c & 255;
  23832. c >>= 8;
  23833. }
  23834. }
  23835. const MAX_NUM_SIZE = 16;
  23836. const MAX_ENCODED_NUM_SIZE = 19;
  23837. class BinaryCMapStream {
  23838. constructor(data) {
  23839. this.buffer = data;
  23840. this.pos = 0;
  23841. this.end = data.length;
  23842. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  23843. }
  23844. readByte() {
  23845. if (this.pos >= this.end) {
  23846. return -1;
  23847. }
  23848. return this.buffer[this.pos++];
  23849. }
  23850. readNumber() {
  23851. let n = 0;
  23852. let last;
  23853. do {
  23854. const b = this.readByte();
  23855. if (b < 0) {
  23856. throw new _util.FormatError("unexpected EOF in bcmap");
  23857. }
  23858. last = !(b & 0x80);
  23859. n = n << 7 | b & 0x7f;
  23860. } while (!last);
  23861. return n;
  23862. }
  23863. readSigned() {
  23864. const n = this.readNumber();
  23865. return n & 1 ? ~(n >>> 1) : n >>> 1;
  23866. }
  23867. readHex(num, size) {
  23868. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  23869. this.pos += size + 1;
  23870. }
  23871. readHexNumber(num, size) {
  23872. let last;
  23873. const stack = this.tmpBuf;
  23874. let sp = 0;
  23875. do {
  23876. const b = this.readByte();
  23877. if (b < 0) {
  23878. throw new _util.FormatError("unexpected EOF in bcmap");
  23879. }
  23880. last = !(b & 0x80);
  23881. stack[sp++] = b & 0x7f;
  23882. } while (!last);
  23883. let i = size,
  23884. buffer = 0,
  23885. bufferSize = 0;
  23886. while (i >= 0) {
  23887. while (bufferSize < 8 && stack.length > 0) {
  23888. buffer |= stack[--sp] << bufferSize;
  23889. bufferSize += 7;
  23890. }
  23891. num[i] = buffer & 255;
  23892. i--;
  23893. buffer >>= 8;
  23894. bufferSize -= 8;
  23895. }
  23896. }
  23897. readHexSigned(num, size) {
  23898. this.readHexNumber(num, size);
  23899. const sign = num[size] & 1 ? 255 : 0;
  23900. let c = 0;
  23901. for (let i = 0; i <= size; i++) {
  23902. c = (c & 1) << 8 | num[i];
  23903. num[i] = c >> 1 ^ sign;
  23904. }
  23905. }
  23906. readString() {
  23907. const len = this.readNumber();
  23908. let s = "";
  23909. for (let i = 0; i < len; i++) {
  23910. s += String.fromCharCode(this.readNumber());
  23911. }
  23912. return s;
  23913. }
  23914. }
  23915. class BinaryCMapReader {
  23916. async process(data, cMap, extend) {
  23917. const stream = new BinaryCMapStream(data);
  23918. const header = stream.readByte();
  23919. cMap.vertical = !!(header & 1);
  23920. let useCMap = null;
  23921. const start = new Uint8Array(MAX_NUM_SIZE);
  23922. const end = new Uint8Array(MAX_NUM_SIZE);
  23923. const char = new Uint8Array(MAX_NUM_SIZE);
  23924. const charCode = new Uint8Array(MAX_NUM_SIZE);
  23925. const tmp = new Uint8Array(MAX_NUM_SIZE);
  23926. let code;
  23927. let b;
  23928. while ((b = stream.readByte()) >= 0) {
  23929. const type = b >> 5;
  23930. if (type === 7) {
  23931. switch (b & 0x1f) {
  23932. case 0:
  23933. stream.readString();
  23934. break;
  23935. case 1:
  23936. useCMap = stream.readString();
  23937. break;
  23938. }
  23939. continue;
  23940. }
  23941. const sequence = !!(b & 0x10);
  23942. const dataSize = b & 15;
  23943. if (dataSize + 1 > MAX_NUM_SIZE) {
  23944. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  23945. }
  23946. const ucs2DataSize = 1;
  23947. const subitemsCount = stream.readNumber();
  23948. switch (type) {
  23949. case 0:
  23950. stream.readHex(start, dataSize);
  23951. stream.readHexNumber(end, dataSize);
  23952. addHex(end, start, dataSize);
  23953. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  23954. for (let i = 1; i < subitemsCount; i++) {
  23955. incHex(end, dataSize);
  23956. stream.readHexNumber(start, dataSize);
  23957. addHex(start, end, dataSize);
  23958. stream.readHexNumber(end, dataSize);
  23959. addHex(end, start, dataSize);
  23960. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  23961. }
  23962. break;
  23963. case 1:
  23964. stream.readHex(start, dataSize);
  23965. stream.readHexNumber(end, dataSize);
  23966. addHex(end, start, dataSize);
  23967. stream.readNumber();
  23968. for (let i = 1; i < subitemsCount; i++) {
  23969. incHex(end, dataSize);
  23970. stream.readHexNumber(start, dataSize);
  23971. addHex(start, end, dataSize);
  23972. stream.readHexNumber(end, dataSize);
  23973. addHex(end, start, dataSize);
  23974. stream.readNumber();
  23975. }
  23976. break;
  23977. case 2:
  23978. stream.readHex(char, dataSize);
  23979. code = stream.readNumber();
  23980. cMap.mapOne(hexToInt(char, dataSize), code);
  23981. for (let i = 1; i < subitemsCount; i++) {
  23982. incHex(char, dataSize);
  23983. if (!sequence) {
  23984. stream.readHexNumber(tmp, dataSize);
  23985. addHex(char, tmp, dataSize);
  23986. }
  23987. code = stream.readSigned() + (code + 1);
  23988. cMap.mapOne(hexToInt(char, dataSize), code);
  23989. }
  23990. break;
  23991. case 3:
  23992. stream.readHex(start, dataSize);
  23993. stream.readHexNumber(end, dataSize);
  23994. addHex(end, start, dataSize);
  23995. code = stream.readNumber();
  23996. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  23997. for (let i = 1; i < subitemsCount; i++) {
  23998. incHex(end, dataSize);
  23999. if (!sequence) {
  24000. stream.readHexNumber(start, dataSize);
  24001. addHex(start, end, dataSize);
  24002. } else {
  24003. start.set(end);
  24004. }
  24005. stream.readHexNumber(end, dataSize);
  24006. addHex(end, start, dataSize);
  24007. code = stream.readNumber();
  24008. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24009. }
  24010. break;
  24011. case 4:
  24012. stream.readHex(char, ucs2DataSize);
  24013. stream.readHex(charCode, dataSize);
  24014. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24015. for (let i = 1; i < subitemsCount; i++) {
  24016. incHex(char, ucs2DataSize);
  24017. if (!sequence) {
  24018. stream.readHexNumber(tmp, ucs2DataSize);
  24019. addHex(char, tmp, ucs2DataSize);
  24020. }
  24021. incHex(charCode, dataSize);
  24022. stream.readHexSigned(tmp, dataSize);
  24023. addHex(charCode, tmp, dataSize);
  24024. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24025. }
  24026. break;
  24027. case 5:
  24028. stream.readHex(start, ucs2DataSize);
  24029. stream.readHexNumber(end, ucs2DataSize);
  24030. addHex(end, start, ucs2DataSize);
  24031. stream.readHex(charCode, dataSize);
  24032. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24033. for (let i = 1; i < subitemsCount; i++) {
  24034. incHex(end, ucs2DataSize);
  24035. if (!sequence) {
  24036. stream.readHexNumber(start, ucs2DataSize);
  24037. addHex(start, end, ucs2DataSize);
  24038. } else {
  24039. start.set(end);
  24040. }
  24041. stream.readHexNumber(end, ucs2DataSize);
  24042. addHex(end, start, ucs2DataSize);
  24043. stream.readHex(charCode, dataSize);
  24044. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24045. }
  24046. break;
  24047. default:
  24048. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  24049. }
  24050. }
  24051. if (useCMap) {
  24052. return extend(useCMap);
  24053. }
  24054. return cMap;
  24055. }
  24056. }
  24057. return BinaryCMapReader;
  24058. }();
  24059. const CMapFactory = function CMapFactoryClosure() {
  24060. function strToInt(str) {
  24061. let a = 0;
  24062. for (let i = 0; i < str.length; i++) {
  24063. a = a << 8 | str.charCodeAt(i);
  24064. }
  24065. return a >>> 0;
  24066. }
  24067. function expectString(obj) {
  24068. if (!(0, _util.isString)(obj)) {
  24069. throw new _util.FormatError("Malformed CMap: expected string.");
  24070. }
  24071. }
  24072. function expectInt(obj) {
  24073. if (!Number.isInteger(obj)) {
  24074. throw new _util.FormatError("Malformed CMap: expected int.");
  24075. }
  24076. }
  24077. function parseBfChar(cMap, lexer) {
  24078. while (true) {
  24079. let obj = lexer.getObj();
  24080. if (obj === _primitives.EOF) {
  24081. break;
  24082. }
  24083. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  24084. return;
  24085. }
  24086. expectString(obj);
  24087. const src = strToInt(obj);
  24088. obj = lexer.getObj();
  24089. expectString(obj);
  24090. const dst = obj;
  24091. cMap.mapOne(src, dst);
  24092. }
  24093. }
  24094. function parseBfRange(cMap, lexer) {
  24095. while (true) {
  24096. let obj = lexer.getObj();
  24097. if (obj === _primitives.EOF) {
  24098. break;
  24099. }
  24100. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  24101. return;
  24102. }
  24103. expectString(obj);
  24104. const low = strToInt(obj);
  24105. obj = lexer.getObj();
  24106. expectString(obj);
  24107. const high = strToInt(obj);
  24108. obj = lexer.getObj();
  24109. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  24110. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  24111. cMap.mapBfRange(low, high, dstLow);
  24112. } else if ((0, _primitives.isCmd)(obj, "[")) {
  24113. obj = lexer.getObj();
  24114. const array = [];
  24115. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  24116. array.push(obj);
  24117. obj = lexer.getObj();
  24118. }
  24119. cMap.mapBfRangeToArray(low, high, array);
  24120. } else {
  24121. break;
  24122. }
  24123. }
  24124. throw new _util.FormatError("Invalid bf range.");
  24125. }
  24126. function parseCidChar(cMap, lexer) {
  24127. while (true) {
  24128. let obj = lexer.getObj();
  24129. if (obj === _primitives.EOF) {
  24130. break;
  24131. }
  24132. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  24133. return;
  24134. }
  24135. expectString(obj);
  24136. const src = strToInt(obj);
  24137. obj = lexer.getObj();
  24138. expectInt(obj);
  24139. const dst = obj;
  24140. cMap.mapOne(src, dst);
  24141. }
  24142. }
  24143. function parseCidRange(cMap, lexer) {
  24144. while (true) {
  24145. let obj = lexer.getObj();
  24146. if (obj === _primitives.EOF) {
  24147. break;
  24148. }
  24149. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  24150. return;
  24151. }
  24152. expectString(obj);
  24153. const low = strToInt(obj);
  24154. obj = lexer.getObj();
  24155. expectString(obj);
  24156. const high = strToInt(obj);
  24157. obj = lexer.getObj();
  24158. expectInt(obj);
  24159. const dstLow = obj;
  24160. cMap.mapCidRange(low, high, dstLow);
  24161. }
  24162. }
  24163. function parseCodespaceRange(cMap, lexer) {
  24164. while (true) {
  24165. let obj = lexer.getObj();
  24166. if (obj === _primitives.EOF) {
  24167. break;
  24168. }
  24169. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  24170. return;
  24171. }
  24172. if (!(0, _util.isString)(obj)) {
  24173. break;
  24174. }
  24175. const low = strToInt(obj);
  24176. obj = lexer.getObj();
  24177. if (!(0, _util.isString)(obj)) {
  24178. break;
  24179. }
  24180. const high = strToInt(obj);
  24181. cMap.addCodespaceRange(obj.length, low, high);
  24182. }
  24183. throw new _util.FormatError("Invalid codespace range.");
  24184. }
  24185. function parseWMode(cMap, lexer) {
  24186. const obj = lexer.getObj();
  24187. if (Number.isInteger(obj)) {
  24188. cMap.vertical = !!obj;
  24189. }
  24190. }
  24191. function parseCMapName(cMap, lexer) {
  24192. const obj = lexer.getObj();
  24193. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  24194. cMap.name = obj.name;
  24195. }
  24196. }
  24197. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  24198. let previous, embeddedUseCMap;
  24199. objLoop: while (true) {
  24200. try {
  24201. const obj = lexer.getObj();
  24202. if (obj === _primitives.EOF) {
  24203. break;
  24204. } else if ((0, _primitives.isName)(obj)) {
  24205. if (obj.name === "WMode") {
  24206. parseWMode(cMap, lexer);
  24207. } else if (obj.name === "CMapName") {
  24208. parseCMapName(cMap, lexer);
  24209. }
  24210. previous = obj;
  24211. } else if ((0, _primitives.isCmd)(obj)) {
  24212. switch (obj.cmd) {
  24213. case "endcmap":
  24214. break objLoop;
  24215. case "usecmap":
  24216. if ((0, _primitives.isName)(previous)) {
  24217. embeddedUseCMap = previous.name;
  24218. }
  24219. break;
  24220. case "begincodespacerange":
  24221. parseCodespaceRange(cMap, lexer);
  24222. break;
  24223. case "beginbfchar":
  24224. parseBfChar(cMap, lexer);
  24225. break;
  24226. case "begincidchar":
  24227. parseCidChar(cMap, lexer);
  24228. break;
  24229. case "beginbfrange":
  24230. parseBfRange(cMap, lexer);
  24231. break;
  24232. case "begincidrange":
  24233. parseCidRange(cMap, lexer);
  24234. break;
  24235. }
  24236. }
  24237. } catch (ex) {
  24238. if (ex instanceof _core_utils.MissingDataException) {
  24239. throw ex;
  24240. }
  24241. (0, _util.warn)("Invalid cMap data: " + ex);
  24242. continue;
  24243. }
  24244. }
  24245. if (!useCMap && embeddedUseCMap) {
  24246. useCMap = embeddedUseCMap;
  24247. }
  24248. if (useCMap) {
  24249. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24250. }
  24251. return cMap;
  24252. }
  24253. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  24254. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  24255. if (cMap.numCodespaceRanges === 0) {
  24256. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  24257. for (let i = 0; i < useCodespaceRanges.length; i++) {
  24258. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  24259. }
  24260. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  24261. }
  24262. cMap.useCMap.forEach(function (key, value) {
  24263. if (!cMap.contains(key)) {
  24264. cMap.mapOne(key, cMap.useCMap.lookup(key));
  24265. }
  24266. });
  24267. return cMap;
  24268. }
  24269. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  24270. if (name === "Identity-H") {
  24271. return new IdentityCMap(false, 2);
  24272. } else if (name === "Identity-V") {
  24273. return new IdentityCMap(true, 2);
  24274. }
  24275. if (!BUILT_IN_CMAPS.includes(name)) {
  24276. throw new Error("Unknown CMap name: " + name);
  24277. }
  24278. if (!fetchBuiltInCMap) {
  24279. throw new Error("Built-in CMap parameters are not provided.");
  24280. }
  24281. const {
  24282. cMapData,
  24283. compressionType
  24284. } = await fetchBuiltInCMap(name);
  24285. const cMap = new CMap(true);
  24286. if (compressionType === _util.CMapCompressionType.BINARY) {
  24287. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  24288. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24289. });
  24290. }
  24291. if (compressionType === _util.CMapCompressionType.NONE) {
  24292. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  24293. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  24294. }
  24295. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  24296. }
  24297. return {
  24298. async create(params) {
  24299. const encoding = params.encoding;
  24300. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  24301. const useCMap = params.useCMap;
  24302. if ((0, _primitives.isName)(encoding)) {
  24303. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  24304. } else if ((0, _primitives.isStream)(encoding)) {
  24305. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  24306. if (parsedCMap.isIdentityCMap) {
  24307. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  24308. }
  24309. return parsedCMap;
  24310. }
  24311. throw new Error("Encoding required.");
  24312. }
  24313. };
  24314. }();
  24315. exports.CMapFactory = CMapFactory;
  24316. /***/ }),
  24317. /* 27 */
  24318. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24319. Object.defineProperty(exports, "__esModule", ({
  24320. value: true
  24321. }));
  24322. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  24323. var _util = __w_pdfjs_require__(2);
  24324. var _primitives = __w_pdfjs_require__(5);
  24325. var _core_utils = __w_pdfjs_require__(9);
  24326. var _ascii_85_stream = __w_pdfjs_require__(28);
  24327. var _ascii_hex_stream = __w_pdfjs_require__(30);
  24328. var _ccitt_stream = __w_pdfjs_require__(31);
  24329. var _flate_stream = __w_pdfjs_require__(33);
  24330. var _jbig2_stream = __w_pdfjs_require__(34);
  24331. var _jpeg_stream = __w_pdfjs_require__(37);
  24332. var _jpx_stream = __w_pdfjs_require__(39);
  24333. var _lzw_stream = __w_pdfjs_require__(41);
  24334. var _stream = __w_pdfjs_require__(10);
  24335. var _predictor_stream = __w_pdfjs_require__(42);
  24336. var _run_length_stream = __w_pdfjs_require__(43);
  24337. const MAX_LENGTH_TO_CACHE = 1000;
  24338. const MAX_ADLER32_LENGTH = 5552;
  24339. function computeAdler32(bytes) {
  24340. const bytesLength = bytes.length;
  24341. let a = 1,
  24342. b = 0;
  24343. for (let i = 0; i < bytesLength; ++i) {
  24344. a += bytes[i] & 0xff;
  24345. b += a;
  24346. }
  24347. return b % 65521 << 16 | a % 65521;
  24348. }
  24349. class Parser {
  24350. constructor({
  24351. lexer,
  24352. xref,
  24353. allowStreams = false,
  24354. recoveryMode = false
  24355. }) {
  24356. this.lexer = lexer;
  24357. this.xref = xref;
  24358. this.allowStreams = allowStreams;
  24359. this.recoveryMode = recoveryMode;
  24360. this.imageCache = Object.create(null);
  24361. this.refill();
  24362. }
  24363. refill() {
  24364. this.buf1 = this.lexer.getObj();
  24365. this.buf2 = this.lexer.getObj();
  24366. }
  24367. shift() {
  24368. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  24369. this.buf1 = this.buf2;
  24370. this.buf2 = null;
  24371. } else {
  24372. this.buf1 = this.buf2;
  24373. this.buf2 = this.lexer.getObj();
  24374. }
  24375. }
  24376. tryShift() {
  24377. try {
  24378. this.shift();
  24379. return true;
  24380. } catch (e) {
  24381. if (e instanceof _core_utils.MissingDataException) {
  24382. throw e;
  24383. }
  24384. return false;
  24385. }
  24386. }
  24387. getObj(cipherTransform = null) {
  24388. const buf1 = this.buf1;
  24389. this.shift();
  24390. if (buf1 instanceof _primitives.Cmd) {
  24391. switch (buf1.cmd) {
  24392. case "BI":
  24393. return this.makeInlineImage(cipherTransform);
  24394. case "[":
  24395. const array = [];
  24396. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  24397. array.push(this.getObj(cipherTransform));
  24398. }
  24399. if (this.buf1 === _primitives.EOF) {
  24400. if (this.recoveryMode) {
  24401. return array;
  24402. }
  24403. throw new _core_utils.ParserEOFException("End of file inside array.");
  24404. }
  24405. this.shift();
  24406. return array;
  24407. case "<<":
  24408. const dict = new _primitives.Dict(this.xref);
  24409. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  24410. if (!(0, _primitives.isName)(this.buf1)) {
  24411. (0, _util.info)("Malformed dictionary: key must be a name object");
  24412. this.shift();
  24413. continue;
  24414. }
  24415. const key = this.buf1.name;
  24416. this.shift();
  24417. if (this.buf1 === _primitives.EOF) {
  24418. break;
  24419. }
  24420. dict.set(key, this.getObj(cipherTransform));
  24421. }
  24422. if (this.buf1 === _primitives.EOF) {
  24423. if (this.recoveryMode) {
  24424. return dict;
  24425. }
  24426. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  24427. }
  24428. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  24429. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  24430. }
  24431. this.shift();
  24432. return dict;
  24433. default:
  24434. return buf1;
  24435. }
  24436. }
  24437. if (Number.isInteger(buf1)) {
  24438. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  24439. const ref = _primitives.Ref.get(buf1, this.buf1);
  24440. this.shift();
  24441. this.shift();
  24442. return ref;
  24443. }
  24444. return buf1;
  24445. }
  24446. if (typeof buf1 === "string") {
  24447. if (cipherTransform) {
  24448. return cipherTransform.decryptString(buf1);
  24449. }
  24450. return buf1;
  24451. }
  24452. return buf1;
  24453. }
  24454. findDefaultInlineStreamEnd(stream) {
  24455. const E = 0x45,
  24456. I = 0x49,
  24457. SPACE = 0x20,
  24458. LF = 0xa,
  24459. CR = 0xd,
  24460. NUL = 0x0;
  24461. const lexer = this.lexer,
  24462. startPos = stream.pos,
  24463. n = 10;
  24464. let state = 0,
  24465. ch,
  24466. maybeEIPos;
  24467. while ((ch = stream.getByte()) !== -1) {
  24468. if (state === 0) {
  24469. state = ch === E ? 1 : 0;
  24470. } else if (state === 1) {
  24471. state = ch === I ? 2 : 0;
  24472. } else {
  24473. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  24474. if (ch === SPACE || ch === LF || ch === CR) {
  24475. maybeEIPos = stream.pos;
  24476. const followingBytes = stream.peekBytes(n);
  24477. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  24478. ch = followingBytes[i];
  24479. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  24480. continue;
  24481. }
  24482. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  24483. state = 0;
  24484. break;
  24485. }
  24486. }
  24487. if (state !== 2) {
  24488. continue;
  24489. }
  24490. if (lexer.knownCommands) {
  24491. const nextObj = lexer.peekObj();
  24492. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  24493. state = 0;
  24494. }
  24495. } else {
  24496. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  24497. }
  24498. if (state === 2) {
  24499. break;
  24500. }
  24501. } else {
  24502. state = 0;
  24503. }
  24504. }
  24505. }
  24506. if (ch === -1) {
  24507. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  24508. if (maybeEIPos) {
  24509. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  24510. stream.skip(-(stream.pos - maybeEIPos));
  24511. }
  24512. }
  24513. let endOffset = 4;
  24514. stream.skip(-endOffset);
  24515. ch = stream.peekByte();
  24516. stream.skip(endOffset);
  24517. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  24518. endOffset--;
  24519. }
  24520. return stream.pos - endOffset - startPos;
  24521. }
  24522. findDCTDecodeInlineStreamEnd(stream) {
  24523. const startPos = stream.pos;
  24524. let foundEOI = false,
  24525. b,
  24526. markerLength;
  24527. while ((b = stream.getByte()) !== -1) {
  24528. if (b !== 0xff) {
  24529. continue;
  24530. }
  24531. switch (stream.getByte()) {
  24532. case 0x00:
  24533. break;
  24534. case 0xff:
  24535. stream.skip(-1);
  24536. break;
  24537. case 0xd9:
  24538. foundEOI = true;
  24539. break;
  24540. case 0xc0:
  24541. case 0xc1:
  24542. case 0xc2:
  24543. case 0xc3:
  24544. case 0xc5:
  24545. case 0xc6:
  24546. case 0xc7:
  24547. case 0xc9:
  24548. case 0xca:
  24549. case 0xcb:
  24550. case 0xcd:
  24551. case 0xce:
  24552. case 0xcf:
  24553. case 0xc4:
  24554. case 0xcc:
  24555. case 0xda:
  24556. case 0xdb:
  24557. case 0xdc:
  24558. case 0xdd:
  24559. case 0xde:
  24560. case 0xdf:
  24561. case 0xe0:
  24562. case 0xe1:
  24563. case 0xe2:
  24564. case 0xe3:
  24565. case 0xe4:
  24566. case 0xe5:
  24567. case 0xe6:
  24568. case 0xe7:
  24569. case 0xe8:
  24570. case 0xe9:
  24571. case 0xea:
  24572. case 0xeb:
  24573. case 0xec:
  24574. case 0xed:
  24575. case 0xee:
  24576. case 0xef:
  24577. case 0xfe:
  24578. markerLength = stream.getUint16();
  24579. if (markerLength > 2) {
  24580. stream.skip(markerLength - 2);
  24581. } else {
  24582. stream.skip(-2);
  24583. }
  24584. break;
  24585. }
  24586. if (foundEOI) {
  24587. break;
  24588. }
  24589. }
  24590. const length = stream.pos - startPos;
  24591. if (b === -1) {
  24592. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  24593. stream.skip(-length);
  24594. return this.findDefaultInlineStreamEnd(stream);
  24595. }
  24596. this.inlineStreamSkipEI(stream);
  24597. return length;
  24598. }
  24599. findASCII85DecodeInlineStreamEnd(stream) {
  24600. const TILDE = 0x7e,
  24601. GT = 0x3e;
  24602. const startPos = stream.pos;
  24603. let ch;
  24604. while ((ch = stream.getByte()) !== -1) {
  24605. if (ch === TILDE) {
  24606. const tildePos = stream.pos;
  24607. ch = stream.peekByte();
  24608. while ((0, _core_utils.isWhiteSpace)(ch)) {
  24609. stream.skip();
  24610. ch = stream.peekByte();
  24611. }
  24612. if (ch === GT) {
  24613. stream.skip();
  24614. break;
  24615. }
  24616. if (stream.pos > tildePos) {
  24617. const maybeEI = stream.peekBytes(2);
  24618. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  24619. break;
  24620. }
  24621. }
  24622. }
  24623. }
  24624. const length = stream.pos - startPos;
  24625. if (ch === -1) {
  24626. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24627. stream.skip(-length);
  24628. return this.findDefaultInlineStreamEnd(stream);
  24629. }
  24630. this.inlineStreamSkipEI(stream);
  24631. return length;
  24632. }
  24633. findASCIIHexDecodeInlineStreamEnd(stream) {
  24634. const GT = 0x3e;
  24635. const startPos = stream.pos;
  24636. let ch;
  24637. while ((ch = stream.getByte()) !== -1) {
  24638. if (ch === GT) {
  24639. break;
  24640. }
  24641. }
  24642. const length = stream.pos - startPos;
  24643. if (ch === -1) {
  24644. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24645. stream.skip(-length);
  24646. return this.findDefaultInlineStreamEnd(stream);
  24647. }
  24648. this.inlineStreamSkipEI(stream);
  24649. return length;
  24650. }
  24651. inlineStreamSkipEI(stream) {
  24652. const E = 0x45,
  24653. I = 0x49;
  24654. let state = 0,
  24655. ch;
  24656. while ((ch = stream.getByte()) !== -1) {
  24657. if (state === 0) {
  24658. state = ch === E ? 1 : 0;
  24659. } else if (state === 1) {
  24660. state = ch === I ? 2 : 0;
  24661. } else if (state === 2) {
  24662. break;
  24663. }
  24664. }
  24665. }
  24666. makeInlineImage(cipherTransform) {
  24667. const lexer = this.lexer;
  24668. const stream = lexer.stream;
  24669. const dict = new _primitives.Dict(this.xref);
  24670. let dictLength;
  24671. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  24672. if (!(0, _primitives.isName)(this.buf1)) {
  24673. throw new _util.FormatError("Dictionary key must be a name object");
  24674. }
  24675. const key = this.buf1.name;
  24676. this.shift();
  24677. if (this.buf1 === _primitives.EOF) {
  24678. break;
  24679. }
  24680. dict.set(key, this.getObj(cipherTransform));
  24681. }
  24682. if (lexer.beginInlineImagePos !== -1) {
  24683. dictLength = stream.pos - lexer.beginInlineImagePos;
  24684. }
  24685. const filter = dict.get("F", "Filter");
  24686. let filterName;
  24687. if ((0, _primitives.isName)(filter)) {
  24688. filterName = filter.name;
  24689. } else if (Array.isArray(filter)) {
  24690. const filterZero = this.xref.fetchIfRef(filter[0]);
  24691. if ((0, _primitives.isName)(filterZero)) {
  24692. filterName = filterZero.name;
  24693. }
  24694. }
  24695. const startPos = stream.pos;
  24696. let length;
  24697. switch (filterName) {
  24698. case "DCT":
  24699. case "DCTDecode":
  24700. length = this.findDCTDecodeInlineStreamEnd(stream);
  24701. break;
  24702. case "A85":
  24703. case "ASCII85Decode":
  24704. length = this.findASCII85DecodeInlineStreamEnd(stream);
  24705. break;
  24706. case "AHx":
  24707. case "ASCIIHexDecode":
  24708. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  24709. break;
  24710. default:
  24711. length = this.findDefaultInlineStreamEnd(stream);
  24712. }
  24713. let imageStream = stream.makeSubStream(startPos, length, dict);
  24714. let cacheKey;
  24715. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  24716. const imageBytes = imageStream.getBytes();
  24717. imageStream.reset();
  24718. const initialStreamPos = stream.pos;
  24719. stream.pos = lexer.beginInlineImagePos;
  24720. const dictBytes = stream.getBytes(dictLength);
  24721. stream.pos = initialStreamPos;
  24722. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  24723. const cacheEntry = this.imageCache[cacheKey];
  24724. if (cacheEntry !== undefined) {
  24725. this.buf2 = _primitives.Cmd.get("EI");
  24726. this.shift();
  24727. cacheEntry.reset();
  24728. return cacheEntry;
  24729. }
  24730. }
  24731. if (cipherTransform) {
  24732. imageStream = cipherTransform.createStream(imageStream, length);
  24733. }
  24734. imageStream = this.filter(imageStream, dict, length);
  24735. imageStream.dict = dict;
  24736. if (cacheKey !== undefined) {
  24737. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  24738. this.imageCache[cacheKey] = imageStream;
  24739. }
  24740. this.buf2 = _primitives.Cmd.get("EI");
  24741. this.shift();
  24742. return imageStream;
  24743. }
  24744. _findStreamLength(startPos, signature) {
  24745. const {
  24746. stream
  24747. } = this.lexer;
  24748. stream.pos = startPos;
  24749. const SCAN_BLOCK_LENGTH = 2048;
  24750. const signatureLength = signature.length;
  24751. while (stream.pos < stream.end) {
  24752. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  24753. const scanLength = scanBytes.length - signatureLength;
  24754. if (scanLength <= 0) {
  24755. break;
  24756. }
  24757. let pos = 0;
  24758. while (pos < scanLength) {
  24759. let j = 0;
  24760. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  24761. j++;
  24762. }
  24763. if (j >= signatureLength) {
  24764. stream.pos += pos;
  24765. return stream.pos - startPos;
  24766. }
  24767. pos++;
  24768. }
  24769. stream.pos += scanLength;
  24770. }
  24771. return -1;
  24772. }
  24773. makeStream(dict, cipherTransform) {
  24774. const lexer = this.lexer;
  24775. let stream = lexer.stream;
  24776. lexer.skipToNextLine();
  24777. const startPos = stream.pos - 1;
  24778. let length = dict.get("Length");
  24779. if (!Number.isInteger(length)) {
  24780. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  24781. length = 0;
  24782. }
  24783. stream.pos = startPos + length;
  24784. lexer.nextChar();
  24785. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  24786. this.shift();
  24787. } else {
  24788. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  24789. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  24790. if (actualLength < 0) {
  24791. const MAX_TRUNCATION = 1;
  24792. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  24793. const end = ENDSTREAM_SIGNATURE.length - i;
  24794. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  24795. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  24796. if (maybeLength >= 0) {
  24797. const lastByte = stream.peekBytes(end + 1)[end];
  24798. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  24799. break;
  24800. }
  24801. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  24802. actualLength = maybeLength;
  24803. break;
  24804. }
  24805. }
  24806. if (actualLength < 0) {
  24807. throw new _util.FormatError("Missing endstream command.");
  24808. }
  24809. }
  24810. length = actualLength;
  24811. lexer.nextChar();
  24812. this.shift();
  24813. this.shift();
  24814. }
  24815. this.shift();
  24816. stream = stream.makeSubStream(startPos, length, dict);
  24817. if (cipherTransform) {
  24818. stream = cipherTransform.createStream(stream, length);
  24819. }
  24820. stream = this.filter(stream, dict, length);
  24821. stream.dict = dict;
  24822. return stream;
  24823. }
  24824. filter(stream, dict, length) {
  24825. let filter = dict.get("F", "Filter");
  24826. let params = dict.get("DP", "DecodeParms");
  24827. if ((0, _primitives.isName)(filter)) {
  24828. if (Array.isArray(params)) {
  24829. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  24830. }
  24831. return this.makeFilter(stream, filter.name, length, params);
  24832. }
  24833. let maybeLength = length;
  24834. if (Array.isArray(filter)) {
  24835. const filterArray = filter;
  24836. const paramsArray = params;
  24837. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  24838. filter = this.xref.fetchIfRef(filterArray[i]);
  24839. if (!(0, _primitives.isName)(filter)) {
  24840. throw new _util.FormatError(`Bad filter name "${filter}"`);
  24841. }
  24842. params = null;
  24843. if (Array.isArray(paramsArray) && i in paramsArray) {
  24844. params = this.xref.fetchIfRef(paramsArray[i]);
  24845. }
  24846. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  24847. maybeLength = null;
  24848. }
  24849. }
  24850. return stream;
  24851. }
  24852. makeFilter(stream, name, maybeLength, params) {
  24853. if (maybeLength === 0) {
  24854. (0, _util.warn)(`Empty "${name}" stream.`);
  24855. return new _stream.NullStream();
  24856. }
  24857. const xrefStats = this.xref.stats;
  24858. try {
  24859. switch (name) {
  24860. case "Fl":
  24861. case "FlateDecode":
  24862. xrefStats.addStreamType(_util.StreamType.FLATE);
  24863. if (params) {
  24864. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  24865. }
  24866. return new _flate_stream.FlateStream(stream, maybeLength);
  24867. case "LZW":
  24868. case "LZWDecode":
  24869. xrefStats.addStreamType(_util.StreamType.LZW);
  24870. let earlyChange = 1;
  24871. if (params) {
  24872. if (params.has("EarlyChange")) {
  24873. earlyChange = params.get("EarlyChange");
  24874. }
  24875. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  24876. }
  24877. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  24878. case "DCT":
  24879. case "DCTDecode":
  24880. xrefStats.addStreamType(_util.StreamType.DCT);
  24881. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  24882. case "JPX":
  24883. case "JPXDecode":
  24884. xrefStats.addStreamType(_util.StreamType.JPX);
  24885. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  24886. case "A85":
  24887. case "ASCII85Decode":
  24888. xrefStats.addStreamType(_util.StreamType.A85);
  24889. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  24890. case "AHx":
  24891. case "ASCIIHexDecode":
  24892. xrefStats.addStreamType(_util.StreamType.AHX);
  24893. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  24894. case "CCF":
  24895. case "CCITTFaxDecode":
  24896. xrefStats.addStreamType(_util.StreamType.CCF);
  24897. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  24898. case "RL":
  24899. case "RunLengthDecode":
  24900. xrefStats.addStreamType(_util.StreamType.RLX);
  24901. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  24902. case "JBIG2Decode":
  24903. xrefStats.addStreamType(_util.StreamType.JBIG);
  24904. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  24905. }
  24906. (0, _util.warn)(`Filter "${name}" is not supported.`);
  24907. return stream;
  24908. } catch (ex) {
  24909. if (ex instanceof _core_utils.MissingDataException) {
  24910. throw ex;
  24911. }
  24912. (0, _util.warn)(`Invalid stream: "${ex}"`);
  24913. return new _stream.NullStream();
  24914. }
  24915. }
  24916. }
  24917. exports.Parser = Parser;
  24918. 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];
  24919. function toHexDigit(ch) {
  24920. if (ch >= 0x30 && ch <= 0x39) {
  24921. return ch & 0x0f;
  24922. }
  24923. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  24924. return (ch & 0x0f) + 9;
  24925. }
  24926. return -1;
  24927. }
  24928. class Lexer {
  24929. constructor(stream, knownCommands = null) {
  24930. this.stream = stream;
  24931. this.nextChar();
  24932. this.strBuf = [];
  24933. this.knownCommands = knownCommands;
  24934. this._hexStringNumWarn = 0;
  24935. this.beginInlineImagePos = -1;
  24936. }
  24937. nextChar() {
  24938. return this.currentChar = this.stream.getByte();
  24939. }
  24940. peekChar() {
  24941. return this.stream.peekByte();
  24942. }
  24943. getNumber() {
  24944. let ch = this.currentChar;
  24945. let eNotation = false;
  24946. let divideBy = 0;
  24947. let sign = 0;
  24948. if (ch === 0x2d) {
  24949. sign = -1;
  24950. ch = this.nextChar();
  24951. if (ch === 0x2d) {
  24952. ch = this.nextChar();
  24953. }
  24954. } else if (ch === 0x2b) {
  24955. sign = 1;
  24956. ch = this.nextChar();
  24957. }
  24958. if (ch === 0x0a || ch === 0x0d) {
  24959. do {
  24960. ch = this.nextChar();
  24961. } while (ch === 0x0a || ch === 0x0d);
  24962. }
  24963. if (ch === 0x2e) {
  24964. divideBy = 10;
  24965. ch = this.nextChar();
  24966. }
  24967. if (ch < 0x30 || ch > 0x39) {
  24968. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  24969. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  24970. return 0;
  24971. }
  24972. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  24973. }
  24974. sign = sign || 1;
  24975. let baseValue = ch - 0x30;
  24976. let powerValue = 0;
  24977. let powerValueSign = 1;
  24978. while ((ch = this.nextChar()) >= 0) {
  24979. if (ch >= 0x30 && ch <= 0x39) {
  24980. const currentDigit = ch - 0x30;
  24981. if (eNotation) {
  24982. powerValue = powerValue * 10 + currentDigit;
  24983. } else {
  24984. if (divideBy !== 0) {
  24985. divideBy *= 10;
  24986. }
  24987. baseValue = baseValue * 10 + currentDigit;
  24988. }
  24989. } else if (ch === 0x2e) {
  24990. if (divideBy === 0) {
  24991. divideBy = 1;
  24992. } else {
  24993. break;
  24994. }
  24995. } else if (ch === 0x2d) {
  24996. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  24997. } else if (ch === 0x45 || ch === 0x65) {
  24998. ch = this.peekChar();
  24999. if (ch === 0x2b || ch === 0x2d) {
  25000. powerValueSign = ch === 0x2d ? -1 : 1;
  25001. this.nextChar();
  25002. } else if (ch < 0x30 || ch > 0x39) {
  25003. break;
  25004. }
  25005. eNotation = true;
  25006. } else {
  25007. break;
  25008. }
  25009. }
  25010. if (divideBy !== 0) {
  25011. baseValue /= divideBy;
  25012. }
  25013. if (eNotation) {
  25014. baseValue *= 10 ** (powerValueSign * powerValue);
  25015. }
  25016. return sign * baseValue;
  25017. }
  25018. getString() {
  25019. let numParen = 1;
  25020. let done = false;
  25021. const strBuf = this.strBuf;
  25022. strBuf.length = 0;
  25023. let ch = this.nextChar();
  25024. while (true) {
  25025. let charBuffered = false;
  25026. switch (ch | 0) {
  25027. case -1:
  25028. (0, _util.warn)("Unterminated string");
  25029. done = true;
  25030. break;
  25031. case 0x28:
  25032. ++numParen;
  25033. strBuf.push("(");
  25034. break;
  25035. case 0x29:
  25036. if (--numParen === 0) {
  25037. this.nextChar();
  25038. done = true;
  25039. } else {
  25040. strBuf.push(")");
  25041. }
  25042. break;
  25043. case 0x5c:
  25044. ch = this.nextChar();
  25045. switch (ch) {
  25046. case -1:
  25047. (0, _util.warn)("Unterminated string");
  25048. done = true;
  25049. break;
  25050. case 0x6e:
  25051. strBuf.push("\n");
  25052. break;
  25053. case 0x72:
  25054. strBuf.push("\r");
  25055. break;
  25056. case 0x74:
  25057. strBuf.push("\t");
  25058. break;
  25059. case 0x62:
  25060. strBuf.push("\b");
  25061. break;
  25062. case 0x66:
  25063. strBuf.push("\f");
  25064. break;
  25065. case 0x5c:
  25066. case 0x28:
  25067. case 0x29:
  25068. strBuf.push(String.fromCharCode(ch));
  25069. break;
  25070. case 0x30:
  25071. case 0x31:
  25072. case 0x32:
  25073. case 0x33:
  25074. case 0x34:
  25075. case 0x35:
  25076. case 0x36:
  25077. case 0x37:
  25078. let x = ch & 0x0f;
  25079. ch = this.nextChar();
  25080. charBuffered = true;
  25081. if (ch >= 0x30 && ch <= 0x37) {
  25082. x = (x << 3) + (ch & 0x0f);
  25083. ch = this.nextChar();
  25084. if (ch >= 0x30 && ch <= 0x37) {
  25085. charBuffered = false;
  25086. x = (x << 3) + (ch & 0x0f);
  25087. }
  25088. }
  25089. strBuf.push(String.fromCharCode(x));
  25090. break;
  25091. case 0x0d:
  25092. if (this.peekChar() === 0x0a) {
  25093. this.nextChar();
  25094. }
  25095. break;
  25096. case 0x0a:
  25097. break;
  25098. default:
  25099. strBuf.push(String.fromCharCode(ch));
  25100. break;
  25101. }
  25102. break;
  25103. default:
  25104. strBuf.push(String.fromCharCode(ch));
  25105. break;
  25106. }
  25107. if (done) {
  25108. break;
  25109. }
  25110. if (!charBuffered) {
  25111. ch = this.nextChar();
  25112. }
  25113. }
  25114. return strBuf.join("");
  25115. }
  25116. getName() {
  25117. let ch, previousCh;
  25118. const strBuf = this.strBuf;
  25119. strBuf.length = 0;
  25120. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25121. if (ch === 0x23) {
  25122. ch = this.nextChar();
  25123. if (specialChars[ch]) {
  25124. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  25125. strBuf.push("#");
  25126. break;
  25127. }
  25128. const x = toHexDigit(ch);
  25129. if (x !== -1) {
  25130. previousCh = ch;
  25131. ch = this.nextChar();
  25132. const x2 = toHexDigit(ch);
  25133. if (x2 === -1) {
  25134. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  25135. strBuf.push("#", String.fromCharCode(previousCh));
  25136. if (specialChars[ch]) {
  25137. break;
  25138. }
  25139. strBuf.push(String.fromCharCode(ch));
  25140. continue;
  25141. }
  25142. strBuf.push(String.fromCharCode(x << 4 | x2));
  25143. } else {
  25144. strBuf.push("#", String.fromCharCode(ch));
  25145. }
  25146. } else {
  25147. strBuf.push(String.fromCharCode(ch));
  25148. }
  25149. }
  25150. if (strBuf.length > 127) {
  25151. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  25152. }
  25153. return _primitives.Name.get(strBuf.join(""));
  25154. }
  25155. _hexStringWarn(ch) {
  25156. const MAX_HEX_STRING_NUM_WARN = 5;
  25157. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  25158. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  25159. return;
  25160. }
  25161. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  25162. return;
  25163. }
  25164. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  25165. }
  25166. getHexString() {
  25167. const strBuf = this.strBuf;
  25168. strBuf.length = 0;
  25169. let ch = this.currentChar;
  25170. let isFirstHex = true;
  25171. let firstDigit, secondDigit;
  25172. this._hexStringNumWarn = 0;
  25173. while (true) {
  25174. if (ch < 0) {
  25175. (0, _util.warn)("Unterminated hex string");
  25176. break;
  25177. } else if (ch === 0x3e) {
  25178. this.nextChar();
  25179. break;
  25180. } else if (specialChars[ch] === 1) {
  25181. ch = this.nextChar();
  25182. continue;
  25183. } else {
  25184. if (isFirstHex) {
  25185. firstDigit = toHexDigit(ch);
  25186. if (firstDigit === -1) {
  25187. this._hexStringWarn(ch);
  25188. ch = this.nextChar();
  25189. continue;
  25190. }
  25191. } else {
  25192. secondDigit = toHexDigit(ch);
  25193. if (secondDigit === -1) {
  25194. this._hexStringWarn(ch);
  25195. ch = this.nextChar();
  25196. continue;
  25197. }
  25198. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  25199. }
  25200. isFirstHex = !isFirstHex;
  25201. ch = this.nextChar();
  25202. }
  25203. }
  25204. return strBuf.join("");
  25205. }
  25206. getObj() {
  25207. let comment = false;
  25208. let ch = this.currentChar;
  25209. while (true) {
  25210. if (ch < 0) {
  25211. return _primitives.EOF;
  25212. }
  25213. if (comment) {
  25214. if (ch === 0x0a || ch === 0x0d) {
  25215. comment = false;
  25216. }
  25217. } else if (ch === 0x25) {
  25218. comment = true;
  25219. } else if (specialChars[ch] !== 1) {
  25220. break;
  25221. }
  25222. ch = this.nextChar();
  25223. }
  25224. switch (ch | 0) {
  25225. case 0x30:
  25226. case 0x31:
  25227. case 0x32:
  25228. case 0x33:
  25229. case 0x34:
  25230. case 0x35:
  25231. case 0x36:
  25232. case 0x37:
  25233. case 0x38:
  25234. case 0x39:
  25235. case 0x2b:
  25236. case 0x2d:
  25237. case 0x2e:
  25238. return this.getNumber();
  25239. case 0x28:
  25240. return this.getString();
  25241. case 0x2f:
  25242. return this.getName();
  25243. case 0x5b:
  25244. this.nextChar();
  25245. return _primitives.Cmd.get("[");
  25246. case 0x5d:
  25247. this.nextChar();
  25248. return _primitives.Cmd.get("]");
  25249. case 0x3c:
  25250. ch = this.nextChar();
  25251. if (ch === 0x3c) {
  25252. this.nextChar();
  25253. return _primitives.Cmd.get("<<");
  25254. }
  25255. return this.getHexString();
  25256. case 0x3e:
  25257. ch = this.nextChar();
  25258. if (ch === 0x3e) {
  25259. this.nextChar();
  25260. return _primitives.Cmd.get(">>");
  25261. }
  25262. return _primitives.Cmd.get(">");
  25263. case 0x7b:
  25264. this.nextChar();
  25265. return _primitives.Cmd.get("{");
  25266. case 0x7d:
  25267. this.nextChar();
  25268. return _primitives.Cmd.get("}");
  25269. case 0x29:
  25270. this.nextChar();
  25271. throw new _util.FormatError(`Illegal character: ${ch}`);
  25272. }
  25273. let str = String.fromCharCode(ch);
  25274. if (ch < 0x20 || ch > 0x7f) {
  25275. const nextCh = this.peekChar();
  25276. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  25277. this.nextChar();
  25278. return _primitives.Cmd.get(str);
  25279. }
  25280. }
  25281. const knownCommands = this.knownCommands;
  25282. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25283. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25284. const possibleCommand = str + String.fromCharCode(ch);
  25285. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  25286. break;
  25287. }
  25288. if (str.length === 128) {
  25289. throw new _util.FormatError(`Command token too long: ${str.length}`);
  25290. }
  25291. str = possibleCommand;
  25292. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25293. }
  25294. if (str === "true") {
  25295. return true;
  25296. }
  25297. if (str === "false") {
  25298. return false;
  25299. }
  25300. if (str === "null") {
  25301. return null;
  25302. }
  25303. if (str === "BI") {
  25304. this.beginInlineImagePos = this.stream.pos;
  25305. }
  25306. return _primitives.Cmd.get(str);
  25307. }
  25308. peekObj() {
  25309. const streamPos = this.stream.pos,
  25310. currentChar = this.currentChar,
  25311. beginInlineImagePos = this.beginInlineImagePos;
  25312. let nextObj;
  25313. try {
  25314. nextObj = this.getObj();
  25315. } catch (ex) {
  25316. if (ex instanceof _core_utils.MissingDataException) {
  25317. throw ex;
  25318. }
  25319. (0, _util.warn)(`peekObj: ${ex}`);
  25320. }
  25321. this.stream.pos = streamPos;
  25322. this.currentChar = currentChar;
  25323. this.beginInlineImagePos = beginInlineImagePos;
  25324. return nextObj;
  25325. }
  25326. skipToNextLine() {
  25327. let ch = this.currentChar;
  25328. while (ch >= 0) {
  25329. if (ch === 0x0d) {
  25330. ch = this.nextChar();
  25331. if (ch === 0x0a) {
  25332. this.nextChar();
  25333. }
  25334. break;
  25335. } else if (ch === 0x0a) {
  25336. this.nextChar();
  25337. break;
  25338. }
  25339. ch = this.nextChar();
  25340. }
  25341. }
  25342. }
  25343. exports.Lexer = Lexer;
  25344. class Linearization {
  25345. static create(stream) {
  25346. function getInt(linDict, name, allowZeroValue = false) {
  25347. const obj = linDict.get(name);
  25348. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  25349. return obj;
  25350. }
  25351. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  25352. }
  25353. function getHints(linDict) {
  25354. const hints = linDict.get("H");
  25355. let hintsLength;
  25356. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  25357. for (let index = 0; index < hintsLength; index++) {
  25358. const hint = hints[index];
  25359. if (!(Number.isInteger(hint) && hint > 0)) {
  25360. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  25361. }
  25362. }
  25363. return hints;
  25364. }
  25365. throw new Error("Hint array in the linearization dictionary is invalid.");
  25366. }
  25367. const parser = new Parser({
  25368. lexer: new Lexer(stream),
  25369. xref: null
  25370. });
  25371. const obj1 = parser.getObj();
  25372. const obj2 = parser.getObj();
  25373. const obj3 = parser.getObj();
  25374. const linDict = parser.getObj();
  25375. let obj, length;
  25376. 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)) {
  25377. return null;
  25378. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  25379. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  25380. }
  25381. return {
  25382. length,
  25383. hints: getHints(linDict),
  25384. objectNumberFirst: getInt(linDict, "O"),
  25385. endFirst: getInt(linDict, "E"),
  25386. numPages: getInt(linDict, "N"),
  25387. mainXRefEntriesOffset: getInt(linDict, "T"),
  25388. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  25389. };
  25390. }
  25391. }
  25392. exports.Linearization = Linearization;
  25393. /***/ }),
  25394. /* 28 */
  25395. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25396. Object.defineProperty(exports, "__esModule", ({
  25397. value: true
  25398. }));
  25399. exports.Ascii85Stream = void 0;
  25400. var _decode_stream = __w_pdfjs_require__(29);
  25401. var _core_utils = __w_pdfjs_require__(9);
  25402. class Ascii85Stream extends _decode_stream.DecodeStream {
  25403. constructor(str, maybeLength) {
  25404. if (maybeLength) {
  25405. maybeLength *= 0.8;
  25406. }
  25407. super(maybeLength);
  25408. this.str = str;
  25409. this.dict = str.dict;
  25410. this.input = new Uint8Array(5);
  25411. }
  25412. readBlock() {
  25413. const TILDA_CHAR = 0x7e;
  25414. const Z_LOWER_CHAR = 0x7a;
  25415. const EOF = -1;
  25416. const str = this.str;
  25417. let c = str.getByte();
  25418. while ((0, _core_utils.isWhiteSpace)(c)) {
  25419. c = str.getByte();
  25420. }
  25421. if (c === EOF || c === TILDA_CHAR) {
  25422. this.eof = true;
  25423. return;
  25424. }
  25425. const bufferLength = this.bufferLength;
  25426. let buffer, i;
  25427. if (c === Z_LOWER_CHAR) {
  25428. buffer = this.ensureBuffer(bufferLength + 4);
  25429. for (i = 0; i < 4; ++i) {
  25430. buffer[bufferLength + i] = 0;
  25431. }
  25432. this.bufferLength += 4;
  25433. } else {
  25434. const input = this.input;
  25435. input[0] = c;
  25436. for (i = 1; i < 5; ++i) {
  25437. c = str.getByte();
  25438. while ((0, _core_utils.isWhiteSpace)(c)) {
  25439. c = str.getByte();
  25440. }
  25441. input[i] = c;
  25442. if (c === EOF || c === TILDA_CHAR) {
  25443. break;
  25444. }
  25445. }
  25446. buffer = this.ensureBuffer(bufferLength + i - 1);
  25447. this.bufferLength += i - 1;
  25448. if (i < 5) {
  25449. for (; i < 5; ++i) {
  25450. input[i] = 0x21 + 84;
  25451. }
  25452. this.eof = true;
  25453. }
  25454. let t = 0;
  25455. for (i = 0; i < 5; ++i) {
  25456. t = t * 85 + (input[i] - 0x21);
  25457. }
  25458. for (i = 3; i >= 0; --i) {
  25459. buffer[bufferLength + i] = t & 0xff;
  25460. t >>= 8;
  25461. }
  25462. }
  25463. }
  25464. }
  25465. exports.Ascii85Stream = Ascii85Stream;
  25466. /***/ }),
  25467. /* 29 */
  25468. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25469. Object.defineProperty(exports, "__esModule", ({
  25470. value: true
  25471. }));
  25472. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  25473. var _base_stream = __w_pdfjs_require__(6);
  25474. var _stream = __w_pdfjs_require__(10);
  25475. const emptyBuffer = new Uint8Array(0);
  25476. class DecodeStream extends _base_stream.BaseStream {
  25477. constructor(maybeMinBufferLength) {
  25478. super();
  25479. this._rawMinBufferLength = maybeMinBufferLength || 0;
  25480. this.pos = 0;
  25481. this.bufferLength = 0;
  25482. this.eof = false;
  25483. this.buffer = emptyBuffer;
  25484. this.minBufferLength = 512;
  25485. if (maybeMinBufferLength) {
  25486. while (this.minBufferLength < maybeMinBufferLength) {
  25487. this.minBufferLength *= 2;
  25488. }
  25489. }
  25490. }
  25491. get isEmpty() {
  25492. while (!this.eof && this.bufferLength === 0) {
  25493. this.readBlock();
  25494. }
  25495. return this.bufferLength === 0;
  25496. }
  25497. ensureBuffer(requested) {
  25498. const buffer = this.buffer;
  25499. if (requested <= buffer.byteLength) {
  25500. return buffer;
  25501. }
  25502. let size = this.minBufferLength;
  25503. while (size < requested) {
  25504. size *= 2;
  25505. }
  25506. const buffer2 = new Uint8Array(size);
  25507. buffer2.set(buffer);
  25508. return this.buffer = buffer2;
  25509. }
  25510. getByte() {
  25511. const pos = this.pos;
  25512. while (this.bufferLength <= pos) {
  25513. if (this.eof) {
  25514. return -1;
  25515. }
  25516. this.readBlock();
  25517. }
  25518. return this.buffer[this.pos++];
  25519. }
  25520. getBytes(length, forceClamped = false) {
  25521. const pos = this.pos;
  25522. let end;
  25523. if (length) {
  25524. this.ensureBuffer(pos + length);
  25525. end = pos + length;
  25526. while (!this.eof && this.bufferLength < end) {
  25527. this.readBlock();
  25528. }
  25529. const bufEnd = this.bufferLength;
  25530. if (end > bufEnd) {
  25531. end = bufEnd;
  25532. }
  25533. } else {
  25534. while (!this.eof) {
  25535. this.readBlock();
  25536. }
  25537. end = this.bufferLength;
  25538. }
  25539. this.pos = end;
  25540. const subarray = this.buffer.subarray(pos, end);
  25541. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  25542. }
  25543. reset() {
  25544. this.pos = 0;
  25545. }
  25546. makeSubStream(start, length, dict = null) {
  25547. if (length === undefined) {
  25548. while (!this.eof) {
  25549. this.readBlock();
  25550. }
  25551. } else {
  25552. const end = start + length;
  25553. while (this.bufferLength <= end && !this.eof) {
  25554. this.readBlock();
  25555. }
  25556. }
  25557. return new _stream.Stream(this.buffer, start, length, dict);
  25558. }
  25559. getBaseStreams() {
  25560. return this.str ? this.str.getBaseStreams() : null;
  25561. }
  25562. }
  25563. exports.DecodeStream = DecodeStream;
  25564. class StreamsSequenceStream extends DecodeStream {
  25565. constructor(streams, onError = null) {
  25566. let maybeLength = 0;
  25567. for (const stream of streams) {
  25568. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  25569. }
  25570. super(maybeLength);
  25571. this.streams = streams;
  25572. this._onError = onError;
  25573. }
  25574. readBlock() {
  25575. const streams = this.streams;
  25576. if (streams.length === 0) {
  25577. this.eof = true;
  25578. return;
  25579. }
  25580. const stream = streams.shift();
  25581. let chunk;
  25582. try {
  25583. chunk = stream.getBytes();
  25584. } catch (reason) {
  25585. if (this._onError) {
  25586. this._onError(reason, stream.dict && stream.dict.objId);
  25587. return;
  25588. }
  25589. throw reason;
  25590. }
  25591. const bufferLength = this.bufferLength;
  25592. const newLength = bufferLength + chunk.length;
  25593. const buffer = this.ensureBuffer(newLength);
  25594. buffer.set(chunk, bufferLength);
  25595. this.bufferLength = newLength;
  25596. }
  25597. getBaseStreams() {
  25598. const baseStreamsBuf = [];
  25599. for (const stream of this.streams) {
  25600. const baseStreams = stream.getBaseStreams();
  25601. if (baseStreams) {
  25602. baseStreamsBuf.push(...baseStreams);
  25603. }
  25604. }
  25605. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  25606. }
  25607. }
  25608. exports.StreamsSequenceStream = StreamsSequenceStream;
  25609. /***/ }),
  25610. /* 30 */
  25611. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25612. Object.defineProperty(exports, "__esModule", ({
  25613. value: true
  25614. }));
  25615. exports.AsciiHexStream = void 0;
  25616. var _decode_stream = __w_pdfjs_require__(29);
  25617. class AsciiHexStream extends _decode_stream.DecodeStream {
  25618. constructor(str, maybeLength) {
  25619. if (maybeLength) {
  25620. maybeLength *= 0.5;
  25621. }
  25622. super(maybeLength);
  25623. this.str = str;
  25624. this.dict = str.dict;
  25625. this.firstDigit = -1;
  25626. }
  25627. readBlock() {
  25628. const UPSTREAM_BLOCK_SIZE = 8000;
  25629. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  25630. if (!bytes.length) {
  25631. this.eof = true;
  25632. return;
  25633. }
  25634. const maxDecodeLength = bytes.length + 1 >> 1;
  25635. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  25636. let bufferLength = this.bufferLength;
  25637. let firstDigit = this.firstDigit;
  25638. for (const ch of bytes) {
  25639. let digit;
  25640. if (ch >= 0x30 && ch <= 0x39) {
  25641. digit = ch & 0x0f;
  25642. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25643. digit = (ch & 0x0f) + 9;
  25644. } else if (ch === 0x3e) {
  25645. this.eof = true;
  25646. break;
  25647. } else {
  25648. continue;
  25649. }
  25650. if (firstDigit < 0) {
  25651. firstDigit = digit;
  25652. } else {
  25653. buffer[bufferLength++] = firstDigit << 4 | digit;
  25654. firstDigit = -1;
  25655. }
  25656. }
  25657. if (firstDigit >= 0 && this.eof) {
  25658. buffer[bufferLength++] = firstDigit << 4;
  25659. firstDigit = -1;
  25660. }
  25661. this.firstDigit = firstDigit;
  25662. this.bufferLength = bufferLength;
  25663. }
  25664. }
  25665. exports.AsciiHexStream = AsciiHexStream;
  25666. /***/ }),
  25667. /* 31 */
  25668. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25669. Object.defineProperty(exports, "__esModule", ({
  25670. value: true
  25671. }));
  25672. exports.CCITTFaxStream = void 0;
  25673. var _primitives = __w_pdfjs_require__(5);
  25674. var _ccitt = __w_pdfjs_require__(32);
  25675. var _decode_stream = __w_pdfjs_require__(29);
  25676. class CCITTFaxStream extends _decode_stream.DecodeStream {
  25677. constructor(str, maybeLength, params) {
  25678. super(maybeLength);
  25679. this.str = str;
  25680. this.dict = str.dict;
  25681. if (!(0, _primitives.isDict)(params)) {
  25682. params = _primitives.Dict.empty;
  25683. }
  25684. const source = {
  25685. next() {
  25686. return str.getByte();
  25687. }
  25688. };
  25689. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  25690. K: params.get("K"),
  25691. EndOfLine: params.get("EndOfLine"),
  25692. EncodedByteAlign: params.get("EncodedByteAlign"),
  25693. Columns: params.get("Columns"),
  25694. Rows: params.get("Rows"),
  25695. EndOfBlock: params.get("EndOfBlock"),
  25696. BlackIs1: params.get("BlackIs1")
  25697. });
  25698. }
  25699. readBlock() {
  25700. while (!this.eof) {
  25701. const c = this.ccittFaxDecoder.readNextChar();
  25702. if (c === -1) {
  25703. this.eof = true;
  25704. return;
  25705. }
  25706. this.ensureBuffer(this.bufferLength + 1);
  25707. this.buffer[this.bufferLength++] = c;
  25708. }
  25709. }
  25710. }
  25711. exports.CCITTFaxStream = CCITTFaxStream;
  25712. /***/ }),
  25713. /* 32 */
  25714. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25715. Object.defineProperty(exports, "__esModule", ({
  25716. value: true
  25717. }));
  25718. exports.CCITTFaxDecoder = void 0;
  25719. var _util = __w_pdfjs_require__(2);
  25720. const ccittEOL = -2;
  25721. const ccittEOF = -1;
  25722. const twoDimPass = 0;
  25723. const twoDimHoriz = 1;
  25724. const twoDimVert0 = 2;
  25725. const twoDimVertR1 = 3;
  25726. const twoDimVertL1 = 4;
  25727. const twoDimVertR2 = 5;
  25728. const twoDimVertL2 = 6;
  25729. const twoDimVertR3 = 7;
  25730. const twoDimVertL3 = 8;
  25731. 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]];
  25732. 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]];
  25733. 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]];
  25734. 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]];
  25735. 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]];
  25736. 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]];
  25737. class CCITTFaxDecoder {
  25738. constructor(source, options = {}) {
  25739. if (!source || typeof source.next !== "function") {
  25740. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  25741. }
  25742. this.source = source;
  25743. this.eof = false;
  25744. this.encoding = options.K || 0;
  25745. this.eoline = options.EndOfLine || false;
  25746. this.byteAlign = options.EncodedByteAlign || false;
  25747. this.columns = options.Columns || 1728;
  25748. this.rows = options.Rows || 0;
  25749. let eoblock = options.EndOfBlock;
  25750. if (eoblock === null || eoblock === undefined) {
  25751. eoblock = true;
  25752. }
  25753. this.eoblock = eoblock;
  25754. this.black = options.BlackIs1 || false;
  25755. this.codingLine = new Uint32Array(this.columns + 1);
  25756. this.refLine = new Uint32Array(this.columns + 2);
  25757. this.codingLine[0] = this.columns;
  25758. this.codingPos = 0;
  25759. this.row = 0;
  25760. this.nextLine2D = this.encoding < 0;
  25761. this.inputBits = 0;
  25762. this.inputBuf = 0;
  25763. this.outputBits = 0;
  25764. this.rowsDone = false;
  25765. let code1;
  25766. while ((code1 = this._lookBits(12)) === 0) {
  25767. this._eatBits(1);
  25768. }
  25769. if (code1 === 1) {
  25770. this._eatBits(12);
  25771. }
  25772. if (this.encoding > 0) {
  25773. this.nextLine2D = !this._lookBits(1);
  25774. this._eatBits(1);
  25775. }
  25776. }
  25777. readNextChar() {
  25778. if (this.eof) {
  25779. return -1;
  25780. }
  25781. const refLine = this.refLine;
  25782. const codingLine = this.codingLine;
  25783. const columns = this.columns;
  25784. let refPos, blackPixels, bits, i;
  25785. if (this.outputBits === 0) {
  25786. if (this.rowsDone) {
  25787. this.eof = true;
  25788. }
  25789. if (this.eof) {
  25790. return -1;
  25791. }
  25792. this.err = false;
  25793. let code1, code2, code3;
  25794. if (this.nextLine2D) {
  25795. for (i = 0; codingLine[i] < columns; ++i) {
  25796. refLine[i] = codingLine[i];
  25797. }
  25798. refLine[i++] = columns;
  25799. refLine[i] = columns;
  25800. codingLine[0] = 0;
  25801. this.codingPos = 0;
  25802. refPos = 0;
  25803. blackPixels = 0;
  25804. while (codingLine[this.codingPos] < columns) {
  25805. code1 = this._getTwoDimCode();
  25806. switch (code1) {
  25807. case twoDimPass:
  25808. this._addPixels(refLine[refPos + 1], blackPixels);
  25809. if (refLine[refPos + 1] < columns) {
  25810. refPos += 2;
  25811. }
  25812. break;
  25813. case twoDimHoriz:
  25814. code1 = code2 = 0;
  25815. if (blackPixels) {
  25816. do {
  25817. code1 += code3 = this._getBlackCode();
  25818. } while (code3 >= 64);
  25819. do {
  25820. code2 += code3 = this._getWhiteCode();
  25821. } while (code3 >= 64);
  25822. } else {
  25823. do {
  25824. code1 += code3 = this._getWhiteCode();
  25825. } while (code3 >= 64);
  25826. do {
  25827. code2 += code3 = this._getBlackCode();
  25828. } while (code3 >= 64);
  25829. }
  25830. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  25831. if (codingLine[this.codingPos] < columns) {
  25832. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  25833. }
  25834. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25835. refPos += 2;
  25836. }
  25837. break;
  25838. case twoDimVertR3:
  25839. this._addPixels(refLine[refPos] + 3, blackPixels);
  25840. blackPixels ^= 1;
  25841. if (codingLine[this.codingPos] < columns) {
  25842. ++refPos;
  25843. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25844. refPos += 2;
  25845. }
  25846. }
  25847. break;
  25848. case twoDimVertR2:
  25849. this._addPixels(refLine[refPos] + 2, blackPixels);
  25850. blackPixels ^= 1;
  25851. if (codingLine[this.codingPos] < columns) {
  25852. ++refPos;
  25853. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25854. refPos += 2;
  25855. }
  25856. }
  25857. break;
  25858. case twoDimVertR1:
  25859. this._addPixels(refLine[refPos] + 1, blackPixels);
  25860. blackPixels ^= 1;
  25861. if (codingLine[this.codingPos] < columns) {
  25862. ++refPos;
  25863. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25864. refPos += 2;
  25865. }
  25866. }
  25867. break;
  25868. case twoDimVert0:
  25869. this._addPixels(refLine[refPos], blackPixels);
  25870. blackPixels ^= 1;
  25871. if (codingLine[this.codingPos] < columns) {
  25872. ++refPos;
  25873. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25874. refPos += 2;
  25875. }
  25876. }
  25877. break;
  25878. case twoDimVertL3:
  25879. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  25880. blackPixels ^= 1;
  25881. if (codingLine[this.codingPos] < columns) {
  25882. if (refPos > 0) {
  25883. --refPos;
  25884. } else {
  25885. ++refPos;
  25886. }
  25887. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25888. refPos += 2;
  25889. }
  25890. }
  25891. break;
  25892. case twoDimVertL2:
  25893. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  25894. blackPixels ^= 1;
  25895. if (codingLine[this.codingPos] < columns) {
  25896. if (refPos > 0) {
  25897. --refPos;
  25898. } else {
  25899. ++refPos;
  25900. }
  25901. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25902. refPos += 2;
  25903. }
  25904. }
  25905. break;
  25906. case twoDimVertL1:
  25907. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  25908. blackPixels ^= 1;
  25909. if (codingLine[this.codingPos] < columns) {
  25910. if (refPos > 0) {
  25911. --refPos;
  25912. } else {
  25913. ++refPos;
  25914. }
  25915. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25916. refPos += 2;
  25917. }
  25918. }
  25919. break;
  25920. case ccittEOF:
  25921. this._addPixels(columns, 0);
  25922. this.eof = true;
  25923. break;
  25924. default:
  25925. (0, _util.info)("bad 2d code");
  25926. this._addPixels(columns, 0);
  25927. this.err = true;
  25928. }
  25929. }
  25930. } else {
  25931. codingLine[0] = 0;
  25932. this.codingPos = 0;
  25933. blackPixels = 0;
  25934. while (codingLine[this.codingPos] < columns) {
  25935. code1 = 0;
  25936. if (blackPixels) {
  25937. do {
  25938. code1 += code3 = this._getBlackCode();
  25939. } while (code3 >= 64);
  25940. } else {
  25941. do {
  25942. code1 += code3 = this._getWhiteCode();
  25943. } while (code3 >= 64);
  25944. }
  25945. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  25946. blackPixels ^= 1;
  25947. }
  25948. }
  25949. let gotEOL = false;
  25950. if (this.byteAlign) {
  25951. this.inputBits &= ~7;
  25952. }
  25953. if (!this.eoblock && this.row === this.rows - 1) {
  25954. this.rowsDone = true;
  25955. } else {
  25956. code1 = this._lookBits(12);
  25957. if (this.eoline) {
  25958. while (code1 !== ccittEOF && code1 !== 1) {
  25959. this._eatBits(1);
  25960. code1 = this._lookBits(12);
  25961. }
  25962. } else {
  25963. while (code1 === 0) {
  25964. this._eatBits(1);
  25965. code1 = this._lookBits(12);
  25966. }
  25967. }
  25968. if (code1 === 1) {
  25969. this._eatBits(12);
  25970. gotEOL = true;
  25971. } else if (code1 === ccittEOF) {
  25972. this.eof = true;
  25973. }
  25974. }
  25975. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  25976. this.nextLine2D = !this._lookBits(1);
  25977. this._eatBits(1);
  25978. }
  25979. if (this.eoblock && gotEOL && this.byteAlign) {
  25980. code1 = this._lookBits(12);
  25981. if (code1 === 1) {
  25982. this._eatBits(12);
  25983. if (this.encoding > 0) {
  25984. this._lookBits(1);
  25985. this._eatBits(1);
  25986. }
  25987. if (this.encoding >= 0) {
  25988. for (i = 0; i < 4; ++i) {
  25989. code1 = this._lookBits(12);
  25990. if (code1 !== 1) {
  25991. (0, _util.info)("bad rtc code: " + code1);
  25992. }
  25993. this._eatBits(12);
  25994. if (this.encoding > 0) {
  25995. this._lookBits(1);
  25996. this._eatBits(1);
  25997. }
  25998. }
  25999. }
  26000. this.eof = true;
  26001. }
  26002. } else if (this.err && this.eoline) {
  26003. while (true) {
  26004. code1 = this._lookBits(13);
  26005. if (code1 === ccittEOF) {
  26006. this.eof = true;
  26007. return -1;
  26008. }
  26009. if (code1 >> 1 === 1) {
  26010. break;
  26011. }
  26012. this._eatBits(1);
  26013. }
  26014. this._eatBits(12);
  26015. if (this.encoding > 0) {
  26016. this._eatBits(1);
  26017. this.nextLine2D = !(code1 & 1);
  26018. }
  26019. }
  26020. if (codingLine[0] > 0) {
  26021. this.outputBits = codingLine[this.codingPos = 0];
  26022. } else {
  26023. this.outputBits = codingLine[this.codingPos = 1];
  26024. }
  26025. this.row++;
  26026. }
  26027. let c;
  26028. if (this.outputBits >= 8) {
  26029. c = this.codingPos & 1 ? 0 : 0xff;
  26030. this.outputBits -= 8;
  26031. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  26032. this.codingPos++;
  26033. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26034. }
  26035. } else {
  26036. bits = 8;
  26037. c = 0;
  26038. do {
  26039. if (typeof this.outputBits !== "number") {
  26040. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  26041. }
  26042. if (this.outputBits > bits) {
  26043. c <<= bits;
  26044. if (!(this.codingPos & 1)) {
  26045. c |= 0xff >> 8 - bits;
  26046. }
  26047. this.outputBits -= bits;
  26048. bits = 0;
  26049. } else {
  26050. c <<= this.outputBits;
  26051. if (!(this.codingPos & 1)) {
  26052. c |= 0xff >> 8 - this.outputBits;
  26053. }
  26054. bits -= this.outputBits;
  26055. this.outputBits = 0;
  26056. if (codingLine[this.codingPos] < columns) {
  26057. this.codingPos++;
  26058. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26059. } else if (bits > 0) {
  26060. c <<= bits;
  26061. bits = 0;
  26062. }
  26063. }
  26064. } while (bits);
  26065. }
  26066. if (this.black) {
  26067. c ^= 0xff;
  26068. }
  26069. return c;
  26070. }
  26071. _addPixels(a1, blackPixels) {
  26072. const codingLine = this.codingLine;
  26073. let codingPos = this.codingPos;
  26074. if (a1 > codingLine[codingPos]) {
  26075. if (a1 > this.columns) {
  26076. (0, _util.info)("row is wrong length");
  26077. this.err = true;
  26078. a1 = this.columns;
  26079. }
  26080. if (codingPos & 1 ^ blackPixels) {
  26081. ++codingPos;
  26082. }
  26083. codingLine[codingPos] = a1;
  26084. }
  26085. this.codingPos = codingPos;
  26086. }
  26087. _addPixelsNeg(a1, blackPixels) {
  26088. const codingLine = this.codingLine;
  26089. let codingPos = this.codingPos;
  26090. if (a1 > codingLine[codingPos]) {
  26091. if (a1 > this.columns) {
  26092. (0, _util.info)("row is wrong length");
  26093. this.err = true;
  26094. a1 = this.columns;
  26095. }
  26096. if (codingPos & 1 ^ blackPixels) {
  26097. ++codingPos;
  26098. }
  26099. codingLine[codingPos] = a1;
  26100. } else if (a1 < codingLine[codingPos]) {
  26101. if (a1 < 0) {
  26102. (0, _util.info)("invalid code");
  26103. this.err = true;
  26104. a1 = 0;
  26105. }
  26106. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  26107. --codingPos;
  26108. }
  26109. codingLine[codingPos] = a1;
  26110. }
  26111. this.codingPos = codingPos;
  26112. }
  26113. _findTableCode(start, end, table, limit) {
  26114. const limitValue = limit || 0;
  26115. for (let i = start; i <= end; ++i) {
  26116. let code = this._lookBits(i);
  26117. if (code === ccittEOF) {
  26118. return [true, 1, false];
  26119. }
  26120. if (i < end) {
  26121. code <<= end - i;
  26122. }
  26123. if (!limitValue || code >= limitValue) {
  26124. const p = table[code - limitValue];
  26125. if (p[0] === i) {
  26126. this._eatBits(i);
  26127. return [true, p[1], true];
  26128. }
  26129. }
  26130. }
  26131. return [false, 0, false];
  26132. }
  26133. _getTwoDimCode() {
  26134. let code = 0;
  26135. let p;
  26136. if (this.eoblock) {
  26137. code = this._lookBits(7);
  26138. p = twoDimTable[code];
  26139. if (p && p[0] > 0) {
  26140. this._eatBits(p[0]);
  26141. return p[1];
  26142. }
  26143. } else {
  26144. const result = this._findTableCode(1, 7, twoDimTable);
  26145. if (result[0] && result[2]) {
  26146. return result[1];
  26147. }
  26148. }
  26149. (0, _util.info)("Bad two dim code");
  26150. return ccittEOF;
  26151. }
  26152. _getWhiteCode() {
  26153. let code = 0;
  26154. let p;
  26155. if (this.eoblock) {
  26156. code = this._lookBits(12);
  26157. if (code === ccittEOF) {
  26158. return 1;
  26159. }
  26160. if (code >> 5 === 0) {
  26161. p = whiteTable1[code];
  26162. } else {
  26163. p = whiteTable2[code >> 3];
  26164. }
  26165. if (p[0] > 0) {
  26166. this._eatBits(p[0]);
  26167. return p[1];
  26168. }
  26169. } else {
  26170. let result = this._findTableCode(1, 9, whiteTable2);
  26171. if (result[0]) {
  26172. return result[1];
  26173. }
  26174. result = this._findTableCode(11, 12, whiteTable1);
  26175. if (result[0]) {
  26176. return result[1];
  26177. }
  26178. }
  26179. (0, _util.info)("bad white code");
  26180. this._eatBits(1);
  26181. return 1;
  26182. }
  26183. _getBlackCode() {
  26184. let code, p;
  26185. if (this.eoblock) {
  26186. code = this._lookBits(13);
  26187. if (code === ccittEOF) {
  26188. return 1;
  26189. }
  26190. if (code >> 7 === 0) {
  26191. p = blackTable1[code];
  26192. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  26193. p = blackTable2[(code >> 1) - 64];
  26194. } else {
  26195. p = blackTable3[code >> 7];
  26196. }
  26197. if (p[0] > 0) {
  26198. this._eatBits(p[0]);
  26199. return p[1];
  26200. }
  26201. } else {
  26202. let result = this._findTableCode(2, 6, blackTable3);
  26203. if (result[0]) {
  26204. return result[1];
  26205. }
  26206. result = this._findTableCode(7, 12, blackTable2, 64);
  26207. if (result[0]) {
  26208. return result[1];
  26209. }
  26210. result = this._findTableCode(10, 13, blackTable1);
  26211. if (result[0]) {
  26212. return result[1];
  26213. }
  26214. }
  26215. (0, _util.info)("bad black code");
  26216. this._eatBits(1);
  26217. return 1;
  26218. }
  26219. _lookBits(n) {
  26220. let c;
  26221. while (this.inputBits < n) {
  26222. if ((c = this.source.next()) === -1) {
  26223. if (this.inputBits === 0) {
  26224. return ccittEOF;
  26225. }
  26226. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  26227. }
  26228. this.inputBuf = this.inputBuf << 8 | c;
  26229. this.inputBits += 8;
  26230. }
  26231. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  26232. }
  26233. _eatBits(n) {
  26234. if ((this.inputBits -= n) < 0) {
  26235. this.inputBits = 0;
  26236. }
  26237. }
  26238. }
  26239. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  26240. /***/ }),
  26241. /* 33 */
  26242. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26243. Object.defineProperty(exports, "__esModule", ({
  26244. value: true
  26245. }));
  26246. exports.FlateStream = void 0;
  26247. var _decode_stream = __w_pdfjs_require__(29);
  26248. var _util = __w_pdfjs_require__(2);
  26249. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  26250. 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]);
  26251. 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]);
  26252. 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];
  26253. 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];
  26254. class FlateStream extends _decode_stream.DecodeStream {
  26255. constructor(str, maybeLength) {
  26256. super(maybeLength);
  26257. this.str = str;
  26258. this.dict = str.dict;
  26259. const cmf = str.getByte();
  26260. const flg = str.getByte();
  26261. if (cmf === -1 || flg === -1) {
  26262. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  26263. }
  26264. if ((cmf & 0x0f) !== 0x08) {
  26265. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  26266. }
  26267. if (((cmf << 8) + flg) % 31 !== 0) {
  26268. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  26269. }
  26270. if (flg & 0x20) {
  26271. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  26272. }
  26273. this.codeSize = 0;
  26274. this.codeBuf = 0;
  26275. }
  26276. getBits(bits) {
  26277. const str = this.str;
  26278. let codeSize = this.codeSize;
  26279. let codeBuf = this.codeBuf;
  26280. let b;
  26281. while (codeSize < bits) {
  26282. if ((b = str.getByte()) === -1) {
  26283. throw new _util.FormatError("Bad encoding in flate stream");
  26284. }
  26285. codeBuf |= b << codeSize;
  26286. codeSize += 8;
  26287. }
  26288. b = codeBuf & (1 << bits) - 1;
  26289. this.codeBuf = codeBuf >> bits;
  26290. this.codeSize = codeSize -= bits;
  26291. return b;
  26292. }
  26293. getCode(table) {
  26294. const str = this.str;
  26295. const codes = table[0];
  26296. const maxLen = table[1];
  26297. let codeSize = this.codeSize;
  26298. let codeBuf = this.codeBuf;
  26299. let b;
  26300. while (codeSize < maxLen) {
  26301. if ((b = str.getByte()) === -1) {
  26302. break;
  26303. }
  26304. codeBuf |= b << codeSize;
  26305. codeSize += 8;
  26306. }
  26307. const code = codes[codeBuf & (1 << maxLen) - 1];
  26308. const codeLen = code >> 16;
  26309. const codeVal = code & 0xffff;
  26310. if (codeLen < 1 || codeSize < codeLen) {
  26311. throw new _util.FormatError("Bad encoding in flate stream");
  26312. }
  26313. this.codeBuf = codeBuf >> codeLen;
  26314. this.codeSize = codeSize - codeLen;
  26315. return codeVal;
  26316. }
  26317. generateHuffmanTable(lengths) {
  26318. const n = lengths.length;
  26319. let maxLen = 0;
  26320. let i;
  26321. for (i = 0; i < n; ++i) {
  26322. if (lengths[i] > maxLen) {
  26323. maxLen = lengths[i];
  26324. }
  26325. }
  26326. const size = 1 << maxLen;
  26327. const codes = new Int32Array(size);
  26328. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  26329. for (let val = 0; val < n; ++val) {
  26330. if (lengths[val] === len) {
  26331. let code2 = 0;
  26332. let t = code;
  26333. for (i = 0; i < len; ++i) {
  26334. code2 = code2 << 1 | t & 1;
  26335. t >>= 1;
  26336. }
  26337. for (i = code2; i < size; i += skip) {
  26338. codes[i] = len << 16 | val;
  26339. }
  26340. ++code;
  26341. }
  26342. }
  26343. }
  26344. return [codes, maxLen];
  26345. }
  26346. readBlock() {
  26347. let buffer, len;
  26348. const str = this.str;
  26349. let hdr = this.getBits(3);
  26350. if (hdr & 1) {
  26351. this.eof = true;
  26352. }
  26353. hdr >>= 1;
  26354. if (hdr === 0) {
  26355. let b;
  26356. if ((b = str.getByte()) === -1) {
  26357. throw new _util.FormatError("Bad block header in flate stream");
  26358. }
  26359. let blockLen = b;
  26360. if ((b = str.getByte()) === -1) {
  26361. throw new _util.FormatError("Bad block header in flate stream");
  26362. }
  26363. blockLen |= b << 8;
  26364. if ((b = str.getByte()) === -1) {
  26365. throw new _util.FormatError("Bad block header in flate stream");
  26366. }
  26367. let check = b;
  26368. if ((b = str.getByte()) === -1) {
  26369. throw new _util.FormatError("Bad block header in flate stream");
  26370. }
  26371. check |= b << 8;
  26372. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  26373. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  26374. }
  26375. this.codeBuf = 0;
  26376. this.codeSize = 0;
  26377. const bufferLength = this.bufferLength,
  26378. end = bufferLength + blockLen;
  26379. buffer = this.ensureBuffer(end);
  26380. this.bufferLength = end;
  26381. if (blockLen === 0) {
  26382. if (str.peekByte() === -1) {
  26383. this.eof = true;
  26384. }
  26385. } else {
  26386. const block = str.getBytes(blockLen);
  26387. buffer.set(block, bufferLength);
  26388. if (block.length < blockLen) {
  26389. this.eof = true;
  26390. }
  26391. }
  26392. return;
  26393. }
  26394. let litCodeTable;
  26395. let distCodeTable;
  26396. if (hdr === 1) {
  26397. litCodeTable = fixedLitCodeTab;
  26398. distCodeTable = fixedDistCodeTab;
  26399. } else if (hdr === 2) {
  26400. const numLitCodes = this.getBits(5) + 257;
  26401. const numDistCodes = this.getBits(5) + 1;
  26402. const numCodeLenCodes = this.getBits(4) + 4;
  26403. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  26404. let i;
  26405. for (i = 0; i < numCodeLenCodes; ++i) {
  26406. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  26407. }
  26408. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  26409. len = 0;
  26410. i = 0;
  26411. const codes = numLitCodes + numDistCodes;
  26412. const codeLengths = new Uint8Array(codes);
  26413. let bitsLength, bitsOffset, what;
  26414. while (i < codes) {
  26415. const code = this.getCode(codeLenCodeTab);
  26416. if (code === 16) {
  26417. bitsLength = 2;
  26418. bitsOffset = 3;
  26419. what = len;
  26420. } else if (code === 17) {
  26421. bitsLength = 3;
  26422. bitsOffset = 3;
  26423. what = len = 0;
  26424. } else if (code === 18) {
  26425. bitsLength = 7;
  26426. bitsOffset = 11;
  26427. what = len = 0;
  26428. } else {
  26429. codeLengths[i++] = len = code;
  26430. continue;
  26431. }
  26432. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  26433. while (repeatLength-- > 0) {
  26434. codeLengths[i++] = what;
  26435. }
  26436. }
  26437. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  26438. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  26439. } else {
  26440. throw new _util.FormatError("Unknown block type in flate stream");
  26441. }
  26442. buffer = this.buffer;
  26443. let limit = buffer ? buffer.length : 0;
  26444. let pos = this.bufferLength;
  26445. while (true) {
  26446. let code1 = this.getCode(litCodeTable);
  26447. if (code1 < 256) {
  26448. if (pos + 1 >= limit) {
  26449. buffer = this.ensureBuffer(pos + 1);
  26450. limit = buffer.length;
  26451. }
  26452. buffer[pos++] = code1;
  26453. continue;
  26454. }
  26455. if (code1 === 256) {
  26456. this.bufferLength = pos;
  26457. return;
  26458. }
  26459. code1 -= 257;
  26460. code1 = lengthDecode[code1];
  26461. let code2 = code1 >> 16;
  26462. if (code2 > 0) {
  26463. code2 = this.getBits(code2);
  26464. }
  26465. len = (code1 & 0xffff) + code2;
  26466. code1 = this.getCode(distCodeTable);
  26467. code1 = distDecode[code1];
  26468. code2 = code1 >> 16;
  26469. if (code2 > 0) {
  26470. code2 = this.getBits(code2);
  26471. }
  26472. const dist = (code1 & 0xffff) + code2;
  26473. if (pos + len >= limit) {
  26474. buffer = this.ensureBuffer(pos + len);
  26475. limit = buffer.length;
  26476. }
  26477. for (let k = 0; k < len; ++k, ++pos) {
  26478. buffer[pos] = buffer[pos - dist];
  26479. }
  26480. }
  26481. }
  26482. }
  26483. exports.FlateStream = FlateStream;
  26484. /***/ }),
  26485. /* 34 */
  26486. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26487. Object.defineProperty(exports, "__esModule", ({
  26488. value: true
  26489. }));
  26490. exports.Jbig2Stream = void 0;
  26491. var _primitives = __w_pdfjs_require__(5);
  26492. var _decode_stream = __w_pdfjs_require__(29);
  26493. var _jbig = __w_pdfjs_require__(35);
  26494. var _util = __w_pdfjs_require__(2);
  26495. class Jbig2Stream extends _decode_stream.DecodeStream {
  26496. constructor(stream, maybeLength, params) {
  26497. super(maybeLength);
  26498. this.stream = stream;
  26499. this.dict = stream.dict;
  26500. this.maybeLength = maybeLength;
  26501. this.params = params;
  26502. }
  26503. get bytes() {
  26504. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  26505. }
  26506. ensureBuffer(requested) {}
  26507. readBlock() {
  26508. if (this.eof) {
  26509. return;
  26510. }
  26511. const jbig2Image = new _jbig.Jbig2Image();
  26512. const chunks = [];
  26513. if ((0, _primitives.isDict)(this.params)) {
  26514. const globalsStream = this.params.get("JBIG2Globals");
  26515. if ((0, _primitives.isStream)(globalsStream)) {
  26516. const globals = globalsStream.getBytes();
  26517. chunks.push({
  26518. data: globals,
  26519. start: 0,
  26520. end: globals.length
  26521. });
  26522. }
  26523. }
  26524. chunks.push({
  26525. data: this.bytes,
  26526. start: 0,
  26527. end: this.bytes.length
  26528. });
  26529. const data = jbig2Image.parseChunks(chunks);
  26530. const dataLength = data.length;
  26531. for (let i = 0; i < dataLength; i++) {
  26532. data[i] ^= 0xff;
  26533. }
  26534. this.buffer = data;
  26535. this.bufferLength = dataLength;
  26536. this.eof = true;
  26537. }
  26538. }
  26539. exports.Jbig2Stream = Jbig2Stream;
  26540. /***/ }),
  26541. /* 35 */
  26542. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26543. Object.defineProperty(exports, "__esModule", ({
  26544. value: true
  26545. }));
  26546. exports.Jbig2Image = void 0;
  26547. var _util = __w_pdfjs_require__(2);
  26548. var _core_utils = __w_pdfjs_require__(9);
  26549. var _arithmetic_decoder = __w_pdfjs_require__(36);
  26550. var _ccitt = __w_pdfjs_require__(32);
  26551. class Jbig2Error extends _util.BaseException {
  26552. constructor(msg) {
  26553. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  26554. }
  26555. }
  26556. class ContextCache {
  26557. getContexts(id) {
  26558. if (id in this) {
  26559. return this[id];
  26560. }
  26561. return this[id] = new Int8Array(1 << 16);
  26562. }
  26563. }
  26564. class DecodingContext {
  26565. constructor(data, start, end) {
  26566. this.data = data;
  26567. this.start = start;
  26568. this.end = end;
  26569. }
  26570. get decoder() {
  26571. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  26572. return (0, _util.shadow)(this, "decoder", decoder);
  26573. }
  26574. get contextCache() {
  26575. const cache = new ContextCache();
  26576. return (0, _util.shadow)(this, "contextCache", cache);
  26577. }
  26578. }
  26579. function decodeInteger(contextCache, procedure, decoder) {
  26580. const contexts = contextCache.getContexts(procedure);
  26581. let prev = 1;
  26582. function readBits(length) {
  26583. let v = 0;
  26584. for (let i = 0; i < length; i++) {
  26585. const bit = decoder.readBit(contexts, prev);
  26586. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  26587. v = v << 1 | bit;
  26588. }
  26589. return v >>> 0;
  26590. }
  26591. const sign = readBits(1);
  26592. 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);
  26593. if (sign === 0) {
  26594. return value;
  26595. } else if (value > 0) {
  26596. return -value;
  26597. }
  26598. return null;
  26599. }
  26600. function decodeIAID(contextCache, decoder, codeLength) {
  26601. const contexts = contextCache.getContexts("IAID");
  26602. let prev = 1;
  26603. for (let i = 0; i < codeLength; i++) {
  26604. const bit = decoder.readBit(contexts, prev);
  26605. prev = prev << 1 | bit;
  26606. }
  26607. if (codeLength < 31) {
  26608. return prev & (1 << codeLength) - 1;
  26609. }
  26610. return prev & 0x7fffffff;
  26611. }
  26612. 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"];
  26613. const CodingTemplates = [[{
  26614. x: -1,
  26615. y: -2
  26616. }, {
  26617. x: 0,
  26618. y: -2
  26619. }, {
  26620. x: 1,
  26621. y: -2
  26622. }, {
  26623. x: -2,
  26624. y: -1
  26625. }, {
  26626. x: -1,
  26627. y: -1
  26628. }, {
  26629. x: 0,
  26630. y: -1
  26631. }, {
  26632. x: 1,
  26633. y: -1
  26634. }, {
  26635. x: 2,
  26636. y: -1
  26637. }, {
  26638. x: -4,
  26639. y: 0
  26640. }, {
  26641. x: -3,
  26642. y: 0
  26643. }, {
  26644. x: -2,
  26645. y: 0
  26646. }, {
  26647. x: -1,
  26648. y: 0
  26649. }], [{
  26650. x: -1,
  26651. y: -2
  26652. }, {
  26653. x: 0,
  26654. y: -2
  26655. }, {
  26656. x: 1,
  26657. y: -2
  26658. }, {
  26659. x: 2,
  26660. y: -2
  26661. }, {
  26662. x: -2,
  26663. y: -1
  26664. }, {
  26665. x: -1,
  26666. y: -1
  26667. }, {
  26668. x: 0,
  26669. y: -1
  26670. }, {
  26671. x: 1,
  26672. y: -1
  26673. }, {
  26674. x: 2,
  26675. y: -1
  26676. }, {
  26677. x: -3,
  26678. y: 0
  26679. }, {
  26680. x: -2,
  26681. y: 0
  26682. }, {
  26683. x: -1,
  26684. y: 0
  26685. }], [{
  26686. x: -1,
  26687. y: -2
  26688. }, {
  26689. x: 0,
  26690. y: -2
  26691. }, {
  26692. x: 1,
  26693. y: -2
  26694. }, {
  26695. x: -2,
  26696. y: -1
  26697. }, {
  26698. x: -1,
  26699. y: -1
  26700. }, {
  26701. x: 0,
  26702. y: -1
  26703. }, {
  26704. x: 1,
  26705. y: -1
  26706. }, {
  26707. x: -2,
  26708. y: 0
  26709. }, {
  26710. x: -1,
  26711. y: 0
  26712. }], [{
  26713. x: -3,
  26714. y: -1
  26715. }, {
  26716. x: -2,
  26717. y: -1
  26718. }, {
  26719. x: -1,
  26720. y: -1
  26721. }, {
  26722. x: 0,
  26723. y: -1
  26724. }, {
  26725. x: 1,
  26726. y: -1
  26727. }, {
  26728. x: -4,
  26729. y: 0
  26730. }, {
  26731. x: -3,
  26732. y: 0
  26733. }, {
  26734. x: -2,
  26735. y: 0
  26736. }, {
  26737. x: -1,
  26738. y: 0
  26739. }]];
  26740. const RefinementTemplates = [{
  26741. coding: [{
  26742. x: 0,
  26743. y: -1
  26744. }, {
  26745. x: 1,
  26746. y: -1
  26747. }, {
  26748. x: -1,
  26749. y: 0
  26750. }],
  26751. reference: [{
  26752. x: 0,
  26753. y: -1
  26754. }, {
  26755. x: 1,
  26756. y: -1
  26757. }, {
  26758. x: -1,
  26759. y: 0
  26760. }, {
  26761. x: 0,
  26762. y: 0
  26763. }, {
  26764. x: 1,
  26765. y: 0
  26766. }, {
  26767. x: -1,
  26768. y: 1
  26769. }, {
  26770. x: 0,
  26771. y: 1
  26772. }, {
  26773. x: 1,
  26774. y: 1
  26775. }]
  26776. }, {
  26777. coding: [{
  26778. x: -1,
  26779. y: -1
  26780. }, {
  26781. x: 0,
  26782. y: -1
  26783. }, {
  26784. x: 1,
  26785. y: -1
  26786. }, {
  26787. x: -1,
  26788. y: 0
  26789. }],
  26790. reference: [{
  26791. x: 0,
  26792. y: -1
  26793. }, {
  26794. x: -1,
  26795. y: 0
  26796. }, {
  26797. x: 0,
  26798. y: 0
  26799. }, {
  26800. x: 1,
  26801. y: 0
  26802. }, {
  26803. x: 0,
  26804. y: 1
  26805. }, {
  26806. x: 1,
  26807. y: 1
  26808. }]
  26809. }];
  26810. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  26811. const RefinementReusedContexts = [0x0020, 0x0008];
  26812. function decodeBitmapTemplate0(width, height, decodingContext) {
  26813. const decoder = decodingContext.decoder;
  26814. const contexts = decodingContext.contextCache.getContexts("GB");
  26815. const bitmap = [];
  26816. let contextLabel, i, j, pixel, row, row1, row2;
  26817. const OLD_PIXEL_MASK = 0x7bf7;
  26818. for (i = 0; i < height; i++) {
  26819. row = bitmap[i] = new Uint8Array(width);
  26820. row1 = i < 1 ? row : bitmap[i - 1];
  26821. row2 = i < 2 ? row : bitmap[i - 2];
  26822. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  26823. for (j = 0; j < width; j++) {
  26824. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  26825. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  26826. }
  26827. }
  26828. return bitmap;
  26829. }
  26830. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  26831. if (mmr) {
  26832. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  26833. return decodeMMRBitmap(input, width, height, false);
  26834. }
  26835. 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) {
  26836. return decodeBitmapTemplate0(width, height, decodingContext);
  26837. }
  26838. const useskip = !!skip;
  26839. const template = CodingTemplates[templateIndex].concat(at);
  26840. template.sort(function (a, b) {
  26841. return a.y - b.y || a.x - b.x;
  26842. });
  26843. const templateLength = template.length;
  26844. const templateX = new Int8Array(templateLength);
  26845. const templateY = new Int8Array(templateLength);
  26846. const changingTemplateEntries = [];
  26847. let reuseMask = 0,
  26848. minX = 0,
  26849. maxX = 0,
  26850. minY = 0;
  26851. let c, k;
  26852. for (k = 0; k < templateLength; k++) {
  26853. templateX[k] = template[k].x;
  26854. templateY[k] = template[k].y;
  26855. minX = Math.min(minX, template[k].x);
  26856. maxX = Math.max(maxX, template[k].x);
  26857. minY = Math.min(minY, template[k].y);
  26858. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  26859. reuseMask |= 1 << templateLength - 1 - k;
  26860. } else {
  26861. changingTemplateEntries.push(k);
  26862. }
  26863. }
  26864. const changingEntriesLength = changingTemplateEntries.length;
  26865. const changingTemplateX = new Int8Array(changingEntriesLength);
  26866. const changingTemplateY = new Int8Array(changingEntriesLength);
  26867. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  26868. for (c = 0; c < changingEntriesLength; c++) {
  26869. k = changingTemplateEntries[c];
  26870. changingTemplateX[c] = template[k].x;
  26871. changingTemplateY[c] = template[k].y;
  26872. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  26873. }
  26874. const sbb_left = -minX;
  26875. const sbb_top = -minY;
  26876. const sbb_right = width - maxX;
  26877. const pseudoPixelContext = ReusedContexts[templateIndex];
  26878. let row = new Uint8Array(width);
  26879. const bitmap = [];
  26880. const decoder = decodingContext.decoder;
  26881. const contexts = decodingContext.contextCache.getContexts("GB");
  26882. let ltp = 0,
  26883. j,
  26884. i0,
  26885. j0,
  26886. contextLabel = 0,
  26887. bit,
  26888. shift;
  26889. for (let i = 0; i < height; i++) {
  26890. if (prediction) {
  26891. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  26892. ltp ^= sltp;
  26893. if (ltp) {
  26894. bitmap.push(row);
  26895. continue;
  26896. }
  26897. }
  26898. row = new Uint8Array(row);
  26899. bitmap.push(row);
  26900. for (j = 0; j < width; j++) {
  26901. if (useskip && skip[i][j]) {
  26902. row[j] = 0;
  26903. continue;
  26904. }
  26905. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  26906. contextLabel = contextLabel << 1 & reuseMask;
  26907. for (k = 0; k < changingEntriesLength; k++) {
  26908. i0 = i + changingTemplateY[k];
  26909. j0 = j + changingTemplateX[k];
  26910. bit = bitmap[i0][j0];
  26911. if (bit) {
  26912. bit = changingTemplateBit[k];
  26913. contextLabel |= bit;
  26914. }
  26915. }
  26916. } else {
  26917. contextLabel = 0;
  26918. shift = templateLength - 1;
  26919. for (k = 0; k < templateLength; k++, shift--) {
  26920. j0 = j + templateX[k];
  26921. if (j0 >= 0 && j0 < width) {
  26922. i0 = i + templateY[k];
  26923. if (i0 >= 0) {
  26924. bit = bitmap[i0][j0];
  26925. if (bit) {
  26926. contextLabel |= bit << shift;
  26927. }
  26928. }
  26929. }
  26930. }
  26931. }
  26932. const pixel = decoder.readBit(contexts, contextLabel);
  26933. row[j] = pixel;
  26934. }
  26935. }
  26936. return bitmap;
  26937. }
  26938. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  26939. let codingTemplate = RefinementTemplates[templateIndex].coding;
  26940. if (templateIndex === 0) {
  26941. codingTemplate = codingTemplate.concat([at[0]]);
  26942. }
  26943. const codingTemplateLength = codingTemplate.length;
  26944. const codingTemplateX = new Int32Array(codingTemplateLength);
  26945. const codingTemplateY = new Int32Array(codingTemplateLength);
  26946. let k;
  26947. for (k = 0; k < codingTemplateLength; k++) {
  26948. codingTemplateX[k] = codingTemplate[k].x;
  26949. codingTemplateY[k] = codingTemplate[k].y;
  26950. }
  26951. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  26952. if (templateIndex === 0) {
  26953. referenceTemplate = referenceTemplate.concat([at[1]]);
  26954. }
  26955. const referenceTemplateLength = referenceTemplate.length;
  26956. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  26957. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  26958. for (k = 0; k < referenceTemplateLength; k++) {
  26959. referenceTemplateX[k] = referenceTemplate[k].x;
  26960. referenceTemplateY[k] = referenceTemplate[k].y;
  26961. }
  26962. const referenceWidth = referenceBitmap[0].length;
  26963. const referenceHeight = referenceBitmap.length;
  26964. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  26965. const bitmap = [];
  26966. const decoder = decodingContext.decoder;
  26967. const contexts = decodingContext.contextCache.getContexts("GR");
  26968. let ltp = 0;
  26969. for (let i = 0; i < height; i++) {
  26970. if (prediction) {
  26971. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  26972. ltp ^= sltp;
  26973. if (ltp) {
  26974. throw new Jbig2Error("prediction is not supported");
  26975. }
  26976. }
  26977. const row = new Uint8Array(width);
  26978. bitmap.push(row);
  26979. for (let j = 0; j < width; j++) {
  26980. let i0, j0;
  26981. let contextLabel = 0;
  26982. for (k = 0; k < codingTemplateLength; k++) {
  26983. i0 = i + codingTemplateY[k];
  26984. j0 = j + codingTemplateX[k];
  26985. if (i0 < 0 || j0 < 0 || j0 >= width) {
  26986. contextLabel <<= 1;
  26987. } else {
  26988. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  26989. }
  26990. }
  26991. for (k = 0; k < referenceTemplateLength; k++) {
  26992. i0 = i + referenceTemplateY[k] - offsetY;
  26993. j0 = j + referenceTemplateX[k] - offsetX;
  26994. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  26995. contextLabel <<= 1;
  26996. } else {
  26997. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  26998. }
  26999. }
  27000. const pixel = decoder.readBit(contexts, contextLabel);
  27001. row[j] = pixel;
  27002. }
  27003. }
  27004. return bitmap;
  27005. }
  27006. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  27007. if (huffman && refinement) {
  27008. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  27009. }
  27010. const newSymbols = [];
  27011. let currentHeight = 0;
  27012. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  27013. const decoder = decodingContext.decoder;
  27014. const contextCache = decodingContext.contextCache;
  27015. let tableB1, symbolWidths;
  27016. if (huffman) {
  27017. tableB1 = getStandardTable(1);
  27018. symbolWidths = [];
  27019. symbolCodeLength = Math.max(symbolCodeLength, 1);
  27020. }
  27021. while (newSymbols.length < numberOfNewSymbols) {
  27022. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  27023. currentHeight += deltaHeight;
  27024. let currentWidth = 0,
  27025. totalWidth = 0;
  27026. const firstSymbol = huffman ? symbolWidths.length : 0;
  27027. while (true) {
  27028. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  27029. if (deltaWidth === null) {
  27030. break;
  27031. }
  27032. currentWidth += deltaWidth;
  27033. totalWidth += currentWidth;
  27034. let bitmap;
  27035. if (refinement) {
  27036. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  27037. if (numberOfInstances > 1) {
  27038. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  27039. } else {
  27040. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  27041. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27042. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27043. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  27044. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  27045. }
  27046. newSymbols.push(bitmap);
  27047. } else if (huffman) {
  27048. symbolWidths.push(currentWidth);
  27049. } else {
  27050. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  27051. newSymbols.push(bitmap);
  27052. }
  27053. }
  27054. if (huffman && !refinement) {
  27055. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  27056. huffmanInput.byteAlign();
  27057. let collectiveBitmap;
  27058. if (bitmapSize === 0) {
  27059. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  27060. } else {
  27061. const originalEnd = huffmanInput.end;
  27062. const bitmapEnd = huffmanInput.position + bitmapSize;
  27063. huffmanInput.end = bitmapEnd;
  27064. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  27065. huffmanInput.end = originalEnd;
  27066. huffmanInput.position = bitmapEnd;
  27067. }
  27068. const numberOfSymbolsDecoded = symbolWidths.length;
  27069. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  27070. newSymbols.push(collectiveBitmap);
  27071. } else {
  27072. let i,
  27073. y,
  27074. xMin = 0,
  27075. xMax,
  27076. bitmapWidth,
  27077. symbolBitmap;
  27078. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  27079. bitmapWidth = symbolWidths[i];
  27080. xMax = xMin + bitmapWidth;
  27081. symbolBitmap = [];
  27082. for (y = 0; y < currentHeight; y++) {
  27083. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27084. }
  27085. newSymbols.push(symbolBitmap);
  27086. xMin = xMax;
  27087. }
  27088. }
  27089. }
  27090. }
  27091. const exportedSymbols = [],
  27092. flags = [];
  27093. let currentFlag = false,
  27094. i,
  27095. ii;
  27096. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  27097. while (flags.length < totalSymbolsLength) {
  27098. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  27099. while (runLength--) {
  27100. flags.push(currentFlag);
  27101. }
  27102. currentFlag = !currentFlag;
  27103. }
  27104. for (i = 0, ii = symbols.length; i < ii; i++) {
  27105. if (flags[i]) {
  27106. exportedSymbols.push(symbols[i]);
  27107. }
  27108. }
  27109. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  27110. if (flags[i]) {
  27111. exportedSymbols.push(newSymbols[j]);
  27112. }
  27113. }
  27114. return exportedSymbols;
  27115. }
  27116. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  27117. if (huffman && refinement) {
  27118. throw new Jbig2Error("refinement with Huffman is not supported");
  27119. }
  27120. const bitmap = [];
  27121. let i, row;
  27122. for (i = 0; i < height; i++) {
  27123. row = new Uint8Array(width);
  27124. if (defaultPixelValue) {
  27125. for (let j = 0; j < width; j++) {
  27126. row[j] = defaultPixelValue;
  27127. }
  27128. }
  27129. bitmap.push(row);
  27130. }
  27131. const decoder = decodingContext.decoder;
  27132. const contextCache = decodingContext.contextCache;
  27133. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  27134. let firstS = 0;
  27135. i = 0;
  27136. while (i < numberOfSymbolInstances) {
  27137. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  27138. stripT += deltaT;
  27139. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  27140. firstS += deltaFirstS;
  27141. let currentS = firstS;
  27142. do {
  27143. let currentT = 0;
  27144. if (stripSize > 1) {
  27145. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  27146. }
  27147. const t = stripSize * stripT + currentT;
  27148. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  27149. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  27150. let symbolBitmap = inputSymbols[symbolId];
  27151. let symbolWidth = symbolBitmap[0].length;
  27152. let symbolHeight = symbolBitmap.length;
  27153. if (applyRefinement) {
  27154. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  27155. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  27156. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27157. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27158. symbolWidth += rdw;
  27159. symbolHeight += rdh;
  27160. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  27161. }
  27162. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  27163. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  27164. let s2, t2, symbolRow;
  27165. if (transposed) {
  27166. for (s2 = 0; s2 < symbolHeight; s2++) {
  27167. row = bitmap[offsetS + s2];
  27168. if (!row) {
  27169. continue;
  27170. }
  27171. symbolRow = symbolBitmap[s2];
  27172. const maxWidth = Math.min(width - offsetT, symbolWidth);
  27173. switch (combinationOperator) {
  27174. case 0:
  27175. for (t2 = 0; t2 < maxWidth; t2++) {
  27176. row[offsetT + t2] |= symbolRow[t2];
  27177. }
  27178. break;
  27179. case 2:
  27180. for (t2 = 0; t2 < maxWidth; t2++) {
  27181. row[offsetT + t2] ^= symbolRow[t2];
  27182. }
  27183. break;
  27184. default:
  27185. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27186. }
  27187. }
  27188. currentS += symbolHeight - 1;
  27189. } else {
  27190. for (t2 = 0; t2 < symbolHeight; t2++) {
  27191. row = bitmap[offsetT + t2];
  27192. if (!row) {
  27193. continue;
  27194. }
  27195. symbolRow = symbolBitmap[t2];
  27196. switch (combinationOperator) {
  27197. case 0:
  27198. for (s2 = 0; s2 < symbolWidth; s2++) {
  27199. row[offsetS + s2] |= symbolRow[s2];
  27200. }
  27201. break;
  27202. case 2:
  27203. for (s2 = 0; s2 < symbolWidth; s2++) {
  27204. row[offsetS + s2] ^= symbolRow[s2];
  27205. }
  27206. break;
  27207. default:
  27208. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27209. }
  27210. }
  27211. currentS += symbolWidth - 1;
  27212. }
  27213. i++;
  27214. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  27215. if (deltaS === null) {
  27216. break;
  27217. }
  27218. currentS += deltaS + dsOffset;
  27219. } while (true);
  27220. }
  27221. return bitmap;
  27222. }
  27223. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  27224. const at = [];
  27225. if (!mmr) {
  27226. at.push({
  27227. x: -patternWidth,
  27228. y: 0
  27229. });
  27230. if (template === 0) {
  27231. at.push({
  27232. x: -3,
  27233. y: -1
  27234. }, {
  27235. x: 2,
  27236. y: -2
  27237. }, {
  27238. x: -2,
  27239. y: -2
  27240. });
  27241. }
  27242. }
  27243. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  27244. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  27245. const patterns = [];
  27246. for (let i = 0; i <= maxPatternIndex; i++) {
  27247. const patternBitmap = [];
  27248. const xMin = patternWidth * i;
  27249. const xMax = xMin + patternWidth;
  27250. for (let y = 0; y < patternHeight; y++) {
  27251. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27252. }
  27253. patterns.push(patternBitmap);
  27254. }
  27255. return patterns;
  27256. }
  27257. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  27258. const skip = null;
  27259. if (enableSkip) {
  27260. throw new Jbig2Error("skip is not supported");
  27261. }
  27262. if (combinationOperator !== 0) {
  27263. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  27264. }
  27265. const regionBitmap = [];
  27266. let i, j, row;
  27267. for (i = 0; i < regionHeight; i++) {
  27268. row = new Uint8Array(regionWidth);
  27269. if (defaultPixelValue) {
  27270. for (j = 0; j < regionWidth; j++) {
  27271. row[j] = defaultPixelValue;
  27272. }
  27273. }
  27274. regionBitmap.push(row);
  27275. }
  27276. const numberOfPatterns = patterns.length;
  27277. const pattern0 = patterns[0];
  27278. const patternWidth = pattern0[0].length,
  27279. patternHeight = pattern0.length;
  27280. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  27281. const at = [];
  27282. if (!mmr) {
  27283. at.push({
  27284. x: template <= 1 ? 3 : 2,
  27285. y: -1
  27286. });
  27287. if (template === 0) {
  27288. at.push({
  27289. x: -3,
  27290. y: -1
  27291. }, {
  27292. x: 2,
  27293. y: -2
  27294. }, {
  27295. x: -2,
  27296. y: -2
  27297. });
  27298. }
  27299. }
  27300. const grayScaleBitPlanes = [];
  27301. let mmrInput, bitmap;
  27302. if (mmr) {
  27303. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27304. }
  27305. for (i = bitsPerValue - 1; i >= 0; i--) {
  27306. if (mmr) {
  27307. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  27308. } else {
  27309. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  27310. }
  27311. grayScaleBitPlanes[i] = bitmap;
  27312. }
  27313. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  27314. for (mg = 0; mg < gridHeight; mg++) {
  27315. for (ng = 0; ng < gridWidth; ng++) {
  27316. bit = 0;
  27317. patternIndex = 0;
  27318. for (j = bitsPerValue - 1; j >= 0; j--) {
  27319. bit ^= grayScaleBitPlanes[j][mg][ng];
  27320. patternIndex |= bit << j;
  27321. }
  27322. patternBitmap = patterns[patternIndex];
  27323. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  27324. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  27325. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  27326. for (i = 0; i < patternHeight; i++) {
  27327. regionRow = regionBitmap[y + i];
  27328. patternRow = patternBitmap[i];
  27329. for (j = 0; j < patternWidth; j++) {
  27330. regionRow[x + j] |= patternRow[j];
  27331. }
  27332. }
  27333. } else {
  27334. let regionX, regionY;
  27335. for (i = 0; i < patternHeight; i++) {
  27336. regionY = y + i;
  27337. if (regionY < 0 || regionY >= regionHeight) {
  27338. continue;
  27339. }
  27340. regionRow = regionBitmap[regionY];
  27341. patternRow = patternBitmap[i];
  27342. for (j = 0; j < patternWidth; j++) {
  27343. regionX = x + j;
  27344. if (regionX >= 0 && regionX < regionWidth) {
  27345. regionRow[regionX] |= patternRow[j];
  27346. }
  27347. }
  27348. }
  27349. }
  27350. }
  27351. }
  27352. return regionBitmap;
  27353. }
  27354. function readSegmentHeader(data, start) {
  27355. const segmentHeader = {};
  27356. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  27357. const flags = data[start + 4];
  27358. const segmentType = flags & 0x3f;
  27359. if (!SegmentTypes[segmentType]) {
  27360. throw new Jbig2Error("invalid segment type: " + segmentType);
  27361. }
  27362. segmentHeader.type = segmentType;
  27363. segmentHeader.typeName = SegmentTypes[segmentType];
  27364. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  27365. const pageAssociationFieldSize = !!(flags & 0x40);
  27366. const referredFlags = data[start + 5];
  27367. let referredToCount = referredFlags >> 5 & 7;
  27368. const retainBits = [referredFlags & 31];
  27369. let position = start + 6;
  27370. if (referredFlags === 7) {
  27371. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  27372. position += 3;
  27373. let bytes = referredToCount + 7 >> 3;
  27374. retainBits[0] = data[position++];
  27375. while (--bytes > 0) {
  27376. retainBits.push(data[position++]);
  27377. }
  27378. } else if (referredFlags === 5 || referredFlags === 6) {
  27379. throw new Jbig2Error("invalid referred-to flags");
  27380. }
  27381. segmentHeader.retainBits = retainBits;
  27382. let referredToSegmentNumberSize = 4;
  27383. if (segmentHeader.number <= 256) {
  27384. referredToSegmentNumberSize = 1;
  27385. } else if (segmentHeader.number <= 65536) {
  27386. referredToSegmentNumberSize = 2;
  27387. }
  27388. const referredTo = [];
  27389. let i, ii;
  27390. for (i = 0; i < referredToCount; i++) {
  27391. let number;
  27392. if (referredToSegmentNumberSize === 1) {
  27393. number = data[position];
  27394. } else if (referredToSegmentNumberSize === 2) {
  27395. number = (0, _core_utils.readUint16)(data, position);
  27396. } else {
  27397. number = (0, _core_utils.readUint32)(data, position);
  27398. }
  27399. referredTo.push(number);
  27400. position += referredToSegmentNumberSize;
  27401. }
  27402. segmentHeader.referredTo = referredTo;
  27403. if (!pageAssociationFieldSize) {
  27404. segmentHeader.pageAssociation = data[position++];
  27405. } else {
  27406. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  27407. position += 4;
  27408. }
  27409. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  27410. position += 4;
  27411. if (segmentHeader.length === 0xffffffff) {
  27412. if (segmentType === 38) {
  27413. const genericRegionInfo = readRegionSegmentInformation(data, position);
  27414. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  27415. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  27416. const searchPatternLength = 6;
  27417. const searchPattern = new Uint8Array(searchPatternLength);
  27418. if (!genericRegionMmr) {
  27419. searchPattern[0] = 0xff;
  27420. searchPattern[1] = 0xac;
  27421. }
  27422. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  27423. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  27424. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  27425. searchPattern[5] = genericRegionInfo.height & 0xff;
  27426. for (i = position, ii = data.length; i < ii; i++) {
  27427. let j = 0;
  27428. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  27429. j++;
  27430. }
  27431. if (j === searchPatternLength) {
  27432. segmentHeader.length = i + searchPatternLength;
  27433. break;
  27434. }
  27435. }
  27436. if (segmentHeader.length === 0xffffffff) {
  27437. throw new Jbig2Error("segment end was not found");
  27438. }
  27439. } else {
  27440. throw new Jbig2Error("invalid unknown segment length");
  27441. }
  27442. }
  27443. segmentHeader.headerEnd = position;
  27444. return segmentHeader;
  27445. }
  27446. function readSegments(header, data, start, end) {
  27447. const segments = [];
  27448. let position = start;
  27449. while (position < end) {
  27450. const segmentHeader = readSegmentHeader(data, position);
  27451. position = segmentHeader.headerEnd;
  27452. const segment = {
  27453. header: segmentHeader,
  27454. data
  27455. };
  27456. if (!header.randomAccess) {
  27457. segment.start = position;
  27458. position += segmentHeader.length;
  27459. segment.end = position;
  27460. }
  27461. segments.push(segment);
  27462. if (segmentHeader.type === 51) {
  27463. break;
  27464. }
  27465. }
  27466. if (header.randomAccess) {
  27467. for (let i = 0, ii = segments.length; i < ii; i++) {
  27468. segments[i].start = position;
  27469. position += segments[i].header.length;
  27470. segments[i].end = position;
  27471. }
  27472. }
  27473. return segments;
  27474. }
  27475. function readRegionSegmentInformation(data, start) {
  27476. return {
  27477. width: (0, _core_utils.readUint32)(data, start),
  27478. height: (0, _core_utils.readUint32)(data, start + 4),
  27479. x: (0, _core_utils.readUint32)(data, start + 8),
  27480. y: (0, _core_utils.readUint32)(data, start + 12),
  27481. combinationOperator: data[start + 16] & 7
  27482. };
  27483. }
  27484. const RegionSegmentInformationFieldLength = 17;
  27485. function processSegment(segment, visitor) {
  27486. const header = segment.header;
  27487. const data = segment.data,
  27488. end = segment.end;
  27489. let position = segment.start;
  27490. let args, at, i, atLength;
  27491. switch (header.type) {
  27492. case 0:
  27493. const dictionary = {};
  27494. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  27495. dictionary.huffman = !!(dictionaryFlags & 1);
  27496. dictionary.refinement = !!(dictionaryFlags & 2);
  27497. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  27498. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  27499. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  27500. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  27501. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  27502. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  27503. dictionary.template = dictionaryFlags >> 10 & 3;
  27504. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  27505. position += 2;
  27506. if (!dictionary.huffman) {
  27507. atLength = dictionary.template === 0 ? 4 : 1;
  27508. at = [];
  27509. for (i = 0; i < atLength; i++) {
  27510. at.push({
  27511. x: (0, _core_utils.readInt8)(data, position),
  27512. y: (0, _core_utils.readInt8)(data, position + 1)
  27513. });
  27514. position += 2;
  27515. }
  27516. dictionary.at = at;
  27517. }
  27518. if (dictionary.refinement && !dictionary.refinementTemplate) {
  27519. at = [];
  27520. for (i = 0; i < 2; i++) {
  27521. at.push({
  27522. x: (0, _core_utils.readInt8)(data, position),
  27523. y: (0, _core_utils.readInt8)(data, position + 1)
  27524. });
  27525. position += 2;
  27526. }
  27527. dictionary.refinementAt = at;
  27528. }
  27529. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  27530. position += 4;
  27531. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  27532. position += 4;
  27533. args = [dictionary, header.number, header.referredTo, data, position, end];
  27534. break;
  27535. case 6:
  27536. case 7:
  27537. const textRegion = {};
  27538. textRegion.info = readRegionSegmentInformation(data, position);
  27539. position += RegionSegmentInformationFieldLength;
  27540. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  27541. position += 2;
  27542. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  27543. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  27544. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  27545. textRegion.stripSize = 1 << textRegion.logStripSize;
  27546. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  27547. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  27548. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  27549. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  27550. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  27551. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  27552. if (textRegion.huffman) {
  27553. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  27554. position += 2;
  27555. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  27556. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  27557. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  27558. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  27559. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  27560. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  27561. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  27562. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  27563. }
  27564. if (textRegion.refinement && !textRegion.refinementTemplate) {
  27565. at = [];
  27566. for (i = 0; i < 2; i++) {
  27567. at.push({
  27568. x: (0, _core_utils.readInt8)(data, position),
  27569. y: (0, _core_utils.readInt8)(data, position + 1)
  27570. });
  27571. position += 2;
  27572. }
  27573. textRegion.refinementAt = at;
  27574. }
  27575. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  27576. position += 4;
  27577. args = [textRegion, header.referredTo, data, position, end];
  27578. break;
  27579. case 16:
  27580. const patternDictionary = {};
  27581. const patternDictionaryFlags = data[position++];
  27582. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  27583. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  27584. patternDictionary.patternWidth = data[position++];
  27585. patternDictionary.patternHeight = data[position++];
  27586. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  27587. position += 4;
  27588. args = [patternDictionary, header.number, data, position, end];
  27589. break;
  27590. case 22:
  27591. case 23:
  27592. const halftoneRegion = {};
  27593. halftoneRegion.info = readRegionSegmentInformation(data, position);
  27594. position += RegionSegmentInformationFieldLength;
  27595. const halftoneRegionFlags = data[position++];
  27596. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  27597. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  27598. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  27599. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  27600. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  27601. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  27602. position += 4;
  27603. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  27604. position += 4;
  27605. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27606. position += 4;
  27607. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27608. position += 4;
  27609. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  27610. position += 2;
  27611. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  27612. position += 2;
  27613. args = [halftoneRegion, header.referredTo, data, position, end];
  27614. break;
  27615. case 38:
  27616. case 39:
  27617. const genericRegion = {};
  27618. genericRegion.info = readRegionSegmentInformation(data, position);
  27619. position += RegionSegmentInformationFieldLength;
  27620. const genericRegionSegmentFlags = data[position++];
  27621. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  27622. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  27623. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  27624. if (!genericRegion.mmr) {
  27625. atLength = genericRegion.template === 0 ? 4 : 1;
  27626. at = [];
  27627. for (i = 0; i < atLength; i++) {
  27628. at.push({
  27629. x: (0, _core_utils.readInt8)(data, position),
  27630. y: (0, _core_utils.readInt8)(data, position + 1)
  27631. });
  27632. position += 2;
  27633. }
  27634. genericRegion.at = at;
  27635. }
  27636. args = [genericRegion, data, position, end];
  27637. break;
  27638. case 48:
  27639. const pageInfo = {
  27640. width: (0, _core_utils.readUint32)(data, position),
  27641. height: (0, _core_utils.readUint32)(data, position + 4),
  27642. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  27643. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  27644. };
  27645. if (pageInfo.height === 0xffffffff) {
  27646. delete pageInfo.height;
  27647. }
  27648. const pageSegmentFlags = data[position + 16];
  27649. (0, _core_utils.readUint16)(data, position + 17);
  27650. pageInfo.lossless = !!(pageSegmentFlags & 1);
  27651. pageInfo.refinement = !!(pageSegmentFlags & 2);
  27652. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  27653. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  27654. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  27655. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  27656. args = [pageInfo];
  27657. break;
  27658. case 49:
  27659. break;
  27660. case 50:
  27661. break;
  27662. case 51:
  27663. break;
  27664. case 53:
  27665. args = [header.number, data, position, end];
  27666. break;
  27667. case 62:
  27668. break;
  27669. default:
  27670. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  27671. }
  27672. const callbackName = "on" + header.typeName;
  27673. if (callbackName in visitor) {
  27674. visitor[callbackName].apply(visitor, args);
  27675. }
  27676. }
  27677. function processSegments(segments, visitor) {
  27678. for (let i = 0, ii = segments.length; i < ii; i++) {
  27679. processSegment(segments[i], visitor);
  27680. }
  27681. }
  27682. function parseJbig2Chunks(chunks) {
  27683. const visitor = new SimpleSegmentVisitor();
  27684. for (let i = 0, ii = chunks.length; i < ii; i++) {
  27685. const chunk = chunks[i];
  27686. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  27687. processSegments(segments, visitor);
  27688. }
  27689. return visitor.buffer;
  27690. }
  27691. function parseJbig2(data) {
  27692. const end = data.length;
  27693. let position = 0;
  27694. 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) {
  27695. throw new Jbig2Error("parseJbig2 - invalid header.");
  27696. }
  27697. const header = Object.create(null);
  27698. position += 8;
  27699. const flags = data[position++];
  27700. header.randomAccess = !(flags & 1);
  27701. if (!(flags & 2)) {
  27702. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  27703. position += 4;
  27704. }
  27705. const segments = readSegments(header, data, position, end);
  27706. const visitor = new SimpleSegmentVisitor();
  27707. processSegments(segments, visitor);
  27708. const {
  27709. width,
  27710. height
  27711. } = visitor.currentPageInfo;
  27712. const bitPacked = visitor.buffer;
  27713. const imgData = new Uint8ClampedArray(width * height);
  27714. let q = 0,
  27715. k = 0;
  27716. for (let i = 0; i < height; i++) {
  27717. let mask = 0,
  27718. buffer;
  27719. for (let j = 0; j < width; j++) {
  27720. if (!mask) {
  27721. mask = 128;
  27722. buffer = bitPacked[k++];
  27723. }
  27724. imgData[q++] = buffer & mask ? 0 : 255;
  27725. mask >>= 1;
  27726. }
  27727. }
  27728. return {
  27729. imgData,
  27730. width,
  27731. height
  27732. };
  27733. }
  27734. class SimpleSegmentVisitor {
  27735. onPageInformation(info) {
  27736. this.currentPageInfo = info;
  27737. const rowSize = info.width + 7 >> 3;
  27738. const buffer = new Uint8ClampedArray(rowSize * info.height);
  27739. if (info.defaultPixelValue) {
  27740. for (let i = 0, ii = buffer.length; i < ii; i++) {
  27741. buffer[i] = 0xff;
  27742. }
  27743. }
  27744. this.buffer = buffer;
  27745. }
  27746. drawBitmap(regionInfo, bitmap) {
  27747. const pageInfo = this.currentPageInfo;
  27748. const width = regionInfo.width,
  27749. height = regionInfo.height;
  27750. const rowSize = pageInfo.width + 7 >> 3;
  27751. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  27752. const buffer = this.buffer;
  27753. const mask0 = 128 >> (regionInfo.x & 7);
  27754. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  27755. let i, j, mask, offset;
  27756. switch (combinationOperator) {
  27757. case 0:
  27758. for (i = 0; i < height; i++) {
  27759. mask = mask0;
  27760. offset = offset0;
  27761. for (j = 0; j < width; j++) {
  27762. if (bitmap[i][j]) {
  27763. buffer[offset] |= mask;
  27764. }
  27765. mask >>= 1;
  27766. if (!mask) {
  27767. mask = 128;
  27768. offset++;
  27769. }
  27770. }
  27771. offset0 += rowSize;
  27772. }
  27773. break;
  27774. case 2:
  27775. for (i = 0; i < height; i++) {
  27776. mask = mask0;
  27777. offset = offset0;
  27778. for (j = 0; j < width; j++) {
  27779. if (bitmap[i][j]) {
  27780. buffer[offset] ^= mask;
  27781. }
  27782. mask >>= 1;
  27783. if (!mask) {
  27784. mask = 128;
  27785. offset++;
  27786. }
  27787. }
  27788. offset0 += rowSize;
  27789. }
  27790. break;
  27791. default:
  27792. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27793. }
  27794. }
  27795. onImmediateGenericRegion(region, data, start, end) {
  27796. const regionInfo = region.info;
  27797. const decodingContext = new DecodingContext(data, start, end);
  27798. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  27799. this.drawBitmap(regionInfo, bitmap);
  27800. }
  27801. onImmediateLosslessGenericRegion() {
  27802. this.onImmediateGenericRegion.apply(this, arguments);
  27803. }
  27804. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  27805. let huffmanTables, huffmanInput;
  27806. if (dictionary.huffman) {
  27807. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  27808. huffmanInput = new Reader(data, start, end);
  27809. }
  27810. let symbols = this.symbols;
  27811. if (!symbols) {
  27812. this.symbols = symbols = {};
  27813. }
  27814. let inputSymbols = [];
  27815. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27816. const referredSymbols = symbols[referredSegments[i]];
  27817. if (referredSymbols) {
  27818. inputSymbols = inputSymbols.concat(referredSymbols);
  27819. }
  27820. }
  27821. const decodingContext = new DecodingContext(data, start, end);
  27822. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  27823. }
  27824. onImmediateTextRegion(region, referredSegments, data, start, end) {
  27825. const regionInfo = region.info;
  27826. let huffmanTables, huffmanInput;
  27827. const symbols = this.symbols;
  27828. let inputSymbols = [];
  27829. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27830. const referredSymbols = symbols[referredSegments[i]];
  27831. if (referredSymbols) {
  27832. inputSymbols = inputSymbols.concat(referredSymbols);
  27833. }
  27834. }
  27835. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  27836. if (region.huffman) {
  27837. huffmanInput = new Reader(data, start, end);
  27838. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  27839. }
  27840. const decodingContext = new DecodingContext(data, start, end);
  27841. 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);
  27842. this.drawBitmap(regionInfo, bitmap);
  27843. }
  27844. onImmediateLosslessTextRegion() {
  27845. this.onImmediateTextRegion.apply(this, arguments);
  27846. }
  27847. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  27848. let patterns = this.patterns;
  27849. if (!patterns) {
  27850. this.patterns = patterns = {};
  27851. }
  27852. const decodingContext = new DecodingContext(data, start, end);
  27853. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  27854. }
  27855. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  27856. const patterns = this.patterns[referredSegments[0]];
  27857. const regionInfo = region.info;
  27858. const decodingContext = new DecodingContext(data, start, end);
  27859. 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);
  27860. this.drawBitmap(regionInfo, bitmap);
  27861. }
  27862. onImmediateLosslessHalftoneRegion() {
  27863. this.onImmediateHalftoneRegion.apply(this, arguments);
  27864. }
  27865. onTables(currentSegment, data, start, end) {
  27866. let customTables = this.customTables;
  27867. if (!customTables) {
  27868. this.customTables = customTables = {};
  27869. }
  27870. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  27871. }
  27872. }
  27873. class HuffmanLine {
  27874. constructor(lineData) {
  27875. if (lineData.length === 2) {
  27876. this.isOOB = true;
  27877. this.rangeLow = 0;
  27878. this.prefixLength = lineData[0];
  27879. this.rangeLength = 0;
  27880. this.prefixCode = lineData[1];
  27881. this.isLowerRange = false;
  27882. } else {
  27883. this.isOOB = false;
  27884. this.rangeLow = lineData[0];
  27885. this.prefixLength = lineData[1];
  27886. this.rangeLength = lineData[2];
  27887. this.prefixCode = lineData[3];
  27888. this.isLowerRange = lineData[4] === "lower";
  27889. }
  27890. }
  27891. }
  27892. class HuffmanTreeNode {
  27893. constructor(line) {
  27894. this.children = [];
  27895. if (line) {
  27896. this.isLeaf = true;
  27897. this.rangeLength = line.rangeLength;
  27898. this.rangeLow = line.rangeLow;
  27899. this.isLowerRange = line.isLowerRange;
  27900. this.isOOB = line.isOOB;
  27901. } else {
  27902. this.isLeaf = false;
  27903. }
  27904. }
  27905. buildTree(line, shift) {
  27906. const bit = line.prefixCode >> shift & 1;
  27907. if (shift <= 0) {
  27908. this.children[bit] = new HuffmanTreeNode(line);
  27909. } else {
  27910. let node = this.children[bit];
  27911. if (!node) {
  27912. this.children[bit] = node = new HuffmanTreeNode(null);
  27913. }
  27914. node.buildTree(line, shift - 1);
  27915. }
  27916. }
  27917. decodeNode(reader) {
  27918. if (this.isLeaf) {
  27919. if (this.isOOB) {
  27920. return null;
  27921. }
  27922. const htOffset = reader.readBits(this.rangeLength);
  27923. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  27924. }
  27925. const node = this.children[reader.readBit()];
  27926. if (!node) {
  27927. throw new Jbig2Error("invalid Huffman data");
  27928. }
  27929. return node.decodeNode(reader);
  27930. }
  27931. }
  27932. class HuffmanTable {
  27933. constructor(lines, prefixCodesDone) {
  27934. if (!prefixCodesDone) {
  27935. this.assignPrefixCodes(lines);
  27936. }
  27937. this.rootNode = new HuffmanTreeNode(null);
  27938. for (let i = 0, ii = lines.length; i < ii; i++) {
  27939. const line = lines[i];
  27940. if (line.prefixLength > 0) {
  27941. this.rootNode.buildTree(line, line.prefixLength - 1);
  27942. }
  27943. }
  27944. }
  27945. decode(reader) {
  27946. return this.rootNode.decodeNode(reader);
  27947. }
  27948. assignPrefixCodes(lines) {
  27949. const linesLength = lines.length;
  27950. let prefixLengthMax = 0;
  27951. for (let i = 0; i < linesLength; i++) {
  27952. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  27953. }
  27954. const histogram = new Uint32Array(prefixLengthMax + 1);
  27955. for (let i = 0; i < linesLength; i++) {
  27956. histogram[lines[i].prefixLength]++;
  27957. }
  27958. let currentLength = 1,
  27959. firstCode = 0,
  27960. currentCode,
  27961. currentTemp,
  27962. line;
  27963. histogram[0] = 0;
  27964. while (currentLength <= prefixLengthMax) {
  27965. firstCode = firstCode + histogram[currentLength - 1] << 1;
  27966. currentCode = firstCode;
  27967. currentTemp = 0;
  27968. while (currentTemp < linesLength) {
  27969. line = lines[currentTemp];
  27970. if (line.prefixLength === currentLength) {
  27971. line.prefixCode = currentCode;
  27972. currentCode++;
  27973. }
  27974. currentTemp++;
  27975. }
  27976. currentLength++;
  27977. }
  27978. }
  27979. }
  27980. function decodeTablesSegment(data, start, end) {
  27981. const flags = data[start];
  27982. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  27983. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  27984. const reader = new Reader(data, start + 9, end);
  27985. const prefixSizeBits = (flags >> 1 & 7) + 1;
  27986. const rangeSizeBits = (flags >> 4 & 7) + 1;
  27987. const lines = [];
  27988. let prefixLength,
  27989. rangeLength,
  27990. currentRangeLow = lowestValue;
  27991. do {
  27992. prefixLength = reader.readBits(prefixSizeBits);
  27993. rangeLength = reader.readBits(rangeSizeBits);
  27994. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  27995. currentRangeLow += 1 << rangeLength;
  27996. } while (currentRangeLow < highestValue);
  27997. prefixLength = reader.readBits(prefixSizeBits);
  27998. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  27999. prefixLength = reader.readBits(prefixSizeBits);
  28000. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  28001. if (flags & 1) {
  28002. prefixLength = reader.readBits(prefixSizeBits);
  28003. lines.push(new HuffmanLine([prefixLength, 0]));
  28004. }
  28005. return new HuffmanTable(lines, false);
  28006. }
  28007. const standardTablesCache = {};
  28008. function getStandardTable(number) {
  28009. let table = standardTablesCache[number];
  28010. if (table) {
  28011. return table;
  28012. }
  28013. let lines;
  28014. switch (number) {
  28015. case 1:
  28016. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  28017. break;
  28018. case 2:
  28019. 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]];
  28020. break;
  28021. case 3:
  28022. 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]];
  28023. break;
  28024. case 4:
  28025. 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]];
  28026. break;
  28027. case 5:
  28028. 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]];
  28029. break;
  28030. case 6:
  28031. 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]];
  28032. break;
  28033. case 7:
  28034. 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]];
  28035. break;
  28036. case 8:
  28037. 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]];
  28038. break;
  28039. case 9:
  28040. 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]];
  28041. break;
  28042. case 10:
  28043. 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]];
  28044. break;
  28045. case 11:
  28046. 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]];
  28047. break;
  28048. case 12:
  28049. 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]];
  28050. break;
  28051. case 13:
  28052. 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]];
  28053. break;
  28054. case 14:
  28055. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  28056. break;
  28057. case 15:
  28058. 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]];
  28059. break;
  28060. default:
  28061. throw new Jbig2Error(`standard table B.${number} does not exist`);
  28062. }
  28063. for (let i = 0, ii = lines.length; i < ii; i++) {
  28064. lines[i] = new HuffmanLine(lines[i]);
  28065. }
  28066. table = new HuffmanTable(lines, true);
  28067. standardTablesCache[number] = table;
  28068. return table;
  28069. }
  28070. class Reader {
  28071. constructor(data, start, end) {
  28072. this.data = data;
  28073. this.start = start;
  28074. this.end = end;
  28075. this.position = start;
  28076. this.shift = -1;
  28077. this.currentByte = 0;
  28078. }
  28079. readBit() {
  28080. if (this.shift < 0) {
  28081. if (this.position >= this.end) {
  28082. throw new Jbig2Error("end of data while reading bit");
  28083. }
  28084. this.currentByte = this.data[this.position++];
  28085. this.shift = 7;
  28086. }
  28087. const bit = this.currentByte >> this.shift & 1;
  28088. this.shift--;
  28089. return bit;
  28090. }
  28091. readBits(numBits) {
  28092. let result = 0,
  28093. i;
  28094. for (i = numBits - 1; i >= 0; i--) {
  28095. result |= this.readBit() << i;
  28096. }
  28097. return result;
  28098. }
  28099. byteAlign() {
  28100. this.shift = -1;
  28101. }
  28102. next() {
  28103. if (this.position >= this.end) {
  28104. return -1;
  28105. }
  28106. return this.data[this.position++];
  28107. }
  28108. }
  28109. function getCustomHuffmanTable(index, referredTo, customTables) {
  28110. let currentIndex = 0;
  28111. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  28112. const table = customTables[referredTo[i]];
  28113. if (table) {
  28114. if (index === currentIndex) {
  28115. return table;
  28116. }
  28117. currentIndex++;
  28118. }
  28119. }
  28120. throw new Jbig2Error("can't find custom Huffman table");
  28121. }
  28122. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  28123. const codes = [];
  28124. for (let i = 0; i <= 34; i++) {
  28125. const codeLength = reader.readBits(4);
  28126. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28127. }
  28128. const runCodesTable = new HuffmanTable(codes, false);
  28129. codes.length = 0;
  28130. for (let i = 0; i < numberOfSymbols;) {
  28131. const codeLength = runCodesTable.decode(reader);
  28132. if (codeLength >= 32) {
  28133. let repeatedLength, numberOfRepeats, j;
  28134. switch (codeLength) {
  28135. case 32:
  28136. if (i === 0) {
  28137. throw new Jbig2Error("no previous value in symbol ID table");
  28138. }
  28139. numberOfRepeats = reader.readBits(2) + 3;
  28140. repeatedLength = codes[i - 1].prefixLength;
  28141. break;
  28142. case 33:
  28143. numberOfRepeats = reader.readBits(3) + 3;
  28144. repeatedLength = 0;
  28145. break;
  28146. case 34:
  28147. numberOfRepeats = reader.readBits(7) + 11;
  28148. repeatedLength = 0;
  28149. break;
  28150. default:
  28151. throw new Jbig2Error("invalid code length in symbol ID table");
  28152. }
  28153. for (j = 0; j < numberOfRepeats; j++) {
  28154. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  28155. i++;
  28156. }
  28157. } else {
  28158. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28159. i++;
  28160. }
  28161. }
  28162. reader.byteAlign();
  28163. const symbolIDTable = new HuffmanTable(codes, false);
  28164. let customIndex = 0,
  28165. tableFirstS,
  28166. tableDeltaS,
  28167. tableDeltaT;
  28168. switch (textRegion.huffmanFS) {
  28169. case 0:
  28170. case 1:
  28171. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  28172. break;
  28173. case 3:
  28174. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28175. customIndex++;
  28176. break;
  28177. default:
  28178. throw new Jbig2Error("invalid Huffman FS selector");
  28179. }
  28180. switch (textRegion.huffmanDS) {
  28181. case 0:
  28182. case 1:
  28183. case 2:
  28184. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  28185. break;
  28186. case 3:
  28187. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28188. customIndex++;
  28189. break;
  28190. default:
  28191. throw new Jbig2Error("invalid Huffman DS selector");
  28192. }
  28193. switch (textRegion.huffmanDT) {
  28194. case 0:
  28195. case 1:
  28196. case 2:
  28197. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  28198. break;
  28199. case 3:
  28200. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28201. customIndex++;
  28202. break;
  28203. default:
  28204. throw new Jbig2Error("invalid Huffman DT selector");
  28205. }
  28206. if (textRegion.refinement) {
  28207. throw new Jbig2Error("refinement with Huffman is not supported");
  28208. }
  28209. return {
  28210. symbolIDTable,
  28211. tableFirstS,
  28212. tableDeltaS,
  28213. tableDeltaT
  28214. };
  28215. }
  28216. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  28217. let customIndex = 0,
  28218. tableDeltaHeight,
  28219. tableDeltaWidth;
  28220. switch (dictionary.huffmanDHSelector) {
  28221. case 0:
  28222. case 1:
  28223. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  28224. break;
  28225. case 3:
  28226. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28227. customIndex++;
  28228. break;
  28229. default:
  28230. throw new Jbig2Error("invalid Huffman DH selector");
  28231. }
  28232. switch (dictionary.huffmanDWSelector) {
  28233. case 0:
  28234. case 1:
  28235. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  28236. break;
  28237. case 3:
  28238. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28239. customIndex++;
  28240. break;
  28241. default:
  28242. throw new Jbig2Error("invalid Huffman DW selector");
  28243. }
  28244. let tableBitmapSize, tableAggregateInstances;
  28245. if (dictionary.bitmapSizeSelector) {
  28246. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28247. customIndex++;
  28248. } else {
  28249. tableBitmapSize = getStandardTable(1);
  28250. }
  28251. if (dictionary.aggregationInstancesSelector) {
  28252. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28253. } else {
  28254. tableAggregateInstances = getStandardTable(1);
  28255. }
  28256. return {
  28257. tableDeltaHeight,
  28258. tableDeltaWidth,
  28259. tableBitmapSize,
  28260. tableAggregateInstances
  28261. };
  28262. }
  28263. function readUncompressedBitmap(reader, width, height) {
  28264. const bitmap = [];
  28265. for (let y = 0; y < height; y++) {
  28266. const row = new Uint8Array(width);
  28267. bitmap.push(row);
  28268. for (let x = 0; x < width; x++) {
  28269. row[x] = reader.readBit();
  28270. }
  28271. reader.byteAlign();
  28272. }
  28273. return bitmap;
  28274. }
  28275. function decodeMMRBitmap(input, width, height, endOfBlock) {
  28276. const params = {
  28277. K: -1,
  28278. Columns: width,
  28279. Rows: height,
  28280. BlackIs1: true,
  28281. EndOfBlock: endOfBlock
  28282. };
  28283. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  28284. const bitmap = [];
  28285. let currentByte,
  28286. eof = false;
  28287. for (let y = 0; y < height; y++) {
  28288. const row = new Uint8Array(width);
  28289. bitmap.push(row);
  28290. let shift = -1;
  28291. for (let x = 0; x < width; x++) {
  28292. if (shift < 0) {
  28293. currentByte = decoder.readNextChar();
  28294. if (currentByte === -1) {
  28295. currentByte = 0;
  28296. eof = true;
  28297. }
  28298. shift = 7;
  28299. }
  28300. row[x] = currentByte >> shift & 1;
  28301. shift--;
  28302. }
  28303. }
  28304. if (endOfBlock && !eof) {
  28305. const lookForEOFLimit = 5;
  28306. for (let i = 0; i < lookForEOFLimit; i++) {
  28307. if (decoder.readNextChar() === -1) {
  28308. break;
  28309. }
  28310. }
  28311. }
  28312. return bitmap;
  28313. }
  28314. class Jbig2Image {
  28315. parseChunks(chunks) {
  28316. return parseJbig2Chunks(chunks);
  28317. }
  28318. parse(data) {
  28319. const {
  28320. imgData,
  28321. width,
  28322. height
  28323. } = parseJbig2(data);
  28324. this.width = width;
  28325. this.height = height;
  28326. return imgData;
  28327. }
  28328. }
  28329. exports.Jbig2Image = Jbig2Image;
  28330. /***/ }),
  28331. /* 36 */
  28332. /***/ ((__unused_webpack_module, exports) => {
  28333. Object.defineProperty(exports, "__esModule", ({
  28334. value: true
  28335. }));
  28336. exports.ArithmeticDecoder = void 0;
  28337. const QeTable = [{
  28338. qe: 0x5601,
  28339. nmps: 1,
  28340. nlps: 1,
  28341. switchFlag: 1
  28342. }, {
  28343. qe: 0x3401,
  28344. nmps: 2,
  28345. nlps: 6,
  28346. switchFlag: 0
  28347. }, {
  28348. qe: 0x1801,
  28349. nmps: 3,
  28350. nlps: 9,
  28351. switchFlag: 0
  28352. }, {
  28353. qe: 0x0ac1,
  28354. nmps: 4,
  28355. nlps: 12,
  28356. switchFlag: 0
  28357. }, {
  28358. qe: 0x0521,
  28359. nmps: 5,
  28360. nlps: 29,
  28361. switchFlag: 0
  28362. }, {
  28363. qe: 0x0221,
  28364. nmps: 38,
  28365. nlps: 33,
  28366. switchFlag: 0
  28367. }, {
  28368. qe: 0x5601,
  28369. nmps: 7,
  28370. nlps: 6,
  28371. switchFlag: 1
  28372. }, {
  28373. qe: 0x5401,
  28374. nmps: 8,
  28375. nlps: 14,
  28376. switchFlag: 0
  28377. }, {
  28378. qe: 0x4801,
  28379. nmps: 9,
  28380. nlps: 14,
  28381. switchFlag: 0
  28382. }, {
  28383. qe: 0x3801,
  28384. nmps: 10,
  28385. nlps: 14,
  28386. switchFlag: 0
  28387. }, {
  28388. qe: 0x3001,
  28389. nmps: 11,
  28390. nlps: 17,
  28391. switchFlag: 0
  28392. }, {
  28393. qe: 0x2401,
  28394. nmps: 12,
  28395. nlps: 18,
  28396. switchFlag: 0
  28397. }, {
  28398. qe: 0x1c01,
  28399. nmps: 13,
  28400. nlps: 20,
  28401. switchFlag: 0
  28402. }, {
  28403. qe: 0x1601,
  28404. nmps: 29,
  28405. nlps: 21,
  28406. switchFlag: 0
  28407. }, {
  28408. qe: 0x5601,
  28409. nmps: 15,
  28410. nlps: 14,
  28411. switchFlag: 1
  28412. }, {
  28413. qe: 0x5401,
  28414. nmps: 16,
  28415. nlps: 14,
  28416. switchFlag: 0
  28417. }, {
  28418. qe: 0x5101,
  28419. nmps: 17,
  28420. nlps: 15,
  28421. switchFlag: 0
  28422. }, {
  28423. qe: 0x4801,
  28424. nmps: 18,
  28425. nlps: 16,
  28426. switchFlag: 0
  28427. }, {
  28428. qe: 0x3801,
  28429. nmps: 19,
  28430. nlps: 17,
  28431. switchFlag: 0
  28432. }, {
  28433. qe: 0x3401,
  28434. nmps: 20,
  28435. nlps: 18,
  28436. switchFlag: 0
  28437. }, {
  28438. qe: 0x3001,
  28439. nmps: 21,
  28440. nlps: 19,
  28441. switchFlag: 0
  28442. }, {
  28443. qe: 0x2801,
  28444. nmps: 22,
  28445. nlps: 19,
  28446. switchFlag: 0
  28447. }, {
  28448. qe: 0x2401,
  28449. nmps: 23,
  28450. nlps: 20,
  28451. switchFlag: 0
  28452. }, {
  28453. qe: 0x2201,
  28454. nmps: 24,
  28455. nlps: 21,
  28456. switchFlag: 0
  28457. }, {
  28458. qe: 0x1c01,
  28459. nmps: 25,
  28460. nlps: 22,
  28461. switchFlag: 0
  28462. }, {
  28463. qe: 0x1801,
  28464. nmps: 26,
  28465. nlps: 23,
  28466. switchFlag: 0
  28467. }, {
  28468. qe: 0x1601,
  28469. nmps: 27,
  28470. nlps: 24,
  28471. switchFlag: 0
  28472. }, {
  28473. qe: 0x1401,
  28474. nmps: 28,
  28475. nlps: 25,
  28476. switchFlag: 0
  28477. }, {
  28478. qe: 0x1201,
  28479. nmps: 29,
  28480. nlps: 26,
  28481. switchFlag: 0
  28482. }, {
  28483. qe: 0x1101,
  28484. nmps: 30,
  28485. nlps: 27,
  28486. switchFlag: 0
  28487. }, {
  28488. qe: 0x0ac1,
  28489. nmps: 31,
  28490. nlps: 28,
  28491. switchFlag: 0
  28492. }, {
  28493. qe: 0x09c1,
  28494. nmps: 32,
  28495. nlps: 29,
  28496. switchFlag: 0
  28497. }, {
  28498. qe: 0x08a1,
  28499. nmps: 33,
  28500. nlps: 30,
  28501. switchFlag: 0
  28502. }, {
  28503. qe: 0x0521,
  28504. nmps: 34,
  28505. nlps: 31,
  28506. switchFlag: 0
  28507. }, {
  28508. qe: 0x0441,
  28509. nmps: 35,
  28510. nlps: 32,
  28511. switchFlag: 0
  28512. }, {
  28513. qe: 0x02a1,
  28514. nmps: 36,
  28515. nlps: 33,
  28516. switchFlag: 0
  28517. }, {
  28518. qe: 0x0221,
  28519. nmps: 37,
  28520. nlps: 34,
  28521. switchFlag: 0
  28522. }, {
  28523. qe: 0x0141,
  28524. nmps: 38,
  28525. nlps: 35,
  28526. switchFlag: 0
  28527. }, {
  28528. qe: 0x0111,
  28529. nmps: 39,
  28530. nlps: 36,
  28531. switchFlag: 0
  28532. }, {
  28533. qe: 0x0085,
  28534. nmps: 40,
  28535. nlps: 37,
  28536. switchFlag: 0
  28537. }, {
  28538. qe: 0x0049,
  28539. nmps: 41,
  28540. nlps: 38,
  28541. switchFlag: 0
  28542. }, {
  28543. qe: 0x0025,
  28544. nmps: 42,
  28545. nlps: 39,
  28546. switchFlag: 0
  28547. }, {
  28548. qe: 0x0015,
  28549. nmps: 43,
  28550. nlps: 40,
  28551. switchFlag: 0
  28552. }, {
  28553. qe: 0x0009,
  28554. nmps: 44,
  28555. nlps: 41,
  28556. switchFlag: 0
  28557. }, {
  28558. qe: 0x0005,
  28559. nmps: 45,
  28560. nlps: 42,
  28561. switchFlag: 0
  28562. }, {
  28563. qe: 0x0001,
  28564. nmps: 45,
  28565. nlps: 43,
  28566. switchFlag: 0
  28567. }, {
  28568. qe: 0x5601,
  28569. nmps: 46,
  28570. nlps: 46,
  28571. switchFlag: 0
  28572. }];
  28573. class ArithmeticDecoder {
  28574. constructor(data, start, end) {
  28575. this.data = data;
  28576. this.bp = start;
  28577. this.dataEnd = end;
  28578. this.chigh = data[start];
  28579. this.clow = 0;
  28580. this.byteIn();
  28581. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  28582. this.clow = this.clow << 7 & 0xffff;
  28583. this.ct -= 7;
  28584. this.a = 0x8000;
  28585. }
  28586. byteIn() {
  28587. const data = this.data;
  28588. let bp = this.bp;
  28589. if (data[bp] === 0xff) {
  28590. if (data[bp + 1] > 0x8f) {
  28591. this.clow += 0xff00;
  28592. this.ct = 8;
  28593. } else {
  28594. bp++;
  28595. this.clow += data[bp] << 9;
  28596. this.ct = 7;
  28597. this.bp = bp;
  28598. }
  28599. } else {
  28600. bp++;
  28601. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  28602. this.ct = 8;
  28603. this.bp = bp;
  28604. }
  28605. if (this.clow > 0xffff) {
  28606. this.chigh += this.clow >> 16;
  28607. this.clow &= 0xffff;
  28608. }
  28609. }
  28610. readBit(contexts, pos) {
  28611. let cx_index = contexts[pos] >> 1,
  28612. cx_mps = contexts[pos] & 1;
  28613. const qeTableIcx = QeTable[cx_index];
  28614. const qeIcx = qeTableIcx.qe;
  28615. let d;
  28616. let a = this.a - qeIcx;
  28617. if (this.chigh < qeIcx) {
  28618. if (a < qeIcx) {
  28619. a = qeIcx;
  28620. d = cx_mps;
  28621. cx_index = qeTableIcx.nmps;
  28622. } else {
  28623. a = qeIcx;
  28624. d = 1 ^ cx_mps;
  28625. if (qeTableIcx.switchFlag === 1) {
  28626. cx_mps = d;
  28627. }
  28628. cx_index = qeTableIcx.nlps;
  28629. }
  28630. } else {
  28631. this.chigh -= qeIcx;
  28632. if ((a & 0x8000) !== 0) {
  28633. this.a = a;
  28634. return cx_mps;
  28635. }
  28636. if (a < qeIcx) {
  28637. d = 1 ^ cx_mps;
  28638. if (qeTableIcx.switchFlag === 1) {
  28639. cx_mps = d;
  28640. }
  28641. cx_index = qeTableIcx.nlps;
  28642. } else {
  28643. d = cx_mps;
  28644. cx_index = qeTableIcx.nmps;
  28645. }
  28646. }
  28647. do {
  28648. if (this.ct === 0) {
  28649. this.byteIn();
  28650. }
  28651. a <<= 1;
  28652. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  28653. this.clow = this.clow << 1 & 0xffff;
  28654. this.ct--;
  28655. } while ((a & 0x8000) === 0);
  28656. this.a = a;
  28657. contexts[pos] = cx_index << 1 | cx_mps;
  28658. return d;
  28659. }
  28660. }
  28661. exports.ArithmeticDecoder = ArithmeticDecoder;
  28662. /***/ }),
  28663. /* 37 */
  28664. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28665. Object.defineProperty(exports, "__esModule", ({
  28666. value: true
  28667. }));
  28668. exports.JpegStream = void 0;
  28669. var _decode_stream = __w_pdfjs_require__(29);
  28670. var _primitives = __w_pdfjs_require__(5);
  28671. var _jpg = __w_pdfjs_require__(38);
  28672. var _util = __w_pdfjs_require__(2);
  28673. class JpegStream extends _decode_stream.DecodeStream {
  28674. constructor(stream, maybeLength, params) {
  28675. let ch;
  28676. while ((ch = stream.getByte()) !== -1) {
  28677. if (ch === 0xff) {
  28678. stream.skip(-1);
  28679. break;
  28680. }
  28681. }
  28682. super(maybeLength);
  28683. this.stream = stream;
  28684. this.dict = stream.dict;
  28685. this.maybeLength = maybeLength;
  28686. this.params = params;
  28687. }
  28688. get bytes() {
  28689. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  28690. }
  28691. ensureBuffer(requested) {}
  28692. readBlock() {
  28693. if (this.eof) {
  28694. return;
  28695. }
  28696. const jpegOptions = {
  28697. decodeTransform: undefined,
  28698. colorTransform: undefined
  28699. };
  28700. const decodeArr = this.dict.getArray("D", "Decode");
  28701. if (this.forceRGB && Array.isArray(decodeArr)) {
  28702. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  28703. const decodeArrLength = decodeArr.length;
  28704. const transform = new Int32Array(decodeArrLength);
  28705. let transformNeeded = false;
  28706. const maxValue = (1 << bitsPerComponent) - 1;
  28707. for (let i = 0; i < decodeArrLength; i += 2) {
  28708. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  28709. transform[i + 1] = decodeArr[i] * maxValue | 0;
  28710. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  28711. transformNeeded = true;
  28712. }
  28713. }
  28714. if (transformNeeded) {
  28715. jpegOptions.decodeTransform = transform;
  28716. }
  28717. }
  28718. if ((0, _primitives.isDict)(this.params)) {
  28719. const colorTransform = this.params.get("ColorTransform");
  28720. if (Number.isInteger(colorTransform)) {
  28721. jpegOptions.colorTransform = colorTransform;
  28722. }
  28723. }
  28724. const jpegImage = new _jpg.JpegImage(jpegOptions);
  28725. jpegImage.parse(this.bytes);
  28726. const data = jpegImage.getData({
  28727. width: this.drawWidth,
  28728. height: this.drawHeight,
  28729. forceRGB: this.forceRGB,
  28730. isSourcePDF: true
  28731. });
  28732. this.buffer = data;
  28733. this.bufferLength = data.length;
  28734. this.eof = true;
  28735. }
  28736. }
  28737. exports.JpegStream = JpegStream;
  28738. /***/ }),
  28739. /* 38 */
  28740. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28741. Object.defineProperty(exports, "__esModule", ({
  28742. value: true
  28743. }));
  28744. exports.JpegImage = void 0;
  28745. var _util = __w_pdfjs_require__(2);
  28746. var _core_utils = __w_pdfjs_require__(9);
  28747. class JpegError extends _util.BaseException {
  28748. constructor(msg) {
  28749. super(`JPEG error: ${msg}`, "JpegError");
  28750. }
  28751. }
  28752. class DNLMarkerError extends _util.BaseException {
  28753. constructor(message, scanLines) {
  28754. super(message, "DNLMarkerError");
  28755. this.scanLines = scanLines;
  28756. }
  28757. }
  28758. class EOIMarkerError extends _util.BaseException {
  28759. constructor(msg) {
  28760. super(msg, "EOIMarkerError");
  28761. }
  28762. }
  28763. 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]);
  28764. const dctCos1 = 4017;
  28765. const dctSin1 = 799;
  28766. const dctCos3 = 3406;
  28767. const dctSin3 = 2276;
  28768. const dctCos6 = 1567;
  28769. const dctSin6 = 3784;
  28770. const dctSqrt2 = 5793;
  28771. const dctSqrt1d2 = 2896;
  28772. function buildHuffmanTable(codeLengths, values) {
  28773. let k = 0,
  28774. i,
  28775. j,
  28776. length = 16;
  28777. while (length > 0 && !codeLengths[length - 1]) {
  28778. length--;
  28779. }
  28780. const code = [{
  28781. children: [],
  28782. index: 0
  28783. }];
  28784. let p = code[0],
  28785. q;
  28786. for (i = 0; i < length; i++) {
  28787. for (j = 0; j < codeLengths[i]; j++) {
  28788. p = code.pop();
  28789. p.children[p.index] = values[k];
  28790. while (p.index > 0) {
  28791. p = code.pop();
  28792. }
  28793. p.index++;
  28794. code.push(p);
  28795. while (code.length <= i) {
  28796. code.push(q = {
  28797. children: [],
  28798. index: 0
  28799. });
  28800. p.children[p.index] = q.children;
  28801. p = q;
  28802. }
  28803. k++;
  28804. }
  28805. if (i + 1 < length) {
  28806. code.push(q = {
  28807. children: [],
  28808. index: 0
  28809. });
  28810. p.children[p.index] = q.children;
  28811. p = q;
  28812. }
  28813. }
  28814. return code[0].children;
  28815. }
  28816. function getBlockBufferOffset(component, row, col) {
  28817. return 64 * ((component.blocksPerLine + 1) * row + col);
  28818. }
  28819. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  28820. const mcusPerLine = frame.mcusPerLine;
  28821. const progressive = frame.progressive;
  28822. const startOffset = offset;
  28823. let bitsData = 0,
  28824. bitsCount = 0;
  28825. function readBit() {
  28826. if (bitsCount > 0) {
  28827. bitsCount--;
  28828. return bitsData >> bitsCount & 1;
  28829. }
  28830. bitsData = data[offset++];
  28831. if (bitsData === 0xff) {
  28832. const nextByte = data[offset++];
  28833. if (nextByte) {
  28834. if (nextByte === 0xdc && parseDNLMarker) {
  28835. offset += 2;
  28836. const scanLines = (0, _core_utils.readUint16)(data, offset);
  28837. offset += 2;
  28838. if (scanLines > 0 && scanLines !== frame.scanLines) {
  28839. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  28840. }
  28841. } else if (nextByte === 0xd9) {
  28842. if (parseDNLMarker) {
  28843. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  28844. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  28845. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  28846. }
  28847. }
  28848. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  28849. }
  28850. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  28851. }
  28852. }
  28853. bitsCount = 7;
  28854. return bitsData >>> 7;
  28855. }
  28856. function decodeHuffman(tree) {
  28857. let node = tree;
  28858. while (true) {
  28859. node = node[readBit()];
  28860. switch (typeof node) {
  28861. case "number":
  28862. return node;
  28863. case "object":
  28864. continue;
  28865. }
  28866. throw new JpegError("invalid huffman sequence");
  28867. }
  28868. }
  28869. function receive(length) {
  28870. let n = 0;
  28871. while (length > 0) {
  28872. n = n << 1 | readBit();
  28873. length--;
  28874. }
  28875. return n;
  28876. }
  28877. function receiveAndExtend(length) {
  28878. if (length === 1) {
  28879. return readBit() === 1 ? 1 : -1;
  28880. }
  28881. const n = receive(length);
  28882. if (n >= 1 << length - 1) {
  28883. return n;
  28884. }
  28885. return n + (-1 << length) + 1;
  28886. }
  28887. function decodeBaseline(component, blockOffset) {
  28888. const t = decodeHuffman(component.huffmanTableDC);
  28889. const diff = t === 0 ? 0 : receiveAndExtend(t);
  28890. component.blockData[blockOffset] = component.pred += diff;
  28891. let k = 1;
  28892. while (k < 64) {
  28893. const rs = decodeHuffman(component.huffmanTableAC);
  28894. const s = rs & 15,
  28895. r = rs >> 4;
  28896. if (s === 0) {
  28897. if (r < 15) {
  28898. break;
  28899. }
  28900. k += 16;
  28901. continue;
  28902. }
  28903. k += r;
  28904. const z = dctZigZag[k];
  28905. component.blockData[blockOffset + z] = receiveAndExtend(s);
  28906. k++;
  28907. }
  28908. }
  28909. function decodeDCFirst(component, blockOffset) {
  28910. const t = decodeHuffman(component.huffmanTableDC);
  28911. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  28912. component.blockData[blockOffset] = component.pred += diff;
  28913. }
  28914. function decodeDCSuccessive(component, blockOffset) {
  28915. component.blockData[blockOffset] |= readBit() << successive;
  28916. }
  28917. let eobrun = 0;
  28918. function decodeACFirst(component, blockOffset) {
  28919. if (eobrun > 0) {
  28920. eobrun--;
  28921. return;
  28922. }
  28923. let k = spectralStart;
  28924. const e = spectralEnd;
  28925. while (k <= e) {
  28926. const rs = decodeHuffman(component.huffmanTableAC);
  28927. const s = rs & 15,
  28928. r = rs >> 4;
  28929. if (s === 0) {
  28930. if (r < 15) {
  28931. eobrun = receive(r) + (1 << r) - 1;
  28932. break;
  28933. }
  28934. k += 16;
  28935. continue;
  28936. }
  28937. k += r;
  28938. const z = dctZigZag[k];
  28939. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  28940. k++;
  28941. }
  28942. }
  28943. let successiveACState = 0,
  28944. successiveACNextValue;
  28945. function decodeACSuccessive(component, blockOffset) {
  28946. let k = spectralStart;
  28947. const e = spectralEnd;
  28948. let r = 0;
  28949. let s;
  28950. let rs;
  28951. while (k <= e) {
  28952. const offsetZ = blockOffset + dctZigZag[k];
  28953. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  28954. switch (successiveACState) {
  28955. case 0:
  28956. rs = decodeHuffman(component.huffmanTableAC);
  28957. s = rs & 15;
  28958. r = rs >> 4;
  28959. if (s === 0) {
  28960. if (r < 15) {
  28961. eobrun = receive(r) + (1 << r);
  28962. successiveACState = 4;
  28963. } else {
  28964. r = 16;
  28965. successiveACState = 1;
  28966. }
  28967. } else {
  28968. if (s !== 1) {
  28969. throw new JpegError("invalid ACn encoding");
  28970. }
  28971. successiveACNextValue = receiveAndExtend(s);
  28972. successiveACState = r ? 2 : 3;
  28973. }
  28974. continue;
  28975. case 1:
  28976. case 2:
  28977. if (component.blockData[offsetZ]) {
  28978. component.blockData[offsetZ] += sign * (readBit() << successive);
  28979. } else {
  28980. r--;
  28981. if (r === 0) {
  28982. successiveACState = successiveACState === 2 ? 3 : 0;
  28983. }
  28984. }
  28985. break;
  28986. case 3:
  28987. if (component.blockData[offsetZ]) {
  28988. component.blockData[offsetZ] += sign * (readBit() << successive);
  28989. } else {
  28990. component.blockData[offsetZ] = successiveACNextValue << successive;
  28991. successiveACState = 0;
  28992. }
  28993. break;
  28994. case 4:
  28995. if (component.blockData[offsetZ]) {
  28996. component.blockData[offsetZ] += sign * (readBit() << successive);
  28997. }
  28998. break;
  28999. }
  29000. k++;
  29001. }
  29002. if (successiveACState === 4) {
  29003. eobrun--;
  29004. if (eobrun === 0) {
  29005. successiveACState = 0;
  29006. }
  29007. }
  29008. }
  29009. let blockRow = 0;
  29010. function decodeMcu(component, decode, mcu, row, col) {
  29011. const mcuRow = mcu / mcusPerLine | 0;
  29012. const mcuCol = mcu % mcusPerLine;
  29013. blockRow = mcuRow * component.v + row;
  29014. const blockCol = mcuCol * component.h + col;
  29015. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29016. decode(component, blockOffset);
  29017. }
  29018. function decodeBlock(component, decode, mcu) {
  29019. blockRow = mcu / component.blocksPerLine | 0;
  29020. const blockCol = mcu % component.blocksPerLine;
  29021. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29022. decode(component, blockOffset);
  29023. }
  29024. const componentsLength = components.length;
  29025. let component, i, j, k, n;
  29026. let decodeFn;
  29027. if (progressive) {
  29028. if (spectralStart === 0) {
  29029. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  29030. } else {
  29031. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  29032. }
  29033. } else {
  29034. decodeFn = decodeBaseline;
  29035. }
  29036. let mcu = 0,
  29037. fileMarker;
  29038. let mcuExpected;
  29039. if (componentsLength === 1) {
  29040. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  29041. } else {
  29042. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  29043. }
  29044. let h, v;
  29045. while (mcu <= mcuExpected) {
  29046. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  29047. if (mcuToRead > 0) {
  29048. for (i = 0; i < componentsLength; i++) {
  29049. components[i].pred = 0;
  29050. }
  29051. eobrun = 0;
  29052. if (componentsLength === 1) {
  29053. component = components[0];
  29054. for (n = 0; n < mcuToRead; n++) {
  29055. decodeBlock(component, decodeFn, mcu);
  29056. mcu++;
  29057. }
  29058. } else {
  29059. for (n = 0; n < mcuToRead; n++) {
  29060. for (i = 0; i < componentsLength; i++) {
  29061. component = components[i];
  29062. h = component.h;
  29063. v = component.v;
  29064. for (j = 0; j < v; j++) {
  29065. for (k = 0; k < h; k++) {
  29066. decodeMcu(component, decodeFn, mcu, j, k);
  29067. }
  29068. }
  29069. }
  29070. mcu++;
  29071. }
  29072. }
  29073. }
  29074. bitsCount = 0;
  29075. fileMarker = findNextFileMarker(data, offset);
  29076. if (!fileMarker) {
  29077. break;
  29078. }
  29079. if (fileMarker.invalid) {
  29080. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  29081. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  29082. offset = fileMarker.offset;
  29083. }
  29084. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  29085. offset += 2;
  29086. } else {
  29087. break;
  29088. }
  29089. }
  29090. return offset - startOffset;
  29091. }
  29092. function quantizeAndInverse(component, blockBufferOffset, p) {
  29093. const qt = component.quantizationTable,
  29094. blockData = component.blockData;
  29095. let v0, v1, v2, v3, v4, v5, v6, v7;
  29096. let p0, p1, p2, p3, p4, p5, p6, p7;
  29097. let t;
  29098. if (!qt) {
  29099. throw new JpegError("missing required Quantization Table.");
  29100. }
  29101. for (let row = 0; row < 64; row += 8) {
  29102. p0 = blockData[blockBufferOffset + row];
  29103. p1 = blockData[blockBufferOffset + row + 1];
  29104. p2 = blockData[blockBufferOffset + row + 2];
  29105. p3 = blockData[blockBufferOffset + row + 3];
  29106. p4 = blockData[blockBufferOffset + row + 4];
  29107. p5 = blockData[blockBufferOffset + row + 5];
  29108. p6 = blockData[blockBufferOffset + row + 6];
  29109. p7 = blockData[blockBufferOffset + row + 7];
  29110. p0 *= qt[row];
  29111. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29112. t = dctSqrt2 * p0 + 512 >> 10;
  29113. p[row] = t;
  29114. p[row + 1] = t;
  29115. p[row + 2] = t;
  29116. p[row + 3] = t;
  29117. p[row + 4] = t;
  29118. p[row + 5] = t;
  29119. p[row + 6] = t;
  29120. p[row + 7] = t;
  29121. continue;
  29122. }
  29123. p1 *= qt[row + 1];
  29124. p2 *= qt[row + 2];
  29125. p3 *= qt[row + 3];
  29126. p4 *= qt[row + 4];
  29127. p5 *= qt[row + 5];
  29128. p6 *= qt[row + 6];
  29129. p7 *= qt[row + 7];
  29130. v0 = dctSqrt2 * p0 + 128 >> 8;
  29131. v1 = dctSqrt2 * p4 + 128 >> 8;
  29132. v2 = p2;
  29133. v3 = p6;
  29134. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  29135. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  29136. v5 = p3 << 4;
  29137. v6 = p5 << 4;
  29138. v0 = v0 + v1 + 1 >> 1;
  29139. v1 = v0 - v1;
  29140. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  29141. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  29142. v3 = t;
  29143. v4 = v4 + v6 + 1 >> 1;
  29144. v6 = v4 - v6;
  29145. v7 = v7 + v5 + 1 >> 1;
  29146. v5 = v7 - v5;
  29147. v0 = v0 + v3 + 1 >> 1;
  29148. v3 = v0 - v3;
  29149. v1 = v1 + v2 + 1 >> 1;
  29150. v2 = v1 - v2;
  29151. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29152. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29153. v7 = t;
  29154. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29155. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29156. v6 = t;
  29157. p[row] = v0 + v7;
  29158. p[row + 7] = v0 - v7;
  29159. p[row + 1] = v1 + v6;
  29160. p[row + 6] = v1 - v6;
  29161. p[row + 2] = v2 + v5;
  29162. p[row + 5] = v2 - v5;
  29163. p[row + 3] = v3 + v4;
  29164. p[row + 4] = v3 - v4;
  29165. }
  29166. for (let col = 0; col < 8; ++col) {
  29167. p0 = p[col];
  29168. p1 = p[col + 8];
  29169. p2 = p[col + 16];
  29170. p3 = p[col + 24];
  29171. p4 = p[col + 32];
  29172. p5 = p[col + 40];
  29173. p6 = p[col + 48];
  29174. p7 = p[col + 56];
  29175. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29176. t = dctSqrt2 * p0 + 8192 >> 14;
  29177. if (t < -2040) {
  29178. t = 0;
  29179. } else if (t >= 2024) {
  29180. t = 255;
  29181. } else {
  29182. t = t + 2056 >> 4;
  29183. }
  29184. blockData[blockBufferOffset + col] = t;
  29185. blockData[blockBufferOffset + col + 8] = t;
  29186. blockData[blockBufferOffset + col + 16] = t;
  29187. blockData[blockBufferOffset + col + 24] = t;
  29188. blockData[blockBufferOffset + col + 32] = t;
  29189. blockData[blockBufferOffset + col + 40] = t;
  29190. blockData[blockBufferOffset + col + 48] = t;
  29191. blockData[blockBufferOffset + col + 56] = t;
  29192. continue;
  29193. }
  29194. v0 = dctSqrt2 * p0 + 2048 >> 12;
  29195. v1 = dctSqrt2 * p4 + 2048 >> 12;
  29196. v2 = p2;
  29197. v3 = p6;
  29198. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  29199. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  29200. v5 = p3;
  29201. v6 = p5;
  29202. v0 = (v0 + v1 + 1 >> 1) + 4112;
  29203. v1 = v0 - v1;
  29204. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  29205. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  29206. v3 = t;
  29207. v4 = v4 + v6 + 1 >> 1;
  29208. v6 = v4 - v6;
  29209. v7 = v7 + v5 + 1 >> 1;
  29210. v5 = v7 - v5;
  29211. v0 = v0 + v3 + 1 >> 1;
  29212. v3 = v0 - v3;
  29213. v1 = v1 + v2 + 1 >> 1;
  29214. v2 = v1 - v2;
  29215. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29216. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29217. v7 = t;
  29218. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29219. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29220. v6 = t;
  29221. p0 = v0 + v7;
  29222. p7 = v0 - v7;
  29223. p1 = v1 + v6;
  29224. p6 = v1 - v6;
  29225. p2 = v2 + v5;
  29226. p5 = v2 - v5;
  29227. p3 = v3 + v4;
  29228. p4 = v3 - v4;
  29229. if (p0 < 16) {
  29230. p0 = 0;
  29231. } else if (p0 >= 4080) {
  29232. p0 = 255;
  29233. } else {
  29234. p0 >>= 4;
  29235. }
  29236. if (p1 < 16) {
  29237. p1 = 0;
  29238. } else if (p1 >= 4080) {
  29239. p1 = 255;
  29240. } else {
  29241. p1 >>= 4;
  29242. }
  29243. if (p2 < 16) {
  29244. p2 = 0;
  29245. } else if (p2 >= 4080) {
  29246. p2 = 255;
  29247. } else {
  29248. p2 >>= 4;
  29249. }
  29250. if (p3 < 16) {
  29251. p3 = 0;
  29252. } else if (p3 >= 4080) {
  29253. p3 = 255;
  29254. } else {
  29255. p3 >>= 4;
  29256. }
  29257. if (p4 < 16) {
  29258. p4 = 0;
  29259. } else if (p4 >= 4080) {
  29260. p4 = 255;
  29261. } else {
  29262. p4 >>= 4;
  29263. }
  29264. if (p5 < 16) {
  29265. p5 = 0;
  29266. } else if (p5 >= 4080) {
  29267. p5 = 255;
  29268. } else {
  29269. p5 >>= 4;
  29270. }
  29271. if (p6 < 16) {
  29272. p6 = 0;
  29273. } else if (p6 >= 4080) {
  29274. p6 = 255;
  29275. } else {
  29276. p6 >>= 4;
  29277. }
  29278. if (p7 < 16) {
  29279. p7 = 0;
  29280. } else if (p7 >= 4080) {
  29281. p7 = 255;
  29282. } else {
  29283. p7 >>= 4;
  29284. }
  29285. blockData[blockBufferOffset + col] = p0;
  29286. blockData[blockBufferOffset + col + 8] = p1;
  29287. blockData[blockBufferOffset + col + 16] = p2;
  29288. blockData[blockBufferOffset + col + 24] = p3;
  29289. blockData[blockBufferOffset + col + 32] = p4;
  29290. blockData[blockBufferOffset + col + 40] = p5;
  29291. blockData[blockBufferOffset + col + 48] = p6;
  29292. blockData[blockBufferOffset + col + 56] = p7;
  29293. }
  29294. }
  29295. function buildComponentData(frame, component) {
  29296. const blocksPerLine = component.blocksPerLine;
  29297. const blocksPerColumn = component.blocksPerColumn;
  29298. const computationBuffer = new Int16Array(64);
  29299. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  29300. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  29301. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  29302. quantizeAndInverse(component, offset, computationBuffer);
  29303. }
  29304. }
  29305. return component.blockData;
  29306. }
  29307. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  29308. const maxPos = data.length - 1;
  29309. let newPos = startPos < currentPos ? startPos : currentPos;
  29310. if (currentPos >= maxPos) {
  29311. return null;
  29312. }
  29313. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  29314. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  29315. return {
  29316. invalid: null,
  29317. marker: currentMarker,
  29318. offset: currentPos
  29319. };
  29320. }
  29321. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  29322. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  29323. if (++newPos >= maxPos) {
  29324. return null;
  29325. }
  29326. newMarker = (0, _core_utils.readUint16)(data, newPos);
  29327. }
  29328. return {
  29329. invalid: currentMarker.toString(16),
  29330. marker: newMarker,
  29331. offset: newPos
  29332. };
  29333. }
  29334. class JpegImage {
  29335. constructor({
  29336. decodeTransform = null,
  29337. colorTransform = -1
  29338. } = {}) {
  29339. this._decodeTransform = decodeTransform;
  29340. this._colorTransform = colorTransform;
  29341. }
  29342. parse(data, {
  29343. dnlScanLines = null
  29344. } = {}) {
  29345. function readDataBlock() {
  29346. const length = (0, _core_utils.readUint16)(data, offset);
  29347. offset += 2;
  29348. let endOffset = offset + length - 2;
  29349. const fileMarker = findNextFileMarker(data, endOffset, offset);
  29350. if (fileMarker && fileMarker.invalid) {
  29351. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  29352. endOffset = fileMarker.offset;
  29353. }
  29354. const array = data.subarray(offset, endOffset);
  29355. offset += array.length;
  29356. return array;
  29357. }
  29358. function prepareComponents(frame) {
  29359. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  29360. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  29361. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29362. const component = frame.components[i];
  29363. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  29364. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  29365. const blocksPerLineForMcu = mcusPerLine * component.h;
  29366. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  29367. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  29368. component.blockData = new Int16Array(blocksBufferSize);
  29369. component.blocksPerLine = blocksPerLine;
  29370. component.blocksPerColumn = blocksPerColumn;
  29371. }
  29372. frame.mcusPerLine = mcusPerLine;
  29373. frame.mcusPerColumn = mcusPerColumn;
  29374. }
  29375. let offset = 0;
  29376. let jfif = null;
  29377. let adobe = null;
  29378. let frame, resetInterval;
  29379. let numSOSMarkers = 0;
  29380. const quantizationTables = [];
  29381. const huffmanTablesAC = [],
  29382. huffmanTablesDC = [];
  29383. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  29384. offset += 2;
  29385. if (fileMarker !== 0xffd8) {
  29386. throw new JpegError("SOI not found");
  29387. }
  29388. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29389. offset += 2;
  29390. markerLoop: while (fileMarker !== 0xffd9) {
  29391. let i, j, l;
  29392. switch (fileMarker) {
  29393. case 0xffe0:
  29394. case 0xffe1:
  29395. case 0xffe2:
  29396. case 0xffe3:
  29397. case 0xffe4:
  29398. case 0xffe5:
  29399. case 0xffe6:
  29400. case 0xffe7:
  29401. case 0xffe8:
  29402. case 0xffe9:
  29403. case 0xffea:
  29404. case 0xffeb:
  29405. case 0xffec:
  29406. case 0xffed:
  29407. case 0xffee:
  29408. case 0xffef:
  29409. case 0xfffe:
  29410. const appData = readDataBlock();
  29411. if (fileMarker === 0xffe0) {
  29412. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  29413. jfif = {
  29414. version: {
  29415. major: appData[5],
  29416. minor: appData[6]
  29417. },
  29418. densityUnits: appData[7],
  29419. xDensity: appData[8] << 8 | appData[9],
  29420. yDensity: appData[10] << 8 | appData[11],
  29421. thumbWidth: appData[12],
  29422. thumbHeight: appData[13],
  29423. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  29424. };
  29425. }
  29426. }
  29427. if (fileMarker === 0xffee) {
  29428. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  29429. adobe = {
  29430. version: appData[5] << 8 | appData[6],
  29431. flags0: appData[7] << 8 | appData[8],
  29432. flags1: appData[9] << 8 | appData[10],
  29433. transformCode: appData[11]
  29434. };
  29435. }
  29436. }
  29437. break;
  29438. case 0xffdb:
  29439. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  29440. offset += 2;
  29441. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  29442. let z;
  29443. while (offset < quantizationTablesEnd) {
  29444. const quantizationTableSpec = data[offset++];
  29445. const tableData = new Uint16Array(64);
  29446. if (quantizationTableSpec >> 4 === 0) {
  29447. for (j = 0; j < 64; j++) {
  29448. z = dctZigZag[j];
  29449. tableData[z] = data[offset++];
  29450. }
  29451. } else if (quantizationTableSpec >> 4 === 1) {
  29452. for (j = 0; j < 64; j++) {
  29453. z = dctZigZag[j];
  29454. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  29455. offset += 2;
  29456. }
  29457. } else {
  29458. throw new JpegError("DQT - invalid table spec");
  29459. }
  29460. quantizationTables[quantizationTableSpec & 15] = tableData;
  29461. }
  29462. break;
  29463. case 0xffc0:
  29464. case 0xffc1:
  29465. case 0xffc2:
  29466. if (frame) {
  29467. throw new JpegError("Only single frame JPEGs supported");
  29468. }
  29469. offset += 2;
  29470. frame = {};
  29471. frame.extended = fileMarker === 0xffc1;
  29472. frame.progressive = fileMarker === 0xffc2;
  29473. frame.precision = data[offset++];
  29474. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  29475. offset += 2;
  29476. frame.scanLines = dnlScanLines || sofScanLines;
  29477. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  29478. offset += 2;
  29479. frame.components = [];
  29480. frame.componentIds = {};
  29481. const componentsCount = data[offset++];
  29482. let maxH = 0,
  29483. maxV = 0;
  29484. for (i = 0; i < componentsCount; i++) {
  29485. const componentId = data[offset];
  29486. const h = data[offset + 1] >> 4;
  29487. const v = data[offset + 1] & 15;
  29488. if (maxH < h) {
  29489. maxH = h;
  29490. }
  29491. if (maxV < v) {
  29492. maxV = v;
  29493. }
  29494. const qId = data[offset + 2];
  29495. l = frame.components.push({
  29496. h,
  29497. v,
  29498. quantizationId: qId,
  29499. quantizationTable: null
  29500. });
  29501. frame.componentIds[componentId] = l - 1;
  29502. offset += 3;
  29503. }
  29504. frame.maxH = maxH;
  29505. frame.maxV = maxV;
  29506. prepareComponents(frame);
  29507. break;
  29508. case 0xffc4:
  29509. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  29510. offset += 2;
  29511. for (i = 2; i < huffmanLength;) {
  29512. const huffmanTableSpec = data[offset++];
  29513. const codeLengths = new Uint8Array(16);
  29514. let codeLengthSum = 0;
  29515. for (j = 0; j < 16; j++, offset++) {
  29516. codeLengthSum += codeLengths[j] = data[offset];
  29517. }
  29518. const huffmanValues = new Uint8Array(codeLengthSum);
  29519. for (j = 0; j < codeLengthSum; j++, offset++) {
  29520. huffmanValues[j] = data[offset];
  29521. }
  29522. i += 17 + codeLengthSum;
  29523. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  29524. }
  29525. break;
  29526. case 0xffdd:
  29527. offset += 2;
  29528. resetInterval = (0, _core_utils.readUint16)(data, offset);
  29529. offset += 2;
  29530. break;
  29531. case 0xffda:
  29532. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  29533. offset += 2;
  29534. const selectorsCount = data[offset++],
  29535. components = [];
  29536. for (i = 0; i < selectorsCount; i++) {
  29537. const index = data[offset++];
  29538. const componentIndex = frame.componentIds[index];
  29539. const component = frame.components[componentIndex];
  29540. component.index = index;
  29541. const tableSpec = data[offset++];
  29542. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  29543. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  29544. components.push(component);
  29545. }
  29546. const spectralStart = data[offset++],
  29547. spectralEnd = data[offset++],
  29548. successiveApproximation = data[offset++];
  29549. try {
  29550. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  29551. offset += processed;
  29552. } catch (ex) {
  29553. if (ex instanceof DNLMarkerError) {
  29554. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  29555. return this.parse(data, {
  29556. dnlScanLines: ex.scanLines
  29557. });
  29558. } else if (ex instanceof EOIMarkerError) {
  29559. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  29560. break markerLoop;
  29561. }
  29562. throw ex;
  29563. }
  29564. break;
  29565. case 0xffdc:
  29566. offset += 4;
  29567. break;
  29568. case 0xffff:
  29569. if (data[offset] !== 0xff) {
  29570. offset--;
  29571. }
  29572. break;
  29573. default:
  29574. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  29575. if (nextFileMarker && nextFileMarker.invalid) {
  29576. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  29577. offset = nextFileMarker.offset;
  29578. break;
  29579. }
  29580. if (!nextFileMarker || offset >= data.length - 1) {
  29581. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  29582. break markerLoop;
  29583. }
  29584. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  29585. }
  29586. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29587. offset += 2;
  29588. }
  29589. this.width = frame.samplesPerLine;
  29590. this.height = frame.scanLines;
  29591. this.jfif = jfif;
  29592. this.adobe = adobe;
  29593. this.components = [];
  29594. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29595. const component = frame.components[i];
  29596. const quantizationTable = quantizationTables[component.quantizationId];
  29597. if (quantizationTable) {
  29598. component.quantizationTable = quantizationTable;
  29599. }
  29600. this.components.push({
  29601. index: component.index,
  29602. output: buildComponentData(frame, component),
  29603. scaleX: component.h / frame.maxH,
  29604. scaleY: component.v / frame.maxV,
  29605. blocksPerLine: component.blocksPerLine,
  29606. blocksPerColumn: component.blocksPerColumn
  29607. });
  29608. }
  29609. this.numComponents = this.components.length;
  29610. return undefined;
  29611. }
  29612. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  29613. const scaleX = this.width / width,
  29614. scaleY = this.height / height;
  29615. let component, componentScaleX, componentScaleY, blocksPerScanline;
  29616. let x, y, i, j, k;
  29617. let index;
  29618. let offset = 0;
  29619. let output;
  29620. const numComponents = this.components.length;
  29621. const dataLength = width * height * numComponents;
  29622. const data = new Uint8ClampedArray(dataLength);
  29623. const xScaleBlockOffset = new Uint32Array(width);
  29624. const mask3LSB = 0xfffffff8;
  29625. let lastComponentScaleX;
  29626. for (i = 0; i < numComponents; i++) {
  29627. component = this.components[i];
  29628. componentScaleX = component.scaleX * scaleX;
  29629. componentScaleY = component.scaleY * scaleY;
  29630. offset = i;
  29631. output = component.output;
  29632. blocksPerScanline = component.blocksPerLine + 1 << 3;
  29633. if (componentScaleX !== lastComponentScaleX) {
  29634. for (x = 0; x < width; x++) {
  29635. j = 0 | x * componentScaleX;
  29636. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  29637. }
  29638. lastComponentScaleX = componentScaleX;
  29639. }
  29640. for (y = 0; y < height; y++) {
  29641. j = 0 | y * componentScaleY;
  29642. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  29643. for (x = 0; x < width; x++) {
  29644. data[offset] = output[index + xScaleBlockOffset[x]];
  29645. offset += numComponents;
  29646. }
  29647. }
  29648. }
  29649. let transform = this._decodeTransform;
  29650. if (!isSourcePDF && numComponents === 4 && !transform) {
  29651. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  29652. }
  29653. if (transform) {
  29654. for (i = 0; i < dataLength;) {
  29655. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  29656. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  29657. }
  29658. }
  29659. }
  29660. return data;
  29661. }
  29662. get _isColorConversionNeeded() {
  29663. if (this.adobe) {
  29664. return !!this.adobe.transformCode;
  29665. }
  29666. if (this.numComponents === 3) {
  29667. if (this._colorTransform === 0) {
  29668. return false;
  29669. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  29670. return false;
  29671. }
  29672. return true;
  29673. }
  29674. if (this._colorTransform === 1) {
  29675. return true;
  29676. }
  29677. return false;
  29678. }
  29679. _convertYccToRgb(data) {
  29680. let Y, Cb, Cr;
  29681. for (let i = 0, length = data.length; i < length; i += 3) {
  29682. Y = data[i];
  29683. Cb = data[i + 1];
  29684. Cr = data[i + 2];
  29685. data[i] = Y - 179.456 + 1.402 * Cr;
  29686. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  29687. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  29688. }
  29689. return data;
  29690. }
  29691. _convertYcckToRgb(data) {
  29692. let Y, Cb, Cr, k;
  29693. let offset = 0;
  29694. for (let i = 0, length = data.length; i < length; i += 4) {
  29695. Y = data[i];
  29696. Cb = data[i + 1];
  29697. Cr = data[i + 2];
  29698. k = data[i + 3];
  29699. 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);
  29700. 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);
  29701. 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);
  29702. }
  29703. return data.subarray(0, offset);
  29704. }
  29705. _convertYcckToCmyk(data) {
  29706. let Y, Cb, Cr;
  29707. for (let i = 0, length = data.length; i < length; i += 4) {
  29708. Y = data[i];
  29709. Cb = data[i + 1];
  29710. Cr = data[i + 2];
  29711. data[i] = 434.456 - Y - 1.402 * Cr;
  29712. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  29713. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  29714. }
  29715. return data;
  29716. }
  29717. _convertCmykToRgb(data) {
  29718. let c, m, y, k;
  29719. let offset = 0;
  29720. for (let i = 0, length = data.length; i < length; i += 4) {
  29721. c = data[i];
  29722. m = data[i + 1];
  29723. y = data[i + 2];
  29724. k = data[i + 3];
  29725. 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);
  29726. 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.0003189131175883281 * k + 0.7364883807733168);
  29727. 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);
  29728. }
  29729. return data.subarray(0, offset);
  29730. }
  29731. getData({
  29732. width,
  29733. height,
  29734. forceRGB = false,
  29735. isSourcePDF = false
  29736. }) {
  29737. if (this.numComponents > 4) {
  29738. throw new JpegError("Unsupported color mode");
  29739. }
  29740. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  29741. if (this.numComponents === 1 && forceRGB) {
  29742. const dataLength = data.length;
  29743. const rgbData = new Uint8ClampedArray(dataLength * 3);
  29744. let offset = 0;
  29745. for (let i = 0; i < dataLength; i++) {
  29746. const grayColor = data[i];
  29747. rgbData[offset++] = grayColor;
  29748. rgbData[offset++] = grayColor;
  29749. rgbData[offset++] = grayColor;
  29750. }
  29751. return rgbData;
  29752. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  29753. return this._convertYccToRgb(data);
  29754. } else if (this.numComponents === 4) {
  29755. if (this._isColorConversionNeeded) {
  29756. if (forceRGB) {
  29757. return this._convertYcckToRgb(data);
  29758. }
  29759. return this._convertYcckToCmyk(data);
  29760. } else if (forceRGB) {
  29761. return this._convertCmykToRgb(data);
  29762. }
  29763. }
  29764. return data;
  29765. }
  29766. }
  29767. exports.JpegImage = JpegImage;
  29768. /***/ }),
  29769. /* 39 */
  29770. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29771. Object.defineProperty(exports, "__esModule", ({
  29772. value: true
  29773. }));
  29774. exports.JpxStream = void 0;
  29775. var _decode_stream = __w_pdfjs_require__(29);
  29776. var _jpx = __w_pdfjs_require__(40);
  29777. var _util = __w_pdfjs_require__(2);
  29778. class JpxStream extends _decode_stream.DecodeStream {
  29779. constructor(stream, maybeLength, params) {
  29780. super(maybeLength);
  29781. this.stream = stream;
  29782. this.dict = stream.dict;
  29783. this.maybeLength = maybeLength;
  29784. this.params = params;
  29785. }
  29786. get bytes() {
  29787. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29788. }
  29789. ensureBuffer(requested) {}
  29790. readBlock() {
  29791. if (this.eof) {
  29792. return;
  29793. }
  29794. const jpxImage = new _jpx.JpxImage();
  29795. jpxImage.parse(this.bytes);
  29796. const width = jpxImage.width;
  29797. const height = jpxImage.height;
  29798. const componentsCount = jpxImage.componentsCount;
  29799. const tileCount = jpxImage.tiles.length;
  29800. if (tileCount === 1) {
  29801. this.buffer = jpxImage.tiles[0].items;
  29802. } else {
  29803. const data = new Uint8ClampedArray(width * height * componentsCount);
  29804. for (let k = 0; k < tileCount; k++) {
  29805. const tileComponents = jpxImage.tiles[k];
  29806. const tileWidth = tileComponents.width;
  29807. const tileHeight = tileComponents.height;
  29808. const tileLeft = tileComponents.left;
  29809. const tileTop = tileComponents.top;
  29810. const src = tileComponents.items;
  29811. let srcPosition = 0;
  29812. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  29813. const imgRowSize = width * componentsCount;
  29814. const tileRowSize = tileWidth * componentsCount;
  29815. for (let j = 0; j < tileHeight; j++) {
  29816. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  29817. data.set(rowBytes, dataPosition);
  29818. srcPosition += tileRowSize;
  29819. dataPosition += imgRowSize;
  29820. }
  29821. }
  29822. this.buffer = data;
  29823. }
  29824. this.bufferLength = this.buffer.length;
  29825. this.eof = true;
  29826. }
  29827. }
  29828. exports.JpxStream = JpxStream;
  29829. /***/ }),
  29830. /* 40 */
  29831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29832. Object.defineProperty(exports, "__esModule", ({
  29833. value: true
  29834. }));
  29835. exports.JpxImage = void 0;
  29836. var _util = __w_pdfjs_require__(2);
  29837. var _core_utils = __w_pdfjs_require__(9);
  29838. var _arithmetic_decoder = __w_pdfjs_require__(36);
  29839. class JpxError extends _util.BaseException {
  29840. constructor(msg) {
  29841. super(`JPX error: ${msg}`, "JpxError");
  29842. }
  29843. }
  29844. const SubbandsGainLog2 = {
  29845. LL: 0,
  29846. LH: 1,
  29847. HL: 1,
  29848. HH: 2
  29849. };
  29850. class JpxImage {
  29851. constructor() {
  29852. this.failOnCorruptedImage = false;
  29853. }
  29854. parse(data) {
  29855. const head = (0, _core_utils.readUint16)(data, 0);
  29856. if (head === 0xff4f) {
  29857. this.parseCodestream(data, 0, data.length);
  29858. return;
  29859. }
  29860. const length = data.length;
  29861. let position = 0;
  29862. while (position < length) {
  29863. let headerSize = 8;
  29864. let lbox = (0, _core_utils.readUint32)(data, position);
  29865. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  29866. position += headerSize;
  29867. if (lbox === 1) {
  29868. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  29869. position += 8;
  29870. headerSize += 8;
  29871. }
  29872. if (lbox === 0) {
  29873. lbox = length - position + headerSize;
  29874. }
  29875. if (lbox < headerSize) {
  29876. throw new JpxError("Invalid box field size");
  29877. }
  29878. const dataLength = lbox - headerSize;
  29879. let jumpDataLength = true;
  29880. switch (tbox) {
  29881. case 0x6a703268:
  29882. jumpDataLength = false;
  29883. break;
  29884. case 0x636f6c72:
  29885. const method = data[position];
  29886. if (method === 1) {
  29887. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  29888. switch (colorspace) {
  29889. case 16:
  29890. case 17:
  29891. case 18:
  29892. break;
  29893. default:
  29894. (0, _util.warn)("Unknown colorspace " + colorspace);
  29895. break;
  29896. }
  29897. } else if (method === 2) {
  29898. (0, _util.info)("ICC profile not supported");
  29899. }
  29900. break;
  29901. case 0x6a703263:
  29902. this.parseCodestream(data, position, position + dataLength);
  29903. break;
  29904. case 0x6a502020:
  29905. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  29906. (0, _util.warn)("Invalid JP2 signature");
  29907. }
  29908. break;
  29909. case 0x6a501a1a:
  29910. case 0x66747970:
  29911. case 0x72726571:
  29912. case 0x72657320:
  29913. case 0x69686472:
  29914. break;
  29915. default:
  29916. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  29917. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  29918. break;
  29919. }
  29920. if (jumpDataLength) {
  29921. position += dataLength;
  29922. }
  29923. }
  29924. }
  29925. parseImageProperties(stream) {
  29926. let newByte = stream.getByte();
  29927. while (newByte >= 0) {
  29928. const oldByte = newByte;
  29929. newByte = stream.getByte();
  29930. const code = oldByte << 8 | newByte;
  29931. if (code === 0xff51) {
  29932. stream.skip(4);
  29933. const Xsiz = stream.getInt32() >>> 0;
  29934. const Ysiz = stream.getInt32() >>> 0;
  29935. const XOsiz = stream.getInt32() >>> 0;
  29936. const YOsiz = stream.getInt32() >>> 0;
  29937. stream.skip(16);
  29938. const Csiz = stream.getUint16();
  29939. this.width = Xsiz - XOsiz;
  29940. this.height = Ysiz - YOsiz;
  29941. this.componentsCount = Csiz;
  29942. this.bitsPerComponent = 8;
  29943. return;
  29944. }
  29945. }
  29946. throw new JpxError("No size marker found in JPX stream");
  29947. }
  29948. parseCodestream(data, start, end) {
  29949. const context = {};
  29950. let doNotRecover = false;
  29951. try {
  29952. let position = start;
  29953. while (position + 1 < end) {
  29954. const code = (0, _core_utils.readUint16)(data, position);
  29955. position += 2;
  29956. let length = 0,
  29957. j,
  29958. sqcd,
  29959. spqcds,
  29960. spqcdSize,
  29961. scalarExpounded,
  29962. tile;
  29963. switch (code) {
  29964. case 0xff4f:
  29965. context.mainHeader = true;
  29966. break;
  29967. case 0xffd9:
  29968. break;
  29969. case 0xff51:
  29970. length = (0, _core_utils.readUint16)(data, position);
  29971. const siz = {};
  29972. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  29973. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  29974. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  29975. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  29976. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  29977. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  29978. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  29979. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  29980. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  29981. siz.Csiz = componentsCount;
  29982. const components = [];
  29983. j = position + 38;
  29984. for (let i = 0; i < componentsCount; i++) {
  29985. const component = {
  29986. precision: (data[j] & 0x7f) + 1,
  29987. isSigned: !!(data[j] & 0x80),
  29988. XRsiz: data[j + 1],
  29989. YRsiz: data[j + 2]
  29990. };
  29991. j += 3;
  29992. calculateComponentDimensions(component, siz);
  29993. components.push(component);
  29994. }
  29995. context.SIZ = siz;
  29996. context.components = components;
  29997. calculateTileGrids(context, components);
  29998. context.QCC = [];
  29999. context.COC = [];
  30000. break;
  30001. case 0xff5c:
  30002. length = (0, _core_utils.readUint16)(data, position);
  30003. const qcd = {};
  30004. j = position + 2;
  30005. sqcd = data[j++];
  30006. switch (sqcd & 0x1f) {
  30007. case 0:
  30008. spqcdSize = 8;
  30009. scalarExpounded = true;
  30010. break;
  30011. case 1:
  30012. spqcdSize = 16;
  30013. scalarExpounded = false;
  30014. break;
  30015. case 2:
  30016. spqcdSize = 16;
  30017. scalarExpounded = true;
  30018. break;
  30019. default:
  30020. throw new Error("Invalid SQcd value " + sqcd);
  30021. }
  30022. qcd.noQuantization = spqcdSize === 8;
  30023. qcd.scalarExpounded = scalarExpounded;
  30024. qcd.guardBits = sqcd >> 5;
  30025. spqcds = [];
  30026. while (j < length + position) {
  30027. const spqcd = {};
  30028. if (spqcdSize === 8) {
  30029. spqcd.epsilon = data[j++] >> 3;
  30030. spqcd.mu = 0;
  30031. } else {
  30032. spqcd.epsilon = data[j] >> 3;
  30033. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30034. j += 2;
  30035. }
  30036. spqcds.push(spqcd);
  30037. }
  30038. qcd.SPqcds = spqcds;
  30039. if (context.mainHeader) {
  30040. context.QCD = qcd;
  30041. } else {
  30042. context.currentTile.QCD = qcd;
  30043. context.currentTile.QCC = [];
  30044. }
  30045. break;
  30046. case 0xff5d:
  30047. length = (0, _core_utils.readUint16)(data, position);
  30048. const qcc = {};
  30049. j = position + 2;
  30050. let cqcc;
  30051. if (context.SIZ.Csiz < 257) {
  30052. cqcc = data[j++];
  30053. } else {
  30054. cqcc = (0, _core_utils.readUint16)(data, j);
  30055. j += 2;
  30056. }
  30057. sqcd = data[j++];
  30058. switch (sqcd & 0x1f) {
  30059. case 0:
  30060. spqcdSize = 8;
  30061. scalarExpounded = true;
  30062. break;
  30063. case 1:
  30064. spqcdSize = 16;
  30065. scalarExpounded = false;
  30066. break;
  30067. case 2:
  30068. spqcdSize = 16;
  30069. scalarExpounded = true;
  30070. break;
  30071. default:
  30072. throw new Error("Invalid SQcd value " + sqcd);
  30073. }
  30074. qcc.noQuantization = spqcdSize === 8;
  30075. qcc.scalarExpounded = scalarExpounded;
  30076. qcc.guardBits = sqcd >> 5;
  30077. spqcds = [];
  30078. while (j < length + position) {
  30079. const spqcd = {};
  30080. if (spqcdSize === 8) {
  30081. spqcd.epsilon = data[j++] >> 3;
  30082. spqcd.mu = 0;
  30083. } else {
  30084. spqcd.epsilon = data[j] >> 3;
  30085. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30086. j += 2;
  30087. }
  30088. spqcds.push(spqcd);
  30089. }
  30090. qcc.SPqcds = spqcds;
  30091. if (context.mainHeader) {
  30092. context.QCC[cqcc] = qcc;
  30093. } else {
  30094. context.currentTile.QCC[cqcc] = qcc;
  30095. }
  30096. break;
  30097. case 0xff52:
  30098. length = (0, _core_utils.readUint16)(data, position);
  30099. const cod = {};
  30100. j = position + 2;
  30101. const scod = data[j++];
  30102. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  30103. cod.sopMarkerUsed = !!(scod & 2);
  30104. cod.ephMarkerUsed = !!(scod & 4);
  30105. cod.progressionOrder = data[j++];
  30106. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  30107. j += 2;
  30108. cod.multipleComponentTransform = data[j++];
  30109. cod.decompositionLevelsCount = data[j++];
  30110. cod.xcb = (data[j++] & 0xf) + 2;
  30111. cod.ycb = (data[j++] & 0xf) + 2;
  30112. const blockStyle = data[j++];
  30113. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  30114. cod.resetContextProbabilities = !!(blockStyle & 2);
  30115. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  30116. cod.verticallyStripe = !!(blockStyle & 8);
  30117. cod.predictableTermination = !!(blockStyle & 16);
  30118. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  30119. cod.reversibleTransformation = data[j++];
  30120. if (cod.entropyCoderWithCustomPrecincts) {
  30121. const precinctsSizes = [];
  30122. while (j < length + position) {
  30123. const precinctsSize = data[j++];
  30124. precinctsSizes.push({
  30125. PPx: precinctsSize & 0xf,
  30126. PPy: precinctsSize >> 4
  30127. });
  30128. }
  30129. cod.precinctsSizes = precinctsSizes;
  30130. }
  30131. const unsupported = [];
  30132. if (cod.selectiveArithmeticCodingBypass) {
  30133. unsupported.push("selectiveArithmeticCodingBypass");
  30134. }
  30135. if (cod.resetContextProbabilities) {
  30136. unsupported.push("resetContextProbabilities");
  30137. }
  30138. if (cod.terminationOnEachCodingPass) {
  30139. unsupported.push("terminationOnEachCodingPass");
  30140. }
  30141. if (cod.verticallyStripe) {
  30142. unsupported.push("verticallyStripe");
  30143. }
  30144. if (cod.predictableTermination) {
  30145. unsupported.push("predictableTermination");
  30146. }
  30147. if (unsupported.length > 0) {
  30148. doNotRecover = true;
  30149. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  30150. }
  30151. if (context.mainHeader) {
  30152. context.COD = cod;
  30153. } else {
  30154. context.currentTile.COD = cod;
  30155. context.currentTile.COC = [];
  30156. }
  30157. break;
  30158. case 0xff90:
  30159. length = (0, _core_utils.readUint16)(data, position);
  30160. tile = {};
  30161. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  30162. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  30163. tile.dataEnd = tile.length + position - 2;
  30164. tile.partIndex = data[position + 8];
  30165. tile.partsCount = data[position + 9];
  30166. context.mainHeader = false;
  30167. if (tile.partIndex === 0) {
  30168. tile.COD = context.COD;
  30169. tile.COC = context.COC.slice(0);
  30170. tile.QCD = context.QCD;
  30171. tile.QCC = context.QCC.slice(0);
  30172. }
  30173. context.currentTile = tile;
  30174. break;
  30175. case 0xff93:
  30176. tile = context.currentTile;
  30177. if (tile.partIndex === 0) {
  30178. initializeTile(context, tile.index);
  30179. buildPackets(context);
  30180. }
  30181. length = tile.dataEnd - position;
  30182. parseTilePackets(context, data, position, length);
  30183. break;
  30184. case 0xff53:
  30185. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  30186. case 0xff55:
  30187. case 0xff57:
  30188. case 0xff58:
  30189. case 0xff64:
  30190. length = (0, _core_utils.readUint16)(data, position);
  30191. break;
  30192. default:
  30193. throw new Error("Unknown codestream code: " + code.toString(16));
  30194. }
  30195. position += length;
  30196. }
  30197. } catch (e) {
  30198. if (doNotRecover || this.failOnCorruptedImage) {
  30199. throw new JpxError(e.message);
  30200. } else {
  30201. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  30202. }
  30203. }
  30204. this.tiles = transformComponents(context);
  30205. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  30206. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  30207. this.componentsCount = context.SIZ.Csiz;
  30208. }
  30209. }
  30210. exports.JpxImage = JpxImage;
  30211. function calculateComponentDimensions(component, siz) {
  30212. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  30213. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  30214. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  30215. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  30216. component.width = component.x1 - component.x0;
  30217. component.height = component.y1 - component.y0;
  30218. }
  30219. function calculateTileGrids(context, components) {
  30220. const siz = context.SIZ;
  30221. const tiles = [];
  30222. let tile;
  30223. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  30224. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  30225. for (let q = 0; q < numYtiles; q++) {
  30226. for (let p = 0; p < numXtiles; p++) {
  30227. tile = {};
  30228. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  30229. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  30230. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  30231. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  30232. tile.width = tile.tx1 - tile.tx0;
  30233. tile.height = tile.ty1 - tile.ty0;
  30234. tile.components = [];
  30235. tiles.push(tile);
  30236. }
  30237. }
  30238. context.tiles = tiles;
  30239. const componentsCount = siz.Csiz;
  30240. for (let i = 0, ii = componentsCount; i < ii; i++) {
  30241. const component = components[i];
  30242. for (let j = 0, jj = tiles.length; j < jj; j++) {
  30243. const tileComponent = {};
  30244. tile = tiles[j];
  30245. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  30246. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  30247. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  30248. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  30249. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  30250. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  30251. tile.components[i] = tileComponent;
  30252. }
  30253. }
  30254. }
  30255. function getBlocksDimensions(context, component, r) {
  30256. const codOrCoc = component.codingStyleParameters;
  30257. const result = {};
  30258. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  30259. result.PPx = 15;
  30260. result.PPy = 15;
  30261. } else {
  30262. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  30263. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  30264. }
  30265. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  30266. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  30267. return result;
  30268. }
  30269. function buildPrecincts(context, resolution, dimensions) {
  30270. const precinctWidth = 1 << dimensions.PPx;
  30271. const precinctHeight = 1 << dimensions.PPy;
  30272. const isZeroRes = resolution.resLevel === 0;
  30273. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  30274. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  30275. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  30276. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  30277. const numprecincts = numprecinctswide * numprecinctshigh;
  30278. resolution.precinctParameters = {
  30279. precinctWidth,
  30280. precinctHeight,
  30281. numprecinctswide,
  30282. numprecinctshigh,
  30283. numprecincts,
  30284. precinctWidthInSubband,
  30285. precinctHeightInSubband
  30286. };
  30287. }
  30288. function buildCodeblocks(context, subband, dimensions) {
  30289. const xcb_ = dimensions.xcb_;
  30290. const ycb_ = dimensions.ycb_;
  30291. const codeblockWidth = 1 << xcb_;
  30292. const codeblockHeight = 1 << ycb_;
  30293. const cbx0 = subband.tbx0 >> xcb_;
  30294. const cby0 = subband.tby0 >> ycb_;
  30295. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  30296. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  30297. const precinctParameters = subband.resolution.precinctParameters;
  30298. const codeblocks = [];
  30299. const precincts = [];
  30300. let i, j, codeblock, precinctNumber;
  30301. for (j = cby0; j < cby1; j++) {
  30302. for (i = cbx0; i < cbx1; i++) {
  30303. codeblock = {
  30304. cbx: i,
  30305. cby: j,
  30306. tbx0: codeblockWidth * i,
  30307. tby0: codeblockHeight * j,
  30308. tbx1: codeblockWidth * (i + 1),
  30309. tby1: codeblockHeight * (j + 1)
  30310. };
  30311. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  30312. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  30313. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  30314. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  30315. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  30316. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  30317. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  30318. codeblock.precinctNumber = precinctNumber;
  30319. codeblock.subbandType = subband.type;
  30320. codeblock.Lblock = 3;
  30321. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  30322. continue;
  30323. }
  30324. codeblocks.push(codeblock);
  30325. let precinct = precincts[precinctNumber];
  30326. if (precinct !== undefined) {
  30327. if (i < precinct.cbxMin) {
  30328. precinct.cbxMin = i;
  30329. } else if (i > precinct.cbxMax) {
  30330. precinct.cbxMax = i;
  30331. }
  30332. if (j < precinct.cbyMin) {
  30333. precinct.cbxMin = j;
  30334. } else if (j > precinct.cbyMax) {
  30335. precinct.cbyMax = j;
  30336. }
  30337. } else {
  30338. precincts[precinctNumber] = precinct = {
  30339. cbxMin: i,
  30340. cbyMin: j,
  30341. cbxMax: i,
  30342. cbyMax: j
  30343. };
  30344. }
  30345. codeblock.precinct = precinct;
  30346. }
  30347. }
  30348. subband.codeblockParameters = {
  30349. codeblockWidth: xcb_,
  30350. codeblockHeight: ycb_,
  30351. numcodeblockwide: cbx1 - cbx0 + 1,
  30352. numcodeblockhigh: cby1 - cby0 + 1
  30353. };
  30354. subband.codeblocks = codeblocks;
  30355. subband.precincts = precincts;
  30356. }
  30357. function createPacket(resolution, precinctNumber, layerNumber) {
  30358. const precinctCodeblocks = [];
  30359. const subbands = resolution.subbands;
  30360. for (let i = 0, ii = subbands.length; i < ii; i++) {
  30361. const subband = subbands[i];
  30362. const codeblocks = subband.codeblocks;
  30363. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  30364. const codeblock = codeblocks[j];
  30365. if (codeblock.precinctNumber !== precinctNumber) {
  30366. continue;
  30367. }
  30368. precinctCodeblocks.push(codeblock);
  30369. }
  30370. }
  30371. return {
  30372. layerNumber,
  30373. codeblocks: precinctCodeblocks
  30374. };
  30375. }
  30376. function LayerResolutionComponentPositionIterator(context) {
  30377. const siz = context.SIZ;
  30378. const tileIndex = context.currentTile.index;
  30379. const tile = context.tiles[tileIndex];
  30380. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30381. const componentsCount = siz.Csiz;
  30382. let maxDecompositionLevelsCount = 0;
  30383. for (let q = 0; q < componentsCount; q++) {
  30384. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30385. }
  30386. let l = 0,
  30387. r = 0,
  30388. i = 0,
  30389. k = 0;
  30390. this.nextPacket = function JpxImage_nextPacket() {
  30391. for (; l < layersCount; l++) {
  30392. for (; r <= maxDecompositionLevelsCount; r++) {
  30393. for (; i < componentsCount; i++) {
  30394. const component = tile.components[i];
  30395. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30396. continue;
  30397. }
  30398. const resolution = component.resolutions[r];
  30399. const numprecincts = resolution.precinctParameters.numprecincts;
  30400. for (; k < numprecincts;) {
  30401. const packet = createPacket(resolution, k, l);
  30402. k++;
  30403. return packet;
  30404. }
  30405. k = 0;
  30406. }
  30407. i = 0;
  30408. }
  30409. r = 0;
  30410. }
  30411. throw new JpxError("Out of packets");
  30412. };
  30413. }
  30414. function ResolutionLayerComponentPositionIterator(context) {
  30415. const siz = context.SIZ;
  30416. const tileIndex = context.currentTile.index;
  30417. const tile = context.tiles[tileIndex];
  30418. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30419. const componentsCount = siz.Csiz;
  30420. let maxDecompositionLevelsCount = 0;
  30421. for (let q = 0; q < componentsCount; q++) {
  30422. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30423. }
  30424. let r = 0,
  30425. l = 0,
  30426. i = 0,
  30427. k = 0;
  30428. this.nextPacket = function JpxImage_nextPacket() {
  30429. for (; r <= maxDecompositionLevelsCount; r++) {
  30430. for (; l < layersCount; l++) {
  30431. for (; i < componentsCount; i++) {
  30432. const component = tile.components[i];
  30433. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30434. continue;
  30435. }
  30436. const resolution = component.resolutions[r];
  30437. const numprecincts = resolution.precinctParameters.numprecincts;
  30438. for (; k < numprecincts;) {
  30439. const packet = createPacket(resolution, k, l);
  30440. k++;
  30441. return packet;
  30442. }
  30443. k = 0;
  30444. }
  30445. i = 0;
  30446. }
  30447. l = 0;
  30448. }
  30449. throw new JpxError("Out of packets");
  30450. };
  30451. }
  30452. function ResolutionPositionComponentLayerIterator(context) {
  30453. const siz = context.SIZ;
  30454. const tileIndex = context.currentTile.index;
  30455. const tile = context.tiles[tileIndex];
  30456. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30457. const componentsCount = siz.Csiz;
  30458. let l, r, c, p;
  30459. let maxDecompositionLevelsCount = 0;
  30460. for (c = 0; c < componentsCount; c++) {
  30461. const component = tile.components[c];
  30462. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  30463. }
  30464. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  30465. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  30466. let maxNumPrecincts = 0;
  30467. for (c = 0; c < componentsCount; ++c) {
  30468. const resolutions = tile.components[c].resolutions;
  30469. if (r < resolutions.length) {
  30470. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  30471. }
  30472. }
  30473. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  30474. }
  30475. l = 0;
  30476. r = 0;
  30477. c = 0;
  30478. p = 0;
  30479. this.nextPacket = function JpxImage_nextPacket() {
  30480. for (; r <= maxDecompositionLevelsCount; r++) {
  30481. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  30482. for (; c < componentsCount; c++) {
  30483. const component = tile.components[c];
  30484. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30485. continue;
  30486. }
  30487. const resolution = component.resolutions[r];
  30488. const numprecincts = resolution.precinctParameters.numprecincts;
  30489. if (p >= numprecincts) {
  30490. continue;
  30491. }
  30492. for (; l < layersCount;) {
  30493. const packet = createPacket(resolution, p, l);
  30494. l++;
  30495. return packet;
  30496. }
  30497. l = 0;
  30498. }
  30499. c = 0;
  30500. }
  30501. p = 0;
  30502. }
  30503. throw new JpxError("Out of packets");
  30504. };
  30505. }
  30506. function PositionComponentResolutionLayerIterator(context) {
  30507. const siz = context.SIZ;
  30508. const tileIndex = context.currentTile.index;
  30509. const tile = context.tiles[tileIndex];
  30510. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30511. const componentsCount = siz.Csiz;
  30512. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30513. const precinctsIterationSizes = precinctsSizes;
  30514. let l = 0,
  30515. r = 0,
  30516. c = 0,
  30517. px = 0,
  30518. py = 0;
  30519. this.nextPacket = function JpxImage_nextPacket() {
  30520. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30521. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30522. for (; c < componentsCount; c++) {
  30523. const component = tile.components[c];
  30524. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30525. for (; r <= decompositionLevelsCount; r++) {
  30526. const resolution = component.resolutions[r];
  30527. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  30528. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30529. if (k === null) {
  30530. continue;
  30531. }
  30532. for (; l < layersCount;) {
  30533. const packet = createPacket(resolution, k, l);
  30534. l++;
  30535. return packet;
  30536. }
  30537. l = 0;
  30538. }
  30539. r = 0;
  30540. }
  30541. c = 0;
  30542. }
  30543. px = 0;
  30544. }
  30545. throw new JpxError("Out of packets");
  30546. };
  30547. }
  30548. function ComponentPositionResolutionLayerIterator(context) {
  30549. const siz = context.SIZ;
  30550. const tileIndex = context.currentTile.index;
  30551. const tile = context.tiles[tileIndex];
  30552. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30553. const componentsCount = siz.Csiz;
  30554. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30555. let l = 0,
  30556. r = 0,
  30557. c = 0,
  30558. px = 0,
  30559. py = 0;
  30560. this.nextPacket = function JpxImage_nextPacket() {
  30561. for (; c < componentsCount; ++c) {
  30562. const component = tile.components[c];
  30563. const precinctsIterationSizes = precinctsSizes.components[c];
  30564. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30565. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30566. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30567. for (; r <= decompositionLevelsCount; r++) {
  30568. const resolution = component.resolutions[r];
  30569. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  30570. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30571. if (k === null) {
  30572. continue;
  30573. }
  30574. for (; l < layersCount;) {
  30575. const packet = createPacket(resolution, k, l);
  30576. l++;
  30577. return packet;
  30578. }
  30579. l = 0;
  30580. }
  30581. r = 0;
  30582. }
  30583. px = 0;
  30584. }
  30585. py = 0;
  30586. }
  30587. throw new JpxError("Out of packets");
  30588. };
  30589. }
  30590. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  30591. const posX = pxIndex * precinctIterationSizes.minWidth;
  30592. const posY = pyIndex * precinctIterationSizes.minHeight;
  30593. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  30594. return null;
  30595. }
  30596. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  30597. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  30598. }
  30599. function getPrecinctSizesInImageScale(tile) {
  30600. const componentsCount = tile.components.length;
  30601. let minWidth = Number.MAX_VALUE;
  30602. let minHeight = Number.MAX_VALUE;
  30603. let maxNumWide = 0;
  30604. let maxNumHigh = 0;
  30605. const sizePerComponent = new Array(componentsCount);
  30606. for (let c = 0; c < componentsCount; c++) {
  30607. const component = tile.components[c];
  30608. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30609. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  30610. let minWidthCurrentComponent = Number.MAX_VALUE;
  30611. let minHeightCurrentComponent = Number.MAX_VALUE;
  30612. let maxNumWideCurrentComponent = 0;
  30613. let maxNumHighCurrentComponent = 0;
  30614. let scale = 1;
  30615. for (let r = decompositionLevelsCount; r >= 0; --r) {
  30616. const resolution = component.resolutions[r];
  30617. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  30618. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30619. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30620. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30621. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30622. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30623. sizePerResolution[r] = {
  30624. width: widthCurrentResolution,
  30625. height: heightCurrentResolution
  30626. };
  30627. scale <<= 1;
  30628. }
  30629. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30630. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30631. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30632. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30633. sizePerComponent[c] = {
  30634. resolutions: sizePerResolution,
  30635. minWidth: minWidthCurrentComponent,
  30636. minHeight: minHeightCurrentComponent,
  30637. maxNumWide: maxNumWideCurrentComponent,
  30638. maxNumHigh: maxNumHighCurrentComponent
  30639. };
  30640. }
  30641. return {
  30642. components: sizePerComponent,
  30643. minWidth,
  30644. minHeight,
  30645. maxNumWide,
  30646. maxNumHigh
  30647. };
  30648. }
  30649. function buildPackets(context) {
  30650. const siz = context.SIZ;
  30651. const tileIndex = context.currentTile.index;
  30652. const tile = context.tiles[tileIndex];
  30653. const componentsCount = siz.Csiz;
  30654. for (let c = 0; c < componentsCount; c++) {
  30655. const component = tile.components[c];
  30656. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30657. const resolutions = [];
  30658. const subbands = [];
  30659. for (let r = 0; r <= decompositionLevelsCount; r++) {
  30660. const blocksDimensions = getBlocksDimensions(context, component, r);
  30661. const resolution = {};
  30662. const scale = 1 << decompositionLevelsCount - r;
  30663. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30664. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30665. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30666. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30667. resolution.resLevel = r;
  30668. buildPrecincts(context, resolution, blocksDimensions);
  30669. resolutions.push(resolution);
  30670. let subband;
  30671. if (r === 0) {
  30672. subband = {};
  30673. subband.type = "LL";
  30674. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30675. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30676. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30677. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30678. subband.resolution = resolution;
  30679. buildCodeblocks(context, subband, blocksDimensions);
  30680. subbands.push(subband);
  30681. resolution.subbands = [subband];
  30682. } else {
  30683. const bscale = 1 << decompositionLevelsCount - r + 1;
  30684. const resolutionSubbands = [];
  30685. subband = {};
  30686. subband.type = "HL";
  30687. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30688. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30689. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30690. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30691. subband.resolution = resolution;
  30692. buildCodeblocks(context, subband, blocksDimensions);
  30693. subbands.push(subband);
  30694. resolutionSubbands.push(subband);
  30695. subband = {};
  30696. subband.type = "LH";
  30697. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30698. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30699. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30700. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30701. subband.resolution = resolution;
  30702. buildCodeblocks(context, subband, blocksDimensions);
  30703. subbands.push(subband);
  30704. resolutionSubbands.push(subband);
  30705. subband = {};
  30706. subband.type = "HH";
  30707. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30708. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30709. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30710. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30711. subband.resolution = resolution;
  30712. buildCodeblocks(context, subband, blocksDimensions);
  30713. subbands.push(subband);
  30714. resolutionSubbands.push(subband);
  30715. resolution.subbands = resolutionSubbands;
  30716. }
  30717. }
  30718. component.resolutions = resolutions;
  30719. component.subbands = subbands;
  30720. }
  30721. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30722. switch (progressionOrder) {
  30723. case 0:
  30724. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30725. break;
  30726. case 1:
  30727. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30728. break;
  30729. case 2:
  30730. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30731. break;
  30732. case 3:
  30733. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30734. break;
  30735. case 4:
  30736. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30737. break;
  30738. default:
  30739. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  30740. }
  30741. }
  30742. function parseTilePackets(context, data, offset, dataLength) {
  30743. let position = 0;
  30744. let buffer,
  30745. bufferSize = 0,
  30746. skipNextBit = false;
  30747. function readBits(count) {
  30748. while (bufferSize < count) {
  30749. const b = data[offset + position];
  30750. position++;
  30751. if (skipNextBit) {
  30752. buffer = buffer << 7 | b;
  30753. bufferSize += 7;
  30754. skipNextBit = false;
  30755. } else {
  30756. buffer = buffer << 8 | b;
  30757. bufferSize += 8;
  30758. }
  30759. if (b === 0xff) {
  30760. skipNextBit = true;
  30761. }
  30762. }
  30763. bufferSize -= count;
  30764. return buffer >>> bufferSize & (1 << count) - 1;
  30765. }
  30766. function skipMarkerIfEqual(value) {
  30767. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  30768. skipBytes(1);
  30769. return true;
  30770. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  30771. skipBytes(2);
  30772. return true;
  30773. }
  30774. return false;
  30775. }
  30776. function skipBytes(count) {
  30777. position += count;
  30778. }
  30779. function alignToByte() {
  30780. bufferSize = 0;
  30781. if (skipNextBit) {
  30782. position++;
  30783. skipNextBit = false;
  30784. }
  30785. }
  30786. function readCodingpasses() {
  30787. if (readBits(1) === 0) {
  30788. return 1;
  30789. }
  30790. if (readBits(1) === 0) {
  30791. return 2;
  30792. }
  30793. let value = readBits(2);
  30794. if (value < 3) {
  30795. return value + 3;
  30796. }
  30797. value = readBits(5);
  30798. if (value < 31) {
  30799. return value + 6;
  30800. }
  30801. value = readBits(7);
  30802. return value + 37;
  30803. }
  30804. const tileIndex = context.currentTile.index;
  30805. const tile = context.tiles[tileIndex];
  30806. const sopMarkerUsed = context.COD.sopMarkerUsed;
  30807. const ephMarkerUsed = context.COD.ephMarkerUsed;
  30808. const packetsIterator = tile.packetsIterator;
  30809. while (position < dataLength) {
  30810. alignToByte();
  30811. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30812. skipBytes(4);
  30813. }
  30814. const packet = packetsIterator.nextPacket();
  30815. if (!readBits(1)) {
  30816. continue;
  30817. }
  30818. const layerNumber = packet.layerNumber,
  30819. queue = [];
  30820. let codeblock;
  30821. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30822. codeblock = packet.codeblocks[i];
  30823. let precinct = codeblock.precinct;
  30824. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30825. const codeblockRow = codeblock.cby - precinct.cbyMin;
  30826. let codeblockIncluded = false;
  30827. let firstTimeInclusion = false;
  30828. let valueReady, zeroBitPlanesTree;
  30829. if (codeblock.included !== undefined) {
  30830. codeblockIncluded = !!readBits(1);
  30831. } else {
  30832. precinct = codeblock.precinct;
  30833. let inclusionTree;
  30834. if (precinct.inclusionTree !== undefined) {
  30835. inclusionTree = precinct.inclusionTree;
  30836. } else {
  30837. const width = precinct.cbxMax - precinct.cbxMin + 1;
  30838. const height = precinct.cbyMax - precinct.cbyMin + 1;
  30839. inclusionTree = new InclusionTree(width, height, layerNumber);
  30840. zeroBitPlanesTree = new TagTree(width, height);
  30841. precinct.inclusionTree = inclusionTree;
  30842. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30843. for (let l = 0; l < layerNumber; l++) {
  30844. if (readBits(1) !== 0) {
  30845. throw new JpxError("Invalid tag tree");
  30846. }
  30847. }
  30848. }
  30849. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30850. while (true) {
  30851. if (readBits(1)) {
  30852. valueReady = !inclusionTree.nextLevel();
  30853. if (valueReady) {
  30854. codeblock.included = true;
  30855. codeblockIncluded = firstTimeInclusion = true;
  30856. break;
  30857. }
  30858. } else {
  30859. inclusionTree.incrementValue(layerNumber);
  30860. break;
  30861. }
  30862. }
  30863. }
  30864. }
  30865. if (!codeblockIncluded) {
  30866. continue;
  30867. }
  30868. if (firstTimeInclusion) {
  30869. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30870. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30871. while (true) {
  30872. if (readBits(1)) {
  30873. valueReady = !zeroBitPlanesTree.nextLevel();
  30874. if (valueReady) {
  30875. break;
  30876. }
  30877. } else {
  30878. zeroBitPlanesTree.incrementValue();
  30879. }
  30880. }
  30881. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30882. }
  30883. const codingpasses = readCodingpasses();
  30884. while (readBits(1)) {
  30885. codeblock.Lblock++;
  30886. }
  30887. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  30888. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30889. const codedDataLength = readBits(bits);
  30890. queue.push({
  30891. codeblock,
  30892. codingpasses,
  30893. dataLength: codedDataLength
  30894. });
  30895. }
  30896. alignToByte();
  30897. if (ephMarkerUsed) {
  30898. skipMarkerIfEqual(0x92);
  30899. }
  30900. while (queue.length > 0) {
  30901. const packetItem = queue.shift();
  30902. codeblock = packetItem.codeblock;
  30903. if (codeblock.data === undefined) {
  30904. codeblock.data = [];
  30905. }
  30906. codeblock.data.push({
  30907. data,
  30908. start: offset + position,
  30909. end: offset + position + packetItem.dataLength,
  30910. codingpasses: packetItem.codingpasses
  30911. });
  30912. position += packetItem.dataLength;
  30913. }
  30914. }
  30915. return position;
  30916. }
  30917. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30918. const x0 = subband.tbx0;
  30919. const y0 = subband.tby0;
  30920. const width = subband.tbx1 - subband.tbx0;
  30921. const codeblocks = subband.codeblocks;
  30922. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  30923. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  30924. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  30925. const codeblock = codeblocks[i];
  30926. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30927. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30928. if (blockWidth === 0 || blockHeight === 0) {
  30929. continue;
  30930. }
  30931. if (codeblock.data === undefined) {
  30932. continue;
  30933. }
  30934. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30935. let currentCodingpassType = 2;
  30936. const data = codeblock.data;
  30937. let totalLength = 0,
  30938. codingpasses = 0;
  30939. let j, jj, dataItem;
  30940. for (j = 0, jj = data.length; j < jj; j++) {
  30941. dataItem = data[j];
  30942. totalLength += dataItem.end - dataItem.start;
  30943. codingpasses += dataItem.codingpasses;
  30944. }
  30945. const encodedData = new Uint8Array(totalLength);
  30946. let position = 0;
  30947. for (j = 0, jj = data.length; j < jj; j++) {
  30948. dataItem = data[j];
  30949. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30950. encodedData.set(chunk, position);
  30951. position += chunk.length;
  30952. }
  30953. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  30954. bitModel.setDecoder(decoder);
  30955. for (j = 0; j < codingpasses; j++) {
  30956. switch (currentCodingpassType) {
  30957. case 0:
  30958. bitModel.runSignificancePropagationPass();
  30959. break;
  30960. case 1:
  30961. bitModel.runMagnitudeRefinementPass();
  30962. break;
  30963. case 2:
  30964. bitModel.runCleanupPass();
  30965. if (segmentationSymbolUsed) {
  30966. bitModel.checkSegmentationSymbol();
  30967. }
  30968. break;
  30969. }
  30970. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30971. }
  30972. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30973. const sign = bitModel.coefficentsSign;
  30974. const magnitude = bitModel.coefficentsMagnitude;
  30975. const bitsDecoded = bitModel.bitsDecoded;
  30976. const magnitudeCorrection = reversible ? 0 : 0.5;
  30977. let k, n, nb;
  30978. position = 0;
  30979. const interleave = subband.type !== "LL";
  30980. for (j = 0; j < blockHeight; j++) {
  30981. const row = offset / width | 0;
  30982. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30983. for (k = 0; k < blockWidth; k++) {
  30984. n = magnitude[position];
  30985. if (n !== 0) {
  30986. n = (n + magnitudeCorrection) * delta;
  30987. if (sign[position] !== 0) {
  30988. n = -n;
  30989. }
  30990. nb = bitsDecoded[position];
  30991. const pos = interleave ? levelOffset + (offset << 1) : offset;
  30992. if (reversible && nb >= mb) {
  30993. coefficients[pos] = n;
  30994. } else {
  30995. coefficients[pos] = n * (1 << mb - nb);
  30996. }
  30997. }
  30998. offset++;
  30999. position++;
  31000. }
  31001. offset += width - blockWidth;
  31002. }
  31003. }
  31004. }
  31005. function transformTile(context, tile, c) {
  31006. const component = tile.components[c];
  31007. const codingStyleParameters = component.codingStyleParameters;
  31008. const quantizationParameters = component.quantizationParameters;
  31009. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  31010. const spqcds = quantizationParameters.SPqcds;
  31011. const scalarExpounded = quantizationParameters.scalarExpounded;
  31012. const guardBits = quantizationParameters.guardBits;
  31013. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  31014. const precision = context.components[c].precision;
  31015. const reversible = codingStyleParameters.reversibleTransformation;
  31016. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  31017. const subbandCoefficients = [];
  31018. let b = 0;
  31019. for (let i = 0; i <= decompositionLevelsCount; i++) {
  31020. const resolution = component.resolutions[i];
  31021. const width = resolution.trx1 - resolution.trx0;
  31022. const height = resolution.try1 - resolution.try0;
  31023. const coefficients = new Float32Array(width * height);
  31024. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  31025. let mu, epsilon;
  31026. if (!scalarExpounded) {
  31027. mu = spqcds[0].mu;
  31028. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  31029. } else {
  31030. mu = spqcds[b].mu;
  31031. epsilon = spqcds[b].epsilon;
  31032. b++;
  31033. }
  31034. const subband = resolution.subbands[j];
  31035. const gainLog2 = SubbandsGainLog2[subband.type];
  31036. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  31037. const mb = guardBits + epsilon - 1;
  31038. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  31039. }
  31040. subbandCoefficients.push({
  31041. width,
  31042. height,
  31043. items: coefficients
  31044. });
  31045. }
  31046. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  31047. return {
  31048. left: component.tcx0,
  31049. top: component.tcy0,
  31050. width: result.width,
  31051. height: result.height,
  31052. items: result.items
  31053. };
  31054. }
  31055. function transformComponents(context) {
  31056. const siz = context.SIZ;
  31057. const components = context.components;
  31058. const componentsCount = siz.Csiz;
  31059. const resultImages = [];
  31060. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  31061. const tile = context.tiles[i];
  31062. const transformedTiles = [];
  31063. for (let c = 0; c < componentsCount; c++) {
  31064. transformedTiles[c] = transformTile(context, tile, c);
  31065. }
  31066. const tile0 = transformedTiles[0];
  31067. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  31068. const result = {
  31069. left: tile0.left,
  31070. top: tile0.top,
  31071. width: tile0.width,
  31072. height: tile0.height,
  31073. items: out
  31074. };
  31075. let shift, offset;
  31076. let pos = 0,
  31077. j,
  31078. jj,
  31079. y0,
  31080. y1,
  31081. y2;
  31082. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  31083. const fourComponents = componentsCount === 4;
  31084. const y0items = transformedTiles[0].items;
  31085. const y1items = transformedTiles[1].items;
  31086. const y2items = transformedTiles[2].items;
  31087. const y3items = fourComponents ? transformedTiles[3].items : null;
  31088. shift = components[0].precision - 8;
  31089. offset = (128 << shift) + 0.5;
  31090. const component0 = tile.components[0];
  31091. const alpha01 = componentsCount - 3;
  31092. jj = y0items.length;
  31093. if (!component0.codingStyleParameters.reversibleTransformation) {
  31094. for (j = 0; j < jj; j++, pos += alpha01) {
  31095. y0 = y0items[j] + offset;
  31096. y1 = y1items[j];
  31097. y2 = y2items[j];
  31098. out[pos++] = y0 + 1.402 * y2 >> shift;
  31099. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  31100. out[pos++] = y0 + 1.772 * y1 >> shift;
  31101. }
  31102. } else {
  31103. for (j = 0; j < jj; j++, pos += alpha01) {
  31104. y0 = y0items[j] + offset;
  31105. y1 = y1items[j];
  31106. y2 = y2items[j];
  31107. const g = y0 - (y2 + y1 >> 2);
  31108. out[pos++] = g + y2 >> shift;
  31109. out[pos++] = g >> shift;
  31110. out[pos++] = g + y1 >> shift;
  31111. }
  31112. }
  31113. if (fourComponents) {
  31114. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  31115. out[pos] = y3items[j] + offset >> shift;
  31116. }
  31117. }
  31118. } else {
  31119. for (let c = 0; c < componentsCount; c++) {
  31120. const items = transformedTiles[c].items;
  31121. shift = components[c].precision - 8;
  31122. offset = (128 << shift) + 0.5;
  31123. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  31124. out[pos] = items[j] + offset >> shift;
  31125. pos += componentsCount;
  31126. }
  31127. }
  31128. }
  31129. resultImages.push(result);
  31130. }
  31131. return resultImages;
  31132. }
  31133. function initializeTile(context, tileIndex) {
  31134. const siz = context.SIZ;
  31135. const componentsCount = siz.Csiz;
  31136. const tile = context.tiles[tileIndex];
  31137. for (let c = 0; c < componentsCount; c++) {
  31138. const component = tile.components[c];
  31139. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  31140. component.quantizationParameters = qcdOrQcc;
  31141. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  31142. component.codingStyleParameters = codOrCoc;
  31143. }
  31144. tile.codingStyleDefaultParameters = context.currentTile.COD;
  31145. }
  31146. class TagTree {
  31147. constructor(width, height) {
  31148. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31149. this.levels = [];
  31150. for (let i = 0; i < levelsLength; i++) {
  31151. const level = {
  31152. width,
  31153. height,
  31154. items: []
  31155. };
  31156. this.levels.push(level);
  31157. width = Math.ceil(width / 2);
  31158. height = Math.ceil(height / 2);
  31159. }
  31160. }
  31161. reset(i, j) {
  31162. let currentLevel = 0,
  31163. value = 0,
  31164. level;
  31165. while (currentLevel < this.levels.length) {
  31166. level = this.levels[currentLevel];
  31167. const index = i + j * level.width;
  31168. if (level.items[index] !== undefined) {
  31169. value = level.items[index];
  31170. break;
  31171. }
  31172. level.index = index;
  31173. i >>= 1;
  31174. j >>= 1;
  31175. currentLevel++;
  31176. }
  31177. currentLevel--;
  31178. level = this.levels[currentLevel];
  31179. level.items[level.index] = value;
  31180. this.currentLevel = currentLevel;
  31181. delete this.value;
  31182. }
  31183. incrementValue() {
  31184. const level = this.levels[this.currentLevel];
  31185. level.items[level.index]++;
  31186. }
  31187. nextLevel() {
  31188. let currentLevel = this.currentLevel;
  31189. let level = this.levels[currentLevel];
  31190. const value = level.items[level.index];
  31191. currentLevel--;
  31192. if (currentLevel < 0) {
  31193. this.value = value;
  31194. return false;
  31195. }
  31196. this.currentLevel = currentLevel;
  31197. level = this.levels[currentLevel];
  31198. level.items[level.index] = value;
  31199. return true;
  31200. }
  31201. }
  31202. class InclusionTree {
  31203. constructor(width, height, defaultValue) {
  31204. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31205. this.levels = [];
  31206. for (let i = 0; i < levelsLength; i++) {
  31207. const items = new Uint8Array(width * height);
  31208. for (let j = 0, jj = items.length; j < jj; j++) {
  31209. items[j] = defaultValue;
  31210. }
  31211. const level = {
  31212. width,
  31213. height,
  31214. items
  31215. };
  31216. this.levels.push(level);
  31217. width = Math.ceil(width / 2);
  31218. height = Math.ceil(height / 2);
  31219. }
  31220. }
  31221. reset(i, j, stopValue) {
  31222. let currentLevel = 0;
  31223. while (currentLevel < this.levels.length) {
  31224. const level = this.levels[currentLevel];
  31225. const index = i + j * level.width;
  31226. level.index = index;
  31227. const value = level.items[index];
  31228. if (value === 0xff) {
  31229. break;
  31230. }
  31231. if (value > stopValue) {
  31232. this.currentLevel = currentLevel;
  31233. this.propagateValues();
  31234. return false;
  31235. }
  31236. i >>= 1;
  31237. j >>= 1;
  31238. currentLevel++;
  31239. }
  31240. this.currentLevel = currentLevel - 1;
  31241. return true;
  31242. }
  31243. incrementValue(stopValue) {
  31244. const level = this.levels[this.currentLevel];
  31245. level.items[level.index] = stopValue + 1;
  31246. this.propagateValues();
  31247. }
  31248. propagateValues() {
  31249. let levelIndex = this.currentLevel;
  31250. let level = this.levels[levelIndex];
  31251. const currentValue = level.items[level.index];
  31252. while (--levelIndex >= 0) {
  31253. level = this.levels[levelIndex];
  31254. level.items[level.index] = currentValue;
  31255. }
  31256. }
  31257. nextLevel() {
  31258. let currentLevel = this.currentLevel;
  31259. let level = this.levels[currentLevel];
  31260. const value = level.items[level.index];
  31261. level.items[level.index] = 0xff;
  31262. currentLevel--;
  31263. if (currentLevel < 0) {
  31264. return false;
  31265. }
  31266. this.currentLevel = currentLevel;
  31267. level = this.levels[currentLevel];
  31268. level.items[level.index] = value;
  31269. return true;
  31270. }
  31271. }
  31272. const BitModel = function BitModelClosure() {
  31273. const UNIFORM_CONTEXT = 17;
  31274. const RUNLENGTH_CONTEXT = 18;
  31275. 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]);
  31276. 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]);
  31277. 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]);
  31278. class BitModel {
  31279. constructor(width, height, subband, zeroBitPlanes, mb) {
  31280. this.width = width;
  31281. this.height = height;
  31282. let contextLabelTable;
  31283. if (subband === "HH") {
  31284. contextLabelTable = HHContextLabel;
  31285. } else if (subband === "HL") {
  31286. contextLabelTable = HLContextLabel;
  31287. } else {
  31288. contextLabelTable = LLAndLHContextsLabel;
  31289. }
  31290. this.contextLabelTable = contextLabelTable;
  31291. const coefficientCount = width * height;
  31292. this.neighborsSignificance = new Uint8Array(coefficientCount);
  31293. this.coefficentsSign = new Uint8Array(coefficientCount);
  31294. let coefficentsMagnitude;
  31295. if (mb > 14) {
  31296. coefficentsMagnitude = new Uint32Array(coefficientCount);
  31297. } else if (mb > 6) {
  31298. coefficentsMagnitude = new Uint16Array(coefficientCount);
  31299. } else {
  31300. coefficentsMagnitude = new Uint8Array(coefficientCount);
  31301. }
  31302. this.coefficentsMagnitude = coefficentsMagnitude;
  31303. this.processingFlags = new Uint8Array(coefficientCount);
  31304. const bitsDecoded = new Uint8Array(coefficientCount);
  31305. if (zeroBitPlanes !== 0) {
  31306. for (let i = 0; i < coefficientCount; i++) {
  31307. bitsDecoded[i] = zeroBitPlanes;
  31308. }
  31309. }
  31310. this.bitsDecoded = bitsDecoded;
  31311. this.reset();
  31312. }
  31313. setDecoder(decoder) {
  31314. this.decoder = decoder;
  31315. }
  31316. reset() {
  31317. this.contexts = new Int8Array(19);
  31318. this.contexts[0] = 4 << 1 | 0;
  31319. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  31320. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  31321. }
  31322. setNeighborsSignificance(row, column, index) {
  31323. const neighborsSignificance = this.neighborsSignificance;
  31324. const width = this.width,
  31325. height = this.height;
  31326. const left = column > 0;
  31327. const right = column + 1 < width;
  31328. let i;
  31329. if (row > 0) {
  31330. i = index - width;
  31331. if (left) {
  31332. neighborsSignificance[i - 1] += 0x10;
  31333. }
  31334. if (right) {
  31335. neighborsSignificance[i + 1] += 0x10;
  31336. }
  31337. neighborsSignificance[i] += 0x04;
  31338. }
  31339. if (row + 1 < height) {
  31340. i = index + width;
  31341. if (left) {
  31342. neighborsSignificance[i - 1] += 0x10;
  31343. }
  31344. if (right) {
  31345. neighborsSignificance[i + 1] += 0x10;
  31346. }
  31347. neighborsSignificance[i] += 0x04;
  31348. }
  31349. if (left) {
  31350. neighborsSignificance[index - 1] += 0x01;
  31351. }
  31352. if (right) {
  31353. neighborsSignificance[index + 1] += 0x01;
  31354. }
  31355. neighborsSignificance[index] |= 0x80;
  31356. }
  31357. runSignificancePropagationPass() {
  31358. const decoder = this.decoder;
  31359. const width = this.width,
  31360. height = this.height;
  31361. const coefficentsMagnitude = this.coefficentsMagnitude;
  31362. const coefficentsSign = this.coefficentsSign;
  31363. const neighborsSignificance = this.neighborsSignificance;
  31364. const processingFlags = this.processingFlags;
  31365. const contexts = this.contexts;
  31366. const labels = this.contextLabelTable;
  31367. const bitsDecoded = this.bitsDecoded;
  31368. const processedInverseMask = ~1;
  31369. const processedMask = 1;
  31370. const firstMagnitudeBitMask = 2;
  31371. for (let i0 = 0; i0 < height; i0 += 4) {
  31372. for (let j = 0; j < width; j++) {
  31373. let index = i0 * width + j;
  31374. for (let i1 = 0; i1 < 4; i1++, index += width) {
  31375. const i = i0 + i1;
  31376. if (i >= height) {
  31377. break;
  31378. }
  31379. processingFlags[index] &= processedInverseMask;
  31380. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  31381. continue;
  31382. }
  31383. const contextLabel = labels[neighborsSignificance[index]];
  31384. const decision = decoder.readBit(contexts, contextLabel);
  31385. if (decision) {
  31386. const sign = this.decodeSignBit(i, j, index);
  31387. coefficentsSign[index] = sign;
  31388. coefficentsMagnitude[index] = 1;
  31389. this.setNeighborsSignificance(i, j, index);
  31390. processingFlags[index] |= firstMagnitudeBitMask;
  31391. }
  31392. bitsDecoded[index]++;
  31393. processingFlags[index] |= processedMask;
  31394. }
  31395. }
  31396. }
  31397. }
  31398. decodeSignBit(row, column, index) {
  31399. const width = this.width,
  31400. height = this.height;
  31401. const coefficentsMagnitude = this.coefficentsMagnitude;
  31402. const coefficentsSign = this.coefficentsSign;
  31403. let contribution, sign0, sign1, significance1;
  31404. let contextLabel, decoded;
  31405. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  31406. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31407. sign1 = coefficentsSign[index + 1];
  31408. if (significance1) {
  31409. sign0 = coefficentsSign[index - 1];
  31410. contribution = 1 - sign1 - sign0;
  31411. } else {
  31412. contribution = 1 - sign1 - sign1;
  31413. }
  31414. } else if (significance1) {
  31415. sign0 = coefficentsSign[index - 1];
  31416. contribution = 1 - sign0 - sign0;
  31417. } else {
  31418. contribution = 0;
  31419. }
  31420. const horizontalContribution = 3 * contribution;
  31421. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31422. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31423. sign1 = coefficentsSign[index + width];
  31424. if (significance1) {
  31425. sign0 = coefficentsSign[index - width];
  31426. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31427. } else {
  31428. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31429. }
  31430. } else if (significance1) {
  31431. sign0 = coefficentsSign[index - width];
  31432. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31433. } else {
  31434. contribution = horizontalContribution;
  31435. }
  31436. if (contribution >= 0) {
  31437. contextLabel = 9 + contribution;
  31438. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31439. } else {
  31440. contextLabel = 9 - contribution;
  31441. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31442. }
  31443. return decoded;
  31444. }
  31445. runMagnitudeRefinementPass() {
  31446. const decoder = this.decoder;
  31447. const width = this.width,
  31448. height = this.height;
  31449. const coefficentsMagnitude = this.coefficentsMagnitude;
  31450. const neighborsSignificance = this.neighborsSignificance;
  31451. const contexts = this.contexts;
  31452. const bitsDecoded = this.bitsDecoded;
  31453. const processingFlags = this.processingFlags;
  31454. const processedMask = 1;
  31455. const firstMagnitudeBitMask = 2;
  31456. const length = width * height;
  31457. const width4 = width * 4;
  31458. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31459. indexNext = Math.min(length, index0 + width4);
  31460. for (let j = 0; j < width; j++) {
  31461. for (let index = index0 + j; index < indexNext; index += width) {
  31462. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31463. continue;
  31464. }
  31465. let contextLabel = 16;
  31466. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31467. processingFlags[index] ^= firstMagnitudeBitMask;
  31468. const significance = neighborsSignificance[index] & 127;
  31469. contextLabel = significance === 0 ? 15 : 14;
  31470. }
  31471. const bit = decoder.readBit(contexts, contextLabel);
  31472. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31473. bitsDecoded[index]++;
  31474. processingFlags[index] |= processedMask;
  31475. }
  31476. }
  31477. }
  31478. }
  31479. runCleanupPass() {
  31480. const decoder = this.decoder;
  31481. const width = this.width,
  31482. height = this.height;
  31483. const neighborsSignificance = this.neighborsSignificance;
  31484. const coefficentsMagnitude = this.coefficentsMagnitude;
  31485. const coefficentsSign = this.coefficentsSign;
  31486. const contexts = this.contexts;
  31487. const labels = this.contextLabelTable;
  31488. const bitsDecoded = this.bitsDecoded;
  31489. const processingFlags = this.processingFlags;
  31490. const processedMask = 1;
  31491. const firstMagnitudeBitMask = 2;
  31492. const oneRowDown = width;
  31493. const twoRowsDown = width * 2;
  31494. const threeRowsDown = width * 3;
  31495. let iNext;
  31496. for (let i0 = 0; i0 < height; i0 = iNext) {
  31497. iNext = Math.min(i0 + 4, height);
  31498. const indexBase = i0 * width;
  31499. const checkAllEmpty = i0 + 3 < height;
  31500. for (let j = 0; j < width; j++) {
  31501. const index0 = indexBase + j;
  31502. 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;
  31503. let i1 = 0,
  31504. index = index0;
  31505. let i = i0,
  31506. sign;
  31507. if (allEmpty) {
  31508. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31509. if (!hasSignificantCoefficent) {
  31510. bitsDecoded[index0]++;
  31511. bitsDecoded[index0 + oneRowDown]++;
  31512. bitsDecoded[index0 + twoRowsDown]++;
  31513. bitsDecoded[index0 + threeRowsDown]++;
  31514. continue;
  31515. }
  31516. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31517. if (i1 !== 0) {
  31518. i = i0 + i1;
  31519. index += i1 * width;
  31520. }
  31521. sign = this.decodeSignBit(i, j, index);
  31522. coefficentsSign[index] = sign;
  31523. coefficentsMagnitude[index] = 1;
  31524. this.setNeighborsSignificance(i, j, index);
  31525. processingFlags[index] |= firstMagnitudeBitMask;
  31526. index = index0;
  31527. for (let i2 = i0; i2 <= i; i2++, index += width) {
  31528. bitsDecoded[index]++;
  31529. }
  31530. i1++;
  31531. }
  31532. for (i = i0 + i1; i < iNext; i++, index += width) {
  31533. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31534. continue;
  31535. }
  31536. const contextLabel = labels[neighborsSignificance[index]];
  31537. const decision = decoder.readBit(contexts, contextLabel);
  31538. if (decision === 1) {
  31539. sign = this.decodeSignBit(i, j, index);
  31540. coefficentsSign[index] = sign;
  31541. coefficentsMagnitude[index] = 1;
  31542. this.setNeighborsSignificance(i, j, index);
  31543. processingFlags[index] |= firstMagnitudeBitMask;
  31544. }
  31545. bitsDecoded[index]++;
  31546. }
  31547. }
  31548. }
  31549. }
  31550. checkSegmentationSymbol() {
  31551. const decoder = this.decoder;
  31552. const contexts = this.contexts;
  31553. 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);
  31554. if (symbol !== 0xa) {
  31555. throw new JpxError("Invalid segmentation symbol");
  31556. }
  31557. }
  31558. }
  31559. return BitModel;
  31560. }();
  31561. class Transform {
  31562. constructor() {
  31563. if (this.constructor === Transform) {
  31564. (0, _util.unreachable)("Cannot initialize Transform.");
  31565. }
  31566. }
  31567. calculate(subbands, u0, v0) {
  31568. let ll = subbands[0];
  31569. for (let i = 1, ii = subbands.length; i < ii; i++) {
  31570. ll = this.iterate(ll, subbands[i], u0, v0);
  31571. }
  31572. return ll;
  31573. }
  31574. extend(buffer, offset, size) {
  31575. let i1 = offset - 1,
  31576. j1 = offset + 1;
  31577. let i2 = offset + size - 2,
  31578. j2 = offset + size;
  31579. buffer[i1--] = buffer[j1++];
  31580. buffer[j2++] = buffer[i2--];
  31581. buffer[i1--] = buffer[j1++];
  31582. buffer[j2++] = buffer[i2--];
  31583. buffer[i1--] = buffer[j1++];
  31584. buffer[j2++] = buffer[i2--];
  31585. buffer[i1] = buffer[j1];
  31586. buffer[j2] = buffer[i2];
  31587. }
  31588. filter(x, offset, length) {
  31589. (0, _util.unreachable)("Abstract method `filter` called");
  31590. }
  31591. iterate(ll, hl_lh_hh, u0, v0) {
  31592. const llWidth = ll.width,
  31593. llHeight = ll.height;
  31594. let llItems = ll.items;
  31595. const width = hl_lh_hh.width;
  31596. const height = hl_lh_hh.height;
  31597. const items = hl_lh_hh.items;
  31598. let i, j, k, l, u, v;
  31599. for (k = 0, i = 0; i < llHeight; i++) {
  31600. l = i * 2 * width;
  31601. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31602. items[l] = llItems[k];
  31603. }
  31604. }
  31605. llItems = ll.items = null;
  31606. const bufferPadding = 4;
  31607. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31608. if (width === 1) {
  31609. if ((u0 & 1) !== 0) {
  31610. for (v = 0, k = 0; v < height; v++, k += width) {
  31611. items[k] *= 0.5;
  31612. }
  31613. }
  31614. } else {
  31615. for (v = 0, k = 0; v < height; v++, k += width) {
  31616. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31617. this.extend(rowBuffer, bufferPadding, width);
  31618. this.filter(rowBuffer, bufferPadding, width);
  31619. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31620. }
  31621. }
  31622. let numBuffers = 16;
  31623. const colBuffers = [];
  31624. for (i = 0; i < numBuffers; i++) {
  31625. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31626. }
  31627. let b,
  31628. currentBuffer = 0;
  31629. ll = bufferPadding + height;
  31630. if (height === 1) {
  31631. if ((v0 & 1) !== 0) {
  31632. for (u = 0; u < width; u++) {
  31633. items[u] *= 0.5;
  31634. }
  31635. }
  31636. } else {
  31637. for (u = 0; u < width; u++) {
  31638. if (currentBuffer === 0) {
  31639. numBuffers = Math.min(width - u, numBuffers);
  31640. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31641. for (b = 0; b < numBuffers; b++) {
  31642. colBuffers[b][l] = items[k + b];
  31643. }
  31644. }
  31645. currentBuffer = numBuffers;
  31646. }
  31647. currentBuffer--;
  31648. const buffer = colBuffers[currentBuffer];
  31649. this.extend(buffer, bufferPadding, height);
  31650. this.filter(buffer, bufferPadding, height);
  31651. if (currentBuffer === 0) {
  31652. k = u - numBuffers + 1;
  31653. for (l = bufferPadding; l < ll; k += width, l++) {
  31654. for (b = 0; b < numBuffers; b++) {
  31655. items[k + b] = colBuffers[b][l];
  31656. }
  31657. }
  31658. }
  31659. }
  31660. }
  31661. return {
  31662. width,
  31663. height,
  31664. items
  31665. };
  31666. }
  31667. }
  31668. class IrreversibleTransform extends Transform {
  31669. filter(x, offset, length) {
  31670. const len = length >> 1;
  31671. offset |= 0;
  31672. let j, n, current, next;
  31673. const alpha = -1.586134342059924;
  31674. const beta = -0.052980118572961;
  31675. const gamma = 0.882911075530934;
  31676. const delta = 0.443506852043971;
  31677. const K = 1.230174104914001;
  31678. const K_ = 1 / K;
  31679. j = offset - 3;
  31680. for (n = len + 4; n--; j += 2) {
  31681. x[j] *= K_;
  31682. }
  31683. j = offset - 2;
  31684. current = delta * x[j - 1];
  31685. for (n = len + 3; n--; j += 2) {
  31686. next = delta * x[j + 1];
  31687. x[j] = K * x[j] - current - next;
  31688. if (n--) {
  31689. j += 2;
  31690. current = delta * x[j + 1];
  31691. x[j] = K * x[j] - current - next;
  31692. } else {
  31693. break;
  31694. }
  31695. }
  31696. j = offset - 1;
  31697. current = gamma * x[j - 1];
  31698. for (n = len + 2; n--; j += 2) {
  31699. next = gamma * x[j + 1];
  31700. x[j] -= current + next;
  31701. if (n--) {
  31702. j += 2;
  31703. current = gamma * x[j + 1];
  31704. x[j] -= current + next;
  31705. } else {
  31706. break;
  31707. }
  31708. }
  31709. j = offset;
  31710. current = beta * x[j - 1];
  31711. for (n = len + 1; n--; j += 2) {
  31712. next = beta * x[j + 1];
  31713. x[j] -= current + next;
  31714. if (n--) {
  31715. j += 2;
  31716. current = beta * x[j + 1];
  31717. x[j] -= current + next;
  31718. } else {
  31719. break;
  31720. }
  31721. }
  31722. if (len !== 0) {
  31723. j = offset + 1;
  31724. current = alpha * x[j - 1];
  31725. for (n = len; n--; j += 2) {
  31726. next = alpha * x[j + 1];
  31727. x[j] -= current + next;
  31728. if (n--) {
  31729. j += 2;
  31730. current = alpha * x[j + 1];
  31731. x[j] -= current + next;
  31732. } else {
  31733. break;
  31734. }
  31735. }
  31736. }
  31737. }
  31738. }
  31739. class ReversibleTransform extends Transform {
  31740. filter(x, offset, length) {
  31741. const len = length >> 1;
  31742. offset |= 0;
  31743. let j, n;
  31744. for (j = offset, n = len + 1; n--; j += 2) {
  31745. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31746. }
  31747. for (j = offset + 1, n = len; n--; j += 2) {
  31748. x[j] += x[j - 1] + x[j + 1] >> 1;
  31749. }
  31750. }
  31751. }
  31752. /***/ }),
  31753. /* 41 */
  31754. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31755. Object.defineProperty(exports, "__esModule", ({
  31756. value: true
  31757. }));
  31758. exports.LZWStream = void 0;
  31759. var _decode_stream = __w_pdfjs_require__(29);
  31760. class LZWStream extends _decode_stream.DecodeStream {
  31761. constructor(str, maybeLength, earlyChange) {
  31762. super(maybeLength);
  31763. this.str = str;
  31764. this.dict = str.dict;
  31765. this.cachedData = 0;
  31766. this.bitsCached = 0;
  31767. const maxLzwDictionarySize = 4096;
  31768. const lzwState = {
  31769. earlyChange,
  31770. codeLength: 9,
  31771. nextCode: 258,
  31772. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  31773. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  31774. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  31775. currentSequence: new Uint8Array(maxLzwDictionarySize),
  31776. currentSequenceLength: 0
  31777. };
  31778. for (let i = 0; i < 256; ++i) {
  31779. lzwState.dictionaryValues[i] = i;
  31780. lzwState.dictionaryLengths[i] = 1;
  31781. }
  31782. this.lzwState = lzwState;
  31783. }
  31784. readBits(n) {
  31785. let bitsCached = this.bitsCached;
  31786. let cachedData = this.cachedData;
  31787. while (bitsCached < n) {
  31788. const c = this.str.getByte();
  31789. if (c === -1) {
  31790. this.eof = true;
  31791. return null;
  31792. }
  31793. cachedData = cachedData << 8 | c;
  31794. bitsCached += 8;
  31795. }
  31796. this.bitsCached = bitsCached -= n;
  31797. this.cachedData = cachedData;
  31798. this.lastCode = null;
  31799. return cachedData >>> bitsCached & (1 << n) - 1;
  31800. }
  31801. readBlock() {
  31802. const blockSize = 512,
  31803. decodedSizeDelta = blockSize;
  31804. let estimatedDecodedSize = blockSize * 2;
  31805. let i, j, q;
  31806. const lzwState = this.lzwState;
  31807. if (!lzwState) {
  31808. return;
  31809. }
  31810. const earlyChange = lzwState.earlyChange;
  31811. let nextCode = lzwState.nextCode;
  31812. const dictionaryValues = lzwState.dictionaryValues;
  31813. const dictionaryLengths = lzwState.dictionaryLengths;
  31814. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  31815. let codeLength = lzwState.codeLength;
  31816. let prevCode = lzwState.prevCode;
  31817. const currentSequence = lzwState.currentSequence;
  31818. let currentSequenceLength = lzwState.currentSequenceLength;
  31819. let decodedLength = 0;
  31820. let currentBufferLength = this.bufferLength;
  31821. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31822. for (i = 0; i < blockSize; i++) {
  31823. const code = this.readBits(codeLength);
  31824. const hasPrev = currentSequenceLength > 0;
  31825. if (code < 256) {
  31826. currentSequence[0] = code;
  31827. currentSequenceLength = 1;
  31828. } else if (code >= 258) {
  31829. if (code < nextCode) {
  31830. currentSequenceLength = dictionaryLengths[code];
  31831. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  31832. currentSequence[j] = dictionaryValues[q];
  31833. q = dictionaryPrevCodes[q];
  31834. }
  31835. } else {
  31836. currentSequence[currentSequenceLength++] = currentSequence[0];
  31837. }
  31838. } else if (code === 256) {
  31839. codeLength = 9;
  31840. nextCode = 258;
  31841. currentSequenceLength = 0;
  31842. continue;
  31843. } else {
  31844. this.eof = true;
  31845. delete this.lzwState;
  31846. break;
  31847. }
  31848. if (hasPrev) {
  31849. dictionaryPrevCodes[nextCode] = prevCode;
  31850. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  31851. dictionaryValues[nextCode] = currentSequence[0];
  31852. nextCode++;
  31853. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  31854. }
  31855. prevCode = code;
  31856. decodedLength += currentSequenceLength;
  31857. if (estimatedDecodedSize < decodedLength) {
  31858. do {
  31859. estimatedDecodedSize += decodedSizeDelta;
  31860. } while (estimatedDecodedSize < decodedLength);
  31861. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31862. }
  31863. for (j = 0; j < currentSequenceLength; j++) {
  31864. buffer[currentBufferLength++] = currentSequence[j];
  31865. }
  31866. }
  31867. lzwState.nextCode = nextCode;
  31868. lzwState.codeLength = codeLength;
  31869. lzwState.prevCode = prevCode;
  31870. lzwState.currentSequenceLength = currentSequenceLength;
  31871. this.bufferLength = currentBufferLength;
  31872. }
  31873. }
  31874. exports.LZWStream = LZWStream;
  31875. /***/ }),
  31876. /* 42 */
  31877. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31878. Object.defineProperty(exports, "__esModule", ({
  31879. value: true
  31880. }));
  31881. exports.PredictorStream = void 0;
  31882. var _decode_stream = __w_pdfjs_require__(29);
  31883. var _util = __w_pdfjs_require__(2);
  31884. var _primitives = __w_pdfjs_require__(5);
  31885. class PredictorStream extends _decode_stream.DecodeStream {
  31886. constructor(str, maybeLength, params) {
  31887. super(maybeLength);
  31888. if (!(0, _primitives.isDict)(params)) {
  31889. return str;
  31890. }
  31891. const predictor = this.predictor = params.get("Predictor") || 1;
  31892. if (predictor <= 1) {
  31893. return str;
  31894. }
  31895. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  31896. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  31897. }
  31898. if (predictor === 2) {
  31899. this.readBlock = this.readBlockTiff;
  31900. } else {
  31901. this.readBlock = this.readBlockPng;
  31902. }
  31903. this.str = str;
  31904. this.dict = str.dict;
  31905. const colors = this.colors = params.get("Colors") || 1;
  31906. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  31907. const columns = this.columns = params.get("Columns") || 1;
  31908. this.pixBytes = colors * bits + 7 >> 3;
  31909. this.rowBytes = columns * colors * bits + 7 >> 3;
  31910. return this;
  31911. }
  31912. readBlockTiff() {
  31913. const rowBytes = this.rowBytes;
  31914. const bufferLength = this.bufferLength;
  31915. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  31916. const bits = this.bits;
  31917. const colors = this.colors;
  31918. const rawBytes = this.str.getBytes(rowBytes);
  31919. this.eof = !rawBytes.length;
  31920. if (this.eof) {
  31921. return;
  31922. }
  31923. let inbuf = 0,
  31924. outbuf = 0;
  31925. let inbits = 0,
  31926. outbits = 0;
  31927. let pos = bufferLength;
  31928. let i;
  31929. if (bits === 1 && colors === 1) {
  31930. for (i = 0; i < rowBytes; ++i) {
  31931. let c = rawBytes[i] ^ inbuf;
  31932. c ^= c >> 1;
  31933. c ^= c >> 2;
  31934. c ^= c >> 4;
  31935. inbuf = (c & 1) << 7;
  31936. buffer[pos++] = c;
  31937. }
  31938. } else if (bits === 8) {
  31939. for (i = 0; i < colors; ++i) {
  31940. buffer[pos++] = rawBytes[i];
  31941. }
  31942. for (; i < rowBytes; ++i) {
  31943. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  31944. pos++;
  31945. }
  31946. } else if (bits === 16) {
  31947. const bytesPerPixel = colors * 2;
  31948. for (i = 0; i < bytesPerPixel; ++i) {
  31949. buffer[pos++] = rawBytes[i];
  31950. }
  31951. for (; i < rowBytes; i += 2) {
  31952. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  31953. buffer[pos++] = sum >> 8 & 0xff;
  31954. buffer[pos++] = sum & 0xff;
  31955. }
  31956. } else {
  31957. const compArray = new Uint8Array(colors + 1);
  31958. const bitMask = (1 << bits) - 1;
  31959. let j = 0,
  31960. k = bufferLength;
  31961. const columns = this.columns;
  31962. for (i = 0; i < columns; ++i) {
  31963. for (let kk = 0; kk < colors; ++kk) {
  31964. if (inbits < bits) {
  31965. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  31966. inbits += 8;
  31967. }
  31968. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  31969. inbits -= bits;
  31970. outbuf = outbuf << bits | compArray[kk];
  31971. outbits += bits;
  31972. if (outbits >= 8) {
  31973. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  31974. outbits -= 8;
  31975. }
  31976. }
  31977. }
  31978. if (outbits > 0) {
  31979. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  31980. }
  31981. }
  31982. this.bufferLength += rowBytes;
  31983. }
  31984. readBlockPng() {
  31985. const rowBytes = this.rowBytes;
  31986. const pixBytes = this.pixBytes;
  31987. const predictor = this.str.getByte();
  31988. const rawBytes = this.str.getBytes(rowBytes);
  31989. this.eof = !rawBytes.length;
  31990. if (this.eof) {
  31991. return;
  31992. }
  31993. const bufferLength = this.bufferLength;
  31994. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  31995. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  31996. if (prevRow.length === 0) {
  31997. prevRow = new Uint8Array(rowBytes);
  31998. }
  31999. let i,
  32000. j = bufferLength,
  32001. up,
  32002. c;
  32003. switch (predictor) {
  32004. case 0:
  32005. for (i = 0; i < rowBytes; ++i) {
  32006. buffer[j++] = rawBytes[i];
  32007. }
  32008. break;
  32009. case 1:
  32010. for (i = 0; i < pixBytes; ++i) {
  32011. buffer[j++] = rawBytes[i];
  32012. }
  32013. for (; i < rowBytes; ++i) {
  32014. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  32015. j++;
  32016. }
  32017. break;
  32018. case 2:
  32019. for (i = 0; i < rowBytes; ++i) {
  32020. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  32021. }
  32022. break;
  32023. case 3:
  32024. for (i = 0; i < pixBytes; ++i) {
  32025. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  32026. }
  32027. for (; i < rowBytes; ++i) {
  32028. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  32029. j++;
  32030. }
  32031. break;
  32032. case 4:
  32033. for (i = 0; i < pixBytes; ++i) {
  32034. up = prevRow[i];
  32035. c = rawBytes[i];
  32036. buffer[j++] = up + c;
  32037. }
  32038. for (; i < rowBytes; ++i) {
  32039. up = prevRow[i];
  32040. const upLeft = prevRow[i - pixBytes];
  32041. const left = buffer[j - pixBytes];
  32042. const p = left + up - upLeft;
  32043. let pa = p - left;
  32044. if (pa < 0) {
  32045. pa = -pa;
  32046. }
  32047. let pb = p - up;
  32048. if (pb < 0) {
  32049. pb = -pb;
  32050. }
  32051. let pc = p - upLeft;
  32052. if (pc < 0) {
  32053. pc = -pc;
  32054. }
  32055. c = rawBytes[i];
  32056. if (pa <= pb && pa <= pc) {
  32057. buffer[j++] = left + c;
  32058. } else if (pb <= pc) {
  32059. buffer[j++] = up + c;
  32060. } else {
  32061. buffer[j++] = upLeft + c;
  32062. }
  32063. }
  32064. break;
  32065. default:
  32066. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32067. }
  32068. this.bufferLength += rowBytes;
  32069. }
  32070. }
  32071. exports.PredictorStream = PredictorStream;
  32072. /***/ }),
  32073. /* 43 */
  32074. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32075. Object.defineProperty(exports, "__esModule", ({
  32076. value: true
  32077. }));
  32078. exports.RunLengthStream = void 0;
  32079. var _decode_stream = __w_pdfjs_require__(29);
  32080. class RunLengthStream extends _decode_stream.DecodeStream {
  32081. constructor(str, maybeLength) {
  32082. super(maybeLength);
  32083. this.str = str;
  32084. this.dict = str.dict;
  32085. }
  32086. readBlock() {
  32087. const repeatHeader = this.str.getBytes(2);
  32088. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  32089. this.eof = true;
  32090. return;
  32091. }
  32092. let buffer;
  32093. let bufferLength = this.bufferLength;
  32094. let n = repeatHeader[0];
  32095. if (n < 128) {
  32096. buffer = this.ensureBuffer(bufferLength + n + 1);
  32097. buffer[bufferLength++] = repeatHeader[1];
  32098. if (n > 0) {
  32099. const source = this.str.getBytes(n);
  32100. buffer.set(source, bufferLength);
  32101. bufferLength += n;
  32102. }
  32103. } else {
  32104. n = 257 - n;
  32105. const b = repeatHeader[1];
  32106. buffer = this.ensureBuffer(bufferLength + n + 1);
  32107. for (let i = 0; i < n; i++) {
  32108. buffer[bufferLength++] = b;
  32109. }
  32110. }
  32111. this.bufferLength = bufferLength;
  32112. }
  32113. }
  32114. exports.RunLengthStream = RunLengthStream;
  32115. /***/ }),
  32116. /* 44 */
  32117. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32118. Object.defineProperty(exports, "__esModule", ({
  32119. value: true
  32120. }));
  32121. exports.Font = exports.ErrorFont = void 0;
  32122. var _util = __w_pdfjs_require__(2);
  32123. var _cff_parser = __w_pdfjs_require__(45);
  32124. var _fonts_utils = __w_pdfjs_require__(18);
  32125. var _glyphlist = __w_pdfjs_require__(20);
  32126. var _encodings = __w_pdfjs_require__(19);
  32127. var _standard_fonts = __w_pdfjs_require__(47);
  32128. var _unicode = __w_pdfjs_require__(21);
  32129. var _to_unicode_map = __w_pdfjs_require__(48);
  32130. var _cff_font = __w_pdfjs_require__(49);
  32131. var _font_renderer = __w_pdfjs_require__(50);
  32132. var _glyf = __w_pdfjs_require__(51);
  32133. var _cmap = __w_pdfjs_require__(26);
  32134. var _opentype_file_builder = __w_pdfjs_require__(52);
  32135. var _core_utils = __w_pdfjs_require__(9);
  32136. var _stream = __w_pdfjs_require__(10);
  32137. var _type1_font = __w_pdfjs_require__(53);
  32138. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  32139. const PDF_GLYPH_SPACE_UNITS = 1000;
  32140. 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"];
  32141. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  32142. function adjustWidths(properties) {
  32143. if (!properties.fontMatrix) {
  32144. return;
  32145. }
  32146. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  32147. return;
  32148. }
  32149. const scale = 0.001 / properties.fontMatrix[0];
  32150. const glyphsWidths = properties.widths;
  32151. for (const glyph in glyphsWidths) {
  32152. glyphsWidths[glyph] *= scale;
  32153. }
  32154. properties.defaultWidth *= scale;
  32155. }
  32156. function adjustToUnicode(properties, builtInEncoding) {
  32157. if (properties.isInternalFont) {
  32158. return;
  32159. }
  32160. if (builtInEncoding === properties.defaultEncoding) {
  32161. return;
  32162. }
  32163. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32164. return;
  32165. }
  32166. const toUnicode = [],
  32167. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32168. for (const charCode in builtInEncoding) {
  32169. if (properties.hasIncludedToUnicodeMap) {
  32170. if (properties.toUnicode.has(charCode)) {
  32171. continue;
  32172. }
  32173. } else if (properties.hasEncoding) {
  32174. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  32175. continue;
  32176. }
  32177. }
  32178. const glyphName = builtInEncoding[charCode];
  32179. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32180. if (unicode !== -1) {
  32181. toUnicode[charCode] = String.fromCharCode(unicode);
  32182. }
  32183. }
  32184. if (toUnicode.length > 0) {
  32185. properties.toUnicode.amend(toUnicode);
  32186. }
  32187. }
  32188. function amendFallbackToUnicode(properties) {
  32189. if (!properties.fallbackToUnicode) {
  32190. return;
  32191. }
  32192. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32193. return;
  32194. }
  32195. const toUnicode = [];
  32196. for (const charCode in properties.fallbackToUnicode) {
  32197. if (properties.toUnicode.has(charCode)) {
  32198. continue;
  32199. }
  32200. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  32201. }
  32202. if (toUnicode.length > 0) {
  32203. properties.toUnicode.amend(toUnicode);
  32204. }
  32205. }
  32206. class Glyph {
  32207. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32208. this.originalCharCode = originalCharCode;
  32209. this.fontChar = fontChar;
  32210. this.unicode = unicode;
  32211. this.accent = accent;
  32212. this.width = width;
  32213. this.vmetric = vmetric;
  32214. this.operatorListId = operatorListId;
  32215. this.isSpace = isSpace;
  32216. this.isInFont = isInFont;
  32217. }
  32218. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32219. 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;
  32220. }
  32221. }
  32222. function int16(b0, b1) {
  32223. return (b0 << 8) + b1;
  32224. }
  32225. function writeSignedInt16(bytes, index, value) {
  32226. bytes[index + 1] = value;
  32227. bytes[index] = value >>> 8;
  32228. }
  32229. function signedInt16(b0, b1) {
  32230. const value = (b0 << 8) + b1;
  32231. return value & 1 << 15 ? value - 0x10000 : value;
  32232. }
  32233. function int32(b0, b1, b2, b3) {
  32234. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  32235. }
  32236. function string16(value) {
  32237. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32238. }
  32239. function safeString16(value) {
  32240. if (value > 0x7fff) {
  32241. value = 0x7fff;
  32242. } else if (value < -0x8000) {
  32243. value = -0x8000;
  32244. }
  32245. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32246. }
  32247. function isTrueTypeFile(file) {
  32248. const header = file.peekBytes(4);
  32249. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  32250. }
  32251. function isTrueTypeCollectionFile(file) {
  32252. const header = file.peekBytes(4);
  32253. return (0, _util.bytesToString)(header) === "ttcf";
  32254. }
  32255. function isOpenTypeFile(file) {
  32256. const header = file.peekBytes(4);
  32257. return (0, _util.bytesToString)(header) === "OTTO";
  32258. }
  32259. function isType1File(file) {
  32260. const header = file.peekBytes(2);
  32261. if (header[0] === 0x25 && header[1] === 0x21) {
  32262. return true;
  32263. }
  32264. if (header[0] === 0x80 && header[1] === 0x01) {
  32265. return true;
  32266. }
  32267. return false;
  32268. }
  32269. function isCFFFile(file) {
  32270. const header = file.peekBytes(4);
  32271. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  32272. return true;
  32273. }
  32274. return false;
  32275. }
  32276. function getFontFileType(file, {
  32277. type,
  32278. subtype,
  32279. composite
  32280. }) {
  32281. let fileType, fileSubtype;
  32282. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  32283. if (composite) {
  32284. fileType = "CIDFontType2";
  32285. } else {
  32286. fileType = "TrueType";
  32287. }
  32288. } else if (isOpenTypeFile(file)) {
  32289. if (composite) {
  32290. fileType = "CIDFontType2";
  32291. } else {
  32292. fileType = "OpenType";
  32293. }
  32294. } else if (isType1File(file)) {
  32295. if (composite) {
  32296. fileType = "CIDFontType0";
  32297. } else {
  32298. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32299. }
  32300. } else if (isCFFFile(file)) {
  32301. if (composite) {
  32302. fileType = "CIDFontType0";
  32303. fileSubtype = "CIDFontType0C";
  32304. } else {
  32305. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32306. fileSubtype = "Type1C";
  32307. }
  32308. } else {
  32309. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  32310. fileType = type;
  32311. fileSubtype = subtype;
  32312. }
  32313. return [fileType, fileSubtype];
  32314. }
  32315. function applyStandardFontGlyphMap(map, glyphMap) {
  32316. for (const charCode in glyphMap) {
  32317. map[+charCode] = glyphMap[charCode];
  32318. }
  32319. }
  32320. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  32321. const toFontChar = [];
  32322. let unicode;
  32323. for (let i = 0, ii = encoding.length; i < ii; i++) {
  32324. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  32325. if (unicode !== -1) {
  32326. toFontChar[i] = unicode;
  32327. }
  32328. }
  32329. for (const charCode in differences) {
  32330. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  32331. if (unicode !== -1) {
  32332. toFontChar[+charCode] = unicode;
  32333. }
  32334. }
  32335. return toFontChar;
  32336. }
  32337. function convertCidString(charCode, cid, shouldThrow = false) {
  32338. switch (cid.length) {
  32339. case 1:
  32340. return cid.charCodeAt(0);
  32341. case 2:
  32342. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  32343. }
  32344. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  32345. if (shouldThrow) {
  32346. throw new _util.FormatError(msg);
  32347. }
  32348. (0, _util.warn)(msg);
  32349. return cid;
  32350. }
  32351. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  32352. const newMap = Object.create(null);
  32353. const toFontChar = [];
  32354. let privateUseAreaIndex = 0;
  32355. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32356. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32357. for (let originalCharCode in charCodeToGlyphId) {
  32358. originalCharCode |= 0;
  32359. let glyphId = charCodeToGlyphId[originalCharCode];
  32360. if (!hasGlyph(glyphId)) {
  32361. continue;
  32362. }
  32363. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  32364. privateUseAreaIndex++;
  32365. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  32366. (0, _util.warn)("Ran out of space in font private use area.");
  32367. break;
  32368. }
  32369. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32370. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32371. }
  32372. const fontCharCode = nextAvailableFontCharCode++;
  32373. if (glyphId === 0) {
  32374. glyphId = newGlyphZeroId;
  32375. }
  32376. newMap[fontCharCode] = glyphId;
  32377. toFontChar[originalCharCode] = fontCharCode;
  32378. }
  32379. return {
  32380. toFontChar,
  32381. charCodeToGlyphId: newMap,
  32382. nextAvailableFontCharCode
  32383. };
  32384. }
  32385. function getRanges(glyphs, numGlyphs) {
  32386. const codes = [];
  32387. for (const charCode in glyphs) {
  32388. if (glyphs[charCode] >= numGlyphs) {
  32389. continue;
  32390. }
  32391. codes.push({
  32392. fontCharCode: charCode | 0,
  32393. glyphId: glyphs[charCode]
  32394. });
  32395. }
  32396. if (codes.length === 0) {
  32397. codes.push({
  32398. fontCharCode: 0,
  32399. glyphId: 0
  32400. });
  32401. }
  32402. codes.sort(function fontGetRangesSort(a, b) {
  32403. return a.fontCharCode - b.fontCharCode;
  32404. });
  32405. const ranges = [];
  32406. const length = codes.length;
  32407. for (let n = 0; n < length;) {
  32408. const start = codes[n].fontCharCode;
  32409. const codeIndices = [codes[n].glyphId];
  32410. ++n;
  32411. let end = start;
  32412. while (n < length && end + 1 === codes[n].fontCharCode) {
  32413. codeIndices.push(codes[n].glyphId);
  32414. ++end;
  32415. ++n;
  32416. if (end === 0xffff) {
  32417. break;
  32418. }
  32419. }
  32420. ranges.push([start, end, codeIndices]);
  32421. }
  32422. return ranges;
  32423. }
  32424. function createCmapTable(glyphs, numGlyphs) {
  32425. const ranges = getRanges(glyphs, numGlyphs);
  32426. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  32427. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  32428. let i, ii, j, jj;
  32429. for (i = ranges.length - 1; i >= 0; --i) {
  32430. if (ranges[i][0] <= 0xffff) {
  32431. break;
  32432. }
  32433. }
  32434. const bmpLength = i + 1;
  32435. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  32436. ranges[i][1] = 0xfffe;
  32437. }
  32438. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  32439. const segCount = bmpLength + trailingRangesCount;
  32440. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  32441. let startCount = "";
  32442. let endCount = "";
  32443. let idDeltas = "";
  32444. let idRangeOffsets = "";
  32445. let glyphsIds = "";
  32446. let bias = 0;
  32447. let range, start, end, codes;
  32448. for (i = 0, ii = bmpLength; i < ii; i++) {
  32449. range = ranges[i];
  32450. start = range[0];
  32451. end = range[1];
  32452. startCount += string16(start);
  32453. endCount += string16(end);
  32454. codes = range[2];
  32455. let contiguous = true;
  32456. for (j = 1, jj = codes.length; j < jj; ++j) {
  32457. if (codes[j] !== codes[j - 1] + 1) {
  32458. contiguous = false;
  32459. break;
  32460. }
  32461. }
  32462. if (!contiguous) {
  32463. const offset = (segCount - i) * 2 + bias * 2;
  32464. bias += end - start + 1;
  32465. idDeltas += string16(0);
  32466. idRangeOffsets += string16(offset);
  32467. for (j = 0, jj = codes.length; j < jj; ++j) {
  32468. glyphsIds += string16(codes[j]);
  32469. }
  32470. } else {
  32471. const startCode = codes[0];
  32472. idDeltas += string16(startCode - start & 0xffff);
  32473. idRangeOffsets += string16(0);
  32474. }
  32475. }
  32476. if (trailingRangesCount > 0) {
  32477. endCount += "\xFF\xFF";
  32478. startCount += "\xFF\xFF";
  32479. idDeltas += "\x00\x01";
  32480. idRangeOffsets += "\x00\x00";
  32481. }
  32482. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  32483. let format31012 = "";
  32484. let header31012 = "";
  32485. if (numTables > 1) {
  32486. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  32487. format31012 = "";
  32488. for (i = 0, ii = ranges.length; i < ii; i++) {
  32489. range = ranges[i];
  32490. start = range[0];
  32491. codes = range[2];
  32492. let code = codes[0];
  32493. for (j = 1, jj = codes.length; j < jj; ++j) {
  32494. if (codes[j] !== codes[j - 1] + 1) {
  32495. end = range[0] + j - 1;
  32496. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  32497. start = end + 1;
  32498. code = codes[j];
  32499. }
  32500. }
  32501. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  32502. }
  32503. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  32504. }
  32505. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  32506. }
  32507. function validateOS2Table(os2, file) {
  32508. file.pos = (file.start || 0) + os2.offset;
  32509. const version = file.getUint16();
  32510. file.skip(60);
  32511. const selection = file.getUint16();
  32512. if (version < 4 && selection & 0x0300) {
  32513. return false;
  32514. }
  32515. const firstChar = file.getUint16();
  32516. const lastChar = file.getUint16();
  32517. if (firstChar > lastChar) {
  32518. return false;
  32519. }
  32520. file.skip(6);
  32521. const usWinAscent = file.getUint16();
  32522. if (usWinAscent === 0) {
  32523. return false;
  32524. }
  32525. os2.data[8] = os2.data[9] = 0;
  32526. return true;
  32527. }
  32528. function createOS2Table(properties, charstrings, override) {
  32529. override = override || {
  32530. unitsPerEm: 0,
  32531. yMax: 0,
  32532. yMin: 0,
  32533. ascent: 0,
  32534. descent: 0
  32535. };
  32536. let ulUnicodeRange1 = 0;
  32537. let ulUnicodeRange2 = 0;
  32538. let ulUnicodeRange3 = 0;
  32539. let ulUnicodeRange4 = 0;
  32540. let firstCharIndex = null;
  32541. let lastCharIndex = 0;
  32542. if (charstrings) {
  32543. for (let code in charstrings) {
  32544. code |= 0;
  32545. if (firstCharIndex > code || !firstCharIndex) {
  32546. firstCharIndex = code;
  32547. }
  32548. if (lastCharIndex < code) {
  32549. lastCharIndex = code;
  32550. }
  32551. const position = (0, _unicode.getUnicodeRangeFor)(code);
  32552. if (position < 32) {
  32553. ulUnicodeRange1 |= 1 << position;
  32554. } else if (position < 64) {
  32555. ulUnicodeRange2 |= 1 << position - 32;
  32556. } else if (position < 96) {
  32557. ulUnicodeRange3 |= 1 << position - 64;
  32558. } else if (position < 123) {
  32559. ulUnicodeRange4 |= 1 << position - 96;
  32560. } else {
  32561. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  32562. }
  32563. }
  32564. if (lastCharIndex > 0xffff) {
  32565. lastCharIndex = 0xffff;
  32566. }
  32567. } else {
  32568. firstCharIndex = 0;
  32569. lastCharIndex = 255;
  32570. }
  32571. const bbox = properties.bbox || [0, 0, 0, 0];
  32572. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  32573. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  32574. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  32575. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  32576. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  32577. typoDescent = -typoDescent;
  32578. }
  32579. const winAscent = override.yMax || typoAscent;
  32580. const winDescent = -override.yMin || -typoDescent;
  32581. 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";
  32582. }
  32583. function createPostTable(properties) {
  32584. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  32585. 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";
  32586. }
  32587. function createPostscriptName(name) {
  32588. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  32589. }
  32590. function createNameTable(name, proto) {
  32591. if (!proto) {
  32592. proto = [[], []];
  32593. }
  32594. 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"];
  32595. const stringsUnicode = [];
  32596. let i, ii, j, jj, str;
  32597. for (i = 0, ii = strings.length; i < ii; i++) {
  32598. str = proto[1][i] || strings[i];
  32599. const strBufUnicode = [];
  32600. for (j = 0, jj = str.length; j < jj; j++) {
  32601. strBufUnicode.push(string16(str.charCodeAt(j)));
  32602. }
  32603. stringsUnicode.push(strBufUnicode.join(""));
  32604. }
  32605. const names = [strings, stringsUnicode];
  32606. const platforms = ["\x00\x01", "\x00\x03"];
  32607. const encodings = ["\x00\x00", "\x00\x01"];
  32608. const languages = ["\x00\x00", "\x04\x09"];
  32609. const namesRecordCount = strings.length * platforms.length;
  32610. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  32611. let strOffset = 0;
  32612. for (i = 0, ii = platforms.length; i < ii; i++) {
  32613. const strs = names[i];
  32614. for (j = 0, jj = strs.length; j < jj; j++) {
  32615. str = strs[j];
  32616. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  32617. nameTable += nameRecord;
  32618. strOffset += str.length;
  32619. }
  32620. }
  32621. nameTable += strings.join("") + stringsUnicode.join("");
  32622. return nameTable;
  32623. }
  32624. class Font {
  32625. constructor(name, file, properties) {
  32626. this.name = name;
  32627. this.psName = null;
  32628. this.mimetype = null;
  32629. this.disableFontFace = false;
  32630. this.loadedName = properties.loadedName;
  32631. this.isType3Font = properties.isType3Font;
  32632. this.missingFile = false;
  32633. this.cssFontInfo = properties.cssFontInfo;
  32634. this._charsCache = Object.create(null);
  32635. this._glyphCache = Object.create(null);
  32636. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  32637. if (!isSerifFont && !properties.isSimulatedFlags) {
  32638. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  32639. serifFonts = (0, _standard_fonts.getSerifFonts)();
  32640. for (const namePart of baseName.split("+")) {
  32641. if (serifFonts[namePart]) {
  32642. isSerifFont = true;
  32643. break;
  32644. }
  32645. }
  32646. }
  32647. this.isSerifFont = isSerifFont;
  32648. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  32649. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  32650. let type = properties.type;
  32651. let subtype = properties.subtype;
  32652. this.type = type;
  32653. this.subtype = subtype;
  32654. let fallbackName = "sans-serif";
  32655. if (this.isMonospace) {
  32656. fallbackName = "monospace";
  32657. } else if (this.isSerifFont) {
  32658. fallbackName = "serif";
  32659. }
  32660. this.fallbackName = fallbackName;
  32661. this.differences = properties.differences;
  32662. this.widths = properties.widths;
  32663. this.defaultWidth = properties.defaultWidth;
  32664. this.composite = properties.composite;
  32665. this.cMap = properties.cMap;
  32666. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  32667. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  32668. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  32669. this.lineHeight = this.ascent - this.descent;
  32670. this.fontMatrix = properties.fontMatrix;
  32671. this.bbox = properties.bbox;
  32672. this.defaultEncoding = properties.defaultEncoding;
  32673. this.toUnicode = properties.toUnicode;
  32674. this.toFontChar = [];
  32675. if (properties.type === "Type3") {
  32676. for (let charCode = 0; charCode < 256; charCode++) {
  32677. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  32678. }
  32679. this.fontType = _util.FontType.TYPE3;
  32680. return;
  32681. }
  32682. this.cidEncoding = properties.cidEncoding || "";
  32683. this.vertical = !!properties.vertical;
  32684. if (this.vertical) {
  32685. this.vmetrics = properties.vmetrics;
  32686. this.defaultVMetrics = properties.defaultVMetrics;
  32687. }
  32688. if (!file || file.isEmpty) {
  32689. if (file) {
  32690. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  32691. }
  32692. this.fallbackToSystemFont(properties);
  32693. return;
  32694. }
  32695. [type, subtype] = getFontFileType(file, properties);
  32696. if (type !== this.type || subtype !== this.subtype) {
  32697. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  32698. }
  32699. let data;
  32700. try {
  32701. switch (type) {
  32702. case "MMType1":
  32703. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  32704. case "Type1":
  32705. case "CIDFontType0":
  32706. this.mimetype = "font/opentype";
  32707. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  32708. adjustWidths(properties);
  32709. data = this.convert(name, cff, properties);
  32710. break;
  32711. case "OpenType":
  32712. case "TrueType":
  32713. case "CIDFontType2":
  32714. this.mimetype = "font/opentype";
  32715. data = this.checkAndRepair(name, file, properties);
  32716. if (this.isOpenType) {
  32717. adjustWidths(properties);
  32718. type = "OpenType";
  32719. }
  32720. break;
  32721. default:
  32722. throw new _util.FormatError(`Font ${type} is not supported`);
  32723. }
  32724. } catch (e) {
  32725. (0, _util.warn)(e);
  32726. this.fallbackToSystemFont(properties);
  32727. return;
  32728. }
  32729. amendFallbackToUnicode(properties);
  32730. this.data = data;
  32731. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32732. this.fontMatrix = properties.fontMatrix;
  32733. this.widths = properties.widths;
  32734. this.defaultWidth = properties.defaultWidth;
  32735. this.toUnicode = properties.toUnicode;
  32736. this.seacMap = properties.seacMap;
  32737. }
  32738. get renderer() {
  32739. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  32740. return (0, _util.shadow)(this, "renderer", renderer);
  32741. }
  32742. exportData(extraProperties = false) {
  32743. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  32744. const data = Object.create(null);
  32745. let property, value;
  32746. for (property of exportDataProperties) {
  32747. value = this[property];
  32748. if (value !== undefined) {
  32749. data[property] = value;
  32750. }
  32751. }
  32752. return data;
  32753. }
  32754. fallbackToSystemFont(properties) {
  32755. this.missingFile = true;
  32756. const name = this.name;
  32757. const type = this.type;
  32758. const subtype = this.subtype;
  32759. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  32760. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  32761. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  32762. const isStandardFont = !!stdFontMap[fontName];
  32763. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  32764. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  32765. this.bold = fontName.search(/bold/gi) !== -1;
  32766. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  32767. this.black = name.search(/Black/g) !== -1;
  32768. const isNarrow = name.search(/Narrow/g) !== -1;
  32769. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  32770. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  32771. const cidToGidMap = properties.cidToGidMap;
  32772. const map = [];
  32773. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32774. if (/Arial-?Black/i.test(name)) {
  32775. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  32776. } else if (/Calibri/i.test(name)) {
  32777. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  32778. }
  32779. if (cidToGidMap) {
  32780. for (const charCode in map) {
  32781. const cid = map[charCode];
  32782. if (cidToGidMap[cid] !== undefined) {
  32783. map[+charCode] = cidToGidMap[cid];
  32784. }
  32785. }
  32786. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32787. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32788. const cid = map[charCode];
  32789. if (cidToGidMap[cid] === undefined) {
  32790. map[+charCode] = unicodeCharCode;
  32791. }
  32792. });
  32793. }
  32794. }
  32795. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32796. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32797. map[+charCode] = unicodeCharCode;
  32798. });
  32799. }
  32800. this.toFontChar = map;
  32801. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  32802. } else if (/Symbol/i.test(fontName)) {
  32803. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32804. } else if (/Dingbats/i.test(fontName)) {
  32805. if (/Wingdings/i.test(name)) {
  32806. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  32807. }
  32808. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  32809. } else if (isStandardFont) {
  32810. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32811. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32812. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32813. map[+charCode] = unicodeCharCode;
  32814. });
  32815. }
  32816. this.toFontChar = map;
  32817. } else {
  32818. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32819. const map = [];
  32820. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  32821. if (!this.composite) {
  32822. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  32823. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32824. if (unicode !== -1) {
  32825. unicodeCharCode = unicode;
  32826. }
  32827. }
  32828. map[+charCode] = unicodeCharCode;
  32829. });
  32830. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32831. if (/Verdana/i.test(name)) {
  32832. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32833. }
  32834. }
  32835. this.toFontChar = map;
  32836. }
  32837. amendFallbackToUnicode(properties);
  32838. this.loadedName = fontName.split("-")[0];
  32839. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32840. }
  32841. checkAndRepair(name, font, properties) {
  32842. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  32843. function readTables(file, numTables) {
  32844. const tables = Object.create(null);
  32845. tables["OS/2"] = null;
  32846. tables.cmap = null;
  32847. tables.head = null;
  32848. tables.hhea = null;
  32849. tables.hmtx = null;
  32850. tables.maxp = null;
  32851. tables.name = null;
  32852. tables.post = null;
  32853. for (let i = 0; i < numTables; i++) {
  32854. const table = readTableEntry(file);
  32855. if (!VALID_TABLES.includes(table.tag)) {
  32856. continue;
  32857. }
  32858. if (table.length === 0) {
  32859. continue;
  32860. }
  32861. tables[table.tag] = table;
  32862. }
  32863. return tables;
  32864. }
  32865. function readTableEntry(file) {
  32866. const tag = file.getString(4);
  32867. const checksum = file.getInt32() >>> 0;
  32868. const offset = file.getInt32() >>> 0;
  32869. const length = file.getInt32() >>> 0;
  32870. const previousPosition = file.pos;
  32871. file.pos = file.start ? file.start : 0;
  32872. file.skip(offset);
  32873. const data = file.getBytes(length);
  32874. file.pos = previousPosition;
  32875. if (tag === "head") {
  32876. data[8] = data[9] = data[10] = data[11] = 0;
  32877. data[17] |= 0x20;
  32878. }
  32879. return {
  32880. tag,
  32881. checksum,
  32882. length,
  32883. offset,
  32884. data
  32885. };
  32886. }
  32887. function readOpenTypeHeader(ttf) {
  32888. return {
  32889. version: ttf.getString(4),
  32890. numTables: ttf.getUint16(),
  32891. searchRange: ttf.getUint16(),
  32892. entrySelector: ttf.getUint16(),
  32893. rangeShift: ttf.getUint16()
  32894. };
  32895. }
  32896. function readTrueTypeCollectionHeader(ttc) {
  32897. const ttcTag = ttc.getString(4);
  32898. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  32899. const majorVersion = ttc.getUint16();
  32900. const minorVersion = ttc.getUint16();
  32901. const numFonts = ttc.getInt32() >>> 0;
  32902. const offsetTable = [];
  32903. for (let i = 0; i < numFonts; i++) {
  32904. offsetTable.push(ttc.getInt32() >>> 0);
  32905. }
  32906. const header = {
  32907. ttcTag,
  32908. majorVersion,
  32909. minorVersion,
  32910. numFonts,
  32911. offsetTable
  32912. };
  32913. switch (majorVersion) {
  32914. case 1:
  32915. return header;
  32916. case 2:
  32917. header.dsigTag = ttc.getInt32() >>> 0;
  32918. header.dsigLength = ttc.getInt32() >>> 0;
  32919. header.dsigOffset = ttc.getInt32() >>> 0;
  32920. return header;
  32921. }
  32922. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  32923. }
  32924. function readTrueTypeCollectionData(ttc, fontName) {
  32925. const {
  32926. numFonts,
  32927. offsetTable
  32928. } = readTrueTypeCollectionHeader(ttc);
  32929. const fontNameParts = fontName.split("+");
  32930. let fallbackData;
  32931. for (let i = 0; i < numFonts; i++) {
  32932. ttc.pos = (ttc.start || 0) + offsetTable[i];
  32933. const potentialHeader = readOpenTypeHeader(ttc);
  32934. const potentialTables = readTables(ttc, potentialHeader.numTables);
  32935. if (!potentialTables.name) {
  32936. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  32937. }
  32938. const nameTable = readNameTable(potentialTables.name);
  32939. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  32940. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  32941. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  32942. if (!nameEntry) {
  32943. continue;
  32944. }
  32945. if (nameEntry === fontName) {
  32946. return {
  32947. header: potentialHeader,
  32948. tables: potentialTables
  32949. };
  32950. }
  32951. if (fontNameParts.length < 2) {
  32952. continue;
  32953. }
  32954. for (const part of fontNameParts) {
  32955. if (nameEntry === part) {
  32956. fallbackData = {
  32957. name: part,
  32958. header: potentialHeader,
  32959. tables: potentialTables
  32960. };
  32961. }
  32962. }
  32963. }
  32964. }
  32965. }
  32966. if (fallbackData) {
  32967. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  32968. return {
  32969. header: fallbackData.header,
  32970. tables: fallbackData.tables
  32971. };
  32972. }
  32973. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  32974. }
  32975. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  32976. if (!cmap) {
  32977. (0, _util.warn)("No cmap table available.");
  32978. return {
  32979. platformId: -1,
  32980. encodingId: -1,
  32981. mappings: [],
  32982. hasShortCmap: false
  32983. };
  32984. }
  32985. let segment;
  32986. let start = (file.start ? file.start : 0) + cmap.offset;
  32987. file.pos = start;
  32988. file.skip(2);
  32989. const numTables = file.getUint16();
  32990. let potentialTable;
  32991. let canBreak = false;
  32992. for (let i = 0; i < numTables; i++) {
  32993. const platformId = file.getUint16();
  32994. const encodingId = file.getUint16();
  32995. const offset = file.getInt32() >>> 0;
  32996. let useTable = false;
  32997. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  32998. continue;
  32999. }
  33000. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  33001. useTable = true;
  33002. } else if (platformId === 1 && encodingId === 0) {
  33003. useTable = true;
  33004. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  33005. useTable = true;
  33006. if (!isSymbolicFont) {
  33007. canBreak = true;
  33008. }
  33009. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  33010. useTable = true;
  33011. let correctlySorted = true;
  33012. if (i < numTables - 1) {
  33013. const nextBytes = file.peekBytes(2),
  33014. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  33015. if (nextPlatformId < platformId) {
  33016. correctlySorted = false;
  33017. }
  33018. }
  33019. if (correctlySorted) {
  33020. canBreak = true;
  33021. }
  33022. }
  33023. if (useTable) {
  33024. potentialTable = {
  33025. platformId,
  33026. encodingId,
  33027. offset
  33028. };
  33029. }
  33030. if (canBreak) {
  33031. break;
  33032. }
  33033. }
  33034. if (potentialTable) {
  33035. file.pos = start + potentialTable.offset;
  33036. }
  33037. if (!potentialTable || file.peekByte() === -1) {
  33038. (0, _util.warn)("Could not find a preferred cmap table.");
  33039. return {
  33040. platformId: -1,
  33041. encodingId: -1,
  33042. mappings: [],
  33043. hasShortCmap: false
  33044. };
  33045. }
  33046. const format = file.getUint16();
  33047. file.skip(2 + 2);
  33048. let hasShortCmap = false;
  33049. const mappings = [];
  33050. let j, glyphId;
  33051. if (format === 0) {
  33052. for (j = 0; j < 256; j++) {
  33053. const index = file.getByte();
  33054. if (!index) {
  33055. continue;
  33056. }
  33057. mappings.push({
  33058. charCode: j,
  33059. glyphId: index
  33060. });
  33061. }
  33062. hasShortCmap = true;
  33063. } else if (format === 2) {
  33064. const subHeaderKeys = [];
  33065. let maxSubHeaderKey = 0;
  33066. for (let i = 0; i < 256; i++) {
  33067. const subHeaderKey = file.getUint16() >> 3;
  33068. subHeaderKeys.push(subHeaderKey);
  33069. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  33070. }
  33071. const subHeaders = [];
  33072. for (let i = 0; i <= maxSubHeaderKey; i++) {
  33073. subHeaders.push({
  33074. firstCode: file.getUint16(),
  33075. entryCount: file.getUint16(),
  33076. idDelta: signedInt16(file.getByte(), file.getByte()),
  33077. idRangePos: file.pos + file.getUint16()
  33078. });
  33079. }
  33080. for (let i = 0; i < 256; i++) {
  33081. if (subHeaderKeys[i] === 0) {
  33082. file.pos = subHeaders[0].idRangePos + 2 * i;
  33083. glyphId = file.getUint16();
  33084. mappings.push({
  33085. charCode: i,
  33086. glyphId
  33087. });
  33088. } else {
  33089. const s = subHeaders[subHeaderKeys[i]];
  33090. for (j = 0; j < s.entryCount; j++) {
  33091. const charCode = (i << 8) + j + s.firstCode;
  33092. file.pos = s.idRangePos + 2 * j;
  33093. glyphId = file.getUint16();
  33094. if (glyphId !== 0) {
  33095. glyphId = (glyphId + s.idDelta) % 65536;
  33096. }
  33097. mappings.push({
  33098. charCode,
  33099. glyphId
  33100. });
  33101. }
  33102. }
  33103. }
  33104. } else if (format === 4) {
  33105. const segCount = file.getUint16() >> 1;
  33106. file.skip(6);
  33107. const segments = [];
  33108. let segIndex;
  33109. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33110. segments.push({
  33111. end: file.getUint16()
  33112. });
  33113. }
  33114. file.skip(2);
  33115. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33116. segments[segIndex].start = file.getUint16();
  33117. }
  33118. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33119. segments[segIndex].delta = file.getUint16();
  33120. }
  33121. let offsetsCount = 0,
  33122. offsetIndex;
  33123. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33124. segment = segments[segIndex];
  33125. const rangeOffset = file.getUint16();
  33126. if (!rangeOffset) {
  33127. segment.offsetIndex = -1;
  33128. continue;
  33129. }
  33130. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  33131. segment.offsetIndex = offsetIndex;
  33132. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  33133. }
  33134. const offsets = [];
  33135. for (j = 0; j < offsetsCount; j++) {
  33136. offsets.push(file.getUint16());
  33137. }
  33138. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33139. segment = segments[segIndex];
  33140. start = segment.start;
  33141. const end = segment.end;
  33142. const delta = segment.delta;
  33143. offsetIndex = segment.offsetIndex;
  33144. for (j = start; j <= end; j++) {
  33145. if (j === 0xffff) {
  33146. continue;
  33147. }
  33148. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  33149. glyphId = glyphId + delta & 0xffff;
  33150. mappings.push({
  33151. charCode: j,
  33152. glyphId
  33153. });
  33154. }
  33155. }
  33156. } else if (format === 6) {
  33157. const firstCode = file.getUint16();
  33158. const entryCount = file.getUint16();
  33159. for (j = 0; j < entryCount; j++) {
  33160. glyphId = file.getUint16();
  33161. const charCode = firstCode + j;
  33162. mappings.push({
  33163. charCode,
  33164. glyphId
  33165. });
  33166. }
  33167. } else {
  33168. (0, _util.warn)("cmap table has unsupported format: " + format);
  33169. return {
  33170. platformId: -1,
  33171. encodingId: -1,
  33172. mappings: [],
  33173. hasShortCmap: false
  33174. };
  33175. }
  33176. mappings.sort(function (a, b) {
  33177. return a.charCode - b.charCode;
  33178. });
  33179. for (let i = 1; i < mappings.length; i++) {
  33180. if (mappings[i - 1].charCode === mappings[i].charCode) {
  33181. mappings.splice(i, 1);
  33182. i--;
  33183. }
  33184. }
  33185. return {
  33186. platformId: potentialTable.platformId,
  33187. encodingId: potentialTable.encodingId,
  33188. mappings,
  33189. hasShortCmap
  33190. };
  33191. }
  33192. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  33193. if (!header) {
  33194. if (metrics) {
  33195. metrics.data = null;
  33196. }
  33197. return;
  33198. }
  33199. file.pos = (file.start ? file.start : 0) + header.offset;
  33200. file.pos += 4;
  33201. file.pos += 2;
  33202. file.pos += 2;
  33203. file.pos += 2;
  33204. file.pos += 2;
  33205. file.pos += 2;
  33206. file.pos += 2;
  33207. file.pos += 2;
  33208. file.pos += 2;
  33209. file.pos += 2;
  33210. const caretOffset = file.getUint16();
  33211. file.pos += 8;
  33212. file.pos += 2;
  33213. let numOfMetrics = file.getUint16();
  33214. if (caretOffset !== 0) {
  33215. const macStyle = int16(headTable.data[44], headTable.data[45]);
  33216. if (!(macStyle & 2)) {
  33217. header.data[22] = 0;
  33218. header.data[23] = 0;
  33219. }
  33220. }
  33221. if (numOfMetrics > numGlyphs) {
  33222. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  33223. numOfMetrics = numGlyphs;
  33224. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  33225. header.data[35] = numOfMetrics & 0x00ff;
  33226. }
  33227. const numOfSidebearings = numGlyphs - numOfMetrics;
  33228. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  33229. if (numMissing > 0) {
  33230. const entries = new Uint8Array(metrics.length + numMissing * 2);
  33231. entries.set(metrics.data);
  33232. if (dupFirstEntry) {
  33233. entries[metrics.length] = metrics.data[2];
  33234. entries[metrics.length + 1] = metrics.data[3];
  33235. }
  33236. metrics.data = entries;
  33237. }
  33238. }
  33239. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  33240. const glyphProfile = {
  33241. length: 0,
  33242. sizeOfInstructions: 0
  33243. };
  33244. if (sourceEnd - sourceStart <= 12) {
  33245. return glyphProfile;
  33246. }
  33247. const glyf = source.subarray(sourceStart, sourceEnd);
  33248. let contoursCount = signedInt16(glyf[0], glyf[1]);
  33249. if (contoursCount < 0) {
  33250. contoursCount = -1;
  33251. writeSignedInt16(glyf, 0, contoursCount);
  33252. dest.set(glyf, destStart);
  33253. glyphProfile.length = glyf.length;
  33254. return glyphProfile;
  33255. }
  33256. let i,
  33257. j = 10,
  33258. flagsCount = 0;
  33259. for (i = 0; i < contoursCount; i++) {
  33260. const endPoint = glyf[j] << 8 | glyf[j + 1];
  33261. flagsCount = endPoint + 1;
  33262. j += 2;
  33263. }
  33264. const instructionsStart = j;
  33265. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  33266. glyphProfile.sizeOfInstructions = instructionsLength;
  33267. j += 2 + instructionsLength;
  33268. const instructionsEnd = j;
  33269. let coordinatesLength = 0;
  33270. for (i = 0; i < flagsCount; i++) {
  33271. const flag = glyf[j++];
  33272. if (flag & 0xc0) {
  33273. glyf[j - 1] = flag & 0x3f;
  33274. }
  33275. let xLength = 2;
  33276. if (flag & 2) {
  33277. xLength = 1;
  33278. } else if (flag & 16) {
  33279. xLength = 0;
  33280. }
  33281. let yLength = 2;
  33282. if (flag & 4) {
  33283. yLength = 1;
  33284. } else if (flag & 32) {
  33285. yLength = 0;
  33286. }
  33287. const xyLength = xLength + yLength;
  33288. coordinatesLength += xyLength;
  33289. if (flag & 8) {
  33290. const repeat = glyf[j++];
  33291. i += repeat;
  33292. coordinatesLength += repeat * xyLength;
  33293. }
  33294. }
  33295. if (coordinatesLength === 0) {
  33296. return glyphProfile;
  33297. }
  33298. let glyphDataLength = j + coordinatesLength;
  33299. if (glyphDataLength > glyf.length) {
  33300. return glyphProfile;
  33301. }
  33302. if (!hintsValid && instructionsLength > 0) {
  33303. dest.set(glyf.subarray(0, instructionsStart), destStart);
  33304. dest.set([0, 0], destStart + instructionsStart);
  33305. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  33306. glyphDataLength -= instructionsLength;
  33307. if (glyf.length - glyphDataLength > 3) {
  33308. glyphDataLength = glyphDataLength + 3 & ~3;
  33309. }
  33310. glyphProfile.length = glyphDataLength;
  33311. return glyphProfile;
  33312. }
  33313. if (glyf.length - glyphDataLength > 3) {
  33314. glyphDataLength = glyphDataLength + 3 & ~3;
  33315. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  33316. glyphProfile.length = glyphDataLength;
  33317. return glyphProfile;
  33318. }
  33319. dest.set(glyf, destStart);
  33320. glyphProfile.length = glyf.length;
  33321. return glyphProfile;
  33322. }
  33323. function sanitizeHead(head, numGlyphs, locaLength) {
  33324. const data = head.data;
  33325. const version = int32(data[0], data[1], data[2], data[3]);
  33326. if (version >> 16 !== 1) {
  33327. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  33328. data[0] = 0;
  33329. data[1] = 1;
  33330. data[2] = 0;
  33331. data[3] = 0;
  33332. }
  33333. const indexToLocFormat = int16(data[50], data[51]);
  33334. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  33335. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  33336. const numGlyphsPlusOne = numGlyphs + 1;
  33337. if (locaLength === numGlyphsPlusOne << 1) {
  33338. data[50] = 0;
  33339. data[51] = 0;
  33340. } else if (locaLength === numGlyphsPlusOne << 2) {
  33341. data[50] = 0;
  33342. data[51] = 1;
  33343. } else {
  33344. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  33345. }
  33346. }
  33347. }
  33348. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  33349. let itemSize, itemDecode, itemEncode;
  33350. if (isGlyphLocationsLong) {
  33351. itemSize = 4;
  33352. itemDecode = function fontItemDecodeLong(data, offset) {
  33353. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  33354. };
  33355. itemEncode = function fontItemEncodeLong(data, offset, value) {
  33356. data[offset] = value >>> 24 & 0xff;
  33357. data[offset + 1] = value >> 16 & 0xff;
  33358. data[offset + 2] = value >> 8 & 0xff;
  33359. data[offset + 3] = value & 0xff;
  33360. };
  33361. } else {
  33362. itemSize = 2;
  33363. itemDecode = function fontItemDecode(data, offset) {
  33364. return data[offset] << 9 | data[offset + 1] << 1;
  33365. };
  33366. itemEncode = function fontItemEncode(data, offset, value) {
  33367. data[offset] = value >> 9 & 0xff;
  33368. data[offset + 1] = value >> 1 & 0xff;
  33369. };
  33370. }
  33371. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  33372. const locaDataSize = itemSize * (1 + numGlyphsOut);
  33373. const locaData = new Uint8Array(locaDataSize);
  33374. locaData.set(loca.data.subarray(0, locaDataSize));
  33375. loca.data = locaData;
  33376. const oldGlyfData = glyf.data;
  33377. const oldGlyfDataLength = oldGlyfData.length;
  33378. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  33379. let i, j;
  33380. const locaEntries = [];
  33381. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  33382. let offset = itemDecode(locaData, j);
  33383. if (offset > oldGlyfDataLength) {
  33384. offset = oldGlyfDataLength;
  33385. }
  33386. locaEntries.push({
  33387. index: i,
  33388. offset,
  33389. endOffset: 0
  33390. });
  33391. }
  33392. locaEntries.sort((a, b) => {
  33393. return a.offset - b.offset;
  33394. });
  33395. for (i = 0; i < numGlyphs; i++) {
  33396. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  33397. }
  33398. locaEntries.sort((a, b) => {
  33399. return a.index - b.index;
  33400. });
  33401. const missingGlyphs = Object.create(null);
  33402. let writeOffset = 0;
  33403. itemEncode(locaData, 0, writeOffset);
  33404. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  33405. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  33406. const newLength = glyphProfile.length;
  33407. if (newLength === 0) {
  33408. missingGlyphs[i] = true;
  33409. }
  33410. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  33411. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  33412. }
  33413. writeOffset += newLength;
  33414. itemEncode(locaData, j, writeOffset);
  33415. }
  33416. if (writeOffset === 0) {
  33417. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  33418. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  33419. itemEncode(locaData, j, simpleGlyph.length);
  33420. }
  33421. glyf.data = simpleGlyph;
  33422. } else if (dupFirstEntry) {
  33423. const firstEntryLength = itemDecode(locaData, itemSize);
  33424. if (newGlyfData.length > firstEntryLength + writeOffset) {
  33425. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  33426. } else {
  33427. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  33428. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  33429. }
  33430. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  33431. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  33432. } else {
  33433. glyf.data = newGlyfData.subarray(0, writeOffset);
  33434. }
  33435. return {
  33436. missingGlyphs,
  33437. maxSizeOfInstructions
  33438. };
  33439. }
  33440. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  33441. const start = (font.start ? font.start : 0) + post.offset;
  33442. font.pos = start;
  33443. const length = post.length,
  33444. end = start + length;
  33445. const version = font.getInt32();
  33446. font.skip(28);
  33447. let glyphNames;
  33448. let valid = true;
  33449. let i;
  33450. switch (version) {
  33451. case 0x00010000:
  33452. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  33453. break;
  33454. case 0x00020000:
  33455. const numGlyphs = font.getUint16();
  33456. if (numGlyphs !== maxpNumGlyphs) {
  33457. valid = false;
  33458. break;
  33459. }
  33460. const glyphNameIndexes = [];
  33461. for (i = 0; i < numGlyphs; ++i) {
  33462. const index = font.getUint16();
  33463. if (index >= 32768) {
  33464. valid = false;
  33465. break;
  33466. }
  33467. glyphNameIndexes.push(index);
  33468. }
  33469. if (!valid) {
  33470. break;
  33471. }
  33472. const customNames = [],
  33473. strBuf = [];
  33474. while (font.pos < end) {
  33475. const stringLength = font.getByte();
  33476. strBuf.length = stringLength;
  33477. for (i = 0; i < stringLength; ++i) {
  33478. strBuf[i] = String.fromCharCode(font.getByte());
  33479. }
  33480. customNames.push(strBuf.join(""));
  33481. }
  33482. glyphNames = [];
  33483. for (i = 0; i < numGlyphs; ++i) {
  33484. const j = glyphNameIndexes[i];
  33485. if (j < 258) {
  33486. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  33487. continue;
  33488. }
  33489. glyphNames.push(customNames[j - 258]);
  33490. }
  33491. break;
  33492. case 0x00030000:
  33493. break;
  33494. default:
  33495. (0, _util.warn)("Unknown/unsupported post table version " + version);
  33496. valid = false;
  33497. if (propertiesObj.defaultEncoding) {
  33498. glyphNames = propertiesObj.defaultEncoding;
  33499. }
  33500. break;
  33501. }
  33502. propertiesObj.glyphNames = glyphNames;
  33503. return valid;
  33504. }
  33505. function readNameTable(nameTable) {
  33506. const start = (font.start ? font.start : 0) + nameTable.offset;
  33507. font.pos = start;
  33508. const names = [[], []];
  33509. const length = nameTable.length,
  33510. end = start + length;
  33511. const format = font.getUint16();
  33512. const FORMAT_0_HEADER_LENGTH = 6;
  33513. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  33514. return names;
  33515. }
  33516. const numRecords = font.getUint16();
  33517. const stringsStart = font.getUint16();
  33518. const records = [];
  33519. const NAME_RECORD_LENGTH = 12;
  33520. let i, ii;
  33521. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  33522. const r = {
  33523. platform: font.getUint16(),
  33524. encoding: font.getUint16(),
  33525. language: font.getUint16(),
  33526. name: font.getUint16(),
  33527. length: font.getUint16(),
  33528. offset: font.getUint16()
  33529. };
  33530. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  33531. records.push(r);
  33532. }
  33533. }
  33534. for (i = 0, ii = records.length; i < ii; i++) {
  33535. const record = records[i];
  33536. if (record.length <= 0) {
  33537. continue;
  33538. }
  33539. const pos = start + stringsStart + record.offset;
  33540. if (pos + record.length > end) {
  33541. continue;
  33542. }
  33543. font.pos = pos;
  33544. const nameIndex = record.name;
  33545. if (record.encoding) {
  33546. let str = "";
  33547. for (let j = 0, jj = record.length; j < jj; j += 2) {
  33548. str += String.fromCharCode(font.getUint16());
  33549. }
  33550. names[1][nameIndex] = str;
  33551. } else {
  33552. names[0][nameIndex] = font.getString(record.length);
  33553. }
  33554. }
  33555. return names;
  33556. }
  33557. 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];
  33558. function sanitizeTTProgram(table, ttContext) {
  33559. let data = table.data;
  33560. let i = 0,
  33561. j,
  33562. n,
  33563. b,
  33564. funcId,
  33565. pc,
  33566. lastEndf = 0,
  33567. lastDeff = 0;
  33568. const stack = [];
  33569. const callstack = [];
  33570. const functionsCalled = [];
  33571. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  33572. let inFDEF = false,
  33573. ifLevel = 0,
  33574. inELSE = 0;
  33575. for (let ii = data.length; i < ii;) {
  33576. const op = data[i++];
  33577. if (op === 0x40) {
  33578. n = data[i++];
  33579. if (inFDEF || inELSE) {
  33580. i += n;
  33581. } else {
  33582. for (j = 0; j < n; j++) {
  33583. stack.push(data[i++]);
  33584. }
  33585. }
  33586. } else if (op === 0x41) {
  33587. n = data[i++];
  33588. if (inFDEF || inELSE) {
  33589. i += n * 2;
  33590. } else {
  33591. for (j = 0; j < n; j++) {
  33592. b = data[i++];
  33593. stack.push(b << 8 | data[i++]);
  33594. }
  33595. }
  33596. } else if ((op & 0xf8) === 0xb0) {
  33597. n = op - 0xb0 + 1;
  33598. if (inFDEF || inELSE) {
  33599. i += n;
  33600. } else {
  33601. for (j = 0; j < n; j++) {
  33602. stack.push(data[i++]);
  33603. }
  33604. }
  33605. } else if ((op & 0xf8) === 0xb8) {
  33606. n = op - 0xb8 + 1;
  33607. if (inFDEF || inELSE) {
  33608. i += n * 2;
  33609. } else {
  33610. for (j = 0; j < n; j++) {
  33611. b = data[i++];
  33612. stack.push(b << 8 | data[i++]);
  33613. }
  33614. }
  33615. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  33616. if (!inFDEF && !inELSE) {
  33617. funcId = stack[stack.length - 1];
  33618. if (isNaN(funcId)) {
  33619. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  33620. } else {
  33621. ttContext.functionsUsed[funcId] = true;
  33622. if (funcId in ttContext.functionsStackDeltas) {
  33623. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  33624. if (newStackLength < 0) {
  33625. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  33626. ttContext.hintsValid = false;
  33627. return;
  33628. }
  33629. stack.length = newStackLength;
  33630. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  33631. callstack.push({
  33632. data,
  33633. i,
  33634. stackTop: stack.length - 1
  33635. });
  33636. functionsCalled.push(funcId);
  33637. pc = ttContext.functionsDefined[funcId];
  33638. if (!pc) {
  33639. (0, _util.warn)("TT: CALL non-existent function");
  33640. ttContext.hintsValid = false;
  33641. return;
  33642. }
  33643. data = pc.data;
  33644. i = pc.i;
  33645. }
  33646. }
  33647. }
  33648. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  33649. if (inFDEF || inELSE) {
  33650. (0, _util.warn)("TT: nested FDEFs not allowed");
  33651. tooComplexToFollowFunctions = true;
  33652. }
  33653. inFDEF = true;
  33654. lastDeff = i;
  33655. funcId = stack.pop();
  33656. ttContext.functionsDefined[funcId] = {
  33657. data,
  33658. i
  33659. };
  33660. } else if (op === 0x2d) {
  33661. if (inFDEF) {
  33662. inFDEF = false;
  33663. lastEndf = i;
  33664. } else {
  33665. pc = callstack.pop();
  33666. if (!pc) {
  33667. (0, _util.warn)("TT: ENDF bad stack");
  33668. ttContext.hintsValid = false;
  33669. return;
  33670. }
  33671. funcId = functionsCalled.pop();
  33672. data = pc.data;
  33673. i = pc.i;
  33674. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  33675. }
  33676. } else if (op === 0x89) {
  33677. if (inFDEF || inELSE) {
  33678. (0, _util.warn)("TT: nested IDEFs not allowed");
  33679. tooComplexToFollowFunctions = true;
  33680. }
  33681. inFDEF = true;
  33682. lastDeff = i;
  33683. } else if (op === 0x58) {
  33684. ++ifLevel;
  33685. } else if (op === 0x1b) {
  33686. inELSE = ifLevel;
  33687. } else if (op === 0x59) {
  33688. if (inELSE === ifLevel) {
  33689. inELSE = 0;
  33690. }
  33691. --ifLevel;
  33692. } else if (op === 0x1c) {
  33693. if (!inFDEF && !inELSE) {
  33694. const offset = stack[stack.length - 1];
  33695. if (offset > 0) {
  33696. i += offset - 1;
  33697. }
  33698. }
  33699. }
  33700. if (!inFDEF && !inELSE) {
  33701. let stackDelta = 0;
  33702. if (op <= 0x8e) {
  33703. stackDelta = TTOpsStackDeltas[op];
  33704. } else if (op >= 0xc0 && op <= 0xdf) {
  33705. stackDelta = -1;
  33706. } else if (op >= 0xe0) {
  33707. stackDelta = -2;
  33708. }
  33709. if (op >= 0x71 && op <= 0x75) {
  33710. n = stack.pop();
  33711. if (!isNaN(n)) {
  33712. stackDelta = -n * 2;
  33713. }
  33714. }
  33715. while (stackDelta < 0 && stack.length > 0) {
  33716. stack.pop();
  33717. stackDelta++;
  33718. }
  33719. while (stackDelta > 0) {
  33720. stack.push(NaN);
  33721. stackDelta--;
  33722. }
  33723. }
  33724. }
  33725. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  33726. const content = [data];
  33727. if (i > data.length) {
  33728. content.push(new Uint8Array(i - data.length));
  33729. }
  33730. if (lastDeff > lastEndf) {
  33731. (0, _util.warn)("TT: complementing a missing function tail");
  33732. content.push(new Uint8Array([0x22, 0x2d]));
  33733. }
  33734. foldTTTable(table, content);
  33735. }
  33736. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  33737. if (ttContext.tooComplexToFollowFunctions) {
  33738. return;
  33739. }
  33740. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  33741. (0, _util.warn)("TT: more functions defined than expected");
  33742. ttContext.hintsValid = false;
  33743. return;
  33744. }
  33745. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  33746. if (j > maxFunctionDefs) {
  33747. (0, _util.warn)("TT: invalid function id: " + j);
  33748. ttContext.hintsValid = false;
  33749. return;
  33750. }
  33751. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  33752. (0, _util.warn)("TT: undefined function: " + j);
  33753. ttContext.hintsValid = false;
  33754. return;
  33755. }
  33756. }
  33757. }
  33758. function foldTTTable(table, content) {
  33759. if (content.length > 1) {
  33760. let newLength = 0;
  33761. let j, jj;
  33762. for (j = 0, jj = content.length; j < jj; j++) {
  33763. newLength += content[j].length;
  33764. }
  33765. newLength = newLength + 3 & ~3;
  33766. const result = new Uint8Array(newLength);
  33767. let pos = 0;
  33768. for (j = 0, jj = content.length; j < jj; j++) {
  33769. result.set(content[j], pos);
  33770. pos += content[j].length;
  33771. }
  33772. table.data = result;
  33773. table.length = newLength;
  33774. }
  33775. }
  33776. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  33777. const ttContext = {
  33778. functionsDefined: [],
  33779. functionsUsed: [],
  33780. functionsStackDeltas: [],
  33781. tooComplexToFollowFunctions: false,
  33782. hintsValid: true
  33783. };
  33784. if (fpgm) {
  33785. sanitizeTTProgram(fpgm, ttContext);
  33786. }
  33787. if (prep) {
  33788. sanitizeTTProgram(prep, ttContext);
  33789. }
  33790. if (fpgm) {
  33791. checkInvalidFunctions(ttContext, maxFunctionDefs);
  33792. }
  33793. if (cvt && cvt.length & 1) {
  33794. const cvtData = new Uint8Array(cvt.length + 1);
  33795. cvtData.set(cvt.data);
  33796. cvt.data = cvtData;
  33797. }
  33798. return ttContext.hintsValid;
  33799. }
  33800. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  33801. let header, tables;
  33802. if (isTrueTypeCollectionFile(font)) {
  33803. const ttcData = readTrueTypeCollectionData(font, this.name);
  33804. header = ttcData.header;
  33805. tables = ttcData.tables;
  33806. } else {
  33807. header = readOpenTypeHeader(font);
  33808. tables = readTables(font, header.numTables);
  33809. }
  33810. let cff, cffFile;
  33811. const isTrueType = !tables["CFF "];
  33812. if (!isTrueType) {
  33813. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  33814. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  33815. cffFile = new _stream.Stream(tables["CFF "].data);
  33816. cff = new _cff_font.CFFFont(cffFile, properties);
  33817. adjustWidths(properties);
  33818. return this.convert(name, cff, properties);
  33819. }
  33820. delete tables.glyf;
  33821. delete tables.loca;
  33822. delete tables.fpgm;
  33823. delete tables.prep;
  33824. delete tables["cvt "];
  33825. this.isOpenType = true;
  33826. } else {
  33827. if (!tables.loca) {
  33828. throw new _util.FormatError('Required "loca" table is not found');
  33829. }
  33830. if (!tables.glyf) {
  33831. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  33832. tables.glyf = {
  33833. tag: "glyf",
  33834. data: new Uint8Array(0)
  33835. };
  33836. }
  33837. this.isOpenType = false;
  33838. }
  33839. if (!tables.maxp) {
  33840. throw new _util.FormatError('Required "maxp" table is not found');
  33841. }
  33842. font.pos = (font.start || 0) + tables.maxp.offset;
  33843. const version = font.getInt32();
  33844. const numGlyphs = font.getUint16();
  33845. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  33846. const {
  33847. scaleFactors
  33848. } = properties;
  33849. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  33850. const glyphs = new _glyf.GlyfTable({
  33851. glyfTable: tables.glyf.data,
  33852. isGlyphLocationsLong,
  33853. locaTable: tables.loca.data,
  33854. numGlyphs
  33855. });
  33856. glyphs.scale(scaleFactors);
  33857. const {
  33858. glyf,
  33859. loca,
  33860. isLocationLong
  33861. } = glyphs.write();
  33862. tables.glyf.data = glyf;
  33863. tables.loca.data = loca;
  33864. if (isLocationLong !== !!isGlyphLocationsLong) {
  33865. tables.head.data[50] = 0;
  33866. tables.head.data[51] = isLocationLong ? 1 : 0;
  33867. }
  33868. const metrics = tables.hmtx.data;
  33869. for (let i = 0; i < numGlyphs; i++) {
  33870. const j = 4 * i;
  33871. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  33872. metrics[j] = advanceWidth >> 8 & 0xff;
  33873. metrics[j + 1] = advanceWidth & 0xff;
  33874. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  33875. writeSignedInt16(metrics, j + 2, lsb);
  33876. }
  33877. }
  33878. let numGlyphsOut = numGlyphs + 1;
  33879. let dupFirstEntry = true;
  33880. if (numGlyphsOut > 0xffff) {
  33881. dupFirstEntry = false;
  33882. numGlyphsOut = numGlyphs;
  33883. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  33884. }
  33885. let maxFunctionDefs = 0;
  33886. let maxSizeOfInstructions = 0;
  33887. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  33888. font.pos += 8;
  33889. const maxZones = font.getUint16();
  33890. if (maxZones > 2) {
  33891. tables.maxp.data[14] = 0;
  33892. tables.maxp.data[15] = 2;
  33893. }
  33894. font.pos += 4;
  33895. maxFunctionDefs = font.getUint16();
  33896. font.pos += 4;
  33897. maxSizeOfInstructions = font.getUint16();
  33898. }
  33899. tables.maxp.data[4] = numGlyphsOut >> 8;
  33900. tables.maxp.data[5] = numGlyphsOut & 255;
  33901. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  33902. if (!hintsValid) {
  33903. delete tables.fpgm;
  33904. delete tables.prep;
  33905. delete tables["cvt "];
  33906. }
  33907. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  33908. if (!tables.head) {
  33909. throw new _util.FormatError('Required "head" table is not found');
  33910. }
  33911. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  33912. let missingGlyphs = Object.create(null);
  33913. if (isTrueType) {
  33914. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  33915. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  33916. missingGlyphs = glyphsInfo.missingGlyphs;
  33917. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  33918. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  33919. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  33920. }
  33921. }
  33922. if (!tables.hhea) {
  33923. throw new _util.FormatError('Required "hhea" table is not found');
  33924. }
  33925. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  33926. tables.hhea.data[10] = 0xff;
  33927. tables.hhea.data[11] = 0xff;
  33928. }
  33929. const metricsOverride = {
  33930. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  33931. yMax: int16(tables.head.data[42], tables.head.data[43]),
  33932. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  33933. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  33934. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  33935. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  33936. };
  33937. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  33938. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  33939. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  33940. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  33941. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  33942. this.lineGap = this.cssFontInfo.metrics.lineGap;
  33943. } else {
  33944. this.lineHeight = this.ascent - this.descent + this.lineGap;
  33945. }
  33946. if (tables.post) {
  33947. readPostScriptTable(tables.post, properties, numGlyphs);
  33948. }
  33949. tables.post = {
  33950. tag: "post",
  33951. data: createPostTable(properties)
  33952. };
  33953. const charCodeToGlyphId = [];
  33954. function hasGlyph(glyphId) {
  33955. return !missingGlyphs[glyphId];
  33956. }
  33957. if (properties.composite) {
  33958. const cidToGidMap = properties.cidToGidMap || [];
  33959. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  33960. properties.cMap.forEach(function (charCode, cid) {
  33961. if (typeof cid === "string") {
  33962. cid = convertCidString(charCode, cid, true);
  33963. }
  33964. if (cid > 0xffff) {
  33965. throw new _util.FormatError("Max size of CID is 65,535");
  33966. }
  33967. let glyphId = -1;
  33968. if (isCidToGidMapEmpty) {
  33969. glyphId = cid;
  33970. } else if (cidToGidMap[cid] !== undefined) {
  33971. glyphId = cidToGidMap[cid];
  33972. }
  33973. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  33974. charCodeToGlyphId[charCode] = glyphId;
  33975. }
  33976. });
  33977. } else {
  33978. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  33979. const cmapPlatformId = cmapTable.platformId;
  33980. const cmapEncodingId = cmapTable.encodingId;
  33981. const cmapMappings = cmapTable.mappings;
  33982. const cmapMappingsLength = cmapMappings.length;
  33983. let baseEncoding = [],
  33984. forcePostTable = false;
  33985. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  33986. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  33987. }
  33988. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  33989. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33990. for (let charCode = 0; charCode < 256; charCode++) {
  33991. let glyphName;
  33992. if (this.differences[charCode] !== undefined) {
  33993. glyphName = this.differences[charCode];
  33994. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  33995. glyphName = baseEncoding[charCode];
  33996. } else {
  33997. glyphName = _encodings.StandardEncoding[charCode];
  33998. }
  33999. if (!glyphName) {
  34000. continue;
  34001. }
  34002. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  34003. let unicodeOrCharCode;
  34004. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  34005. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  34006. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  34007. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  34008. }
  34009. if (unicodeOrCharCode === undefined) {
  34010. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  34011. const unicode = this.toUnicode.get(charCode);
  34012. if (unicode) {
  34013. unicodeOrCharCode = unicode.codePointAt(0);
  34014. }
  34015. }
  34016. if (unicodeOrCharCode === undefined) {
  34017. continue;
  34018. }
  34019. }
  34020. for (let i = 0; i < cmapMappingsLength; ++i) {
  34021. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  34022. continue;
  34023. }
  34024. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34025. break;
  34026. }
  34027. }
  34028. } else if (cmapPlatformId === 0) {
  34029. for (let i = 0; i < cmapMappingsLength; ++i) {
  34030. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  34031. }
  34032. forcePostTable = true;
  34033. } else {
  34034. for (let i = 0; i < cmapMappingsLength; ++i) {
  34035. let charCode = cmapMappings[i].charCode;
  34036. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  34037. charCode &= 0xff;
  34038. }
  34039. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34040. }
  34041. }
  34042. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  34043. for (let i = 0; i < 256; ++i) {
  34044. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  34045. continue;
  34046. }
  34047. const glyphName = this.differences[i] || baseEncoding[i];
  34048. if (!glyphName) {
  34049. continue;
  34050. }
  34051. const glyphId = properties.glyphNames.indexOf(glyphName);
  34052. if (glyphId > 0 && hasGlyph(glyphId)) {
  34053. charCodeToGlyphId[i] = glyphId;
  34054. }
  34055. }
  34056. }
  34057. }
  34058. if (charCodeToGlyphId.length === 0) {
  34059. charCodeToGlyphId[0] = 0;
  34060. }
  34061. let glyphZeroId = numGlyphsOut - 1;
  34062. if (!dupFirstEntry) {
  34063. glyphZeroId = 0;
  34064. }
  34065. if (!properties.cssFontInfo) {
  34066. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  34067. this.toFontChar = newMapping.toFontChar;
  34068. tables.cmap = {
  34069. tag: "cmap",
  34070. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  34071. };
  34072. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  34073. tables["OS/2"] = {
  34074. tag: "OS/2",
  34075. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  34076. };
  34077. }
  34078. }
  34079. if (!isTrueType) {
  34080. try {
  34081. cffFile = new _stream.Stream(tables["CFF "].data);
  34082. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  34083. cff = parser.parse();
  34084. cff.duplicateFirstGlyph();
  34085. const compiler = new _cff_parser.CFFCompiler(cff);
  34086. tables["CFF "].data = compiler.compile();
  34087. } catch (e) {
  34088. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  34089. }
  34090. }
  34091. if (!tables.name) {
  34092. tables.name = {
  34093. tag: "name",
  34094. data: createNameTable(this.name)
  34095. };
  34096. } else {
  34097. const namePrototype = readNameTable(tables.name);
  34098. tables.name.data = createNameTable(name, namePrototype);
  34099. this.psName = namePrototype[0][6] || null;
  34100. }
  34101. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  34102. for (const tableTag in tables) {
  34103. builder.addTable(tableTag, tables[tableTag].data);
  34104. }
  34105. return builder.toArray();
  34106. }
  34107. convert(fontName, font, properties) {
  34108. properties.fixedPitch = false;
  34109. if (properties.builtInEncoding) {
  34110. adjustToUnicode(properties, properties.builtInEncoding);
  34111. }
  34112. let glyphZeroId = 1;
  34113. if (font instanceof _cff_font.CFFFont) {
  34114. glyphZeroId = font.numGlyphs - 1;
  34115. }
  34116. const mapping = font.getGlyphMapping(properties);
  34117. let newMapping = null;
  34118. let newCharCodeToGlyphId = mapping;
  34119. if (!properties.cssFontInfo) {
  34120. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  34121. this.toFontChar = newMapping.toFontChar;
  34122. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  34123. }
  34124. const numGlyphs = font.numGlyphs;
  34125. function getCharCodes(charCodeToGlyphId, glyphId) {
  34126. let charCodes = null;
  34127. for (const charCode in charCodeToGlyphId) {
  34128. if (glyphId === charCodeToGlyphId[charCode]) {
  34129. if (!charCodes) {
  34130. charCodes = [];
  34131. }
  34132. charCodes.push(charCode | 0);
  34133. }
  34134. }
  34135. return charCodes;
  34136. }
  34137. function createCharCode(charCodeToGlyphId, glyphId) {
  34138. for (const charCode in charCodeToGlyphId) {
  34139. if (glyphId === charCodeToGlyphId[charCode]) {
  34140. return charCode | 0;
  34141. }
  34142. }
  34143. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  34144. return newMapping.nextAvailableFontCharCode++;
  34145. }
  34146. const seacs = font.seacs;
  34147. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  34148. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  34149. const charset = font.getCharset();
  34150. const seacMap = Object.create(null);
  34151. for (let glyphId in seacs) {
  34152. glyphId |= 0;
  34153. const seac = seacs[glyphId];
  34154. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  34155. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  34156. const baseGlyphId = charset.indexOf(baseGlyphName);
  34157. const accentGlyphId = charset.indexOf(accentGlyphName);
  34158. if (baseGlyphId < 0 || accentGlyphId < 0) {
  34159. continue;
  34160. }
  34161. const accentOffset = {
  34162. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  34163. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  34164. };
  34165. const charCodes = getCharCodes(mapping, glyphId);
  34166. if (!charCodes) {
  34167. continue;
  34168. }
  34169. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  34170. const charCode = charCodes[i];
  34171. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  34172. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  34173. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  34174. seacMap[charCode] = {
  34175. baseFontCharCode,
  34176. accentFontCharCode,
  34177. accentOffset
  34178. };
  34179. }
  34180. }
  34181. properties.seacMap = seacMap;
  34182. }
  34183. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  34184. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  34185. builder.addTable("CFF ", font.data);
  34186. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  34187. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  34188. 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");
  34189. 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));
  34190. builder.addTable("hmtx", function fontFieldsHmtx() {
  34191. const charstrings = font.charstrings;
  34192. const cffWidths = font.cff ? font.cff.widths : null;
  34193. let hmtx = "\x00\x00\x00\x00";
  34194. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  34195. let width = 0;
  34196. if (charstrings) {
  34197. const charstring = charstrings[i - 1];
  34198. width = "width" in charstring ? charstring.width : 0;
  34199. } else if (cffWidths) {
  34200. width = Math.ceil(cffWidths[i] || 0);
  34201. }
  34202. hmtx += string16(width) + string16(0);
  34203. }
  34204. return hmtx;
  34205. }());
  34206. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  34207. builder.addTable("name", createNameTable(fontName));
  34208. builder.addTable("post", createPostTable(properties));
  34209. return builder.toArray();
  34210. }
  34211. get spaceWidth() {
  34212. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  34213. let width;
  34214. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  34215. const glyphName = possibleSpaceReplacements[i];
  34216. if (glyphName in this.widths) {
  34217. width = this.widths[glyphName];
  34218. break;
  34219. }
  34220. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34221. const glyphUnicode = glyphsUnicodeMap[glyphName];
  34222. let charcode = 0;
  34223. if (this.composite && this.cMap.contains(glyphUnicode)) {
  34224. charcode = this.cMap.lookup(glyphUnicode);
  34225. if (typeof charcode === "string") {
  34226. charcode = convertCidString(glyphUnicode, charcode);
  34227. }
  34228. }
  34229. if (!charcode && this.toUnicode) {
  34230. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  34231. }
  34232. if (charcode <= 0) {
  34233. charcode = glyphUnicode;
  34234. }
  34235. width = this.widths[charcode];
  34236. if (width) {
  34237. break;
  34238. }
  34239. }
  34240. width = width || this.defaultWidth;
  34241. return (0, _util.shadow)(this, "spaceWidth", width);
  34242. }
  34243. _charToGlyph(charcode, isSpace = false) {
  34244. let fontCharCode, width, operatorListId;
  34245. let widthCode = charcode;
  34246. if (this.cMap && this.cMap.contains(charcode)) {
  34247. widthCode = this.cMap.lookup(charcode);
  34248. if (typeof widthCode === "string") {
  34249. widthCode = convertCidString(charcode, widthCode);
  34250. }
  34251. }
  34252. width = this.widths[widthCode];
  34253. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  34254. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  34255. let unicode = this.toUnicode.get(charcode) || charcode;
  34256. if (typeof unicode === "number") {
  34257. unicode = String.fromCharCode(unicode);
  34258. }
  34259. let isInFont = this.toFontChar[charcode] !== undefined;
  34260. fontCharCode = this.toFontChar[charcode] || charcode;
  34261. if (this.missingFile) {
  34262. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  34263. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  34264. fontCharCode = 0x20;
  34265. }
  34266. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  34267. }
  34268. if (this.isType3Font) {
  34269. operatorListId = fontCharCode;
  34270. }
  34271. let accent = null;
  34272. if (this.seacMap && this.seacMap[charcode]) {
  34273. isInFont = true;
  34274. const seac = this.seacMap[charcode];
  34275. fontCharCode = seac.baseFontCharCode;
  34276. accent = {
  34277. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  34278. offset: seac.accentOffset
  34279. };
  34280. }
  34281. let fontChar = "";
  34282. if (typeof fontCharCode === "number") {
  34283. if (fontCharCode <= 0x10ffff) {
  34284. fontChar = String.fromCodePoint(fontCharCode);
  34285. } else {
  34286. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  34287. }
  34288. }
  34289. let glyph = this._glyphCache[charcode];
  34290. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  34291. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  34292. this._glyphCache[charcode] = glyph;
  34293. }
  34294. return glyph;
  34295. }
  34296. charsToGlyphs(chars) {
  34297. let glyphs = this._charsCache[chars];
  34298. if (glyphs) {
  34299. return glyphs;
  34300. }
  34301. glyphs = [];
  34302. if (this.cMap) {
  34303. const c = Object.create(null),
  34304. ii = chars.length;
  34305. let i = 0;
  34306. while (i < ii) {
  34307. this.cMap.readCharCode(chars, i, c);
  34308. const {
  34309. charcode,
  34310. length
  34311. } = c;
  34312. i += length;
  34313. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  34314. glyphs.push(glyph);
  34315. }
  34316. } else {
  34317. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34318. const charcode = chars.charCodeAt(i);
  34319. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  34320. glyphs.push(glyph);
  34321. }
  34322. }
  34323. return this._charsCache[chars] = glyphs;
  34324. }
  34325. getCharPositions(chars) {
  34326. const positions = [];
  34327. if (this.cMap) {
  34328. const c = Object.create(null);
  34329. let i = 0;
  34330. while (i < chars.length) {
  34331. this.cMap.readCharCode(chars, i, c);
  34332. const length = c.length;
  34333. positions.push([i, i + length]);
  34334. i += length;
  34335. }
  34336. } else {
  34337. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34338. positions.push([i, i + 1]);
  34339. }
  34340. }
  34341. return positions;
  34342. }
  34343. get glyphCacheValues() {
  34344. return Object.values(this._glyphCache);
  34345. }
  34346. encodeString(str) {
  34347. const buffers = [];
  34348. const currentBuf = [];
  34349. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  34350. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  34351. for (let i = 0, ii = str.length; i < ii; i++) {
  34352. const unicode = str.codePointAt(i);
  34353. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  34354. i++;
  34355. }
  34356. if (this.toUnicode) {
  34357. const charCode = getCharCode(unicode);
  34358. if (charCode !== -1) {
  34359. if (hasCurrentBufErrors()) {
  34360. buffers.push(currentBuf.join(""));
  34361. currentBuf.length = 0;
  34362. }
  34363. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  34364. for (let j = charCodeLength - 1; j >= 0; j--) {
  34365. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  34366. }
  34367. continue;
  34368. }
  34369. }
  34370. if (!hasCurrentBufErrors()) {
  34371. buffers.push(currentBuf.join(""));
  34372. currentBuf.length = 0;
  34373. }
  34374. currentBuf.push(String.fromCodePoint(unicode));
  34375. }
  34376. buffers.push(currentBuf.join(""));
  34377. return buffers;
  34378. }
  34379. }
  34380. exports.Font = Font;
  34381. class ErrorFont {
  34382. constructor(error) {
  34383. this.error = error;
  34384. this.loadedName = "g_font_error";
  34385. this.missingFile = true;
  34386. }
  34387. charsToGlyphs() {
  34388. return [];
  34389. }
  34390. encodeString(chars) {
  34391. return [chars];
  34392. }
  34393. exportData(extraProperties = false) {
  34394. return {
  34395. error: this.error
  34396. };
  34397. }
  34398. }
  34399. exports.ErrorFont = ErrorFont;
  34400. /***/ }),
  34401. /* 45 */
  34402. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34403. Object.defineProperty(exports, "__esModule", ({
  34404. value: true
  34405. }));
  34406. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  34407. var _util = __w_pdfjs_require__(2);
  34408. var _charsets = __w_pdfjs_require__(46);
  34409. var _encodings = __w_pdfjs_require__(19);
  34410. const MAX_SUBR_NESTING = 10;
  34411. 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"];
  34412. exports.CFFStandardStrings = CFFStandardStrings;
  34413. const NUM_STANDARD_CFF_STRINGS = 391;
  34414. const CFFParser = function CFFParserClosure() {
  34415. const CharstringValidationData = [null, {
  34416. id: "hstem",
  34417. min: 2,
  34418. stackClearing: true,
  34419. stem: true
  34420. }, null, {
  34421. id: "vstem",
  34422. min: 2,
  34423. stackClearing: true,
  34424. stem: true
  34425. }, {
  34426. id: "vmoveto",
  34427. min: 1,
  34428. stackClearing: true
  34429. }, {
  34430. id: "rlineto",
  34431. min: 2,
  34432. resetStack: true
  34433. }, {
  34434. id: "hlineto",
  34435. min: 1,
  34436. resetStack: true
  34437. }, {
  34438. id: "vlineto",
  34439. min: 1,
  34440. resetStack: true
  34441. }, {
  34442. id: "rrcurveto",
  34443. min: 6,
  34444. resetStack: true
  34445. }, null, {
  34446. id: "callsubr",
  34447. min: 1,
  34448. undefStack: true
  34449. }, {
  34450. id: "return",
  34451. min: 0,
  34452. undefStack: true
  34453. }, null, null, {
  34454. id: "endchar",
  34455. min: 0,
  34456. stackClearing: true
  34457. }, null, null, null, {
  34458. id: "hstemhm",
  34459. min: 2,
  34460. stackClearing: true,
  34461. stem: true
  34462. }, {
  34463. id: "hintmask",
  34464. min: 0,
  34465. stackClearing: true
  34466. }, {
  34467. id: "cntrmask",
  34468. min: 0,
  34469. stackClearing: true
  34470. }, {
  34471. id: "rmoveto",
  34472. min: 2,
  34473. stackClearing: true
  34474. }, {
  34475. id: "hmoveto",
  34476. min: 1,
  34477. stackClearing: true
  34478. }, {
  34479. id: "vstemhm",
  34480. min: 2,
  34481. stackClearing: true,
  34482. stem: true
  34483. }, {
  34484. id: "rcurveline",
  34485. min: 8,
  34486. resetStack: true
  34487. }, {
  34488. id: "rlinecurve",
  34489. min: 8,
  34490. resetStack: true
  34491. }, {
  34492. id: "vvcurveto",
  34493. min: 4,
  34494. resetStack: true
  34495. }, {
  34496. id: "hhcurveto",
  34497. min: 4,
  34498. resetStack: true
  34499. }, null, {
  34500. id: "callgsubr",
  34501. min: 1,
  34502. undefStack: true
  34503. }, {
  34504. id: "vhcurveto",
  34505. min: 4,
  34506. resetStack: true
  34507. }, {
  34508. id: "hvcurveto",
  34509. min: 4,
  34510. resetStack: true
  34511. }];
  34512. const CharstringValidationData12 = [null, null, null, {
  34513. id: "and",
  34514. min: 2,
  34515. stackDelta: -1
  34516. }, {
  34517. id: "or",
  34518. min: 2,
  34519. stackDelta: -1
  34520. }, {
  34521. id: "not",
  34522. min: 1,
  34523. stackDelta: 0
  34524. }, null, null, null, {
  34525. id: "abs",
  34526. min: 1,
  34527. stackDelta: 0
  34528. }, {
  34529. id: "add",
  34530. min: 2,
  34531. stackDelta: -1,
  34532. stackFn: function stack_div(stack, index) {
  34533. stack[index - 2] = stack[index - 2] + stack[index - 1];
  34534. }
  34535. }, {
  34536. id: "sub",
  34537. min: 2,
  34538. stackDelta: -1,
  34539. stackFn: function stack_div(stack, index) {
  34540. stack[index - 2] = stack[index - 2] - stack[index - 1];
  34541. }
  34542. }, {
  34543. id: "div",
  34544. min: 2,
  34545. stackDelta: -1,
  34546. stackFn: function stack_div(stack, index) {
  34547. stack[index - 2] = stack[index - 2] / stack[index - 1];
  34548. }
  34549. }, null, {
  34550. id: "neg",
  34551. min: 1,
  34552. stackDelta: 0,
  34553. stackFn: function stack_div(stack, index) {
  34554. stack[index - 1] = -stack[index - 1];
  34555. }
  34556. }, {
  34557. id: "eq",
  34558. min: 2,
  34559. stackDelta: -1
  34560. }, null, null, {
  34561. id: "drop",
  34562. min: 1,
  34563. stackDelta: -1
  34564. }, null, {
  34565. id: "put",
  34566. min: 2,
  34567. stackDelta: -2
  34568. }, {
  34569. id: "get",
  34570. min: 1,
  34571. stackDelta: 0
  34572. }, {
  34573. id: "ifelse",
  34574. min: 4,
  34575. stackDelta: -3
  34576. }, {
  34577. id: "random",
  34578. min: 0,
  34579. stackDelta: 1
  34580. }, {
  34581. id: "mul",
  34582. min: 2,
  34583. stackDelta: -1,
  34584. stackFn: function stack_div(stack, index) {
  34585. stack[index - 2] = stack[index - 2] * stack[index - 1];
  34586. }
  34587. }, null, {
  34588. id: "sqrt",
  34589. min: 1,
  34590. stackDelta: 0
  34591. }, {
  34592. id: "dup",
  34593. min: 1,
  34594. stackDelta: 1
  34595. }, {
  34596. id: "exch",
  34597. min: 2,
  34598. stackDelta: 0
  34599. }, {
  34600. id: "index",
  34601. min: 2,
  34602. stackDelta: 0
  34603. }, {
  34604. id: "roll",
  34605. min: 3,
  34606. stackDelta: -2
  34607. }, null, null, null, {
  34608. id: "hflex",
  34609. min: 7,
  34610. resetStack: true
  34611. }, {
  34612. id: "flex",
  34613. min: 13,
  34614. resetStack: true
  34615. }, {
  34616. id: "hflex1",
  34617. min: 9,
  34618. resetStack: true
  34619. }, {
  34620. id: "flex1",
  34621. min: 11,
  34622. resetStack: true
  34623. }];
  34624. class CFFParser {
  34625. constructor(file, properties, seacAnalysisEnabled) {
  34626. this.bytes = file.getBytes();
  34627. this.properties = properties;
  34628. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  34629. }
  34630. parse() {
  34631. const properties = this.properties;
  34632. const cff = new CFF();
  34633. this.cff = cff;
  34634. const header = this.parseHeader();
  34635. const nameIndex = this.parseIndex(header.endPos);
  34636. const topDictIndex = this.parseIndex(nameIndex.endPos);
  34637. const stringIndex = this.parseIndex(topDictIndex.endPos);
  34638. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  34639. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  34640. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  34641. cff.header = header.obj;
  34642. cff.names = this.parseNameIndex(nameIndex.obj);
  34643. cff.strings = this.parseStringIndex(stringIndex.obj);
  34644. cff.topDict = topDict;
  34645. cff.globalSubrIndex = globalSubrIndex.obj;
  34646. this.parsePrivateDict(cff.topDict);
  34647. cff.isCIDFont = topDict.hasName("ROS");
  34648. const charStringOffset = topDict.getByName("CharStrings");
  34649. const charStringIndex = this.parseIndex(charStringOffset).obj;
  34650. const fontMatrix = topDict.getByName("FontMatrix");
  34651. if (fontMatrix) {
  34652. properties.fontMatrix = fontMatrix;
  34653. }
  34654. const fontBBox = topDict.getByName("FontBBox");
  34655. if (fontBBox) {
  34656. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  34657. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  34658. properties.ascentScaled = true;
  34659. }
  34660. let charset, encoding;
  34661. if (cff.isCIDFont) {
  34662. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  34663. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  34664. const dictRaw = fdArrayIndex.get(i);
  34665. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  34666. this.parsePrivateDict(fontDict);
  34667. cff.fdArray.push(fontDict);
  34668. }
  34669. encoding = null;
  34670. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  34671. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  34672. } else {
  34673. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  34674. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  34675. }
  34676. cff.charset = charset;
  34677. cff.encoding = encoding;
  34678. const charStringsAndSeacs = this.parseCharStrings({
  34679. charStrings: charStringIndex,
  34680. localSubrIndex: topDict.privateDict.subrsIndex,
  34681. globalSubrIndex: globalSubrIndex.obj,
  34682. fdSelect: cff.fdSelect,
  34683. fdArray: cff.fdArray,
  34684. privateDict: topDict.privateDict
  34685. });
  34686. cff.charStrings = charStringsAndSeacs.charStrings;
  34687. cff.seacs = charStringsAndSeacs.seacs;
  34688. cff.widths = charStringsAndSeacs.widths;
  34689. return cff;
  34690. }
  34691. parseHeader() {
  34692. let bytes = this.bytes;
  34693. const bytesLength = bytes.length;
  34694. let offset = 0;
  34695. while (offset < bytesLength && bytes[offset] !== 1) {
  34696. ++offset;
  34697. }
  34698. if (offset >= bytesLength) {
  34699. throw new _util.FormatError("Invalid CFF header");
  34700. }
  34701. if (offset !== 0) {
  34702. (0, _util.info)("cff data is shifted");
  34703. bytes = bytes.subarray(offset);
  34704. this.bytes = bytes;
  34705. }
  34706. const major = bytes[0];
  34707. const minor = bytes[1];
  34708. const hdrSize = bytes[2];
  34709. const offSize = bytes[3];
  34710. const header = new CFFHeader(major, minor, hdrSize, offSize);
  34711. return {
  34712. obj: header,
  34713. endPos: hdrSize
  34714. };
  34715. }
  34716. parseDict(dict) {
  34717. let pos = 0;
  34718. function parseOperand() {
  34719. let value = dict[pos++];
  34720. if (value === 30) {
  34721. return parseFloatOperand();
  34722. } else if (value === 28) {
  34723. value = dict[pos++];
  34724. value = (value << 24 | dict[pos++] << 16) >> 16;
  34725. return value;
  34726. } else if (value === 29) {
  34727. value = dict[pos++];
  34728. value = value << 8 | dict[pos++];
  34729. value = value << 8 | dict[pos++];
  34730. value = value << 8 | dict[pos++];
  34731. return value;
  34732. } else if (value >= 32 && value <= 246) {
  34733. return value - 139;
  34734. } else if (value >= 247 && value <= 250) {
  34735. return (value - 247) * 256 + dict[pos++] + 108;
  34736. } else if (value >= 251 && value <= 254) {
  34737. return -((value - 251) * 256) - dict[pos++] - 108;
  34738. }
  34739. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  34740. return NaN;
  34741. }
  34742. function parseFloatOperand() {
  34743. let str = "";
  34744. const eof = 15;
  34745. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  34746. const length = dict.length;
  34747. while (pos < length) {
  34748. const b = dict[pos++];
  34749. const b1 = b >> 4;
  34750. const b2 = b & 15;
  34751. if (b1 === eof) {
  34752. break;
  34753. }
  34754. str += lookup[b1];
  34755. if (b2 === eof) {
  34756. break;
  34757. }
  34758. str += lookup[b2];
  34759. }
  34760. return parseFloat(str);
  34761. }
  34762. let operands = [];
  34763. const entries = [];
  34764. pos = 0;
  34765. const end = dict.length;
  34766. while (pos < end) {
  34767. let b = dict[pos];
  34768. if (b <= 21) {
  34769. if (b === 12) {
  34770. b = b << 8 | dict[++pos];
  34771. }
  34772. entries.push([b, operands]);
  34773. operands = [];
  34774. ++pos;
  34775. } else {
  34776. operands.push(parseOperand());
  34777. }
  34778. }
  34779. return entries;
  34780. }
  34781. parseIndex(pos) {
  34782. const cffIndex = new CFFIndex();
  34783. const bytes = this.bytes;
  34784. const count = bytes[pos++] << 8 | bytes[pos++];
  34785. const offsets = [];
  34786. let end = pos;
  34787. let i, ii;
  34788. if (count !== 0) {
  34789. const offsetSize = bytes[pos++];
  34790. const startPos = pos + (count + 1) * offsetSize - 1;
  34791. for (i = 0, ii = count + 1; i < ii; ++i) {
  34792. let offset = 0;
  34793. for (let j = 0; j < offsetSize; ++j) {
  34794. offset <<= 8;
  34795. offset += bytes[pos++];
  34796. }
  34797. offsets.push(startPos + offset);
  34798. }
  34799. end = offsets[count];
  34800. }
  34801. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  34802. const offsetStart = offsets[i];
  34803. const offsetEnd = offsets[i + 1];
  34804. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  34805. }
  34806. return {
  34807. obj: cffIndex,
  34808. endPos: end
  34809. };
  34810. }
  34811. parseNameIndex(index) {
  34812. const names = [];
  34813. for (let i = 0, ii = index.count; i < ii; ++i) {
  34814. const name = index.get(i);
  34815. names.push((0, _util.bytesToString)(name));
  34816. }
  34817. return names;
  34818. }
  34819. parseStringIndex(index) {
  34820. const strings = new CFFStrings();
  34821. for (let i = 0, ii = index.count; i < ii; ++i) {
  34822. const data = index.get(i);
  34823. strings.add((0, _util.bytesToString)(data));
  34824. }
  34825. return strings;
  34826. }
  34827. createDict(Type, dict, strings) {
  34828. const cffDict = new Type(strings);
  34829. for (let i = 0, ii = dict.length; i < ii; ++i) {
  34830. const pair = dict[i];
  34831. const key = pair[0];
  34832. const value = pair[1];
  34833. cffDict.setByKey(key, value);
  34834. }
  34835. return cffDict;
  34836. }
  34837. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  34838. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  34839. return false;
  34840. }
  34841. let stackSize = state.stackSize;
  34842. const stack = state.stack;
  34843. const length = data.length;
  34844. for (let j = 0; j < length;) {
  34845. const value = data[j++];
  34846. let validationCommand = null;
  34847. if (value === 12) {
  34848. const q = data[j++];
  34849. if (q === 0) {
  34850. data[j - 2] = 139;
  34851. data[j - 1] = 22;
  34852. stackSize = 0;
  34853. } else {
  34854. validationCommand = CharstringValidationData12[q];
  34855. }
  34856. } else if (value === 28) {
  34857. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  34858. j += 2;
  34859. stackSize++;
  34860. } else if (value === 14) {
  34861. if (stackSize >= 4) {
  34862. stackSize -= 4;
  34863. if (this.seacAnalysisEnabled) {
  34864. state.seac = stack.slice(stackSize, stackSize + 4);
  34865. return false;
  34866. }
  34867. }
  34868. validationCommand = CharstringValidationData[value];
  34869. } else if (value >= 32 && value <= 246) {
  34870. stack[stackSize] = value - 139;
  34871. stackSize++;
  34872. } else if (value >= 247 && value <= 254) {
  34873. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  34874. j++;
  34875. stackSize++;
  34876. } else if (value === 255) {
  34877. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  34878. j += 4;
  34879. stackSize++;
  34880. } else if (value === 19 || value === 20) {
  34881. state.hints += stackSize >> 1;
  34882. j += state.hints + 7 >> 3;
  34883. stackSize %= 2;
  34884. validationCommand = CharstringValidationData[value];
  34885. } else if (value === 10 || value === 29) {
  34886. let subrsIndex;
  34887. if (value === 10) {
  34888. subrsIndex = localSubrIndex;
  34889. } else {
  34890. subrsIndex = globalSubrIndex;
  34891. }
  34892. if (!subrsIndex) {
  34893. validationCommand = CharstringValidationData[value];
  34894. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  34895. return false;
  34896. }
  34897. let bias = 32768;
  34898. if (subrsIndex.count < 1240) {
  34899. bias = 107;
  34900. } else if (subrsIndex.count < 33900) {
  34901. bias = 1131;
  34902. }
  34903. const subrNumber = stack[--stackSize] + bias;
  34904. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  34905. validationCommand = CharstringValidationData[value];
  34906. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  34907. return false;
  34908. }
  34909. state.stackSize = stackSize;
  34910. state.callDepth++;
  34911. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  34912. if (!valid) {
  34913. return false;
  34914. }
  34915. state.callDepth--;
  34916. stackSize = state.stackSize;
  34917. continue;
  34918. } else if (value === 11) {
  34919. state.stackSize = stackSize;
  34920. return true;
  34921. } else if (value === 0 && j === data.length) {
  34922. data[j - 1] = 14;
  34923. validationCommand = CharstringValidationData[14];
  34924. } else {
  34925. validationCommand = CharstringValidationData[value];
  34926. }
  34927. if (validationCommand) {
  34928. if (validationCommand.stem) {
  34929. state.hints += stackSize >> 1;
  34930. if (value === 3 || value === 23) {
  34931. state.hasVStems = true;
  34932. } else if (state.hasVStems && (value === 1 || value === 18)) {
  34933. (0, _util.warn)("CFF stem hints are in wrong order");
  34934. data[j - 1] = value === 1 ? 3 : 23;
  34935. }
  34936. }
  34937. if ("min" in validationCommand) {
  34938. if (!state.undefStack && stackSize < validationCommand.min) {
  34939. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  34940. if (stackSize === 0) {
  34941. data[j - 1] = 14;
  34942. return true;
  34943. }
  34944. return false;
  34945. }
  34946. }
  34947. if (state.firstStackClearing && validationCommand.stackClearing) {
  34948. state.firstStackClearing = false;
  34949. stackSize -= validationCommand.min;
  34950. if (stackSize >= 2 && validationCommand.stem) {
  34951. stackSize %= 2;
  34952. } else if (stackSize > 1) {
  34953. (0, _util.warn)("Found too many parameters for stack-clearing command");
  34954. }
  34955. if (stackSize > 0) {
  34956. state.width = stack[stackSize - 1];
  34957. }
  34958. }
  34959. if ("stackDelta" in validationCommand) {
  34960. if ("stackFn" in validationCommand) {
  34961. validationCommand.stackFn(stack, stackSize);
  34962. }
  34963. stackSize += validationCommand.stackDelta;
  34964. } else if (validationCommand.stackClearing) {
  34965. stackSize = 0;
  34966. } else if (validationCommand.resetStack) {
  34967. stackSize = 0;
  34968. state.undefStack = false;
  34969. } else if (validationCommand.undefStack) {
  34970. stackSize = 0;
  34971. state.undefStack = true;
  34972. state.firstStackClearing = false;
  34973. }
  34974. }
  34975. }
  34976. state.stackSize = stackSize;
  34977. return true;
  34978. }
  34979. parseCharStrings({
  34980. charStrings,
  34981. localSubrIndex,
  34982. globalSubrIndex,
  34983. fdSelect,
  34984. fdArray,
  34985. privateDict
  34986. }) {
  34987. const seacs = [];
  34988. const widths = [];
  34989. const count = charStrings.count;
  34990. for (let i = 0; i < count; i++) {
  34991. const charstring = charStrings.get(i);
  34992. const state = {
  34993. callDepth: 0,
  34994. stackSize: 0,
  34995. stack: [],
  34996. undefStack: true,
  34997. hints: 0,
  34998. firstStackClearing: true,
  34999. seac: null,
  35000. width: null,
  35001. hasVStems: false
  35002. };
  35003. let valid = true;
  35004. let localSubrToUse = null;
  35005. let privateDictToUse = privateDict;
  35006. if (fdSelect && fdArray.length) {
  35007. const fdIndex = fdSelect.getFDIndex(i);
  35008. if (fdIndex === -1) {
  35009. (0, _util.warn)("Glyph index is not in fd select.");
  35010. valid = false;
  35011. }
  35012. if (fdIndex >= fdArray.length) {
  35013. (0, _util.warn)("Invalid fd index for glyph index.");
  35014. valid = false;
  35015. }
  35016. if (valid) {
  35017. privateDictToUse = fdArray[fdIndex].privateDict;
  35018. localSubrToUse = privateDictToUse.subrsIndex;
  35019. }
  35020. } else if (localSubrIndex) {
  35021. localSubrToUse = localSubrIndex;
  35022. }
  35023. if (valid) {
  35024. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  35025. }
  35026. if (state.width !== null) {
  35027. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  35028. widths[i] = nominalWidth + state.width;
  35029. } else {
  35030. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  35031. widths[i] = defaultWidth;
  35032. }
  35033. if (state.seac !== null) {
  35034. seacs[i] = state.seac;
  35035. }
  35036. if (!valid) {
  35037. charStrings.set(i, new Uint8Array([14]));
  35038. }
  35039. }
  35040. return {
  35041. charStrings,
  35042. seacs,
  35043. widths
  35044. };
  35045. }
  35046. emptyPrivateDictionary(parentDict) {
  35047. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  35048. parentDict.setByKey(18, [0, 0]);
  35049. parentDict.privateDict = privateDict;
  35050. }
  35051. parsePrivateDict(parentDict) {
  35052. if (!parentDict.hasName("Private")) {
  35053. this.emptyPrivateDictionary(parentDict);
  35054. return;
  35055. }
  35056. const privateOffset = parentDict.getByName("Private");
  35057. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  35058. parentDict.removeByName("Private");
  35059. return;
  35060. }
  35061. const size = privateOffset[0];
  35062. const offset = privateOffset[1];
  35063. if (size === 0 || offset >= this.bytes.length) {
  35064. this.emptyPrivateDictionary(parentDict);
  35065. return;
  35066. }
  35067. const privateDictEnd = offset + size;
  35068. const dictData = this.bytes.subarray(offset, privateDictEnd);
  35069. const dict = this.parseDict(dictData);
  35070. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  35071. parentDict.privateDict = privateDict;
  35072. if (!privateDict.getByName("Subrs")) {
  35073. return;
  35074. }
  35075. const subrsOffset = privateDict.getByName("Subrs");
  35076. const relativeOffset = offset + subrsOffset;
  35077. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  35078. this.emptyPrivateDictionary(parentDict);
  35079. return;
  35080. }
  35081. const subrsIndex = this.parseIndex(relativeOffset);
  35082. privateDict.subrsIndex = subrsIndex.obj;
  35083. }
  35084. parseCharsets(pos, length, strings, cid) {
  35085. if (pos === 0) {
  35086. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  35087. } else if (pos === 1) {
  35088. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  35089. } else if (pos === 2) {
  35090. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  35091. }
  35092. const bytes = this.bytes;
  35093. const start = pos;
  35094. const format = bytes[pos++];
  35095. const charset = [cid ? 0 : ".notdef"];
  35096. let id, count, i;
  35097. length -= 1;
  35098. switch (format) {
  35099. case 0:
  35100. for (i = 0; i < length; i++) {
  35101. id = bytes[pos++] << 8 | bytes[pos++];
  35102. charset.push(cid ? id : strings.get(id));
  35103. }
  35104. break;
  35105. case 1:
  35106. while (charset.length <= length) {
  35107. id = bytes[pos++] << 8 | bytes[pos++];
  35108. count = bytes[pos++];
  35109. for (i = 0; i <= count; i++) {
  35110. charset.push(cid ? id++ : strings.get(id++));
  35111. }
  35112. }
  35113. break;
  35114. case 2:
  35115. while (charset.length <= length) {
  35116. id = bytes[pos++] << 8 | bytes[pos++];
  35117. count = bytes[pos++] << 8 | bytes[pos++];
  35118. for (i = 0; i <= count; i++) {
  35119. charset.push(cid ? id++ : strings.get(id++));
  35120. }
  35121. }
  35122. break;
  35123. default:
  35124. throw new _util.FormatError("Unknown charset format");
  35125. }
  35126. const end = pos;
  35127. const raw = bytes.subarray(start, end);
  35128. return new CFFCharset(false, format, charset, raw);
  35129. }
  35130. parseEncoding(pos, properties, strings, charset) {
  35131. const encoding = Object.create(null);
  35132. const bytes = this.bytes;
  35133. let predefined = false;
  35134. let format, i, ii;
  35135. let raw = null;
  35136. function readSupplement() {
  35137. const supplementsCount = bytes[pos++];
  35138. for (i = 0; i < supplementsCount; i++) {
  35139. const code = bytes[pos++];
  35140. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  35141. encoding[code] = charset.indexOf(strings.get(sid));
  35142. }
  35143. }
  35144. if (pos === 0 || pos === 1) {
  35145. predefined = true;
  35146. format = pos;
  35147. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  35148. for (i = 0, ii = charset.length; i < ii; i++) {
  35149. const index = baseEncoding.indexOf(charset[i]);
  35150. if (index !== -1) {
  35151. encoding[index] = i;
  35152. }
  35153. }
  35154. } else {
  35155. const dataStart = pos;
  35156. format = bytes[pos++];
  35157. switch (format & 0x7f) {
  35158. case 0:
  35159. const glyphsCount = bytes[pos++];
  35160. for (i = 1; i <= glyphsCount; i++) {
  35161. encoding[bytes[pos++]] = i;
  35162. }
  35163. break;
  35164. case 1:
  35165. const rangesCount = bytes[pos++];
  35166. let gid = 1;
  35167. for (i = 0; i < rangesCount; i++) {
  35168. const start = bytes[pos++];
  35169. const left = bytes[pos++];
  35170. for (let j = start; j <= start + left; j++) {
  35171. encoding[j] = gid++;
  35172. }
  35173. }
  35174. break;
  35175. default:
  35176. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  35177. }
  35178. const dataEnd = pos;
  35179. if (format & 0x80) {
  35180. bytes[dataStart] &= 0x7f;
  35181. readSupplement();
  35182. }
  35183. raw = bytes.subarray(dataStart, dataEnd);
  35184. }
  35185. format &= 0x7f;
  35186. return new CFFEncoding(predefined, format, encoding, raw);
  35187. }
  35188. parseFDSelect(pos, length) {
  35189. const bytes = this.bytes;
  35190. const format = bytes[pos++];
  35191. const fdSelect = [];
  35192. let i;
  35193. switch (format) {
  35194. case 0:
  35195. for (i = 0; i < length; ++i) {
  35196. const id = bytes[pos++];
  35197. fdSelect.push(id);
  35198. }
  35199. break;
  35200. case 3:
  35201. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  35202. for (i = 0; i < rangesCount; ++i) {
  35203. let first = bytes[pos++] << 8 | bytes[pos++];
  35204. if (i === 0 && first !== 0) {
  35205. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  35206. first = 0;
  35207. }
  35208. const fdIndex = bytes[pos++];
  35209. const next = bytes[pos] << 8 | bytes[pos + 1];
  35210. for (let j = first; j < next; ++j) {
  35211. fdSelect.push(fdIndex);
  35212. }
  35213. }
  35214. pos += 2;
  35215. break;
  35216. default:
  35217. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  35218. }
  35219. if (fdSelect.length !== length) {
  35220. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  35221. }
  35222. return new CFFFDSelect(format, fdSelect);
  35223. }
  35224. }
  35225. return CFFParser;
  35226. }();
  35227. exports.CFFParser = CFFParser;
  35228. class CFF {
  35229. constructor() {
  35230. this.header = null;
  35231. this.names = [];
  35232. this.topDict = null;
  35233. this.strings = new CFFStrings();
  35234. this.globalSubrIndex = null;
  35235. this.encoding = null;
  35236. this.charset = null;
  35237. this.charStrings = null;
  35238. this.fdArray = [];
  35239. this.fdSelect = null;
  35240. this.isCIDFont = false;
  35241. }
  35242. duplicateFirstGlyph() {
  35243. if (this.charStrings.count >= 65535) {
  35244. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  35245. return;
  35246. }
  35247. const glyphZero = this.charStrings.get(0);
  35248. this.charStrings.add(glyphZero);
  35249. if (this.isCIDFont) {
  35250. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  35251. }
  35252. }
  35253. hasGlyphId(id) {
  35254. if (id < 0 || id >= this.charStrings.count) {
  35255. return false;
  35256. }
  35257. const glyph = this.charStrings.get(id);
  35258. return glyph.length > 0;
  35259. }
  35260. }
  35261. exports.CFF = CFF;
  35262. class CFFHeader {
  35263. constructor(major, minor, hdrSize, offSize) {
  35264. this.major = major;
  35265. this.minor = minor;
  35266. this.hdrSize = hdrSize;
  35267. this.offSize = offSize;
  35268. }
  35269. }
  35270. exports.CFFHeader = CFFHeader;
  35271. class CFFStrings {
  35272. constructor() {
  35273. this.strings = [];
  35274. }
  35275. get(index) {
  35276. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  35277. return CFFStandardStrings[index];
  35278. }
  35279. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  35280. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  35281. }
  35282. return CFFStandardStrings[0];
  35283. }
  35284. getSID(str) {
  35285. let index = CFFStandardStrings.indexOf(str);
  35286. if (index !== -1) {
  35287. return index;
  35288. }
  35289. index = this.strings.indexOf(str);
  35290. if (index !== -1) {
  35291. return index + NUM_STANDARD_CFF_STRINGS;
  35292. }
  35293. return -1;
  35294. }
  35295. add(value) {
  35296. this.strings.push(value);
  35297. }
  35298. get count() {
  35299. return this.strings.length;
  35300. }
  35301. }
  35302. exports.CFFStrings = CFFStrings;
  35303. class CFFIndex {
  35304. constructor() {
  35305. this.objects = [];
  35306. this.length = 0;
  35307. }
  35308. add(data) {
  35309. this.length += data.length;
  35310. this.objects.push(data);
  35311. }
  35312. set(index, data) {
  35313. this.length += data.length - this.objects[index].length;
  35314. this.objects[index] = data;
  35315. }
  35316. get(index) {
  35317. return this.objects[index];
  35318. }
  35319. get count() {
  35320. return this.objects.length;
  35321. }
  35322. }
  35323. exports.CFFIndex = CFFIndex;
  35324. class CFFDict {
  35325. constructor(tables, strings) {
  35326. this.keyToNameMap = tables.keyToNameMap;
  35327. this.nameToKeyMap = tables.nameToKeyMap;
  35328. this.defaults = tables.defaults;
  35329. this.types = tables.types;
  35330. this.opcodes = tables.opcodes;
  35331. this.order = tables.order;
  35332. this.strings = strings;
  35333. this.values = Object.create(null);
  35334. }
  35335. setByKey(key, value) {
  35336. if (!(key in this.keyToNameMap)) {
  35337. return false;
  35338. }
  35339. const valueLength = value.length;
  35340. if (valueLength === 0) {
  35341. return true;
  35342. }
  35343. for (let i = 0; i < valueLength; i++) {
  35344. if (isNaN(value[i])) {
  35345. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  35346. return true;
  35347. }
  35348. }
  35349. const type = this.types[key];
  35350. if (type === "num" || type === "sid" || type === "offset") {
  35351. value = value[0];
  35352. }
  35353. this.values[key] = value;
  35354. return true;
  35355. }
  35356. setByName(name, value) {
  35357. if (!(name in this.nameToKeyMap)) {
  35358. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  35359. }
  35360. this.values[this.nameToKeyMap[name]] = value;
  35361. }
  35362. hasName(name) {
  35363. return this.nameToKeyMap[name] in this.values;
  35364. }
  35365. getByName(name) {
  35366. if (!(name in this.nameToKeyMap)) {
  35367. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  35368. }
  35369. const key = this.nameToKeyMap[name];
  35370. if (!(key in this.values)) {
  35371. return this.defaults[key];
  35372. }
  35373. return this.values[key];
  35374. }
  35375. removeByName(name) {
  35376. delete this.values[this.nameToKeyMap[name]];
  35377. }
  35378. static createTables(layout) {
  35379. const tables = {
  35380. keyToNameMap: {},
  35381. nameToKeyMap: {},
  35382. defaults: {},
  35383. types: {},
  35384. opcodes: {},
  35385. order: []
  35386. };
  35387. for (let i = 0, ii = layout.length; i < ii; ++i) {
  35388. const entry = layout[i];
  35389. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  35390. tables.keyToNameMap[key] = entry[1];
  35391. tables.nameToKeyMap[entry[1]] = key;
  35392. tables.types[key] = entry[2];
  35393. tables.defaults[key] = entry[3];
  35394. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  35395. tables.order.push(key);
  35396. }
  35397. return tables;
  35398. }
  35399. }
  35400. const CFFTopDict = function CFFTopDictClosure() {
  35401. 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]];
  35402. let tables = null;
  35403. class CFFTopDict extends CFFDict {
  35404. constructor(strings) {
  35405. if (tables === null) {
  35406. tables = CFFDict.createTables(layout);
  35407. }
  35408. super(tables, strings);
  35409. this.privateDict = null;
  35410. }
  35411. }
  35412. return CFFTopDict;
  35413. }();
  35414. exports.CFFTopDict = CFFTopDict;
  35415. const CFFPrivateDict = function CFFPrivateDictClosure() {
  35416. 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]];
  35417. let tables = null;
  35418. class CFFPrivateDict extends CFFDict {
  35419. constructor(strings) {
  35420. if (tables === null) {
  35421. tables = CFFDict.createTables(layout);
  35422. }
  35423. super(tables, strings);
  35424. this.subrsIndex = null;
  35425. }
  35426. }
  35427. return CFFPrivateDict;
  35428. }();
  35429. exports.CFFPrivateDict = CFFPrivateDict;
  35430. const CFFCharsetPredefinedTypes = {
  35431. ISO_ADOBE: 0,
  35432. EXPERT: 1,
  35433. EXPERT_SUBSET: 2
  35434. };
  35435. class CFFCharset {
  35436. constructor(predefined, format, charset, raw) {
  35437. this.predefined = predefined;
  35438. this.format = format;
  35439. this.charset = charset;
  35440. this.raw = raw;
  35441. }
  35442. }
  35443. exports.CFFCharset = CFFCharset;
  35444. class CFFEncoding {
  35445. constructor(predefined, format, encoding, raw) {
  35446. this.predefined = predefined;
  35447. this.format = format;
  35448. this.encoding = encoding;
  35449. this.raw = raw;
  35450. }
  35451. }
  35452. class CFFFDSelect {
  35453. constructor(format, fdSelect) {
  35454. this.format = format;
  35455. this.fdSelect = fdSelect;
  35456. }
  35457. getFDIndex(glyphIndex) {
  35458. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  35459. return -1;
  35460. }
  35461. return this.fdSelect[glyphIndex];
  35462. }
  35463. }
  35464. exports.CFFFDSelect = CFFFDSelect;
  35465. class CFFOffsetTracker {
  35466. constructor() {
  35467. this.offsets = Object.create(null);
  35468. }
  35469. isTracking(key) {
  35470. return key in this.offsets;
  35471. }
  35472. track(key, location) {
  35473. if (key in this.offsets) {
  35474. throw new _util.FormatError(`Already tracking location of ${key}`);
  35475. }
  35476. this.offsets[key] = location;
  35477. }
  35478. offset(value) {
  35479. for (const key in this.offsets) {
  35480. this.offsets[key] += value;
  35481. }
  35482. }
  35483. setEntryLocation(key, values, output) {
  35484. if (!(key in this.offsets)) {
  35485. throw new _util.FormatError(`Not tracking location of ${key}`);
  35486. }
  35487. const data = output.data;
  35488. const dataOffset = this.offsets[key];
  35489. const size = 5;
  35490. for (let i = 0, ii = values.length; i < ii; ++i) {
  35491. const offset0 = i * size + dataOffset;
  35492. const offset1 = offset0 + 1;
  35493. const offset2 = offset0 + 2;
  35494. const offset3 = offset0 + 3;
  35495. const offset4 = offset0 + 4;
  35496. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  35497. throw new _util.FormatError("writing to an offset that is not empty");
  35498. }
  35499. const value = values[i];
  35500. data[offset0] = 0x1d;
  35501. data[offset1] = value >> 24 & 0xff;
  35502. data[offset2] = value >> 16 & 0xff;
  35503. data[offset3] = value >> 8 & 0xff;
  35504. data[offset4] = value & 0xff;
  35505. }
  35506. }
  35507. }
  35508. class CFFCompiler {
  35509. constructor(cff) {
  35510. this.cff = cff;
  35511. }
  35512. compile() {
  35513. const cff = this.cff;
  35514. const output = {
  35515. data: [],
  35516. length: 0,
  35517. add: function CFFCompiler_add(data) {
  35518. this.data = this.data.concat(data);
  35519. this.length = this.data.length;
  35520. }
  35521. };
  35522. const header = this.compileHeader(cff.header);
  35523. output.add(header);
  35524. const nameIndex = this.compileNameIndex(cff.names);
  35525. output.add(nameIndex);
  35526. if (cff.isCIDFont) {
  35527. if (cff.topDict.hasName("FontMatrix")) {
  35528. const base = cff.topDict.getByName("FontMatrix");
  35529. cff.topDict.removeByName("FontMatrix");
  35530. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  35531. const subDict = cff.fdArray[i];
  35532. let matrix = base.slice(0);
  35533. if (subDict.hasName("FontMatrix")) {
  35534. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  35535. }
  35536. subDict.setByName("FontMatrix", matrix);
  35537. }
  35538. }
  35539. }
  35540. const xuid = cff.topDict.getByName("XUID");
  35541. if (xuid && xuid.length > 16) {
  35542. cff.topDict.removeByName("XUID");
  35543. }
  35544. cff.topDict.setByName("charset", 0);
  35545. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  35546. output.add(compiled.output);
  35547. const topDictTracker = compiled.trackers[0];
  35548. const stringIndex = this.compileStringIndex(cff.strings.strings);
  35549. output.add(stringIndex);
  35550. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  35551. output.add(globalSubrIndex);
  35552. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  35553. if (cff.encoding.predefined) {
  35554. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  35555. } else {
  35556. const encoding = this.compileEncoding(cff.encoding);
  35557. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  35558. output.add(encoding);
  35559. }
  35560. }
  35561. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  35562. topDictTracker.setEntryLocation("charset", [output.length], output);
  35563. output.add(charset);
  35564. const charStrings = this.compileCharStrings(cff.charStrings);
  35565. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  35566. output.add(charStrings);
  35567. if (cff.isCIDFont) {
  35568. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  35569. const fdSelect = this.compileFDSelect(cff.fdSelect);
  35570. output.add(fdSelect);
  35571. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  35572. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  35573. output.add(compiled.output);
  35574. const fontDictTrackers = compiled.trackers;
  35575. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  35576. }
  35577. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  35578. output.add([0]);
  35579. return output.data;
  35580. }
  35581. encodeNumber(value) {
  35582. if (Number.isInteger(value)) {
  35583. return this.encodeInteger(value);
  35584. }
  35585. return this.encodeFloat(value);
  35586. }
  35587. static get EncodeFloatRegExp() {
  35588. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  35589. }
  35590. encodeFloat(num) {
  35591. let value = num.toString();
  35592. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  35593. if (m) {
  35594. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  35595. value = (Math.round(num * epsilon) / epsilon).toString();
  35596. }
  35597. let nibbles = "";
  35598. let i, ii;
  35599. for (i = 0, ii = value.length; i < ii; ++i) {
  35600. const a = value[i];
  35601. if (a === "e") {
  35602. nibbles += value[++i] === "-" ? "c" : "b";
  35603. } else if (a === ".") {
  35604. nibbles += "a";
  35605. } else if (a === "-") {
  35606. nibbles += "e";
  35607. } else {
  35608. nibbles += a;
  35609. }
  35610. }
  35611. nibbles += nibbles.length & 1 ? "f" : "ff";
  35612. const out = [30];
  35613. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  35614. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  35615. }
  35616. return out;
  35617. }
  35618. encodeInteger(value) {
  35619. let code;
  35620. if (value >= -107 && value <= 107) {
  35621. code = [value + 139];
  35622. } else if (value >= 108 && value <= 1131) {
  35623. value -= 108;
  35624. code = [(value >> 8) + 247, value & 0xff];
  35625. } else if (value >= -1131 && value <= -108) {
  35626. value = -value - 108;
  35627. code = [(value >> 8) + 251, value & 0xff];
  35628. } else if (value >= -32768 && value <= 32767) {
  35629. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  35630. } else {
  35631. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  35632. }
  35633. return code;
  35634. }
  35635. compileHeader(header) {
  35636. return [header.major, header.minor, 4, header.offSize];
  35637. }
  35638. compileNameIndex(names) {
  35639. const nameIndex = new CFFIndex();
  35640. for (let i = 0, ii = names.length; i < ii; ++i) {
  35641. const name = names[i];
  35642. const length = Math.min(name.length, 127);
  35643. let sanitizedName = new Array(length);
  35644. for (let j = 0; j < length; j++) {
  35645. let char = name[j];
  35646. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  35647. char = "_";
  35648. }
  35649. sanitizedName[j] = char;
  35650. }
  35651. sanitizedName = sanitizedName.join("");
  35652. if (sanitizedName === "") {
  35653. sanitizedName = "Bad_Font_Name";
  35654. }
  35655. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  35656. }
  35657. return this.compileIndex(nameIndex);
  35658. }
  35659. compileTopDicts(dicts, length, removeCidKeys) {
  35660. const fontDictTrackers = [];
  35661. let fdArrayIndex = new CFFIndex();
  35662. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35663. const fontDict = dicts[i];
  35664. if (removeCidKeys) {
  35665. fontDict.removeByName("CIDFontVersion");
  35666. fontDict.removeByName("CIDFontRevision");
  35667. fontDict.removeByName("CIDFontType");
  35668. fontDict.removeByName("CIDCount");
  35669. fontDict.removeByName("UIDBase");
  35670. }
  35671. const fontDictTracker = new CFFOffsetTracker();
  35672. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  35673. fontDictTrackers.push(fontDictTracker);
  35674. fdArrayIndex.add(fontDictData);
  35675. fontDictTracker.offset(length);
  35676. }
  35677. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  35678. return {
  35679. trackers: fontDictTrackers,
  35680. output: fdArrayIndex
  35681. };
  35682. }
  35683. compilePrivateDicts(dicts, trackers, output) {
  35684. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35685. const fontDict = dicts[i];
  35686. const privateDict = fontDict.privateDict;
  35687. if (!privateDict || !fontDict.hasName("Private")) {
  35688. throw new _util.FormatError("There must be a private dictionary.");
  35689. }
  35690. const privateDictTracker = new CFFOffsetTracker();
  35691. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  35692. let outputLength = output.length;
  35693. privateDictTracker.offset(outputLength);
  35694. if (!privateDictData.length) {
  35695. outputLength = 0;
  35696. }
  35697. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  35698. output.add(privateDictData);
  35699. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  35700. const subrs = this.compileIndex(privateDict.subrsIndex);
  35701. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  35702. output.add(subrs);
  35703. }
  35704. }
  35705. }
  35706. compileDict(dict, offsetTracker) {
  35707. let out = [];
  35708. const order = dict.order;
  35709. for (let i = 0; i < order.length; ++i) {
  35710. const key = order[i];
  35711. if (!(key in dict.values)) {
  35712. continue;
  35713. }
  35714. let values = dict.values[key];
  35715. let types = dict.types[key];
  35716. if (!Array.isArray(types)) {
  35717. types = [types];
  35718. }
  35719. if (!Array.isArray(values)) {
  35720. values = [values];
  35721. }
  35722. if (values.length === 0) {
  35723. continue;
  35724. }
  35725. for (let j = 0, jj = types.length; j < jj; ++j) {
  35726. const type = types[j];
  35727. const value = values[j];
  35728. switch (type) {
  35729. case "num":
  35730. case "sid":
  35731. out = out.concat(this.encodeNumber(value));
  35732. break;
  35733. case "offset":
  35734. const name = dict.keyToNameMap[key];
  35735. if (!offsetTracker.isTracking(name)) {
  35736. offsetTracker.track(name, out.length);
  35737. }
  35738. out = out.concat([0x1d, 0, 0, 0, 0]);
  35739. break;
  35740. case "array":
  35741. case "delta":
  35742. out = out.concat(this.encodeNumber(value));
  35743. for (let k = 1, kk = values.length; k < kk; ++k) {
  35744. out = out.concat(this.encodeNumber(values[k]));
  35745. }
  35746. break;
  35747. default:
  35748. throw new _util.FormatError(`Unknown data type of ${type}`);
  35749. }
  35750. }
  35751. out = out.concat(dict.opcodes[key]);
  35752. }
  35753. return out;
  35754. }
  35755. compileStringIndex(strings) {
  35756. const stringIndex = new CFFIndex();
  35757. for (let i = 0, ii = strings.length; i < ii; ++i) {
  35758. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  35759. }
  35760. return this.compileIndex(stringIndex);
  35761. }
  35762. compileGlobalSubrIndex() {
  35763. const globalSubrIndex = this.cff.globalSubrIndex;
  35764. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  35765. }
  35766. compileCharStrings(charStrings) {
  35767. const charStringsIndex = new CFFIndex();
  35768. for (let i = 0; i < charStrings.count; i++) {
  35769. const glyph = charStrings.get(i);
  35770. if (glyph.length === 0) {
  35771. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  35772. continue;
  35773. }
  35774. charStringsIndex.add(glyph);
  35775. }
  35776. return this.compileIndex(charStringsIndex);
  35777. }
  35778. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  35779. let out;
  35780. const numGlyphsLessNotDef = numGlyphs - 1;
  35781. if (isCIDFont) {
  35782. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  35783. } else {
  35784. const length = 1 + numGlyphsLessNotDef * 2;
  35785. out = new Uint8Array(length);
  35786. out[0] = 0;
  35787. let charsetIndex = 0;
  35788. const numCharsets = charset.charset.length;
  35789. let warned = false;
  35790. for (let i = 1; i < out.length; i += 2) {
  35791. let sid = 0;
  35792. if (charsetIndex < numCharsets) {
  35793. const name = charset.charset[charsetIndex++];
  35794. sid = strings.getSID(name);
  35795. if (sid === -1) {
  35796. sid = 0;
  35797. if (!warned) {
  35798. warned = true;
  35799. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  35800. }
  35801. }
  35802. }
  35803. out[i] = sid >> 8 & 0xff;
  35804. out[i + 1] = sid & 0xff;
  35805. }
  35806. }
  35807. return this.compileTypedArray(out);
  35808. }
  35809. compileEncoding(encoding) {
  35810. return this.compileTypedArray(encoding.raw);
  35811. }
  35812. compileFDSelect(fdSelect) {
  35813. const format = fdSelect.format;
  35814. let out, i;
  35815. switch (format) {
  35816. case 0:
  35817. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  35818. out[0] = format;
  35819. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  35820. out[i + 1] = fdSelect.fdSelect[i];
  35821. }
  35822. break;
  35823. case 3:
  35824. const start = 0;
  35825. let lastFD = fdSelect.fdSelect[0];
  35826. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  35827. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  35828. const currentFD = fdSelect.fdSelect[i];
  35829. if (currentFD !== lastFD) {
  35830. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  35831. lastFD = currentFD;
  35832. }
  35833. }
  35834. const numRanges = (ranges.length - 3) / 3;
  35835. ranges[1] = numRanges >> 8 & 0xff;
  35836. ranges[2] = numRanges & 0xff;
  35837. ranges.push(i >> 8 & 0xff, i & 0xff);
  35838. out = new Uint8Array(ranges);
  35839. break;
  35840. }
  35841. return this.compileTypedArray(out);
  35842. }
  35843. compileTypedArray(data) {
  35844. const out = [];
  35845. for (let i = 0, ii = data.length; i < ii; ++i) {
  35846. out[i] = data[i];
  35847. }
  35848. return out;
  35849. }
  35850. compileIndex(index, trackers = []) {
  35851. const objects = index.objects;
  35852. const count = objects.length;
  35853. if (count === 0) {
  35854. return [0, 0, 0];
  35855. }
  35856. const data = [count >> 8 & 0xff, count & 0xff];
  35857. let lastOffset = 1,
  35858. i;
  35859. for (i = 0; i < count; ++i) {
  35860. lastOffset += objects[i].length;
  35861. }
  35862. let offsetSize;
  35863. if (lastOffset < 0x100) {
  35864. offsetSize = 1;
  35865. } else if (lastOffset < 0x10000) {
  35866. offsetSize = 2;
  35867. } else if (lastOffset < 0x1000000) {
  35868. offsetSize = 3;
  35869. } else {
  35870. offsetSize = 4;
  35871. }
  35872. data.push(offsetSize);
  35873. let relativeOffset = 1;
  35874. for (i = 0; i < count + 1; i++) {
  35875. if (offsetSize === 1) {
  35876. data.push(relativeOffset & 0xff);
  35877. } else if (offsetSize === 2) {
  35878. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35879. } else if (offsetSize === 3) {
  35880. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35881. } else {
  35882. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35883. }
  35884. if (objects[i]) {
  35885. relativeOffset += objects[i].length;
  35886. }
  35887. }
  35888. for (i = 0; i < count; i++) {
  35889. if (trackers[i]) {
  35890. trackers[i].offset(data.length);
  35891. }
  35892. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  35893. data.push(objects[i][j]);
  35894. }
  35895. }
  35896. return data;
  35897. }
  35898. }
  35899. exports.CFFCompiler = CFFCompiler;
  35900. /***/ }),
  35901. /* 46 */
  35902. /***/ ((__unused_webpack_module, exports) => {
  35903. Object.defineProperty(exports, "__esModule", ({
  35904. value: true
  35905. }));
  35906. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  35907. 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"];
  35908. exports.ISOAdobeCharset = ISOAdobeCharset;
  35909. 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"];
  35910. exports.ExpertCharset = ExpertCharset;
  35911. 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"];
  35912. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  35913. /***/ }),
  35914. /* 47 */
  35915. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35916. Object.defineProperty(exports, "__esModule", ({
  35917. value: true
  35918. }));
  35919. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  35920. exports.getStandardFontName = getStandardFontName;
  35921. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  35922. var _core_utils = __w_pdfjs_require__(9);
  35923. var _fonts_utils = __w_pdfjs_require__(18);
  35924. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35925. t["Times-Roman"] = "Times-Roman";
  35926. t.Helvetica = "Helvetica";
  35927. t.Courier = "Courier";
  35928. t.Symbol = "Symbol";
  35929. t["Times-Bold"] = "Times-Bold";
  35930. t["Helvetica-Bold"] = "Helvetica-Bold";
  35931. t["Courier-Bold"] = "Courier-Bold";
  35932. t.ZapfDingbats = "ZapfDingbats";
  35933. t["Times-Italic"] = "Times-Italic";
  35934. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  35935. t["Courier-Oblique"] = "Courier-Oblique";
  35936. t["Times-BoldItalic"] = "Times-BoldItalic";
  35937. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  35938. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  35939. t.ArialNarrow = "Helvetica";
  35940. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  35941. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  35942. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  35943. t.ArialBlack = "Helvetica";
  35944. t["ArialBlack-Bold"] = "Helvetica-Bold";
  35945. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  35946. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  35947. t["Arial-Black"] = "Helvetica";
  35948. t["Arial-Black-Bold"] = "Helvetica-Bold";
  35949. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  35950. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  35951. t.Arial = "Helvetica";
  35952. t["Arial-Bold"] = "Helvetica-Bold";
  35953. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  35954. t["Arial-Italic"] = "Helvetica-Oblique";
  35955. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  35956. t["Arial-BoldMT"] = "Helvetica-Bold";
  35957. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  35958. t.ArialMT = "Helvetica";
  35959. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  35960. t["Courier-Italic"] = "Courier-Oblique";
  35961. t.CourierNew = "Courier";
  35962. t["CourierNew-Bold"] = "Courier-Bold";
  35963. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  35964. t["CourierNew-Italic"] = "Courier-Oblique";
  35965. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  35966. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  35967. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  35968. t.CourierNewPSMT = "Courier";
  35969. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  35970. t["Helvetica-Italic"] = "Helvetica-Oblique";
  35971. t["Symbol-Bold"] = "Symbol";
  35972. t["Symbol-BoldItalic"] = "Symbol";
  35973. t["Symbol-Italic"] = "Symbol";
  35974. t.TimesNewRoman = "Times-Roman";
  35975. t["TimesNewRoman-Bold"] = "Times-Bold";
  35976. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  35977. t["TimesNewRoman-Italic"] = "Times-Italic";
  35978. t.TimesNewRomanPS = "Times-Roman";
  35979. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  35980. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  35981. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  35982. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  35983. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  35984. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  35985. t.TimesNewRomanPSMT = "Times-Roman";
  35986. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  35987. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  35988. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  35989. });
  35990. exports.getStdFontMap = getStdFontMap;
  35991. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35992. t.Courier = "FoxitFixed.pfb";
  35993. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  35994. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  35995. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  35996. t.Helvetica = "FoxitSans.pfb";
  35997. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  35998. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  35999. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36000. t["Times-Roman"] = "FoxitSerif.pfb";
  36001. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36002. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36003. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36004. t.Symbol = "FoxitSymbol.pfb";
  36005. t.ZapfDingbats = "FoxitDingbats.pfb";
  36006. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36007. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36008. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36009. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36010. });
  36011. exports.getFontNameToFileMap = getFontNameToFileMap;
  36012. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36013. t.Calibri = "Helvetica";
  36014. t["Calibri-Bold"] = "Helvetica-Bold";
  36015. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36016. t["Calibri-Italic"] = "Helvetica-Oblique";
  36017. t.CenturyGothic = "Helvetica";
  36018. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36019. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36020. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36021. t.ComicSansMS = "Comic Sans MS";
  36022. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36023. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36024. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36025. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36026. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36027. t["ItcSymbol-Book"] = "Helvetica";
  36028. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36029. t["ItcSymbol-Medium"] = "Helvetica";
  36030. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36031. t.LucidaConsole = "Courier";
  36032. t["LucidaConsole-Bold"] = "Courier-Bold";
  36033. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36034. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36035. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36036. t["MS-Gothic"] = "MS Gothic";
  36037. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36038. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36039. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36040. t["MS-Mincho"] = "MS Mincho";
  36041. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36042. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36043. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36044. t["MS-PGothic"] = "MS PGothic";
  36045. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36046. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36047. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36048. t["MS-PMincho"] = "MS PMincho";
  36049. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36050. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36051. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36052. t.NuptialScript = "Times-Italic";
  36053. t.SegoeUISymbol = "Helvetica";
  36054. t.Wingdings = "ZapfDingbats";
  36055. t["Wingdings-Regular"] = "ZapfDingbats";
  36056. });
  36057. exports.getNonStdFontMap = getNonStdFontMap;
  36058. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36059. t["Adobe Jenson"] = true;
  36060. t["Adobe Text"] = true;
  36061. t.Albertus = true;
  36062. t.Aldus = true;
  36063. t.Alexandria = true;
  36064. t.Algerian = true;
  36065. t["American Typewriter"] = true;
  36066. t.Antiqua = true;
  36067. t.Apex = true;
  36068. t.Arno = true;
  36069. t.Aster = true;
  36070. t.Aurora = true;
  36071. t.Baskerville = true;
  36072. t.Bell = true;
  36073. t.Bembo = true;
  36074. t["Bembo Schoolbook"] = true;
  36075. t.Benguiat = true;
  36076. t["Berkeley Old Style"] = true;
  36077. t["Bernhard Modern"] = true;
  36078. t["Berthold City"] = true;
  36079. t.Bodoni = true;
  36080. t["Bauer Bodoni"] = true;
  36081. t["Book Antiqua"] = true;
  36082. t.Bookman = true;
  36083. t["Bordeaux Roman"] = true;
  36084. t["Californian FB"] = true;
  36085. t.Calisto = true;
  36086. t.Calvert = true;
  36087. t.Capitals = true;
  36088. t.Cambria = true;
  36089. t.Cartier = true;
  36090. t.Caslon = true;
  36091. t.Catull = true;
  36092. t.Centaur = true;
  36093. t["Century Old Style"] = true;
  36094. t["Century Schoolbook"] = true;
  36095. t.Chaparral = true;
  36096. t["Charis SIL"] = true;
  36097. t.Cheltenham = true;
  36098. t["Cholla Slab"] = true;
  36099. t.Clarendon = true;
  36100. t.Clearface = true;
  36101. t.Cochin = true;
  36102. t.Colonna = true;
  36103. t["Computer Modern"] = true;
  36104. t["Concrete Roman"] = true;
  36105. t.Constantia = true;
  36106. t["Cooper Black"] = true;
  36107. t.Corona = true;
  36108. t.Ecotype = true;
  36109. t.Egyptienne = true;
  36110. t.Elephant = true;
  36111. t.Excelsior = true;
  36112. t.Fairfield = true;
  36113. t["FF Scala"] = true;
  36114. t.Folkard = true;
  36115. t.Footlight = true;
  36116. t.FreeSerif = true;
  36117. t["Friz Quadrata"] = true;
  36118. t.Garamond = true;
  36119. t.Gentium = true;
  36120. t.Georgia = true;
  36121. t.Gloucester = true;
  36122. t["Goudy Old Style"] = true;
  36123. t["Goudy Schoolbook"] = true;
  36124. t["Goudy Pro Font"] = true;
  36125. t.Granjon = true;
  36126. t["Guardian Egyptian"] = true;
  36127. t.Heather = true;
  36128. t.Hercules = true;
  36129. t["High Tower Text"] = true;
  36130. t.Hiroshige = true;
  36131. t["Hoefler Text"] = true;
  36132. t["Humana Serif"] = true;
  36133. t.Imprint = true;
  36134. t["Ionic No. 5"] = true;
  36135. t.Janson = true;
  36136. t.Joanna = true;
  36137. t.Korinna = true;
  36138. t.Lexicon = true;
  36139. t.LiberationSerif = true;
  36140. t["Liberation Serif"] = true;
  36141. t["Linux Libertine"] = true;
  36142. t.Literaturnaya = true;
  36143. t.Lucida = true;
  36144. t["Lucida Bright"] = true;
  36145. t.Melior = true;
  36146. t.Memphis = true;
  36147. t.Miller = true;
  36148. t.Minion = true;
  36149. t.Modern = true;
  36150. t["Mona Lisa"] = true;
  36151. t["Mrs Eaves"] = true;
  36152. t["MS Serif"] = true;
  36153. t["Museo Slab"] = true;
  36154. t["New York"] = true;
  36155. t["Nimbus Roman"] = true;
  36156. t["NPS Rawlinson Roadway"] = true;
  36157. t.NuptialScript = true;
  36158. t.Palatino = true;
  36159. t.Perpetua = true;
  36160. t.Plantin = true;
  36161. t["Plantin Schoolbook"] = true;
  36162. t.Playbill = true;
  36163. t["Poor Richard"] = true;
  36164. t["Rawlinson Roadway"] = true;
  36165. t.Renault = true;
  36166. t.Requiem = true;
  36167. t.Rockwell = true;
  36168. t.Roman = true;
  36169. t["Rotis Serif"] = true;
  36170. t.Sabon = true;
  36171. t.Scala = true;
  36172. t.Seagull = true;
  36173. t.Sistina = true;
  36174. t.Souvenir = true;
  36175. t.STIX = true;
  36176. t["Stone Informal"] = true;
  36177. t["Stone Serif"] = true;
  36178. t.Sylfaen = true;
  36179. t.Times = true;
  36180. t.Trajan = true;
  36181. t["Trinité"] = true;
  36182. t["Trump Mediaeval"] = true;
  36183. t.Utopia = true;
  36184. t["Vale Type"] = true;
  36185. t["Bitstream Vera"] = true;
  36186. t["Vera Serif"] = true;
  36187. t.Versailles = true;
  36188. t.Wanted = true;
  36189. t.Weiss = true;
  36190. t["Wide Latin"] = true;
  36191. t.Windsor = true;
  36192. t.XITS = true;
  36193. });
  36194. exports.getSerifFonts = getSerifFonts;
  36195. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36196. t.Dingbats = true;
  36197. t.Symbol = true;
  36198. t.ZapfDingbats = true;
  36199. });
  36200. exports.getSymbolsFonts = getSymbolsFonts;
  36201. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36202. t[2] = 10;
  36203. t[3] = 32;
  36204. t[4] = 33;
  36205. t[5] = 34;
  36206. t[6] = 35;
  36207. t[7] = 36;
  36208. t[8] = 37;
  36209. t[9] = 38;
  36210. t[10] = 39;
  36211. t[11] = 40;
  36212. t[12] = 41;
  36213. t[13] = 42;
  36214. t[14] = 43;
  36215. t[15] = 44;
  36216. t[16] = 45;
  36217. t[17] = 46;
  36218. t[18] = 47;
  36219. t[19] = 48;
  36220. t[20] = 49;
  36221. t[21] = 50;
  36222. t[22] = 51;
  36223. t[23] = 52;
  36224. t[24] = 53;
  36225. t[25] = 54;
  36226. t[26] = 55;
  36227. t[27] = 56;
  36228. t[28] = 57;
  36229. t[29] = 58;
  36230. t[30] = 894;
  36231. t[31] = 60;
  36232. t[32] = 61;
  36233. t[33] = 62;
  36234. t[34] = 63;
  36235. t[35] = 64;
  36236. t[36] = 65;
  36237. t[37] = 66;
  36238. t[38] = 67;
  36239. t[39] = 68;
  36240. t[40] = 69;
  36241. t[41] = 70;
  36242. t[42] = 71;
  36243. t[43] = 72;
  36244. t[44] = 73;
  36245. t[45] = 74;
  36246. t[46] = 75;
  36247. t[47] = 76;
  36248. t[48] = 77;
  36249. t[49] = 78;
  36250. t[50] = 79;
  36251. t[51] = 80;
  36252. t[52] = 81;
  36253. t[53] = 82;
  36254. t[54] = 83;
  36255. t[55] = 84;
  36256. t[56] = 85;
  36257. t[57] = 86;
  36258. t[58] = 87;
  36259. t[59] = 88;
  36260. t[60] = 89;
  36261. t[61] = 90;
  36262. t[62] = 91;
  36263. t[63] = 92;
  36264. t[64] = 93;
  36265. t[65] = 94;
  36266. t[66] = 95;
  36267. t[67] = 96;
  36268. t[68] = 97;
  36269. t[69] = 98;
  36270. t[70] = 99;
  36271. t[71] = 100;
  36272. t[72] = 101;
  36273. t[73] = 102;
  36274. t[74] = 103;
  36275. t[75] = 104;
  36276. t[76] = 105;
  36277. t[77] = 106;
  36278. t[78] = 107;
  36279. t[79] = 108;
  36280. t[80] = 109;
  36281. t[81] = 110;
  36282. t[82] = 111;
  36283. t[83] = 112;
  36284. t[84] = 113;
  36285. t[85] = 114;
  36286. t[86] = 115;
  36287. t[87] = 116;
  36288. t[88] = 117;
  36289. t[89] = 118;
  36290. t[90] = 119;
  36291. t[91] = 120;
  36292. t[92] = 121;
  36293. t[93] = 122;
  36294. t[94] = 123;
  36295. t[95] = 124;
  36296. t[96] = 125;
  36297. t[97] = 126;
  36298. t[98] = 196;
  36299. t[99] = 197;
  36300. t[100] = 199;
  36301. t[101] = 201;
  36302. t[102] = 209;
  36303. t[103] = 214;
  36304. t[104] = 220;
  36305. t[105] = 225;
  36306. t[106] = 224;
  36307. t[107] = 226;
  36308. t[108] = 228;
  36309. t[109] = 227;
  36310. t[110] = 229;
  36311. t[111] = 231;
  36312. t[112] = 233;
  36313. t[113] = 232;
  36314. t[114] = 234;
  36315. t[115] = 235;
  36316. t[116] = 237;
  36317. t[117] = 236;
  36318. t[118] = 238;
  36319. t[119] = 239;
  36320. t[120] = 241;
  36321. t[121] = 243;
  36322. t[122] = 242;
  36323. t[123] = 244;
  36324. t[124] = 246;
  36325. t[125] = 245;
  36326. t[126] = 250;
  36327. t[127] = 249;
  36328. t[128] = 251;
  36329. t[129] = 252;
  36330. t[130] = 8224;
  36331. t[131] = 176;
  36332. t[132] = 162;
  36333. t[133] = 163;
  36334. t[134] = 167;
  36335. t[135] = 8226;
  36336. t[136] = 182;
  36337. t[137] = 223;
  36338. t[138] = 174;
  36339. t[139] = 169;
  36340. t[140] = 8482;
  36341. t[141] = 180;
  36342. t[142] = 168;
  36343. t[143] = 8800;
  36344. t[144] = 198;
  36345. t[145] = 216;
  36346. t[146] = 8734;
  36347. t[147] = 177;
  36348. t[148] = 8804;
  36349. t[149] = 8805;
  36350. t[150] = 165;
  36351. t[151] = 181;
  36352. t[152] = 8706;
  36353. t[153] = 8721;
  36354. t[154] = 8719;
  36355. t[156] = 8747;
  36356. t[157] = 170;
  36357. t[158] = 186;
  36358. t[159] = 8486;
  36359. t[160] = 230;
  36360. t[161] = 248;
  36361. t[162] = 191;
  36362. t[163] = 161;
  36363. t[164] = 172;
  36364. t[165] = 8730;
  36365. t[166] = 402;
  36366. t[167] = 8776;
  36367. t[168] = 8710;
  36368. t[169] = 171;
  36369. t[170] = 187;
  36370. t[171] = 8230;
  36371. t[200] = 193;
  36372. t[203] = 205;
  36373. t[210] = 218;
  36374. t[223] = 711;
  36375. t[224] = 321;
  36376. t[225] = 322;
  36377. t[226] = 352;
  36378. t[227] = 353;
  36379. t[228] = 381;
  36380. t[229] = 382;
  36381. t[233] = 221;
  36382. t[234] = 253;
  36383. t[252] = 263;
  36384. t[253] = 268;
  36385. t[254] = 269;
  36386. t[258] = 258;
  36387. t[260] = 260;
  36388. t[261] = 261;
  36389. t[265] = 280;
  36390. t[266] = 281;
  36391. t[267] = 282;
  36392. t[268] = 283;
  36393. t[269] = 313;
  36394. t[275] = 323;
  36395. t[276] = 324;
  36396. t[278] = 328;
  36397. t[283] = 344;
  36398. t[284] = 345;
  36399. t[285] = 346;
  36400. t[286] = 347;
  36401. t[292] = 367;
  36402. t[295] = 377;
  36403. t[296] = 378;
  36404. t[298] = 380;
  36405. t[305] = 963;
  36406. t[306] = 964;
  36407. t[307] = 966;
  36408. t[308] = 8215;
  36409. t[309] = 8252;
  36410. t[310] = 8319;
  36411. t[311] = 8359;
  36412. t[312] = 8592;
  36413. t[313] = 8593;
  36414. t[337] = 9552;
  36415. t[493] = 1039;
  36416. t[494] = 1040;
  36417. t[705] = 1524;
  36418. t[706] = 8362;
  36419. t[710] = 64288;
  36420. t[711] = 64298;
  36421. t[759] = 1617;
  36422. t[761] = 1776;
  36423. t[763] = 1778;
  36424. t[775] = 1652;
  36425. t[777] = 1764;
  36426. t[778] = 1780;
  36427. t[779] = 1781;
  36428. t[780] = 1782;
  36429. t[782] = 771;
  36430. t[783] = 64726;
  36431. t[786] = 8363;
  36432. t[788] = 8532;
  36433. t[790] = 768;
  36434. t[791] = 769;
  36435. t[792] = 768;
  36436. t[795] = 803;
  36437. t[797] = 64336;
  36438. t[798] = 64337;
  36439. t[799] = 64342;
  36440. t[800] = 64343;
  36441. t[801] = 64344;
  36442. t[802] = 64345;
  36443. t[803] = 64362;
  36444. t[804] = 64363;
  36445. t[805] = 64364;
  36446. t[2424] = 7821;
  36447. t[2425] = 7822;
  36448. t[2426] = 7823;
  36449. t[2427] = 7824;
  36450. t[2428] = 7825;
  36451. t[2429] = 7826;
  36452. t[2430] = 7827;
  36453. t[2433] = 7682;
  36454. t[2678] = 8045;
  36455. t[2679] = 8046;
  36456. t[2830] = 1552;
  36457. t[2838] = 686;
  36458. t[2840] = 751;
  36459. t[2842] = 753;
  36460. t[2843] = 754;
  36461. t[2844] = 755;
  36462. t[2846] = 757;
  36463. t[2856] = 767;
  36464. t[2857] = 848;
  36465. t[2858] = 849;
  36466. t[2862] = 853;
  36467. t[2863] = 854;
  36468. t[2864] = 855;
  36469. t[2865] = 861;
  36470. t[2866] = 862;
  36471. t[2906] = 7460;
  36472. t[2908] = 7462;
  36473. t[2909] = 7463;
  36474. t[2910] = 7464;
  36475. t[2912] = 7466;
  36476. t[2913] = 7467;
  36477. t[2914] = 7468;
  36478. t[2916] = 7470;
  36479. t[2917] = 7471;
  36480. t[2918] = 7472;
  36481. t[2920] = 7474;
  36482. t[2921] = 7475;
  36483. t[2922] = 7476;
  36484. t[2924] = 7478;
  36485. t[2925] = 7479;
  36486. t[2926] = 7480;
  36487. t[2928] = 7482;
  36488. t[2929] = 7483;
  36489. t[2930] = 7484;
  36490. t[2932] = 7486;
  36491. t[2933] = 7487;
  36492. t[2934] = 7488;
  36493. t[2936] = 7490;
  36494. t[2937] = 7491;
  36495. t[2938] = 7492;
  36496. t[2940] = 7494;
  36497. t[2941] = 7495;
  36498. t[2942] = 7496;
  36499. t[2944] = 7498;
  36500. t[2946] = 7500;
  36501. t[2948] = 7502;
  36502. t[2950] = 7504;
  36503. t[2951] = 7505;
  36504. t[2952] = 7506;
  36505. t[2954] = 7508;
  36506. t[2955] = 7509;
  36507. t[2956] = 7510;
  36508. t[2958] = 7512;
  36509. t[2959] = 7513;
  36510. t[2960] = 7514;
  36511. t[2962] = 7516;
  36512. t[2963] = 7517;
  36513. t[2964] = 7518;
  36514. t[2966] = 7520;
  36515. t[2967] = 7521;
  36516. t[2968] = 7522;
  36517. t[2970] = 7524;
  36518. t[2971] = 7525;
  36519. t[2972] = 7526;
  36520. t[2974] = 7528;
  36521. t[2975] = 7529;
  36522. t[2976] = 7530;
  36523. t[2978] = 1537;
  36524. t[2979] = 1538;
  36525. t[2980] = 1539;
  36526. t[2982] = 1549;
  36527. t[2983] = 1551;
  36528. t[2984] = 1552;
  36529. t[2986] = 1554;
  36530. t[2987] = 1555;
  36531. t[2988] = 1556;
  36532. t[2990] = 1623;
  36533. t[2991] = 1624;
  36534. t[2995] = 1775;
  36535. t[2999] = 1791;
  36536. t[3002] = 64290;
  36537. t[3003] = 64291;
  36538. t[3004] = 64292;
  36539. t[3006] = 64294;
  36540. t[3007] = 64295;
  36541. t[3008] = 64296;
  36542. t[3011] = 1900;
  36543. t[3014] = 8223;
  36544. t[3015] = 8244;
  36545. t[3017] = 7532;
  36546. t[3018] = 7533;
  36547. t[3019] = 7534;
  36548. t[3075] = 7590;
  36549. t[3076] = 7591;
  36550. t[3079] = 7594;
  36551. t[3080] = 7595;
  36552. t[3083] = 7598;
  36553. t[3084] = 7599;
  36554. t[3087] = 7602;
  36555. t[3088] = 7603;
  36556. t[3091] = 7606;
  36557. t[3092] = 7607;
  36558. t[3095] = 7610;
  36559. t[3096] = 7611;
  36560. t[3099] = 7614;
  36561. t[3100] = 7615;
  36562. t[3103] = 7618;
  36563. t[3104] = 7619;
  36564. t[3107] = 8337;
  36565. t[3108] = 8338;
  36566. t[3116] = 1884;
  36567. t[3119] = 1885;
  36568. t[3120] = 1885;
  36569. t[3123] = 1886;
  36570. t[3124] = 1886;
  36571. t[3127] = 1887;
  36572. t[3128] = 1887;
  36573. t[3131] = 1888;
  36574. t[3132] = 1888;
  36575. t[3135] = 1889;
  36576. t[3136] = 1889;
  36577. t[3139] = 1890;
  36578. t[3140] = 1890;
  36579. t[3143] = 1891;
  36580. t[3144] = 1891;
  36581. t[3147] = 1892;
  36582. t[3148] = 1892;
  36583. t[3153] = 580;
  36584. t[3154] = 581;
  36585. t[3157] = 584;
  36586. t[3158] = 585;
  36587. t[3161] = 588;
  36588. t[3162] = 589;
  36589. t[3165] = 891;
  36590. t[3166] = 892;
  36591. t[3169] = 1274;
  36592. t[3170] = 1275;
  36593. t[3173] = 1278;
  36594. t[3174] = 1279;
  36595. t[3181] = 7622;
  36596. t[3182] = 7623;
  36597. t[3282] = 11799;
  36598. t[3316] = 578;
  36599. t[3379] = 42785;
  36600. t[3393] = 1159;
  36601. t[3416] = 8377;
  36602. });
  36603. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  36604. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  36605. t[227] = 322;
  36606. t[264] = 261;
  36607. t[291] = 346;
  36608. });
  36609. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  36610. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  36611. t[1] = 32;
  36612. t[4] = 65;
  36613. t[6] = 193;
  36614. t[17] = 66;
  36615. t[18] = 67;
  36616. t[21] = 268;
  36617. t[24] = 68;
  36618. t[28] = 69;
  36619. t[30] = 201;
  36620. t[32] = 282;
  36621. t[38] = 70;
  36622. t[39] = 71;
  36623. t[44] = 72;
  36624. t[47] = 73;
  36625. t[49] = 205;
  36626. t[58] = 74;
  36627. t[60] = 75;
  36628. t[62] = 76;
  36629. t[68] = 77;
  36630. t[69] = 78;
  36631. t[75] = 79;
  36632. t[87] = 80;
  36633. t[89] = 81;
  36634. t[90] = 82;
  36635. t[92] = 344;
  36636. t[94] = 83;
  36637. t[97] = 352;
  36638. t[100] = 84;
  36639. t[104] = 85;
  36640. t[115] = 86;
  36641. t[116] = 87;
  36642. t[121] = 88;
  36643. t[122] = 89;
  36644. t[124] = 221;
  36645. t[127] = 90;
  36646. t[129] = 381;
  36647. t[258] = 97;
  36648. t[260] = 225;
  36649. t[268] = 261;
  36650. t[271] = 98;
  36651. t[272] = 99;
  36652. t[273] = 263;
  36653. t[275] = 269;
  36654. t[282] = 100;
  36655. t[286] = 101;
  36656. t[288] = 233;
  36657. t[290] = 283;
  36658. t[295] = 281;
  36659. t[296] = 102;
  36660. t[336] = 103;
  36661. t[346] = 104;
  36662. t[349] = 105;
  36663. t[351] = 237;
  36664. t[361] = 106;
  36665. t[364] = 107;
  36666. t[367] = 108;
  36667. t[371] = 322;
  36668. t[373] = 109;
  36669. t[374] = 110;
  36670. t[381] = 111;
  36671. t[383] = 243;
  36672. t[393] = 112;
  36673. t[395] = 113;
  36674. t[396] = 114;
  36675. t[398] = 345;
  36676. t[400] = 115;
  36677. t[401] = 347;
  36678. t[403] = 353;
  36679. t[410] = 116;
  36680. t[437] = 117;
  36681. t[448] = 118;
  36682. t[449] = 119;
  36683. t[454] = 120;
  36684. t[455] = 121;
  36685. t[457] = 253;
  36686. t[460] = 122;
  36687. t[462] = 382;
  36688. t[463] = 380;
  36689. t[853] = 44;
  36690. t[855] = 58;
  36691. t[856] = 46;
  36692. t[876] = 47;
  36693. t[878] = 45;
  36694. t[882] = 45;
  36695. t[894] = 40;
  36696. t[895] = 41;
  36697. t[896] = 91;
  36698. t[897] = 93;
  36699. t[923] = 64;
  36700. t[1004] = 48;
  36701. t[1005] = 49;
  36702. t[1006] = 50;
  36703. t[1007] = 51;
  36704. t[1008] = 52;
  36705. t[1009] = 53;
  36706. t[1010] = 54;
  36707. t[1011] = 55;
  36708. t[1012] = 56;
  36709. t[1013] = 57;
  36710. t[1081] = 37;
  36711. t[1085] = 43;
  36712. t[1086] = 45;
  36713. });
  36714. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  36715. function getStandardFontName(name) {
  36716. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  36717. const stdFontMap = getStdFontMap();
  36718. return stdFontMap[fontName];
  36719. }
  36720. /***/ }),
  36721. /* 48 */
  36722. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36723. Object.defineProperty(exports, "__esModule", ({
  36724. value: true
  36725. }));
  36726. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  36727. var _util = __w_pdfjs_require__(2);
  36728. class ToUnicodeMap {
  36729. constructor(cmap = []) {
  36730. this._map = cmap;
  36731. }
  36732. get length() {
  36733. return this._map.length;
  36734. }
  36735. forEach(callback) {
  36736. for (const charCode in this._map) {
  36737. callback(charCode, this._map[charCode].charCodeAt(0));
  36738. }
  36739. }
  36740. has(i) {
  36741. return this._map[i] !== undefined;
  36742. }
  36743. get(i) {
  36744. return this._map[i];
  36745. }
  36746. charCodeOf(value) {
  36747. const map = this._map;
  36748. if (map.length <= 0x10000) {
  36749. return map.indexOf(value);
  36750. }
  36751. for (const charCode in map) {
  36752. if (map[charCode] === value) {
  36753. return charCode | 0;
  36754. }
  36755. }
  36756. return -1;
  36757. }
  36758. amend(map) {
  36759. for (const charCode in map) {
  36760. this._map[charCode] = map[charCode];
  36761. }
  36762. }
  36763. }
  36764. exports.ToUnicodeMap = ToUnicodeMap;
  36765. class IdentityToUnicodeMap {
  36766. constructor(firstChar, lastChar) {
  36767. this.firstChar = firstChar;
  36768. this.lastChar = lastChar;
  36769. }
  36770. get length() {
  36771. return this.lastChar + 1 - this.firstChar;
  36772. }
  36773. forEach(callback) {
  36774. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  36775. callback(i, i);
  36776. }
  36777. }
  36778. has(i) {
  36779. return this.firstChar <= i && i <= this.lastChar;
  36780. }
  36781. get(i) {
  36782. if (this.firstChar <= i && i <= this.lastChar) {
  36783. return String.fromCharCode(i);
  36784. }
  36785. return undefined;
  36786. }
  36787. charCodeOf(v) {
  36788. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  36789. }
  36790. amend(map) {
  36791. (0, _util.unreachable)("Should not call amend()");
  36792. }
  36793. }
  36794. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  36795. /***/ }),
  36796. /* 49 */
  36797. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36798. Object.defineProperty(exports, "__esModule", ({
  36799. value: true
  36800. }));
  36801. exports.CFFFont = void 0;
  36802. var _cff_parser = __w_pdfjs_require__(45);
  36803. var _fonts_utils = __w_pdfjs_require__(18);
  36804. var _util = __w_pdfjs_require__(2);
  36805. class CFFFont {
  36806. constructor(file, properties) {
  36807. this.properties = properties;
  36808. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  36809. this.cff = parser.parse();
  36810. this.cff.duplicateFirstGlyph();
  36811. const compiler = new _cff_parser.CFFCompiler(this.cff);
  36812. this.seacs = this.cff.seacs;
  36813. try {
  36814. this.data = compiler.compile();
  36815. } catch (e) {
  36816. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  36817. this.data = file;
  36818. }
  36819. this._createBuiltInEncoding();
  36820. }
  36821. get numGlyphs() {
  36822. return this.cff.charStrings.count;
  36823. }
  36824. getCharset() {
  36825. return this.cff.charset.charset;
  36826. }
  36827. getGlyphMapping() {
  36828. const cff = this.cff;
  36829. const properties = this.properties;
  36830. const charsets = cff.charset.charset;
  36831. let charCodeToGlyphId;
  36832. let glyphId;
  36833. if (properties.composite) {
  36834. charCodeToGlyphId = Object.create(null);
  36835. let charCode;
  36836. if (cff.isCIDFont) {
  36837. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  36838. const cid = charsets[glyphId];
  36839. charCode = properties.cMap.charCodeOf(cid);
  36840. charCodeToGlyphId[charCode] = glyphId;
  36841. }
  36842. } else {
  36843. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  36844. charCode = properties.cMap.charCodeOf(glyphId);
  36845. charCodeToGlyphId[charCode] = glyphId;
  36846. }
  36847. }
  36848. return charCodeToGlyphId;
  36849. }
  36850. let encoding = cff.encoding ? cff.encoding.encoding : null;
  36851. if (properties.isInternalFont) {
  36852. encoding = properties.defaultEncoding;
  36853. }
  36854. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  36855. return charCodeToGlyphId;
  36856. }
  36857. hasGlyphId(id) {
  36858. return this.cff.hasGlyphId(id);
  36859. }
  36860. _createBuiltInEncoding() {
  36861. const {
  36862. charset,
  36863. encoding
  36864. } = this.cff;
  36865. if (!charset || !encoding) {
  36866. return;
  36867. }
  36868. const charsets = charset.charset,
  36869. encodings = encoding.encoding;
  36870. const map = [];
  36871. for (const charCode in encodings) {
  36872. const glyphId = encodings[charCode];
  36873. if (glyphId >= 0) {
  36874. const glyphName = charsets[glyphId];
  36875. if (glyphName) {
  36876. map[charCode] = glyphName;
  36877. }
  36878. }
  36879. }
  36880. if (map.length > 0) {
  36881. this.properties.builtInEncoding = map;
  36882. }
  36883. }
  36884. }
  36885. exports.CFFFont = CFFFont;
  36886. /***/ }),
  36887. /* 50 */
  36888. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36889. Object.defineProperty(exports, "__esModule", ({
  36890. value: true
  36891. }));
  36892. exports.FontRendererFactory = void 0;
  36893. var _util = __w_pdfjs_require__(2);
  36894. var _cff_parser = __w_pdfjs_require__(45);
  36895. var _glyphlist = __w_pdfjs_require__(20);
  36896. var _encodings = __w_pdfjs_require__(19);
  36897. var _stream = __w_pdfjs_require__(10);
  36898. function getLong(data, offset) {
  36899. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  36900. }
  36901. function getUshort(data, offset) {
  36902. return data[offset] << 8 | data[offset + 1];
  36903. }
  36904. function getSubroutineBias(subrs) {
  36905. const numSubrs = subrs.length;
  36906. let bias = 32768;
  36907. if (numSubrs < 1240) {
  36908. bias = 107;
  36909. } else if (numSubrs < 33900) {
  36910. bias = 1131;
  36911. }
  36912. return bias;
  36913. }
  36914. function parseCmap(data, start, end) {
  36915. const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  36916. const format = getUshort(data, start + offset);
  36917. let ranges, p, i;
  36918. if (format === 4) {
  36919. getUshort(data, start + offset + 2);
  36920. const segCount = getUshort(data, start + offset + 6) >> 1;
  36921. p = start + offset + 14;
  36922. ranges = [];
  36923. for (i = 0; i < segCount; i++, p += 2) {
  36924. ranges[i] = {
  36925. end: getUshort(data, p)
  36926. };
  36927. }
  36928. p += 2;
  36929. for (i = 0; i < segCount; i++, p += 2) {
  36930. ranges[i].start = getUshort(data, p);
  36931. }
  36932. for (i = 0; i < segCount; i++, p += 2) {
  36933. ranges[i].idDelta = getUshort(data, p);
  36934. }
  36935. for (i = 0; i < segCount; i++, p += 2) {
  36936. let idOffset = getUshort(data, p);
  36937. if (idOffset === 0) {
  36938. continue;
  36939. }
  36940. ranges[i].ids = [];
  36941. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  36942. ranges[i].ids[j] = getUshort(data, p + idOffset);
  36943. idOffset += 2;
  36944. }
  36945. }
  36946. return ranges;
  36947. } else if (format === 12) {
  36948. getLong(data, start + offset + 4);
  36949. const groups = getLong(data, start + offset + 12);
  36950. p = start + offset + 16;
  36951. ranges = [];
  36952. for (i = 0; i < groups; i++) {
  36953. ranges.push({
  36954. start: getLong(data, p),
  36955. end: getLong(data, p + 4),
  36956. idDelta: getLong(data, p + 8) - getLong(data, p)
  36957. });
  36958. p += 12;
  36959. }
  36960. return ranges;
  36961. }
  36962. throw new _util.FormatError(`unsupported cmap: ${format}`);
  36963. }
  36964. function parseCff(data, start, end, seacAnalysisEnabled) {
  36965. const properties = {};
  36966. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  36967. const cff = parser.parse();
  36968. return {
  36969. glyphs: cff.charStrings.objects,
  36970. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  36971. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  36972. isCFFCIDFont: cff.isCIDFont,
  36973. fdSelect: cff.fdSelect,
  36974. fdArray: cff.fdArray
  36975. };
  36976. }
  36977. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  36978. let itemSize, itemDecode;
  36979. if (isGlyphLocationsLong) {
  36980. itemSize = 4;
  36981. itemDecode = function fontItemDecodeLong(data, offset) {
  36982. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  36983. };
  36984. } else {
  36985. itemSize = 2;
  36986. itemDecode = function fontItemDecode(data, offset) {
  36987. return data[offset] << 9 | data[offset + 1] << 1;
  36988. };
  36989. }
  36990. const glyphs = [];
  36991. let startOffset = itemDecode(loca, 0);
  36992. for (let j = itemSize; j < loca.length; j += itemSize) {
  36993. const endOffset = itemDecode(loca, j);
  36994. glyphs.push(glyf.subarray(startOffset, endOffset));
  36995. startOffset = endOffset;
  36996. }
  36997. return glyphs;
  36998. }
  36999. function lookupCmap(ranges, unicode) {
  37000. const code = unicode.codePointAt(0);
  37001. let gid = 0,
  37002. l = 0,
  37003. r = ranges.length - 1;
  37004. while (l < r) {
  37005. const c = l + r + 1 >> 1;
  37006. if (code < ranges[c].start) {
  37007. r = c - 1;
  37008. } else {
  37009. l = c;
  37010. }
  37011. }
  37012. if (ranges[l].start <= code && code <= ranges[l].end) {
  37013. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37014. }
  37015. return {
  37016. charCode: code,
  37017. glyphId: gid
  37018. };
  37019. }
  37020. function compileGlyf(code, cmds, font) {
  37021. function moveTo(x, y) {
  37022. cmds.push({
  37023. cmd: "moveTo",
  37024. args: [x, y]
  37025. });
  37026. }
  37027. function lineTo(x, y) {
  37028. cmds.push({
  37029. cmd: "lineTo",
  37030. args: [x, y]
  37031. });
  37032. }
  37033. function quadraticCurveTo(xa, ya, x, y) {
  37034. cmds.push({
  37035. cmd: "quadraticCurveTo",
  37036. args: [xa, ya, x, y]
  37037. });
  37038. }
  37039. let i = 0;
  37040. const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  37041. let flags;
  37042. let x = 0,
  37043. y = 0;
  37044. i += 10;
  37045. if (numberOfContours < 0) {
  37046. do {
  37047. flags = code[i] << 8 | code[i + 1];
  37048. const glyphIndex = code[i + 2] << 8 | code[i + 3];
  37049. i += 4;
  37050. let arg1, arg2;
  37051. if (flags & 0x01) {
  37052. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  37053. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  37054. i += 4;
  37055. } else {
  37056. arg1 = code[i++];
  37057. arg2 = code[i++];
  37058. }
  37059. if (flags & 0x02) {
  37060. x = arg1;
  37061. y = arg2;
  37062. } else {
  37063. x = 0;
  37064. y = 0;
  37065. }
  37066. let scaleX = 1,
  37067. scaleY = 1,
  37068. scale01 = 0,
  37069. scale10 = 0;
  37070. if (flags & 0x08) {
  37071. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  37072. i += 2;
  37073. } else if (flags & 0x40) {
  37074. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  37075. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  37076. i += 4;
  37077. } else if (flags & 0x80) {
  37078. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  37079. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  37080. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  37081. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  37082. i += 8;
  37083. }
  37084. const subglyph = font.glyphs[glyphIndex];
  37085. if (subglyph) {
  37086. cmds.push({
  37087. cmd: "save"
  37088. }, {
  37089. cmd: "transform",
  37090. args: [scaleX, scale01, scale10, scaleY, x, y]
  37091. });
  37092. compileGlyf(subglyph, cmds, font);
  37093. cmds.push({
  37094. cmd: "restore"
  37095. });
  37096. }
  37097. } while (flags & 0x20);
  37098. } else {
  37099. const endPtsOfContours = [];
  37100. let j, jj;
  37101. for (j = 0; j < numberOfContours; j++) {
  37102. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  37103. i += 2;
  37104. }
  37105. const instructionLength = code[i] << 8 | code[i + 1];
  37106. i += 2 + instructionLength;
  37107. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  37108. const points = [];
  37109. while (points.length < numberOfPoints) {
  37110. flags = code[i++];
  37111. let repeat = 1;
  37112. if (flags & 0x08) {
  37113. repeat += code[i++];
  37114. }
  37115. while (repeat-- > 0) {
  37116. points.push({
  37117. flags
  37118. });
  37119. }
  37120. }
  37121. for (j = 0; j < numberOfPoints; j++) {
  37122. switch (points[j].flags & 0x12) {
  37123. case 0x00:
  37124. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  37125. i += 2;
  37126. break;
  37127. case 0x02:
  37128. x -= code[i++];
  37129. break;
  37130. case 0x12:
  37131. x += code[i++];
  37132. break;
  37133. }
  37134. points[j].x = x;
  37135. }
  37136. for (j = 0; j < numberOfPoints; j++) {
  37137. switch (points[j].flags & 0x24) {
  37138. case 0x00:
  37139. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  37140. i += 2;
  37141. break;
  37142. case 0x04:
  37143. y -= code[i++];
  37144. break;
  37145. case 0x24:
  37146. y += code[i++];
  37147. break;
  37148. }
  37149. points[j].y = y;
  37150. }
  37151. let startPoint = 0;
  37152. for (i = 0; i < numberOfContours; i++) {
  37153. const endPoint = endPtsOfContours[i];
  37154. const contour = points.slice(startPoint, endPoint + 1);
  37155. if (contour[0].flags & 1) {
  37156. contour.push(contour[0]);
  37157. } else if (contour[contour.length - 1].flags & 1) {
  37158. contour.unshift(contour[contour.length - 1]);
  37159. } else {
  37160. const p = {
  37161. flags: 1,
  37162. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  37163. y: (contour[0].y + contour[contour.length - 1].y) / 2
  37164. };
  37165. contour.unshift(p);
  37166. contour.push(p);
  37167. }
  37168. moveTo(contour[0].x, contour[0].y);
  37169. for (j = 1, jj = contour.length; j < jj; j++) {
  37170. if (contour[j].flags & 1) {
  37171. lineTo(contour[j].x, contour[j].y);
  37172. } else if (contour[j + 1].flags & 1) {
  37173. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37174. j++;
  37175. } else {
  37176. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37177. }
  37178. }
  37179. startPoint = endPoint + 1;
  37180. }
  37181. }
  37182. }
  37183. function compileCharString(charStringCode, cmds, font, glyphId) {
  37184. function moveTo(x, y) {
  37185. cmds.push({
  37186. cmd: "moveTo",
  37187. args: [x, y]
  37188. });
  37189. }
  37190. function lineTo(x, y) {
  37191. cmds.push({
  37192. cmd: "lineTo",
  37193. args: [x, y]
  37194. });
  37195. }
  37196. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37197. cmds.push({
  37198. cmd: "bezierCurveTo",
  37199. args: [x1, y1, x2, y2, x, y]
  37200. });
  37201. }
  37202. const stack = [];
  37203. let x = 0,
  37204. y = 0;
  37205. let stems = 0;
  37206. function parse(code) {
  37207. let i = 0;
  37208. while (i < code.length) {
  37209. let stackClean = false;
  37210. let v = code[i++];
  37211. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  37212. switch (v) {
  37213. case 1:
  37214. stems += stack.length >> 1;
  37215. stackClean = true;
  37216. break;
  37217. case 3:
  37218. stems += stack.length >> 1;
  37219. stackClean = true;
  37220. break;
  37221. case 4:
  37222. y += stack.pop();
  37223. moveTo(x, y);
  37224. stackClean = true;
  37225. break;
  37226. case 5:
  37227. while (stack.length > 0) {
  37228. x += stack.shift();
  37229. y += stack.shift();
  37230. lineTo(x, y);
  37231. }
  37232. break;
  37233. case 6:
  37234. while (stack.length > 0) {
  37235. x += stack.shift();
  37236. lineTo(x, y);
  37237. if (stack.length === 0) {
  37238. break;
  37239. }
  37240. y += stack.shift();
  37241. lineTo(x, y);
  37242. }
  37243. break;
  37244. case 7:
  37245. while (stack.length > 0) {
  37246. y += stack.shift();
  37247. lineTo(x, y);
  37248. if (stack.length === 0) {
  37249. break;
  37250. }
  37251. x += stack.shift();
  37252. lineTo(x, y);
  37253. }
  37254. break;
  37255. case 8:
  37256. while (stack.length > 0) {
  37257. xa = x + stack.shift();
  37258. ya = y + stack.shift();
  37259. xb = xa + stack.shift();
  37260. yb = ya + stack.shift();
  37261. x = xb + stack.shift();
  37262. y = yb + stack.shift();
  37263. bezierCurveTo(xa, ya, xb, yb, x, y);
  37264. }
  37265. break;
  37266. case 10:
  37267. n = stack.pop();
  37268. subrCode = null;
  37269. if (font.isCFFCIDFont) {
  37270. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  37271. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  37272. const fontDict = font.fdArray[fdIndex];
  37273. let subrs;
  37274. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  37275. subrs = fontDict.privateDict.subrsIndex.objects;
  37276. }
  37277. if (subrs) {
  37278. n += getSubroutineBias(subrs);
  37279. subrCode = subrs[n];
  37280. }
  37281. } else {
  37282. (0, _util.warn)("Invalid fd index for glyph index.");
  37283. }
  37284. } else {
  37285. subrCode = font.subrs[n + font.subrsBias];
  37286. }
  37287. if (subrCode) {
  37288. parse(subrCode);
  37289. }
  37290. break;
  37291. case 11:
  37292. return;
  37293. case 12:
  37294. v = code[i++];
  37295. switch (v) {
  37296. case 34:
  37297. xa = x + stack.shift();
  37298. xb = xa + stack.shift();
  37299. y1 = y + stack.shift();
  37300. x = xb + stack.shift();
  37301. bezierCurveTo(xa, y, xb, y1, x, y1);
  37302. xa = x + stack.shift();
  37303. xb = xa + stack.shift();
  37304. x = xb + stack.shift();
  37305. bezierCurveTo(xa, y1, xb, y, x, y);
  37306. break;
  37307. case 35:
  37308. xa = x + stack.shift();
  37309. ya = y + stack.shift();
  37310. xb = xa + stack.shift();
  37311. yb = ya + stack.shift();
  37312. x = xb + stack.shift();
  37313. y = yb + stack.shift();
  37314. bezierCurveTo(xa, ya, xb, yb, x, y);
  37315. xa = x + stack.shift();
  37316. ya = y + stack.shift();
  37317. xb = xa + stack.shift();
  37318. yb = ya + stack.shift();
  37319. x = xb + stack.shift();
  37320. y = yb + stack.shift();
  37321. bezierCurveTo(xa, ya, xb, yb, x, y);
  37322. stack.pop();
  37323. break;
  37324. case 36:
  37325. xa = x + stack.shift();
  37326. y1 = y + stack.shift();
  37327. xb = xa + stack.shift();
  37328. y2 = y1 + stack.shift();
  37329. x = xb + stack.shift();
  37330. bezierCurveTo(xa, y1, xb, y2, x, y2);
  37331. xa = x + stack.shift();
  37332. xb = xa + stack.shift();
  37333. y3 = y2 + stack.shift();
  37334. x = xb + stack.shift();
  37335. bezierCurveTo(xa, y2, xb, y3, x, y);
  37336. break;
  37337. case 37:
  37338. const x0 = x,
  37339. y0 = y;
  37340. xa = x + stack.shift();
  37341. ya = y + stack.shift();
  37342. xb = xa + stack.shift();
  37343. yb = ya + stack.shift();
  37344. x = xb + stack.shift();
  37345. y = yb + stack.shift();
  37346. bezierCurveTo(xa, ya, xb, yb, x, y);
  37347. xa = x + stack.shift();
  37348. ya = y + stack.shift();
  37349. xb = xa + stack.shift();
  37350. yb = ya + stack.shift();
  37351. x = xb;
  37352. y = yb;
  37353. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  37354. x += stack.shift();
  37355. } else {
  37356. y += stack.shift();
  37357. }
  37358. bezierCurveTo(xa, ya, xb, yb, x, y);
  37359. break;
  37360. default:
  37361. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  37362. }
  37363. break;
  37364. case 14:
  37365. if (stack.length >= 4) {
  37366. const achar = stack.pop();
  37367. const bchar = stack.pop();
  37368. y = stack.pop();
  37369. x = stack.pop();
  37370. cmds.push({
  37371. cmd: "save"
  37372. }, {
  37373. cmd: "translate",
  37374. args: [x, y]
  37375. });
  37376. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  37377. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37378. cmds.push({
  37379. cmd: "restore"
  37380. });
  37381. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  37382. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37383. }
  37384. return;
  37385. case 18:
  37386. stems += stack.length >> 1;
  37387. stackClean = true;
  37388. break;
  37389. case 19:
  37390. stems += stack.length >> 1;
  37391. i += stems + 7 >> 3;
  37392. stackClean = true;
  37393. break;
  37394. case 20:
  37395. stems += stack.length >> 1;
  37396. i += stems + 7 >> 3;
  37397. stackClean = true;
  37398. break;
  37399. case 21:
  37400. y += stack.pop();
  37401. x += stack.pop();
  37402. moveTo(x, y);
  37403. stackClean = true;
  37404. break;
  37405. case 22:
  37406. x += stack.pop();
  37407. moveTo(x, y);
  37408. stackClean = true;
  37409. break;
  37410. case 23:
  37411. stems += stack.length >> 1;
  37412. stackClean = true;
  37413. break;
  37414. case 24:
  37415. while (stack.length > 2) {
  37416. xa = x + stack.shift();
  37417. ya = y + stack.shift();
  37418. xb = xa + stack.shift();
  37419. yb = ya + stack.shift();
  37420. x = xb + stack.shift();
  37421. y = yb + stack.shift();
  37422. bezierCurveTo(xa, ya, xb, yb, x, y);
  37423. }
  37424. x += stack.shift();
  37425. y += stack.shift();
  37426. lineTo(x, y);
  37427. break;
  37428. case 25:
  37429. while (stack.length > 6) {
  37430. x += stack.shift();
  37431. y += stack.shift();
  37432. lineTo(x, y);
  37433. }
  37434. xa = x + stack.shift();
  37435. ya = y + stack.shift();
  37436. xb = xa + stack.shift();
  37437. yb = ya + stack.shift();
  37438. x = xb + stack.shift();
  37439. y = yb + stack.shift();
  37440. bezierCurveTo(xa, ya, xb, yb, x, y);
  37441. break;
  37442. case 26:
  37443. if (stack.length % 2) {
  37444. x += stack.shift();
  37445. }
  37446. while (stack.length > 0) {
  37447. xa = x;
  37448. ya = y + stack.shift();
  37449. xb = xa + stack.shift();
  37450. yb = ya + stack.shift();
  37451. x = xb;
  37452. y = yb + stack.shift();
  37453. bezierCurveTo(xa, ya, xb, yb, x, y);
  37454. }
  37455. break;
  37456. case 27:
  37457. if (stack.length % 2) {
  37458. y += stack.shift();
  37459. }
  37460. while (stack.length > 0) {
  37461. xa = x + stack.shift();
  37462. ya = y;
  37463. xb = xa + stack.shift();
  37464. yb = ya + stack.shift();
  37465. x = xb + stack.shift();
  37466. y = yb;
  37467. bezierCurveTo(xa, ya, xb, yb, x, y);
  37468. }
  37469. break;
  37470. case 28:
  37471. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  37472. i += 2;
  37473. break;
  37474. case 29:
  37475. n = stack.pop() + font.gsubrsBias;
  37476. subrCode = font.gsubrs[n];
  37477. if (subrCode) {
  37478. parse(subrCode);
  37479. }
  37480. break;
  37481. case 30:
  37482. while (stack.length > 0) {
  37483. xa = x;
  37484. ya = y + stack.shift();
  37485. xb = xa + stack.shift();
  37486. yb = ya + stack.shift();
  37487. x = xb + stack.shift();
  37488. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37489. bezierCurveTo(xa, ya, xb, yb, x, y);
  37490. if (stack.length === 0) {
  37491. break;
  37492. }
  37493. xa = x + stack.shift();
  37494. ya = y;
  37495. xb = xa + stack.shift();
  37496. yb = ya + stack.shift();
  37497. y = yb + stack.shift();
  37498. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37499. bezierCurveTo(xa, ya, xb, yb, x, y);
  37500. }
  37501. break;
  37502. case 31:
  37503. while (stack.length > 0) {
  37504. xa = x + stack.shift();
  37505. ya = y;
  37506. xb = xa + stack.shift();
  37507. yb = ya + stack.shift();
  37508. y = yb + stack.shift();
  37509. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37510. bezierCurveTo(xa, ya, xb, yb, x, y);
  37511. if (stack.length === 0) {
  37512. break;
  37513. }
  37514. xa = x;
  37515. ya = y + stack.shift();
  37516. xb = xa + stack.shift();
  37517. yb = ya + stack.shift();
  37518. x = xb + stack.shift();
  37519. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37520. bezierCurveTo(xa, ya, xb, yb, x, y);
  37521. }
  37522. break;
  37523. default:
  37524. if (v < 32) {
  37525. throw new _util.FormatError(`unknown operator: ${v}`);
  37526. }
  37527. if (v < 247) {
  37528. stack.push(v - 139);
  37529. } else if (v < 251) {
  37530. stack.push((v - 247) * 256 + code[i++] + 108);
  37531. } else if (v < 255) {
  37532. stack.push(-(v - 251) * 256 - code[i++] - 108);
  37533. } else {
  37534. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  37535. i += 4;
  37536. }
  37537. break;
  37538. }
  37539. if (stackClean) {
  37540. stack.length = 0;
  37541. }
  37542. }
  37543. }
  37544. parse(charStringCode);
  37545. }
  37546. const NOOP = [];
  37547. class CompiledFont {
  37548. constructor(fontMatrix) {
  37549. if (this.constructor === CompiledFont) {
  37550. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  37551. }
  37552. this.fontMatrix = fontMatrix;
  37553. this.compiledGlyphs = Object.create(null);
  37554. this.compiledCharCodeToGlyphId = Object.create(null);
  37555. }
  37556. getPathJs(unicode) {
  37557. const {
  37558. charCode,
  37559. glyphId
  37560. } = lookupCmap(this.cmap, unicode);
  37561. let fn = this.compiledGlyphs[glyphId];
  37562. if (!fn) {
  37563. try {
  37564. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  37565. this.compiledGlyphs[glyphId] = fn;
  37566. } catch (ex) {
  37567. this.compiledGlyphs[glyphId] = NOOP;
  37568. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37569. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37570. }
  37571. throw ex;
  37572. }
  37573. }
  37574. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37575. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37576. }
  37577. return fn;
  37578. }
  37579. compileGlyph(code, glyphId) {
  37580. if (!code || code.length === 0 || code[0] === 14) {
  37581. return NOOP;
  37582. }
  37583. let fontMatrix = this.fontMatrix;
  37584. if (this.isCFFCIDFont) {
  37585. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  37586. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  37587. const fontDict = this.fdArray[fdIndex];
  37588. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  37589. } else {
  37590. (0, _util.warn)("Invalid fd index for glyph index.");
  37591. }
  37592. }
  37593. const cmds = [{
  37594. cmd: "save"
  37595. }, {
  37596. cmd: "transform",
  37597. args: fontMatrix.slice()
  37598. }, {
  37599. cmd: "scale",
  37600. args: ["size", "-size"]
  37601. }];
  37602. this.compileGlyphImpl(code, cmds, glyphId);
  37603. cmds.push({
  37604. cmd: "restore"
  37605. });
  37606. return cmds;
  37607. }
  37608. compileGlyphImpl() {
  37609. (0, _util.unreachable)("Children classes should implement this.");
  37610. }
  37611. hasBuiltPath(unicode) {
  37612. const {
  37613. charCode,
  37614. glyphId
  37615. } = lookupCmap(this.cmap, unicode);
  37616. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  37617. }
  37618. }
  37619. class TrueTypeCompiled extends CompiledFont {
  37620. constructor(glyphs, cmap, fontMatrix) {
  37621. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  37622. this.glyphs = glyphs;
  37623. this.cmap = cmap;
  37624. }
  37625. compileGlyphImpl(code, cmds) {
  37626. compileGlyf(code, cmds, this);
  37627. }
  37628. }
  37629. class Type2Compiled extends CompiledFont {
  37630. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  37631. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  37632. this.glyphs = cffInfo.glyphs;
  37633. this.gsubrs = cffInfo.gsubrs || [];
  37634. this.subrs = cffInfo.subrs || [];
  37635. this.cmap = cmap;
  37636. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  37637. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  37638. this.subrsBias = getSubroutineBias(this.subrs);
  37639. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  37640. this.fdSelect = cffInfo.fdSelect;
  37641. this.fdArray = cffInfo.fdArray;
  37642. }
  37643. compileGlyphImpl(code, cmds, glyphId) {
  37644. compileCharString(code, cmds, this, glyphId);
  37645. }
  37646. }
  37647. class FontRendererFactory {
  37648. static create(font, seacAnalysisEnabled) {
  37649. const data = new Uint8Array(font.data);
  37650. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  37651. const numTables = getUshort(data, 4);
  37652. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  37653. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  37654. const offset = getLong(data, p + 8);
  37655. const length = getLong(data, p + 12);
  37656. switch (tag) {
  37657. case "cmap":
  37658. cmap = parseCmap(data, offset, offset + length);
  37659. break;
  37660. case "glyf":
  37661. glyf = data.subarray(offset, offset + length);
  37662. break;
  37663. case "loca":
  37664. loca = data.subarray(offset, offset + length);
  37665. break;
  37666. case "head":
  37667. unitsPerEm = getUshort(data, offset + 18);
  37668. indexToLocFormat = getUshort(data, offset + 50);
  37669. break;
  37670. case "CFF ":
  37671. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  37672. break;
  37673. }
  37674. }
  37675. if (glyf) {
  37676. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  37677. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  37678. }
  37679. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  37680. }
  37681. }
  37682. exports.FontRendererFactory = FontRendererFactory;
  37683. /***/ }),
  37684. /* 51 */
  37685. /***/ ((__unused_webpack_module, exports) => {
  37686. Object.defineProperty(exports, "__esModule", ({
  37687. value: true
  37688. }));
  37689. exports.GlyfTable = void 0;
  37690. const ON_CURVE_POINT = 1 << 0;
  37691. const X_SHORT_VECTOR = 1 << 1;
  37692. const Y_SHORT_VECTOR = 1 << 2;
  37693. const REPEAT_FLAG = 1 << 3;
  37694. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  37695. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  37696. const OVERLAP_SIMPLE = 1 << 6;
  37697. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  37698. const ARGS_ARE_XY_VALUES = 1 << 1;
  37699. const WE_HAVE_A_SCALE = 1 << 3;
  37700. const MORE_COMPONENTS = 1 << 5;
  37701. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  37702. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  37703. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  37704. class GlyfTable {
  37705. constructor({
  37706. glyfTable,
  37707. isGlyphLocationsLong,
  37708. locaTable,
  37709. numGlyphs
  37710. }) {
  37711. this.glyphs = [];
  37712. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  37713. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  37714. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  37715. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  37716. let pos = 0;
  37717. for (let i = 0; i < numGlyphs; i++) {
  37718. pos += offsetSize;
  37719. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  37720. if (next === prev) {
  37721. this.glyphs.push(new Glyph({}));
  37722. continue;
  37723. }
  37724. const glyph = Glyph.parse(prev, glyf);
  37725. this.glyphs.push(glyph);
  37726. prev = next;
  37727. }
  37728. }
  37729. getSize() {
  37730. return this.glyphs.reduce((a, g) => {
  37731. const size = g.getSize();
  37732. return a + (size + 3 & ~3);
  37733. }, 0);
  37734. }
  37735. write() {
  37736. const totalSize = this.getSize();
  37737. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  37738. const isLocationLong = totalSize > 0x1fffe;
  37739. const offsetSize = isLocationLong ? 4 : 2;
  37740. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  37741. if (isLocationLong) {
  37742. locaTable.setUint32(0, 0);
  37743. } else {
  37744. locaTable.setUint16(0, 0);
  37745. }
  37746. let pos = 0;
  37747. let locaIndex = 0;
  37748. for (const glyph of this.glyphs) {
  37749. pos += glyph.write(pos, glyfTable);
  37750. pos = pos + 3 & ~3;
  37751. locaIndex += offsetSize;
  37752. if (isLocationLong) {
  37753. locaTable.setUint32(locaIndex, pos);
  37754. } else {
  37755. locaTable.setUint16(locaIndex, pos >> 1);
  37756. }
  37757. }
  37758. return {
  37759. isLocationLong,
  37760. loca: new Uint8Array(locaTable.buffer),
  37761. glyf: new Uint8Array(glyfTable.buffer)
  37762. };
  37763. }
  37764. scale(factors) {
  37765. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  37766. this.glyphs[i].scale(factors[i]);
  37767. }
  37768. }
  37769. }
  37770. exports.GlyfTable = GlyfTable;
  37771. class Glyph {
  37772. constructor({
  37773. header = null,
  37774. simple = null,
  37775. composites = null
  37776. }) {
  37777. this.header = header;
  37778. this.simple = simple;
  37779. this.composites = composites;
  37780. }
  37781. static parse(pos, glyf) {
  37782. const [read, header] = GlyphHeader.parse(pos, glyf);
  37783. pos += read;
  37784. if (header.numberOfContours < 0) {
  37785. const composites = [];
  37786. while (true) {
  37787. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  37788. pos += n;
  37789. composites.push(composite);
  37790. if (!(composite.flags & MORE_COMPONENTS)) {
  37791. break;
  37792. }
  37793. }
  37794. return new Glyph({
  37795. header,
  37796. composites
  37797. });
  37798. }
  37799. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  37800. return new Glyph({
  37801. header,
  37802. simple
  37803. });
  37804. }
  37805. getSize() {
  37806. if (!this.header) {
  37807. return 0;
  37808. }
  37809. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  37810. return this.header.getSize() + size;
  37811. }
  37812. write(pos, buf) {
  37813. if (!this.header) {
  37814. return 0;
  37815. }
  37816. const spos = pos;
  37817. pos += this.header.write(pos, buf);
  37818. if (this.simple) {
  37819. pos += this.simple.write(pos, buf);
  37820. } else {
  37821. for (const composite of this.composites) {
  37822. pos += composite.write(pos, buf);
  37823. }
  37824. }
  37825. return pos - spos;
  37826. }
  37827. scale(factor) {
  37828. if (!this.header) {
  37829. return;
  37830. }
  37831. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  37832. this.header.scale(xMiddle, factor);
  37833. if (this.simple) {
  37834. this.simple.scale(xMiddle, factor);
  37835. } else {
  37836. for (const composite of this.composites) {
  37837. composite.scale(xMiddle, factor);
  37838. }
  37839. }
  37840. }
  37841. }
  37842. class GlyphHeader {
  37843. constructor({
  37844. numberOfContours,
  37845. xMin,
  37846. yMin,
  37847. xMax,
  37848. yMax
  37849. }) {
  37850. this.numberOfContours = numberOfContours;
  37851. this.xMin = xMin;
  37852. this.yMin = yMin;
  37853. this.xMax = xMax;
  37854. this.yMax = yMax;
  37855. }
  37856. static parse(pos, glyf) {
  37857. return [10, new GlyphHeader({
  37858. numberOfContours: glyf.getInt16(pos),
  37859. xMin: glyf.getInt16(pos + 2),
  37860. yMin: glyf.getInt16(pos + 4),
  37861. xMax: glyf.getInt16(pos + 6),
  37862. yMax: glyf.getInt16(pos + 8)
  37863. })];
  37864. }
  37865. getSize() {
  37866. return 10;
  37867. }
  37868. write(pos, buf) {
  37869. buf.setInt16(pos, this.numberOfContours);
  37870. buf.setInt16(pos + 2, this.xMin);
  37871. buf.setInt16(pos + 4, this.yMin);
  37872. buf.setInt16(pos + 6, this.xMax);
  37873. buf.setInt16(pos + 8, this.yMax);
  37874. return 10;
  37875. }
  37876. scale(x, factor) {
  37877. this.xMin = Math.round(x + (this.xMin - x) * factor);
  37878. this.xMax = Math.round(x + (this.xMax - x) * factor);
  37879. }
  37880. }
  37881. class Contour {
  37882. constructor({
  37883. flags,
  37884. xCoordinates,
  37885. yCoordinates
  37886. }) {
  37887. this.xCoordinates = xCoordinates;
  37888. this.yCoordinates = yCoordinates;
  37889. this.flags = flags;
  37890. }
  37891. }
  37892. class SimpleGlyph {
  37893. constructor({
  37894. contours,
  37895. instructions
  37896. }) {
  37897. this.contours = contours;
  37898. this.instructions = instructions;
  37899. }
  37900. static parse(pos, glyf, numberOfContours) {
  37901. const endPtsOfContours = [];
  37902. for (let i = 0; i < numberOfContours; i++) {
  37903. const endPt = glyf.getUint16(pos);
  37904. pos += 2;
  37905. endPtsOfContours.push(endPt);
  37906. }
  37907. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  37908. const instructionLength = glyf.getUint16(pos);
  37909. pos += 2;
  37910. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  37911. pos += instructionLength;
  37912. const flags = [];
  37913. for (let i = 0; i < numberOfPt; pos++, i++) {
  37914. let flag = glyf.getUint8(pos);
  37915. flags.push(flag);
  37916. if (flag & REPEAT_FLAG) {
  37917. const count = glyf.getUint8(++pos);
  37918. flag ^= REPEAT_FLAG;
  37919. for (let m = 0; m < count; m++) {
  37920. flags.push(flag);
  37921. }
  37922. i += count;
  37923. }
  37924. }
  37925. const allXCoordinates = [];
  37926. let xCoordinates = [];
  37927. let yCoordinates = [];
  37928. let pointFlags = [];
  37929. const contours = [];
  37930. let endPtsOfContoursIndex = 0;
  37931. let lastCoordinate = 0;
  37932. for (let i = 0; i < numberOfPt; i++) {
  37933. const flag = flags[i];
  37934. if (flag & X_SHORT_VECTOR) {
  37935. const x = glyf.getUint8(pos++);
  37936. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  37937. xCoordinates.push(lastCoordinate);
  37938. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  37939. xCoordinates.push(lastCoordinate);
  37940. } else {
  37941. lastCoordinate += glyf.getInt16(pos);
  37942. pos += 2;
  37943. xCoordinates.push(lastCoordinate);
  37944. }
  37945. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37946. endPtsOfContoursIndex++;
  37947. allXCoordinates.push(xCoordinates);
  37948. xCoordinates = [];
  37949. }
  37950. }
  37951. lastCoordinate = 0;
  37952. endPtsOfContoursIndex = 0;
  37953. for (let i = 0; i < numberOfPt; i++) {
  37954. const flag = flags[i];
  37955. if (flag & Y_SHORT_VECTOR) {
  37956. const y = glyf.getUint8(pos++);
  37957. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  37958. yCoordinates.push(lastCoordinate);
  37959. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  37960. yCoordinates.push(lastCoordinate);
  37961. } else {
  37962. lastCoordinate += glyf.getInt16(pos);
  37963. pos += 2;
  37964. yCoordinates.push(lastCoordinate);
  37965. }
  37966. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  37967. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37968. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  37969. endPtsOfContoursIndex++;
  37970. contours.push(new Contour({
  37971. flags: pointFlags,
  37972. xCoordinates,
  37973. yCoordinates
  37974. }));
  37975. yCoordinates = [];
  37976. pointFlags = [];
  37977. }
  37978. }
  37979. return new SimpleGlyph({
  37980. contours,
  37981. instructions
  37982. });
  37983. }
  37984. getSize() {
  37985. let size = this.contours.length * 2 + 2 + this.instructions.length;
  37986. let lastX = 0;
  37987. let lastY = 0;
  37988. for (const contour of this.contours) {
  37989. size += contour.flags.length;
  37990. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37991. const x = contour.xCoordinates[i];
  37992. const y = contour.yCoordinates[i];
  37993. let abs = Math.abs(x - lastX);
  37994. if (abs > 255) {
  37995. size += 2;
  37996. } else if (abs > 0) {
  37997. size += 1;
  37998. }
  37999. lastX = x;
  38000. abs = Math.abs(y - lastY);
  38001. if (abs > 255) {
  38002. size += 2;
  38003. } else if (abs > 0) {
  38004. size += 1;
  38005. }
  38006. lastY = y;
  38007. }
  38008. }
  38009. return size;
  38010. }
  38011. write(pos, buf) {
  38012. const spos = pos;
  38013. const xCoordinates = [];
  38014. const yCoordinates = [];
  38015. const flags = [];
  38016. let lastX = 0;
  38017. let lastY = 0;
  38018. for (const contour of this.contours) {
  38019. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  38020. let flag = contour.flags[i];
  38021. const x = contour.xCoordinates[i];
  38022. let delta = x - lastX;
  38023. if (delta === 0) {
  38024. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  38025. xCoordinates.push(0);
  38026. } else {
  38027. const abs = Math.abs(delta);
  38028. if (abs <= 255) {
  38029. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  38030. xCoordinates.push(abs);
  38031. } else {
  38032. xCoordinates.push(delta);
  38033. }
  38034. }
  38035. lastX = x;
  38036. const y = contour.yCoordinates[i];
  38037. delta = y - lastY;
  38038. if (delta === 0) {
  38039. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  38040. yCoordinates.push(0);
  38041. } else {
  38042. const abs = Math.abs(delta);
  38043. if (abs <= 255) {
  38044. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  38045. yCoordinates.push(abs);
  38046. } else {
  38047. yCoordinates.push(delta);
  38048. }
  38049. }
  38050. lastY = y;
  38051. flags.push(flag);
  38052. }
  38053. buf.setUint16(pos, xCoordinates.length - 1);
  38054. pos += 2;
  38055. }
  38056. buf.setUint16(pos, this.instructions.length);
  38057. pos += 2;
  38058. if (this.instructions.length) {
  38059. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  38060. pos += this.instructions.length;
  38061. }
  38062. for (const flag of flags) {
  38063. buf.setUint8(pos++, flag);
  38064. }
  38065. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  38066. const x = xCoordinates[i];
  38067. const flag = flags[i];
  38068. if (flag & X_SHORT_VECTOR) {
  38069. buf.setUint8(pos++, x);
  38070. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  38071. buf.setInt16(pos, x);
  38072. pos += 2;
  38073. }
  38074. }
  38075. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  38076. const y = yCoordinates[i];
  38077. const flag = flags[i];
  38078. if (flag & Y_SHORT_VECTOR) {
  38079. buf.setUint8(pos++, y);
  38080. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  38081. buf.setInt16(pos, y);
  38082. pos += 2;
  38083. }
  38084. }
  38085. return pos - spos;
  38086. }
  38087. scale(x, factor) {
  38088. for (const contour of this.contours) {
  38089. if (contour.xCoordinates.length === 0) {
  38090. continue;
  38091. }
  38092. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  38093. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  38094. }
  38095. }
  38096. }
  38097. }
  38098. class CompositeGlyph {
  38099. constructor({
  38100. flags,
  38101. glyphIndex,
  38102. argument1,
  38103. argument2,
  38104. transf,
  38105. instructions
  38106. }) {
  38107. this.flags = flags;
  38108. this.glyphIndex = glyphIndex;
  38109. this.argument1 = argument1;
  38110. this.argument2 = argument2;
  38111. this.transf = transf;
  38112. this.instructions = instructions;
  38113. }
  38114. static parse(pos, glyf) {
  38115. const spos = pos;
  38116. const transf = [];
  38117. let flags = glyf.getUint16(pos);
  38118. const glyphIndex = glyf.getUint16(pos + 2);
  38119. pos += 4;
  38120. let argument1, argument2;
  38121. if (flags & ARG_1_AND_2_ARE_WORDS) {
  38122. if (flags & ARGS_ARE_XY_VALUES) {
  38123. argument1 = glyf.getInt16(pos);
  38124. argument2 = glyf.getInt16(pos + 2);
  38125. } else {
  38126. argument1 = glyf.getUint16(pos);
  38127. argument2 = glyf.getUint16(pos + 2);
  38128. }
  38129. pos += 4;
  38130. flags ^= ARG_1_AND_2_ARE_WORDS;
  38131. } else {
  38132. argument1 = glyf.getUint8(pos);
  38133. argument2 = glyf.getUint8(pos + 1);
  38134. if (flags & ARGS_ARE_XY_VALUES) {
  38135. const abs1 = argument1 & 0x7f;
  38136. argument1 = argument1 & 0x80 ? -abs1 : abs1;
  38137. const abs2 = argument2 & 0x7f;
  38138. argument2 = argument2 & 0x80 ? -abs2 : abs2;
  38139. }
  38140. pos += 2;
  38141. }
  38142. if (flags & WE_HAVE_A_SCALE) {
  38143. transf.push(glyf.getUint16(pos));
  38144. pos += 2;
  38145. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  38146. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  38147. pos += 4;
  38148. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  38149. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  38150. pos += 8;
  38151. }
  38152. let instructions = null;
  38153. if (flags & WE_HAVE_INSTRUCTIONS) {
  38154. const instructionLength = glyf.getUint16(pos);
  38155. pos += 2;
  38156. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  38157. pos += instructionLength;
  38158. }
  38159. return [pos - spos, new CompositeGlyph({
  38160. flags,
  38161. glyphIndex,
  38162. argument1,
  38163. argument2,
  38164. transf,
  38165. instructions
  38166. })];
  38167. }
  38168. getSize() {
  38169. let size = 2 + 2 + this.transf.length * 2;
  38170. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  38171. size += 2 + this.instructions.length;
  38172. }
  38173. size += 2;
  38174. if (this.flags & 2) {
  38175. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  38176. size += 2;
  38177. }
  38178. } else {
  38179. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  38180. size += 2;
  38181. }
  38182. }
  38183. return size;
  38184. }
  38185. write(pos, buf) {
  38186. const spos = pos;
  38187. if (this.flags & ARGS_ARE_XY_VALUES) {
  38188. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  38189. this.flags |= ARG_1_AND_2_ARE_WORDS;
  38190. }
  38191. } else {
  38192. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  38193. this.flags |= ARG_1_AND_2_ARE_WORDS;
  38194. }
  38195. }
  38196. buf.setUint16(pos, this.flags);
  38197. buf.setUint16(pos + 2, this.glyphIndex);
  38198. pos += 4;
  38199. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  38200. if (this.flags & ARGS_ARE_XY_VALUES) {
  38201. buf.setInt16(pos, this.argument1);
  38202. buf.setInt16(pos + 2, this.argument2);
  38203. } else {
  38204. buf.setUint16(pos, this.argument1);
  38205. buf.setUint16(pos + 2, this.argument2);
  38206. }
  38207. pos += 4;
  38208. } else {
  38209. buf.setUint8(pos, this.argument1);
  38210. buf.setUint8(pos + 1, this.argument2);
  38211. pos += 2;
  38212. }
  38213. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  38214. buf.setUint16(pos, this.instructions.length);
  38215. pos += 2;
  38216. if (this.instructions.length) {
  38217. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  38218. pos += this.instructions.length;
  38219. }
  38220. }
  38221. return pos - spos;
  38222. }
  38223. scale(x, factor) {}
  38224. }
  38225. /***/ }),
  38226. /* 52 */
  38227. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38228. Object.defineProperty(exports, "__esModule", ({
  38229. value: true
  38230. }));
  38231. exports.OpenTypeFileBuilder = void 0;
  38232. var _core_utils = __w_pdfjs_require__(9);
  38233. var _util = __w_pdfjs_require__(2);
  38234. function writeInt16(dest, offset, num) {
  38235. dest[offset] = num >> 8 & 0xff;
  38236. dest[offset + 1] = num & 0xff;
  38237. }
  38238. function writeInt32(dest, offset, num) {
  38239. dest[offset] = num >> 24 & 0xff;
  38240. dest[offset + 1] = num >> 16 & 0xff;
  38241. dest[offset + 2] = num >> 8 & 0xff;
  38242. dest[offset + 3] = num & 0xff;
  38243. }
  38244. function writeData(dest, offset, data) {
  38245. if (data instanceof Uint8Array) {
  38246. dest.set(data, offset);
  38247. } else if (typeof data === "string") {
  38248. for (let i = 0, ii = data.length; i < ii; i++) {
  38249. dest[offset++] = data.charCodeAt(i) & 0xff;
  38250. }
  38251. } else {
  38252. for (let i = 0, ii = data.length; i < ii; i++) {
  38253. dest[offset++] = data[i] & 0xff;
  38254. }
  38255. }
  38256. }
  38257. const OTF_HEADER_SIZE = 12;
  38258. const OTF_TABLE_ENTRY_SIZE = 16;
  38259. class OpenTypeFileBuilder {
  38260. constructor(sfnt) {
  38261. this.sfnt = sfnt;
  38262. this.tables = Object.create(null);
  38263. }
  38264. static getSearchParams(entriesCount, entrySize) {
  38265. let maxPower2 = 1,
  38266. log2 = 0;
  38267. while ((maxPower2 ^ entriesCount) > maxPower2) {
  38268. maxPower2 <<= 1;
  38269. log2++;
  38270. }
  38271. const searchRange = maxPower2 * entrySize;
  38272. return {
  38273. range: searchRange,
  38274. entry: log2,
  38275. rangeShift: entrySize * entriesCount - searchRange
  38276. };
  38277. }
  38278. toArray() {
  38279. let sfnt = this.sfnt;
  38280. const tables = this.tables;
  38281. const tablesNames = Object.keys(tables);
  38282. tablesNames.sort();
  38283. const numTables = tablesNames.length;
  38284. let i, j, jj, table, tableName;
  38285. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  38286. const tableOffsets = [offset];
  38287. for (i = 0; i < numTables; i++) {
  38288. table = tables[tablesNames[i]];
  38289. const paddedLength = (table.length + 3 & ~3) >>> 0;
  38290. offset += paddedLength;
  38291. tableOffsets.push(offset);
  38292. }
  38293. const file = new Uint8Array(offset);
  38294. for (i = 0; i < numTables; i++) {
  38295. table = tables[tablesNames[i]];
  38296. writeData(file, tableOffsets[i], table);
  38297. }
  38298. if (sfnt === "true") {
  38299. sfnt = (0, _util.string32)(0x00010000);
  38300. }
  38301. file[0] = sfnt.charCodeAt(0) & 0xff;
  38302. file[1] = sfnt.charCodeAt(1) & 0xff;
  38303. file[2] = sfnt.charCodeAt(2) & 0xff;
  38304. file[3] = sfnt.charCodeAt(3) & 0xff;
  38305. writeInt16(file, 4, numTables);
  38306. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  38307. writeInt16(file, 6, searchParams.range);
  38308. writeInt16(file, 8, searchParams.entry);
  38309. writeInt16(file, 10, searchParams.rangeShift);
  38310. offset = OTF_HEADER_SIZE;
  38311. for (i = 0; i < numTables; i++) {
  38312. tableName = tablesNames[i];
  38313. file[offset] = tableName.charCodeAt(0) & 0xff;
  38314. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  38315. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  38316. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  38317. let checksum = 0;
  38318. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  38319. const quad = (0, _core_utils.readUint32)(file, j);
  38320. checksum = checksum + quad >>> 0;
  38321. }
  38322. writeInt32(file, offset + 4, checksum);
  38323. writeInt32(file, offset + 8, tableOffsets[i]);
  38324. writeInt32(file, offset + 12, tables[tableName].length);
  38325. offset += OTF_TABLE_ENTRY_SIZE;
  38326. }
  38327. return file;
  38328. }
  38329. addTable(tag, data) {
  38330. if (tag in this.tables) {
  38331. throw new Error("Table " + tag + " already exists");
  38332. }
  38333. this.tables[tag] = data;
  38334. }
  38335. }
  38336. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  38337. /***/ }),
  38338. /* 53 */
  38339. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38340. Object.defineProperty(exports, "__esModule", ({
  38341. value: true
  38342. }));
  38343. exports.Type1Font = void 0;
  38344. var _cff_parser = __w_pdfjs_require__(45);
  38345. var _fonts_utils = __w_pdfjs_require__(18);
  38346. var _core_utils = __w_pdfjs_require__(9);
  38347. var _stream = __w_pdfjs_require__(10);
  38348. var _type1_parser = __w_pdfjs_require__(54);
  38349. var _util = __w_pdfjs_require__(2);
  38350. function findBlock(streamBytes, signature, startIndex) {
  38351. const streamBytesLength = streamBytes.length;
  38352. const signatureLength = signature.length;
  38353. const scanLength = streamBytesLength - signatureLength;
  38354. let i = startIndex,
  38355. found = false;
  38356. while (i < scanLength) {
  38357. let j = 0;
  38358. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  38359. j++;
  38360. }
  38361. if (j >= signatureLength) {
  38362. i += j;
  38363. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  38364. i++;
  38365. }
  38366. found = true;
  38367. break;
  38368. }
  38369. i++;
  38370. }
  38371. return {
  38372. found,
  38373. length: i
  38374. };
  38375. }
  38376. function getHeaderBlock(stream, suggestedLength) {
  38377. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  38378. const streamStartPos = stream.pos;
  38379. let headerBytes, headerBytesLength, block;
  38380. try {
  38381. headerBytes = stream.getBytes(suggestedLength);
  38382. headerBytesLength = headerBytes.length;
  38383. } catch (ex) {}
  38384. if (headerBytesLength === suggestedLength) {
  38385. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  38386. if (block.found && block.length === suggestedLength) {
  38387. return {
  38388. stream: new _stream.Stream(headerBytes),
  38389. length: suggestedLength
  38390. };
  38391. }
  38392. }
  38393. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  38394. stream.pos = streamStartPos;
  38395. const SCAN_BLOCK_LENGTH = 2048;
  38396. let actualLength;
  38397. while (true) {
  38398. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  38399. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  38400. if (block.length === 0) {
  38401. break;
  38402. }
  38403. stream.pos += block.length;
  38404. if (block.found) {
  38405. actualLength = stream.pos - streamStartPos;
  38406. break;
  38407. }
  38408. }
  38409. stream.pos = streamStartPos;
  38410. if (actualLength) {
  38411. return {
  38412. stream: new _stream.Stream(stream.getBytes(actualLength)),
  38413. length: actualLength
  38414. };
  38415. }
  38416. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  38417. return {
  38418. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  38419. length: suggestedLength
  38420. };
  38421. }
  38422. function getEexecBlock(stream, suggestedLength) {
  38423. const eexecBytes = stream.getBytes();
  38424. return {
  38425. stream: new _stream.Stream(eexecBytes),
  38426. length: eexecBytes.length
  38427. };
  38428. }
  38429. class Type1Font {
  38430. constructor(name, file, properties) {
  38431. const PFB_HEADER_SIZE = 6;
  38432. let headerBlockLength = properties.length1;
  38433. let eexecBlockLength = properties.length2;
  38434. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  38435. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  38436. if (pfbHeaderPresent) {
  38437. file.skip(PFB_HEADER_SIZE);
  38438. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  38439. }
  38440. const headerBlock = getHeaderBlock(file, headerBlockLength);
  38441. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  38442. headerBlockParser.extractFontHeader(properties);
  38443. if (pfbHeaderPresent) {
  38444. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  38445. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  38446. }
  38447. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  38448. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  38449. const data = eexecBlockParser.extractFontProgram(properties);
  38450. for (const key in data.properties) {
  38451. properties[key] = data.properties[key];
  38452. }
  38453. const charstrings = data.charstrings;
  38454. const type2Charstrings = this.getType2Charstrings(charstrings);
  38455. const subrs = this.getType2Subrs(data.subrs);
  38456. this.charstrings = charstrings;
  38457. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  38458. this.seacs = this.getSeacs(data.charstrings);
  38459. }
  38460. get numGlyphs() {
  38461. return this.charstrings.length + 1;
  38462. }
  38463. getCharset() {
  38464. const charset = [".notdef"];
  38465. const charstrings = this.charstrings;
  38466. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  38467. charset.push(charstrings[glyphId].glyphName);
  38468. }
  38469. return charset;
  38470. }
  38471. getGlyphMapping(properties) {
  38472. const charstrings = this.charstrings;
  38473. if (properties.composite) {
  38474. const charCodeToGlyphId = Object.create(null);
  38475. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  38476. const charCode = properties.cMap.charCodeOf(glyphId);
  38477. charCodeToGlyphId[charCode] = glyphId + 1;
  38478. }
  38479. return charCodeToGlyphId;
  38480. }
  38481. const glyphNames = [".notdef"];
  38482. let builtInEncoding, glyphId;
  38483. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  38484. glyphNames.push(charstrings[glyphId].glyphName);
  38485. }
  38486. const encoding = properties.builtInEncoding;
  38487. if (encoding) {
  38488. builtInEncoding = Object.create(null);
  38489. for (const charCode in encoding) {
  38490. glyphId = glyphNames.indexOf(encoding[charCode]);
  38491. if (glyphId >= 0) {
  38492. builtInEncoding[charCode] = glyphId;
  38493. }
  38494. }
  38495. }
  38496. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  38497. }
  38498. hasGlyphId(id) {
  38499. if (id < 0 || id >= this.numGlyphs) {
  38500. return false;
  38501. }
  38502. if (id === 0) {
  38503. return true;
  38504. }
  38505. const glyph = this.charstrings[id - 1];
  38506. return glyph.charstring.length > 0;
  38507. }
  38508. getSeacs(charstrings) {
  38509. const seacMap = [];
  38510. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  38511. const charstring = charstrings[i];
  38512. if (charstring.seac) {
  38513. seacMap[i + 1] = charstring.seac;
  38514. }
  38515. }
  38516. return seacMap;
  38517. }
  38518. getType2Charstrings(type1Charstrings) {
  38519. const type2Charstrings = [];
  38520. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  38521. type2Charstrings.push(type1Charstrings[i].charstring);
  38522. }
  38523. return type2Charstrings;
  38524. }
  38525. getType2Subrs(type1Subrs) {
  38526. let bias = 0;
  38527. const count = type1Subrs.length;
  38528. if (count < 1133) {
  38529. bias = 107;
  38530. } else if (count < 33769) {
  38531. bias = 1131;
  38532. } else {
  38533. bias = 32768;
  38534. }
  38535. const type2Subrs = [];
  38536. let i;
  38537. for (i = 0; i < bias; i++) {
  38538. type2Subrs.push([0x0b]);
  38539. }
  38540. for (i = 0; i < count; i++) {
  38541. type2Subrs.push(type1Subrs[i]);
  38542. }
  38543. return type2Subrs;
  38544. }
  38545. wrap(name, glyphs, charstrings, subrs, properties) {
  38546. const cff = new _cff_parser.CFF();
  38547. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  38548. cff.names = [name];
  38549. const topDict = new _cff_parser.CFFTopDict();
  38550. topDict.setByName("version", 391);
  38551. topDict.setByName("Notice", 392);
  38552. topDict.setByName("FullName", 393);
  38553. topDict.setByName("FamilyName", 394);
  38554. topDict.setByName("Weight", 395);
  38555. topDict.setByName("Encoding", null);
  38556. topDict.setByName("FontMatrix", properties.fontMatrix);
  38557. topDict.setByName("FontBBox", properties.bbox);
  38558. topDict.setByName("charset", null);
  38559. topDict.setByName("CharStrings", null);
  38560. topDict.setByName("Private", null);
  38561. cff.topDict = topDict;
  38562. const strings = new _cff_parser.CFFStrings();
  38563. strings.add("Version 0.11");
  38564. strings.add("See original notice");
  38565. strings.add(name);
  38566. strings.add(name);
  38567. strings.add("Medium");
  38568. cff.strings = strings;
  38569. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  38570. const count = glyphs.length;
  38571. const charsetArray = [".notdef"];
  38572. let i, ii;
  38573. for (i = 0; i < count; i++) {
  38574. const glyphName = charstrings[i].glyphName;
  38575. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  38576. if (index === -1) {
  38577. strings.add(glyphName);
  38578. }
  38579. charsetArray.push(glyphName);
  38580. }
  38581. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  38582. const charStringsIndex = new _cff_parser.CFFIndex();
  38583. charStringsIndex.add([0x8b, 0x0e]);
  38584. for (i = 0; i < count; i++) {
  38585. charStringsIndex.add(glyphs[i]);
  38586. }
  38587. cff.charStrings = charStringsIndex;
  38588. const privateDict = new _cff_parser.CFFPrivateDict();
  38589. privateDict.setByName("Subrs", null);
  38590. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  38591. for (i = 0, ii = fields.length; i < ii; i++) {
  38592. const field = fields[i];
  38593. if (!(field in properties.privateData)) {
  38594. continue;
  38595. }
  38596. const value = properties.privateData[field];
  38597. if (Array.isArray(value)) {
  38598. for (let j = value.length - 1; j > 0; j--) {
  38599. value[j] -= value[j - 1];
  38600. }
  38601. }
  38602. privateDict.setByName(field, value);
  38603. }
  38604. cff.topDict.privateDict = privateDict;
  38605. const subrIndex = new _cff_parser.CFFIndex();
  38606. for (i = 0, ii = subrs.length; i < ii; i++) {
  38607. subrIndex.add(subrs[i]);
  38608. }
  38609. privateDict.subrsIndex = subrIndex;
  38610. const compiler = new _cff_parser.CFFCompiler(cff);
  38611. return compiler.compile();
  38612. }
  38613. }
  38614. exports.Type1Font = Type1Font;
  38615. /***/ }),
  38616. /* 54 */
  38617. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38618. Object.defineProperty(exports, "__esModule", ({
  38619. value: true
  38620. }));
  38621. exports.Type1Parser = void 0;
  38622. var _encodings = __w_pdfjs_require__(19);
  38623. var _core_utils = __w_pdfjs_require__(9);
  38624. var _stream = __w_pdfjs_require__(10);
  38625. var _util = __w_pdfjs_require__(2);
  38626. const HINTING_ENABLED = false;
  38627. const Type1CharString = function Type1CharStringClosure() {
  38628. const COMMAND_MAP = {
  38629. hstem: [1],
  38630. vstem: [3],
  38631. vmoveto: [4],
  38632. rlineto: [5],
  38633. hlineto: [6],
  38634. vlineto: [7],
  38635. rrcurveto: [8],
  38636. callsubr: [10],
  38637. flex: [12, 35],
  38638. drop: [12, 18],
  38639. endchar: [14],
  38640. rmoveto: [21],
  38641. hmoveto: [22],
  38642. vhcurveto: [30],
  38643. hvcurveto: [31]
  38644. };
  38645. class Type1CharString {
  38646. constructor() {
  38647. this.width = 0;
  38648. this.lsb = 0;
  38649. this.flexing = false;
  38650. this.output = [];
  38651. this.stack = [];
  38652. }
  38653. convert(encoded, subrs, seacAnalysisEnabled) {
  38654. const count = encoded.length;
  38655. let error = false;
  38656. let wx, sbx, subrNumber;
  38657. for (let i = 0; i < count; i++) {
  38658. let value = encoded[i];
  38659. if (value < 32) {
  38660. if (value === 12) {
  38661. value = (value << 8) + encoded[++i];
  38662. }
  38663. switch (value) {
  38664. case 1:
  38665. if (!HINTING_ENABLED) {
  38666. this.stack = [];
  38667. break;
  38668. }
  38669. error = this.executeCommand(2, COMMAND_MAP.hstem);
  38670. break;
  38671. case 3:
  38672. if (!HINTING_ENABLED) {
  38673. this.stack = [];
  38674. break;
  38675. }
  38676. error = this.executeCommand(2, COMMAND_MAP.vstem);
  38677. break;
  38678. case 4:
  38679. if (this.flexing) {
  38680. if (this.stack.length < 1) {
  38681. error = true;
  38682. break;
  38683. }
  38684. const dy = this.stack.pop();
  38685. this.stack.push(0, dy);
  38686. break;
  38687. }
  38688. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  38689. break;
  38690. case 5:
  38691. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  38692. break;
  38693. case 6:
  38694. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  38695. break;
  38696. case 7:
  38697. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  38698. break;
  38699. case 8:
  38700. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  38701. break;
  38702. case 9:
  38703. this.stack = [];
  38704. break;
  38705. case 10:
  38706. if (this.stack.length < 1) {
  38707. error = true;
  38708. break;
  38709. }
  38710. subrNumber = this.stack.pop();
  38711. if (!subrs[subrNumber]) {
  38712. error = true;
  38713. break;
  38714. }
  38715. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  38716. break;
  38717. case 11:
  38718. return error;
  38719. case 13:
  38720. if (this.stack.length < 2) {
  38721. error = true;
  38722. break;
  38723. }
  38724. wx = this.stack.pop();
  38725. sbx = this.stack.pop();
  38726. this.lsb = sbx;
  38727. this.width = wx;
  38728. this.stack.push(wx, sbx);
  38729. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  38730. break;
  38731. case 14:
  38732. this.output.push(COMMAND_MAP.endchar[0]);
  38733. break;
  38734. case 21:
  38735. if (this.flexing) {
  38736. break;
  38737. }
  38738. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  38739. break;
  38740. case 22:
  38741. if (this.flexing) {
  38742. this.stack.push(0);
  38743. break;
  38744. }
  38745. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  38746. break;
  38747. case 30:
  38748. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  38749. break;
  38750. case 31:
  38751. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  38752. break;
  38753. case (12 << 8) + 0:
  38754. this.stack = [];
  38755. break;
  38756. case (12 << 8) + 1:
  38757. if (!HINTING_ENABLED) {
  38758. this.stack = [];
  38759. break;
  38760. }
  38761. error = this.executeCommand(2, COMMAND_MAP.vstem);
  38762. break;
  38763. case (12 << 8) + 2:
  38764. if (!HINTING_ENABLED) {
  38765. this.stack = [];
  38766. break;
  38767. }
  38768. error = this.executeCommand(2, COMMAND_MAP.hstem);
  38769. break;
  38770. case (12 << 8) + 6:
  38771. if (seacAnalysisEnabled) {
  38772. const asb = this.stack[this.stack.length - 5];
  38773. this.seac = this.stack.splice(-4, 4);
  38774. this.seac[0] += this.lsb - asb;
  38775. error = this.executeCommand(0, COMMAND_MAP.endchar);
  38776. } else {
  38777. error = this.executeCommand(4, COMMAND_MAP.endchar);
  38778. }
  38779. break;
  38780. case (12 << 8) + 7:
  38781. if (this.stack.length < 4) {
  38782. error = true;
  38783. break;
  38784. }
  38785. this.stack.pop();
  38786. wx = this.stack.pop();
  38787. const sby = this.stack.pop();
  38788. sbx = this.stack.pop();
  38789. this.lsb = sbx;
  38790. this.width = wx;
  38791. this.stack.push(wx, sbx, sby);
  38792. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  38793. break;
  38794. case (12 << 8) + 12:
  38795. if (this.stack.length < 2) {
  38796. error = true;
  38797. break;
  38798. }
  38799. const num2 = this.stack.pop();
  38800. const num1 = this.stack.pop();
  38801. this.stack.push(num1 / num2);
  38802. break;
  38803. case (12 << 8) + 16:
  38804. if (this.stack.length < 2) {
  38805. error = true;
  38806. break;
  38807. }
  38808. subrNumber = this.stack.pop();
  38809. const numArgs = this.stack.pop();
  38810. if (subrNumber === 0 && numArgs === 3) {
  38811. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  38812. 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]);
  38813. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  38814. this.flexing = false;
  38815. this.stack.push(flexArgs[15], flexArgs[16]);
  38816. } else if (subrNumber === 1 && numArgs === 0) {
  38817. this.flexing = true;
  38818. }
  38819. break;
  38820. case (12 << 8) + 17:
  38821. break;
  38822. case (12 << 8) + 33:
  38823. this.stack = [];
  38824. break;
  38825. default:
  38826. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  38827. break;
  38828. }
  38829. if (error) {
  38830. break;
  38831. }
  38832. continue;
  38833. } else if (value <= 246) {
  38834. value -= 139;
  38835. } else if (value <= 250) {
  38836. value = (value - 247) * 256 + encoded[++i] + 108;
  38837. } else if (value <= 254) {
  38838. value = -((value - 251) * 256) - encoded[++i] - 108;
  38839. } else {
  38840. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  38841. }
  38842. this.stack.push(value);
  38843. }
  38844. return error;
  38845. }
  38846. executeCommand(howManyArgs, command, keepStack) {
  38847. const stackLength = this.stack.length;
  38848. if (howManyArgs > stackLength) {
  38849. return true;
  38850. }
  38851. const start = stackLength - howManyArgs;
  38852. for (let i = start; i < stackLength; i++) {
  38853. let value = this.stack[i];
  38854. if (Number.isInteger(value)) {
  38855. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  38856. } else {
  38857. value = 65536 * value | 0;
  38858. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  38859. }
  38860. }
  38861. this.output.push.apply(this.output, command);
  38862. if (keepStack) {
  38863. this.stack.splice(start, howManyArgs);
  38864. } else {
  38865. this.stack.length = 0;
  38866. }
  38867. return false;
  38868. }
  38869. }
  38870. return Type1CharString;
  38871. }();
  38872. const Type1Parser = function Type1ParserClosure() {
  38873. const EEXEC_ENCRYPT_KEY = 55665;
  38874. const CHAR_STRS_ENCRYPT_KEY = 4330;
  38875. function isHexDigit(code) {
  38876. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  38877. }
  38878. function decrypt(data, key, discardNumber) {
  38879. if (discardNumber >= data.length) {
  38880. return new Uint8Array(0);
  38881. }
  38882. const c1 = 52845,
  38883. c2 = 22719;
  38884. let r = key | 0,
  38885. i,
  38886. j;
  38887. for (i = 0; i < discardNumber; i++) {
  38888. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  38889. }
  38890. const count = data.length - discardNumber;
  38891. const decrypted = new Uint8Array(count);
  38892. for (i = discardNumber, j = 0; j < count; i++, j++) {
  38893. const value = data[i];
  38894. decrypted[j] = value ^ r >> 8;
  38895. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  38896. }
  38897. return decrypted;
  38898. }
  38899. function decryptAscii(data, key, discardNumber) {
  38900. const c1 = 52845,
  38901. c2 = 22719;
  38902. let r = key | 0;
  38903. const count = data.length,
  38904. maybeLength = count >>> 1;
  38905. const decrypted = new Uint8Array(maybeLength);
  38906. let i, j;
  38907. for (i = 0, j = 0; i < count; i++) {
  38908. const digit1 = data[i];
  38909. if (!isHexDigit(digit1)) {
  38910. continue;
  38911. }
  38912. i++;
  38913. let digit2;
  38914. while (i < count && !isHexDigit(digit2 = data[i])) {
  38915. i++;
  38916. }
  38917. if (i < count) {
  38918. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  38919. decrypted[j++] = value ^ r >> 8;
  38920. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  38921. }
  38922. }
  38923. return decrypted.slice(discardNumber, j);
  38924. }
  38925. function isSpecial(c) {
  38926. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  38927. }
  38928. class Type1Parser {
  38929. constructor(stream, encrypted, seacAnalysisEnabled) {
  38930. if (encrypted) {
  38931. const data = stream.getBytes();
  38932. 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]));
  38933. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  38934. }
  38935. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  38936. this.stream = stream;
  38937. this.nextChar();
  38938. }
  38939. readNumberArray() {
  38940. this.getToken();
  38941. const array = [];
  38942. while (true) {
  38943. const token = this.getToken();
  38944. if (token === null || token === "]" || token === "}") {
  38945. break;
  38946. }
  38947. array.push(parseFloat(token || 0));
  38948. }
  38949. return array;
  38950. }
  38951. readNumber() {
  38952. const token = this.getToken();
  38953. return parseFloat(token || 0);
  38954. }
  38955. readInt() {
  38956. const token = this.getToken();
  38957. return parseInt(token || 0, 10) | 0;
  38958. }
  38959. readBoolean() {
  38960. const token = this.getToken();
  38961. return token === "true" ? 1 : 0;
  38962. }
  38963. nextChar() {
  38964. return this.currentChar = this.stream.getByte();
  38965. }
  38966. getToken() {
  38967. let comment = false;
  38968. let ch = this.currentChar;
  38969. while (true) {
  38970. if (ch === -1) {
  38971. return null;
  38972. }
  38973. if (comment) {
  38974. if (ch === 0x0a || ch === 0x0d) {
  38975. comment = false;
  38976. }
  38977. } else if (ch === 0x25) {
  38978. comment = true;
  38979. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  38980. break;
  38981. }
  38982. ch = this.nextChar();
  38983. }
  38984. if (isSpecial(ch)) {
  38985. this.nextChar();
  38986. return String.fromCharCode(ch);
  38987. }
  38988. let token = "";
  38989. do {
  38990. token += String.fromCharCode(ch);
  38991. ch = this.nextChar();
  38992. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  38993. return token;
  38994. }
  38995. readCharStrings(bytes, lenIV) {
  38996. if (lenIV === -1) {
  38997. return bytes;
  38998. }
  38999. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  39000. }
  39001. extractFontProgram(properties) {
  39002. const stream = this.stream;
  39003. const subrs = [],
  39004. charstrings = [];
  39005. const privateData = Object.create(null);
  39006. privateData.lenIV = 4;
  39007. const program = {
  39008. subrs: [],
  39009. charstrings: [],
  39010. properties: {
  39011. privateData
  39012. }
  39013. };
  39014. let token, length, data, lenIV, encoded;
  39015. while ((token = this.getToken()) !== null) {
  39016. if (token !== "/") {
  39017. continue;
  39018. }
  39019. token = this.getToken();
  39020. switch (token) {
  39021. case "CharStrings":
  39022. this.getToken();
  39023. this.getToken();
  39024. this.getToken();
  39025. this.getToken();
  39026. while (true) {
  39027. token = this.getToken();
  39028. if (token === null || token === "end") {
  39029. break;
  39030. }
  39031. if (token !== "/") {
  39032. continue;
  39033. }
  39034. const glyph = this.getToken();
  39035. length = this.readInt();
  39036. this.getToken();
  39037. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  39038. lenIV = program.properties.privateData.lenIV;
  39039. encoded = this.readCharStrings(data, lenIV);
  39040. this.nextChar();
  39041. token = this.getToken();
  39042. if (token === "noaccess") {
  39043. this.getToken();
  39044. }
  39045. charstrings.push({
  39046. glyph,
  39047. encoded
  39048. });
  39049. }
  39050. break;
  39051. case "Subrs":
  39052. this.readInt();
  39053. this.getToken();
  39054. while (this.getToken() === "dup") {
  39055. const index = this.readInt();
  39056. length = this.readInt();
  39057. this.getToken();
  39058. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  39059. lenIV = program.properties.privateData.lenIV;
  39060. encoded = this.readCharStrings(data, lenIV);
  39061. this.nextChar();
  39062. token = this.getToken();
  39063. if (token === "noaccess") {
  39064. this.getToken();
  39065. }
  39066. subrs[index] = encoded;
  39067. }
  39068. break;
  39069. case "BlueValues":
  39070. case "OtherBlues":
  39071. case "FamilyBlues":
  39072. case "FamilyOtherBlues":
  39073. const blueArray = this.readNumberArray();
  39074. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  39075. program.properties.privateData[token] = blueArray;
  39076. }
  39077. break;
  39078. case "StemSnapH":
  39079. case "StemSnapV":
  39080. program.properties.privateData[token] = this.readNumberArray();
  39081. break;
  39082. case "StdHW":
  39083. case "StdVW":
  39084. program.properties.privateData[token] = this.readNumberArray()[0];
  39085. break;
  39086. case "BlueShift":
  39087. case "lenIV":
  39088. case "BlueFuzz":
  39089. case "BlueScale":
  39090. case "LanguageGroup":
  39091. case "ExpansionFactor":
  39092. program.properties.privateData[token] = this.readNumber();
  39093. break;
  39094. case "ForceBold":
  39095. program.properties.privateData[token] = this.readBoolean();
  39096. break;
  39097. }
  39098. }
  39099. for (let i = 0; i < charstrings.length; i++) {
  39100. const glyph = charstrings[i].glyph;
  39101. encoded = charstrings[i].encoded;
  39102. const charString = new Type1CharString();
  39103. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  39104. let output = charString.output;
  39105. if (error) {
  39106. output = [14];
  39107. }
  39108. const charStringObject = {
  39109. glyphName: glyph,
  39110. charstring: output,
  39111. width: charString.width,
  39112. lsb: charString.lsb,
  39113. seac: charString.seac
  39114. };
  39115. if (glyph === ".notdef") {
  39116. program.charstrings.unshift(charStringObject);
  39117. } else {
  39118. program.charstrings.push(charStringObject);
  39119. }
  39120. if (properties.builtInEncoding) {
  39121. const index = properties.builtInEncoding.indexOf(glyph);
  39122. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  39123. properties.widths[index] = charString.width;
  39124. }
  39125. }
  39126. }
  39127. return program;
  39128. }
  39129. extractFontHeader(properties) {
  39130. let token;
  39131. while ((token = this.getToken()) !== null) {
  39132. if (token !== "/") {
  39133. continue;
  39134. }
  39135. token = this.getToken();
  39136. switch (token) {
  39137. case "FontMatrix":
  39138. const matrix = this.readNumberArray();
  39139. properties.fontMatrix = matrix;
  39140. break;
  39141. case "Encoding":
  39142. const encodingArg = this.getToken();
  39143. let encoding;
  39144. if (!/^\d+$/.test(encodingArg)) {
  39145. encoding = (0, _encodings.getEncoding)(encodingArg);
  39146. } else {
  39147. encoding = [];
  39148. const size = parseInt(encodingArg, 10) | 0;
  39149. this.getToken();
  39150. for (let j = 0; j < size; j++) {
  39151. token = this.getToken();
  39152. while (token !== "dup" && token !== "def") {
  39153. token = this.getToken();
  39154. if (token === null) {
  39155. return;
  39156. }
  39157. }
  39158. if (token === "def") {
  39159. break;
  39160. }
  39161. const index = this.readInt();
  39162. this.getToken();
  39163. const glyph = this.getToken();
  39164. encoding[index] = glyph;
  39165. this.getToken();
  39166. }
  39167. }
  39168. properties.builtInEncoding = encoding;
  39169. break;
  39170. case "FontBBox":
  39171. const fontBBox = this.readNumberArray();
  39172. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  39173. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  39174. properties.ascentScaled = true;
  39175. break;
  39176. }
  39177. }
  39178. }
  39179. }
  39180. return Type1Parser;
  39181. }();
  39182. exports.Type1Parser = Type1Parser;
  39183. /***/ }),
  39184. /* 55 */
  39185. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39186. Object.defineProperty(exports, "__esModule", ({
  39187. value: true
  39188. }));
  39189. exports.Pattern = void 0;
  39190. exports.getTilingPatternIR = getTilingPatternIR;
  39191. var _util = __w_pdfjs_require__(2);
  39192. var _colorspace = __w_pdfjs_require__(24);
  39193. var _primitives = __w_pdfjs_require__(5);
  39194. var _core_utils = __w_pdfjs_require__(9);
  39195. const ShadingType = {
  39196. FUNCTION_BASED: 1,
  39197. AXIAL: 2,
  39198. RADIAL: 3,
  39199. FREE_FORM_MESH: 4,
  39200. LATTICE_FORM_MESH: 5,
  39201. COONS_PATCH_MESH: 6,
  39202. TENSOR_PATCH_MESH: 7
  39203. };
  39204. class Pattern {
  39205. constructor() {
  39206. (0, _util.unreachable)("Cannot initialize Pattern.");
  39207. }
  39208. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  39209. const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  39210. const type = dict.get("ShadingType");
  39211. try {
  39212. switch (type) {
  39213. case ShadingType.AXIAL:
  39214. case ShadingType.RADIAL:
  39215. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  39216. case ShadingType.FREE_FORM_MESH:
  39217. case ShadingType.LATTICE_FORM_MESH:
  39218. case ShadingType.COONS_PATCH_MESH:
  39219. case ShadingType.TENSOR_PATCH_MESH:
  39220. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  39221. default:
  39222. throw new _util.FormatError("Unsupported ShadingType: " + type);
  39223. }
  39224. } catch (ex) {
  39225. if (ex instanceof _core_utils.MissingDataException) {
  39226. throw ex;
  39227. }
  39228. handler.send("UnsupportedFeature", {
  39229. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  39230. });
  39231. (0, _util.warn)(ex);
  39232. return new DummyShading();
  39233. }
  39234. }
  39235. }
  39236. exports.Pattern = Pattern;
  39237. class BaseShading {
  39238. static get SMALL_NUMBER() {
  39239. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  39240. }
  39241. constructor() {
  39242. if (this.constructor === BaseShading) {
  39243. (0, _util.unreachable)("Cannot initialize BaseShading.");
  39244. }
  39245. }
  39246. getIR() {
  39247. (0, _util.unreachable)("Abstract method `getIR` called.");
  39248. }
  39249. }
  39250. class RadialAxialShading extends BaseShading {
  39251. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  39252. super();
  39253. this.coordsArr = dict.getArray("Coords");
  39254. this.shadingType = dict.get("ShadingType");
  39255. const cs = _colorspace.ColorSpace.parse({
  39256. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  39257. xref,
  39258. resources,
  39259. pdfFunctionFactory,
  39260. localColorSpaceCache
  39261. });
  39262. const bbox = dict.getArray("BBox");
  39263. if (Array.isArray(bbox) && bbox.length === 4) {
  39264. this.bbox = _util.Util.normalizeRect(bbox);
  39265. } else {
  39266. this.bbox = null;
  39267. }
  39268. let t0 = 0.0,
  39269. t1 = 1.0;
  39270. if (dict.has("Domain")) {
  39271. const domainArr = dict.getArray("Domain");
  39272. t0 = domainArr[0];
  39273. t1 = domainArr[1];
  39274. }
  39275. let extendStart = false,
  39276. extendEnd = false;
  39277. if (dict.has("Extend")) {
  39278. const extendArr = dict.getArray("Extend");
  39279. extendStart = extendArr[0];
  39280. extendEnd = extendArr[1];
  39281. }
  39282. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  39283. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  39284. const distance = Math.hypot(x1 - x2, y1 - y2);
  39285. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  39286. (0, _util.warn)("Unsupported radial gradient.");
  39287. }
  39288. }
  39289. this.extendStart = extendStart;
  39290. this.extendEnd = extendEnd;
  39291. const fnObj = dict.getRaw("Function");
  39292. const fn = pdfFunctionFactory.createFromArray(fnObj);
  39293. const NUMBER_OF_SAMPLES = 10;
  39294. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  39295. const colorStops = this.colorStops = [];
  39296. if (t0 >= t1 || step <= 0) {
  39297. (0, _util.info)("Bad shading domain.");
  39298. return;
  39299. }
  39300. const color = new Float32Array(cs.numComps),
  39301. ratio = new Float32Array(1);
  39302. let rgbColor;
  39303. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  39304. ratio[0] = t0 + i * step;
  39305. fn(ratio, 0, color, 0);
  39306. rgbColor = cs.getRgb(color, 0);
  39307. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  39308. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  39309. }
  39310. let background = "transparent";
  39311. if (dict.has("Background")) {
  39312. rgbColor = cs.getRgb(dict.get("Background"), 0);
  39313. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  39314. }
  39315. if (!extendStart) {
  39316. colorStops.unshift([0, background]);
  39317. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  39318. }
  39319. if (!extendEnd) {
  39320. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  39321. colorStops.push([1, background]);
  39322. }
  39323. this.colorStops = colorStops;
  39324. }
  39325. getIR() {
  39326. const coordsArr = this.coordsArr;
  39327. const shadingType = this.shadingType;
  39328. let type, p0, p1, r0, r1;
  39329. if (shadingType === ShadingType.AXIAL) {
  39330. p0 = [coordsArr[0], coordsArr[1]];
  39331. p1 = [coordsArr[2], coordsArr[3]];
  39332. r0 = null;
  39333. r1 = null;
  39334. type = "axial";
  39335. } else if (shadingType === ShadingType.RADIAL) {
  39336. p0 = [coordsArr[0], coordsArr[1]];
  39337. p1 = [coordsArr[3], coordsArr[4]];
  39338. r0 = coordsArr[2];
  39339. r1 = coordsArr[5];
  39340. type = "radial";
  39341. } else {
  39342. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  39343. }
  39344. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  39345. }
  39346. }
  39347. class MeshStreamReader {
  39348. constructor(stream, context) {
  39349. this.stream = stream;
  39350. this.context = context;
  39351. this.buffer = 0;
  39352. this.bufferLength = 0;
  39353. const numComps = context.numComps;
  39354. this.tmpCompsBuf = new Float32Array(numComps);
  39355. const csNumComps = context.colorSpace.numComps;
  39356. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  39357. }
  39358. get hasData() {
  39359. if (this.stream.end) {
  39360. return this.stream.pos < this.stream.end;
  39361. }
  39362. if (this.bufferLength > 0) {
  39363. return true;
  39364. }
  39365. const nextByte = this.stream.getByte();
  39366. if (nextByte < 0) {
  39367. return false;
  39368. }
  39369. this.buffer = nextByte;
  39370. this.bufferLength = 8;
  39371. return true;
  39372. }
  39373. readBits(n) {
  39374. let buffer = this.buffer;
  39375. let bufferLength = this.bufferLength;
  39376. if (n === 32) {
  39377. if (bufferLength === 0) {
  39378. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  39379. }
  39380. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  39381. const nextByte = this.stream.getByte();
  39382. this.buffer = nextByte & (1 << bufferLength) - 1;
  39383. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  39384. }
  39385. if (n === 8 && bufferLength === 0) {
  39386. return this.stream.getByte();
  39387. }
  39388. while (bufferLength < n) {
  39389. buffer = buffer << 8 | this.stream.getByte();
  39390. bufferLength += 8;
  39391. }
  39392. bufferLength -= n;
  39393. this.bufferLength = bufferLength;
  39394. this.buffer = buffer & (1 << bufferLength) - 1;
  39395. return buffer >> bufferLength;
  39396. }
  39397. align() {
  39398. this.buffer = 0;
  39399. this.bufferLength = 0;
  39400. }
  39401. readFlag() {
  39402. return this.readBits(this.context.bitsPerFlag);
  39403. }
  39404. readCoordinate() {
  39405. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  39406. const xi = this.readBits(bitsPerCoordinate);
  39407. const yi = this.readBits(bitsPerCoordinate);
  39408. const decode = this.context.decode;
  39409. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  39410. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  39411. }
  39412. readComponents() {
  39413. const numComps = this.context.numComps;
  39414. const bitsPerComponent = this.context.bitsPerComponent;
  39415. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  39416. const decode = this.context.decode;
  39417. const components = this.tmpCompsBuf;
  39418. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  39419. const ci = this.readBits(bitsPerComponent);
  39420. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  39421. }
  39422. const color = this.tmpCsCompsBuf;
  39423. if (this.context.colorFn) {
  39424. this.context.colorFn(components, 0, color, 0);
  39425. }
  39426. return this.context.colorSpace.getRgb(color, 0);
  39427. }
  39428. }
  39429. const getB = function getBClosure() {
  39430. function buildB(count) {
  39431. const lut = [];
  39432. for (let i = 0; i <= count; i++) {
  39433. const t = i / count,
  39434. t_ = 1 - t;
  39435. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  39436. }
  39437. return lut;
  39438. }
  39439. const cache = [];
  39440. return function (count) {
  39441. if (!cache[count]) {
  39442. cache[count] = buildB(count);
  39443. }
  39444. return cache[count];
  39445. };
  39446. }();
  39447. class MeshShading extends BaseShading {
  39448. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  39449. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  39450. }
  39451. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  39452. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  39453. }
  39454. static get TRIANGLE_DENSITY() {
  39455. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  39456. }
  39457. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  39458. super();
  39459. if (!(0, _primitives.isStream)(stream)) {
  39460. throw new _util.FormatError("Mesh data is not a stream");
  39461. }
  39462. const dict = stream.dict;
  39463. this.shadingType = dict.get("ShadingType");
  39464. const bbox = dict.getArray("BBox");
  39465. if (Array.isArray(bbox) && bbox.length === 4) {
  39466. this.bbox = _util.Util.normalizeRect(bbox);
  39467. } else {
  39468. this.bbox = null;
  39469. }
  39470. const cs = _colorspace.ColorSpace.parse({
  39471. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  39472. xref,
  39473. resources,
  39474. pdfFunctionFactory,
  39475. localColorSpaceCache
  39476. });
  39477. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  39478. const fnObj = dict.getRaw("Function");
  39479. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  39480. this.coords = [];
  39481. this.colors = [];
  39482. this.figures = [];
  39483. const decodeContext = {
  39484. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  39485. bitsPerComponent: dict.get("BitsPerComponent"),
  39486. bitsPerFlag: dict.get("BitsPerFlag"),
  39487. decode: dict.getArray("Decode"),
  39488. colorFn: fn,
  39489. colorSpace: cs,
  39490. numComps: fn ? 1 : cs.numComps
  39491. };
  39492. const reader = new MeshStreamReader(stream, decodeContext);
  39493. let patchMesh = false;
  39494. switch (this.shadingType) {
  39495. case ShadingType.FREE_FORM_MESH:
  39496. this._decodeType4Shading(reader);
  39497. break;
  39498. case ShadingType.LATTICE_FORM_MESH:
  39499. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  39500. if (verticesPerRow < 2) {
  39501. throw new _util.FormatError("Invalid VerticesPerRow");
  39502. }
  39503. this._decodeType5Shading(reader, verticesPerRow);
  39504. break;
  39505. case ShadingType.COONS_PATCH_MESH:
  39506. this._decodeType6Shading(reader);
  39507. patchMesh = true;
  39508. break;
  39509. case ShadingType.TENSOR_PATCH_MESH:
  39510. this._decodeType7Shading(reader);
  39511. patchMesh = true;
  39512. break;
  39513. default:
  39514. (0, _util.unreachable)("Unsupported mesh type.");
  39515. break;
  39516. }
  39517. if (patchMesh) {
  39518. this._updateBounds();
  39519. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  39520. this._buildFigureFromPatch(i);
  39521. }
  39522. }
  39523. this._updateBounds();
  39524. this._packData();
  39525. }
  39526. _decodeType4Shading(reader) {
  39527. const coords = this.coords;
  39528. const colors = this.colors;
  39529. const operators = [];
  39530. const ps = [];
  39531. let verticesLeft = 0;
  39532. while (reader.hasData) {
  39533. const f = reader.readFlag();
  39534. const coord = reader.readCoordinate();
  39535. const color = reader.readComponents();
  39536. if (verticesLeft === 0) {
  39537. if (!(0 <= f && f <= 2)) {
  39538. throw new _util.FormatError("Unknown type4 flag");
  39539. }
  39540. switch (f) {
  39541. case 0:
  39542. verticesLeft = 3;
  39543. break;
  39544. case 1:
  39545. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  39546. verticesLeft = 1;
  39547. break;
  39548. case 2:
  39549. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  39550. verticesLeft = 1;
  39551. break;
  39552. }
  39553. operators.push(f);
  39554. }
  39555. ps.push(coords.length);
  39556. coords.push(coord);
  39557. colors.push(color);
  39558. verticesLeft--;
  39559. reader.align();
  39560. }
  39561. this.figures.push({
  39562. type: "triangles",
  39563. coords: new Int32Array(ps),
  39564. colors: new Int32Array(ps)
  39565. });
  39566. }
  39567. _decodeType5Shading(reader, verticesPerRow) {
  39568. const coords = this.coords;
  39569. const colors = this.colors;
  39570. const ps = [];
  39571. while (reader.hasData) {
  39572. const coord = reader.readCoordinate();
  39573. const color = reader.readComponents();
  39574. ps.push(coords.length);
  39575. coords.push(coord);
  39576. colors.push(color);
  39577. }
  39578. this.figures.push({
  39579. type: "lattice",
  39580. coords: new Int32Array(ps),
  39581. colors: new Int32Array(ps),
  39582. verticesPerRow
  39583. });
  39584. }
  39585. _decodeType6Shading(reader) {
  39586. const coords = this.coords;
  39587. const colors = this.colors;
  39588. const ps = new Int32Array(16);
  39589. const cs = new Int32Array(4);
  39590. while (reader.hasData) {
  39591. const f = reader.readFlag();
  39592. if (!(0 <= f && f <= 3)) {
  39593. throw new _util.FormatError("Unknown type6 flag");
  39594. }
  39595. const pi = coords.length;
  39596. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  39597. coords.push(reader.readCoordinate());
  39598. }
  39599. const ci = colors.length;
  39600. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  39601. colors.push(reader.readComponents());
  39602. }
  39603. let tmp1, tmp2, tmp3, tmp4;
  39604. switch (f) {
  39605. case 0:
  39606. ps[12] = pi + 3;
  39607. ps[13] = pi + 4;
  39608. ps[14] = pi + 5;
  39609. ps[15] = pi + 6;
  39610. ps[8] = pi + 2;
  39611. ps[11] = pi + 7;
  39612. ps[4] = pi + 1;
  39613. ps[7] = pi + 8;
  39614. ps[0] = pi;
  39615. ps[1] = pi + 11;
  39616. ps[2] = pi + 10;
  39617. ps[3] = pi + 9;
  39618. cs[2] = ci + 1;
  39619. cs[3] = ci + 2;
  39620. cs[0] = ci;
  39621. cs[1] = ci + 3;
  39622. break;
  39623. case 1:
  39624. tmp1 = ps[12];
  39625. tmp2 = ps[13];
  39626. tmp3 = ps[14];
  39627. tmp4 = ps[15];
  39628. ps[12] = tmp4;
  39629. ps[13] = pi + 0;
  39630. ps[14] = pi + 1;
  39631. ps[15] = pi + 2;
  39632. ps[8] = tmp3;
  39633. ps[11] = pi + 3;
  39634. ps[4] = tmp2;
  39635. ps[7] = pi + 4;
  39636. ps[0] = tmp1;
  39637. ps[1] = pi + 7;
  39638. ps[2] = pi + 6;
  39639. ps[3] = pi + 5;
  39640. tmp1 = cs[2];
  39641. tmp2 = cs[3];
  39642. cs[2] = tmp2;
  39643. cs[3] = ci;
  39644. cs[0] = tmp1;
  39645. cs[1] = ci + 1;
  39646. break;
  39647. case 2:
  39648. tmp1 = ps[15];
  39649. tmp2 = ps[11];
  39650. ps[12] = ps[3];
  39651. ps[13] = pi + 0;
  39652. ps[14] = pi + 1;
  39653. ps[15] = pi + 2;
  39654. ps[8] = ps[7];
  39655. ps[11] = pi + 3;
  39656. ps[4] = tmp2;
  39657. ps[7] = pi + 4;
  39658. ps[0] = tmp1;
  39659. ps[1] = pi + 7;
  39660. ps[2] = pi + 6;
  39661. ps[3] = pi + 5;
  39662. tmp1 = cs[3];
  39663. cs[2] = cs[1];
  39664. cs[3] = ci;
  39665. cs[0] = tmp1;
  39666. cs[1] = ci + 1;
  39667. break;
  39668. case 3:
  39669. ps[12] = ps[0];
  39670. ps[13] = pi + 0;
  39671. ps[14] = pi + 1;
  39672. ps[15] = pi + 2;
  39673. ps[8] = ps[1];
  39674. ps[11] = pi + 3;
  39675. ps[4] = ps[2];
  39676. ps[7] = pi + 4;
  39677. ps[0] = ps[3];
  39678. ps[1] = pi + 7;
  39679. ps[2] = pi + 6;
  39680. ps[3] = pi + 5;
  39681. cs[2] = cs[0];
  39682. cs[3] = ci;
  39683. cs[0] = cs[1];
  39684. cs[1] = ci + 1;
  39685. break;
  39686. }
  39687. ps[5] = coords.length;
  39688. 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]);
  39689. ps[6] = coords.length;
  39690. 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]);
  39691. ps[9] = coords.length;
  39692. 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]);
  39693. ps[10] = coords.length;
  39694. 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]);
  39695. this.figures.push({
  39696. type: "patch",
  39697. coords: new Int32Array(ps),
  39698. colors: new Int32Array(cs)
  39699. });
  39700. }
  39701. }
  39702. _decodeType7Shading(reader) {
  39703. const coords = this.coords;
  39704. const colors = this.colors;
  39705. const ps = new Int32Array(16);
  39706. const cs = new Int32Array(4);
  39707. while (reader.hasData) {
  39708. const f = reader.readFlag();
  39709. if (!(0 <= f && f <= 3)) {
  39710. throw new _util.FormatError("Unknown type7 flag");
  39711. }
  39712. const pi = coords.length;
  39713. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  39714. coords.push(reader.readCoordinate());
  39715. }
  39716. const ci = colors.length;
  39717. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  39718. colors.push(reader.readComponents());
  39719. }
  39720. let tmp1, tmp2, tmp3, tmp4;
  39721. switch (f) {
  39722. case 0:
  39723. ps[12] = pi + 3;
  39724. ps[13] = pi + 4;
  39725. ps[14] = pi + 5;
  39726. ps[15] = pi + 6;
  39727. ps[8] = pi + 2;
  39728. ps[9] = pi + 13;
  39729. ps[10] = pi + 14;
  39730. ps[11] = pi + 7;
  39731. ps[4] = pi + 1;
  39732. ps[5] = pi + 12;
  39733. ps[6] = pi + 15;
  39734. ps[7] = pi + 8;
  39735. ps[0] = pi;
  39736. ps[1] = pi + 11;
  39737. ps[2] = pi + 10;
  39738. ps[3] = pi + 9;
  39739. cs[2] = ci + 1;
  39740. cs[3] = ci + 2;
  39741. cs[0] = ci;
  39742. cs[1] = ci + 3;
  39743. break;
  39744. case 1:
  39745. tmp1 = ps[12];
  39746. tmp2 = ps[13];
  39747. tmp3 = ps[14];
  39748. tmp4 = ps[15];
  39749. ps[12] = tmp4;
  39750. ps[13] = pi + 0;
  39751. ps[14] = pi + 1;
  39752. ps[15] = pi + 2;
  39753. ps[8] = tmp3;
  39754. ps[9] = pi + 9;
  39755. ps[10] = pi + 10;
  39756. ps[11] = pi + 3;
  39757. ps[4] = tmp2;
  39758. ps[5] = pi + 8;
  39759. ps[6] = pi + 11;
  39760. ps[7] = pi + 4;
  39761. ps[0] = tmp1;
  39762. ps[1] = pi + 7;
  39763. ps[2] = pi + 6;
  39764. ps[3] = pi + 5;
  39765. tmp1 = cs[2];
  39766. tmp2 = cs[3];
  39767. cs[2] = tmp2;
  39768. cs[3] = ci;
  39769. cs[0] = tmp1;
  39770. cs[1] = ci + 1;
  39771. break;
  39772. case 2:
  39773. tmp1 = ps[15];
  39774. tmp2 = ps[11];
  39775. ps[12] = ps[3];
  39776. ps[13] = pi + 0;
  39777. ps[14] = pi + 1;
  39778. ps[15] = pi + 2;
  39779. ps[8] = ps[7];
  39780. ps[9] = pi + 9;
  39781. ps[10] = pi + 10;
  39782. ps[11] = pi + 3;
  39783. ps[4] = tmp2;
  39784. ps[5] = pi + 8;
  39785. ps[6] = pi + 11;
  39786. ps[7] = pi + 4;
  39787. ps[0] = tmp1;
  39788. ps[1] = pi + 7;
  39789. ps[2] = pi + 6;
  39790. ps[3] = pi + 5;
  39791. tmp1 = cs[3];
  39792. cs[2] = cs[1];
  39793. cs[3] = ci;
  39794. cs[0] = tmp1;
  39795. cs[1] = ci + 1;
  39796. break;
  39797. case 3:
  39798. ps[12] = ps[0];
  39799. ps[13] = pi + 0;
  39800. ps[14] = pi + 1;
  39801. ps[15] = pi + 2;
  39802. ps[8] = ps[1];
  39803. ps[9] = pi + 9;
  39804. ps[10] = pi + 10;
  39805. ps[11] = pi + 3;
  39806. ps[4] = ps[2];
  39807. ps[5] = pi + 8;
  39808. ps[6] = pi + 11;
  39809. ps[7] = pi + 4;
  39810. ps[0] = ps[3];
  39811. ps[1] = pi + 7;
  39812. ps[2] = pi + 6;
  39813. ps[3] = pi + 5;
  39814. cs[2] = cs[0];
  39815. cs[3] = ci;
  39816. cs[0] = cs[1];
  39817. cs[1] = ci + 1;
  39818. break;
  39819. }
  39820. this.figures.push({
  39821. type: "patch",
  39822. coords: new Int32Array(ps),
  39823. colors: new Int32Array(cs)
  39824. });
  39825. }
  39826. }
  39827. _buildFigureFromPatch(index) {
  39828. const figure = this.figures[index];
  39829. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  39830. const coords = this.coords,
  39831. colors = this.colors;
  39832. const pi = figure.coords;
  39833. const ci = figure.colors;
  39834. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  39835. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  39836. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  39837. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  39838. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  39839. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  39840. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  39841. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  39842. const verticesPerRow = splitXBy + 1;
  39843. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  39844. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  39845. let k = 0;
  39846. const cl = new Uint8Array(3),
  39847. cr = new Uint8Array(3);
  39848. const c0 = colors[ci[0]],
  39849. c1 = colors[ci[1]],
  39850. c2 = colors[ci[2]],
  39851. c3 = colors[ci[3]];
  39852. const bRow = getB(splitYBy),
  39853. bCol = getB(splitXBy);
  39854. for (let row = 0; row <= splitYBy; row++) {
  39855. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  39856. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  39857. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  39858. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  39859. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  39860. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  39861. for (let col = 0; col <= splitXBy; col++, k++) {
  39862. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  39863. continue;
  39864. }
  39865. let x = 0,
  39866. y = 0;
  39867. let q = 0;
  39868. for (let i = 0; i <= 3; i++) {
  39869. for (let j = 0; j <= 3; j++, q++) {
  39870. const m = bRow[row][i] * bCol[col][j];
  39871. x += coords[pi[q]][0] * m;
  39872. y += coords[pi[q]][1] * m;
  39873. }
  39874. }
  39875. figureCoords[k] = coords.length;
  39876. coords.push([x, y]);
  39877. figureColors[k] = colors.length;
  39878. const newColor = new Uint8Array(3);
  39879. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  39880. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  39881. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  39882. colors.push(newColor);
  39883. }
  39884. }
  39885. figureCoords[0] = pi[0];
  39886. figureColors[0] = ci[0];
  39887. figureCoords[splitXBy] = pi[3];
  39888. figureColors[splitXBy] = ci[1];
  39889. figureCoords[verticesPerRow * splitYBy] = pi[12];
  39890. figureColors[verticesPerRow * splitYBy] = ci[2];
  39891. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  39892. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  39893. this.figures[index] = {
  39894. type: "lattice",
  39895. coords: figureCoords,
  39896. colors: figureColors,
  39897. verticesPerRow
  39898. };
  39899. }
  39900. _updateBounds() {
  39901. let minX = this.coords[0][0],
  39902. minY = this.coords[0][1],
  39903. maxX = minX,
  39904. maxY = minY;
  39905. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  39906. const x = this.coords[i][0],
  39907. y = this.coords[i][1];
  39908. minX = minX > x ? x : minX;
  39909. minY = minY > y ? y : minY;
  39910. maxX = maxX < x ? x : maxX;
  39911. maxY = maxY < y ? y : maxY;
  39912. }
  39913. this.bounds = [minX, minY, maxX, maxY];
  39914. }
  39915. _packData() {
  39916. let i, ii, j, jj;
  39917. const coords = this.coords;
  39918. const coordsPacked = new Float32Array(coords.length * 2);
  39919. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  39920. const xy = coords[i];
  39921. coordsPacked[j++] = xy[0];
  39922. coordsPacked[j++] = xy[1];
  39923. }
  39924. this.coords = coordsPacked;
  39925. const colors = this.colors;
  39926. const colorsPacked = new Uint8Array(colors.length * 3);
  39927. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  39928. const c = colors[i];
  39929. colorsPacked[j++] = c[0];
  39930. colorsPacked[j++] = c[1];
  39931. colorsPacked[j++] = c[2];
  39932. }
  39933. this.colors = colorsPacked;
  39934. const figures = this.figures;
  39935. for (i = 0, ii = figures.length; i < ii; i++) {
  39936. const figure = figures[i],
  39937. ps = figure.coords,
  39938. cs = figure.colors;
  39939. for (j = 0, jj = ps.length; j < jj; j++) {
  39940. ps[j] *= 2;
  39941. cs[j] *= 3;
  39942. }
  39943. }
  39944. }
  39945. getIR() {
  39946. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  39947. }
  39948. }
  39949. class DummyShading extends BaseShading {
  39950. getIR() {
  39951. return ["Dummy"];
  39952. }
  39953. }
  39954. function getTilingPatternIR(operatorList, dict, color) {
  39955. const matrix = dict.getArray("Matrix");
  39956. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  39957. const xstep = dict.get("XStep");
  39958. const ystep = dict.get("YStep");
  39959. const paintType = dict.get("PaintType");
  39960. const tilingType = dict.get("TilingType");
  39961. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  39962. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  39963. }
  39964. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  39965. }
  39966. /***/ }),
  39967. /* 56 */
  39968. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39969. Object.defineProperty(exports, "__esModule", ({
  39970. value: true
  39971. }));
  39972. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  39973. exports.isPDFFunction = isPDFFunction;
  39974. var _primitives = __w_pdfjs_require__(5);
  39975. var _util = __w_pdfjs_require__(2);
  39976. var _ps_parser = __w_pdfjs_require__(57);
  39977. var _image_utils = __w_pdfjs_require__(58);
  39978. class PDFFunctionFactory {
  39979. constructor({
  39980. xref,
  39981. isEvalSupported = true
  39982. }) {
  39983. this.xref = xref;
  39984. this.isEvalSupported = isEvalSupported !== false;
  39985. }
  39986. create(fn) {
  39987. const cachedFunction = this.getCached(fn);
  39988. if (cachedFunction) {
  39989. return cachedFunction;
  39990. }
  39991. const parsedFunction = PDFFunction.parse({
  39992. xref: this.xref,
  39993. isEvalSupported: this.isEvalSupported,
  39994. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  39995. });
  39996. this._cache(fn, parsedFunction);
  39997. return parsedFunction;
  39998. }
  39999. createFromArray(fnObj) {
  40000. const cachedFunction = this.getCached(fnObj);
  40001. if (cachedFunction) {
  40002. return cachedFunction;
  40003. }
  40004. const parsedFunction = PDFFunction.parseArray({
  40005. xref: this.xref,
  40006. isEvalSupported: this.isEvalSupported,
  40007. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  40008. });
  40009. this._cache(fnObj, parsedFunction);
  40010. return parsedFunction;
  40011. }
  40012. getCached(cacheKey) {
  40013. let fnRef;
  40014. if (cacheKey instanceof _primitives.Ref) {
  40015. fnRef = cacheKey;
  40016. } else if (cacheKey instanceof _primitives.Dict) {
  40017. fnRef = cacheKey.objId;
  40018. } else if ((0, _primitives.isStream)(cacheKey)) {
  40019. fnRef = cacheKey.dict && cacheKey.dict.objId;
  40020. }
  40021. if (fnRef) {
  40022. const localFunction = this._localFunctionCache.getByRef(fnRef);
  40023. if (localFunction) {
  40024. return localFunction;
  40025. }
  40026. }
  40027. return null;
  40028. }
  40029. _cache(cacheKey, parsedFunction) {
  40030. if (!parsedFunction) {
  40031. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  40032. }
  40033. let fnRef;
  40034. if (cacheKey instanceof _primitives.Ref) {
  40035. fnRef = cacheKey;
  40036. } else if (cacheKey instanceof _primitives.Dict) {
  40037. fnRef = cacheKey.objId;
  40038. } else if ((0, _primitives.isStream)(cacheKey)) {
  40039. fnRef = cacheKey.dict && cacheKey.dict.objId;
  40040. }
  40041. if (fnRef) {
  40042. this._localFunctionCache.set(null, fnRef, parsedFunction);
  40043. }
  40044. }
  40045. get _localFunctionCache() {
  40046. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  40047. }
  40048. }
  40049. exports.PDFFunctionFactory = PDFFunctionFactory;
  40050. function toNumberArray(arr) {
  40051. if (!Array.isArray(arr)) {
  40052. return null;
  40053. }
  40054. const length = arr.length;
  40055. for (let i = 0; i < length; i++) {
  40056. if (typeof arr[i] !== "number") {
  40057. const result = new Array(length);
  40058. for (let j = 0; j < length; j++) {
  40059. result[j] = +arr[j];
  40060. }
  40061. return result;
  40062. }
  40063. }
  40064. return arr;
  40065. }
  40066. class PDFFunction {
  40067. static getSampleArray(size, outputSize, bps, stream) {
  40068. let i, ii;
  40069. let length = 1;
  40070. for (i = 0, ii = size.length; i < ii; i++) {
  40071. length *= size[i];
  40072. }
  40073. length *= outputSize;
  40074. const array = new Array(length);
  40075. let codeSize = 0;
  40076. let codeBuf = 0;
  40077. const sampleMul = 1.0 / (2.0 ** bps - 1);
  40078. const strBytes = stream.getBytes((length * bps + 7) / 8);
  40079. let strIdx = 0;
  40080. for (i = 0; i < length; i++) {
  40081. while (codeSize < bps) {
  40082. codeBuf <<= 8;
  40083. codeBuf |= strBytes[strIdx++];
  40084. codeSize += 8;
  40085. }
  40086. codeSize -= bps;
  40087. array[i] = (codeBuf >> codeSize) * sampleMul;
  40088. codeBuf &= (1 << codeSize) - 1;
  40089. }
  40090. return array;
  40091. }
  40092. static parse({
  40093. xref,
  40094. isEvalSupported,
  40095. fn
  40096. }) {
  40097. const dict = fn.dict || fn;
  40098. const typeNum = dict.get("FunctionType");
  40099. switch (typeNum) {
  40100. case 0:
  40101. return this.constructSampled({
  40102. xref,
  40103. isEvalSupported,
  40104. fn,
  40105. dict
  40106. });
  40107. case 1:
  40108. break;
  40109. case 2:
  40110. return this.constructInterpolated({
  40111. xref,
  40112. isEvalSupported,
  40113. dict
  40114. });
  40115. case 3:
  40116. return this.constructStiched({
  40117. xref,
  40118. isEvalSupported,
  40119. dict
  40120. });
  40121. case 4:
  40122. return this.constructPostScript({
  40123. xref,
  40124. isEvalSupported,
  40125. fn,
  40126. dict
  40127. });
  40128. }
  40129. throw new _util.FormatError("Unknown type of function");
  40130. }
  40131. static parseArray({
  40132. xref,
  40133. isEvalSupported,
  40134. fnObj
  40135. }) {
  40136. if (!Array.isArray(fnObj)) {
  40137. return this.parse({
  40138. xref,
  40139. isEvalSupported,
  40140. fn: fnObj
  40141. });
  40142. }
  40143. const fnArray = [];
  40144. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  40145. fnArray.push(this.parse({
  40146. xref,
  40147. isEvalSupported,
  40148. fn: xref.fetchIfRef(fnObj[j])
  40149. }));
  40150. }
  40151. return function (src, srcOffset, dest, destOffset) {
  40152. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  40153. fnArray[i](src, srcOffset, dest, destOffset + i);
  40154. }
  40155. };
  40156. }
  40157. static constructSampled({
  40158. xref,
  40159. isEvalSupported,
  40160. fn,
  40161. dict
  40162. }) {
  40163. function toMultiArray(arr) {
  40164. const inputLength = arr.length;
  40165. const out = [];
  40166. let index = 0;
  40167. for (let i = 0; i < inputLength; i += 2) {
  40168. out[index++] = [arr[i], arr[i + 1]];
  40169. }
  40170. return out;
  40171. }
  40172. function interpolate(x, xmin, xmax, ymin, ymax) {
  40173. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  40174. }
  40175. let domain = toNumberArray(dict.getArray("Domain"));
  40176. let range = toNumberArray(dict.getArray("Range"));
  40177. if (!domain || !range) {
  40178. throw new _util.FormatError("No domain or range");
  40179. }
  40180. const inputSize = domain.length / 2;
  40181. const outputSize = range.length / 2;
  40182. domain = toMultiArray(domain);
  40183. range = toMultiArray(range);
  40184. const size = toNumberArray(dict.getArray("Size"));
  40185. const bps = dict.get("BitsPerSample");
  40186. const order = dict.get("Order") || 1;
  40187. if (order !== 1) {
  40188. (0, _util.info)("No support for cubic spline interpolation: " + order);
  40189. }
  40190. let encode = toNumberArray(dict.getArray("Encode"));
  40191. if (!encode) {
  40192. encode = [];
  40193. for (let i = 0; i < inputSize; ++i) {
  40194. encode.push([0, size[i] - 1]);
  40195. }
  40196. } else {
  40197. encode = toMultiArray(encode);
  40198. }
  40199. let decode = toNumberArray(dict.getArray("Decode"));
  40200. if (!decode) {
  40201. decode = range;
  40202. } else {
  40203. decode = toMultiArray(decode);
  40204. }
  40205. const samples = this.getSampleArray(size, outputSize, bps, fn);
  40206. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  40207. const cubeVertices = 1 << inputSize;
  40208. const cubeN = new Float64Array(cubeVertices);
  40209. const cubeVertex = new Uint32Array(cubeVertices);
  40210. let i, j;
  40211. for (j = 0; j < cubeVertices; j++) {
  40212. cubeN[j] = 1;
  40213. }
  40214. let k = outputSize,
  40215. pos = 1;
  40216. for (i = 0; i < inputSize; ++i) {
  40217. const domain_2i = domain[i][0];
  40218. const domain_2i_1 = domain[i][1];
  40219. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  40220. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  40221. const size_i = size[i];
  40222. e = Math.min(Math.max(e, 0), size_i - 1);
  40223. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  40224. const n0 = e0 + 1 - e;
  40225. const n1 = e - e0;
  40226. const offset0 = e0 * k;
  40227. const offset1 = offset0 + k;
  40228. for (j = 0; j < cubeVertices; j++) {
  40229. if (j & pos) {
  40230. cubeN[j] *= n1;
  40231. cubeVertex[j] += offset1;
  40232. } else {
  40233. cubeN[j] *= n0;
  40234. cubeVertex[j] += offset0;
  40235. }
  40236. }
  40237. k *= size_i;
  40238. pos <<= 1;
  40239. }
  40240. for (j = 0; j < outputSize; ++j) {
  40241. let rj = 0;
  40242. for (i = 0; i < cubeVertices; i++) {
  40243. rj += samples[cubeVertex[i] + j] * cubeN[i];
  40244. }
  40245. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  40246. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  40247. }
  40248. };
  40249. }
  40250. static constructInterpolated({
  40251. xref,
  40252. isEvalSupported,
  40253. dict
  40254. }) {
  40255. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  40256. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  40257. const n = dict.get("N");
  40258. const diff = [];
  40259. for (let i = 0, ii = c0.length; i < ii; ++i) {
  40260. diff.push(c1[i] - c0[i]);
  40261. }
  40262. const length = diff.length;
  40263. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  40264. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  40265. for (let j = 0; j < length; ++j) {
  40266. dest[destOffset + j] = c0[j] + x * diff[j];
  40267. }
  40268. };
  40269. }
  40270. static constructStiched({
  40271. xref,
  40272. isEvalSupported,
  40273. dict
  40274. }) {
  40275. const domain = toNumberArray(dict.getArray("Domain"));
  40276. if (!domain) {
  40277. throw new _util.FormatError("No domain");
  40278. }
  40279. const inputSize = domain.length / 2;
  40280. if (inputSize !== 1) {
  40281. throw new _util.FormatError("Bad domain for stiched function");
  40282. }
  40283. const fnRefs = dict.get("Functions");
  40284. const fns = [];
  40285. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  40286. fns.push(this.parse({
  40287. xref,
  40288. isEvalSupported,
  40289. fn: xref.fetchIfRef(fnRefs[i])
  40290. }));
  40291. }
  40292. const bounds = toNumberArray(dict.getArray("Bounds"));
  40293. const encode = toNumberArray(dict.getArray("Encode"));
  40294. const tmpBuf = new Float32Array(1);
  40295. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  40296. const clip = function constructStichedFromIRClip(v, min, max) {
  40297. if (v > max) {
  40298. v = max;
  40299. } else if (v < min) {
  40300. v = min;
  40301. }
  40302. return v;
  40303. };
  40304. const v = clip(src[srcOffset], domain[0], domain[1]);
  40305. const length = bounds.length;
  40306. let i;
  40307. for (i = 0; i < length; ++i) {
  40308. if (v < bounds[i]) {
  40309. break;
  40310. }
  40311. }
  40312. let dmin = domain[0];
  40313. if (i > 0) {
  40314. dmin = bounds[i - 1];
  40315. }
  40316. let dmax = domain[1];
  40317. if (i < bounds.length) {
  40318. dmax = bounds[i];
  40319. }
  40320. const rmin = encode[2 * i];
  40321. const rmax = encode[2 * i + 1];
  40322. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  40323. fns[i](tmpBuf, 0, dest, destOffset);
  40324. };
  40325. }
  40326. static constructPostScript({
  40327. xref,
  40328. isEvalSupported,
  40329. fn,
  40330. dict
  40331. }) {
  40332. const domain = toNumberArray(dict.getArray("Domain"));
  40333. const range = toNumberArray(dict.getArray("Range"));
  40334. if (!domain) {
  40335. throw new _util.FormatError("No domain.");
  40336. }
  40337. if (!range) {
  40338. throw new _util.FormatError("No range.");
  40339. }
  40340. const lexer = new _ps_parser.PostScriptLexer(fn);
  40341. const parser = new _ps_parser.PostScriptParser(lexer);
  40342. const code = parser.parse();
  40343. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  40344. const compiled = new PostScriptCompiler().compile(code, domain, range);
  40345. if (compiled) {
  40346. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  40347. }
  40348. }
  40349. (0, _util.info)("Unable to compile PS function");
  40350. const numOutputs = range.length >> 1;
  40351. const numInputs = domain.length >> 1;
  40352. const evaluator = new PostScriptEvaluator(code);
  40353. const cache = Object.create(null);
  40354. const MAX_CACHE_SIZE = 2048 * 4;
  40355. let cache_available = MAX_CACHE_SIZE;
  40356. const tmpBuf = new Float32Array(numInputs);
  40357. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  40358. let i, value;
  40359. let key = "";
  40360. const input = tmpBuf;
  40361. for (i = 0; i < numInputs; i++) {
  40362. value = src[srcOffset + i];
  40363. input[i] = value;
  40364. key += value + "_";
  40365. }
  40366. const cachedValue = cache[key];
  40367. if (cachedValue !== undefined) {
  40368. dest.set(cachedValue, destOffset);
  40369. return;
  40370. }
  40371. const output = new Float32Array(numOutputs);
  40372. const stack = evaluator.execute(input);
  40373. const stackIndex = stack.length - numOutputs;
  40374. for (i = 0; i < numOutputs; i++) {
  40375. value = stack[stackIndex + i];
  40376. let bound = range[i * 2];
  40377. if (value < bound) {
  40378. value = bound;
  40379. } else {
  40380. bound = range[i * 2 + 1];
  40381. if (value > bound) {
  40382. value = bound;
  40383. }
  40384. }
  40385. output[i] = value;
  40386. }
  40387. if (cache_available > 0) {
  40388. cache_available--;
  40389. cache[key] = output;
  40390. }
  40391. dest.set(output, destOffset);
  40392. };
  40393. }
  40394. }
  40395. function isPDFFunction(v) {
  40396. let fnDict;
  40397. if (typeof v !== "object") {
  40398. return false;
  40399. } else if ((0, _primitives.isDict)(v)) {
  40400. fnDict = v;
  40401. } else if ((0, _primitives.isStream)(v)) {
  40402. fnDict = v.dict;
  40403. } else {
  40404. return false;
  40405. }
  40406. return fnDict.has("FunctionType");
  40407. }
  40408. class PostScriptStack {
  40409. static get MAX_STACK_SIZE() {
  40410. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  40411. }
  40412. constructor(initialStack) {
  40413. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  40414. }
  40415. push(value) {
  40416. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  40417. throw new Error("PostScript function stack overflow.");
  40418. }
  40419. this.stack.push(value);
  40420. }
  40421. pop() {
  40422. if (this.stack.length <= 0) {
  40423. throw new Error("PostScript function stack underflow.");
  40424. }
  40425. return this.stack.pop();
  40426. }
  40427. copy(n) {
  40428. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  40429. throw new Error("PostScript function stack overflow.");
  40430. }
  40431. const stack = this.stack;
  40432. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  40433. stack.push(stack[i]);
  40434. }
  40435. }
  40436. index(n) {
  40437. this.push(this.stack[this.stack.length - n - 1]);
  40438. }
  40439. roll(n, p) {
  40440. const stack = this.stack;
  40441. const l = stack.length - n;
  40442. const r = stack.length - 1;
  40443. const c = l + (p - Math.floor(p / n) * n);
  40444. for (let i = l, j = r; i < j; i++, j--) {
  40445. const t = stack[i];
  40446. stack[i] = stack[j];
  40447. stack[j] = t;
  40448. }
  40449. for (let i = l, j = c - 1; i < j; i++, j--) {
  40450. const t = stack[i];
  40451. stack[i] = stack[j];
  40452. stack[j] = t;
  40453. }
  40454. for (let i = c, j = r; i < j; i++, j--) {
  40455. const t = stack[i];
  40456. stack[i] = stack[j];
  40457. stack[j] = t;
  40458. }
  40459. }
  40460. }
  40461. class PostScriptEvaluator {
  40462. constructor(operators) {
  40463. this.operators = operators;
  40464. }
  40465. execute(initialStack) {
  40466. const stack = new PostScriptStack(initialStack);
  40467. let counter = 0;
  40468. const operators = this.operators;
  40469. const length = operators.length;
  40470. let operator, a, b;
  40471. while (counter < length) {
  40472. operator = operators[counter++];
  40473. if (typeof operator === "number") {
  40474. stack.push(operator);
  40475. continue;
  40476. }
  40477. switch (operator) {
  40478. case "jz":
  40479. b = stack.pop();
  40480. a = stack.pop();
  40481. if (!a) {
  40482. counter = b;
  40483. }
  40484. break;
  40485. case "j":
  40486. a = stack.pop();
  40487. counter = a;
  40488. break;
  40489. case "abs":
  40490. a = stack.pop();
  40491. stack.push(Math.abs(a));
  40492. break;
  40493. case "add":
  40494. b = stack.pop();
  40495. a = stack.pop();
  40496. stack.push(a + b);
  40497. break;
  40498. case "and":
  40499. b = stack.pop();
  40500. a = stack.pop();
  40501. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40502. stack.push(a && b);
  40503. } else {
  40504. stack.push(a & b);
  40505. }
  40506. break;
  40507. case "atan":
  40508. a = stack.pop();
  40509. stack.push(Math.atan(a));
  40510. break;
  40511. case "bitshift":
  40512. b = stack.pop();
  40513. a = stack.pop();
  40514. if (a > 0) {
  40515. stack.push(a << b);
  40516. } else {
  40517. stack.push(a >> b);
  40518. }
  40519. break;
  40520. case "ceiling":
  40521. a = stack.pop();
  40522. stack.push(Math.ceil(a));
  40523. break;
  40524. case "copy":
  40525. a = stack.pop();
  40526. stack.copy(a);
  40527. break;
  40528. case "cos":
  40529. a = stack.pop();
  40530. stack.push(Math.cos(a));
  40531. break;
  40532. case "cvi":
  40533. a = stack.pop() | 0;
  40534. stack.push(a);
  40535. break;
  40536. case "cvr":
  40537. break;
  40538. case "div":
  40539. b = stack.pop();
  40540. a = stack.pop();
  40541. stack.push(a / b);
  40542. break;
  40543. case "dup":
  40544. stack.copy(1);
  40545. break;
  40546. case "eq":
  40547. b = stack.pop();
  40548. a = stack.pop();
  40549. stack.push(a === b);
  40550. break;
  40551. case "exch":
  40552. stack.roll(2, 1);
  40553. break;
  40554. case "exp":
  40555. b = stack.pop();
  40556. a = stack.pop();
  40557. stack.push(a ** b);
  40558. break;
  40559. case "false":
  40560. stack.push(false);
  40561. break;
  40562. case "floor":
  40563. a = stack.pop();
  40564. stack.push(Math.floor(a));
  40565. break;
  40566. case "ge":
  40567. b = stack.pop();
  40568. a = stack.pop();
  40569. stack.push(a >= b);
  40570. break;
  40571. case "gt":
  40572. b = stack.pop();
  40573. a = stack.pop();
  40574. stack.push(a > b);
  40575. break;
  40576. case "idiv":
  40577. b = stack.pop();
  40578. a = stack.pop();
  40579. stack.push(a / b | 0);
  40580. break;
  40581. case "index":
  40582. a = stack.pop();
  40583. stack.index(a);
  40584. break;
  40585. case "le":
  40586. b = stack.pop();
  40587. a = stack.pop();
  40588. stack.push(a <= b);
  40589. break;
  40590. case "ln":
  40591. a = stack.pop();
  40592. stack.push(Math.log(a));
  40593. break;
  40594. case "log":
  40595. a = stack.pop();
  40596. stack.push(Math.log(a) / Math.LN10);
  40597. break;
  40598. case "lt":
  40599. b = stack.pop();
  40600. a = stack.pop();
  40601. stack.push(a < b);
  40602. break;
  40603. case "mod":
  40604. b = stack.pop();
  40605. a = stack.pop();
  40606. stack.push(a % b);
  40607. break;
  40608. case "mul":
  40609. b = stack.pop();
  40610. a = stack.pop();
  40611. stack.push(a * b);
  40612. break;
  40613. case "ne":
  40614. b = stack.pop();
  40615. a = stack.pop();
  40616. stack.push(a !== b);
  40617. break;
  40618. case "neg":
  40619. a = stack.pop();
  40620. stack.push(-a);
  40621. break;
  40622. case "not":
  40623. a = stack.pop();
  40624. if ((0, _util.isBool)(a)) {
  40625. stack.push(!a);
  40626. } else {
  40627. stack.push(~a);
  40628. }
  40629. break;
  40630. case "or":
  40631. b = stack.pop();
  40632. a = stack.pop();
  40633. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40634. stack.push(a || b);
  40635. } else {
  40636. stack.push(a | b);
  40637. }
  40638. break;
  40639. case "pop":
  40640. stack.pop();
  40641. break;
  40642. case "roll":
  40643. b = stack.pop();
  40644. a = stack.pop();
  40645. stack.roll(a, b);
  40646. break;
  40647. case "round":
  40648. a = stack.pop();
  40649. stack.push(Math.round(a));
  40650. break;
  40651. case "sin":
  40652. a = stack.pop();
  40653. stack.push(Math.sin(a));
  40654. break;
  40655. case "sqrt":
  40656. a = stack.pop();
  40657. stack.push(Math.sqrt(a));
  40658. break;
  40659. case "sub":
  40660. b = stack.pop();
  40661. a = stack.pop();
  40662. stack.push(a - b);
  40663. break;
  40664. case "true":
  40665. stack.push(true);
  40666. break;
  40667. case "truncate":
  40668. a = stack.pop();
  40669. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  40670. stack.push(a);
  40671. break;
  40672. case "xor":
  40673. b = stack.pop();
  40674. a = stack.pop();
  40675. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40676. stack.push(a !== b);
  40677. } else {
  40678. stack.push(a ^ b);
  40679. }
  40680. break;
  40681. default:
  40682. throw new _util.FormatError(`Unknown operator ${operator}`);
  40683. }
  40684. }
  40685. return stack.stack;
  40686. }
  40687. }
  40688. exports.PostScriptEvaluator = PostScriptEvaluator;
  40689. const PostScriptCompiler = function PostScriptCompilerClosure() {
  40690. class AstNode {
  40691. constructor(type) {
  40692. this.type = type;
  40693. }
  40694. visit(visitor) {
  40695. (0, _util.unreachable)("abstract method");
  40696. }
  40697. }
  40698. class AstArgument extends AstNode {
  40699. constructor(index, min, max) {
  40700. super("args");
  40701. this.index = index;
  40702. this.min = min;
  40703. this.max = max;
  40704. }
  40705. visit(visitor) {
  40706. visitor.visitArgument(this);
  40707. }
  40708. }
  40709. class AstLiteral extends AstNode {
  40710. constructor(number) {
  40711. super("literal");
  40712. this.number = number;
  40713. this.min = number;
  40714. this.max = number;
  40715. }
  40716. visit(visitor) {
  40717. visitor.visitLiteral(this);
  40718. }
  40719. }
  40720. class AstBinaryOperation extends AstNode {
  40721. constructor(op, arg1, arg2, min, max) {
  40722. super("binary");
  40723. this.op = op;
  40724. this.arg1 = arg1;
  40725. this.arg2 = arg2;
  40726. this.min = min;
  40727. this.max = max;
  40728. }
  40729. visit(visitor) {
  40730. visitor.visitBinaryOperation(this);
  40731. }
  40732. }
  40733. class AstMin extends AstNode {
  40734. constructor(arg, max) {
  40735. super("max");
  40736. this.arg = arg;
  40737. this.min = arg.min;
  40738. this.max = max;
  40739. }
  40740. visit(visitor) {
  40741. visitor.visitMin(this);
  40742. }
  40743. }
  40744. class AstVariable extends AstNode {
  40745. constructor(index, min, max) {
  40746. super("var");
  40747. this.index = index;
  40748. this.min = min;
  40749. this.max = max;
  40750. }
  40751. visit(visitor) {
  40752. visitor.visitVariable(this);
  40753. }
  40754. }
  40755. class AstVariableDefinition extends AstNode {
  40756. constructor(variable, arg) {
  40757. super("definition");
  40758. this.variable = variable;
  40759. this.arg = arg;
  40760. }
  40761. visit(visitor) {
  40762. visitor.visitVariableDefinition(this);
  40763. }
  40764. }
  40765. class ExpressionBuilderVisitor {
  40766. constructor() {
  40767. this.parts = [];
  40768. }
  40769. visitArgument(arg) {
  40770. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  40771. }
  40772. visitVariable(variable) {
  40773. this.parts.push("v", variable.index);
  40774. }
  40775. visitLiteral(literal) {
  40776. this.parts.push(literal.number);
  40777. }
  40778. visitBinaryOperation(operation) {
  40779. this.parts.push("(");
  40780. operation.arg1.visit(this);
  40781. this.parts.push(" ", operation.op, " ");
  40782. operation.arg2.visit(this);
  40783. this.parts.push(")");
  40784. }
  40785. visitVariableDefinition(definition) {
  40786. this.parts.push("var ");
  40787. definition.variable.visit(this);
  40788. this.parts.push(" = ");
  40789. definition.arg.visit(this);
  40790. this.parts.push(";");
  40791. }
  40792. visitMin(max) {
  40793. this.parts.push("Math.min(");
  40794. max.arg.visit(this);
  40795. this.parts.push(", ", max.max, ")");
  40796. }
  40797. toString() {
  40798. return this.parts.join("");
  40799. }
  40800. }
  40801. function buildAddOperation(num1, num2) {
  40802. if (num2.type === "literal" && num2.number === 0) {
  40803. return num1;
  40804. }
  40805. if (num1.type === "literal" && num1.number === 0) {
  40806. return num2;
  40807. }
  40808. if (num2.type === "literal" && num1.type === "literal") {
  40809. return new AstLiteral(num1.number + num2.number);
  40810. }
  40811. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  40812. }
  40813. function buildMulOperation(num1, num2) {
  40814. if (num2.type === "literal") {
  40815. if (num2.number === 0) {
  40816. return new AstLiteral(0);
  40817. } else if (num2.number === 1) {
  40818. return num1;
  40819. } else if (num1.type === "literal") {
  40820. return new AstLiteral(num1.number * num2.number);
  40821. }
  40822. }
  40823. if (num1.type === "literal") {
  40824. if (num1.number === 0) {
  40825. return new AstLiteral(0);
  40826. } else if (num1.number === 1) {
  40827. return num2;
  40828. }
  40829. }
  40830. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  40831. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  40832. return new AstBinaryOperation("*", num1, num2, min, max);
  40833. }
  40834. function buildSubOperation(num1, num2) {
  40835. if (num2.type === "literal") {
  40836. if (num2.number === 0) {
  40837. return num1;
  40838. } else if (num1.type === "literal") {
  40839. return new AstLiteral(num1.number - num2.number);
  40840. }
  40841. }
  40842. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  40843. return num2.arg2;
  40844. }
  40845. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  40846. }
  40847. function buildMinOperation(num1, max) {
  40848. if (num1.min >= max) {
  40849. return new AstLiteral(max);
  40850. } else if (num1.max <= max) {
  40851. return num1;
  40852. }
  40853. return new AstMin(num1, max);
  40854. }
  40855. class PostScriptCompiler {
  40856. compile(code, domain, range) {
  40857. const stack = [];
  40858. const instructions = [];
  40859. const inputSize = domain.length >> 1,
  40860. outputSize = range.length >> 1;
  40861. let lastRegister = 0;
  40862. let n, j;
  40863. let num1, num2, ast1, ast2, tmpVar, item;
  40864. for (let i = 0; i < inputSize; i++) {
  40865. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  40866. }
  40867. for (let i = 0, ii = code.length; i < ii; i++) {
  40868. item = code[i];
  40869. if (typeof item === "number") {
  40870. stack.push(new AstLiteral(item));
  40871. continue;
  40872. }
  40873. switch (item) {
  40874. case "add":
  40875. if (stack.length < 2) {
  40876. return null;
  40877. }
  40878. num2 = stack.pop();
  40879. num1 = stack.pop();
  40880. stack.push(buildAddOperation(num1, num2));
  40881. break;
  40882. case "cvr":
  40883. if (stack.length < 1) {
  40884. return null;
  40885. }
  40886. break;
  40887. case "mul":
  40888. if (stack.length < 2) {
  40889. return null;
  40890. }
  40891. num2 = stack.pop();
  40892. num1 = stack.pop();
  40893. stack.push(buildMulOperation(num1, num2));
  40894. break;
  40895. case "sub":
  40896. if (stack.length < 2) {
  40897. return null;
  40898. }
  40899. num2 = stack.pop();
  40900. num1 = stack.pop();
  40901. stack.push(buildSubOperation(num1, num2));
  40902. break;
  40903. case "exch":
  40904. if (stack.length < 2) {
  40905. return null;
  40906. }
  40907. ast1 = stack.pop();
  40908. ast2 = stack.pop();
  40909. stack.push(ast1, ast2);
  40910. break;
  40911. case "pop":
  40912. if (stack.length < 1) {
  40913. return null;
  40914. }
  40915. stack.pop();
  40916. break;
  40917. case "index":
  40918. if (stack.length < 1) {
  40919. return null;
  40920. }
  40921. num1 = stack.pop();
  40922. if (num1.type !== "literal") {
  40923. return null;
  40924. }
  40925. n = num1.number;
  40926. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  40927. return null;
  40928. }
  40929. ast1 = stack[stack.length - n - 1];
  40930. if (ast1.type === "literal" || ast1.type === "var") {
  40931. stack.push(ast1);
  40932. break;
  40933. }
  40934. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40935. stack[stack.length - n - 1] = tmpVar;
  40936. stack.push(tmpVar);
  40937. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40938. break;
  40939. case "dup":
  40940. if (stack.length < 1) {
  40941. return null;
  40942. }
  40943. 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]) {
  40944. num1 = stack.pop();
  40945. stack.push(buildMinOperation(num1, code[i + 1]));
  40946. i += 6;
  40947. break;
  40948. }
  40949. ast1 = stack[stack.length - 1];
  40950. if (ast1.type === "literal" || ast1.type === "var") {
  40951. stack.push(ast1);
  40952. break;
  40953. }
  40954. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40955. stack[stack.length - 1] = tmpVar;
  40956. stack.push(tmpVar);
  40957. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40958. break;
  40959. case "roll":
  40960. if (stack.length < 2) {
  40961. return null;
  40962. }
  40963. num2 = stack.pop();
  40964. num1 = stack.pop();
  40965. if (num2.type !== "literal" || num1.type !== "literal") {
  40966. return null;
  40967. }
  40968. j = num2.number;
  40969. n = num1.number;
  40970. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  40971. return null;
  40972. }
  40973. j = (j % n + n) % n;
  40974. if (j === 0) {
  40975. break;
  40976. }
  40977. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  40978. break;
  40979. default:
  40980. return null;
  40981. }
  40982. }
  40983. if (stack.length !== outputSize) {
  40984. return null;
  40985. }
  40986. const result = [];
  40987. for (const instruction of instructions) {
  40988. const statementBuilder = new ExpressionBuilderVisitor();
  40989. instruction.visit(statementBuilder);
  40990. result.push(statementBuilder.toString());
  40991. }
  40992. for (let i = 0, ii = stack.length; i < ii; i++) {
  40993. const expr = stack[i],
  40994. statementBuilder = new ExpressionBuilderVisitor();
  40995. expr.visit(statementBuilder);
  40996. const min = range[i * 2],
  40997. max = range[i * 2 + 1];
  40998. const out = [statementBuilder.toString()];
  40999. if (min > expr.min) {
  41000. out.unshift("Math.max(", min, ", ");
  41001. out.push(")");
  41002. }
  41003. if (max < expr.max) {
  41004. out.unshift("Math.min(", max, ", ");
  41005. out.push(")");
  41006. }
  41007. out.unshift("dest[destOffset + ", i, "] = ");
  41008. out.push(";");
  41009. result.push(out.join(""));
  41010. }
  41011. return result.join("\n");
  41012. }
  41013. }
  41014. return PostScriptCompiler;
  41015. }();
  41016. exports.PostScriptCompiler = PostScriptCompiler;
  41017. /***/ }),
  41018. /* 57 */
  41019. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41020. Object.defineProperty(exports, "__esModule", ({
  41021. value: true
  41022. }));
  41023. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  41024. var _util = __w_pdfjs_require__(2);
  41025. var _primitives = __w_pdfjs_require__(5);
  41026. var _core_utils = __w_pdfjs_require__(9);
  41027. class PostScriptParser {
  41028. constructor(lexer) {
  41029. this.lexer = lexer;
  41030. this.operators = [];
  41031. this.token = null;
  41032. this.prev = null;
  41033. }
  41034. nextToken() {
  41035. this.prev = this.token;
  41036. this.token = this.lexer.getToken();
  41037. }
  41038. accept(type) {
  41039. if (this.token.type === type) {
  41040. this.nextToken();
  41041. return true;
  41042. }
  41043. return false;
  41044. }
  41045. expect(type) {
  41046. if (this.accept(type)) {
  41047. return true;
  41048. }
  41049. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  41050. }
  41051. parse() {
  41052. this.nextToken();
  41053. this.expect(PostScriptTokenTypes.LBRACE);
  41054. this.parseBlock();
  41055. this.expect(PostScriptTokenTypes.RBRACE);
  41056. return this.operators;
  41057. }
  41058. parseBlock() {
  41059. while (true) {
  41060. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  41061. this.operators.push(this.prev.value);
  41062. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  41063. this.operators.push(this.prev.value);
  41064. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  41065. this.parseCondition();
  41066. } else {
  41067. return;
  41068. }
  41069. }
  41070. }
  41071. parseCondition() {
  41072. const conditionLocation = this.operators.length;
  41073. this.operators.push(null, null);
  41074. this.parseBlock();
  41075. this.expect(PostScriptTokenTypes.RBRACE);
  41076. if (this.accept(PostScriptTokenTypes.IF)) {
  41077. this.operators[conditionLocation] = this.operators.length;
  41078. this.operators[conditionLocation + 1] = "jz";
  41079. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  41080. const jumpLocation = this.operators.length;
  41081. this.operators.push(null, null);
  41082. const endOfTrue = this.operators.length;
  41083. this.parseBlock();
  41084. this.expect(PostScriptTokenTypes.RBRACE);
  41085. this.expect(PostScriptTokenTypes.IFELSE);
  41086. this.operators[jumpLocation] = this.operators.length;
  41087. this.operators[jumpLocation + 1] = "j";
  41088. this.operators[conditionLocation] = endOfTrue;
  41089. this.operators[conditionLocation + 1] = "jz";
  41090. } else {
  41091. throw new _util.FormatError("PS Function: error parsing conditional.");
  41092. }
  41093. }
  41094. }
  41095. exports.PostScriptParser = PostScriptParser;
  41096. const PostScriptTokenTypes = {
  41097. LBRACE: 0,
  41098. RBRACE: 1,
  41099. NUMBER: 2,
  41100. OPERATOR: 3,
  41101. IF: 4,
  41102. IFELSE: 5
  41103. };
  41104. class PostScriptToken {
  41105. static get opCache() {
  41106. return (0, _util.shadow)(this, "opCache", Object.create(null));
  41107. }
  41108. constructor(type, value) {
  41109. this.type = type;
  41110. this.value = value;
  41111. }
  41112. static getOperator(op) {
  41113. const opValue = PostScriptToken.opCache[op];
  41114. if (opValue) {
  41115. return opValue;
  41116. }
  41117. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  41118. }
  41119. static get LBRACE() {
  41120. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  41121. }
  41122. static get RBRACE() {
  41123. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  41124. }
  41125. static get IF() {
  41126. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  41127. }
  41128. static get IFELSE() {
  41129. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  41130. }
  41131. }
  41132. class PostScriptLexer {
  41133. constructor(stream) {
  41134. this.stream = stream;
  41135. this.nextChar();
  41136. this.strBuf = [];
  41137. }
  41138. nextChar() {
  41139. return this.currentChar = this.stream.getByte();
  41140. }
  41141. getToken() {
  41142. let comment = false;
  41143. let ch = this.currentChar;
  41144. while (true) {
  41145. if (ch < 0) {
  41146. return _primitives.EOF;
  41147. }
  41148. if (comment) {
  41149. if (ch === 0x0a || ch === 0x0d) {
  41150. comment = false;
  41151. }
  41152. } else if (ch === 0x25) {
  41153. comment = true;
  41154. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  41155. break;
  41156. }
  41157. ch = this.nextChar();
  41158. }
  41159. switch (ch | 0) {
  41160. case 0x30:
  41161. case 0x31:
  41162. case 0x32:
  41163. case 0x33:
  41164. case 0x34:
  41165. case 0x35:
  41166. case 0x36:
  41167. case 0x37:
  41168. case 0x38:
  41169. case 0x39:
  41170. case 0x2b:
  41171. case 0x2d:
  41172. case 0x2e:
  41173. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  41174. case 0x7b:
  41175. this.nextChar();
  41176. return PostScriptToken.LBRACE;
  41177. case 0x7d:
  41178. this.nextChar();
  41179. return PostScriptToken.RBRACE;
  41180. }
  41181. const strBuf = this.strBuf;
  41182. strBuf.length = 0;
  41183. strBuf[0] = String.fromCharCode(ch);
  41184. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  41185. strBuf.push(String.fromCharCode(ch));
  41186. }
  41187. const str = strBuf.join("");
  41188. switch (str.toLowerCase()) {
  41189. case "if":
  41190. return PostScriptToken.IF;
  41191. case "ifelse":
  41192. return PostScriptToken.IFELSE;
  41193. default:
  41194. return PostScriptToken.getOperator(str);
  41195. }
  41196. }
  41197. getNumber() {
  41198. let ch = this.currentChar;
  41199. const strBuf = this.strBuf;
  41200. strBuf.length = 0;
  41201. strBuf[0] = String.fromCharCode(ch);
  41202. while ((ch = this.nextChar()) >= 0) {
  41203. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  41204. strBuf.push(String.fromCharCode(ch));
  41205. } else {
  41206. break;
  41207. }
  41208. }
  41209. const value = parseFloat(strBuf.join(""));
  41210. if (isNaN(value)) {
  41211. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  41212. }
  41213. return value;
  41214. }
  41215. }
  41216. exports.PostScriptLexer = PostScriptLexer;
  41217. /***/ }),
  41218. /* 58 */
  41219. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41220. Object.defineProperty(exports, "__esModule", ({
  41221. value: true
  41222. }));
  41223. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  41224. var _util = __w_pdfjs_require__(2);
  41225. var _primitives = __w_pdfjs_require__(5);
  41226. class BaseLocalCache {
  41227. constructor(options) {
  41228. if (this.constructor === BaseLocalCache) {
  41229. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  41230. }
  41231. this._onlyRefs = (options && options.onlyRefs) === true;
  41232. if (!this._onlyRefs) {
  41233. this._nameRefMap = new Map();
  41234. this._imageMap = new Map();
  41235. }
  41236. this._imageCache = new _primitives.RefSetCache();
  41237. }
  41238. getByName(name) {
  41239. if (this._onlyRefs) {
  41240. (0, _util.unreachable)("Should not call `getByName` method.");
  41241. }
  41242. const ref = this._nameRefMap.get(name);
  41243. if (ref) {
  41244. return this.getByRef(ref);
  41245. }
  41246. return this._imageMap.get(name) || null;
  41247. }
  41248. getByRef(ref) {
  41249. return this._imageCache.get(ref) || null;
  41250. }
  41251. set(name, ref, data) {
  41252. (0, _util.unreachable)("Abstract method `set` called.");
  41253. }
  41254. }
  41255. class LocalImageCache extends BaseLocalCache {
  41256. set(name, ref = null, data) {
  41257. if (typeof name !== "string") {
  41258. throw new Error('LocalImageCache.set - expected "name" argument.');
  41259. }
  41260. if (ref) {
  41261. if (this._imageCache.has(ref)) {
  41262. return;
  41263. }
  41264. this._nameRefMap.set(name, ref);
  41265. this._imageCache.put(ref, data);
  41266. return;
  41267. }
  41268. if (this._imageMap.has(name)) {
  41269. return;
  41270. }
  41271. this._imageMap.set(name, data);
  41272. }
  41273. }
  41274. exports.LocalImageCache = LocalImageCache;
  41275. class LocalColorSpaceCache extends BaseLocalCache {
  41276. set(name = null, ref = null, data) {
  41277. if (typeof name !== "string" && !ref) {
  41278. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  41279. }
  41280. if (ref) {
  41281. if (this._imageCache.has(ref)) {
  41282. return;
  41283. }
  41284. if (name !== null) {
  41285. this._nameRefMap.set(name, ref);
  41286. }
  41287. this._imageCache.put(ref, data);
  41288. return;
  41289. }
  41290. if (this._imageMap.has(name)) {
  41291. return;
  41292. }
  41293. this._imageMap.set(name, data);
  41294. }
  41295. }
  41296. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  41297. class LocalFunctionCache extends BaseLocalCache {
  41298. constructor(options) {
  41299. super({
  41300. onlyRefs: true
  41301. });
  41302. }
  41303. set(name = null, ref, data) {
  41304. if (!ref) {
  41305. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  41306. }
  41307. if (this._imageCache.has(ref)) {
  41308. return;
  41309. }
  41310. this._imageCache.put(ref, data);
  41311. }
  41312. }
  41313. exports.LocalFunctionCache = LocalFunctionCache;
  41314. class LocalGStateCache extends BaseLocalCache {
  41315. set(name, ref = null, data) {
  41316. if (typeof name !== "string") {
  41317. throw new Error('LocalGStateCache.set - expected "name" argument.');
  41318. }
  41319. if (ref) {
  41320. if (this._imageCache.has(ref)) {
  41321. return;
  41322. }
  41323. this._nameRefMap.set(name, ref);
  41324. this._imageCache.put(ref, data);
  41325. return;
  41326. }
  41327. if (this._imageMap.has(name)) {
  41328. return;
  41329. }
  41330. this._imageMap.set(name, data);
  41331. }
  41332. }
  41333. exports.LocalGStateCache = LocalGStateCache;
  41334. class LocalTilingPatternCache extends BaseLocalCache {
  41335. constructor(options) {
  41336. super({
  41337. onlyRefs: true
  41338. });
  41339. }
  41340. set(name = null, ref, data) {
  41341. if (!ref) {
  41342. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  41343. }
  41344. if (this._imageCache.has(ref)) {
  41345. return;
  41346. }
  41347. this._imageCache.put(ref, data);
  41348. }
  41349. }
  41350. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  41351. class GlobalImageCache {
  41352. static get NUM_PAGES_THRESHOLD() {
  41353. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  41354. }
  41355. static get MIN_IMAGES_TO_CACHE() {
  41356. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  41357. }
  41358. static get MAX_BYTE_SIZE() {
  41359. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  41360. }
  41361. constructor() {
  41362. this._refCache = new _primitives.RefSetCache();
  41363. this._imageCache = new _primitives.RefSetCache();
  41364. }
  41365. get _byteSize() {
  41366. let byteSize = 0;
  41367. this._imageCache.forEach(imageData => {
  41368. byteSize += imageData.byteSize;
  41369. });
  41370. return byteSize;
  41371. }
  41372. get _cacheLimitReached() {
  41373. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  41374. return false;
  41375. }
  41376. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  41377. return false;
  41378. }
  41379. return true;
  41380. }
  41381. shouldCache(ref, pageIndex) {
  41382. const pageIndexSet = this._refCache.get(ref);
  41383. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  41384. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  41385. return false;
  41386. }
  41387. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  41388. return false;
  41389. }
  41390. return true;
  41391. }
  41392. addPageIndex(ref, pageIndex) {
  41393. let pageIndexSet = this._refCache.get(ref);
  41394. if (!pageIndexSet) {
  41395. pageIndexSet = new Set();
  41396. this._refCache.put(ref, pageIndexSet);
  41397. }
  41398. pageIndexSet.add(pageIndex);
  41399. }
  41400. addByteSize(ref, byteSize) {
  41401. const imageData = this._imageCache.get(ref);
  41402. if (!imageData) {
  41403. return;
  41404. }
  41405. if (imageData.byteSize) {
  41406. return;
  41407. }
  41408. imageData.byteSize = byteSize;
  41409. }
  41410. getData(ref, pageIndex) {
  41411. const pageIndexSet = this._refCache.get(ref);
  41412. if (!pageIndexSet) {
  41413. return null;
  41414. }
  41415. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  41416. return null;
  41417. }
  41418. const imageData = this._imageCache.get(ref);
  41419. if (!imageData) {
  41420. return null;
  41421. }
  41422. pageIndexSet.add(pageIndex);
  41423. return imageData;
  41424. }
  41425. setData(ref, data) {
  41426. if (!this._refCache.has(ref)) {
  41427. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  41428. }
  41429. if (this._imageCache.has(ref)) {
  41430. return;
  41431. }
  41432. if (this._cacheLimitReached) {
  41433. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  41434. return;
  41435. }
  41436. this._imageCache.put(ref, data);
  41437. }
  41438. clear(onlyData = false) {
  41439. if (!onlyData) {
  41440. this._refCache.clear();
  41441. }
  41442. this._imageCache.clear();
  41443. }
  41444. }
  41445. exports.GlobalImageCache = GlobalImageCache;
  41446. /***/ }),
  41447. /* 59 */
  41448. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41449. Object.defineProperty(exports, "__esModule", ({
  41450. value: true
  41451. }));
  41452. exports.bidi = bidi;
  41453. var _util = __w_pdfjs_require__(2);
  41454. 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"];
  41455. 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"];
  41456. function isOdd(i) {
  41457. return (i & 1) !== 0;
  41458. }
  41459. function isEven(i) {
  41460. return (i & 1) === 0;
  41461. }
  41462. function findUnequal(arr, start, value) {
  41463. let j, jj;
  41464. for (j = start, jj = arr.length; j < jj; ++j) {
  41465. if (arr[j] !== value) {
  41466. return j;
  41467. }
  41468. }
  41469. return j;
  41470. }
  41471. function setValues(arr, start, end, value) {
  41472. for (let j = start; j < end; ++j) {
  41473. arr[j] = value;
  41474. }
  41475. }
  41476. function reverseValues(arr, start, end) {
  41477. for (let i = start, j = end - 1; i < j; ++i, --j) {
  41478. const temp = arr[i];
  41479. arr[i] = arr[j];
  41480. arr[j] = temp;
  41481. }
  41482. }
  41483. function createBidiText(str, isLTR, vertical = false) {
  41484. let dir = "ltr";
  41485. if (vertical) {
  41486. dir = "ttb";
  41487. } else if (!isLTR) {
  41488. dir = "rtl";
  41489. }
  41490. return {
  41491. str,
  41492. dir
  41493. };
  41494. }
  41495. const chars = [];
  41496. const types = [];
  41497. function bidi(str, startLevel = -1, vertical = false) {
  41498. let isLTR = true;
  41499. const strLength = str.length;
  41500. if (strLength === 0 || vertical) {
  41501. return createBidiText(str, isLTR, vertical);
  41502. }
  41503. chars.length = strLength;
  41504. types.length = strLength;
  41505. let numBidi = 0;
  41506. let i, ii;
  41507. for (i = 0; i < strLength; ++i) {
  41508. chars[i] = str.charAt(i);
  41509. const charCode = str.charCodeAt(i);
  41510. let charType = "L";
  41511. if (charCode <= 0x00ff) {
  41512. charType = baseTypes[charCode];
  41513. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  41514. charType = "R";
  41515. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  41516. charType = arabicTypes[charCode & 0xff];
  41517. if (!charType) {
  41518. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  41519. }
  41520. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  41521. charType = "AL";
  41522. }
  41523. if (charType === "R" || charType === "AL" || charType === "AN") {
  41524. numBidi++;
  41525. }
  41526. types[i] = charType;
  41527. }
  41528. if (numBidi === 0) {
  41529. isLTR = true;
  41530. return createBidiText(str, isLTR);
  41531. }
  41532. if (startLevel === -1) {
  41533. if (numBidi / strLength < 0.3 && strLength > 4) {
  41534. isLTR = true;
  41535. startLevel = 0;
  41536. } else {
  41537. isLTR = false;
  41538. startLevel = 1;
  41539. }
  41540. }
  41541. const levels = [];
  41542. for (i = 0; i < strLength; ++i) {
  41543. levels[i] = startLevel;
  41544. }
  41545. const e = isOdd(startLevel) ? "R" : "L";
  41546. const sor = e;
  41547. const eor = sor;
  41548. let lastType = sor;
  41549. for (i = 0; i < strLength; ++i) {
  41550. if (types[i] === "NSM") {
  41551. types[i] = lastType;
  41552. } else {
  41553. lastType = types[i];
  41554. }
  41555. }
  41556. lastType = sor;
  41557. let t;
  41558. for (i = 0; i < strLength; ++i) {
  41559. t = types[i];
  41560. if (t === "EN") {
  41561. types[i] = lastType === "AL" ? "AN" : "EN";
  41562. } else if (t === "R" || t === "L" || t === "AL") {
  41563. lastType = t;
  41564. }
  41565. }
  41566. for (i = 0; i < strLength; ++i) {
  41567. t = types[i];
  41568. if (t === "AL") {
  41569. types[i] = "R";
  41570. }
  41571. }
  41572. for (i = 1; i < strLength - 1; ++i) {
  41573. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  41574. types[i] = "EN";
  41575. }
  41576. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  41577. types[i] = types[i - 1];
  41578. }
  41579. }
  41580. for (i = 0; i < strLength; ++i) {
  41581. if (types[i] === "EN") {
  41582. for (let j = i - 1; j >= 0; --j) {
  41583. if (types[j] !== "ET") {
  41584. break;
  41585. }
  41586. types[j] = "EN";
  41587. }
  41588. for (let j = i + 1; j < strLength; ++j) {
  41589. if (types[j] !== "ET") {
  41590. break;
  41591. }
  41592. types[j] = "EN";
  41593. }
  41594. }
  41595. }
  41596. for (i = 0; i < strLength; ++i) {
  41597. t = types[i];
  41598. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  41599. types[i] = "ON";
  41600. }
  41601. }
  41602. lastType = sor;
  41603. for (i = 0; i < strLength; ++i) {
  41604. t = types[i];
  41605. if (t === "EN") {
  41606. types[i] = lastType === "L" ? "L" : "EN";
  41607. } else if (t === "R" || t === "L") {
  41608. lastType = t;
  41609. }
  41610. }
  41611. for (i = 0; i < strLength; ++i) {
  41612. if (types[i] === "ON") {
  41613. const end = findUnequal(types, i + 1, "ON");
  41614. let before = sor;
  41615. if (i > 0) {
  41616. before = types[i - 1];
  41617. }
  41618. let after = eor;
  41619. if (end + 1 < strLength) {
  41620. after = types[end + 1];
  41621. }
  41622. if (before !== "L") {
  41623. before = "R";
  41624. }
  41625. if (after !== "L") {
  41626. after = "R";
  41627. }
  41628. if (before === after) {
  41629. setValues(types, i, end, before);
  41630. }
  41631. i = end - 1;
  41632. }
  41633. }
  41634. for (i = 0; i < strLength; ++i) {
  41635. if (types[i] === "ON") {
  41636. types[i] = e;
  41637. }
  41638. }
  41639. for (i = 0; i < strLength; ++i) {
  41640. t = types[i];
  41641. if (isEven(levels[i])) {
  41642. if (t === "R") {
  41643. levels[i] += 1;
  41644. } else if (t === "AN" || t === "EN") {
  41645. levels[i] += 2;
  41646. }
  41647. } else {
  41648. if (t === "L" || t === "AN" || t === "EN") {
  41649. levels[i] += 1;
  41650. }
  41651. }
  41652. }
  41653. let highestLevel = -1;
  41654. let lowestOddLevel = 99;
  41655. let level;
  41656. for (i = 0, ii = levels.length; i < ii; ++i) {
  41657. level = levels[i];
  41658. if (highestLevel < level) {
  41659. highestLevel = level;
  41660. }
  41661. if (lowestOddLevel > level && isOdd(level)) {
  41662. lowestOddLevel = level;
  41663. }
  41664. }
  41665. for (level = highestLevel; level >= lowestOddLevel; --level) {
  41666. let start = -1;
  41667. for (i = 0, ii = levels.length; i < ii; ++i) {
  41668. if (levels[i] < level) {
  41669. if (start >= 0) {
  41670. reverseValues(chars, start, i);
  41671. start = -1;
  41672. }
  41673. } else if (start < 0) {
  41674. start = i;
  41675. }
  41676. }
  41677. if (start >= 0) {
  41678. reverseValues(chars, start, levels.length);
  41679. }
  41680. }
  41681. for (i = 0, ii = chars.length; i < ii; ++i) {
  41682. const ch = chars[i];
  41683. if (ch === "<" || ch === ">") {
  41684. chars[i] = "";
  41685. }
  41686. }
  41687. return createBidiText(chars.join(""), isLTR);
  41688. }
  41689. /***/ }),
  41690. /* 60 */
  41691. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41692. Object.defineProperty(exports, "__esModule", ({
  41693. value: true
  41694. }));
  41695. exports.getMetrics = void 0;
  41696. var _core_utils = __w_pdfjs_require__(9);
  41697. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41698. t.Courier = 600;
  41699. t["Courier-Bold"] = 600;
  41700. t["Courier-BoldOblique"] = 600;
  41701. t["Courier-Oblique"] = 600;
  41702. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  41703. t.space = 278;
  41704. t.exclam = 278;
  41705. t.quotedbl = 355;
  41706. t.numbersign = 556;
  41707. t.dollar = 556;
  41708. t.percent = 889;
  41709. t.ampersand = 667;
  41710. t.quoteright = 222;
  41711. t.parenleft = 333;
  41712. t.parenright = 333;
  41713. t.asterisk = 389;
  41714. t.plus = 584;
  41715. t.comma = 278;
  41716. t.hyphen = 333;
  41717. t.period = 278;
  41718. t.slash = 278;
  41719. t.zero = 556;
  41720. t.one = 556;
  41721. t.two = 556;
  41722. t.three = 556;
  41723. t.four = 556;
  41724. t.five = 556;
  41725. t.six = 556;
  41726. t.seven = 556;
  41727. t.eight = 556;
  41728. t.nine = 556;
  41729. t.colon = 278;
  41730. t.semicolon = 278;
  41731. t.less = 584;
  41732. t.equal = 584;
  41733. t.greater = 584;
  41734. t.question = 556;
  41735. t.at = 1015;
  41736. t.A = 667;
  41737. t.B = 667;
  41738. t.C = 722;
  41739. t.D = 722;
  41740. t.E = 667;
  41741. t.F = 611;
  41742. t.G = 778;
  41743. t.H = 722;
  41744. t.I = 278;
  41745. t.J = 500;
  41746. t.K = 667;
  41747. t.L = 556;
  41748. t.M = 833;
  41749. t.N = 722;
  41750. t.O = 778;
  41751. t.P = 667;
  41752. t.Q = 778;
  41753. t.R = 722;
  41754. t.S = 667;
  41755. t.T = 611;
  41756. t.U = 722;
  41757. t.V = 667;
  41758. t.W = 944;
  41759. t.X = 667;
  41760. t.Y = 667;
  41761. t.Z = 611;
  41762. t.bracketleft = 278;
  41763. t.backslash = 278;
  41764. t.bracketright = 278;
  41765. t.asciicircum = 469;
  41766. t.underscore = 556;
  41767. t.quoteleft = 222;
  41768. t.a = 556;
  41769. t.b = 556;
  41770. t.c = 500;
  41771. t.d = 556;
  41772. t.e = 556;
  41773. t.f = 278;
  41774. t.g = 556;
  41775. t.h = 556;
  41776. t.i = 222;
  41777. t.j = 222;
  41778. t.k = 500;
  41779. t.l = 222;
  41780. t.m = 833;
  41781. t.n = 556;
  41782. t.o = 556;
  41783. t.p = 556;
  41784. t.q = 556;
  41785. t.r = 333;
  41786. t.s = 500;
  41787. t.t = 278;
  41788. t.u = 556;
  41789. t.v = 500;
  41790. t.w = 722;
  41791. t.x = 500;
  41792. t.y = 500;
  41793. t.z = 500;
  41794. t.braceleft = 334;
  41795. t.bar = 260;
  41796. t.braceright = 334;
  41797. t.asciitilde = 584;
  41798. t.exclamdown = 333;
  41799. t.cent = 556;
  41800. t.sterling = 556;
  41801. t.fraction = 167;
  41802. t.yen = 556;
  41803. t.florin = 556;
  41804. t.section = 556;
  41805. t.currency = 556;
  41806. t.quotesingle = 191;
  41807. t.quotedblleft = 333;
  41808. t.guillemotleft = 556;
  41809. t.guilsinglleft = 333;
  41810. t.guilsinglright = 333;
  41811. t.fi = 500;
  41812. t.fl = 500;
  41813. t.endash = 556;
  41814. t.dagger = 556;
  41815. t.daggerdbl = 556;
  41816. t.periodcentered = 278;
  41817. t.paragraph = 537;
  41818. t.bullet = 350;
  41819. t.quotesinglbase = 222;
  41820. t.quotedblbase = 333;
  41821. t.quotedblright = 333;
  41822. t.guillemotright = 556;
  41823. t.ellipsis = 1000;
  41824. t.perthousand = 1000;
  41825. t.questiondown = 611;
  41826. t.grave = 333;
  41827. t.acute = 333;
  41828. t.circumflex = 333;
  41829. t.tilde = 333;
  41830. t.macron = 333;
  41831. t.breve = 333;
  41832. t.dotaccent = 333;
  41833. t.dieresis = 333;
  41834. t.ring = 333;
  41835. t.cedilla = 333;
  41836. t.hungarumlaut = 333;
  41837. t.ogonek = 333;
  41838. t.caron = 333;
  41839. t.emdash = 1000;
  41840. t.AE = 1000;
  41841. t.ordfeminine = 370;
  41842. t.Lslash = 556;
  41843. t.Oslash = 778;
  41844. t.OE = 1000;
  41845. t.ordmasculine = 365;
  41846. t.ae = 889;
  41847. t.dotlessi = 278;
  41848. t.lslash = 222;
  41849. t.oslash = 611;
  41850. t.oe = 944;
  41851. t.germandbls = 611;
  41852. t.Idieresis = 278;
  41853. t.eacute = 556;
  41854. t.abreve = 556;
  41855. t.uhungarumlaut = 556;
  41856. t.ecaron = 556;
  41857. t.Ydieresis = 667;
  41858. t.divide = 584;
  41859. t.Yacute = 667;
  41860. t.Acircumflex = 667;
  41861. t.aacute = 556;
  41862. t.Ucircumflex = 722;
  41863. t.yacute = 500;
  41864. t.scommaaccent = 500;
  41865. t.ecircumflex = 556;
  41866. t.Uring = 722;
  41867. t.Udieresis = 722;
  41868. t.aogonek = 556;
  41869. t.Uacute = 722;
  41870. t.uogonek = 556;
  41871. t.Edieresis = 667;
  41872. t.Dcroat = 722;
  41873. t.commaaccent = 250;
  41874. t.copyright = 737;
  41875. t.Emacron = 667;
  41876. t.ccaron = 500;
  41877. t.aring = 556;
  41878. t.Ncommaaccent = 722;
  41879. t.lacute = 222;
  41880. t.agrave = 556;
  41881. t.Tcommaaccent = 611;
  41882. t.Cacute = 722;
  41883. t.atilde = 556;
  41884. t.Edotaccent = 667;
  41885. t.scaron = 500;
  41886. t.scedilla = 500;
  41887. t.iacute = 278;
  41888. t.lozenge = 471;
  41889. t.Rcaron = 722;
  41890. t.Gcommaaccent = 778;
  41891. t.ucircumflex = 556;
  41892. t.acircumflex = 556;
  41893. t.Amacron = 667;
  41894. t.rcaron = 333;
  41895. t.ccedilla = 500;
  41896. t.Zdotaccent = 611;
  41897. t.Thorn = 667;
  41898. t.Omacron = 778;
  41899. t.Racute = 722;
  41900. t.Sacute = 667;
  41901. t.dcaron = 643;
  41902. t.Umacron = 722;
  41903. t.uring = 556;
  41904. t.threesuperior = 333;
  41905. t.Ograve = 778;
  41906. t.Agrave = 667;
  41907. t.Abreve = 667;
  41908. t.multiply = 584;
  41909. t.uacute = 556;
  41910. t.Tcaron = 611;
  41911. t.partialdiff = 476;
  41912. t.ydieresis = 500;
  41913. t.Nacute = 722;
  41914. t.icircumflex = 278;
  41915. t.Ecircumflex = 667;
  41916. t.adieresis = 556;
  41917. t.edieresis = 556;
  41918. t.cacute = 500;
  41919. t.nacute = 556;
  41920. t.umacron = 556;
  41921. t.Ncaron = 722;
  41922. t.Iacute = 278;
  41923. t.plusminus = 584;
  41924. t.brokenbar = 260;
  41925. t.registered = 737;
  41926. t.Gbreve = 778;
  41927. t.Idotaccent = 278;
  41928. t.summation = 600;
  41929. t.Egrave = 667;
  41930. t.racute = 333;
  41931. t.omacron = 556;
  41932. t.Zacute = 611;
  41933. t.Zcaron = 611;
  41934. t.greaterequal = 549;
  41935. t.Eth = 722;
  41936. t.Ccedilla = 722;
  41937. t.lcommaaccent = 222;
  41938. t.tcaron = 317;
  41939. t.eogonek = 556;
  41940. t.Uogonek = 722;
  41941. t.Aacute = 667;
  41942. t.Adieresis = 667;
  41943. t.egrave = 556;
  41944. t.zacute = 500;
  41945. t.iogonek = 222;
  41946. t.Oacute = 778;
  41947. t.oacute = 556;
  41948. t.amacron = 556;
  41949. t.sacute = 500;
  41950. t.idieresis = 278;
  41951. t.Ocircumflex = 778;
  41952. t.Ugrave = 722;
  41953. t.Delta = 612;
  41954. t.thorn = 556;
  41955. t.twosuperior = 333;
  41956. t.Odieresis = 778;
  41957. t.mu = 556;
  41958. t.igrave = 278;
  41959. t.ohungarumlaut = 556;
  41960. t.Eogonek = 667;
  41961. t.dcroat = 556;
  41962. t.threequarters = 834;
  41963. t.Scedilla = 667;
  41964. t.lcaron = 299;
  41965. t.Kcommaaccent = 667;
  41966. t.Lacute = 556;
  41967. t.trademark = 1000;
  41968. t.edotaccent = 556;
  41969. t.Igrave = 278;
  41970. t.Imacron = 278;
  41971. t.Lcaron = 556;
  41972. t.onehalf = 834;
  41973. t.lessequal = 549;
  41974. t.ocircumflex = 556;
  41975. t.ntilde = 556;
  41976. t.Uhungarumlaut = 722;
  41977. t.Eacute = 667;
  41978. t.emacron = 556;
  41979. t.gbreve = 556;
  41980. t.onequarter = 834;
  41981. t.Scaron = 667;
  41982. t.Scommaaccent = 667;
  41983. t.Ohungarumlaut = 778;
  41984. t.degree = 400;
  41985. t.ograve = 556;
  41986. t.Ccaron = 722;
  41987. t.ugrave = 556;
  41988. t.radical = 453;
  41989. t.Dcaron = 722;
  41990. t.rcommaaccent = 333;
  41991. t.Ntilde = 722;
  41992. t.otilde = 556;
  41993. t.Rcommaaccent = 722;
  41994. t.Lcommaaccent = 556;
  41995. t.Atilde = 667;
  41996. t.Aogonek = 667;
  41997. t.Aring = 667;
  41998. t.Otilde = 778;
  41999. t.zdotaccent = 500;
  42000. t.Ecaron = 667;
  42001. t.Iogonek = 278;
  42002. t.kcommaaccent = 500;
  42003. t.minus = 584;
  42004. t.Icircumflex = 278;
  42005. t.ncaron = 556;
  42006. t.tcommaaccent = 278;
  42007. t.logicalnot = 584;
  42008. t.odieresis = 556;
  42009. t.udieresis = 556;
  42010. t.notequal = 549;
  42011. t.gcommaaccent = 556;
  42012. t.eth = 556;
  42013. t.zcaron = 500;
  42014. t.ncommaaccent = 556;
  42015. t.onesuperior = 333;
  42016. t.imacron = 278;
  42017. t.Euro = 556;
  42018. });
  42019. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42020. t.space = 278;
  42021. t.exclam = 333;
  42022. t.quotedbl = 474;
  42023. t.numbersign = 556;
  42024. t.dollar = 556;
  42025. t.percent = 889;
  42026. t.ampersand = 722;
  42027. t.quoteright = 278;
  42028. t.parenleft = 333;
  42029. t.parenright = 333;
  42030. t.asterisk = 389;
  42031. t.plus = 584;
  42032. t.comma = 278;
  42033. t.hyphen = 333;
  42034. t.period = 278;
  42035. t.slash = 278;
  42036. t.zero = 556;
  42037. t.one = 556;
  42038. t.two = 556;
  42039. t.three = 556;
  42040. t.four = 556;
  42041. t.five = 556;
  42042. t.six = 556;
  42043. t.seven = 556;
  42044. t.eight = 556;
  42045. t.nine = 556;
  42046. t.colon = 333;
  42047. t.semicolon = 333;
  42048. t.less = 584;
  42049. t.equal = 584;
  42050. t.greater = 584;
  42051. t.question = 611;
  42052. t.at = 975;
  42053. t.A = 722;
  42054. t.B = 722;
  42055. t.C = 722;
  42056. t.D = 722;
  42057. t.E = 667;
  42058. t.F = 611;
  42059. t.G = 778;
  42060. t.H = 722;
  42061. t.I = 278;
  42062. t.J = 556;
  42063. t.K = 722;
  42064. t.L = 611;
  42065. t.M = 833;
  42066. t.N = 722;
  42067. t.O = 778;
  42068. t.P = 667;
  42069. t.Q = 778;
  42070. t.R = 722;
  42071. t.S = 667;
  42072. t.T = 611;
  42073. t.U = 722;
  42074. t.V = 667;
  42075. t.W = 944;
  42076. t.X = 667;
  42077. t.Y = 667;
  42078. t.Z = 611;
  42079. t.bracketleft = 333;
  42080. t.backslash = 278;
  42081. t.bracketright = 333;
  42082. t.asciicircum = 584;
  42083. t.underscore = 556;
  42084. t.quoteleft = 278;
  42085. t.a = 556;
  42086. t.b = 611;
  42087. t.c = 556;
  42088. t.d = 611;
  42089. t.e = 556;
  42090. t.f = 333;
  42091. t.g = 611;
  42092. t.h = 611;
  42093. t.i = 278;
  42094. t.j = 278;
  42095. t.k = 556;
  42096. t.l = 278;
  42097. t.m = 889;
  42098. t.n = 611;
  42099. t.o = 611;
  42100. t.p = 611;
  42101. t.q = 611;
  42102. t.r = 389;
  42103. t.s = 556;
  42104. t.t = 333;
  42105. t.u = 611;
  42106. t.v = 556;
  42107. t.w = 778;
  42108. t.x = 556;
  42109. t.y = 556;
  42110. t.z = 500;
  42111. t.braceleft = 389;
  42112. t.bar = 280;
  42113. t.braceright = 389;
  42114. t.asciitilde = 584;
  42115. t.exclamdown = 333;
  42116. t.cent = 556;
  42117. t.sterling = 556;
  42118. t.fraction = 167;
  42119. t.yen = 556;
  42120. t.florin = 556;
  42121. t.section = 556;
  42122. t.currency = 556;
  42123. t.quotesingle = 238;
  42124. t.quotedblleft = 500;
  42125. t.guillemotleft = 556;
  42126. t.guilsinglleft = 333;
  42127. t.guilsinglright = 333;
  42128. t.fi = 611;
  42129. t.fl = 611;
  42130. t.endash = 556;
  42131. t.dagger = 556;
  42132. t.daggerdbl = 556;
  42133. t.periodcentered = 278;
  42134. t.paragraph = 556;
  42135. t.bullet = 350;
  42136. t.quotesinglbase = 278;
  42137. t.quotedblbase = 500;
  42138. t.quotedblright = 500;
  42139. t.guillemotright = 556;
  42140. t.ellipsis = 1000;
  42141. t.perthousand = 1000;
  42142. t.questiondown = 611;
  42143. t.grave = 333;
  42144. t.acute = 333;
  42145. t.circumflex = 333;
  42146. t.tilde = 333;
  42147. t.macron = 333;
  42148. t.breve = 333;
  42149. t.dotaccent = 333;
  42150. t.dieresis = 333;
  42151. t.ring = 333;
  42152. t.cedilla = 333;
  42153. t.hungarumlaut = 333;
  42154. t.ogonek = 333;
  42155. t.caron = 333;
  42156. t.emdash = 1000;
  42157. t.AE = 1000;
  42158. t.ordfeminine = 370;
  42159. t.Lslash = 611;
  42160. t.Oslash = 778;
  42161. t.OE = 1000;
  42162. t.ordmasculine = 365;
  42163. t.ae = 889;
  42164. t.dotlessi = 278;
  42165. t.lslash = 278;
  42166. t.oslash = 611;
  42167. t.oe = 944;
  42168. t.germandbls = 611;
  42169. t.Idieresis = 278;
  42170. t.eacute = 556;
  42171. t.abreve = 556;
  42172. t.uhungarumlaut = 611;
  42173. t.ecaron = 556;
  42174. t.Ydieresis = 667;
  42175. t.divide = 584;
  42176. t.Yacute = 667;
  42177. t.Acircumflex = 722;
  42178. t.aacute = 556;
  42179. t.Ucircumflex = 722;
  42180. t.yacute = 556;
  42181. t.scommaaccent = 556;
  42182. t.ecircumflex = 556;
  42183. t.Uring = 722;
  42184. t.Udieresis = 722;
  42185. t.aogonek = 556;
  42186. t.Uacute = 722;
  42187. t.uogonek = 611;
  42188. t.Edieresis = 667;
  42189. t.Dcroat = 722;
  42190. t.commaaccent = 250;
  42191. t.copyright = 737;
  42192. t.Emacron = 667;
  42193. t.ccaron = 556;
  42194. t.aring = 556;
  42195. t.Ncommaaccent = 722;
  42196. t.lacute = 278;
  42197. t.agrave = 556;
  42198. t.Tcommaaccent = 611;
  42199. t.Cacute = 722;
  42200. t.atilde = 556;
  42201. t.Edotaccent = 667;
  42202. t.scaron = 556;
  42203. t.scedilla = 556;
  42204. t.iacute = 278;
  42205. t.lozenge = 494;
  42206. t.Rcaron = 722;
  42207. t.Gcommaaccent = 778;
  42208. t.ucircumflex = 611;
  42209. t.acircumflex = 556;
  42210. t.Amacron = 722;
  42211. t.rcaron = 389;
  42212. t.ccedilla = 556;
  42213. t.Zdotaccent = 611;
  42214. t.Thorn = 667;
  42215. t.Omacron = 778;
  42216. t.Racute = 722;
  42217. t.Sacute = 667;
  42218. t.dcaron = 743;
  42219. t.Umacron = 722;
  42220. t.uring = 611;
  42221. t.threesuperior = 333;
  42222. t.Ograve = 778;
  42223. t.Agrave = 722;
  42224. t.Abreve = 722;
  42225. t.multiply = 584;
  42226. t.uacute = 611;
  42227. t.Tcaron = 611;
  42228. t.partialdiff = 494;
  42229. t.ydieresis = 556;
  42230. t.Nacute = 722;
  42231. t.icircumflex = 278;
  42232. t.Ecircumflex = 667;
  42233. t.adieresis = 556;
  42234. t.edieresis = 556;
  42235. t.cacute = 556;
  42236. t.nacute = 611;
  42237. t.umacron = 611;
  42238. t.Ncaron = 722;
  42239. t.Iacute = 278;
  42240. t.plusminus = 584;
  42241. t.brokenbar = 280;
  42242. t.registered = 737;
  42243. t.Gbreve = 778;
  42244. t.Idotaccent = 278;
  42245. t.summation = 600;
  42246. t.Egrave = 667;
  42247. t.racute = 389;
  42248. t.omacron = 611;
  42249. t.Zacute = 611;
  42250. t.Zcaron = 611;
  42251. t.greaterequal = 549;
  42252. t.Eth = 722;
  42253. t.Ccedilla = 722;
  42254. t.lcommaaccent = 278;
  42255. t.tcaron = 389;
  42256. t.eogonek = 556;
  42257. t.Uogonek = 722;
  42258. t.Aacute = 722;
  42259. t.Adieresis = 722;
  42260. t.egrave = 556;
  42261. t.zacute = 500;
  42262. t.iogonek = 278;
  42263. t.Oacute = 778;
  42264. t.oacute = 611;
  42265. t.amacron = 556;
  42266. t.sacute = 556;
  42267. t.idieresis = 278;
  42268. t.Ocircumflex = 778;
  42269. t.Ugrave = 722;
  42270. t.Delta = 612;
  42271. t.thorn = 611;
  42272. t.twosuperior = 333;
  42273. t.Odieresis = 778;
  42274. t.mu = 611;
  42275. t.igrave = 278;
  42276. t.ohungarumlaut = 611;
  42277. t.Eogonek = 667;
  42278. t.dcroat = 611;
  42279. t.threequarters = 834;
  42280. t.Scedilla = 667;
  42281. t.lcaron = 400;
  42282. t.Kcommaaccent = 722;
  42283. t.Lacute = 611;
  42284. t.trademark = 1000;
  42285. t.edotaccent = 556;
  42286. t.Igrave = 278;
  42287. t.Imacron = 278;
  42288. t.Lcaron = 611;
  42289. t.onehalf = 834;
  42290. t.lessequal = 549;
  42291. t.ocircumflex = 611;
  42292. t.ntilde = 611;
  42293. t.Uhungarumlaut = 722;
  42294. t.Eacute = 667;
  42295. t.emacron = 556;
  42296. t.gbreve = 611;
  42297. t.onequarter = 834;
  42298. t.Scaron = 667;
  42299. t.Scommaaccent = 667;
  42300. t.Ohungarumlaut = 778;
  42301. t.degree = 400;
  42302. t.ograve = 611;
  42303. t.Ccaron = 722;
  42304. t.ugrave = 611;
  42305. t.radical = 549;
  42306. t.Dcaron = 722;
  42307. t.rcommaaccent = 389;
  42308. t.Ntilde = 722;
  42309. t.otilde = 611;
  42310. t.Rcommaaccent = 722;
  42311. t.Lcommaaccent = 611;
  42312. t.Atilde = 722;
  42313. t.Aogonek = 722;
  42314. t.Aring = 722;
  42315. t.Otilde = 778;
  42316. t.zdotaccent = 500;
  42317. t.Ecaron = 667;
  42318. t.Iogonek = 278;
  42319. t.kcommaaccent = 556;
  42320. t.minus = 584;
  42321. t.Icircumflex = 278;
  42322. t.ncaron = 611;
  42323. t.tcommaaccent = 333;
  42324. t.logicalnot = 584;
  42325. t.odieresis = 611;
  42326. t.udieresis = 611;
  42327. t.notequal = 549;
  42328. t.gcommaaccent = 611;
  42329. t.eth = 611;
  42330. t.zcaron = 500;
  42331. t.ncommaaccent = 611;
  42332. t.onesuperior = 333;
  42333. t.imacron = 278;
  42334. t.Euro = 556;
  42335. });
  42336. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42337. t.space = 278;
  42338. t.exclam = 333;
  42339. t.quotedbl = 474;
  42340. t.numbersign = 556;
  42341. t.dollar = 556;
  42342. t.percent = 889;
  42343. t.ampersand = 722;
  42344. t.quoteright = 278;
  42345. t.parenleft = 333;
  42346. t.parenright = 333;
  42347. t.asterisk = 389;
  42348. t.plus = 584;
  42349. t.comma = 278;
  42350. t.hyphen = 333;
  42351. t.period = 278;
  42352. t.slash = 278;
  42353. t.zero = 556;
  42354. t.one = 556;
  42355. t.two = 556;
  42356. t.three = 556;
  42357. t.four = 556;
  42358. t.five = 556;
  42359. t.six = 556;
  42360. t.seven = 556;
  42361. t.eight = 556;
  42362. t.nine = 556;
  42363. t.colon = 333;
  42364. t.semicolon = 333;
  42365. t.less = 584;
  42366. t.equal = 584;
  42367. t.greater = 584;
  42368. t.question = 611;
  42369. t.at = 975;
  42370. t.A = 722;
  42371. t.B = 722;
  42372. t.C = 722;
  42373. t.D = 722;
  42374. t.E = 667;
  42375. t.F = 611;
  42376. t.G = 778;
  42377. t.H = 722;
  42378. t.I = 278;
  42379. t.J = 556;
  42380. t.K = 722;
  42381. t.L = 611;
  42382. t.M = 833;
  42383. t.N = 722;
  42384. t.O = 778;
  42385. t.P = 667;
  42386. t.Q = 778;
  42387. t.R = 722;
  42388. t.S = 667;
  42389. t.T = 611;
  42390. t.U = 722;
  42391. t.V = 667;
  42392. t.W = 944;
  42393. t.X = 667;
  42394. t.Y = 667;
  42395. t.Z = 611;
  42396. t.bracketleft = 333;
  42397. t.backslash = 278;
  42398. t.bracketright = 333;
  42399. t.asciicircum = 584;
  42400. t.underscore = 556;
  42401. t.quoteleft = 278;
  42402. t.a = 556;
  42403. t.b = 611;
  42404. t.c = 556;
  42405. t.d = 611;
  42406. t.e = 556;
  42407. t.f = 333;
  42408. t.g = 611;
  42409. t.h = 611;
  42410. t.i = 278;
  42411. t.j = 278;
  42412. t.k = 556;
  42413. t.l = 278;
  42414. t.m = 889;
  42415. t.n = 611;
  42416. t.o = 611;
  42417. t.p = 611;
  42418. t.q = 611;
  42419. t.r = 389;
  42420. t.s = 556;
  42421. t.t = 333;
  42422. t.u = 611;
  42423. t.v = 556;
  42424. t.w = 778;
  42425. t.x = 556;
  42426. t.y = 556;
  42427. t.z = 500;
  42428. t.braceleft = 389;
  42429. t.bar = 280;
  42430. t.braceright = 389;
  42431. t.asciitilde = 584;
  42432. t.exclamdown = 333;
  42433. t.cent = 556;
  42434. t.sterling = 556;
  42435. t.fraction = 167;
  42436. t.yen = 556;
  42437. t.florin = 556;
  42438. t.section = 556;
  42439. t.currency = 556;
  42440. t.quotesingle = 238;
  42441. t.quotedblleft = 500;
  42442. t.guillemotleft = 556;
  42443. t.guilsinglleft = 333;
  42444. t.guilsinglright = 333;
  42445. t.fi = 611;
  42446. t.fl = 611;
  42447. t.endash = 556;
  42448. t.dagger = 556;
  42449. t.daggerdbl = 556;
  42450. t.periodcentered = 278;
  42451. t.paragraph = 556;
  42452. t.bullet = 350;
  42453. t.quotesinglbase = 278;
  42454. t.quotedblbase = 500;
  42455. t.quotedblright = 500;
  42456. t.guillemotright = 556;
  42457. t.ellipsis = 1000;
  42458. t.perthousand = 1000;
  42459. t.questiondown = 611;
  42460. t.grave = 333;
  42461. t.acute = 333;
  42462. t.circumflex = 333;
  42463. t.tilde = 333;
  42464. t.macron = 333;
  42465. t.breve = 333;
  42466. t.dotaccent = 333;
  42467. t.dieresis = 333;
  42468. t.ring = 333;
  42469. t.cedilla = 333;
  42470. t.hungarumlaut = 333;
  42471. t.ogonek = 333;
  42472. t.caron = 333;
  42473. t.emdash = 1000;
  42474. t.AE = 1000;
  42475. t.ordfeminine = 370;
  42476. t.Lslash = 611;
  42477. t.Oslash = 778;
  42478. t.OE = 1000;
  42479. t.ordmasculine = 365;
  42480. t.ae = 889;
  42481. t.dotlessi = 278;
  42482. t.lslash = 278;
  42483. t.oslash = 611;
  42484. t.oe = 944;
  42485. t.germandbls = 611;
  42486. t.Idieresis = 278;
  42487. t.eacute = 556;
  42488. t.abreve = 556;
  42489. t.uhungarumlaut = 611;
  42490. t.ecaron = 556;
  42491. t.Ydieresis = 667;
  42492. t.divide = 584;
  42493. t.Yacute = 667;
  42494. t.Acircumflex = 722;
  42495. t.aacute = 556;
  42496. t.Ucircumflex = 722;
  42497. t.yacute = 556;
  42498. t.scommaaccent = 556;
  42499. t.ecircumflex = 556;
  42500. t.Uring = 722;
  42501. t.Udieresis = 722;
  42502. t.aogonek = 556;
  42503. t.Uacute = 722;
  42504. t.uogonek = 611;
  42505. t.Edieresis = 667;
  42506. t.Dcroat = 722;
  42507. t.commaaccent = 250;
  42508. t.copyright = 737;
  42509. t.Emacron = 667;
  42510. t.ccaron = 556;
  42511. t.aring = 556;
  42512. t.Ncommaaccent = 722;
  42513. t.lacute = 278;
  42514. t.agrave = 556;
  42515. t.Tcommaaccent = 611;
  42516. t.Cacute = 722;
  42517. t.atilde = 556;
  42518. t.Edotaccent = 667;
  42519. t.scaron = 556;
  42520. t.scedilla = 556;
  42521. t.iacute = 278;
  42522. t.lozenge = 494;
  42523. t.Rcaron = 722;
  42524. t.Gcommaaccent = 778;
  42525. t.ucircumflex = 611;
  42526. t.acircumflex = 556;
  42527. t.Amacron = 722;
  42528. t.rcaron = 389;
  42529. t.ccedilla = 556;
  42530. t.Zdotaccent = 611;
  42531. t.Thorn = 667;
  42532. t.Omacron = 778;
  42533. t.Racute = 722;
  42534. t.Sacute = 667;
  42535. t.dcaron = 743;
  42536. t.Umacron = 722;
  42537. t.uring = 611;
  42538. t.threesuperior = 333;
  42539. t.Ograve = 778;
  42540. t.Agrave = 722;
  42541. t.Abreve = 722;
  42542. t.multiply = 584;
  42543. t.uacute = 611;
  42544. t.Tcaron = 611;
  42545. t.partialdiff = 494;
  42546. t.ydieresis = 556;
  42547. t.Nacute = 722;
  42548. t.icircumflex = 278;
  42549. t.Ecircumflex = 667;
  42550. t.adieresis = 556;
  42551. t.edieresis = 556;
  42552. t.cacute = 556;
  42553. t.nacute = 611;
  42554. t.umacron = 611;
  42555. t.Ncaron = 722;
  42556. t.Iacute = 278;
  42557. t.plusminus = 584;
  42558. t.brokenbar = 280;
  42559. t.registered = 737;
  42560. t.Gbreve = 778;
  42561. t.Idotaccent = 278;
  42562. t.summation = 600;
  42563. t.Egrave = 667;
  42564. t.racute = 389;
  42565. t.omacron = 611;
  42566. t.Zacute = 611;
  42567. t.Zcaron = 611;
  42568. t.greaterequal = 549;
  42569. t.Eth = 722;
  42570. t.Ccedilla = 722;
  42571. t.lcommaaccent = 278;
  42572. t.tcaron = 389;
  42573. t.eogonek = 556;
  42574. t.Uogonek = 722;
  42575. t.Aacute = 722;
  42576. t.Adieresis = 722;
  42577. t.egrave = 556;
  42578. t.zacute = 500;
  42579. t.iogonek = 278;
  42580. t.Oacute = 778;
  42581. t.oacute = 611;
  42582. t.amacron = 556;
  42583. t.sacute = 556;
  42584. t.idieresis = 278;
  42585. t.Ocircumflex = 778;
  42586. t.Ugrave = 722;
  42587. t.Delta = 612;
  42588. t.thorn = 611;
  42589. t.twosuperior = 333;
  42590. t.Odieresis = 778;
  42591. t.mu = 611;
  42592. t.igrave = 278;
  42593. t.ohungarumlaut = 611;
  42594. t.Eogonek = 667;
  42595. t.dcroat = 611;
  42596. t.threequarters = 834;
  42597. t.Scedilla = 667;
  42598. t.lcaron = 400;
  42599. t.Kcommaaccent = 722;
  42600. t.Lacute = 611;
  42601. t.trademark = 1000;
  42602. t.edotaccent = 556;
  42603. t.Igrave = 278;
  42604. t.Imacron = 278;
  42605. t.Lcaron = 611;
  42606. t.onehalf = 834;
  42607. t.lessequal = 549;
  42608. t.ocircumflex = 611;
  42609. t.ntilde = 611;
  42610. t.Uhungarumlaut = 722;
  42611. t.Eacute = 667;
  42612. t.emacron = 556;
  42613. t.gbreve = 611;
  42614. t.onequarter = 834;
  42615. t.Scaron = 667;
  42616. t.Scommaaccent = 667;
  42617. t.Ohungarumlaut = 778;
  42618. t.degree = 400;
  42619. t.ograve = 611;
  42620. t.Ccaron = 722;
  42621. t.ugrave = 611;
  42622. t.radical = 549;
  42623. t.Dcaron = 722;
  42624. t.rcommaaccent = 389;
  42625. t.Ntilde = 722;
  42626. t.otilde = 611;
  42627. t.Rcommaaccent = 722;
  42628. t.Lcommaaccent = 611;
  42629. t.Atilde = 722;
  42630. t.Aogonek = 722;
  42631. t.Aring = 722;
  42632. t.Otilde = 778;
  42633. t.zdotaccent = 500;
  42634. t.Ecaron = 667;
  42635. t.Iogonek = 278;
  42636. t.kcommaaccent = 556;
  42637. t.minus = 584;
  42638. t.Icircumflex = 278;
  42639. t.ncaron = 611;
  42640. t.tcommaaccent = 333;
  42641. t.logicalnot = 584;
  42642. t.odieresis = 611;
  42643. t.udieresis = 611;
  42644. t.notequal = 549;
  42645. t.gcommaaccent = 611;
  42646. t.eth = 611;
  42647. t.zcaron = 500;
  42648. t.ncommaaccent = 611;
  42649. t.onesuperior = 333;
  42650. t.imacron = 278;
  42651. t.Euro = 556;
  42652. });
  42653. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42654. t.space = 278;
  42655. t.exclam = 278;
  42656. t.quotedbl = 355;
  42657. t.numbersign = 556;
  42658. t.dollar = 556;
  42659. t.percent = 889;
  42660. t.ampersand = 667;
  42661. t.quoteright = 222;
  42662. t.parenleft = 333;
  42663. t.parenright = 333;
  42664. t.asterisk = 389;
  42665. t.plus = 584;
  42666. t.comma = 278;
  42667. t.hyphen = 333;
  42668. t.period = 278;
  42669. t.slash = 278;
  42670. t.zero = 556;
  42671. t.one = 556;
  42672. t.two = 556;
  42673. t.three = 556;
  42674. t.four = 556;
  42675. t.five = 556;
  42676. t.six = 556;
  42677. t.seven = 556;
  42678. t.eight = 556;
  42679. t.nine = 556;
  42680. t.colon = 278;
  42681. t.semicolon = 278;
  42682. t.less = 584;
  42683. t.equal = 584;
  42684. t.greater = 584;
  42685. t.question = 556;
  42686. t.at = 1015;
  42687. t.A = 667;
  42688. t.B = 667;
  42689. t.C = 722;
  42690. t.D = 722;
  42691. t.E = 667;
  42692. t.F = 611;
  42693. t.G = 778;
  42694. t.H = 722;
  42695. t.I = 278;
  42696. t.J = 500;
  42697. t.K = 667;
  42698. t.L = 556;
  42699. t.M = 833;
  42700. t.N = 722;
  42701. t.O = 778;
  42702. t.P = 667;
  42703. t.Q = 778;
  42704. t.R = 722;
  42705. t.S = 667;
  42706. t.T = 611;
  42707. t.U = 722;
  42708. t.V = 667;
  42709. t.W = 944;
  42710. t.X = 667;
  42711. t.Y = 667;
  42712. t.Z = 611;
  42713. t.bracketleft = 278;
  42714. t.backslash = 278;
  42715. t.bracketright = 278;
  42716. t.asciicircum = 469;
  42717. t.underscore = 556;
  42718. t.quoteleft = 222;
  42719. t.a = 556;
  42720. t.b = 556;
  42721. t.c = 500;
  42722. t.d = 556;
  42723. t.e = 556;
  42724. t.f = 278;
  42725. t.g = 556;
  42726. t.h = 556;
  42727. t.i = 222;
  42728. t.j = 222;
  42729. t.k = 500;
  42730. t.l = 222;
  42731. t.m = 833;
  42732. t.n = 556;
  42733. t.o = 556;
  42734. t.p = 556;
  42735. t.q = 556;
  42736. t.r = 333;
  42737. t.s = 500;
  42738. t.t = 278;
  42739. t.u = 556;
  42740. t.v = 500;
  42741. t.w = 722;
  42742. t.x = 500;
  42743. t.y = 500;
  42744. t.z = 500;
  42745. t.braceleft = 334;
  42746. t.bar = 260;
  42747. t.braceright = 334;
  42748. t.asciitilde = 584;
  42749. t.exclamdown = 333;
  42750. t.cent = 556;
  42751. t.sterling = 556;
  42752. t.fraction = 167;
  42753. t.yen = 556;
  42754. t.florin = 556;
  42755. t.section = 556;
  42756. t.currency = 556;
  42757. t.quotesingle = 191;
  42758. t.quotedblleft = 333;
  42759. t.guillemotleft = 556;
  42760. t.guilsinglleft = 333;
  42761. t.guilsinglright = 333;
  42762. t.fi = 500;
  42763. t.fl = 500;
  42764. t.endash = 556;
  42765. t.dagger = 556;
  42766. t.daggerdbl = 556;
  42767. t.periodcentered = 278;
  42768. t.paragraph = 537;
  42769. t.bullet = 350;
  42770. t.quotesinglbase = 222;
  42771. t.quotedblbase = 333;
  42772. t.quotedblright = 333;
  42773. t.guillemotright = 556;
  42774. t.ellipsis = 1000;
  42775. t.perthousand = 1000;
  42776. t.questiondown = 611;
  42777. t.grave = 333;
  42778. t.acute = 333;
  42779. t.circumflex = 333;
  42780. t.tilde = 333;
  42781. t.macron = 333;
  42782. t.breve = 333;
  42783. t.dotaccent = 333;
  42784. t.dieresis = 333;
  42785. t.ring = 333;
  42786. t.cedilla = 333;
  42787. t.hungarumlaut = 333;
  42788. t.ogonek = 333;
  42789. t.caron = 333;
  42790. t.emdash = 1000;
  42791. t.AE = 1000;
  42792. t.ordfeminine = 370;
  42793. t.Lslash = 556;
  42794. t.Oslash = 778;
  42795. t.OE = 1000;
  42796. t.ordmasculine = 365;
  42797. t.ae = 889;
  42798. t.dotlessi = 278;
  42799. t.lslash = 222;
  42800. t.oslash = 611;
  42801. t.oe = 944;
  42802. t.germandbls = 611;
  42803. t.Idieresis = 278;
  42804. t.eacute = 556;
  42805. t.abreve = 556;
  42806. t.uhungarumlaut = 556;
  42807. t.ecaron = 556;
  42808. t.Ydieresis = 667;
  42809. t.divide = 584;
  42810. t.Yacute = 667;
  42811. t.Acircumflex = 667;
  42812. t.aacute = 556;
  42813. t.Ucircumflex = 722;
  42814. t.yacute = 500;
  42815. t.scommaaccent = 500;
  42816. t.ecircumflex = 556;
  42817. t.Uring = 722;
  42818. t.Udieresis = 722;
  42819. t.aogonek = 556;
  42820. t.Uacute = 722;
  42821. t.uogonek = 556;
  42822. t.Edieresis = 667;
  42823. t.Dcroat = 722;
  42824. t.commaaccent = 250;
  42825. t.copyright = 737;
  42826. t.Emacron = 667;
  42827. t.ccaron = 500;
  42828. t.aring = 556;
  42829. t.Ncommaaccent = 722;
  42830. t.lacute = 222;
  42831. t.agrave = 556;
  42832. t.Tcommaaccent = 611;
  42833. t.Cacute = 722;
  42834. t.atilde = 556;
  42835. t.Edotaccent = 667;
  42836. t.scaron = 500;
  42837. t.scedilla = 500;
  42838. t.iacute = 278;
  42839. t.lozenge = 471;
  42840. t.Rcaron = 722;
  42841. t.Gcommaaccent = 778;
  42842. t.ucircumflex = 556;
  42843. t.acircumflex = 556;
  42844. t.Amacron = 667;
  42845. t.rcaron = 333;
  42846. t.ccedilla = 500;
  42847. t.Zdotaccent = 611;
  42848. t.Thorn = 667;
  42849. t.Omacron = 778;
  42850. t.Racute = 722;
  42851. t.Sacute = 667;
  42852. t.dcaron = 643;
  42853. t.Umacron = 722;
  42854. t.uring = 556;
  42855. t.threesuperior = 333;
  42856. t.Ograve = 778;
  42857. t.Agrave = 667;
  42858. t.Abreve = 667;
  42859. t.multiply = 584;
  42860. t.uacute = 556;
  42861. t.Tcaron = 611;
  42862. t.partialdiff = 476;
  42863. t.ydieresis = 500;
  42864. t.Nacute = 722;
  42865. t.icircumflex = 278;
  42866. t.Ecircumflex = 667;
  42867. t.adieresis = 556;
  42868. t.edieresis = 556;
  42869. t.cacute = 500;
  42870. t.nacute = 556;
  42871. t.umacron = 556;
  42872. t.Ncaron = 722;
  42873. t.Iacute = 278;
  42874. t.plusminus = 584;
  42875. t.brokenbar = 260;
  42876. t.registered = 737;
  42877. t.Gbreve = 778;
  42878. t.Idotaccent = 278;
  42879. t.summation = 600;
  42880. t.Egrave = 667;
  42881. t.racute = 333;
  42882. t.omacron = 556;
  42883. t.Zacute = 611;
  42884. t.Zcaron = 611;
  42885. t.greaterequal = 549;
  42886. t.Eth = 722;
  42887. t.Ccedilla = 722;
  42888. t.lcommaaccent = 222;
  42889. t.tcaron = 317;
  42890. t.eogonek = 556;
  42891. t.Uogonek = 722;
  42892. t.Aacute = 667;
  42893. t.Adieresis = 667;
  42894. t.egrave = 556;
  42895. t.zacute = 500;
  42896. t.iogonek = 222;
  42897. t.Oacute = 778;
  42898. t.oacute = 556;
  42899. t.amacron = 556;
  42900. t.sacute = 500;
  42901. t.idieresis = 278;
  42902. t.Ocircumflex = 778;
  42903. t.Ugrave = 722;
  42904. t.Delta = 612;
  42905. t.thorn = 556;
  42906. t.twosuperior = 333;
  42907. t.Odieresis = 778;
  42908. t.mu = 556;
  42909. t.igrave = 278;
  42910. t.ohungarumlaut = 556;
  42911. t.Eogonek = 667;
  42912. t.dcroat = 556;
  42913. t.threequarters = 834;
  42914. t.Scedilla = 667;
  42915. t.lcaron = 299;
  42916. t.Kcommaaccent = 667;
  42917. t.Lacute = 556;
  42918. t.trademark = 1000;
  42919. t.edotaccent = 556;
  42920. t.Igrave = 278;
  42921. t.Imacron = 278;
  42922. t.Lcaron = 556;
  42923. t.onehalf = 834;
  42924. t.lessequal = 549;
  42925. t.ocircumflex = 556;
  42926. t.ntilde = 556;
  42927. t.Uhungarumlaut = 722;
  42928. t.Eacute = 667;
  42929. t.emacron = 556;
  42930. t.gbreve = 556;
  42931. t.onequarter = 834;
  42932. t.Scaron = 667;
  42933. t.Scommaaccent = 667;
  42934. t.Ohungarumlaut = 778;
  42935. t.degree = 400;
  42936. t.ograve = 556;
  42937. t.Ccaron = 722;
  42938. t.ugrave = 556;
  42939. t.radical = 453;
  42940. t.Dcaron = 722;
  42941. t.rcommaaccent = 333;
  42942. t.Ntilde = 722;
  42943. t.otilde = 556;
  42944. t.Rcommaaccent = 722;
  42945. t.Lcommaaccent = 556;
  42946. t.Atilde = 667;
  42947. t.Aogonek = 667;
  42948. t.Aring = 667;
  42949. t.Otilde = 778;
  42950. t.zdotaccent = 500;
  42951. t.Ecaron = 667;
  42952. t.Iogonek = 278;
  42953. t.kcommaaccent = 500;
  42954. t.minus = 584;
  42955. t.Icircumflex = 278;
  42956. t.ncaron = 556;
  42957. t.tcommaaccent = 278;
  42958. t.logicalnot = 584;
  42959. t.odieresis = 556;
  42960. t.udieresis = 556;
  42961. t.notequal = 549;
  42962. t.gcommaaccent = 556;
  42963. t.eth = 556;
  42964. t.zcaron = 500;
  42965. t.ncommaaccent = 556;
  42966. t.onesuperior = 333;
  42967. t.imacron = 278;
  42968. t.Euro = 556;
  42969. });
  42970. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  42971. t.space = 250;
  42972. t.exclam = 333;
  42973. t.universal = 713;
  42974. t.numbersign = 500;
  42975. t.existential = 549;
  42976. t.percent = 833;
  42977. t.ampersand = 778;
  42978. t.suchthat = 439;
  42979. t.parenleft = 333;
  42980. t.parenright = 333;
  42981. t.asteriskmath = 500;
  42982. t.plus = 549;
  42983. t.comma = 250;
  42984. t.minus = 549;
  42985. t.period = 250;
  42986. t.slash = 278;
  42987. t.zero = 500;
  42988. t.one = 500;
  42989. t.two = 500;
  42990. t.three = 500;
  42991. t.four = 500;
  42992. t.five = 500;
  42993. t.six = 500;
  42994. t.seven = 500;
  42995. t.eight = 500;
  42996. t.nine = 500;
  42997. t.colon = 278;
  42998. t.semicolon = 278;
  42999. t.less = 549;
  43000. t.equal = 549;
  43001. t.greater = 549;
  43002. t.question = 444;
  43003. t.congruent = 549;
  43004. t.Alpha = 722;
  43005. t.Beta = 667;
  43006. t.Chi = 722;
  43007. t.Delta = 612;
  43008. t.Epsilon = 611;
  43009. t.Phi = 763;
  43010. t.Gamma = 603;
  43011. t.Eta = 722;
  43012. t.Iota = 333;
  43013. t.theta1 = 631;
  43014. t.Kappa = 722;
  43015. t.Lambda = 686;
  43016. t.Mu = 889;
  43017. t.Nu = 722;
  43018. t.Omicron = 722;
  43019. t.Pi = 768;
  43020. t.Theta = 741;
  43021. t.Rho = 556;
  43022. t.Sigma = 592;
  43023. t.Tau = 611;
  43024. t.Upsilon = 690;
  43025. t.sigma1 = 439;
  43026. t.Omega = 768;
  43027. t.Xi = 645;
  43028. t.Psi = 795;
  43029. t.Zeta = 611;
  43030. t.bracketleft = 333;
  43031. t.therefore = 863;
  43032. t.bracketright = 333;
  43033. t.perpendicular = 658;
  43034. t.underscore = 500;
  43035. t.radicalex = 500;
  43036. t.alpha = 631;
  43037. t.beta = 549;
  43038. t.chi = 549;
  43039. t.delta = 494;
  43040. t.epsilon = 439;
  43041. t.phi = 521;
  43042. t.gamma = 411;
  43043. t.eta = 603;
  43044. t.iota = 329;
  43045. t.phi1 = 603;
  43046. t.kappa = 549;
  43047. t.lambda = 549;
  43048. t.mu = 576;
  43049. t.nu = 521;
  43050. t.omicron = 549;
  43051. t.pi = 549;
  43052. t.theta = 521;
  43053. t.rho = 549;
  43054. t.sigma = 603;
  43055. t.tau = 439;
  43056. t.upsilon = 576;
  43057. t.omega1 = 713;
  43058. t.omega = 686;
  43059. t.xi = 493;
  43060. t.psi = 686;
  43061. t.zeta = 494;
  43062. t.braceleft = 480;
  43063. t.bar = 200;
  43064. t.braceright = 480;
  43065. t.similar = 549;
  43066. t.Euro = 750;
  43067. t.Upsilon1 = 620;
  43068. t.minute = 247;
  43069. t.lessequal = 549;
  43070. t.fraction = 167;
  43071. t.infinity = 713;
  43072. t.florin = 500;
  43073. t.club = 753;
  43074. t.diamond = 753;
  43075. t.heart = 753;
  43076. t.spade = 753;
  43077. t.arrowboth = 1042;
  43078. t.arrowleft = 987;
  43079. t.arrowup = 603;
  43080. t.arrowright = 987;
  43081. t.arrowdown = 603;
  43082. t.degree = 400;
  43083. t.plusminus = 549;
  43084. t.second = 411;
  43085. t.greaterequal = 549;
  43086. t.multiply = 549;
  43087. t.proportional = 713;
  43088. t.partialdiff = 494;
  43089. t.bullet = 460;
  43090. t.divide = 549;
  43091. t.notequal = 549;
  43092. t.equivalence = 549;
  43093. t.approxequal = 549;
  43094. t.ellipsis = 1000;
  43095. t.arrowvertex = 603;
  43096. t.arrowhorizex = 1000;
  43097. t.carriagereturn = 658;
  43098. t.aleph = 823;
  43099. t.Ifraktur = 686;
  43100. t.Rfraktur = 795;
  43101. t.weierstrass = 987;
  43102. t.circlemultiply = 768;
  43103. t.circleplus = 768;
  43104. t.emptyset = 823;
  43105. t.intersection = 768;
  43106. t.union = 768;
  43107. t.propersuperset = 713;
  43108. t.reflexsuperset = 713;
  43109. t.notsubset = 713;
  43110. t.propersubset = 713;
  43111. t.reflexsubset = 713;
  43112. t.element = 713;
  43113. t.notelement = 713;
  43114. t.angle = 768;
  43115. t.gradient = 713;
  43116. t.registerserif = 790;
  43117. t.copyrightserif = 790;
  43118. t.trademarkserif = 890;
  43119. t.product = 823;
  43120. t.radical = 549;
  43121. t.dotmath = 250;
  43122. t.logicalnot = 713;
  43123. t.logicaland = 603;
  43124. t.logicalor = 603;
  43125. t.arrowdblboth = 1042;
  43126. t.arrowdblleft = 987;
  43127. t.arrowdblup = 603;
  43128. t.arrowdblright = 987;
  43129. t.arrowdbldown = 603;
  43130. t.lozenge = 494;
  43131. t.angleleft = 329;
  43132. t.registersans = 790;
  43133. t.copyrightsans = 790;
  43134. t.trademarksans = 786;
  43135. t.summation = 713;
  43136. t.parenlefttp = 384;
  43137. t.parenleftex = 384;
  43138. t.parenleftbt = 384;
  43139. t.bracketlefttp = 384;
  43140. t.bracketleftex = 384;
  43141. t.bracketleftbt = 384;
  43142. t.bracelefttp = 494;
  43143. t.braceleftmid = 494;
  43144. t.braceleftbt = 494;
  43145. t.braceex = 494;
  43146. t.angleright = 329;
  43147. t.integral = 274;
  43148. t.integraltp = 686;
  43149. t.integralex = 686;
  43150. t.integralbt = 686;
  43151. t.parenrighttp = 384;
  43152. t.parenrightex = 384;
  43153. t.parenrightbt = 384;
  43154. t.bracketrighttp = 384;
  43155. t.bracketrightex = 384;
  43156. t.bracketrightbt = 384;
  43157. t.bracerighttp = 494;
  43158. t.bracerightmid = 494;
  43159. t.bracerightbt = 494;
  43160. t.apple = 790;
  43161. });
  43162. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43163. t.space = 250;
  43164. t.exclam = 333;
  43165. t.quotedbl = 408;
  43166. t.numbersign = 500;
  43167. t.dollar = 500;
  43168. t.percent = 833;
  43169. t.ampersand = 778;
  43170. t.quoteright = 333;
  43171. t.parenleft = 333;
  43172. t.parenright = 333;
  43173. t.asterisk = 500;
  43174. t.plus = 564;
  43175. t.comma = 250;
  43176. t.hyphen = 333;
  43177. t.period = 250;
  43178. t.slash = 278;
  43179. t.zero = 500;
  43180. t.one = 500;
  43181. t.two = 500;
  43182. t.three = 500;
  43183. t.four = 500;
  43184. t.five = 500;
  43185. t.six = 500;
  43186. t.seven = 500;
  43187. t.eight = 500;
  43188. t.nine = 500;
  43189. t.colon = 278;
  43190. t.semicolon = 278;
  43191. t.less = 564;
  43192. t.equal = 564;
  43193. t.greater = 564;
  43194. t.question = 444;
  43195. t.at = 921;
  43196. t.A = 722;
  43197. t.B = 667;
  43198. t.C = 667;
  43199. t.D = 722;
  43200. t.E = 611;
  43201. t.F = 556;
  43202. t.G = 722;
  43203. t.H = 722;
  43204. t.I = 333;
  43205. t.J = 389;
  43206. t.K = 722;
  43207. t.L = 611;
  43208. t.M = 889;
  43209. t.N = 722;
  43210. t.O = 722;
  43211. t.P = 556;
  43212. t.Q = 722;
  43213. t.R = 667;
  43214. t.S = 556;
  43215. t.T = 611;
  43216. t.U = 722;
  43217. t.V = 722;
  43218. t.W = 944;
  43219. t.X = 722;
  43220. t.Y = 722;
  43221. t.Z = 611;
  43222. t.bracketleft = 333;
  43223. t.backslash = 278;
  43224. t.bracketright = 333;
  43225. t.asciicircum = 469;
  43226. t.underscore = 500;
  43227. t.quoteleft = 333;
  43228. t.a = 444;
  43229. t.b = 500;
  43230. t.c = 444;
  43231. t.d = 500;
  43232. t.e = 444;
  43233. t.f = 333;
  43234. t.g = 500;
  43235. t.h = 500;
  43236. t.i = 278;
  43237. t.j = 278;
  43238. t.k = 500;
  43239. t.l = 278;
  43240. t.m = 778;
  43241. t.n = 500;
  43242. t.o = 500;
  43243. t.p = 500;
  43244. t.q = 500;
  43245. t.r = 333;
  43246. t.s = 389;
  43247. t.t = 278;
  43248. t.u = 500;
  43249. t.v = 500;
  43250. t.w = 722;
  43251. t.x = 500;
  43252. t.y = 500;
  43253. t.z = 444;
  43254. t.braceleft = 480;
  43255. t.bar = 200;
  43256. t.braceright = 480;
  43257. t.asciitilde = 541;
  43258. t.exclamdown = 333;
  43259. t.cent = 500;
  43260. t.sterling = 500;
  43261. t.fraction = 167;
  43262. t.yen = 500;
  43263. t.florin = 500;
  43264. t.section = 500;
  43265. t.currency = 500;
  43266. t.quotesingle = 180;
  43267. t.quotedblleft = 444;
  43268. t.guillemotleft = 500;
  43269. t.guilsinglleft = 333;
  43270. t.guilsinglright = 333;
  43271. t.fi = 556;
  43272. t.fl = 556;
  43273. t.endash = 500;
  43274. t.dagger = 500;
  43275. t.daggerdbl = 500;
  43276. t.periodcentered = 250;
  43277. t.paragraph = 453;
  43278. t.bullet = 350;
  43279. t.quotesinglbase = 333;
  43280. t.quotedblbase = 444;
  43281. t.quotedblright = 444;
  43282. t.guillemotright = 500;
  43283. t.ellipsis = 1000;
  43284. t.perthousand = 1000;
  43285. t.questiondown = 444;
  43286. t.grave = 333;
  43287. t.acute = 333;
  43288. t.circumflex = 333;
  43289. t.tilde = 333;
  43290. t.macron = 333;
  43291. t.breve = 333;
  43292. t.dotaccent = 333;
  43293. t.dieresis = 333;
  43294. t.ring = 333;
  43295. t.cedilla = 333;
  43296. t.hungarumlaut = 333;
  43297. t.ogonek = 333;
  43298. t.caron = 333;
  43299. t.emdash = 1000;
  43300. t.AE = 889;
  43301. t.ordfeminine = 276;
  43302. t.Lslash = 611;
  43303. t.Oslash = 722;
  43304. t.OE = 889;
  43305. t.ordmasculine = 310;
  43306. t.ae = 667;
  43307. t.dotlessi = 278;
  43308. t.lslash = 278;
  43309. t.oslash = 500;
  43310. t.oe = 722;
  43311. t.germandbls = 500;
  43312. t.Idieresis = 333;
  43313. t.eacute = 444;
  43314. t.abreve = 444;
  43315. t.uhungarumlaut = 500;
  43316. t.ecaron = 444;
  43317. t.Ydieresis = 722;
  43318. t.divide = 564;
  43319. t.Yacute = 722;
  43320. t.Acircumflex = 722;
  43321. t.aacute = 444;
  43322. t.Ucircumflex = 722;
  43323. t.yacute = 500;
  43324. t.scommaaccent = 389;
  43325. t.ecircumflex = 444;
  43326. t.Uring = 722;
  43327. t.Udieresis = 722;
  43328. t.aogonek = 444;
  43329. t.Uacute = 722;
  43330. t.uogonek = 500;
  43331. t.Edieresis = 611;
  43332. t.Dcroat = 722;
  43333. t.commaaccent = 250;
  43334. t.copyright = 760;
  43335. t.Emacron = 611;
  43336. t.ccaron = 444;
  43337. t.aring = 444;
  43338. t.Ncommaaccent = 722;
  43339. t.lacute = 278;
  43340. t.agrave = 444;
  43341. t.Tcommaaccent = 611;
  43342. t.Cacute = 667;
  43343. t.atilde = 444;
  43344. t.Edotaccent = 611;
  43345. t.scaron = 389;
  43346. t.scedilla = 389;
  43347. t.iacute = 278;
  43348. t.lozenge = 471;
  43349. t.Rcaron = 667;
  43350. t.Gcommaaccent = 722;
  43351. t.ucircumflex = 500;
  43352. t.acircumflex = 444;
  43353. t.Amacron = 722;
  43354. t.rcaron = 333;
  43355. t.ccedilla = 444;
  43356. t.Zdotaccent = 611;
  43357. t.Thorn = 556;
  43358. t.Omacron = 722;
  43359. t.Racute = 667;
  43360. t.Sacute = 556;
  43361. t.dcaron = 588;
  43362. t.Umacron = 722;
  43363. t.uring = 500;
  43364. t.threesuperior = 300;
  43365. t.Ograve = 722;
  43366. t.Agrave = 722;
  43367. t.Abreve = 722;
  43368. t.multiply = 564;
  43369. t.uacute = 500;
  43370. t.Tcaron = 611;
  43371. t.partialdiff = 476;
  43372. t.ydieresis = 500;
  43373. t.Nacute = 722;
  43374. t.icircumflex = 278;
  43375. t.Ecircumflex = 611;
  43376. t.adieresis = 444;
  43377. t.edieresis = 444;
  43378. t.cacute = 444;
  43379. t.nacute = 500;
  43380. t.umacron = 500;
  43381. t.Ncaron = 722;
  43382. t.Iacute = 333;
  43383. t.plusminus = 564;
  43384. t.brokenbar = 200;
  43385. t.registered = 760;
  43386. t.Gbreve = 722;
  43387. t.Idotaccent = 333;
  43388. t.summation = 600;
  43389. t.Egrave = 611;
  43390. t.racute = 333;
  43391. t.omacron = 500;
  43392. t.Zacute = 611;
  43393. t.Zcaron = 611;
  43394. t.greaterequal = 549;
  43395. t.Eth = 722;
  43396. t.Ccedilla = 667;
  43397. t.lcommaaccent = 278;
  43398. t.tcaron = 326;
  43399. t.eogonek = 444;
  43400. t.Uogonek = 722;
  43401. t.Aacute = 722;
  43402. t.Adieresis = 722;
  43403. t.egrave = 444;
  43404. t.zacute = 444;
  43405. t.iogonek = 278;
  43406. t.Oacute = 722;
  43407. t.oacute = 500;
  43408. t.amacron = 444;
  43409. t.sacute = 389;
  43410. t.idieresis = 278;
  43411. t.Ocircumflex = 722;
  43412. t.Ugrave = 722;
  43413. t.Delta = 612;
  43414. t.thorn = 500;
  43415. t.twosuperior = 300;
  43416. t.Odieresis = 722;
  43417. t.mu = 500;
  43418. t.igrave = 278;
  43419. t.ohungarumlaut = 500;
  43420. t.Eogonek = 611;
  43421. t.dcroat = 500;
  43422. t.threequarters = 750;
  43423. t.Scedilla = 556;
  43424. t.lcaron = 344;
  43425. t.Kcommaaccent = 722;
  43426. t.Lacute = 611;
  43427. t.trademark = 980;
  43428. t.edotaccent = 444;
  43429. t.Igrave = 333;
  43430. t.Imacron = 333;
  43431. t.Lcaron = 611;
  43432. t.onehalf = 750;
  43433. t.lessequal = 549;
  43434. t.ocircumflex = 500;
  43435. t.ntilde = 500;
  43436. t.Uhungarumlaut = 722;
  43437. t.Eacute = 611;
  43438. t.emacron = 444;
  43439. t.gbreve = 500;
  43440. t.onequarter = 750;
  43441. t.Scaron = 556;
  43442. t.Scommaaccent = 556;
  43443. t.Ohungarumlaut = 722;
  43444. t.degree = 400;
  43445. t.ograve = 500;
  43446. t.Ccaron = 667;
  43447. t.ugrave = 500;
  43448. t.radical = 453;
  43449. t.Dcaron = 722;
  43450. t.rcommaaccent = 333;
  43451. t.Ntilde = 722;
  43452. t.otilde = 500;
  43453. t.Rcommaaccent = 667;
  43454. t.Lcommaaccent = 611;
  43455. t.Atilde = 722;
  43456. t.Aogonek = 722;
  43457. t.Aring = 722;
  43458. t.Otilde = 722;
  43459. t.zdotaccent = 444;
  43460. t.Ecaron = 611;
  43461. t.Iogonek = 333;
  43462. t.kcommaaccent = 500;
  43463. t.minus = 564;
  43464. t.Icircumflex = 333;
  43465. t.ncaron = 500;
  43466. t.tcommaaccent = 278;
  43467. t.logicalnot = 564;
  43468. t.odieresis = 500;
  43469. t.udieresis = 500;
  43470. t.notequal = 549;
  43471. t.gcommaaccent = 500;
  43472. t.eth = 500;
  43473. t.zcaron = 444;
  43474. t.ncommaaccent = 500;
  43475. t.onesuperior = 300;
  43476. t.imacron = 278;
  43477. t.Euro = 500;
  43478. });
  43479. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43480. t.space = 250;
  43481. t.exclam = 333;
  43482. t.quotedbl = 555;
  43483. t.numbersign = 500;
  43484. t.dollar = 500;
  43485. t.percent = 1000;
  43486. t.ampersand = 833;
  43487. t.quoteright = 333;
  43488. t.parenleft = 333;
  43489. t.parenright = 333;
  43490. t.asterisk = 500;
  43491. t.plus = 570;
  43492. t.comma = 250;
  43493. t.hyphen = 333;
  43494. t.period = 250;
  43495. t.slash = 278;
  43496. t.zero = 500;
  43497. t.one = 500;
  43498. t.two = 500;
  43499. t.three = 500;
  43500. t.four = 500;
  43501. t.five = 500;
  43502. t.six = 500;
  43503. t.seven = 500;
  43504. t.eight = 500;
  43505. t.nine = 500;
  43506. t.colon = 333;
  43507. t.semicolon = 333;
  43508. t.less = 570;
  43509. t.equal = 570;
  43510. t.greater = 570;
  43511. t.question = 500;
  43512. t.at = 930;
  43513. t.A = 722;
  43514. t.B = 667;
  43515. t.C = 722;
  43516. t.D = 722;
  43517. t.E = 667;
  43518. t.F = 611;
  43519. t.G = 778;
  43520. t.H = 778;
  43521. t.I = 389;
  43522. t.J = 500;
  43523. t.K = 778;
  43524. t.L = 667;
  43525. t.M = 944;
  43526. t.N = 722;
  43527. t.O = 778;
  43528. t.P = 611;
  43529. t.Q = 778;
  43530. t.R = 722;
  43531. t.S = 556;
  43532. t.T = 667;
  43533. t.U = 722;
  43534. t.V = 722;
  43535. t.W = 1000;
  43536. t.X = 722;
  43537. t.Y = 722;
  43538. t.Z = 667;
  43539. t.bracketleft = 333;
  43540. t.backslash = 278;
  43541. t.bracketright = 333;
  43542. t.asciicircum = 581;
  43543. t.underscore = 500;
  43544. t.quoteleft = 333;
  43545. t.a = 500;
  43546. t.b = 556;
  43547. t.c = 444;
  43548. t.d = 556;
  43549. t.e = 444;
  43550. t.f = 333;
  43551. t.g = 500;
  43552. t.h = 556;
  43553. t.i = 278;
  43554. t.j = 333;
  43555. t.k = 556;
  43556. t.l = 278;
  43557. t.m = 833;
  43558. t.n = 556;
  43559. t.o = 500;
  43560. t.p = 556;
  43561. t.q = 556;
  43562. t.r = 444;
  43563. t.s = 389;
  43564. t.t = 333;
  43565. t.u = 556;
  43566. t.v = 500;
  43567. t.w = 722;
  43568. t.x = 500;
  43569. t.y = 500;
  43570. t.z = 444;
  43571. t.braceleft = 394;
  43572. t.bar = 220;
  43573. t.braceright = 394;
  43574. t.asciitilde = 520;
  43575. t.exclamdown = 333;
  43576. t.cent = 500;
  43577. t.sterling = 500;
  43578. t.fraction = 167;
  43579. t.yen = 500;
  43580. t.florin = 500;
  43581. t.section = 500;
  43582. t.currency = 500;
  43583. t.quotesingle = 278;
  43584. t.quotedblleft = 500;
  43585. t.guillemotleft = 500;
  43586. t.guilsinglleft = 333;
  43587. t.guilsinglright = 333;
  43588. t.fi = 556;
  43589. t.fl = 556;
  43590. t.endash = 500;
  43591. t.dagger = 500;
  43592. t.daggerdbl = 500;
  43593. t.periodcentered = 250;
  43594. t.paragraph = 540;
  43595. t.bullet = 350;
  43596. t.quotesinglbase = 333;
  43597. t.quotedblbase = 500;
  43598. t.quotedblright = 500;
  43599. t.guillemotright = 500;
  43600. t.ellipsis = 1000;
  43601. t.perthousand = 1000;
  43602. t.questiondown = 500;
  43603. t.grave = 333;
  43604. t.acute = 333;
  43605. t.circumflex = 333;
  43606. t.tilde = 333;
  43607. t.macron = 333;
  43608. t.breve = 333;
  43609. t.dotaccent = 333;
  43610. t.dieresis = 333;
  43611. t.ring = 333;
  43612. t.cedilla = 333;
  43613. t.hungarumlaut = 333;
  43614. t.ogonek = 333;
  43615. t.caron = 333;
  43616. t.emdash = 1000;
  43617. t.AE = 1000;
  43618. t.ordfeminine = 300;
  43619. t.Lslash = 667;
  43620. t.Oslash = 778;
  43621. t.OE = 1000;
  43622. t.ordmasculine = 330;
  43623. t.ae = 722;
  43624. t.dotlessi = 278;
  43625. t.lslash = 278;
  43626. t.oslash = 500;
  43627. t.oe = 722;
  43628. t.germandbls = 556;
  43629. t.Idieresis = 389;
  43630. t.eacute = 444;
  43631. t.abreve = 500;
  43632. t.uhungarumlaut = 556;
  43633. t.ecaron = 444;
  43634. t.Ydieresis = 722;
  43635. t.divide = 570;
  43636. t.Yacute = 722;
  43637. t.Acircumflex = 722;
  43638. t.aacute = 500;
  43639. t.Ucircumflex = 722;
  43640. t.yacute = 500;
  43641. t.scommaaccent = 389;
  43642. t.ecircumflex = 444;
  43643. t.Uring = 722;
  43644. t.Udieresis = 722;
  43645. t.aogonek = 500;
  43646. t.Uacute = 722;
  43647. t.uogonek = 556;
  43648. t.Edieresis = 667;
  43649. t.Dcroat = 722;
  43650. t.commaaccent = 250;
  43651. t.copyright = 747;
  43652. t.Emacron = 667;
  43653. t.ccaron = 444;
  43654. t.aring = 500;
  43655. t.Ncommaaccent = 722;
  43656. t.lacute = 278;
  43657. t.agrave = 500;
  43658. t.Tcommaaccent = 667;
  43659. t.Cacute = 722;
  43660. t.atilde = 500;
  43661. t.Edotaccent = 667;
  43662. t.scaron = 389;
  43663. t.scedilla = 389;
  43664. t.iacute = 278;
  43665. t.lozenge = 494;
  43666. t.Rcaron = 722;
  43667. t.Gcommaaccent = 778;
  43668. t.ucircumflex = 556;
  43669. t.acircumflex = 500;
  43670. t.Amacron = 722;
  43671. t.rcaron = 444;
  43672. t.ccedilla = 444;
  43673. t.Zdotaccent = 667;
  43674. t.Thorn = 611;
  43675. t.Omacron = 778;
  43676. t.Racute = 722;
  43677. t.Sacute = 556;
  43678. t.dcaron = 672;
  43679. t.Umacron = 722;
  43680. t.uring = 556;
  43681. t.threesuperior = 300;
  43682. t.Ograve = 778;
  43683. t.Agrave = 722;
  43684. t.Abreve = 722;
  43685. t.multiply = 570;
  43686. t.uacute = 556;
  43687. t.Tcaron = 667;
  43688. t.partialdiff = 494;
  43689. t.ydieresis = 500;
  43690. t.Nacute = 722;
  43691. t.icircumflex = 278;
  43692. t.Ecircumflex = 667;
  43693. t.adieresis = 500;
  43694. t.edieresis = 444;
  43695. t.cacute = 444;
  43696. t.nacute = 556;
  43697. t.umacron = 556;
  43698. t.Ncaron = 722;
  43699. t.Iacute = 389;
  43700. t.plusminus = 570;
  43701. t.brokenbar = 220;
  43702. t.registered = 747;
  43703. t.Gbreve = 778;
  43704. t.Idotaccent = 389;
  43705. t.summation = 600;
  43706. t.Egrave = 667;
  43707. t.racute = 444;
  43708. t.omacron = 500;
  43709. t.Zacute = 667;
  43710. t.Zcaron = 667;
  43711. t.greaterequal = 549;
  43712. t.Eth = 722;
  43713. t.Ccedilla = 722;
  43714. t.lcommaaccent = 278;
  43715. t.tcaron = 416;
  43716. t.eogonek = 444;
  43717. t.Uogonek = 722;
  43718. t.Aacute = 722;
  43719. t.Adieresis = 722;
  43720. t.egrave = 444;
  43721. t.zacute = 444;
  43722. t.iogonek = 278;
  43723. t.Oacute = 778;
  43724. t.oacute = 500;
  43725. t.amacron = 500;
  43726. t.sacute = 389;
  43727. t.idieresis = 278;
  43728. t.Ocircumflex = 778;
  43729. t.Ugrave = 722;
  43730. t.Delta = 612;
  43731. t.thorn = 556;
  43732. t.twosuperior = 300;
  43733. t.Odieresis = 778;
  43734. t.mu = 556;
  43735. t.igrave = 278;
  43736. t.ohungarumlaut = 500;
  43737. t.Eogonek = 667;
  43738. t.dcroat = 556;
  43739. t.threequarters = 750;
  43740. t.Scedilla = 556;
  43741. t.lcaron = 394;
  43742. t.Kcommaaccent = 778;
  43743. t.Lacute = 667;
  43744. t.trademark = 1000;
  43745. t.edotaccent = 444;
  43746. t.Igrave = 389;
  43747. t.Imacron = 389;
  43748. t.Lcaron = 667;
  43749. t.onehalf = 750;
  43750. t.lessequal = 549;
  43751. t.ocircumflex = 500;
  43752. t.ntilde = 556;
  43753. t.Uhungarumlaut = 722;
  43754. t.Eacute = 667;
  43755. t.emacron = 444;
  43756. t.gbreve = 500;
  43757. t.onequarter = 750;
  43758. t.Scaron = 556;
  43759. t.Scommaaccent = 556;
  43760. t.Ohungarumlaut = 778;
  43761. t.degree = 400;
  43762. t.ograve = 500;
  43763. t.Ccaron = 722;
  43764. t.ugrave = 556;
  43765. t.radical = 549;
  43766. t.Dcaron = 722;
  43767. t.rcommaaccent = 444;
  43768. t.Ntilde = 722;
  43769. t.otilde = 500;
  43770. t.Rcommaaccent = 722;
  43771. t.Lcommaaccent = 667;
  43772. t.Atilde = 722;
  43773. t.Aogonek = 722;
  43774. t.Aring = 722;
  43775. t.Otilde = 778;
  43776. t.zdotaccent = 444;
  43777. t.Ecaron = 667;
  43778. t.Iogonek = 389;
  43779. t.kcommaaccent = 556;
  43780. t.minus = 570;
  43781. t.Icircumflex = 389;
  43782. t.ncaron = 556;
  43783. t.tcommaaccent = 333;
  43784. t.logicalnot = 570;
  43785. t.odieresis = 500;
  43786. t.udieresis = 556;
  43787. t.notequal = 549;
  43788. t.gcommaaccent = 500;
  43789. t.eth = 500;
  43790. t.zcaron = 444;
  43791. t.ncommaaccent = 556;
  43792. t.onesuperior = 300;
  43793. t.imacron = 278;
  43794. t.Euro = 500;
  43795. });
  43796. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43797. t.space = 250;
  43798. t.exclam = 389;
  43799. t.quotedbl = 555;
  43800. t.numbersign = 500;
  43801. t.dollar = 500;
  43802. t.percent = 833;
  43803. t.ampersand = 778;
  43804. t.quoteright = 333;
  43805. t.parenleft = 333;
  43806. t.parenright = 333;
  43807. t.asterisk = 500;
  43808. t.plus = 570;
  43809. t.comma = 250;
  43810. t.hyphen = 333;
  43811. t.period = 250;
  43812. t.slash = 278;
  43813. t.zero = 500;
  43814. t.one = 500;
  43815. t.two = 500;
  43816. t.three = 500;
  43817. t.four = 500;
  43818. t.five = 500;
  43819. t.six = 500;
  43820. t.seven = 500;
  43821. t.eight = 500;
  43822. t.nine = 500;
  43823. t.colon = 333;
  43824. t.semicolon = 333;
  43825. t.less = 570;
  43826. t.equal = 570;
  43827. t.greater = 570;
  43828. t.question = 500;
  43829. t.at = 832;
  43830. t.A = 667;
  43831. t.B = 667;
  43832. t.C = 667;
  43833. t.D = 722;
  43834. t.E = 667;
  43835. t.F = 667;
  43836. t.G = 722;
  43837. t.H = 778;
  43838. t.I = 389;
  43839. t.J = 500;
  43840. t.K = 667;
  43841. t.L = 611;
  43842. t.M = 889;
  43843. t.N = 722;
  43844. t.O = 722;
  43845. t.P = 611;
  43846. t.Q = 722;
  43847. t.R = 667;
  43848. t.S = 556;
  43849. t.T = 611;
  43850. t.U = 722;
  43851. t.V = 667;
  43852. t.W = 889;
  43853. t.X = 667;
  43854. t.Y = 611;
  43855. t.Z = 611;
  43856. t.bracketleft = 333;
  43857. t.backslash = 278;
  43858. t.bracketright = 333;
  43859. t.asciicircum = 570;
  43860. t.underscore = 500;
  43861. t.quoteleft = 333;
  43862. t.a = 500;
  43863. t.b = 500;
  43864. t.c = 444;
  43865. t.d = 500;
  43866. t.e = 444;
  43867. t.f = 333;
  43868. t.g = 500;
  43869. t.h = 556;
  43870. t.i = 278;
  43871. t.j = 278;
  43872. t.k = 500;
  43873. t.l = 278;
  43874. t.m = 778;
  43875. t.n = 556;
  43876. t.o = 500;
  43877. t.p = 500;
  43878. t.q = 500;
  43879. t.r = 389;
  43880. t.s = 389;
  43881. t.t = 278;
  43882. t.u = 556;
  43883. t.v = 444;
  43884. t.w = 667;
  43885. t.x = 500;
  43886. t.y = 444;
  43887. t.z = 389;
  43888. t.braceleft = 348;
  43889. t.bar = 220;
  43890. t.braceright = 348;
  43891. t.asciitilde = 570;
  43892. t.exclamdown = 389;
  43893. t.cent = 500;
  43894. t.sterling = 500;
  43895. t.fraction = 167;
  43896. t.yen = 500;
  43897. t.florin = 500;
  43898. t.section = 500;
  43899. t.currency = 500;
  43900. t.quotesingle = 278;
  43901. t.quotedblleft = 500;
  43902. t.guillemotleft = 500;
  43903. t.guilsinglleft = 333;
  43904. t.guilsinglright = 333;
  43905. t.fi = 556;
  43906. t.fl = 556;
  43907. t.endash = 500;
  43908. t.dagger = 500;
  43909. t.daggerdbl = 500;
  43910. t.periodcentered = 250;
  43911. t.paragraph = 500;
  43912. t.bullet = 350;
  43913. t.quotesinglbase = 333;
  43914. t.quotedblbase = 500;
  43915. t.quotedblright = 500;
  43916. t.guillemotright = 500;
  43917. t.ellipsis = 1000;
  43918. t.perthousand = 1000;
  43919. t.questiondown = 500;
  43920. t.grave = 333;
  43921. t.acute = 333;
  43922. t.circumflex = 333;
  43923. t.tilde = 333;
  43924. t.macron = 333;
  43925. t.breve = 333;
  43926. t.dotaccent = 333;
  43927. t.dieresis = 333;
  43928. t.ring = 333;
  43929. t.cedilla = 333;
  43930. t.hungarumlaut = 333;
  43931. t.ogonek = 333;
  43932. t.caron = 333;
  43933. t.emdash = 1000;
  43934. t.AE = 944;
  43935. t.ordfeminine = 266;
  43936. t.Lslash = 611;
  43937. t.Oslash = 722;
  43938. t.OE = 944;
  43939. t.ordmasculine = 300;
  43940. t.ae = 722;
  43941. t.dotlessi = 278;
  43942. t.lslash = 278;
  43943. t.oslash = 500;
  43944. t.oe = 722;
  43945. t.germandbls = 500;
  43946. t.Idieresis = 389;
  43947. t.eacute = 444;
  43948. t.abreve = 500;
  43949. t.uhungarumlaut = 556;
  43950. t.ecaron = 444;
  43951. t.Ydieresis = 611;
  43952. t.divide = 570;
  43953. t.Yacute = 611;
  43954. t.Acircumflex = 667;
  43955. t.aacute = 500;
  43956. t.Ucircumflex = 722;
  43957. t.yacute = 444;
  43958. t.scommaaccent = 389;
  43959. t.ecircumflex = 444;
  43960. t.Uring = 722;
  43961. t.Udieresis = 722;
  43962. t.aogonek = 500;
  43963. t.Uacute = 722;
  43964. t.uogonek = 556;
  43965. t.Edieresis = 667;
  43966. t.Dcroat = 722;
  43967. t.commaaccent = 250;
  43968. t.copyright = 747;
  43969. t.Emacron = 667;
  43970. t.ccaron = 444;
  43971. t.aring = 500;
  43972. t.Ncommaaccent = 722;
  43973. t.lacute = 278;
  43974. t.agrave = 500;
  43975. t.Tcommaaccent = 611;
  43976. t.Cacute = 667;
  43977. t.atilde = 500;
  43978. t.Edotaccent = 667;
  43979. t.scaron = 389;
  43980. t.scedilla = 389;
  43981. t.iacute = 278;
  43982. t.lozenge = 494;
  43983. t.Rcaron = 667;
  43984. t.Gcommaaccent = 722;
  43985. t.ucircumflex = 556;
  43986. t.acircumflex = 500;
  43987. t.Amacron = 667;
  43988. t.rcaron = 389;
  43989. t.ccedilla = 444;
  43990. t.Zdotaccent = 611;
  43991. t.Thorn = 611;
  43992. t.Omacron = 722;
  43993. t.Racute = 667;
  43994. t.Sacute = 556;
  43995. t.dcaron = 608;
  43996. t.Umacron = 722;
  43997. t.uring = 556;
  43998. t.threesuperior = 300;
  43999. t.Ograve = 722;
  44000. t.Agrave = 667;
  44001. t.Abreve = 667;
  44002. t.multiply = 570;
  44003. t.uacute = 556;
  44004. t.Tcaron = 611;
  44005. t.partialdiff = 494;
  44006. t.ydieresis = 444;
  44007. t.Nacute = 722;
  44008. t.icircumflex = 278;
  44009. t.Ecircumflex = 667;
  44010. t.adieresis = 500;
  44011. t.edieresis = 444;
  44012. t.cacute = 444;
  44013. t.nacute = 556;
  44014. t.umacron = 556;
  44015. t.Ncaron = 722;
  44016. t.Iacute = 389;
  44017. t.plusminus = 570;
  44018. t.brokenbar = 220;
  44019. t.registered = 747;
  44020. t.Gbreve = 722;
  44021. t.Idotaccent = 389;
  44022. t.summation = 600;
  44023. t.Egrave = 667;
  44024. t.racute = 389;
  44025. t.omacron = 500;
  44026. t.Zacute = 611;
  44027. t.Zcaron = 611;
  44028. t.greaterequal = 549;
  44029. t.Eth = 722;
  44030. t.Ccedilla = 667;
  44031. t.lcommaaccent = 278;
  44032. t.tcaron = 366;
  44033. t.eogonek = 444;
  44034. t.Uogonek = 722;
  44035. t.Aacute = 667;
  44036. t.Adieresis = 667;
  44037. t.egrave = 444;
  44038. t.zacute = 389;
  44039. t.iogonek = 278;
  44040. t.Oacute = 722;
  44041. t.oacute = 500;
  44042. t.amacron = 500;
  44043. t.sacute = 389;
  44044. t.idieresis = 278;
  44045. t.Ocircumflex = 722;
  44046. t.Ugrave = 722;
  44047. t.Delta = 612;
  44048. t.thorn = 500;
  44049. t.twosuperior = 300;
  44050. t.Odieresis = 722;
  44051. t.mu = 576;
  44052. t.igrave = 278;
  44053. t.ohungarumlaut = 500;
  44054. t.Eogonek = 667;
  44055. t.dcroat = 500;
  44056. t.threequarters = 750;
  44057. t.Scedilla = 556;
  44058. t.lcaron = 382;
  44059. t.Kcommaaccent = 667;
  44060. t.Lacute = 611;
  44061. t.trademark = 1000;
  44062. t.edotaccent = 444;
  44063. t.Igrave = 389;
  44064. t.Imacron = 389;
  44065. t.Lcaron = 611;
  44066. t.onehalf = 750;
  44067. t.lessequal = 549;
  44068. t.ocircumflex = 500;
  44069. t.ntilde = 556;
  44070. t.Uhungarumlaut = 722;
  44071. t.Eacute = 667;
  44072. t.emacron = 444;
  44073. t.gbreve = 500;
  44074. t.onequarter = 750;
  44075. t.Scaron = 556;
  44076. t.Scommaaccent = 556;
  44077. t.Ohungarumlaut = 722;
  44078. t.degree = 400;
  44079. t.ograve = 500;
  44080. t.Ccaron = 667;
  44081. t.ugrave = 556;
  44082. t.radical = 549;
  44083. t.Dcaron = 722;
  44084. t.rcommaaccent = 389;
  44085. t.Ntilde = 722;
  44086. t.otilde = 500;
  44087. t.Rcommaaccent = 667;
  44088. t.Lcommaaccent = 611;
  44089. t.Atilde = 667;
  44090. t.Aogonek = 667;
  44091. t.Aring = 667;
  44092. t.Otilde = 722;
  44093. t.zdotaccent = 389;
  44094. t.Ecaron = 667;
  44095. t.Iogonek = 389;
  44096. t.kcommaaccent = 500;
  44097. t.minus = 606;
  44098. t.Icircumflex = 389;
  44099. t.ncaron = 556;
  44100. t.tcommaaccent = 278;
  44101. t.logicalnot = 606;
  44102. t.odieresis = 500;
  44103. t.udieresis = 556;
  44104. t.notequal = 549;
  44105. t.gcommaaccent = 500;
  44106. t.eth = 500;
  44107. t.zcaron = 389;
  44108. t.ncommaaccent = 556;
  44109. t.onesuperior = 300;
  44110. t.imacron = 278;
  44111. t.Euro = 500;
  44112. });
  44113. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44114. t.space = 250;
  44115. t.exclam = 333;
  44116. t.quotedbl = 420;
  44117. t.numbersign = 500;
  44118. t.dollar = 500;
  44119. t.percent = 833;
  44120. t.ampersand = 778;
  44121. t.quoteright = 333;
  44122. t.parenleft = 333;
  44123. t.parenright = 333;
  44124. t.asterisk = 500;
  44125. t.plus = 675;
  44126. t.comma = 250;
  44127. t.hyphen = 333;
  44128. t.period = 250;
  44129. t.slash = 278;
  44130. t.zero = 500;
  44131. t.one = 500;
  44132. t.two = 500;
  44133. t.three = 500;
  44134. t.four = 500;
  44135. t.five = 500;
  44136. t.six = 500;
  44137. t.seven = 500;
  44138. t.eight = 500;
  44139. t.nine = 500;
  44140. t.colon = 333;
  44141. t.semicolon = 333;
  44142. t.less = 675;
  44143. t.equal = 675;
  44144. t.greater = 675;
  44145. t.question = 500;
  44146. t.at = 920;
  44147. t.A = 611;
  44148. t.B = 611;
  44149. t.C = 667;
  44150. t.D = 722;
  44151. t.E = 611;
  44152. t.F = 611;
  44153. t.G = 722;
  44154. t.H = 722;
  44155. t.I = 333;
  44156. t.J = 444;
  44157. t.K = 667;
  44158. t.L = 556;
  44159. t.M = 833;
  44160. t.N = 667;
  44161. t.O = 722;
  44162. t.P = 611;
  44163. t.Q = 722;
  44164. t.R = 611;
  44165. t.S = 500;
  44166. t.T = 556;
  44167. t.U = 722;
  44168. t.V = 611;
  44169. t.W = 833;
  44170. t.X = 611;
  44171. t.Y = 556;
  44172. t.Z = 556;
  44173. t.bracketleft = 389;
  44174. t.backslash = 278;
  44175. t.bracketright = 389;
  44176. t.asciicircum = 422;
  44177. t.underscore = 500;
  44178. t.quoteleft = 333;
  44179. t.a = 500;
  44180. t.b = 500;
  44181. t.c = 444;
  44182. t.d = 500;
  44183. t.e = 444;
  44184. t.f = 278;
  44185. t.g = 500;
  44186. t.h = 500;
  44187. t.i = 278;
  44188. t.j = 278;
  44189. t.k = 444;
  44190. t.l = 278;
  44191. t.m = 722;
  44192. t.n = 500;
  44193. t.o = 500;
  44194. t.p = 500;
  44195. t.q = 500;
  44196. t.r = 389;
  44197. t.s = 389;
  44198. t.t = 278;
  44199. t.u = 500;
  44200. t.v = 444;
  44201. t.w = 667;
  44202. t.x = 444;
  44203. t.y = 444;
  44204. t.z = 389;
  44205. t.braceleft = 400;
  44206. t.bar = 275;
  44207. t.braceright = 400;
  44208. t.asciitilde = 541;
  44209. t.exclamdown = 389;
  44210. t.cent = 500;
  44211. t.sterling = 500;
  44212. t.fraction = 167;
  44213. t.yen = 500;
  44214. t.florin = 500;
  44215. t.section = 500;
  44216. t.currency = 500;
  44217. t.quotesingle = 214;
  44218. t.quotedblleft = 556;
  44219. t.guillemotleft = 500;
  44220. t.guilsinglleft = 333;
  44221. t.guilsinglright = 333;
  44222. t.fi = 500;
  44223. t.fl = 500;
  44224. t.endash = 500;
  44225. t.dagger = 500;
  44226. t.daggerdbl = 500;
  44227. t.periodcentered = 250;
  44228. t.paragraph = 523;
  44229. t.bullet = 350;
  44230. t.quotesinglbase = 333;
  44231. t.quotedblbase = 556;
  44232. t.quotedblright = 556;
  44233. t.guillemotright = 500;
  44234. t.ellipsis = 889;
  44235. t.perthousand = 1000;
  44236. t.questiondown = 500;
  44237. t.grave = 333;
  44238. t.acute = 333;
  44239. t.circumflex = 333;
  44240. t.tilde = 333;
  44241. t.macron = 333;
  44242. t.breve = 333;
  44243. t.dotaccent = 333;
  44244. t.dieresis = 333;
  44245. t.ring = 333;
  44246. t.cedilla = 333;
  44247. t.hungarumlaut = 333;
  44248. t.ogonek = 333;
  44249. t.caron = 333;
  44250. t.emdash = 889;
  44251. t.AE = 889;
  44252. t.ordfeminine = 276;
  44253. t.Lslash = 556;
  44254. t.Oslash = 722;
  44255. t.OE = 944;
  44256. t.ordmasculine = 310;
  44257. t.ae = 667;
  44258. t.dotlessi = 278;
  44259. t.lslash = 278;
  44260. t.oslash = 500;
  44261. t.oe = 667;
  44262. t.germandbls = 500;
  44263. t.Idieresis = 333;
  44264. t.eacute = 444;
  44265. t.abreve = 500;
  44266. t.uhungarumlaut = 500;
  44267. t.ecaron = 444;
  44268. t.Ydieresis = 556;
  44269. t.divide = 675;
  44270. t.Yacute = 556;
  44271. t.Acircumflex = 611;
  44272. t.aacute = 500;
  44273. t.Ucircumflex = 722;
  44274. t.yacute = 444;
  44275. t.scommaaccent = 389;
  44276. t.ecircumflex = 444;
  44277. t.Uring = 722;
  44278. t.Udieresis = 722;
  44279. t.aogonek = 500;
  44280. t.Uacute = 722;
  44281. t.uogonek = 500;
  44282. t.Edieresis = 611;
  44283. t.Dcroat = 722;
  44284. t.commaaccent = 250;
  44285. t.copyright = 760;
  44286. t.Emacron = 611;
  44287. t.ccaron = 444;
  44288. t.aring = 500;
  44289. t.Ncommaaccent = 667;
  44290. t.lacute = 278;
  44291. t.agrave = 500;
  44292. t.Tcommaaccent = 556;
  44293. t.Cacute = 667;
  44294. t.atilde = 500;
  44295. t.Edotaccent = 611;
  44296. t.scaron = 389;
  44297. t.scedilla = 389;
  44298. t.iacute = 278;
  44299. t.lozenge = 471;
  44300. t.Rcaron = 611;
  44301. t.Gcommaaccent = 722;
  44302. t.ucircumflex = 500;
  44303. t.acircumflex = 500;
  44304. t.Amacron = 611;
  44305. t.rcaron = 389;
  44306. t.ccedilla = 444;
  44307. t.Zdotaccent = 556;
  44308. t.Thorn = 611;
  44309. t.Omacron = 722;
  44310. t.Racute = 611;
  44311. t.Sacute = 500;
  44312. t.dcaron = 544;
  44313. t.Umacron = 722;
  44314. t.uring = 500;
  44315. t.threesuperior = 300;
  44316. t.Ograve = 722;
  44317. t.Agrave = 611;
  44318. t.Abreve = 611;
  44319. t.multiply = 675;
  44320. t.uacute = 500;
  44321. t.Tcaron = 556;
  44322. t.partialdiff = 476;
  44323. t.ydieresis = 444;
  44324. t.Nacute = 667;
  44325. t.icircumflex = 278;
  44326. t.Ecircumflex = 611;
  44327. t.adieresis = 500;
  44328. t.edieresis = 444;
  44329. t.cacute = 444;
  44330. t.nacute = 500;
  44331. t.umacron = 500;
  44332. t.Ncaron = 667;
  44333. t.Iacute = 333;
  44334. t.plusminus = 675;
  44335. t.brokenbar = 275;
  44336. t.registered = 760;
  44337. t.Gbreve = 722;
  44338. t.Idotaccent = 333;
  44339. t.summation = 600;
  44340. t.Egrave = 611;
  44341. t.racute = 389;
  44342. t.omacron = 500;
  44343. t.Zacute = 556;
  44344. t.Zcaron = 556;
  44345. t.greaterequal = 549;
  44346. t.Eth = 722;
  44347. t.Ccedilla = 667;
  44348. t.lcommaaccent = 278;
  44349. t.tcaron = 300;
  44350. t.eogonek = 444;
  44351. t.Uogonek = 722;
  44352. t.Aacute = 611;
  44353. t.Adieresis = 611;
  44354. t.egrave = 444;
  44355. t.zacute = 389;
  44356. t.iogonek = 278;
  44357. t.Oacute = 722;
  44358. t.oacute = 500;
  44359. t.amacron = 500;
  44360. t.sacute = 389;
  44361. t.idieresis = 278;
  44362. t.Ocircumflex = 722;
  44363. t.Ugrave = 722;
  44364. t.Delta = 612;
  44365. t.thorn = 500;
  44366. t.twosuperior = 300;
  44367. t.Odieresis = 722;
  44368. t.mu = 500;
  44369. t.igrave = 278;
  44370. t.ohungarumlaut = 500;
  44371. t.Eogonek = 611;
  44372. t.dcroat = 500;
  44373. t.threequarters = 750;
  44374. t.Scedilla = 500;
  44375. t.lcaron = 300;
  44376. t.Kcommaaccent = 667;
  44377. t.Lacute = 556;
  44378. t.trademark = 980;
  44379. t.edotaccent = 444;
  44380. t.Igrave = 333;
  44381. t.Imacron = 333;
  44382. t.Lcaron = 611;
  44383. t.onehalf = 750;
  44384. t.lessequal = 549;
  44385. t.ocircumflex = 500;
  44386. t.ntilde = 500;
  44387. t.Uhungarumlaut = 722;
  44388. t.Eacute = 611;
  44389. t.emacron = 444;
  44390. t.gbreve = 500;
  44391. t.onequarter = 750;
  44392. t.Scaron = 500;
  44393. t.Scommaaccent = 500;
  44394. t.Ohungarumlaut = 722;
  44395. t.degree = 400;
  44396. t.ograve = 500;
  44397. t.Ccaron = 667;
  44398. t.ugrave = 500;
  44399. t.radical = 453;
  44400. t.Dcaron = 722;
  44401. t.rcommaaccent = 389;
  44402. t.Ntilde = 667;
  44403. t.otilde = 500;
  44404. t.Rcommaaccent = 611;
  44405. t.Lcommaaccent = 556;
  44406. t.Atilde = 611;
  44407. t.Aogonek = 611;
  44408. t.Aring = 611;
  44409. t.Otilde = 722;
  44410. t.zdotaccent = 389;
  44411. t.Ecaron = 611;
  44412. t.Iogonek = 333;
  44413. t.kcommaaccent = 444;
  44414. t.minus = 675;
  44415. t.Icircumflex = 333;
  44416. t.ncaron = 500;
  44417. t.tcommaaccent = 278;
  44418. t.logicalnot = 675;
  44419. t.odieresis = 500;
  44420. t.udieresis = 500;
  44421. t.notequal = 549;
  44422. t.gcommaaccent = 500;
  44423. t.eth = 500;
  44424. t.zcaron = 389;
  44425. t.ncommaaccent = 500;
  44426. t.onesuperior = 300;
  44427. t.imacron = 278;
  44428. t.Euro = 500;
  44429. });
  44430. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44431. t.space = 278;
  44432. t.a1 = 974;
  44433. t.a2 = 961;
  44434. t.a202 = 974;
  44435. t.a3 = 980;
  44436. t.a4 = 719;
  44437. t.a5 = 789;
  44438. t.a119 = 790;
  44439. t.a118 = 791;
  44440. t.a117 = 690;
  44441. t.a11 = 960;
  44442. t.a12 = 939;
  44443. t.a13 = 549;
  44444. t.a14 = 855;
  44445. t.a15 = 911;
  44446. t.a16 = 933;
  44447. t.a105 = 911;
  44448. t.a17 = 945;
  44449. t.a18 = 974;
  44450. t.a19 = 755;
  44451. t.a20 = 846;
  44452. t.a21 = 762;
  44453. t.a22 = 761;
  44454. t.a23 = 571;
  44455. t.a24 = 677;
  44456. t.a25 = 763;
  44457. t.a26 = 760;
  44458. t.a27 = 759;
  44459. t.a28 = 754;
  44460. t.a6 = 494;
  44461. t.a7 = 552;
  44462. t.a8 = 537;
  44463. t.a9 = 577;
  44464. t.a10 = 692;
  44465. t.a29 = 786;
  44466. t.a30 = 788;
  44467. t.a31 = 788;
  44468. t.a32 = 790;
  44469. t.a33 = 793;
  44470. t.a34 = 794;
  44471. t.a35 = 816;
  44472. t.a36 = 823;
  44473. t.a37 = 789;
  44474. t.a38 = 841;
  44475. t.a39 = 823;
  44476. t.a40 = 833;
  44477. t.a41 = 816;
  44478. t.a42 = 831;
  44479. t.a43 = 923;
  44480. t.a44 = 744;
  44481. t.a45 = 723;
  44482. t.a46 = 749;
  44483. t.a47 = 790;
  44484. t.a48 = 792;
  44485. t.a49 = 695;
  44486. t.a50 = 776;
  44487. t.a51 = 768;
  44488. t.a52 = 792;
  44489. t.a53 = 759;
  44490. t.a54 = 707;
  44491. t.a55 = 708;
  44492. t.a56 = 682;
  44493. t.a57 = 701;
  44494. t.a58 = 826;
  44495. t.a59 = 815;
  44496. t.a60 = 789;
  44497. t.a61 = 789;
  44498. t.a62 = 707;
  44499. t.a63 = 687;
  44500. t.a64 = 696;
  44501. t.a65 = 689;
  44502. t.a66 = 786;
  44503. t.a67 = 787;
  44504. t.a68 = 713;
  44505. t.a69 = 791;
  44506. t.a70 = 785;
  44507. t.a71 = 791;
  44508. t.a72 = 873;
  44509. t.a73 = 761;
  44510. t.a74 = 762;
  44511. t.a203 = 762;
  44512. t.a75 = 759;
  44513. t.a204 = 759;
  44514. t.a76 = 892;
  44515. t.a77 = 892;
  44516. t.a78 = 788;
  44517. t.a79 = 784;
  44518. t.a81 = 438;
  44519. t.a82 = 138;
  44520. t.a83 = 277;
  44521. t.a84 = 415;
  44522. t.a97 = 392;
  44523. t.a98 = 392;
  44524. t.a99 = 668;
  44525. t.a100 = 668;
  44526. t.a89 = 390;
  44527. t.a90 = 390;
  44528. t.a93 = 317;
  44529. t.a94 = 317;
  44530. t.a91 = 276;
  44531. t.a92 = 276;
  44532. t.a205 = 509;
  44533. t.a85 = 509;
  44534. t.a206 = 410;
  44535. t.a86 = 410;
  44536. t.a87 = 234;
  44537. t.a88 = 234;
  44538. t.a95 = 334;
  44539. t.a96 = 334;
  44540. t.a101 = 732;
  44541. t.a102 = 544;
  44542. t.a103 = 544;
  44543. t.a104 = 910;
  44544. t.a106 = 667;
  44545. t.a107 = 760;
  44546. t.a108 = 760;
  44547. t.a112 = 776;
  44548. t.a111 = 595;
  44549. t.a110 = 694;
  44550. t.a109 = 626;
  44551. t.a120 = 788;
  44552. t.a121 = 788;
  44553. t.a122 = 788;
  44554. t.a123 = 788;
  44555. t.a124 = 788;
  44556. t.a125 = 788;
  44557. t.a126 = 788;
  44558. t.a127 = 788;
  44559. t.a128 = 788;
  44560. t.a129 = 788;
  44561. t.a130 = 788;
  44562. t.a131 = 788;
  44563. t.a132 = 788;
  44564. t.a133 = 788;
  44565. t.a134 = 788;
  44566. t.a135 = 788;
  44567. t.a136 = 788;
  44568. t.a137 = 788;
  44569. t.a138 = 788;
  44570. t.a139 = 788;
  44571. t.a140 = 788;
  44572. t.a141 = 788;
  44573. t.a142 = 788;
  44574. t.a143 = 788;
  44575. t.a144 = 788;
  44576. t.a145 = 788;
  44577. t.a146 = 788;
  44578. t.a147 = 788;
  44579. t.a148 = 788;
  44580. t.a149 = 788;
  44581. t.a150 = 788;
  44582. t.a151 = 788;
  44583. t.a152 = 788;
  44584. t.a153 = 788;
  44585. t.a154 = 788;
  44586. t.a155 = 788;
  44587. t.a156 = 788;
  44588. t.a157 = 788;
  44589. t.a158 = 788;
  44590. t.a159 = 788;
  44591. t.a160 = 894;
  44592. t.a161 = 838;
  44593. t.a163 = 1016;
  44594. t.a164 = 458;
  44595. t.a196 = 748;
  44596. t.a165 = 924;
  44597. t.a192 = 748;
  44598. t.a166 = 918;
  44599. t.a167 = 927;
  44600. t.a168 = 928;
  44601. t.a169 = 928;
  44602. t.a170 = 834;
  44603. t.a171 = 873;
  44604. t.a172 = 828;
  44605. t.a173 = 924;
  44606. t.a162 = 924;
  44607. t.a174 = 917;
  44608. t.a175 = 930;
  44609. t.a176 = 931;
  44610. t.a177 = 463;
  44611. t.a178 = 883;
  44612. t.a179 = 836;
  44613. t.a193 = 836;
  44614. t.a180 = 867;
  44615. t.a199 = 867;
  44616. t.a181 = 696;
  44617. t.a200 = 696;
  44618. t.a182 = 874;
  44619. t.a201 = 874;
  44620. t.a183 = 760;
  44621. t.a184 = 946;
  44622. t.a197 = 771;
  44623. t.a185 = 865;
  44624. t.a194 = 771;
  44625. t.a198 = 888;
  44626. t.a186 = 967;
  44627. t.a195 = 888;
  44628. t.a187 = 831;
  44629. t.a188 = 873;
  44630. t.a189 = 927;
  44631. t.a190 = 970;
  44632. t.a191 = 918;
  44633. });
  44634. });
  44635. exports.getMetrics = getMetrics;
  44636. /***/ }),
  44637. /* 61 */
  44638. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44639. Object.defineProperty(exports, "__esModule", ({
  44640. value: true
  44641. }));
  44642. exports.MurmurHash3_64 = void 0;
  44643. var _util = __w_pdfjs_require__(2);
  44644. const SEED = 0xc3d2e1f0;
  44645. const MASK_HIGH = 0xffff0000;
  44646. const MASK_LOW = 0xffff;
  44647. class MurmurHash3_64 {
  44648. constructor(seed) {
  44649. this.h1 = seed ? seed & 0xffffffff : SEED;
  44650. this.h2 = seed ? seed & 0xffffffff : SEED;
  44651. }
  44652. update(input) {
  44653. let data, length;
  44654. if ((0, _util.isString)(input)) {
  44655. data = new Uint8Array(input.length * 2);
  44656. length = 0;
  44657. for (let i = 0, ii = input.length; i < ii; i++) {
  44658. const code = input.charCodeAt(i);
  44659. if (code <= 0xff) {
  44660. data[length++] = code;
  44661. } else {
  44662. data[length++] = code >>> 8;
  44663. data[length++] = code & 0xff;
  44664. }
  44665. }
  44666. } else if ((0, _util.isArrayBuffer)(input)) {
  44667. data = input.slice();
  44668. length = data.byteLength;
  44669. } else {
  44670. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  44671. }
  44672. const blockCounts = length >> 2;
  44673. const tailLength = length - blockCounts * 4;
  44674. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  44675. let k1 = 0,
  44676. k2 = 0;
  44677. let h1 = this.h1,
  44678. h2 = this.h2;
  44679. const C1 = 0xcc9e2d51,
  44680. C2 = 0x1b873593;
  44681. const C1_LOW = C1 & MASK_LOW,
  44682. C2_LOW = C2 & MASK_LOW;
  44683. for (let i = 0; i < blockCounts; i++) {
  44684. if (i & 1) {
  44685. k1 = dataUint32[i];
  44686. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44687. k1 = k1 << 15 | k1 >>> 17;
  44688. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44689. h1 ^= k1;
  44690. h1 = h1 << 13 | h1 >>> 19;
  44691. h1 = h1 * 5 + 0xe6546b64;
  44692. } else {
  44693. k2 = dataUint32[i];
  44694. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  44695. k2 = k2 << 15 | k2 >>> 17;
  44696. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  44697. h2 ^= k2;
  44698. h2 = h2 << 13 | h2 >>> 19;
  44699. h2 = h2 * 5 + 0xe6546b64;
  44700. }
  44701. }
  44702. k1 = 0;
  44703. switch (tailLength) {
  44704. case 3:
  44705. k1 ^= data[blockCounts * 4 + 2] << 16;
  44706. case 2:
  44707. k1 ^= data[blockCounts * 4 + 1] << 8;
  44708. case 1:
  44709. k1 ^= data[blockCounts * 4];
  44710. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44711. k1 = k1 << 15 | k1 >>> 17;
  44712. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44713. if (blockCounts & 1) {
  44714. h1 ^= k1;
  44715. } else {
  44716. h2 ^= k1;
  44717. }
  44718. }
  44719. this.h1 = h1;
  44720. this.h2 = h2;
  44721. }
  44722. hexdigest() {
  44723. let h1 = this.h1,
  44724. h2 = this.h2;
  44725. h1 ^= h2 >>> 1;
  44726. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  44727. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  44728. h1 ^= h2 >>> 1;
  44729. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  44730. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  44731. h1 ^= h2 >>> 1;
  44732. const hex1 = (h1 >>> 0).toString(16),
  44733. hex2 = (h2 >>> 0).toString(16);
  44734. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  44735. }
  44736. }
  44737. exports.MurmurHash3_64 = MurmurHash3_64;
  44738. /***/ }),
  44739. /* 62 */
  44740. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44741. Object.defineProperty(exports, "__esModule", ({
  44742. value: true
  44743. }));
  44744. exports.OperatorList = void 0;
  44745. var _util = __w_pdfjs_require__(2);
  44746. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  44747. let state = parentState;
  44748. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  44749. const item = pattern[i];
  44750. state = state[item] || (state[item] = []);
  44751. }
  44752. state[pattern[pattern.length - 1]] = {
  44753. checkFn,
  44754. iterateFn,
  44755. processFn
  44756. };
  44757. }
  44758. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  44759. const iFirstPIMXO = iFirstSave + 2;
  44760. let i;
  44761. for (i = 0; i < count; i++) {
  44762. const arg = argsArray[iFirstPIMXO + 4 * i];
  44763. const imageMask = arg.length === 1 && arg[0];
  44764. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  44765. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  44766. continue;
  44767. }
  44768. break;
  44769. }
  44770. return count - i;
  44771. }
  44772. const InitialState = [];
  44773. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  44774. const fnArray = context.fnArray;
  44775. const iFirstSave = context.iCurr - 3;
  44776. const pos = (i - iFirstSave) % 4;
  44777. switch (pos) {
  44778. case 0:
  44779. return fnArray[i] === _util.OPS.save;
  44780. case 1:
  44781. return fnArray[i] === _util.OPS.transform;
  44782. case 2:
  44783. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  44784. case 3:
  44785. return fnArray[i] === _util.OPS.restore;
  44786. }
  44787. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  44788. }, function foundInlineImageGroup(context, i) {
  44789. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  44790. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  44791. const MAX_WIDTH = 1000;
  44792. const IMAGE_PADDING = 1;
  44793. const fnArray = context.fnArray,
  44794. argsArray = context.argsArray;
  44795. const curr = context.iCurr;
  44796. const iFirstSave = curr - 3;
  44797. const iFirstTransform = curr - 2;
  44798. const iFirstPIIXO = curr - 1;
  44799. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  44800. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  44801. return i - (i - iFirstSave) % 4;
  44802. }
  44803. let maxX = 0;
  44804. const map = [];
  44805. let maxLineHeight = 0;
  44806. let currentX = IMAGE_PADDING,
  44807. currentY = IMAGE_PADDING;
  44808. for (let q = 0; q < count; q++) {
  44809. const transform = argsArray[iFirstTransform + (q << 2)];
  44810. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  44811. if (currentX + img.width > MAX_WIDTH) {
  44812. maxX = Math.max(maxX, currentX);
  44813. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  44814. currentX = 0;
  44815. maxLineHeight = 0;
  44816. }
  44817. map.push({
  44818. transform,
  44819. x: currentX,
  44820. y: currentY,
  44821. w: img.width,
  44822. h: img.height
  44823. });
  44824. currentX += img.width + 2 * IMAGE_PADDING;
  44825. maxLineHeight = Math.max(maxLineHeight, img.height);
  44826. }
  44827. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  44828. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  44829. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  44830. const imgRowSize = imgWidth << 2;
  44831. for (let q = 0; q < count; q++) {
  44832. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  44833. const rowSize = map[q].w << 2;
  44834. let dataOffset = 0;
  44835. let offset = map[q].x + map[q].y * imgWidth << 2;
  44836. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  44837. for (let k = 0, kk = map[q].h; k < kk; k++) {
  44838. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  44839. dataOffset += rowSize;
  44840. offset += imgRowSize;
  44841. }
  44842. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  44843. while (offset >= 0) {
  44844. data[offset - 4] = data[offset];
  44845. data[offset - 3] = data[offset + 1];
  44846. data[offset - 2] = data[offset + 2];
  44847. data[offset - 1] = data[offset + 3];
  44848. data[offset + rowSize] = data[offset + rowSize - 4];
  44849. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  44850. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  44851. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  44852. offset -= imgRowSize;
  44853. }
  44854. }
  44855. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  44856. argsArray.splice(iFirstSave, count * 4, [{
  44857. width: imgWidth,
  44858. height: imgHeight,
  44859. kind: _util.ImageKind.RGBA_32BPP,
  44860. data: imgData
  44861. }, map]);
  44862. return iFirstSave + 1;
  44863. });
  44864. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  44865. const fnArray = context.fnArray;
  44866. const iFirstSave = context.iCurr - 3;
  44867. const pos = (i - iFirstSave) % 4;
  44868. switch (pos) {
  44869. case 0:
  44870. return fnArray[i] === _util.OPS.save;
  44871. case 1:
  44872. return fnArray[i] === _util.OPS.transform;
  44873. case 2:
  44874. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  44875. case 3:
  44876. return fnArray[i] === _util.OPS.restore;
  44877. }
  44878. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  44879. }, function foundImageMaskGroup(context, i) {
  44880. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  44881. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  44882. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  44883. const fnArray = context.fnArray,
  44884. argsArray = context.argsArray;
  44885. const curr = context.iCurr;
  44886. const iFirstSave = curr - 3;
  44887. const iFirstTransform = curr - 2;
  44888. const iFirstPIMXO = curr - 1;
  44889. let count = Math.floor((i - iFirstSave) / 4);
  44890. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  44891. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  44892. return i - (i - iFirstSave) % 4;
  44893. }
  44894. let isSameImage = false;
  44895. let iTransform, transformArgs;
  44896. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  44897. const firstTransformArg0 = argsArray[iFirstTransform][0],
  44898. firstTransformArg1 = argsArray[iFirstTransform][1],
  44899. firstTransformArg2 = argsArray[iFirstTransform][2],
  44900. firstTransformArg3 = argsArray[iFirstTransform][3];
  44901. if (firstTransformArg1 === firstTransformArg2) {
  44902. isSameImage = true;
  44903. iTransform = iFirstTransform + 4;
  44904. let iPIMXO = iFirstPIMXO + 4;
  44905. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  44906. transformArgs = argsArray[iTransform];
  44907. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  44908. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  44909. isSameImage = false;
  44910. } else {
  44911. count = q;
  44912. }
  44913. break;
  44914. }
  44915. }
  44916. }
  44917. if (isSameImage) {
  44918. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  44919. const positions = new Float32Array(count * 2);
  44920. iTransform = iFirstTransform;
  44921. for (let q = 0; q < count; q++, iTransform += 4) {
  44922. transformArgs = argsArray[iTransform];
  44923. positions[q << 1] = transformArgs[4];
  44924. positions[(q << 1) + 1] = transformArgs[5];
  44925. }
  44926. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  44927. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  44928. } else {
  44929. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  44930. const images = [];
  44931. for (let q = 0; q < count; q++) {
  44932. transformArgs = argsArray[iFirstTransform + (q << 2)];
  44933. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  44934. images.push({
  44935. data: maskParams.data,
  44936. width: maskParams.width,
  44937. height: maskParams.height,
  44938. transform: transformArgs
  44939. });
  44940. }
  44941. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  44942. argsArray.splice(iFirstSave, count * 4, [images]);
  44943. }
  44944. return iFirstSave + 1;
  44945. });
  44946. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  44947. const argsArray = context.argsArray;
  44948. const iFirstTransform = context.iCurr - 2;
  44949. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  44950. }, function iterateImageGroup(context, i) {
  44951. const fnArray = context.fnArray,
  44952. argsArray = context.argsArray;
  44953. const iFirstSave = context.iCurr - 3;
  44954. const pos = (i - iFirstSave) % 4;
  44955. switch (pos) {
  44956. case 0:
  44957. return fnArray[i] === _util.OPS.save;
  44958. case 1:
  44959. if (fnArray[i] !== _util.OPS.transform) {
  44960. return false;
  44961. }
  44962. const iFirstTransform = context.iCurr - 2;
  44963. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44964. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44965. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  44966. return false;
  44967. }
  44968. return true;
  44969. case 2:
  44970. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  44971. return false;
  44972. }
  44973. const iFirstPIXO = context.iCurr - 1;
  44974. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44975. if (argsArray[i][0] !== firstPIXOArg0) {
  44976. return false;
  44977. }
  44978. return true;
  44979. case 3:
  44980. return fnArray[i] === _util.OPS.restore;
  44981. }
  44982. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  44983. }, function (context, i) {
  44984. const MIN_IMAGES_IN_BLOCK = 3;
  44985. const MAX_IMAGES_IN_BLOCK = 1000;
  44986. const fnArray = context.fnArray,
  44987. argsArray = context.argsArray;
  44988. const curr = context.iCurr;
  44989. const iFirstSave = curr - 3;
  44990. const iFirstTransform = curr - 2;
  44991. const iFirstPIXO = curr - 1;
  44992. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44993. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44994. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44995. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  44996. if (count < MIN_IMAGES_IN_BLOCK) {
  44997. return i - (i - iFirstSave) % 4;
  44998. }
  44999. const positions = new Float32Array(count * 2);
  45000. let iTransform = iFirstTransform;
  45001. for (let q = 0; q < count; q++, iTransform += 4) {
  45002. const transformArgs = argsArray[iTransform];
  45003. positions[q << 1] = transformArgs[4];
  45004. positions[(q << 1) + 1] = transformArgs[5];
  45005. }
  45006. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  45007. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  45008. argsArray.splice(iFirstSave, count * 4, args);
  45009. return iFirstSave + 1;
  45010. });
  45011. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  45012. const fnArray = context.fnArray,
  45013. argsArray = context.argsArray;
  45014. const iFirstSave = context.iCurr - 4;
  45015. const pos = (i - iFirstSave) % 5;
  45016. switch (pos) {
  45017. case 0:
  45018. return fnArray[i] === _util.OPS.beginText;
  45019. case 1:
  45020. return fnArray[i] === _util.OPS.setFont;
  45021. case 2:
  45022. return fnArray[i] === _util.OPS.setTextMatrix;
  45023. case 3:
  45024. if (fnArray[i] !== _util.OPS.showText) {
  45025. return false;
  45026. }
  45027. const iFirstSetFont = context.iCurr - 3;
  45028. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45029. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45030. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  45031. return false;
  45032. }
  45033. return true;
  45034. case 4:
  45035. return fnArray[i] === _util.OPS.endText;
  45036. }
  45037. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  45038. }, function (context, i) {
  45039. const MIN_CHARS_IN_BLOCK = 3;
  45040. const MAX_CHARS_IN_BLOCK = 1000;
  45041. const fnArray = context.fnArray,
  45042. argsArray = context.argsArray;
  45043. const curr = context.iCurr;
  45044. const iFirstBeginText = curr - 4;
  45045. const iFirstSetFont = curr - 3;
  45046. const iFirstSetTextMatrix = curr - 2;
  45047. const iFirstShowText = curr - 1;
  45048. const iFirstEndText = curr;
  45049. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45050. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45051. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  45052. if (count < MIN_CHARS_IN_BLOCK) {
  45053. return i - (i - iFirstBeginText) % 5;
  45054. }
  45055. let iFirst = iFirstBeginText;
  45056. 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) {
  45057. count++;
  45058. iFirst -= 5;
  45059. }
  45060. let iEndText = iFirst + 4;
  45061. for (let q = 1; q < count; q++) {
  45062. fnArray.splice(iEndText, 3);
  45063. argsArray.splice(iEndText, 3);
  45064. iEndText += 2;
  45065. }
  45066. return iEndText + 1;
  45067. });
  45068. class NullOptimizer {
  45069. constructor(queue) {
  45070. this.queue = queue;
  45071. }
  45072. _optimize() {}
  45073. push(fn, args) {
  45074. this.queue.fnArray.push(fn);
  45075. this.queue.argsArray.push(args);
  45076. this._optimize();
  45077. }
  45078. flush() {}
  45079. reset() {}
  45080. }
  45081. class QueueOptimizer extends NullOptimizer {
  45082. constructor(queue) {
  45083. super(queue);
  45084. this.state = null;
  45085. this.context = {
  45086. iCurr: 0,
  45087. fnArray: queue.fnArray,
  45088. argsArray: queue.argsArray
  45089. };
  45090. this.match = null;
  45091. this.lastProcessed = 0;
  45092. }
  45093. _optimize() {
  45094. const fnArray = this.queue.fnArray;
  45095. let i = this.lastProcessed,
  45096. ii = fnArray.length;
  45097. let state = this.state;
  45098. let match = this.match;
  45099. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  45100. this.lastProcessed = ii;
  45101. return;
  45102. }
  45103. const context = this.context;
  45104. while (i < ii) {
  45105. if (match) {
  45106. const iterate = (0, match.iterateFn)(context, i);
  45107. if (iterate) {
  45108. i++;
  45109. continue;
  45110. }
  45111. i = (0, match.processFn)(context, i + 1);
  45112. ii = fnArray.length;
  45113. match = null;
  45114. state = null;
  45115. if (i >= ii) {
  45116. break;
  45117. }
  45118. }
  45119. state = (state || InitialState)[fnArray[i]];
  45120. if (!state || Array.isArray(state)) {
  45121. i++;
  45122. continue;
  45123. }
  45124. context.iCurr = i;
  45125. i++;
  45126. if (state.checkFn && !(0, state.checkFn)(context)) {
  45127. state = null;
  45128. continue;
  45129. }
  45130. match = state;
  45131. state = null;
  45132. }
  45133. this.state = state;
  45134. this.match = match;
  45135. this.lastProcessed = i;
  45136. }
  45137. flush() {
  45138. while (this.match) {
  45139. const length = this.queue.fnArray.length;
  45140. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  45141. this.match = null;
  45142. this.state = null;
  45143. this._optimize();
  45144. }
  45145. }
  45146. reset() {
  45147. this.state = null;
  45148. this.match = null;
  45149. this.lastProcessed = 0;
  45150. }
  45151. }
  45152. class OperatorList {
  45153. static get CHUNK_SIZE() {
  45154. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  45155. }
  45156. static get CHUNK_SIZE_ABOUT() {
  45157. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  45158. }
  45159. constructor(intent = 0, streamSink) {
  45160. this._streamSink = streamSink;
  45161. this.fnArray = [];
  45162. this.argsArray = [];
  45163. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  45164. this.optimizer = new QueueOptimizer(this);
  45165. } else {
  45166. this.optimizer = new NullOptimizer(this);
  45167. }
  45168. this.dependencies = new Set();
  45169. this._totalLength = 0;
  45170. this.weight = 0;
  45171. this._resolved = streamSink ? null : Promise.resolve();
  45172. }
  45173. get length() {
  45174. return this.argsArray.length;
  45175. }
  45176. get ready() {
  45177. return this._resolved || this._streamSink.ready;
  45178. }
  45179. get totalLength() {
  45180. return this._totalLength + this.length;
  45181. }
  45182. addOp(fn, args) {
  45183. this.optimizer.push(fn, args);
  45184. this.weight++;
  45185. if (this._streamSink) {
  45186. if (this.weight >= OperatorList.CHUNK_SIZE) {
  45187. this.flush();
  45188. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  45189. this.flush();
  45190. }
  45191. }
  45192. }
  45193. addDependency(dependency) {
  45194. if (this.dependencies.has(dependency)) {
  45195. return;
  45196. }
  45197. this.dependencies.add(dependency);
  45198. this.addOp(_util.OPS.dependency, [dependency]);
  45199. }
  45200. addDependencies(dependencies) {
  45201. for (const dependency of dependencies) {
  45202. this.addDependency(dependency);
  45203. }
  45204. }
  45205. addOpList(opList) {
  45206. if (!(opList instanceof OperatorList)) {
  45207. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  45208. return;
  45209. }
  45210. for (const dependency of opList.dependencies) {
  45211. this.dependencies.add(dependency);
  45212. }
  45213. for (let i = 0, ii = opList.length; i < ii; i++) {
  45214. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  45215. }
  45216. }
  45217. getIR() {
  45218. return {
  45219. fnArray: this.fnArray,
  45220. argsArray: this.argsArray,
  45221. length: this.length
  45222. };
  45223. }
  45224. get _transfers() {
  45225. const transfers = [];
  45226. const {
  45227. fnArray,
  45228. argsArray,
  45229. length
  45230. } = this;
  45231. for (let i = 0; i < length; i++) {
  45232. switch (fnArray[i]) {
  45233. case _util.OPS.paintInlineImageXObject:
  45234. case _util.OPS.paintInlineImageXObjectGroup:
  45235. case _util.OPS.paintImageMaskXObject:
  45236. const arg = argsArray[i][0];
  45237. ;
  45238. if (!arg.cached) {
  45239. transfers.push(arg.data.buffer);
  45240. }
  45241. break;
  45242. }
  45243. }
  45244. return transfers;
  45245. }
  45246. flush(lastChunk = false) {
  45247. this.optimizer.flush();
  45248. const length = this.length;
  45249. this._totalLength += length;
  45250. this._streamSink.enqueue({
  45251. fnArray: this.fnArray,
  45252. argsArray: this.argsArray,
  45253. lastChunk,
  45254. length
  45255. }, 1, this._transfers);
  45256. this.dependencies.clear();
  45257. this.fnArray.length = 0;
  45258. this.argsArray.length = 0;
  45259. this.weight = 0;
  45260. this.optimizer.reset();
  45261. }
  45262. }
  45263. exports.OperatorList = OperatorList;
  45264. /***/ }),
  45265. /* 63 */
  45266. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45267. Object.defineProperty(exports, "__esModule", ({
  45268. value: true
  45269. }));
  45270. exports.PDFImage = void 0;
  45271. var _util = __w_pdfjs_require__(2);
  45272. var _primitives = __w_pdfjs_require__(5);
  45273. var _colorspace = __w_pdfjs_require__(24);
  45274. var _decode_stream = __w_pdfjs_require__(29);
  45275. var _jpeg_stream = __w_pdfjs_require__(37);
  45276. var _jpx = __w_pdfjs_require__(40);
  45277. function decodeAndClamp(value, addend, coefficient, max) {
  45278. value = addend + value * coefficient;
  45279. if (value < 0) {
  45280. value = 0;
  45281. } else if (value > max) {
  45282. value = max;
  45283. }
  45284. return value;
  45285. }
  45286. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  45287. const length = w2 * h2;
  45288. let dest;
  45289. if (bpc <= 8) {
  45290. dest = new Uint8Array(length);
  45291. } else if (bpc <= 16) {
  45292. dest = new Uint16Array(length);
  45293. } else {
  45294. dest = new Uint32Array(length);
  45295. }
  45296. const xRatio = w1 / w2;
  45297. const yRatio = h1 / h2;
  45298. let i,
  45299. j,
  45300. py,
  45301. newIndex = 0,
  45302. oldIndex;
  45303. const xScaled = new Uint16Array(w2);
  45304. const w1Scanline = w1;
  45305. for (i = 0; i < w2; i++) {
  45306. xScaled[i] = Math.floor(i * xRatio);
  45307. }
  45308. for (i = 0; i < h2; i++) {
  45309. py = Math.floor(i * yRatio) * w1Scanline;
  45310. for (j = 0; j < w2; j++) {
  45311. oldIndex = py + xScaled[j];
  45312. dest[newIndex++] = src[oldIndex];
  45313. }
  45314. }
  45315. return dest;
  45316. }
  45317. class PDFImage {
  45318. constructor({
  45319. xref,
  45320. res,
  45321. image,
  45322. isInline = false,
  45323. smask = null,
  45324. mask = null,
  45325. isMask = false,
  45326. pdfFunctionFactory,
  45327. localColorSpaceCache
  45328. }) {
  45329. this.image = image;
  45330. const dict = image.dict;
  45331. const filter = dict.get("F", "Filter");
  45332. if ((0, _primitives.isName)(filter)) {
  45333. switch (filter.name) {
  45334. case "JPXDecode":
  45335. const jpxImage = new _jpx.JpxImage();
  45336. jpxImage.parseImageProperties(image.stream);
  45337. image.stream.reset();
  45338. image.width = jpxImage.width;
  45339. image.height = jpxImage.height;
  45340. image.bitsPerComponent = jpxImage.bitsPerComponent;
  45341. image.numComps = jpxImage.componentsCount;
  45342. break;
  45343. case "JBIG2Decode":
  45344. image.bitsPerComponent = 1;
  45345. image.numComps = 1;
  45346. break;
  45347. }
  45348. }
  45349. let width = dict.get("W", "Width");
  45350. let height = dict.get("H", "Height");
  45351. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  45352. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  45353. width = image.width;
  45354. height = image.height;
  45355. }
  45356. if (width < 1 || height < 1) {
  45357. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  45358. }
  45359. this.width = width;
  45360. this.height = height;
  45361. this.interpolate = dict.get("I", "Interpolate");
  45362. this.imageMask = dict.get("IM", "ImageMask") || false;
  45363. this.matte = dict.get("Matte") || false;
  45364. let bitsPerComponent = image.bitsPerComponent;
  45365. if (!bitsPerComponent) {
  45366. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  45367. if (!bitsPerComponent) {
  45368. if (this.imageMask) {
  45369. bitsPerComponent = 1;
  45370. } else {
  45371. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  45372. }
  45373. }
  45374. }
  45375. this.bpc = bitsPerComponent;
  45376. if (!this.imageMask) {
  45377. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  45378. if (!colorSpace) {
  45379. (0, _util.info)("JPX images (which do not require color spaces)");
  45380. switch (image.numComps) {
  45381. case 1:
  45382. colorSpace = _primitives.Name.get("DeviceGray");
  45383. break;
  45384. case 3:
  45385. colorSpace = _primitives.Name.get("DeviceRGB");
  45386. break;
  45387. case 4:
  45388. colorSpace = _primitives.Name.get("DeviceCMYK");
  45389. break;
  45390. default:
  45391. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  45392. }
  45393. }
  45394. this.colorSpace = _colorspace.ColorSpace.parse({
  45395. cs: colorSpace,
  45396. xref,
  45397. resources: isInline ? res : null,
  45398. pdfFunctionFactory,
  45399. localColorSpaceCache
  45400. });
  45401. this.numComps = this.colorSpace.numComps;
  45402. }
  45403. this.decode = dict.getArray("D", "Decode");
  45404. this.needsDecode = false;
  45405. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  45406. this.needsDecode = true;
  45407. const max = (1 << bitsPerComponent) - 1;
  45408. this.decodeCoefficients = [];
  45409. this.decodeAddends = [];
  45410. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  45411. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  45412. const dmin = this.decode[i];
  45413. const dmax = this.decode[i + 1];
  45414. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  45415. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  45416. }
  45417. }
  45418. if (smask) {
  45419. this.smask = new PDFImage({
  45420. xref,
  45421. res,
  45422. image: smask,
  45423. isInline,
  45424. pdfFunctionFactory,
  45425. localColorSpaceCache
  45426. });
  45427. } else if (mask) {
  45428. if ((0, _primitives.isStream)(mask)) {
  45429. const maskDict = mask.dict,
  45430. imageMask = maskDict.get("IM", "ImageMask");
  45431. if (!imageMask) {
  45432. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  45433. } else {
  45434. this.mask = new PDFImage({
  45435. xref,
  45436. res,
  45437. image: mask,
  45438. isInline,
  45439. isMask: true,
  45440. pdfFunctionFactory,
  45441. localColorSpaceCache
  45442. });
  45443. }
  45444. } else {
  45445. this.mask = mask;
  45446. }
  45447. }
  45448. }
  45449. static async buildImage({
  45450. xref,
  45451. res,
  45452. image,
  45453. isInline = false,
  45454. pdfFunctionFactory,
  45455. localColorSpaceCache
  45456. }) {
  45457. const imageData = image;
  45458. let smaskData = null;
  45459. let maskData = null;
  45460. const smask = image.dict.get("SMask");
  45461. const mask = image.dict.get("Mask");
  45462. if (smask) {
  45463. smaskData = smask;
  45464. } else if (mask) {
  45465. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  45466. maskData = mask;
  45467. } else {
  45468. (0, _util.warn)("Unsupported mask format.");
  45469. }
  45470. }
  45471. return new PDFImage({
  45472. xref,
  45473. res,
  45474. image: imageData,
  45475. isInline,
  45476. smask: smaskData,
  45477. mask: maskData,
  45478. pdfFunctionFactory,
  45479. localColorSpaceCache
  45480. });
  45481. }
  45482. static createMask({
  45483. imgArray,
  45484. width,
  45485. height,
  45486. imageIsFromDecodeStream,
  45487. inverseDecode,
  45488. interpolate
  45489. }) {
  45490. const computedLength = (width + 7 >> 3) * height;
  45491. const actualLength = imgArray.byteLength;
  45492. const haveFullData = computedLength === actualLength;
  45493. let data, i;
  45494. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  45495. data = imgArray;
  45496. } else if (!inverseDecode) {
  45497. data = new Uint8ClampedArray(actualLength);
  45498. data.set(imgArray);
  45499. } else {
  45500. data = new Uint8ClampedArray(computedLength);
  45501. data.set(imgArray);
  45502. for (i = actualLength; i < computedLength; i++) {
  45503. data[i] = 0xff;
  45504. }
  45505. }
  45506. if (inverseDecode) {
  45507. for (i = 0; i < actualLength; i++) {
  45508. data[i] ^= 0xff;
  45509. }
  45510. }
  45511. return {
  45512. data,
  45513. width,
  45514. height,
  45515. interpolate
  45516. };
  45517. }
  45518. get drawWidth() {
  45519. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  45520. }
  45521. get drawHeight() {
  45522. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  45523. }
  45524. decodeBuffer(buffer) {
  45525. const bpc = this.bpc;
  45526. const numComps = this.numComps;
  45527. const decodeAddends = this.decodeAddends;
  45528. const decodeCoefficients = this.decodeCoefficients;
  45529. const max = (1 << bpc) - 1;
  45530. let i, ii;
  45531. if (bpc === 1) {
  45532. for (i = 0, ii = buffer.length; i < ii; i++) {
  45533. buffer[i] = +!buffer[i];
  45534. }
  45535. return;
  45536. }
  45537. let index = 0;
  45538. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  45539. for (let j = 0; j < numComps; j++) {
  45540. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  45541. index++;
  45542. }
  45543. }
  45544. }
  45545. getComponents(buffer) {
  45546. const bpc = this.bpc;
  45547. if (bpc === 8) {
  45548. return buffer;
  45549. }
  45550. const width = this.width;
  45551. const height = this.height;
  45552. const numComps = this.numComps;
  45553. const length = width * height * numComps;
  45554. let bufferPos = 0;
  45555. let output;
  45556. if (bpc <= 8) {
  45557. output = new Uint8Array(length);
  45558. } else if (bpc <= 16) {
  45559. output = new Uint16Array(length);
  45560. } else {
  45561. output = new Uint32Array(length);
  45562. }
  45563. const rowComps = width * numComps;
  45564. const max = (1 << bpc) - 1;
  45565. let i = 0,
  45566. ii,
  45567. buf;
  45568. if (bpc === 1) {
  45569. let mask, loop1End, loop2End;
  45570. for (let j = 0; j < height; j++) {
  45571. loop1End = i + (rowComps & ~7);
  45572. loop2End = i + rowComps;
  45573. while (i < loop1End) {
  45574. buf = buffer[bufferPos++];
  45575. output[i] = buf >> 7 & 1;
  45576. output[i + 1] = buf >> 6 & 1;
  45577. output[i + 2] = buf >> 5 & 1;
  45578. output[i + 3] = buf >> 4 & 1;
  45579. output[i + 4] = buf >> 3 & 1;
  45580. output[i + 5] = buf >> 2 & 1;
  45581. output[i + 6] = buf >> 1 & 1;
  45582. output[i + 7] = buf & 1;
  45583. i += 8;
  45584. }
  45585. if (i < loop2End) {
  45586. buf = buffer[bufferPos++];
  45587. mask = 128;
  45588. while (i < loop2End) {
  45589. output[i++] = +!!(buf & mask);
  45590. mask >>= 1;
  45591. }
  45592. }
  45593. }
  45594. } else {
  45595. let bits = 0;
  45596. buf = 0;
  45597. for (i = 0, ii = length; i < ii; ++i) {
  45598. if (i % rowComps === 0) {
  45599. buf = 0;
  45600. bits = 0;
  45601. }
  45602. while (bits < bpc) {
  45603. buf = buf << 8 | buffer[bufferPos++];
  45604. bits += 8;
  45605. }
  45606. const remainingBits = bits - bpc;
  45607. let value = buf >> remainingBits;
  45608. if (value < 0) {
  45609. value = 0;
  45610. } else if (value > max) {
  45611. value = max;
  45612. }
  45613. output[i] = value;
  45614. buf &= (1 << remainingBits) - 1;
  45615. bits = remainingBits;
  45616. }
  45617. }
  45618. return output;
  45619. }
  45620. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  45621. const smask = this.smask;
  45622. const mask = this.mask;
  45623. let alphaBuf, sw, sh, i, ii, j;
  45624. if (smask) {
  45625. sw = smask.width;
  45626. sh = smask.height;
  45627. alphaBuf = new Uint8ClampedArray(sw * sh);
  45628. smask.fillGrayBuffer(alphaBuf);
  45629. if (sw !== width || sh !== height) {
  45630. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  45631. }
  45632. } else if (mask) {
  45633. if (mask instanceof PDFImage) {
  45634. sw = mask.width;
  45635. sh = mask.height;
  45636. alphaBuf = new Uint8ClampedArray(sw * sh);
  45637. mask.numComps = 1;
  45638. mask.fillGrayBuffer(alphaBuf);
  45639. for (i = 0, ii = sw * sh; i < ii; ++i) {
  45640. alphaBuf[i] = 255 - alphaBuf[i];
  45641. }
  45642. if (sw !== width || sh !== height) {
  45643. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  45644. }
  45645. } else if (Array.isArray(mask)) {
  45646. alphaBuf = new Uint8ClampedArray(width * height);
  45647. const numComps = this.numComps;
  45648. for (i = 0, ii = width * height; i < ii; ++i) {
  45649. let opacity = 0;
  45650. const imageOffset = i * numComps;
  45651. for (j = 0; j < numComps; ++j) {
  45652. const color = image[imageOffset + j];
  45653. const maskOffset = j * 2;
  45654. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  45655. opacity = 255;
  45656. break;
  45657. }
  45658. }
  45659. alphaBuf[i] = opacity;
  45660. }
  45661. } else {
  45662. throw new _util.FormatError("Unknown mask format.");
  45663. }
  45664. }
  45665. if (alphaBuf) {
  45666. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45667. rgbaBuf[j] = alphaBuf[i];
  45668. }
  45669. } else {
  45670. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45671. rgbaBuf[j] = 255;
  45672. }
  45673. }
  45674. }
  45675. undoPreblend(buffer, width, height) {
  45676. const matte = this.smask && this.smask.matte;
  45677. if (!matte) {
  45678. return;
  45679. }
  45680. const matteRgb = this.colorSpace.getRgb(matte, 0);
  45681. const matteR = matteRgb[0];
  45682. const matteG = matteRgb[1];
  45683. const matteB = matteRgb[2];
  45684. const length = width * height * 4;
  45685. for (let i = 0; i < length; i += 4) {
  45686. const alpha = buffer[i + 3];
  45687. if (alpha === 0) {
  45688. buffer[i] = 255;
  45689. buffer[i + 1] = 255;
  45690. buffer[i + 2] = 255;
  45691. continue;
  45692. }
  45693. const k = 255 / alpha;
  45694. buffer[i] = (buffer[i] - matteR) * k + matteR;
  45695. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  45696. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  45697. }
  45698. }
  45699. createImageData(forceRGBA = false) {
  45700. const drawWidth = this.drawWidth;
  45701. const drawHeight = this.drawHeight;
  45702. const imgData = {
  45703. width: drawWidth,
  45704. height: drawHeight,
  45705. interpolate: this.interpolate,
  45706. kind: 0,
  45707. data: null
  45708. };
  45709. const numComps = this.numComps;
  45710. const originalWidth = this.width;
  45711. const originalHeight = this.height;
  45712. const bpc = this.bpc;
  45713. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  45714. let imgArray;
  45715. if (!forceRGBA) {
  45716. let kind;
  45717. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  45718. kind = _util.ImageKind.GRAYSCALE_1BPP;
  45719. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  45720. kind = _util.ImageKind.RGB_24BPP;
  45721. }
  45722. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  45723. imgData.kind = kind;
  45724. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45725. if (this.image instanceof _decode_stream.DecodeStream) {
  45726. imgData.data = imgArray;
  45727. } else {
  45728. const newArray = new Uint8ClampedArray(imgArray.length);
  45729. newArray.set(imgArray);
  45730. imgData.data = newArray;
  45731. }
  45732. if (this.needsDecode) {
  45733. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  45734. const buffer = imgData.data;
  45735. for (let i = 0, ii = buffer.length; i < ii; i++) {
  45736. buffer[i] ^= 0xff;
  45737. }
  45738. }
  45739. return imgData;
  45740. }
  45741. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  45742. let imageLength = originalHeight * rowBytes;
  45743. switch (this.colorSpace.name) {
  45744. case "DeviceGray":
  45745. imageLength *= 3;
  45746. case "DeviceRGB":
  45747. case "DeviceCMYK":
  45748. imgData.kind = _util.ImageKind.RGB_24BPP;
  45749. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  45750. return imgData;
  45751. }
  45752. }
  45753. }
  45754. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45755. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  45756. const comps = this.getComponents(imgArray);
  45757. let alpha01, maybeUndoPreblend;
  45758. if (!forceRGBA && !this.smask && !this.mask) {
  45759. imgData.kind = _util.ImageKind.RGB_24BPP;
  45760. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  45761. alpha01 = 0;
  45762. maybeUndoPreblend = false;
  45763. } else {
  45764. imgData.kind = _util.ImageKind.RGBA_32BPP;
  45765. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  45766. alpha01 = 1;
  45767. maybeUndoPreblend = true;
  45768. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  45769. }
  45770. if (this.needsDecode) {
  45771. this.decodeBuffer(comps);
  45772. }
  45773. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  45774. if (maybeUndoPreblend) {
  45775. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  45776. }
  45777. return imgData;
  45778. }
  45779. fillGrayBuffer(buffer) {
  45780. const numComps = this.numComps;
  45781. if (numComps !== 1) {
  45782. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  45783. }
  45784. const width = this.width;
  45785. const height = this.height;
  45786. const bpc = this.bpc;
  45787. const rowBytes = width * numComps * bpc + 7 >> 3;
  45788. const imgArray = this.getImageBytes(height * rowBytes);
  45789. const comps = this.getComponents(imgArray);
  45790. let i, length;
  45791. if (bpc === 1) {
  45792. length = width * height;
  45793. if (this.needsDecode) {
  45794. for (i = 0; i < length; ++i) {
  45795. buffer[i] = comps[i] - 1 & 255;
  45796. }
  45797. } else {
  45798. for (i = 0; i < length; ++i) {
  45799. buffer[i] = -comps[i] & 255;
  45800. }
  45801. }
  45802. return;
  45803. }
  45804. if (this.needsDecode) {
  45805. this.decodeBuffer(comps);
  45806. }
  45807. length = width * height;
  45808. const scale = 255 / ((1 << bpc) - 1);
  45809. for (i = 0; i < length; ++i) {
  45810. buffer[i] = scale * comps[i];
  45811. }
  45812. }
  45813. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  45814. this.image.reset();
  45815. this.image.drawWidth = drawWidth || this.width;
  45816. this.image.drawHeight = drawHeight || this.height;
  45817. this.image.forceRGB = !!forceRGB;
  45818. return this.image.getBytes(length, true);
  45819. }
  45820. }
  45821. exports.PDFImage = PDFImage;
  45822. /***/ }),
  45823. /* 64 */
  45824. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45825. Object.defineProperty(exports, "__esModule", ({
  45826. value: true
  45827. }));
  45828. exports.Catalog = void 0;
  45829. var _primitives = __w_pdfjs_require__(5);
  45830. var _core_utils = __w_pdfjs_require__(9);
  45831. var _util = __w_pdfjs_require__(2);
  45832. var _name_number_tree = __w_pdfjs_require__(65);
  45833. var _base_stream = __w_pdfjs_require__(6);
  45834. var _colorspace = __w_pdfjs_require__(24);
  45835. var _file_spec = __w_pdfjs_require__(66);
  45836. var _image_utils = __w_pdfjs_require__(58);
  45837. var _metadata_parser = __w_pdfjs_require__(67);
  45838. var _struct_tree = __w_pdfjs_require__(69);
  45839. function fetchDestination(dest) {
  45840. if (dest instanceof _primitives.Dict) {
  45841. dest = dest.get("D");
  45842. }
  45843. return Array.isArray(dest) ? dest : null;
  45844. }
  45845. class Catalog {
  45846. constructor(pdfManager, xref) {
  45847. this.pdfManager = pdfManager;
  45848. this.xref = xref;
  45849. this._catDict = xref.getCatalogObj();
  45850. if (!(this._catDict instanceof _primitives.Dict)) {
  45851. throw new _util.FormatError("Catalog object is not a dictionary.");
  45852. }
  45853. this.toplevelPagesDict;
  45854. this._actualNumPages = null;
  45855. this.fontCache = new _primitives.RefSetCache();
  45856. this.builtInCMapCache = new Map();
  45857. this.standardFontDataCache = new Map();
  45858. this.globalImageCache = new _image_utils.GlobalImageCache();
  45859. this.pageKidsCountCache = new _primitives.RefSetCache();
  45860. this.pageIndexCache = new _primitives.RefSetCache();
  45861. this.nonBlendModesSet = new _primitives.RefSet();
  45862. }
  45863. get version() {
  45864. const version = this._catDict.get("Version");
  45865. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  45866. }
  45867. get lang() {
  45868. const lang = this._catDict.get("Lang");
  45869. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  45870. }
  45871. get needsRendering() {
  45872. const needsRendering = this._catDict.get("NeedsRendering");
  45873. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  45874. }
  45875. get collection() {
  45876. let collection = null;
  45877. try {
  45878. const obj = this._catDict.get("Collection");
  45879. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45880. collection = obj;
  45881. }
  45882. } catch (ex) {
  45883. if (ex instanceof _core_utils.MissingDataException) {
  45884. throw ex;
  45885. }
  45886. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  45887. }
  45888. return (0, _util.shadow)(this, "collection", collection);
  45889. }
  45890. get acroForm() {
  45891. let acroForm = null;
  45892. try {
  45893. const obj = this._catDict.get("AcroForm");
  45894. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45895. acroForm = obj;
  45896. }
  45897. } catch (ex) {
  45898. if (ex instanceof _core_utils.MissingDataException) {
  45899. throw ex;
  45900. }
  45901. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  45902. }
  45903. return (0, _util.shadow)(this, "acroForm", acroForm);
  45904. }
  45905. get acroFormRef() {
  45906. const value = this._catDict.getRaw("AcroForm");
  45907. return (0, _util.shadow)(this, "acroFormRef", (0, _primitives.isRef)(value) ? value : null);
  45908. }
  45909. get metadata() {
  45910. const streamRef = this._catDict.getRaw("Metadata");
  45911. if (!(streamRef instanceof _primitives.Ref)) {
  45912. return (0, _util.shadow)(this, "metadata", null);
  45913. }
  45914. let metadata = null;
  45915. try {
  45916. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  45917. const stream = this.xref.fetch(streamRef, suppressEncryption);
  45918. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  45919. const type = stream.dict.get("Type");
  45920. const subtype = stream.dict.get("Subtype");
  45921. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  45922. const data = (0, _util.stringToUTF8String)(stream.getString());
  45923. if (data) {
  45924. metadata = new _metadata_parser.MetadataParser(data).serializable;
  45925. }
  45926. }
  45927. }
  45928. } catch (ex) {
  45929. if (ex instanceof _core_utils.MissingDataException) {
  45930. throw ex;
  45931. }
  45932. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  45933. }
  45934. return (0, _util.shadow)(this, "metadata", metadata);
  45935. }
  45936. get markInfo() {
  45937. let markInfo = null;
  45938. try {
  45939. markInfo = this._readMarkInfo();
  45940. } catch (ex) {
  45941. if (ex instanceof _core_utils.MissingDataException) {
  45942. throw ex;
  45943. }
  45944. (0, _util.warn)("Unable to read mark info.");
  45945. }
  45946. return (0, _util.shadow)(this, "markInfo", markInfo);
  45947. }
  45948. _readMarkInfo() {
  45949. const obj = this._catDict.get("MarkInfo");
  45950. if (!(0, _primitives.isDict)(obj)) {
  45951. return null;
  45952. }
  45953. const markInfo = Object.assign(Object.create(null), {
  45954. Marked: false,
  45955. UserProperties: false,
  45956. Suspects: false
  45957. });
  45958. for (const key in markInfo) {
  45959. if (!obj.has(key)) {
  45960. continue;
  45961. }
  45962. const value = obj.get(key);
  45963. if (!(0, _util.isBool)(value)) {
  45964. continue;
  45965. }
  45966. markInfo[key] = value;
  45967. }
  45968. return markInfo;
  45969. }
  45970. get structTreeRoot() {
  45971. let structTree = null;
  45972. try {
  45973. structTree = this._readStructTreeRoot();
  45974. } catch (ex) {
  45975. if (ex instanceof _core_utils.MissingDataException) {
  45976. throw ex;
  45977. }
  45978. (0, _util.warn)("Unable read to structTreeRoot info.");
  45979. }
  45980. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  45981. }
  45982. _readStructTreeRoot() {
  45983. const obj = this._catDict.get("StructTreeRoot");
  45984. if (!(0, _primitives.isDict)(obj)) {
  45985. return null;
  45986. }
  45987. const root = new _struct_tree.StructTreeRoot(obj);
  45988. root.init();
  45989. return root;
  45990. }
  45991. get toplevelPagesDict() {
  45992. const pagesObj = this._catDict.get("Pages");
  45993. if (!(0, _primitives.isDict)(pagesObj)) {
  45994. throw new _util.FormatError("Invalid top-level pages dictionary.");
  45995. }
  45996. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  45997. }
  45998. get documentOutline() {
  45999. let obj = null;
  46000. try {
  46001. obj = this._readDocumentOutline();
  46002. } catch (ex) {
  46003. if (ex instanceof _core_utils.MissingDataException) {
  46004. throw ex;
  46005. }
  46006. (0, _util.warn)("Unable to read document outline.");
  46007. }
  46008. return (0, _util.shadow)(this, "documentOutline", obj);
  46009. }
  46010. _readDocumentOutline() {
  46011. let obj = this._catDict.get("Outlines");
  46012. if (!(0, _primitives.isDict)(obj)) {
  46013. return null;
  46014. }
  46015. obj = obj.getRaw("First");
  46016. if (!(0, _primitives.isRef)(obj)) {
  46017. return null;
  46018. }
  46019. const root = {
  46020. items: []
  46021. };
  46022. const queue = [{
  46023. obj,
  46024. parent: root
  46025. }];
  46026. const processed = new _primitives.RefSet();
  46027. processed.put(obj);
  46028. const xref = this.xref,
  46029. blackColor = new Uint8ClampedArray(3);
  46030. while (queue.length > 0) {
  46031. const i = queue.shift();
  46032. const outlineDict = xref.fetchIfRef(i.obj);
  46033. if (outlineDict === null) {
  46034. continue;
  46035. }
  46036. if (!outlineDict.has("Title")) {
  46037. throw new _util.FormatError("Invalid outline item encountered.");
  46038. }
  46039. const data = {
  46040. url: null,
  46041. dest: null
  46042. };
  46043. Catalog.parseDestDictionary({
  46044. destDict: outlineDict,
  46045. resultObj: data,
  46046. docBaseUrl: this.pdfManager.docBaseUrl
  46047. });
  46048. const title = outlineDict.get("Title");
  46049. const flags = outlineDict.get("F") || 0;
  46050. const color = outlineDict.getArray("C");
  46051. const count = outlineDict.get("Count");
  46052. let rgbColor = blackColor;
  46053. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  46054. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  46055. }
  46056. const outlineItem = {
  46057. dest: data.dest,
  46058. url: data.url,
  46059. unsafeUrl: data.unsafeUrl,
  46060. newWindow: data.newWindow,
  46061. title: (0, _util.stringToPDFString)(title),
  46062. color: rgbColor,
  46063. count: Number.isInteger(count) ? count : undefined,
  46064. bold: !!(flags & 2),
  46065. italic: !!(flags & 1),
  46066. items: []
  46067. };
  46068. i.parent.items.push(outlineItem);
  46069. obj = outlineDict.getRaw("First");
  46070. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  46071. queue.push({
  46072. obj,
  46073. parent: outlineItem
  46074. });
  46075. processed.put(obj);
  46076. }
  46077. obj = outlineDict.getRaw("Next");
  46078. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  46079. queue.push({
  46080. obj,
  46081. parent: i.parent
  46082. });
  46083. processed.put(obj);
  46084. }
  46085. }
  46086. return root.items.length > 0 ? root.items : null;
  46087. }
  46088. get permissions() {
  46089. let permissions = null;
  46090. try {
  46091. permissions = this._readPermissions();
  46092. } catch (ex) {
  46093. if (ex instanceof _core_utils.MissingDataException) {
  46094. throw ex;
  46095. }
  46096. (0, _util.warn)("Unable to read permissions.");
  46097. }
  46098. return (0, _util.shadow)(this, "permissions", permissions);
  46099. }
  46100. _readPermissions() {
  46101. const encrypt = this.xref.trailer.get("Encrypt");
  46102. if (!(0, _primitives.isDict)(encrypt)) {
  46103. return null;
  46104. }
  46105. let flags = encrypt.get("P");
  46106. if (!(0, _util.isNum)(flags)) {
  46107. return null;
  46108. }
  46109. flags += 2 ** 32;
  46110. const permissions = [];
  46111. for (const key in _util.PermissionFlag) {
  46112. const value = _util.PermissionFlag[key];
  46113. if (flags & value) {
  46114. permissions.push(value);
  46115. }
  46116. }
  46117. return permissions;
  46118. }
  46119. get optionalContentConfig() {
  46120. let config = null;
  46121. try {
  46122. const properties = this._catDict.get("OCProperties");
  46123. if (!properties) {
  46124. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46125. }
  46126. const defaultConfig = properties.get("D");
  46127. if (!defaultConfig) {
  46128. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46129. }
  46130. const groupsData = properties.get("OCGs");
  46131. if (!Array.isArray(groupsData)) {
  46132. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46133. }
  46134. const groups = [];
  46135. const groupRefs = [];
  46136. for (const groupRef of groupsData) {
  46137. if (!(0, _primitives.isRef)(groupRef)) {
  46138. continue;
  46139. }
  46140. groupRefs.push(groupRef);
  46141. const group = this.xref.fetchIfRef(groupRef);
  46142. groups.push({
  46143. id: groupRef.toString(),
  46144. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  46145. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  46146. });
  46147. }
  46148. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  46149. config.groups = groups;
  46150. } catch (ex) {
  46151. if (ex instanceof _core_utils.MissingDataException) {
  46152. throw ex;
  46153. }
  46154. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  46155. }
  46156. return (0, _util.shadow)(this, "optionalContentConfig", config);
  46157. }
  46158. _readOptionalContentConfig(config, contentGroupRefs) {
  46159. function parseOnOff(refs) {
  46160. const onParsed = [];
  46161. if (Array.isArray(refs)) {
  46162. for (const value of refs) {
  46163. if (!(0, _primitives.isRef)(value)) {
  46164. continue;
  46165. }
  46166. if (contentGroupRefs.includes(value)) {
  46167. onParsed.push(value.toString());
  46168. }
  46169. }
  46170. }
  46171. return onParsed;
  46172. }
  46173. function parseOrder(refs, nestedLevels = 0) {
  46174. if (!Array.isArray(refs)) {
  46175. return null;
  46176. }
  46177. const order = [];
  46178. for (const value of refs) {
  46179. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  46180. parsedOrderRefs.put(value);
  46181. order.push(value.toString());
  46182. continue;
  46183. }
  46184. const nestedOrder = parseNestedOrder(value, nestedLevels);
  46185. if (nestedOrder) {
  46186. order.push(nestedOrder);
  46187. }
  46188. }
  46189. if (nestedLevels > 0) {
  46190. return order;
  46191. }
  46192. const hiddenGroups = [];
  46193. for (const groupRef of contentGroupRefs) {
  46194. if (parsedOrderRefs.has(groupRef)) {
  46195. continue;
  46196. }
  46197. hiddenGroups.push(groupRef.toString());
  46198. }
  46199. if (hiddenGroups.length) {
  46200. order.push({
  46201. name: null,
  46202. order: hiddenGroups
  46203. });
  46204. }
  46205. return order;
  46206. }
  46207. function parseNestedOrder(ref, nestedLevels) {
  46208. if (++nestedLevels > MAX_NESTED_LEVELS) {
  46209. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  46210. return null;
  46211. }
  46212. const value = xref.fetchIfRef(ref);
  46213. if (!Array.isArray(value)) {
  46214. return null;
  46215. }
  46216. const nestedName = xref.fetchIfRef(value[0]);
  46217. if (typeof nestedName !== "string") {
  46218. return null;
  46219. }
  46220. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  46221. if (!nestedOrder || !nestedOrder.length) {
  46222. return null;
  46223. }
  46224. return {
  46225. name: (0, _util.stringToPDFString)(nestedName),
  46226. order: nestedOrder
  46227. };
  46228. }
  46229. const xref = this.xref,
  46230. parsedOrderRefs = new _primitives.RefSet(),
  46231. MAX_NESTED_LEVELS = 10;
  46232. return {
  46233. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  46234. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  46235. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  46236. on: parseOnOff(config.get("ON")),
  46237. off: parseOnOff(config.get("OFF")),
  46238. order: parseOrder(config.get("Order")),
  46239. groups: null
  46240. };
  46241. }
  46242. setActualNumPages(num = null) {
  46243. this._actualNumPages = num;
  46244. }
  46245. get hasActualNumPages() {
  46246. return this._actualNumPages !== null;
  46247. }
  46248. get _pagesCount() {
  46249. const obj = this.toplevelPagesDict.get("Count");
  46250. if (!Number.isInteger(obj)) {
  46251. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  46252. }
  46253. return (0, _util.shadow)(this, "_pagesCount", obj);
  46254. }
  46255. get numPages() {
  46256. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  46257. }
  46258. get destinations() {
  46259. const obj = this._readDests(),
  46260. dests = Object.create(null);
  46261. if (obj instanceof _name_number_tree.NameTree) {
  46262. for (const [key, value] of obj.getAll()) {
  46263. const dest = fetchDestination(value);
  46264. if (dest) {
  46265. dests[key] = dest;
  46266. }
  46267. }
  46268. } else if (obj instanceof _primitives.Dict) {
  46269. obj.forEach(function (key, value) {
  46270. const dest = fetchDestination(value);
  46271. if (dest) {
  46272. dests[key] = dest;
  46273. }
  46274. });
  46275. }
  46276. return (0, _util.shadow)(this, "destinations", dests);
  46277. }
  46278. getDestination(id) {
  46279. const obj = this._readDests();
  46280. if (obj instanceof _name_number_tree.NameTree) {
  46281. const dest = fetchDestination(obj.get(id));
  46282. if (dest) {
  46283. return dest;
  46284. }
  46285. const allDest = this.destinations[id];
  46286. if (allDest) {
  46287. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  46288. return allDest;
  46289. }
  46290. } else if (obj instanceof _primitives.Dict) {
  46291. const dest = fetchDestination(obj.get(id));
  46292. if (dest) {
  46293. return dest;
  46294. }
  46295. }
  46296. return null;
  46297. }
  46298. _readDests() {
  46299. const obj = this._catDict.get("Names");
  46300. if (obj && obj.has("Dests")) {
  46301. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  46302. } else if (this._catDict.has("Dests")) {
  46303. return this._catDict.get("Dests");
  46304. }
  46305. return undefined;
  46306. }
  46307. get pageLabels() {
  46308. let obj = null;
  46309. try {
  46310. obj = this._readPageLabels();
  46311. } catch (ex) {
  46312. if (ex instanceof _core_utils.MissingDataException) {
  46313. throw ex;
  46314. }
  46315. (0, _util.warn)("Unable to read page labels.");
  46316. }
  46317. return (0, _util.shadow)(this, "pageLabels", obj);
  46318. }
  46319. _readPageLabels() {
  46320. const obj = this._catDict.getRaw("PageLabels");
  46321. if (!obj) {
  46322. return null;
  46323. }
  46324. const pageLabels = new Array(this.numPages);
  46325. let style = null,
  46326. prefix = "";
  46327. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  46328. const nums = numberTree.getAll();
  46329. let currentLabel = "",
  46330. currentIndex = 1;
  46331. for (let i = 0, ii = this.numPages; i < ii; i++) {
  46332. const labelDict = nums.get(i);
  46333. if (labelDict !== undefined) {
  46334. if (!(0, _primitives.isDict)(labelDict)) {
  46335. throw new _util.FormatError("PageLabel is not a dictionary.");
  46336. }
  46337. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  46338. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  46339. }
  46340. if (labelDict.has("S")) {
  46341. const s = labelDict.get("S");
  46342. if (!(0, _primitives.isName)(s)) {
  46343. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  46344. }
  46345. style = s.name;
  46346. } else {
  46347. style = null;
  46348. }
  46349. if (labelDict.has("P")) {
  46350. const p = labelDict.get("P");
  46351. if (!(0, _util.isString)(p)) {
  46352. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  46353. }
  46354. prefix = (0, _util.stringToPDFString)(p);
  46355. } else {
  46356. prefix = "";
  46357. }
  46358. if (labelDict.has("St")) {
  46359. const st = labelDict.get("St");
  46360. if (!(Number.isInteger(st) && st >= 1)) {
  46361. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  46362. }
  46363. currentIndex = st;
  46364. } else {
  46365. currentIndex = 1;
  46366. }
  46367. }
  46368. switch (style) {
  46369. case "D":
  46370. currentLabel = currentIndex;
  46371. break;
  46372. case "R":
  46373. case "r":
  46374. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  46375. break;
  46376. case "A":
  46377. case "a":
  46378. const LIMIT = 26;
  46379. const A_UPPER_CASE = 0x41,
  46380. A_LOWER_CASE = 0x61;
  46381. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  46382. const letterIndex = currentIndex - 1;
  46383. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  46384. const charBuf = [];
  46385. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  46386. charBuf.push(character);
  46387. }
  46388. currentLabel = charBuf.join("");
  46389. break;
  46390. default:
  46391. if (style) {
  46392. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  46393. }
  46394. currentLabel = "";
  46395. }
  46396. pageLabels[i] = prefix + currentLabel;
  46397. currentIndex++;
  46398. }
  46399. return pageLabels;
  46400. }
  46401. get pageLayout() {
  46402. const obj = this._catDict.get("PageLayout");
  46403. let pageLayout = "";
  46404. if ((0, _primitives.isName)(obj)) {
  46405. switch (obj.name) {
  46406. case "SinglePage":
  46407. case "OneColumn":
  46408. case "TwoColumnLeft":
  46409. case "TwoColumnRight":
  46410. case "TwoPageLeft":
  46411. case "TwoPageRight":
  46412. pageLayout = obj.name;
  46413. }
  46414. }
  46415. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  46416. }
  46417. get pageMode() {
  46418. const obj = this._catDict.get("PageMode");
  46419. let pageMode = "UseNone";
  46420. if ((0, _primitives.isName)(obj)) {
  46421. switch (obj.name) {
  46422. case "UseNone":
  46423. case "UseOutlines":
  46424. case "UseThumbs":
  46425. case "FullScreen":
  46426. case "UseOC":
  46427. case "UseAttachments":
  46428. pageMode = obj.name;
  46429. }
  46430. }
  46431. return (0, _util.shadow)(this, "pageMode", pageMode);
  46432. }
  46433. get viewerPreferences() {
  46434. const ViewerPreferencesValidators = {
  46435. HideToolbar: _util.isBool,
  46436. HideMenubar: _util.isBool,
  46437. HideWindowUI: _util.isBool,
  46438. FitWindow: _util.isBool,
  46439. CenterWindow: _util.isBool,
  46440. DisplayDocTitle: _util.isBool,
  46441. NonFullScreenPageMode: _primitives.isName,
  46442. Direction: _primitives.isName,
  46443. ViewArea: _primitives.isName,
  46444. ViewClip: _primitives.isName,
  46445. PrintArea: _primitives.isName,
  46446. PrintClip: _primitives.isName,
  46447. PrintScaling: _primitives.isName,
  46448. Duplex: _primitives.isName,
  46449. PickTrayByPDFSize: _util.isBool,
  46450. PrintPageRange: Array.isArray,
  46451. NumCopies: Number.isInteger
  46452. };
  46453. const obj = this._catDict.get("ViewerPreferences");
  46454. let prefs = null;
  46455. if ((0, _primitives.isDict)(obj)) {
  46456. for (const key in ViewerPreferencesValidators) {
  46457. if (!obj.has(key)) {
  46458. continue;
  46459. }
  46460. const value = obj.get(key);
  46461. if (!ViewerPreferencesValidators[key](value)) {
  46462. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  46463. continue;
  46464. }
  46465. let prefValue;
  46466. switch (key) {
  46467. case "NonFullScreenPageMode":
  46468. switch (value.name) {
  46469. case "UseNone":
  46470. case "UseOutlines":
  46471. case "UseThumbs":
  46472. case "UseOC":
  46473. prefValue = value.name;
  46474. break;
  46475. default:
  46476. prefValue = "UseNone";
  46477. }
  46478. break;
  46479. case "Direction":
  46480. switch (value.name) {
  46481. case "L2R":
  46482. case "R2L":
  46483. prefValue = value.name;
  46484. break;
  46485. default:
  46486. prefValue = "L2R";
  46487. }
  46488. break;
  46489. case "ViewArea":
  46490. case "ViewClip":
  46491. case "PrintArea":
  46492. case "PrintClip":
  46493. switch (value.name) {
  46494. case "MediaBox":
  46495. case "CropBox":
  46496. case "BleedBox":
  46497. case "TrimBox":
  46498. case "ArtBox":
  46499. prefValue = value.name;
  46500. break;
  46501. default:
  46502. prefValue = "CropBox";
  46503. }
  46504. break;
  46505. case "PrintScaling":
  46506. switch (value.name) {
  46507. case "None":
  46508. case "AppDefault":
  46509. prefValue = value.name;
  46510. break;
  46511. default:
  46512. prefValue = "AppDefault";
  46513. }
  46514. break;
  46515. case "Duplex":
  46516. switch (value.name) {
  46517. case "Simplex":
  46518. case "DuplexFlipShortEdge":
  46519. case "DuplexFlipLongEdge":
  46520. prefValue = value.name;
  46521. break;
  46522. default:
  46523. prefValue = "None";
  46524. }
  46525. break;
  46526. case "PrintPageRange":
  46527. const length = value.length;
  46528. if (length % 2 !== 0) {
  46529. break;
  46530. }
  46531. const isValid = value.every((page, i, arr) => {
  46532. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  46533. });
  46534. if (isValid) {
  46535. prefValue = value;
  46536. }
  46537. break;
  46538. case "NumCopies":
  46539. if (value > 0) {
  46540. prefValue = value;
  46541. }
  46542. break;
  46543. default:
  46544. if (typeof value !== "boolean") {
  46545. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  46546. }
  46547. prefValue = value;
  46548. }
  46549. if (prefValue !== undefined) {
  46550. if (!prefs) {
  46551. prefs = Object.create(null);
  46552. }
  46553. prefs[key] = prefValue;
  46554. } else {
  46555. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  46556. }
  46557. }
  46558. }
  46559. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  46560. }
  46561. get openAction() {
  46562. const obj = this._catDict.get("OpenAction");
  46563. const openAction = Object.create(null);
  46564. if ((0, _primitives.isDict)(obj)) {
  46565. const destDict = new _primitives.Dict(this.xref);
  46566. destDict.set("A", obj);
  46567. const resultObj = {
  46568. url: null,
  46569. dest: null,
  46570. action: null
  46571. };
  46572. Catalog.parseDestDictionary({
  46573. destDict,
  46574. resultObj
  46575. });
  46576. if (Array.isArray(resultObj.dest)) {
  46577. openAction.dest = resultObj.dest;
  46578. } else if (resultObj.action) {
  46579. openAction.action = resultObj.action;
  46580. }
  46581. } else if (Array.isArray(obj)) {
  46582. openAction.dest = obj;
  46583. }
  46584. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  46585. }
  46586. get attachments() {
  46587. const obj = this._catDict.get("Names");
  46588. let attachments = null;
  46589. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  46590. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  46591. for (const [key, value] of nameTree.getAll()) {
  46592. const fs = new _file_spec.FileSpec(value, this.xref);
  46593. if (!attachments) {
  46594. attachments = Object.create(null);
  46595. }
  46596. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  46597. }
  46598. }
  46599. return (0, _util.shadow)(this, "attachments", attachments);
  46600. }
  46601. get xfaImages() {
  46602. const obj = this._catDict.get("Names");
  46603. let xfaImages = null;
  46604. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  46605. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  46606. for (const [key, value] of nameTree.getAll()) {
  46607. if (!xfaImages) {
  46608. xfaImages = new _primitives.Dict(this.xref);
  46609. }
  46610. xfaImages.set(key, value);
  46611. }
  46612. }
  46613. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  46614. }
  46615. _collectJavaScript() {
  46616. const obj = this._catDict.get("Names");
  46617. let javaScript = null;
  46618. function appendIfJavaScriptDict(name, jsDict) {
  46619. if (!(jsDict instanceof _primitives.Dict)) {
  46620. return;
  46621. }
  46622. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  46623. return;
  46624. }
  46625. let js = jsDict.get("JS");
  46626. if ((0, _primitives.isStream)(js)) {
  46627. js = js.getString();
  46628. } else if (typeof js !== "string") {
  46629. return;
  46630. }
  46631. if (javaScript === null) {
  46632. javaScript = new Map();
  46633. }
  46634. javaScript.set(name, (0, _util.stringToPDFString)(js));
  46635. }
  46636. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  46637. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  46638. for (const [key, value] of nameTree.getAll()) {
  46639. appendIfJavaScriptDict(key, value);
  46640. }
  46641. }
  46642. const openAction = this._catDict.get("OpenAction");
  46643. if (openAction) {
  46644. appendIfJavaScriptDict("OpenAction", openAction);
  46645. }
  46646. return javaScript;
  46647. }
  46648. get javaScript() {
  46649. const javaScript = this._collectJavaScript();
  46650. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  46651. }
  46652. get jsActions() {
  46653. const javaScript = this._collectJavaScript();
  46654. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  46655. if (javaScript) {
  46656. if (!actions) {
  46657. actions = Object.create(null);
  46658. }
  46659. for (const [key, val] of javaScript) {
  46660. if (key in actions) {
  46661. actions[key].push(val);
  46662. } else {
  46663. actions[key] = [val];
  46664. }
  46665. }
  46666. }
  46667. return (0, _util.shadow)(this, "jsActions", actions);
  46668. }
  46669. fontFallback(id, handler) {
  46670. const promises = [];
  46671. this.fontCache.forEach(function (promise) {
  46672. promises.push(promise);
  46673. });
  46674. return Promise.all(promises).then(translatedFonts => {
  46675. for (const translatedFont of translatedFonts) {
  46676. if (translatedFont.loadedName === id) {
  46677. translatedFont.fallback(handler);
  46678. return;
  46679. }
  46680. }
  46681. });
  46682. }
  46683. cleanup(manuallyTriggered = false) {
  46684. (0, _primitives.clearPrimitiveCaches)();
  46685. this.globalImageCache.clear(manuallyTriggered);
  46686. this.pageKidsCountCache.clear();
  46687. this.pageIndexCache.clear();
  46688. this.nonBlendModesSet.clear();
  46689. const promises = [];
  46690. this.fontCache.forEach(function (promise) {
  46691. promises.push(promise);
  46692. });
  46693. return Promise.all(promises).then(translatedFonts => {
  46694. for (const {
  46695. dict
  46696. } of translatedFonts) {
  46697. delete dict.cacheKey;
  46698. }
  46699. this.fontCache.clear();
  46700. this.builtInCMapCache.clear();
  46701. this.standardFontDataCache.clear();
  46702. });
  46703. }
  46704. getPageDict(pageIndex) {
  46705. const capability = (0, _util.createPromiseCapability)();
  46706. const nodesToVisit = [this.toplevelPagesDict];
  46707. const visitedNodes = new _primitives.RefSet();
  46708. const pagesRef = this._catDict.getRaw("Pages");
  46709. if (pagesRef instanceof _primitives.Ref) {
  46710. visitedNodes.put(pagesRef);
  46711. }
  46712. const xref = this.xref,
  46713. pageKidsCountCache = this.pageKidsCountCache;
  46714. let currentPageIndex = 0;
  46715. function next() {
  46716. while (nodesToVisit.length) {
  46717. const currentNode = nodesToVisit.pop();
  46718. if (currentNode instanceof _primitives.Ref) {
  46719. const count = pageKidsCountCache.get(currentNode);
  46720. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  46721. currentPageIndex += count;
  46722. continue;
  46723. }
  46724. if (visitedNodes.has(currentNode)) {
  46725. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  46726. return;
  46727. }
  46728. visitedNodes.put(currentNode);
  46729. xref.fetchAsync(currentNode).then(function (obj) {
  46730. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  46731. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  46732. pageKidsCountCache.put(currentNode, 1);
  46733. }
  46734. if (pageIndex === currentPageIndex) {
  46735. capability.resolve([obj, currentNode]);
  46736. } else {
  46737. currentPageIndex++;
  46738. next();
  46739. }
  46740. return;
  46741. }
  46742. nodesToVisit.push(obj);
  46743. next();
  46744. }, capability.reject);
  46745. return;
  46746. }
  46747. if (!(currentNode instanceof _primitives.Dict)) {
  46748. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  46749. return;
  46750. }
  46751. let count;
  46752. try {
  46753. count = currentNode.get("Count");
  46754. } catch (ex) {
  46755. if (ex instanceof _core_utils.MissingDataException) {
  46756. throw ex;
  46757. }
  46758. }
  46759. if (Number.isInteger(count) && count >= 0) {
  46760. const objId = currentNode.objId;
  46761. if (objId && !pageKidsCountCache.has(objId)) {
  46762. pageKidsCountCache.put(objId, count);
  46763. }
  46764. if (currentPageIndex + count <= pageIndex) {
  46765. currentPageIndex += count;
  46766. continue;
  46767. }
  46768. }
  46769. let kids;
  46770. try {
  46771. kids = currentNode.get("Kids");
  46772. } catch (ex) {
  46773. if (ex instanceof _core_utils.MissingDataException) {
  46774. throw ex;
  46775. }
  46776. }
  46777. if (!Array.isArray(kids)) {
  46778. let type;
  46779. try {
  46780. type = currentNode.get("Type");
  46781. } catch (ex) {
  46782. if (ex instanceof _core_utils.MissingDataException) {
  46783. throw ex;
  46784. }
  46785. }
  46786. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  46787. if (currentPageIndex === pageIndex) {
  46788. capability.resolve([currentNode, null]);
  46789. return;
  46790. }
  46791. currentPageIndex++;
  46792. continue;
  46793. }
  46794. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  46795. return;
  46796. }
  46797. for (let last = kids.length - 1; last >= 0; last--) {
  46798. nodesToVisit.push(kids[last]);
  46799. }
  46800. }
  46801. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  46802. }
  46803. next();
  46804. return capability.promise;
  46805. }
  46806. getAllPageDicts(recoveryMode = false) {
  46807. const queue = [{
  46808. currentNode: this.toplevelPagesDict,
  46809. posInKids: 0
  46810. }];
  46811. const visitedNodes = new _primitives.RefSet();
  46812. const pagesRef = this._catDict.getRaw("Pages");
  46813. if (pagesRef instanceof _primitives.Ref) {
  46814. visitedNodes.put(pagesRef);
  46815. }
  46816. const map = new Map();
  46817. let pageIndex = 0;
  46818. function addPageDict(pageDict, pageRef) {
  46819. map.set(pageIndex++, [pageDict, pageRef]);
  46820. }
  46821. function addPageError(error) {
  46822. map.set(pageIndex++, [error, null]);
  46823. }
  46824. while (queue.length > 0) {
  46825. const queueItem = queue[queue.length - 1];
  46826. const {
  46827. currentNode,
  46828. posInKids
  46829. } = queueItem;
  46830. let kids;
  46831. try {
  46832. kids = currentNode.get("Kids");
  46833. } catch (ex) {
  46834. if (ex instanceof _core_utils.MissingDataException) {
  46835. throw ex;
  46836. }
  46837. if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
  46838. throw ex;
  46839. }
  46840. addPageError(ex);
  46841. break;
  46842. }
  46843. if (!Array.isArray(kids)) {
  46844. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  46845. break;
  46846. }
  46847. if (posInKids >= kids.length) {
  46848. queue.pop();
  46849. continue;
  46850. }
  46851. const kidObj = kids[posInKids];
  46852. let obj;
  46853. if (kidObj instanceof _primitives.Ref) {
  46854. try {
  46855. obj = this.xref.fetch(kidObj);
  46856. } catch (ex) {
  46857. if (ex instanceof _core_utils.MissingDataException) {
  46858. throw ex;
  46859. }
  46860. if (ex instanceof _core_utils.XRefEntryException && !recoveryMode) {
  46861. throw ex;
  46862. }
  46863. addPageError(ex);
  46864. break;
  46865. }
  46866. if (visitedNodes.has(kidObj)) {
  46867. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  46868. break;
  46869. }
  46870. visitedNodes.put(kidObj);
  46871. } else {
  46872. obj = kidObj;
  46873. }
  46874. if (!(obj instanceof _primitives.Dict)) {
  46875. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  46876. break;
  46877. }
  46878. if ((0, _primitives.isDict)(obj, "Page") || !obj.has("Kids")) {
  46879. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  46880. } else {
  46881. queue.push({
  46882. currentNode: obj,
  46883. posInKids: 0
  46884. });
  46885. }
  46886. queueItem.posInKids++;
  46887. }
  46888. return map;
  46889. }
  46890. getPageIndex(pageRef) {
  46891. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  46892. if (cachedPageIndex !== undefined) {
  46893. return Promise.resolve(cachedPageIndex);
  46894. }
  46895. const xref = this.xref;
  46896. function pagesBeforeRef(kidRef) {
  46897. let total = 0,
  46898. parentRef;
  46899. return xref.fetchAsync(kidRef).then(function (node) {
  46900. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  46901. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  46902. }
  46903. if (!node) {
  46904. return null;
  46905. }
  46906. if (!(0, _primitives.isDict)(node)) {
  46907. throw new _util.FormatError("Node must be a dictionary.");
  46908. }
  46909. parentRef = node.getRaw("Parent");
  46910. return node.getAsync("Parent");
  46911. }).then(function (parent) {
  46912. if (!parent) {
  46913. return null;
  46914. }
  46915. if (!(0, _primitives.isDict)(parent)) {
  46916. throw new _util.FormatError("Parent must be a dictionary.");
  46917. }
  46918. return parent.getAsync("Kids");
  46919. }).then(function (kids) {
  46920. if (!kids) {
  46921. return null;
  46922. }
  46923. const kidPromises = [];
  46924. let found = false;
  46925. for (let i = 0, ii = kids.length; i < ii; i++) {
  46926. const kid = kids[i];
  46927. if (!(0, _primitives.isRef)(kid)) {
  46928. throw new _util.FormatError("Kid must be a reference.");
  46929. }
  46930. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  46931. found = true;
  46932. break;
  46933. }
  46934. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  46935. if (!(0, _primitives.isDict)(obj)) {
  46936. throw new _util.FormatError("Kid node must be a dictionary.");
  46937. }
  46938. if (obj.has("Count")) {
  46939. total += obj.get("Count");
  46940. } else {
  46941. total++;
  46942. }
  46943. }));
  46944. }
  46945. if (!found) {
  46946. throw new _util.FormatError("Kid reference not found in parent's kids.");
  46947. }
  46948. return Promise.all(kidPromises).then(function () {
  46949. return [total, parentRef];
  46950. });
  46951. });
  46952. }
  46953. let total = 0;
  46954. const next = ref => pagesBeforeRef(ref).then(args => {
  46955. if (!args) {
  46956. this.pageIndexCache.put(pageRef, total);
  46957. return total;
  46958. }
  46959. const [count, parentRef] = args;
  46960. total += count;
  46961. return next(parentRef);
  46962. });
  46963. return next(pageRef);
  46964. }
  46965. static parseDestDictionary(params) {
  46966. const destDict = params.destDict;
  46967. if (!(0, _primitives.isDict)(destDict)) {
  46968. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  46969. return;
  46970. }
  46971. const resultObj = params.resultObj;
  46972. if (typeof resultObj !== "object") {
  46973. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  46974. return;
  46975. }
  46976. const docBaseUrl = params.docBaseUrl || null;
  46977. let action = destDict.get("A"),
  46978. url,
  46979. dest;
  46980. if (!(0, _primitives.isDict)(action)) {
  46981. if (destDict.has("Dest")) {
  46982. action = destDict.get("Dest");
  46983. } else {
  46984. action = destDict.get("AA");
  46985. if ((0, _primitives.isDict)(action)) {
  46986. if (action.has("D")) {
  46987. action = action.get("D");
  46988. } else if (action.has("U")) {
  46989. action = action.get("U");
  46990. }
  46991. }
  46992. }
  46993. }
  46994. if ((0, _primitives.isDict)(action)) {
  46995. const actionType = action.get("S");
  46996. if (!(0, _primitives.isName)(actionType)) {
  46997. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  46998. return;
  46999. }
  47000. const actionName = actionType.name;
  47001. switch (actionName) {
  47002. case "ResetForm":
  47003. const flags = action.get("Flags");
  47004. const include = (((0, _util.isNum)(flags) ? flags : 0) & 1) === 0;
  47005. const fields = [];
  47006. const refs = [];
  47007. for (const obj of action.get("Fields") || []) {
  47008. if ((0, _primitives.isRef)(obj)) {
  47009. refs.push(obj.toString());
  47010. } else if ((0, _util.isString)(obj)) {
  47011. fields.push((0, _util.stringToPDFString)(obj));
  47012. }
  47013. }
  47014. resultObj.resetForm = {
  47015. fields,
  47016. refs,
  47017. include
  47018. };
  47019. break;
  47020. case "URI":
  47021. url = action.get("URI");
  47022. if (url instanceof _primitives.Name) {
  47023. url = "/" + url.name;
  47024. }
  47025. break;
  47026. case "GoTo":
  47027. dest = action.get("D");
  47028. break;
  47029. case "Launch":
  47030. case "GoToR":
  47031. const urlDict = action.get("F");
  47032. if ((0, _primitives.isDict)(urlDict)) {
  47033. url = urlDict.get("F") || null;
  47034. } else if ((0, _util.isString)(urlDict)) {
  47035. url = urlDict;
  47036. }
  47037. let remoteDest = action.get("D");
  47038. if (remoteDest) {
  47039. if ((0, _primitives.isName)(remoteDest)) {
  47040. remoteDest = remoteDest.name;
  47041. }
  47042. if ((0, _util.isString)(url)) {
  47043. const baseUrl = url.split("#")[0];
  47044. if ((0, _util.isString)(remoteDest)) {
  47045. url = baseUrl + "#" + remoteDest;
  47046. } else if (Array.isArray(remoteDest)) {
  47047. url = baseUrl + "#" + JSON.stringify(remoteDest);
  47048. }
  47049. }
  47050. }
  47051. const newWindow = action.get("NewWindow");
  47052. if ((0, _util.isBool)(newWindow)) {
  47053. resultObj.newWindow = newWindow;
  47054. }
  47055. break;
  47056. case "Named":
  47057. const namedAction = action.get("N");
  47058. if ((0, _primitives.isName)(namedAction)) {
  47059. resultObj.action = namedAction.name;
  47060. }
  47061. break;
  47062. case "JavaScript":
  47063. const jsAction = action.get("JS");
  47064. let js;
  47065. if ((0, _primitives.isStream)(jsAction)) {
  47066. js = jsAction.getString();
  47067. } else if ((0, _util.isString)(jsAction)) {
  47068. js = jsAction;
  47069. }
  47070. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  47071. if (jsURL) {
  47072. url = jsURL.url;
  47073. resultObj.newWindow = jsURL.newWindow;
  47074. break;
  47075. }
  47076. default:
  47077. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  47078. break;
  47079. }
  47080. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  47081. break;
  47082. }
  47083. } else if (destDict.has("Dest")) {
  47084. dest = destDict.get("Dest");
  47085. }
  47086. if ((0, _util.isString)(url)) {
  47087. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  47088. addDefaultProtocol: true,
  47089. tryConvertEncoding: true
  47090. });
  47091. if (absoluteUrl) {
  47092. resultObj.url = absoluteUrl.href;
  47093. }
  47094. resultObj.unsafeUrl = url;
  47095. }
  47096. if (dest) {
  47097. if ((0, _primitives.isName)(dest)) {
  47098. dest = dest.name;
  47099. }
  47100. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  47101. resultObj.dest = dest;
  47102. }
  47103. }
  47104. }
  47105. }
  47106. exports.Catalog = Catalog;
  47107. /***/ }),
  47108. /* 65 */
  47109. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47110. Object.defineProperty(exports, "__esModule", ({
  47111. value: true
  47112. }));
  47113. exports.NumberTree = exports.NameTree = void 0;
  47114. var _util = __w_pdfjs_require__(2);
  47115. var _primitives = __w_pdfjs_require__(5);
  47116. class NameOrNumberTree {
  47117. constructor(root, xref, type) {
  47118. if (this.constructor === NameOrNumberTree) {
  47119. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  47120. }
  47121. this.root = root;
  47122. this.xref = xref;
  47123. this._type = type;
  47124. }
  47125. getAll() {
  47126. const map = new Map();
  47127. if (!this.root) {
  47128. return map;
  47129. }
  47130. const xref = this.xref;
  47131. const processed = new _primitives.RefSet();
  47132. processed.put(this.root);
  47133. const queue = [this.root];
  47134. while (queue.length > 0) {
  47135. const obj = xref.fetchIfRef(queue.shift());
  47136. if (!(0, _primitives.isDict)(obj)) {
  47137. continue;
  47138. }
  47139. if (obj.has("Kids")) {
  47140. const kids = obj.get("Kids");
  47141. for (let i = 0, ii = kids.length; i < ii; i++) {
  47142. const kid = kids[i];
  47143. if (processed.has(kid)) {
  47144. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  47145. }
  47146. queue.push(kid);
  47147. processed.put(kid);
  47148. }
  47149. continue;
  47150. }
  47151. const entries = obj.get(this._type);
  47152. if (!Array.isArray(entries)) {
  47153. continue;
  47154. }
  47155. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  47156. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  47157. }
  47158. }
  47159. return map;
  47160. }
  47161. get(key) {
  47162. if (!this.root) {
  47163. return null;
  47164. }
  47165. const xref = this.xref;
  47166. let kidsOrEntries = xref.fetchIfRef(this.root);
  47167. let loopCount = 0;
  47168. const MAX_LEVELS = 10;
  47169. while (kidsOrEntries.has("Kids")) {
  47170. if (++loopCount > MAX_LEVELS) {
  47171. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  47172. return null;
  47173. }
  47174. const kids = kidsOrEntries.get("Kids");
  47175. if (!Array.isArray(kids)) {
  47176. return null;
  47177. }
  47178. let l = 0,
  47179. r = kids.length - 1;
  47180. while (l <= r) {
  47181. const m = l + r >> 1;
  47182. const kid = xref.fetchIfRef(kids[m]);
  47183. const limits = kid.get("Limits");
  47184. if (key < xref.fetchIfRef(limits[0])) {
  47185. r = m - 1;
  47186. } else if (key > xref.fetchIfRef(limits[1])) {
  47187. l = m + 1;
  47188. } else {
  47189. kidsOrEntries = xref.fetchIfRef(kids[m]);
  47190. break;
  47191. }
  47192. }
  47193. if (l > r) {
  47194. return null;
  47195. }
  47196. }
  47197. const entries = kidsOrEntries.get(this._type);
  47198. if (Array.isArray(entries)) {
  47199. let l = 0,
  47200. r = entries.length - 2;
  47201. while (l <= r) {
  47202. const tmp = l + r >> 1,
  47203. m = tmp + (tmp & 1);
  47204. const currentKey = xref.fetchIfRef(entries[m]);
  47205. if (key < currentKey) {
  47206. r = m - 2;
  47207. } else if (key > currentKey) {
  47208. l = m + 2;
  47209. } else {
  47210. return xref.fetchIfRef(entries[m + 1]);
  47211. }
  47212. }
  47213. }
  47214. return null;
  47215. }
  47216. }
  47217. class NameTree extends NameOrNumberTree {
  47218. constructor(root, xref) {
  47219. super(root, xref, "Names");
  47220. }
  47221. }
  47222. exports.NameTree = NameTree;
  47223. class NumberTree extends NameOrNumberTree {
  47224. constructor(root, xref) {
  47225. super(root, xref, "Nums");
  47226. }
  47227. }
  47228. exports.NumberTree = NumberTree;
  47229. /***/ }),
  47230. /* 66 */
  47231. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47232. Object.defineProperty(exports, "__esModule", ({
  47233. value: true
  47234. }));
  47235. exports.FileSpec = void 0;
  47236. var _primitives = __w_pdfjs_require__(5);
  47237. var _util = __w_pdfjs_require__(2);
  47238. function pickPlatformItem(dict) {
  47239. if (dict.has("UF")) {
  47240. return dict.get("UF");
  47241. } else if (dict.has("F")) {
  47242. return dict.get("F");
  47243. } else if (dict.has("Unix")) {
  47244. return dict.get("Unix");
  47245. } else if (dict.has("Mac")) {
  47246. return dict.get("Mac");
  47247. } else if (dict.has("DOS")) {
  47248. return dict.get("DOS");
  47249. }
  47250. return null;
  47251. }
  47252. class FileSpec {
  47253. constructor(root, xref) {
  47254. if (!root || !(0, _primitives.isDict)(root)) {
  47255. return;
  47256. }
  47257. this.xref = xref;
  47258. this.root = root;
  47259. if (root.has("FS")) {
  47260. this.fs = root.get("FS");
  47261. }
  47262. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  47263. if (root.has("RF")) {
  47264. (0, _util.warn)("Related file specifications are not supported");
  47265. }
  47266. this.contentAvailable = true;
  47267. if (!root.has("EF")) {
  47268. this.contentAvailable = false;
  47269. (0, _util.warn)("Non-embedded file specifications are not supported");
  47270. }
  47271. }
  47272. get filename() {
  47273. if (!this._filename && this.root) {
  47274. const filename = pickPlatformItem(this.root) || "unnamed";
  47275. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  47276. }
  47277. return this._filename;
  47278. }
  47279. get content() {
  47280. if (!this.contentAvailable) {
  47281. return null;
  47282. }
  47283. if (!this.contentRef && this.root) {
  47284. this.contentRef = pickPlatformItem(this.root.get("EF"));
  47285. }
  47286. let content = null;
  47287. if (this.contentRef) {
  47288. const fileObj = this.xref.fetchIfRef(this.contentRef);
  47289. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  47290. content = fileObj.getBytes();
  47291. } else {
  47292. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  47293. }
  47294. } else {
  47295. (0, _util.warn)("Embedded file specification does not have a content");
  47296. }
  47297. return content;
  47298. }
  47299. get serializable() {
  47300. return {
  47301. filename: this.filename,
  47302. content: this.content
  47303. };
  47304. }
  47305. }
  47306. exports.FileSpec = FileSpec;
  47307. /***/ }),
  47308. /* 67 */
  47309. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47310. Object.defineProperty(exports, "__esModule", ({
  47311. value: true
  47312. }));
  47313. exports.MetadataParser = void 0;
  47314. var _xml_parser = __w_pdfjs_require__(68);
  47315. class MetadataParser {
  47316. constructor(data) {
  47317. data = this._repair(data);
  47318. const parser = new _xml_parser.SimpleXMLParser({
  47319. lowerCaseName: true
  47320. });
  47321. const xmlDocument = parser.parseFromString(data);
  47322. this._metadataMap = new Map();
  47323. this._data = data;
  47324. if (xmlDocument) {
  47325. this._parse(xmlDocument);
  47326. }
  47327. }
  47328. _repair(data) {
  47329. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  47330. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  47331. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  47332. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  47333. switch (name) {
  47334. case "amp":
  47335. return "&";
  47336. case "apos":
  47337. return "'";
  47338. case "gt":
  47339. return ">";
  47340. case "lt":
  47341. return "<";
  47342. case "quot":
  47343. return '"';
  47344. }
  47345. throw new Error(`_repair: ${name} isn't defined.`);
  47346. });
  47347. const charBuf = [];
  47348. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  47349. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  47350. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  47351. charBuf.push(String.fromCharCode(code));
  47352. } else {
  47353. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  47354. }
  47355. }
  47356. return ">" + charBuf.join("");
  47357. });
  47358. }
  47359. _getSequence(entry) {
  47360. const name = entry.nodeName;
  47361. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  47362. return null;
  47363. }
  47364. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  47365. }
  47366. _parseArray(entry) {
  47367. if (!entry.hasChildNodes()) {
  47368. return;
  47369. }
  47370. const [seqNode] = entry.childNodes;
  47371. const sequence = this._getSequence(seqNode) || [];
  47372. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  47373. }
  47374. _parse(xmlDocument) {
  47375. let rdf = xmlDocument.documentElement;
  47376. if (rdf.nodeName !== "rdf:rdf") {
  47377. rdf = rdf.firstChild;
  47378. while (rdf && rdf.nodeName !== "rdf:rdf") {
  47379. rdf = rdf.nextSibling;
  47380. }
  47381. }
  47382. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  47383. return;
  47384. }
  47385. for (const desc of rdf.childNodes) {
  47386. if (desc.nodeName !== "rdf:description") {
  47387. continue;
  47388. }
  47389. for (const entry of desc.childNodes) {
  47390. const name = entry.nodeName;
  47391. switch (name) {
  47392. case "#text":
  47393. continue;
  47394. case "dc:creator":
  47395. case "dc:subject":
  47396. this._parseArray(entry);
  47397. continue;
  47398. }
  47399. this._metadataMap.set(name, entry.textContent.trim());
  47400. }
  47401. }
  47402. }
  47403. get serializable() {
  47404. return {
  47405. parsedData: this._metadataMap,
  47406. rawData: this._data
  47407. };
  47408. }
  47409. }
  47410. exports.MetadataParser = MetadataParser;
  47411. /***/ }),
  47412. /* 68 */
  47413. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47414. Object.defineProperty(exports, "__esModule", ({
  47415. value: true
  47416. }));
  47417. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47418. var _core_utils = __w_pdfjs_require__(9);
  47419. const XMLParserErrorCode = {
  47420. NoError: 0,
  47421. EndOfDocument: -1,
  47422. UnterminatedCdat: -2,
  47423. UnterminatedXmlDeclaration: -3,
  47424. UnterminatedDoctypeDeclaration: -4,
  47425. UnterminatedComment: -5,
  47426. MalformedElement: -6,
  47427. OutOfMemory: -7,
  47428. UnterminatedAttributeValue: -8,
  47429. UnterminatedElement: -9,
  47430. ElementNeverBegun: -10
  47431. };
  47432. exports.XMLParserErrorCode = XMLParserErrorCode;
  47433. function isWhitespace(s, index) {
  47434. const ch = s[index];
  47435. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47436. }
  47437. function isWhitespaceString(s) {
  47438. for (let i = 0, ii = s.length; i < ii; i++) {
  47439. if (!isWhitespace(s, i)) {
  47440. return false;
  47441. }
  47442. }
  47443. return true;
  47444. }
  47445. class XMLParserBase {
  47446. _resolveEntities(s) {
  47447. return s.replace(/&([^;]+);/g, (all, entity) => {
  47448. if (entity.substring(0, 2) === "#x") {
  47449. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47450. } else if (entity.substring(0, 1) === "#") {
  47451. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47452. }
  47453. switch (entity) {
  47454. case "lt":
  47455. return "<";
  47456. case "gt":
  47457. return ">";
  47458. case "amp":
  47459. return "&";
  47460. case "quot":
  47461. return '"';
  47462. case "apos":
  47463. return "'";
  47464. }
  47465. return this.onResolveEntity(entity);
  47466. });
  47467. }
  47468. _parseContent(s, start) {
  47469. const attributes = [];
  47470. let pos = start;
  47471. function skipWs() {
  47472. while (pos < s.length && isWhitespace(s, pos)) {
  47473. ++pos;
  47474. }
  47475. }
  47476. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47477. ++pos;
  47478. }
  47479. const name = s.substring(start, pos);
  47480. skipWs();
  47481. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47482. skipWs();
  47483. let attrName = "",
  47484. attrValue = "";
  47485. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47486. attrName += s[pos];
  47487. ++pos;
  47488. }
  47489. skipWs();
  47490. if (s[pos] !== "=") {
  47491. return null;
  47492. }
  47493. ++pos;
  47494. skipWs();
  47495. const attrEndChar = s[pos];
  47496. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47497. return null;
  47498. }
  47499. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47500. if (attrEndIndex < 0) {
  47501. return null;
  47502. }
  47503. attrValue = s.substring(pos, attrEndIndex);
  47504. attributes.push({
  47505. name: attrName,
  47506. value: this._resolveEntities(attrValue)
  47507. });
  47508. pos = attrEndIndex + 1;
  47509. skipWs();
  47510. }
  47511. return {
  47512. name,
  47513. attributes,
  47514. parsed: pos - start
  47515. };
  47516. }
  47517. _parseProcessingInstruction(s, start) {
  47518. let pos = start;
  47519. function skipWs() {
  47520. while (pos < s.length && isWhitespace(s, pos)) {
  47521. ++pos;
  47522. }
  47523. }
  47524. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47525. ++pos;
  47526. }
  47527. const name = s.substring(start, pos);
  47528. skipWs();
  47529. const attrStart = pos;
  47530. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47531. ++pos;
  47532. }
  47533. const value = s.substring(attrStart, pos);
  47534. return {
  47535. name,
  47536. value,
  47537. parsed: pos - start
  47538. };
  47539. }
  47540. parseXml(s) {
  47541. let i = 0;
  47542. while (i < s.length) {
  47543. const ch = s[i];
  47544. let j = i;
  47545. if (ch === "<") {
  47546. ++j;
  47547. const ch2 = s[j];
  47548. let q;
  47549. switch (ch2) {
  47550. case "/":
  47551. ++j;
  47552. q = s.indexOf(">", j);
  47553. if (q < 0) {
  47554. this.onError(XMLParserErrorCode.UnterminatedElement);
  47555. return;
  47556. }
  47557. this.onEndElement(s.substring(j, q));
  47558. j = q + 1;
  47559. break;
  47560. case "?":
  47561. ++j;
  47562. const pi = this._parseProcessingInstruction(s, j);
  47563. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47564. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47565. return;
  47566. }
  47567. this.onPi(pi.name, pi.value);
  47568. j += pi.parsed + 2;
  47569. break;
  47570. case "!":
  47571. if (s.substring(j + 1, j + 3) === "--") {
  47572. q = s.indexOf("-->", j + 3);
  47573. if (q < 0) {
  47574. this.onError(XMLParserErrorCode.UnterminatedComment);
  47575. return;
  47576. }
  47577. this.onComment(s.substring(j + 3, q));
  47578. j = q + 3;
  47579. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47580. q = s.indexOf("]]>", j + 8);
  47581. if (q < 0) {
  47582. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47583. return;
  47584. }
  47585. this.onCdata(s.substring(j + 8, q));
  47586. j = q + 3;
  47587. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47588. const q2 = s.indexOf("[", j + 8);
  47589. let complexDoctype = false;
  47590. q = s.indexOf(">", j + 8);
  47591. if (q < 0) {
  47592. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47593. return;
  47594. }
  47595. if (q2 > 0 && q > q2) {
  47596. q = s.indexOf("]>", j + 8);
  47597. if (q < 0) {
  47598. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47599. return;
  47600. }
  47601. complexDoctype = true;
  47602. }
  47603. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47604. this.onDoctype(doctypeContent);
  47605. j = q + (complexDoctype ? 2 : 1);
  47606. } else {
  47607. this.onError(XMLParserErrorCode.MalformedElement);
  47608. return;
  47609. }
  47610. break;
  47611. default:
  47612. const content = this._parseContent(s, j);
  47613. if (content === null) {
  47614. this.onError(XMLParserErrorCode.MalformedElement);
  47615. return;
  47616. }
  47617. let isClosed = false;
  47618. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47619. isClosed = true;
  47620. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47621. this.onError(XMLParserErrorCode.UnterminatedElement);
  47622. return;
  47623. }
  47624. this.onBeginElement(content.name, content.attributes, isClosed);
  47625. j += content.parsed + (isClosed ? 2 : 1);
  47626. break;
  47627. }
  47628. } else {
  47629. while (j < s.length && s[j] !== "<") {
  47630. j++;
  47631. }
  47632. const text = s.substring(i, j);
  47633. this.onText(this._resolveEntities(text));
  47634. }
  47635. i = j;
  47636. }
  47637. }
  47638. onResolveEntity(name) {
  47639. return `&${name};`;
  47640. }
  47641. onPi(name, value) {}
  47642. onComment(text) {}
  47643. onCdata(text) {}
  47644. onDoctype(doctypeContent) {}
  47645. onText(text) {}
  47646. onBeginElement(name, attributes, isEmpty) {}
  47647. onEndElement(name) {}
  47648. onError(code) {}
  47649. }
  47650. exports.XMLParserBase = XMLParserBase;
  47651. class SimpleDOMNode {
  47652. constructor(nodeName, nodeValue) {
  47653. this.nodeName = nodeName;
  47654. this.nodeValue = nodeValue;
  47655. Object.defineProperty(this, "parentNode", {
  47656. value: null,
  47657. writable: true
  47658. });
  47659. }
  47660. get firstChild() {
  47661. return this.childNodes && this.childNodes[0];
  47662. }
  47663. get nextSibling() {
  47664. const childNodes = this.parentNode.childNodes;
  47665. if (!childNodes) {
  47666. return undefined;
  47667. }
  47668. const index = childNodes.indexOf(this);
  47669. if (index === -1) {
  47670. return undefined;
  47671. }
  47672. return childNodes[index + 1];
  47673. }
  47674. get textContent() {
  47675. if (!this.childNodes) {
  47676. return this.nodeValue || "";
  47677. }
  47678. return this.childNodes.map(function (child) {
  47679. return child.textContent;
  47680. }).join("");
  47681. }
  47682. hasChildNodes() {
  47683. return this.childNodes && this.childNodes.length > 0;
  47684. }
  47685. searchNode(paths, pos) {
  47686. if (pos >= paths.length) {
  47687. return this;
  47688. }
  47689. const component = paths[pos];
  47690. const stack = [];
  47691. let node = this;
  47692. while (true) {
  47693. if (component.name === node.nodeName) {
  47694. if (component.pos === 0) {
  47695. const res = node.searchNode(paths, pos + 1);
  47696. if (res !== null) {
  47697. return res;
  47698. }
  47699. } else if (stack.length === 0) {
  47700. return null;
  47701. } else {
  47702. const [parent] = stack.pop();
  47703. let siblingPos = 0;
  47704. for (const child of parent.childNodes) {
  47705. if (component.name === child.nodeName) {
  47706. if (siblingPos === component.pos) {
  47707. return child.searchNode(paths, pos + 1);
  47708. }
  47709. siblingPos++;
  47710. }
  47711. }
  47712. return node.searchNode(paths, pos + 1);
  47713. }
  47714. }
  47715. if (node.childNodes && node.childNodes.length !== 0) {
  47716. stack.push([node, 0]);
  47717. node = node.childNodes[0];
  47718. } else if (stack.length === 0) {
  47719. return null;
  47720. } else {
  47721. while (stack.length !== 0) {
  47722. const [parent, currentPos] = stack.pop();
  47723. const newPos = currentPos + 1;
  47724. if (newPos < parent.childNodes.length) {
  47725. stack.push([parent, newPos]);
  47726. node = parent.childNodes[newPos];
  47727. break;
  47728. }
  47729. }
  47730. if (stack.length === 0) {
  47731. return null;
  47732. }
  47733. }
  47734. }
  47735. }
  47736. dump(buffer) {
  47737. if (this.nodeName === "#text") {
  47738. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47739. return;
  47740. }
  47741. buffer.push(`<${this.nodeName}`);
  47742. if (this.attributes) {
  47743. for (const attribute of this.attributes) {
  47744. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47745. }
  47746. }
  47747. if (this.hasChildNodes()) {
  47748. buffer.push(">");
  47749. for (const child of this.childNodes) {
  47750. child.dump(buffer);
  47751. }
  47752. buffer.push(`</${this.nodeName}>`);
  47753. } else if (this.nodeValue) {
  47754. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47755. } else {
  47756. buffer.push("/>");
  47757. }
  47758. }
  47759. }
  47760. exports.SimpleDOMNode = SimpleDOMNode;
  47761. class SimpleXMLParser extends XMLParserBase {
  47762. constructor({
  47763. hasAttributes = false,
  47764. lowerCaseName = false
  47765. }) {
  47766. super();
  47767. this._currentFragment = null;
  47768. this._stack = null;
  47769. this._errorCode = XMLParserErrorCode.NoError;
  47770. this._hasAttributes = hasAttributes;
  47771. this._lowerCaseName = lowerCaseName;
  47772. }
  47773. parseFromString(data) {
  47774. this._currentFragment = [];
  47775. this._stack = [];
  47776. this._errorCode = XMLParserErrorCode.NoError;
  47777. this.parseXml(data);
  47778. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47779. return undefined;
  47780. }
  47781. const [documentElement] = this._currentFragment;
  47782. if (!documentElement) {
  47783. return undefined;
  47784. }
  47785. return {
  47786. documentElement
  47787. };
  47788. }
  47789. onText(text) {
  47790. if (isWhitespaceString(text)) {
  47791. return;
  47792. }
  47793. const node = new SimpleDOMNode("#text", text);
  47794. this._currentFragment.push(node);
  47795. }
  47796. onCdata(text) {
  47797. const node = new SimpleDOMNode("#text", text);
  47798. this._currentFragment.push(node);
  47799. }
  47800. onBeginElement(name, attributes, isEmpty) {
  47801. if (this._lowerCaseName) {
  47802. name = name.toLowerCase();
  47803. }
  47804. const node = new SimpleDOMNode(name);
  47805. node.childNodes = [];
  47806. if (this._hasAttributes) {
  47807. node.attributes = attributes;
  47808. }
  47809. this._currentFragment.push(node);
  47810. if (isEmpty) {
  47811. return;
  47812. }
  47813. this._stack.push(this._currentFragment);
  47814. this._currentFragment = node.childNodes;
  47815. }
  47816. onEndElement(name) {
  47817. this._currentFragment = this._stack.pop() || [];
  47818. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  47819. if (!lastElement) {
  47820. return;
  47821. }
  47822. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47823. lastElement.childNodes[i].parentNode = lastElement;
  47824. }
  47825. }
  47826. onError(code) {
  47827. this._errorCode = code;
  47828. }
  47829. }
  47830. exports.SimpleXMLParser = SimpleXMLParser;
  47831. /***/ }),
  47832. /* 69 */
  47833. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47834. Object.defineProperty(exports, "__esModule", ({
  47835. value: true
  47836. }));
  47837. exports.StructTreeRoot = exports.StructTreePage = void 0;
  47838. var _primitives = __w_pdfjs_require__(5);
  47839. var _util = __w_pdfjs_require__(2);
  47840. var _name_number_tree = __w_pdfjs_require__(65);
  47841. const MAX_DEPTH = 40;
  47842. const StructElementType = {
  47843. PAGE_CONTENT: "PAGE_CONTENT",
  47844. STREAM_CONTENT: "STREAM_CONTENT",
  47845. OBJECT: "OBJECT",
  47846. ELEMENT: "ELEMENT"
  47847. };
  47848. class StructTreeRoot {
  47849. constructor(rootDict) {
  47850. this.dict = rootDict;
  47851. this.roleMap = new Map();
  47852. }
  47853. init() {
  47854. this.readRoleMap();
  47855. }
  47856. readRoleMap() {
  47857. const roleMapDict = this.dict.get("RoleMap");
  47858. if (!(0, _primitives.isDict)(roleMapDict)) {
  47859. return;
  47860. }
  47861. roleMapDict.forEach((key, value) => {
  47862. if (!(0, _primitives.isName)(value)) {
  47863. return;
  47864. }
  47865. this.roleMap.set(key, value.name);
  47866. });
  47867. }
  47868. }
  47869. exports.StructTreeRoot = StructTreeRoot;
  47870. class StructElementNode {
  47871. constructor(tree, dict) {
  47872. this.tree = tree;
  47873. this.dict = dict;
  47874. this.kids = [];
  47875. this.parseKids();
  47876. }
  47877. get role() {
  47878. const nameObj = this.dict.get("S");
  47879. const name = (0, _primitives.isName)(nameObj) ? nameObj.name : "";
  47880. const {
  47881. root
  47882. } = this.tree;
  47883. if (root.roleMap.has(name)) {
  47884. return root.roleMap.get(name);
  47885. }
  47886. return name;
  47887. }
  47888. parseKids() {
  47889. let pageObjId = null;
  47890. const objRef = this.dict.getRaw("Pg");
  47891. if ((0, _primitives.isRef)(objRef)) {
  47892. pageObjId = objRef.toString();
  47893. }
  47894. const kids = this.dict.get("K");
  47895. if (Array.isArray(kids)) {
  47896. for (const kid of kids) {
  47897. const element = this.parseKid(pageObjId, kid);
  47898. if (element) {
  47899. this.kids.push(element);
  47900. }
  47901. }
  47902. } else {
  47903. const element = this.parseKid(pageObjId, kids);
  47904. if (element) {
  47905. this.kids.push(element);
  47906. }
  47907. }
  47908. }
  47909. parseKid(pageObjId, kid) {
  47910. if (Number.isInteger(kid)) {
  47911. if (this.tree.pageDict.objId !== pageObjId) {
  47912. return null;
  47913. }
  47914. return new StructElement({
  47915. type: StructElementType.PAGE_CONTENT,
  47916. mcid: kid,
  47917. pageObjId
  47918. });
  47919. }
  47920. let kidDict = null;
  47921. if ((0, _primitives.isRef)(kid)) {
  47922. kidDict = this.dict.xref.fetch(kid);
  47923. } else if ((0, _primitives.isDict)(kid)) {
  47924. kidDict = kid;
  47925. }
  47926. if (!kidDict) {
  47927. return null;
  47928. }
  47929. const pageRef = kidDict.getRaw("Pg");
  47930. if ((0, _primitives.isRef)(pageRef)) {
  47931. pageObjId = pageRef.toString();
  47932. }
  47933. const type = (0, _primitives.isName)(kidDict.get("Type")) ? kidDict.get("Type").name : null;
  47934. if (type === "MCR") {
  47935. if (this.tree.pageDict.objId !== pageObjId) {
  47936. return null;
  47937. }
  47938. return new StructElement({
  47939. type: StructElementType.STREAM_CONTENT,
  47940. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Stm")) ? kidDict.getRaw("Stm").toString() : null,
  47941. pageObjId,
  47942. mcid: kidDict.get("MCID")
  47943. });
  47944. }
  47945. if (type === "OBJR") {
  47946. if (this.tree.pageDict.objId !== pageObjId) {
  47947. return null;
  47948. }
  47949. return new StructElement({
  47950. type: StructElementType.OBJECT,
  47951. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Obj")) ? kidDict.getRaw("Obj").toString() : null,
  47952. pageObjId
  47953. });
  47954. }
  47955. return new StructElement({
  47956. type: StructElementType.ELEMENT,
  47957. dict: kidDict
  47958. });
  47959. }
  47960. }
  47961. class StructElement {
  47962. constructor({
  47963. type,
  47964. dict = null,
  47965. mcid = null,
  47966. pageObjId = null,
  47967. refObjId = null
  47968. }) {
  47969. this.type = type;
  47970. this.dict = dict;
  47971. this.mcid = mcid;
  47972. this.pageObjId = pageObjId;
  47973. this.refObjId = refObjId;
  47974. this.parentNode = null;
  47975. }
  47976. }
  47977. class StructTreePage {
  47978. constructor(structTreeRoot, pageDict) {
  47979. this.root = structTreeRoot;
  47980. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  47981. this.pageDict = pageDict;
  47982. this.nodes = [];
  47983. }
  47984. parse() {
  47985. if (!this.root || !this.rootDict) {
  47986. return;
  47987. }
  47988. const parentTree = this.rootDict.get("ParentTree");
  47989. if (!parentTree) {
  47990. return;
  47991. }
  47992. const id = this.pageDict.get("StructParents");
  47993. if (!Number.isInteger(id)) {
  47994. return;
  47995. }
  47996. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  47997. const parentArray = numberTree.get(id);
  47998. if (!Array.isArray(parentArray)) {
  47999. return;
  48000. }
  48001. const map = new Map();
  48002. for (const ref of parentArray) {
  48003. if ((0, _primitives.isRef)(ref)) {
  48004. this.addNode(this.rootDict.xref.fetch(ref), map);
  48005. }
  48006. }
  48007. }
  48008. addNode(dict, map, level = 0) {
  48009. if (level > MAX_DEPTH) {
  48010. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  48011. return null;
  48012. }
  48013. if (map.has(dict)) {
  48014. return map.get(dict);
  48015. }
  48016. const element = new StructElementNode(this, dict);
  48017. map.set(dict, element);
  48018. const parent = dict.get("P");
  48019. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  48020. if (!this.addTopLevelNode(dict, element)) {
  48021. map.delete(dict);
  48022. }
  48023. return element;
  48024. }
  48025. const parentNode = this.addNode(parent, map, level + 1);
  48026. if (!parentNode) {
  48027. return element;
  48028. }
  48029. let save = false;
  48030. for (const kid of parentNode.kids) {
  48031. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  48032. kid.parentNode = element;
  48033. save = true;
  48034. }
  48035. }
  48036. if (!save) {
  48037. map.delete(dict);
  48038. }
  48039. return element;
  48040. }
  48041. addTopLevelNode(dict, element) {
  48042. const obj = this.rootDict.get("K");
  48043. if (!obj) {
  48044. return false;
  48045. }
  48046. if ((0, _primitives.isDict)(obj)) {
  48047. if (obj.objId !== dict.objId) {
  48048. return false;
  48049. }
  48050. this.nodes[0] = element;
  48051. return true;
  48052. }
  48053. if (!Array.isArray(obj)) {
  48054. return true;
  48055. }
  48056. let save = false;
  48057. for (let i = 0; i < obj.length; i++) {
  48058. const kidRef = obj[i];
  48059. if (kidRef && kidRef.toString() === dict.objId) {
  48060. this.nodes[i] = element;
  48061. save = true;
  48062. }
  48063. }
  48064. return save;
  48065. }
  48066. get serializable() {
  48067. function nodeToSerializable(node, parent, level = 0) {
  48068. if (level > MAX_DEPTH) {
  48069. (0, _util.warn)("StructTree too deep to be fully serialized.");
  48070. return;
  48071. }
  48072. const obj = Object.create(null);
  48073. obj.role = node.role;
  48074. obj.children = [];
  48075. parent.children.push(obj);
  48076. const alt = node.dict.get("Alt");
  48077. if ((0, _util.isString)(alt)) {
  48078. obj.alt = (0, _util.stringToPDFString)(alt);
  48079. }
  48080. const lang = node.dict.get("Lang");
  48081. if ((0, _util.isString)(lang)) {
  48082. obj.lang = (0, _util.stringToPDFString)(lang);
  48083. }
  48084. for (const kid of node.kids) {
  48085. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  48086. if (kidElement) {
  48087. nodeToSerializable(kidElement, obj, level + 1);
  48088. continue;
  48089. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  48090. obj.children.push({
  48091. type: "content",
  48092. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  48093. });
  48094. } else if (kid.type === StructElementType.OBJECT) {
  48095. obj.children.push({
  48096. type: "object",
  48097. id: kid.refObjId
  48098. });
  48099. }
  48100. }
  48101. }
  48102. const root = Object.create(null);
  48103. root.children = [];
  48104. root.role = "Root";
  48105. for (const child of this.nodes) {
  48106. if (!child) {
  48107. continue;
  48108. }
  48109. nodeToSerializable(child, root);
  48110. }
  48111. return root;
  48112. }
  48113. }
  48114. exports.StructTreePage = StructTreePage;
  48115. /***/ }),
  48116. /* 70 */
  48117. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48118. Object.defineProperty(exports, "__esModule", ({
  48119. value: true
  48120. }));
  48121. exports.ObjectLoader = void 0;
  48122. var _primitives = __w_pdfjs_require__(5);
  48123. var _core_utils = __w_pdfjs_require__(9);
  48124. var _util = __w_pdfjs_require__(2);
  48125. function mayHaveChildren(value) {
  48126. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  48127. }
  48128. function addChildren(node, nodesToVisit) {
  48129. if (node instanceof _primitives.Dict) {
  48130. node = node.getRawValues();
  48131. } else if ((0, _primitives.isStream)(node)) {
  48132. node = node.dict.getRawValues();
  48133. } else if (!Array.isArray(node)) {
  48134. return;
  48135. }
  48136. for (const rawValue of node) {
  48137. if (mayHaveChildren(rawValue)) {
  48138. nodesToVisit.push(rawValue);
  48139. }
  48140. }
  48141. }
  48142. class ObjectLoader {
  48143. constructor(dict, keys, xref) {
  48144. this.dict = dict;
  48145. this.keys = keys;
  48146. this.xref = xref;
  48147. this.refSet = null;
  48148. }
  48149. async load() {
  48150. if (this.xref.stream.isDataLoaded) {
  48151. return undefined;
  48152. }
  48153. const {
  48154. keys,
  48155. dict
  48156. } = this;
  48157. this.refSet = new _primitives.RefSet();
  48158. const nodesToVisit = [];
  48159. for (let i = 0, ii = keys.length; i < ii; i++) {
  48160. const rawValue = dict.getRaw(keys[i]);
  48161. if (rawValue !== undefined) {
  48162. nodesToVisit.push(rawValue);
  48163. }
  48164. }
  48165. return this._walk(nodesToVisit);
  48166. }
  48167. async _walk(nodesToVisit) {
  48168. const nodesToRevisit = [];
  48169. const pendingRequests = [];
  48170. while (nodesToVisit.length) {
  48171. let currentNode = nodesToVisit.pop();
  48172. if (currentNode instanceof _primitives.Ref) {
  48173. if (this.refSet.has(currentNode)) {
  48174. continue;
  48175. }
  48176. try {
  48177. this.refSet.put(currentNode);
  48178. currentNode = this.xref.fetch(currentNode);
  48179. } catch (ex) {
  48180. if (!(ex instanceof _core_utils.MissingDataException)) {
  48181. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  48182. this.refSet = null;
  48183. const {
  48184. manager
  48185. } = this.xref.stream;
  48186. return manager.requestAllChunks();
  48187. }
  48188. nodesToRevisit.push(currentNode);
  48189. pendingRequests.push({
  48190. begin: ex.begin,
  48191. end: ex.end
  48192. });
  48193. }
  48194. }
  48195. if ((0, _primitives.isStream)(currentNode)) {
  48196. const baseStreams = currentNode.getBaseStreams();
  48197. if (baseStreams) {
  48198. let foundMissingData = false;
  48199. for (const stream of baseStreams) {
  48200. if (stream.isDataLoaded) {
  48201. continue;
  48202. }
  48203. foundMissingData = true;
  48204. pendingRequests.push({
  48205. begin: stream.start,
  48206. end: stream.end
  48207. });
  48208. }
  48209. if (foundMissingData) {
  48210. nodesToRevisit.push(currentNode);
  48211. }
  48212. }
  48213. }
  48214. addChildren(currentNode, nodesToVisit);
  48215. }
  48216. if (pendingRequests.length) {
  48217. await this.xref.stream.manager.requestRanges(pendingRequests);
  48218. for (const node of nodesToRevisit) {
  48219. if (node instanceof _primitives.Ref) {
  48220. this.refSet.remove(node);
  48221. }
  48222. }
  48223. return this._walk(nodesToRevisit);
  48224. }
  48225. this.refSet = null;
  48226. return undefined;
  48227. }
  48228. }
  48229. exports.ObjectLoader = ObjectLoader;
  48230. /***/ }),
  48231. /* 71 */
  48232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48233. Object.defineProperty(exports, "__esModule", ({
  48234. value: true
  48235. }));
  48236. exports.incrementalUpdate = incrementalUpdate;
  48237. exports.writeDict = writeDict;
  48238. var _util = __w_pdfjs_require__(2);
  48239. var _primitives = __w_pdfjs_require__(5);
  48240. var _core_utils = __w_pdfjs_require__(9);
  48241. var _xml_parser = __w_pdfjs_require__(68);
  48242. var _crypto = __w_pdfjs_require__(72);
  48243. function writeDict(dict, buffer, transform) {
  48244. buffer.push("<<");
  48245. for (const key of dict.getKeys()) {
  48246. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  48247. writeValue(dict.getRaw(key), buffer, transform);
  48248. }
  48249. buffer.push(">>");
  48250. }
  48251. function writeStream(stream, buffer, transform) {
  48252. writeDict(stream.dict, buffer, transform);
  48253. buffer.push(" stream\n");
  48254. let string = stream.getString();
  48255. if (transform !== null) {
  48256. string = transform.encryptString(string);
  48257. }
  48258. buffer.push(string, "\nendstream\n");
  48259. }
  48260. function writeArray(array, buffer, transform) {
  48261. buffer.push("[");
  48262. let first = true;
  48263. for (const val of array) {
  48264. if (!first) {
  48265. buffer.push(" ");
  48266. } else {
  48267. first = false;
  48268. }
  48269. writeValue(val, buffer, transform);
  48270. }
  48271. buffer.push("]");
  48272. }
  48273. function numberToString(value) {
  48274. if (Number.isInteger(value)) {
  48275. return value.toString();
  48276. }
  48277. const roundedValue = Math.round(value * 100);
  48278. if (roundedValue % 100 === 0) {
  48279. return (roundedValue / 100).toString();
  48280. }
  48281. if (roundedValue % 10 === 0) {
  48282. return value.toFixed(1);
  48283. }
  48284. return value.toFixed(2);
  48285. }
  48286. function writeValue(value, buffer, transform) {
  48287. if ((0, _primitives.isName)(value)) {
  48288. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  48289. } else if ((0, _primitives.isRef)(value)) {
  48290. buffer.push(`${value.num} ${value.gen} R`);
  48291. } else if (Array.isArray(value)) {
  48292. writeArray(value, buffer, transform);
  48293. } else if (typeof value === "string") {
  48294. if (transform !== null) {
  48295. value = transform.encryptString(value);
  48296. }
  48297. buffer.push(`(${(0, _util.escapeString)(value)})`);
  48298. } else if (typeof value === "number") {
  48299. buffer.push(numberToString(value));
  48300. } else if (typeof value === "boolean") {
  48301. buffer.push(value.toString());
  48302. } else if ((0, _primitives.isDict)(value)) {
  48303. writeDict(value, buffer, transform);
  48304. } else if ((0, _primitives.isStream)(value)) {
  48305. writeStream(value, buffer, transform);
  48306. } else if (value === null) {
  48307. buffer.push("null");
  48308. } else {
  48309. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  48310. }
  48311. }
  48312. function writeInt(number, size, offset, buffer) {
  48313. for (let i = size + offset - 1; i > offset - 1; i--) {
  48314. buffer[i] = number & 0xff;
  48315. number >>= 8;
  48316. }
  48317. return offset + size;
  48318. }
  48319. function writeString(string, offset, buffer) {
  48320. for (let i = 0, len = string.length; i < len; i++) {
  48321. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  48322. }
  48323. }
  48324. function computeMD5(filesize, xrefInfo) {
  48325. const time = Math.floor(Date.now() / 1000);
  48326. const filename = xrefInfo.filename || "";
  48327. const md5Buffer = [time.toString(), filename, filesize.toString()];
  48328. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  48329. for (const value of Object.values(xrefInfo.info)) {
  48330. md5Buffer.push(value);
  48331. md5BufferLen += value.length;
  48332. }
  48333. const array = new Uint8Array(md5BufferLen);
  48334. let offset = 0;
  48335. for (const str of md5Buffer) {
  48336. writeString(str, offset, array);
  48337. offset += str.length;
  48338. }
  48339. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  48340. }
  48341. function writeXFADataForAcroform(str, newRefs) {
  48342. const xml = new _xml_parser.SimpleXMLParser({
  48343. hasAttributes: true
  48344. }).parseFromString(str);
  48345. for (const {
  48346. xfa
  48347. } of newRefs) {
  48348. if (!xfa) {
  48349. continue;
  48350. }
  48351. const {
  48352. path,
  48353. value
  48354. } = xfa;
  48355. if (!path) {
  48356. continue;
  48357. }
  48358. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  48359. if (node) {
  48360. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  48361. } else {
  48362. (0, _util.warn)(`Node not found for path: ${path}`);
  48363. }
  48364. }
  48365. const buffer = [];
  48366. xml.documentElement.dump(buffer);
  48367. return buffer.join("");
  48368. }
  48369. function updateXFA({
  48370. xfaData,
  48371. xfaDatasetsRef,
  48372. hasXfaDatasetsEntry,
  48373. acroFormRef,
  48374. acroForm,
  48375. newRefs,
  48376. xref,
  48377. xrefInfo
  48378. }) {
  48379. if (xref === null) {
  48380. return;
  48381. }
  48382. if (!hasXfaDatasetsEntry) {
  48383. if (!acroFormRef) {
  48384. (0, _util.warn)("XFA - Cannot save it");
  48385. return;
  48386. }
  48387. const oldXfa = acroForm.get("XFA");
  48388. const newXfa = oldXfa.slice();
  48389. newXfa.splice(2, 0, "datasets");
  48390. newXfa.splice(3, 0, xfaDatasetsRef);
  48391. acroForm.set("XFA", newXfa);
  48392. const encrypt = xref.encrypt;
  48393. let transform = null;
  48394. if (encrypt) {
  48395. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  48396. }
  48397. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  48398. writeDict(acroForm, buffer, transform);
  48399. buffer.push("\n");
  48400. acroForm.set("XFA", oldXfa);
  48401. newRefs.push({
  48402. ref: acroFormRef,
  48403. data: buffer.join("")
  48404. });
  48405. }
  48406. if (xfaData === null) {
  48407. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  48408. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  48409. }
  48410. const encrypt = xref.encrypt;
  48411. if (encrypt) {
  48412. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  48413. xfaData = transform.encryptString(xfaData);
  48414. }
  48415. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  48416. newRefs.push({
  48417. ref: xfaDatasetsRef,
  48418. data
  48419. });
  48420. }
  48421. function incrementalUpdate({
  48422. originalData,
  48423. xrefInfo,
  48424. newRefs,
  48425. xref = null,
  48426. hasXfa = false,
  48427. xfaDatasetsRef = null,
  48428. hasXfaDatasetsEntry = false,
  48429. acroFormRef = null,
  48430. acroForm = null,
  48431. xfaData = null
  48432. }) {
  48433. if (hasXfa) {
  48434. updateXFA({
  48435. xfaData,
  48436. xfaDatasetsRef,
  48437. hasXfaDatasetsEntry,
  48438. acroFormRef,
  48439. acroForm,
  48440. newRefs,
  48441. xref,
  48442. xrefInfo
  48443. });
  48444. }
  48445. const newXref = new _primitives.Dict(null);
  48446. const refForXrefTable = xrefInfo.newRef;
  48447. let buffer, baseOffset;
  48448. const lastByte = originalData[originalData.length - 1];
  48449. if (lastByte === 0x0a || lastByte === 0x0d) {
  48450. buffer = [];
  48451. baseOffset = originalData.length;
  48452. } else {
  48453. buffer = ["\n"];
  48454. baseOffset = originalData.length + 1;
  48455. }
  48456. newXref.set("Size", refForXrefTable.num + 1);
  48457. newXref.set("Prev", xrefInfo.startXRef);
  48458. newXref.set("Type", _primitives.Name.get("XRef"));
  48459. if (xrefInfo.rootRef !== null) {
  48460. newXref.set("Root", xrefInfo.rootRef);
  48461. }
  48462. if (xrefInfo.infoRef !== null) {
  48463. newXref.set("Info", xrefInfo.infoRef);
  48464. }
  48465. if (xrefInfo.encryptRef !== null) {
  48466. newXref.set("Encrypt", xrefInfo.encryptRef);
  48467. }
  48468. newRefs.push({
  48469. ref: refForXrefTable,
  48470. data: ""
  48471. });
  48472. newRefs = newRefs.sort((a, b) => {
  48473. return a.ref.num - b.ref.num;
  48474. });
  48475. const xrefTableData = [[0, 1, 0xffff]];
  48476. const indexes = [0, 1];
  48477. let maxOffset = 0;
  48478. for (const {
  48479. ref,
  48480. data
  48481. } of newRefs) {
  48482. maxOffset = Math.max(maxOffset, baseOffset);
  48483. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  48484. baseOffset += data.length;
  48485. indexes.push(ref.num, 1);
  48486. buffer.push(data);
  48487. }
  48488. newXref.set("Index", indexes);
  48489. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  48490. const md5 = computeMD5(baseOffset, xrefInfo);
  48491. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  48492. }
  48493. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  48494. const sizes = [1, offsetSize, 2];
  48495. const structSize = sizes[0] + sizes[1] + sizes[2];
  48496. const tableLength = structSize * xrefTableData.length;
  48497. newXref.set("W", sizes);
  48498. newXref.set("Length", tableLength);
  48499. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  48500. writeDict(newXref, buffer, null);
  48501. buffer.push(" stream\n");
  48502. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  48503. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  48504. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  48505. array.set(originalData);
  48506. let offset = originalData.length;
  48507. for (const str of buffer) {
  48508. writeString(str, offset, array);
  48509. offset += str.length;
  48510. }
  48511. for (const [type, objOffset, gen] of xrefTableData) {
  48512. offset = writeInt(type, sizes[0], offset, array);
  48513. offset = writeInt(objOffset, sizes[1], offset, array);
  48514. offset = writeInt(gen, sizes[2], offset, array);
  48515. }
  48516. writeString(footer, offset, array);
  48517. return array;
  48518. }
  48519. /***/ }),
  48520. /* 72 */
  48521. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48522. Object.defineProperty(exports, "__esModule", ({
  48523. value: true
  48524. }));
  48525. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48526. exports.calculateSHA384 = calculateSHA384;
  48527. exports.calculateSHA512 = void 0;
  48528. var _util = __w_pdfjs_require__(2);
  48529. var _primitives = __w_pdfjs_require__(5);
  48530. var _decrypt_stream = __w_pdfjs_require__(73);
  48531. class ARCFourCipher {
  48532. constructor(key) {
  48533. this.a = 0;
  48534. this.b = 0;
  48535. const s = new Uint8Array(256);
  48536. const keyLength = key.length;
  48537. for (let i = 0; i < 256; ++i) {
  48538. s[i] = i;
  48539. }
  48540. for (let i = 0, j = 0; i < 256; ++i) {
  48541. const tmp = s[i];
  48542. j = j + tmp + key[i % keyLength] & 0xff;
  48543. s[i] = s[j];
  48544. s[j] = tmp;
  48545. }
  48546. this.s = s;
  48547. }
  48548. encryptBlock(data) {
  48549. let a = this.a,
  48550. b = this.b;
  48551. const s = this.s;
  48552. const n = data.length;
  48553. const output = new Uint8Array(n);
  48554. for (let i = 0; i < n; ++i) {
  48555. a = a + 1 & 0xff;
  48556. const tmp = s[a];
  48557. b = b + tmp & 0xff;
  48558. const tmp2 = s[b];
  48559. s[a] = tmp2;
  48560. s[b] = tmp;
  48561. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48562. }
  48563. this.a = a;
  48564. this.b = b;
  48565. return output;
  48566. }
  48567. decryptBlock(data) {
  48568. return this.encryptBlock(data);
  48569. }
  48570. encrypt(data) {
  48571. return this.encryptBlock(data);
  48572. }
  48573. }
  48574. exports.ARCFourCipher = ARCFourCipher;
  48575. const calculateMD5 = function calculateMD5Closure() {
  48576. 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]);
  48577. 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]);
  48578. function hash(data, offset, length) {
  48579. let h0 = 1732584193,
  48580. h1 = -271733879,
  48581. h2 = -1732584194,
  48582. h3 = 271733878;
  48583. const paddedLength = length + 72 & ~63;
  48584. const padded = new Uint8Array(paddedLength);
  48585. let i, j;
  48586. for (i = 0; i < length; ++i) {
  48587. padded[i] = data[offset++];
  48588. }
  48589. padded[i++] = 0x80;
  48590. const n = paddedLength - 8;
  48591. while (i < n) {
  48592. padded[i++] = 0;
  48593. }
  48594. padded[i++] = length << 3 & 0xff;
  48595. padded[i++] = length >> 5 & 0xff;
  48596. padded[i++] = length >> 13 & 0xff;
  48597. padded[i++] = length >> 21 & 0xff;
  48598. padded[i++] = length >>> 29 & 0xff;
  48599. padded[i++] = 0;
  48600. padded[i++] = 0;
  48601. padded[i++] = 0;
  48602. const w = new Int32Array(16);
  48603. for (i = 0; i < paddedLength;) {
  48604. for (j = 0; j < 16; ++j, i += 4) {
  48605. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48606. }
  48607. let a = h0,
  48608. b = h1,
  48609. c = h2,
  48610. d = h3,
  48611. f,
  48612. g;
  48613. for (j = 0; j < 64; ++j) {
  48614. if (j < 16) {
  48615. f = b & c | ~b & d;
  48616. g = j;
  48617. } else if (j < 32) {
  48618. f = d & b | ~d & c;
  48619. g = 5 * j + 1 & 15;
  48620. } else if (j < 48) {
  48621. f = b ^ c ^ d;
  48622. g = 3 * j + 5 & 15;
  48623. } else {
  48624. f = c ^ (b | ~d);
  48625. g = 7 * j & 15;
  48626. }
  48627. const tmp = d,
  48628. rotateArg = a + f + k[j] + w[g] | 0,
  48629. rotate = r[j];
  48630. d = c;
  48631. c = b;
  48632. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48633. a = tmp;
  48634. }
  48635. h0 = h0 + a | 0;
  48636. h1 = h1 + b | 0;
  48637. h2 = h2 + c | 0;
  48638. h3 = h3 + d | 0;
  48639. }
  48640. 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]);
  48641. }
  48642. return hash;
  48643. }();
  48644. exports.calculateMD5 = calculateMD5;
  48645. class Word64 {
  48646. constructor(highInteger, lowInteger) {
  48647. this.high = highInteger | 0;
  48648. this.low = lowInteger | 0;
  48649. }
  48650. and(word) {
  48651. this.high &= word.high;
  48652. this.low &= word.low;
  48653. }
  48654. xor(word) {
  48655. this.high ^= word.high;
  48656. this.low ^= word.low;
  48657. }
  48658. or(word) {
  48659. this.high |= word.high;
  48660. this.low |= word.low;
  48661. }
  48662. shiftRight(places) {
  48663. if (places >= 32) {
  48664. this.low = this.high >>> places - 32 | 0;
  48665. this.high = 0;
  48666. } else {
  48667. this.low = this.low >>> places | this.high << 32 - places;
  48668. this.high = this.high >>> places | 0;
  48669. }
  48670. }
  48671. shiftLeft(places) {
  48672. if (places >= 32) {
  48673. this.high = this.low << places - 32;
  48674. this.low = 0;
  48675. } else {
  48676. this.high = this.high << places | this.low >>> 32 - places;
  48677. this.low <<= places;
  48678. }
  48679. }
  48680. rotateRight(places) {
  48681. let low, high;
  48682. if (places & 32) {
  48683. high = this.low;
  48684. low = this.high;
  48685. } else {
  48686. low = this.low;
  48687. high = this.high;
  48688. }
  48689. places &= 31;
  48690. this.low = low >>> places | high << 32 - places;
  48691. this.high = high >>> places | low << 32 - places;
  48692. }
  48693. not() {
  48694. this.high = ~this.high;
  48695. this.low = ~this.low;
  48696. }
  48697. add(word) {
  48698. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48699. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48700. if (lowAdd > 0xffffffff) {
  48701. highAdd += 1;
  48702. }
  48703. this.low = lowAdd | 0;
  48704. this.high = highAdd | 0;
  48705. }
  48706. copyTo(bytes, offset) {
  48707. bytes[offset] = this.high >>> 24 & 0xff;
  48708. bytes[offset + 1] = this.high >> 16 & 0xff;
  48709. bytes[offset + 2] = this.high >> 8 & 0xff;
  48710. bytes[offset + 3] = this.high & 0xff;
  48711. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48712. bytes[offset + 5] = this.low >> 16 & 0xff;
  48713. bytes[offset + 6] = this.low >> 8 & 0xff;
  48714. bytes[offset + 7] = this.low & 0xff;
  48715. }
  48716. assign(word) {
  48717. this.high = word.high;
  48718. this.low = word.low;
  48719. }
  48720. }
  48721. const calculateSHA256 = function calculateSHA256Closure() {
  48722. function rotr(x, n) {
  48723. return x >>> n | x << 32 - n;
  48724. }
  48725. function ch(x, y, z) {
  48726. return x & y ^ ~x & z;
  48727. }
  48728. function maj(x, y, z) {
  48729. return x & y ^ x & z ^ y & z;
  48730. }
  48731. function sigma(x) {
  48732. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48733. }
  48734. function sigmaPrime(x) {
  48735. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48736. }
  48737. function littleSigma(x) {
  48738. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48739. }
  48740. function littleSigmaPrime(x) {
  48741. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48742. }
  48743. 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];
  48744. function hash(data, offset, length) {
  48745. let h0 = 0x6a09e667,
  48746. h1 = 0xbb67ae85,
  48747. h2 = 0x3c6ef372,
  48748. h3 = 0xa54ff53a,
  48749. h4 = 0x510e527f,
  48750. h5 = 0x9b05688c,
  48751. h6 = 0x1f83d9ab,
  48752. h7 = 0x5be0cd19;
  48753. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48754. const padded = new Uint8Array(paddedLength);
  48755. let i, j;
  48756. for (i = 0; i < length; ++i) {
  48757. padded[i] = data[offset++];
  48758. }
  48759. padded[i++] = 0x80;
  48760. const n = paddedLength - 8;
  48761. while (i < n) {
  48762. padded[i++] = 0;
  48763. }
  48764. padded[i++] = 0;
  48765. padded[i++] = 0;
  48766. padded[i++] = 0;
  48767. padded[i++] = length >>> 29 & 0xff;
  48768. padded[i++] = length >> 21 & 0xff;
  48769. padded[i++] = length >> 13 & 0xff;
  48770. padded[i++] = length >> 5 & 0xff;
  48771. padded[i++] = length << 3 & 0xff;
  48772. const w = new Uint32Array(64);
  48773. for (i = 0; i < paddedLength;) {
  48774. for (j = 0; j < 16; ++j) {
  48775. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48776. i += 4;
  48777. }
  48778. for (j = 16; j < 64; ++j) {
  48779. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48780. }
  48781. let a = h0,
  48782. b = h1,
  48783. c = h2,
  48784. d = h3,
  48785. e = h4,
  48786. f = h5,
  48787. g = h6,
  48788. h = h7,
  48789. t1,
  48790. t2;
  48791. for (j = 0; j < 64; ++j) {
  48792. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48793. t2 = sigma(a) + maj(a, b, c);
  48794. h = g;
  48795. g = f;
  48796. f = e;
  48797. e = d + t1 | 0;
  48798. d = c;
  48799. c = b;
  48800. b = a;
  48801. a = t1 + t2 | 0;
  48802. }
  48803. h0 = h0 + a | 0;
  48804. h1 = h1 + b | 0;
  48805. h2 = h2 + c | 0;
  48806. h3 = h3 + d | 0;
  48807. h4 = h4 + e | 0;
  48808. h5 = h5 + f | 0;
  48809. h6 = h6 + g | 0;
  48810. h7 = h7 + h | 0;
  48811. }
  48812. 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]);
  48813. }
  48814. return hash;
  48815. }();
  48816. exports.calculateSHA256 = calculateSHA256;
  48817. const calculateSHA512 = function calculateSHA512Closure() {
  48818. function ch(result, x, y, z, tmp) {
  48819. result.assign(x);
  48820. result.and(y);
  48821. tmp.assign(x);
  48822. tmp.not();
  48823. tmp.and(z);
  48824. result.xor(tmp);
  48825. }
  48826. function maj(result, x, y, z, tmp) {
  48827. result.assign(x);
  48828. result.and(y);
  48829. tmp.assign(x);
  48830. tmp.and(z);
  48831. result.xor(tmp);
  48832. tmp.assign(y);
  48833. tmp.and(z);
  48834. result.xor(tmp);
  48835. }
  48836. function sigma(result, x, tmp) {
  48837. result.assign(x);
  48838. result.rotateRight(28);
  48839. tmp.assign(x);
  48840. tmp.rotateRight(34);
  48841. result.xor(tmp);
  48842. tmp.assign(x);
  48843. tmp.rotateRight(39);
  48844. result.xor(tmp);
  48845. }
  48846. function sigmaPrime(result, x, tmp) {
  48847. result.assign(x);
  48848. result.rotateRight(14);
  48849. tmp.assign(x);
  48850. tmp.rotateRight(18);
  48851. result.xor(tmp);
  48852. tmp.assign(x);
  48853. tmp.rotateRight(41);
  48854. result.xor(tmp);
  48855. }
  48856. function littleSigma(result, x, tmp) {
  48857. result.assign(x);
  48858. result.rotateRight(1);
  48859. tmp.assign(x);
  48860. tmp.rotateRight(8);
  48861. result.xor(tmp);
  48862. tmp.assign(x);
  48863. tmp.shiftRight(7);
  48864. result.xor(tmp);
  48865. }
  48866. function littleSigmaPrime(result, x, tmp) {
  48867. result.assign(x);
  48868. result.rotateRight(19);
  48869. tmp.assign(x);
  48870. tmp.rotateRight(61);
  48871. result.xor(tmp);
  48872. tmp.assign(x);
  48873. tmp.shiftRight(6);
  48874. result.xor(tmp);
  48875. }
  48876. 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)];
  48877. function hash(data, offset, length, mode384 = false) {
  48878. let h0, h1, h2, h3, h4, h5, h6, h7;
  48879. if (!mode384) {
  48880. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48881. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48882. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48883. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48884. h4 = new Word64(0x510e527f, 0xade682d1);
  48885. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48886. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48887. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48888. } else {
  48889. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48890. h1 = new Word64(0x629a292a, 0x367cd507);
  48891. h2 = new Word64(0x9159015a, 0x3070dd17);
  48892. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48893. h4 = new Word64(0x67332667, 0xffc00b31);
  48894. h5 = new Word64(0x8eb44a87, 0x68581511);
  48895. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48896. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48897. }
  48898. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48899. const padded = new Uint8Array(paddedLength);
  48900. let i, j;
  48901. for (i = 0; i < length; ++i) {
  48902. padded[i] = data[offset++];
  48903. }
  48904. padded[i++] = 0x80;
  48905. const n = paddedLength - 16;
  48906. while (i < n) {
  48907. padded[i++] = 0;
  48908. }
  48909. padded[i++] = 0;
  48910. padded[i++] = 0;
  48911. padded[i++] = 0;
  48912. padded[i++] = 0;
  48913. padded[i++] = 0;
  48914. padded[i++] = 0;
  48915. padded[i++] = 0;
  48916. padded[i++] = 0;
  48917. padded[i++] = 0;
  48918. padded[i++] = 0;
  48919. padded[i++] = 0;
  48920. padded[i++] = length >>> 29 & 0xff;
  48921. padded[i++] = length >> 21 & 0xff;
  48922. padded[i++] = length >> 13 & 0xff;
  48923. padded[i++] = length >> 5 & 0xff;
  48924. padded[i++] = length << 3 & 0xff;
  48925. const w = new Array(80);
  48926. for (i = 0; i < 80; i++) {
  48927. w[i] = new Word64(0, 0);
  48928. }
  48929. let a = new Word64(0, 0),
  48930. b = new Word64(0, 0),
  48931. c = new Word64(0, 0);
  48932. let d = new Word64(0, 0),
  48933. e = new Word64(0, 0),
  48934. f = new Word64(0, 0);
  48935. let g = new Word64(0, 0),
  48936. h = new Word64(0, 0);
  48937. const t1 = new Word64(0, 0),
  48938. t2 = new Word64(0, 0);
  48939. const tmp1 = new Word64(0, 0),
  48940. tmp2 = new Word64(0, 0);
  48941. let tmp3;
  48942. for (i = 0; i < paddedLength;) {
  48943. for (j = 0; j < 16; ++j) {
  48944. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48945. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48946. i += 8;
  48947. }
  48948. for (j = 16; j < 80; ++j) {
  48949. tmp3 = w[j];
  48950. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48951. tmp3.add(w[j - 7]);
  48952. littleSigma(tmp1, w[j - 15], tmp2);
  48953. tmp3.add(tmp1);
  48954. tmp3.add(w[j - 16]);
  48955. }
  48956. a.assign(h0);
  48957. b.assign(h1);
  48958. c.assign(h2);
  48959. d.assign(h3);
  48960. e.assign(h4);
  48961. f.assign(h5);
  48962. g.assign(h6);
  48963. h.assign(h7);
  48964. for (j = 0; j < 80; ++j) {
  48965. t1.assign(h);
  48966. sigmaPrime(tmp1, e, tmp2);
  48967. t1.add(tmp1);
  48968. ch(tmp1, e, f, g, tmp2);
  48969. t1.add(tmp1);
  48970. t1.add(k[j]);
  48971. t1.add(w[j]);
  48972. sigma(t2, a, tmp2);
  48973. maj(tmp1, a, b, c, tmp2);
  48974. t2.add(tmp1);
  48975. tmp3 = h;
  48976. h = g;
  48977. g = f;
  48978. f = e;
  48979. d.add(t1);
  48980. e = d;
  48981. d = c;
  48982. c = b;
  48983. b = a;
  48984. tmp3.assign(t1);
  48985. tmp3.add(t2);
  48986. a = tmp3;
  48987. }
  48988. h0.add(a);
  48989. h1.add(b);
  48990. h2.add(c);
  48991. h3.add(d);
  48992. h4.add(e);
  48993. h5.add(f);
  48994. h6.add(g);
  48995. h7.add(h);
  48996. }
  48997. let result;
  48998. if (!mode384) {
  48999. result = new Uint8Array(64);
  49000. h0.copyTo(result, 0);
  49001. h1.copyTo(result, 8);
  49002. h2.copyTo(result, 16);
  49003. h3.copyTo(result, 24);
  49004. h4.copyTo(result, 32);
  49005. h5.copyTo(result, 40);
  49006. h6.copyTo(result, 48);
  49007. h7.copyTo(result, 56);
  49008. } else {
  49009. result = new Uint8Array(48);
  49010. h0.copyTo(result, 0);
  49011. h1.copyTo(result, 8);
  49012. h2.copyTo(result, 16);
  49013. h3.copyTo(result, 24);
  49014. h4.copyTo(result, 32);
  49015. h5.copyTo(result, 40);
  49016. }
  49017. return result;
  49018. }
  49019. return hash;
  49020. }();
  49021. exports.calculateSHA512 = calculateSHA512;
  49022. function calculateSHA384(data, offset, length) {
  49023. return calculateSHA512(data, offset, length, true);
  49024. }
  49025. class NullCipher {
  49026. decryptBlock(data) {
  49027. return data;
  49028. }
  49029. encrypt(data) {
  49030. return data;
  49031. }
  49032. }
  49033. class AESBaseCipher {
  49034. constructor() {
  49035. if (this.constructor === AESBaseCipher) {
  49036. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  49037. }
  49038. 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]);
  49039. 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]);
  49040. 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]);
  49041. this._mixCol = new Uint8Array(256);
  49042. for (let i = 0; i < 256; i++) {
  49043. if (i < 128) {
  49044. this._mixCol[i] = i << 1;
  49045. } else {
  49046. this._mixCol[i] = i << 1 ^ 0x1b;
  49047. }
  49048. }
  49049. this.buffer = new Uint8Array(16);
  49050. this.bufferPosition = 0;
  49051. }
  49052. _expandKey(cipherKey) {
  49053. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  49054. }
  49055. _decrypt(input, key) {
  49056. let t, u, v;
  49057. const state = new Uint8Array(16);
  49058. state.set(input);
  49059. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49060. state[j] ^= key[k];
  49061. }
  49062. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  49063. t = state[13];
  49064. state[13] = state[9];
  49065. state[9] = state[5];
  49066. state[5] = state[1];
  49067. state[1] = t;
  49068. t = state[14];
  49069. u = state[10];
  49070. state[14] = state[6];
  49071. state[10] = state[2];
  49072. state[6] = t;
  49073. state[2] = u;
  49074. t = state[15];
  49075. u = state[11];
  49076. v = state[7];
  49077. state[15] = state[3];
  49078. state[11] = t;
  49079. state[7] = u;
  49080. state[3] = v;
  49081. for (let j = 0; j < 16; ++j) {
  49082. state[j] = this._inv_s[state[j]];
  49083. }
  49084. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49085. state[j] ^= key[k];
  49086. }
  49087. for (let j = 0; j < 16; j += 4) {
  49088. const s0 = this._mix[state[j]];
  49089. const s1 = this._mix[state[j + 1]];
  49090. const s2 = this._mix[state[j + 2]];
  49091. const s3 = this._mix[state[j + 3]];
  49092. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  49093. state[j] = t >>> 24 & 0xff;
  49094. state[j + 1] = t >> 16 & 0xff;
  49095. state[j + 2] = t >> 8 & 0xff;
  49096. state[j + 3] = t & 0xff;
  49097. }
  49098. }
  49099. t = state[13];
  49100. state[13] = state[9];
  49101. state[9] = state[5];
  49102. state[5] = state[1];
  49103. state[1] = t;
  49104. t = state[14];
  49105. u = state[10];
  49106. state[14] = state[6];
  49107. state[10] = state[2];
  49108. state[6] = t;
  49109. state[2] = u;
  49110. t = state[15];
  49111. u = state[11];
  49112. v = state[7];
  49113. state[15] = state[3];
  49114. state[11] = t;
  49115. state[7] = u;
  49116. state[3] = v;
  49117. for (let j = 0; j < 16; ++j) {
  49118. state[j] = this._inv_s[state[j]];
  49119. state[j] ^= key[j];
  49120. }
  49121. return state;
  49122. }
  49123. _encrypt(input, key) {
  49124. const s = this._s;
  49125. let t, u, v;
  49126. const state = new Uint8Array(16);
  49127. state.set(input);
  49128. for (let j = 0; j < 16; ++j) {
  49129. state[j] ^= key[j];
  49130. }
  49131. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  49132. for (let j = 0; j < 16; ++j) {
  49133. state[j] = s[state[j]];
  49134. }
  49135. v = state[1];
  49136. state[1] = state[5];
  49137. state[5] = state[9];
  49138. state[9] = state[13];
  49139. state[13] = v;
  49140. v = state[2];
  49141. u = state[6];
  49142. state[2] = state[10];
  49143. state[6] = state[14];
  49144. state[10] = v;
  49145. state[14] = u;
  49146. v = state[3];
  49147. u = state[7];
  49148. t = state[11];
  49149. state[3] = state[15];
  49150. state[7] = v;
  49151. state[11] = u;
  49152. state[15] = t;
  49153. for (let j = 0; j < 16; j += 4) {
  49154. const s0 = state[j + 0];
  49155. const s1 = state[j + 1];
  49156. const s2 = state[j + 2];
  49157. const s3 = state[j + 3];
  49158. t = s0 ^ s1 ^ s2 ^ s3;
  49159. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  49160. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  49161. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  49162. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  49163. }
  49164. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49165. state[j] ^= key[k];
  49166. }
  49167. }
  49168. for (let j = 0; j < 16; ++j) {
  49169. state[j] = s[state[j]];
  49170. }
  49171. v = state[1];
  49172. state[1] = state[5];
  49173. state[5] = state[9];
  49174. state[9] = state[13];
  49175. state[13] = v;
  49176. v = state[2];
  49177. u = state[6];
  49178. state[2] = state[10];
  49179. state[6] = state[14];
  49180. state[10] = v;
  49181. state[14] = u;
  49182. v = state[3];
  49183. u = state[7];
  49184. t = state[11];
  49185. state[3] = state[15];
  49186. state[7] = v;
  49187. state[11] = u;
  49188. state[15] = t;
  49189. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49190. state[j] ^= key[k];
  49191. }
  49192. return state;
  49193. }
  49194. _decryptBlock2(data, finalize) {
  49195. const sourceLength = data.length;
  49196. let buffer = this.buffer,
  49197. bufferLength = this.bufferPosition;
  49198. const result = [];
  49199. let iv = this.iv;
  49200. for (let i = 0; i < sourceLength; ++i) {
  49201. buffer[bufferLength] = data[i];
  49202. ++bufferLength;
  49203. if (bufferLength < 16) {
  49204. continue;
  49205. }
  49206. const plain = this._decrypt(buffer, this._key);
  49207. for (let j = 0; j < 16; ++j) {
  49208. plain[j] ^= iv[j];
  49209. }
  49210. iv = buffer;
  49211. result.push(plain);
  49212. buffer = new Uint8Array(16);
  49213. bufferLength = 0;
  49214. }
  49215. this.buffer = buffer;
  49216. this.bufferLength = bufferLength;
  49217. this.iv = iv;
  49218. if (result.length === 0) {
  49219. return new Uint8Array(0);
  49220. }
  49221. let outputLength = 16 * result.length;
  49222. if (finalize) {
  49223. const lastBlock = result[result.length - 1];
  49224. let psLen = lastBlock[15];
  49225. if (psLen <= 16) {
  49226. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49227. if (lastBlock[i] !== psLen) {
  49228. psLen = 0;
  49229. break;
  49230. }
  49231. }
  49232. outputLength -= psLen;
  49233. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49234. }
  49235. }
  49236. const output = new Uint8Array(outputLength);
  49237. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49238. output.set(result[i], j);
  49239. }
  49240. return output;
  49241. }
  49242. decryptBlock(data, finalize, iv = null) {
  49243. const sourceLength = data.length;
  49244. const buffer = this.buffer;
  49245. let bufferLength = this.bufferPosition;
  49246. if (iv) {
  49247. this.iv = iv;
  49248. } else {
  49249. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49250. buffer[bufferLength] = data[i];
  49251. }
  49252. if (bufferLength < 16) {
  49253. this.bufferLength = bufferLength;
  49254. return new Uint8Array(0);
  49255. }
  49256. this.iv = buffer;
  49257. data = data.subarray(16);
  49258. }
  49259. this.buffer = new Uint8Array(16);
  49260. this.bufferLength = 0;
  49261. this.decryptBlock = this._decryptBlock2;
  49262. return this.decryptBlock(data, finalize);
  49263. }
  49264. encrypt(data, iv) {
  49265. const sourceLength = data.length;
  49266. let buffer = this.buffer,
  49267. bufferLength = this.bufferPosition;
  49268. const result = [];
  49269. if (!iv) {
  49270. iv = new Uint8Array(16);
  49271. }
  49272. for (let i = 0; i < sourceLength; ++i) {
  49273. buffer[bufferLength] = data[i];
  49274. ++bufferLength;
  49275. if (bufferLength < 16) {
  49276. continue;
  49277. }
  49278. for (let j = 0; j < 16; ++j) {
  49279. buffer[j] ^= iv[j];
  49280. }
  49281. const cipher = this._encrypt(buffer, this._key);
  49282. iv = cipher;
  49283. result.push(cipher);
  49284. buffer = new Uint8Array(16);
  49285. bufferLength = 0;
  49286. }
  49287. this.buffer = buffer;
  49288. this.bufferLength = bufferLength;
  49289. this.iv = iv;
  49290. if (result.length === 0) {
  49291. return new Uint8Array(0);
  49292. }
  49293. const outputLength = 16 * result.length;
  49294. const output = new Uint8Array(outputLength);
  49295. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49296. output.set(result[i], j);
  49297. }
  49298. return output;
  49299. }
  49300. }
  49301. class AES128Cipher extends AESBaseCipher {
  49302. constructor(key) {
  49303. super();
  49304. this._cyclesOfRepetition = 10;
  49305. this._keySize = 160;
  49306. 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]);
  49307. this._key = this._expandKey(key);
  49308. }
  49309. _expandKey(cipherKey) {
  49310. const b = 176;
  49311. const s = this._s;
  49312. const rcon = this._rcon;
  49313. const result = new Uint8Array(b);
  49314. result.set(cipherKey);
  49315. for (let j = 16, i = 1; j < b; ++i) {
  49316. let t1 = result[j - 3];
  49317. let t2 = result[j - 2];
  49318. let t3 = result[j - 1];
  49319. let t4 = result[j - 4];
  49320. t1 = s[t1];
  49321. t2 = s[t2];
  49322. t3 = s[t3];
  49323. t4 = s[t4];
  49324. t1 ^= rcon[i];
  49325. for (let n = 0; n < 4; ++n) {
  49326. result[j] = t1 ^= result[j - 16];
  49327. j++;
  49328. result[j] = t2 ^= result[j - 16];
  49329. j++;
  49330. result[j] = t3 ^= result[j - 16];
  49331. j++;
  49332. result[j] = t4 ^= result[j - 16];
  49333. j++;
  49334. }
  49335. }
  49336. return result;
  49337. }
  49338. }
  49339. exports.AES128Cipher = AES128Cipher;
  49340. class AES256Cipher extends AESBaseCipher {
  49341. constructor(key) {
  49342. super();
  49343. this._cyclesOfRepetition = 14;
  49344. this._keySize = 224;
  49345. this._key = this._expandKey(key);
  49346. }
  49347. _expandKey(cipherKey) {
  49348. const b = 240;
  49349. const s = this._s;
  49350. const result = new Uint8Array(b);
  49351. result.set(cipherKey);
  49352. let r = 1;
  49353. let t1, t2, t3, t4;
  49354. for (let j = 32, i = 1; j < b; ++i) {
  49355. if (j % 32 === 16) {
  49356. t1 = s[t1];
  49357. t2 = s[t2];
  49358. t3 = s[t3];
  49359. t4 = s[t4];
  49360. } else if (j % 32 === 0) {
  49361. t1 = result[j - 3];
  49362. t2 = result[j - 2];
  49363. t3 = result[j - 1];
  49364. t4 = result[j - 4];
  49365. t1 = s[t1];
  49366. t2 = s[t2];
  49367. t3 = s[t3];
  49368. t4 = s[t4];
  49369. t1 ^= r;
  49370. if ((r <<= 1) >= 256) {
  49371. r = (r ^ 0x1b) & 0xff;
  49372. }
  49373. }
  49374. for (let n = 0; n < 4; ++n) {
  49375. result[j] = t1 ^= result[j - 32];
  49376. j++;
  49377. result[j] = t2 ^= result[j - 32];
  49378. j++;
  49379. result[j] = t3 ^= result[j - 32];
  49380. j++;
  49381. result[j] = t4 ^= result[j - 32];
  49382. j++;
  49383. }
  49384. }
  49385. return result;
  49386. }
  49387. }
  49388. exports.AES256Cipher = AES256Cipher;
  49389. class PDF17 {
  49390. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49391. const hashData = new Uint8Array(password.length + 56);
  49392. hashData.set(password, 0);
  49393. hashData.set(ownerValidationSalt, password.length);
  49394. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49395. const result = calculateSHA256(hashData, 0, hashData.length);
  49396. return (0, _util.isArrayEqual)(result, ownerPassword);
  49397. }
  49398. checkUserPassword(password, userValidationSalt, userPassword) {
  49399. const hashData = new Uint8Array(password.length + 8);
  49400. hashData.set(password, 0);
  49401. hashData.set(userValidationSalt, password.length);
  49402. const result = calculateSHA256(hashData, 0, hashData.length);
  49403. return (0, _util.isArrayEqual)(result, userPassword);
  49404. }
  49405. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49406. const hashData = new Uint8Array(password.length + 56);
  49407. hashData.set(password, 0);
  49408. hashData.set(ownerKeySalt, password.length);
  49409. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49410. const key = calculateSHA256(hashData, 0, hashData.length);
  49411. const cipher = new AES256Cipher(key);
  49412. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49413. }
  49414. getUserKey(password, userKeySalt, userEncryption) {
  49415. const hashData = new Uint8Array(password.length + 8);
  49416. hashData.set(password, 0);
  49417. hashData.set(userKeySalt, password.length);
  49418. const key = calculateSHA256(hashData, 0, hashData.length);
  49419. const cipher = new AES256Cipher(key);
  49420. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49421. }
  49422. }
  49423. exports.PDF17 = PDF17;
  49424. const PDF20 = function PDF20Closure() {
  49425. function calculatePDF20Hash(password, input, userBytes) {
  49426. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49427. let e = [0];
  49428. let i = 0;
  49429. while (i < 64 || e[e.length - 1] > i - 32) {
  49430. const combinedLength = password.length + k.length + userBytes.length,
  49431. combinedArray = new Uint8Array(combinedLength);
  49432. let writeOffset = 0;
  49433. combinedArray.set(password, writeOffset);
  49434. writeOffset += password.length;
  49435. combinedArray.set(k, writeOffset);
  49436. writeOffset += k.length;
  49437. combinedArray.set(userBytes, writeOffset);
  49438. const k1 = new Uint8Array(combinedLength * 64);
  49439. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49440. k1.set(combinedArray, pos);
  49441. }
  49442. const cipher = new AES128Cipher(k.subarray(0, 16));
  49443. e = cipher.encrypt(k1, k.subarray(16, 32));
  49444. let remainder = 0;
  49445. for (let z = 0; z < 16; z++) {
  49446. remainder *= 256 % 3;
  49447. remainder %= 3;
  49448. remainder += (e[z] >>> 0) % 3;
  49449. remainder %= 3;
  49450. }
  49451. if (remainder === 0) {
  49452. k = calculateSHA256(e, 0, e.length);
  49453. } else if (remainder === 1) {
  49454. k = calculateSHA384(e, 0, e.length);
  49455. } else if (remainder === 2) {
  49456. k = calculateSHA512(e, 0, e.length);
  49457. }
  49458. i++;
  49459. }
  49460. return k.subarray(0, 32);
  49461. }
  49462. class PDF20 {
  49463. hash(password, concatBytes, userBytes) {
  49464. return calculatePDF20Hash(password, concatBytes, userBytes);
  49465. }
  49466. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49467. const hashData = new Uint8Array(password.length + 56);
  49468. hashData.set(password, 0);
  49469. hashData.set(ownerValidationSalt, password.length);
  49470. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49471. const result = calculatePDF20Hash(password, hashData, userBytes);
  49472. return (0, _util.isArrayEqual)(result, ownerPassword);
  49473. }
  49474. checkUserPassword(password, userValidationSalt, userPassword) {
  49475. const hashData = new Uint8Array(password.length + 8);
  49476. hashData.set(password, 0);
  49477. hashData.set(userValidationSalt, password.length);
  49478. const result = calculatePDF20Hash(password, hashData, []);
  49479. return (0, _util.isArrayEqual)(result, userPassword);
  49480. }
  49481. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49482. const hashData = new Uint8Array(password.length + 56);
  49483. hashData.set(password, 0);
  49484. hashData.set(ownerKeySalt, password.length);
  49485. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49486. const key = calculatePDF20Hash(password, hashData, userBytes);
  49487. const cipher = new AES256Cipher(key);
  49488. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49489. }
  49490. getUserKey(password, userKeySalt, userEncryption) {
  49491. const hashData = new Uint8Array(password.length + 8);
  49492. hashData.set(password, 0);
  49493. hashData.set(userKeySalt, password.length);
  49494. const key = calculatePDF20Hash(password, hashData, []);
  49495. const cipher = new AES256Cipher(key);
  49496. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49497. }
  49498. }
  49499. return PDF20;
  49500. }();
  49501. exports.PDF20 = PDF20;
  49502. class CipherTransform {
  49503. constructor(stringCipherConstructor, streamCipherConstructor) {
  49504. this.StringCipherConstructor = stringCipherConstructor;
  49505. this.StreamCipherConstructor = streamCipherConstructor;
  49506. }
  49507. createStream(stream, length) {
  49508. const cipher = new this.StreamCipherConstructor();
  49509. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49510. return cipher.decryptBlock(data, finalize);
  49511. });
  49512. }
  49513. decryptString(s) {
  49514. const cipher = new this.StringCipherConstructor();
  49515. let data = (0, _util.stringToBytes)(s);
  49516. data = cipher.decryptBlock(data, true);
  49517. return (0, _util.bytesToString)(data);
  49518. }
  49519. encryptString(s) {
  49520. const cipher = new this.StringCipherConstructor();
  49521. if (cipher instanceof AESBaseCipher) {
  49522. const strLen = s.length;
  49523. const pad = 16 - strLen % 16;
  49524. s += String.fromCharCode(pad).repeat(pad);
  49525. const iv = new Uint8Array(16);
  49526. if (typeof crypto !== "undefined") {
  49527. crypto.getRandomValues(iv);
  49528. } else {
  49529. for (let i = 0; i < 16; i++) {
  49530. iv[i] = Math.floor(256 * Math.random());
  49531. }
  49532. }
  49533. let data = (0, _util.stringToBytes)(s);
  49534. data = cipher.encrypt(data, iv);
  49535. const buf = new Uint8Array(16 + data.length);
  49536. buf.set(iv);
  49537. buf.set(data, 16);
  49538. return (0, _util.bytesToString)(buf);
  49539. }
  49540. let data = (0, _util.stringToBytes)(s);
  49541. data = cipher.encrypt(data);
  49542. return (0, _util.bytesToString)(data);
  49543. }
  49544. }
  49545. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49546. 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]);
  49547. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49548. if (password) {
  49549. const passwordLength = Math.min(127, password.length);
  49550. password = password.subarray(0, passwordLength);
  49551. } else {
  49552. password = [];
  49553. }
  49554. let pdfAlgorithm;
  49555. if (revision === 6) {
  49556. pdfAlgorithm = new PDF20();
  49557. } else {
  49558. pdfAlgorithm = new PDF17();
  49559. }
  49560. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49561. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49562. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49563. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49564. }
  49565. return null;
  49566. }
  49567. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49568. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49569. const hashData = new Uint8Array(hashDataSize);
  49570. let i = 0,
  49571. j,
  49572. n;
  49573. if (password) {
  49574. n = Math.min(32, password.length);
  49575. for (; i < n; ++i) {
  49576. hashData[i] = password[i];
  49577. }
  49578. }
  49579. j = 0;
  49580. while (i < 32) {
  49581. hashData[i++] = defaultPasswordBytes[j++];
  49582. }
  49583. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49584. hashData[i++] = ownerPassword[j];
  49585. }
  49586. hashData[i++] = flags & 0xff;
  49587. hashData[i++] = flags >> 8 & 0xff;
  49588. hashData[i++] = flags >> 16 & 0xff;
  49589. hashData[i++] = flags >>> 24 & 0xff;
  49590. for (j = 0, n = fileId.length; j < n; ++j) {
  49591. hashData[i++] = fileId[j];
  49592. }
  49593. if (revision >= 4 && !encryptMetadata) {
  49594. hashData[i++] = 0xff;
  49595. hashData[i++] = 0xff;
  49596. hashData[i++] = 0xff;
  49597. hashData[i++] = 0xff;
  49598. }
  49599. let hash = calculateMD5(hashData, 0, i);
  49600. const keyLengthInBytes = keyLength >> 3;
  49601. if (revision >= 3) {
  49602. for (j = 0; j < 50; ++j) {
  49603. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49604. }
  49605. }
  49606. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49607. let cipher, checkData;
  49608. if (revision >= 3) {
  49609. for (i = 0; i < 32; ++i) {
  49610. hashData[i] = defaultPasswordBytes[i];
  49611. }
  49612. for (j = 0, n = fileId.length; j < n; ++j) {
  49613. hashData[i++] = fileId[j];
  49614. }
  49615. cipher = new ARCFourCipher(encryptionKey);
  49616. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49617. n = encryptionKey.length;
  49618. const derivedKey = new Uint8Array(n);
  49619. for (j = 1; j <= 19; ++j) {
  49620. for (let k = 0; k < n; ++k) {
  49621. derivedKey[k] = encryptionKey[k] ^ j;
  49622. }
  49623. cipher = new ARCFourCipher(derivedKey);
  49624. checkData = cipher.encryptBlock(checkData);
  49625. }
  49626. for (j = 0, n = checkData.length; j < n; ++j) {
  49627. if (userPassword[j] !== checkData[j]) {
  49628. return null;
  49629. }
  49630. }
  49631. } else {
  49632. cipher = new ARCFourCipher(encryptionKey);
  49633. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49634. for (j = 0, n = checkData.length; j < n; ++j) {
  49635. if (userPassword[j] !== checkData[j]) {
  49636. return null;
  49637. }
  49638. }
  49639. }
  49640. return encryptionKey;
  49641. }
  49642. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49643. const hashData = new Uint8Array(32);
  49644. let i = 0;
  49645. const n = Math.min(32, password.length);
  49646. for (; i < n; ++i) {
  49647. hashData[i] = password[i];
  49648. }
  49649. let j = 0;
  49650. while (i < 32) {
  49651. hashData[i++] = defaultPasswordBytes[j++];
  49652. }
  49653. let hash = calculateMD5(hashData, 0, i);
  49654. const keyLengthInBytes = keyLength >> 3;
  49655. if (revision >= 3) {
  49656. for (j = 0; j < 50; ++j) {
  49657. hash = calculateMD5(hash, 0, hash.length);
  49658. }
  49659. }
  49660. let cipher, userPassword;
  49661. if (revision >= 3) {
  49662. userPassword = ownerPassword;
  49663. const derivedKey = new Uint8Array(keyLengthInBytes);
  49664. for (j = 19; j >= 0; j--) {
  49665. for (let k = 0; k < keyLengthInBytes; ++k) {
  49666. derivedKey[k] = hash[k] ^ j;
  49667. }
  49668. cipher = new ARCFourCipher(derivedKey);
  49669. userPassword = cipher.encryptBlock(userPassword);
  49670. }
  49671. } else {
  49672. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49673. userPassword = cipher.encryptBlock(ownerPassword);
  49674. }
  49675. return userPassword;
  49676. }
  49677. const identityName = _primitives.Name.get("Identity");
  49678. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49679. const key = new Uint8Array(encryptionKey.length + 9);
  49680. const n = encryptionKey.length;
  49681. let i;
  49682. for (i = 0; i < n; ++i) {
  49683. key[i] = encryptionKey[i];
  49684. }
  49685. key[i++] = num & 0xff;
  49686. key[i++] = num >> 8 & 0xff;
  49687. key[i++] = num >> 16 & 0xff;
  49688. key[i++] = gen & 0xff;
  49689. key[i++] = gen >> 8 & 0xff;
  49690. if (isAes) {
  49691. key[i++] = 0x73;
  49692. key[i++] = 0x41;
  49693. key[i++] = 0x6c;
  49694. key[i++] = 0x54;
  49695. }
  49696. const hash = calculateMD5(key, 0, i);
  49697. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49698. }
  49699. function buildCipherConstructor(cf, name, num, gen, key) {
  49700. if (!(0, _primitives.isName)(name)) {
  49701. throw new _util.FormatError("Invalid crypt filter name.");
  49702. }
  49703. const cryptFilter = cf.get(name.name);
  49704. let cfm;
  49705. if (cryptFilter !== null && cryptFilter !== undefined) {
  49706. cfm = cryptFilter.get("CFM");
  49707. }
  49708. if (!cfm || cfm.name === "None") {
  49709. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49710. return new NullCipher();
  49711. };
  49712. }
  49713. if (cfm.name === "V2") {
  49714. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49715. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49716. };
  49717. }
  49718. if (cfm.name === "AESV2") {
  49719. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49720. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49721. };
  49722. }
  49723. if (cfm.name === "AESV3") {
  49724. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49725. return new AES256Cipher(key);
  49726. };
  49727. }
  49728. throw new _util.FormatError("Unknown crypto method");
  49729. }
  49730. class CipherTransformFactory {
  49731. constructor(dict, fileId, password) {
  49732. const filter = dict.get("Filter");
  49733. if (!(0, _primitives.isName)(filter, "Standard")) {
  49734. throw new _util.FormatError("unknown encryption method");
  49735. }
  49736. this.filterName = filter.name;
  49737. this.dict = dict;
  49738. const algorithm = dict.get("V");
  49739. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49740. throw new _util.FormatError("unsupported encryption algorithm");
  49741. }
  49742. this.algorithm = algorithm;
  49743. let keyLength = dict.get("Length");
  49744. if (!keyLength) {
  49745. if (algorithm <= 3) {
  49746. keyLength = 40;
  49747. } else {
  49748. const cfDict = dict.get("CF");
  49749. const streamCryptoName = dict.get("StmF");
  49750. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  49751. cfDict.suppressEncryption = true;
  49752. const handlerDict = cfDict.get(streamCryptoName.name);
  49753. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49754. if (keyLength < 40) {
  49755. keyLength <<= 3;
  49756. }
  49757. }
  49758. }
  49759. }
  49760. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49761. throw new _util.FormatError("invalid key length");
  49762. }
  49763. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49764. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49765. const flags = dict.get("P");
  49766. const revision = dict.get("R");
  49767. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49768. this.encryptMetadata = encryptMetadata;
  49769. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49770. let passwordBytes;
  49771. if (password) {
  49772. if (revision === 6) {
  49773. try {
  49774. password = (0, _util.utf8StringToString)(password);
  49775. } catch (ex) {
  49776. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49777. }
  49778. }
  49779. passwordBytes = (0, _util.stringToBytes)(password);
  49780. }
  49781. let encryptionKey;
  49782. if (algorithm !== 5) {
  49783. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49784. } else {
  49785. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49786. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49787. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49788. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49789. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49790. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49791. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49792. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49793. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49794. }
  49795. if (!encryptionKey && !password) {
  49796. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49797. } else if (!encryptionKey && password) {
  49798. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49799. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49800. }
  49801. if (!encryptionKey) {
  49802. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49803. }
  49804. this.encryptionKey = encryptionKey;
  49805. if (algorithm >= 4) {
  49806. const cf = dict.get("CF");
  49807. if ((0, _primitives.isDict)(cf)) {
  49808. cf.suppressEncryption = true;
  49809. }
  49810. this.cf = cf;
  49811. this.stmf = dict.get("StmF") || identityName;
  49812. this.strf = dict.get("StrF") || identityName;
  49813. this.eff = dict.get("EFF") || this.stmf;
  49814. }
  49815. }
  49816. createCipherTransform(num, gen) {
  49817. if (this.algorithm === 4 || this.algorithm === 5) {
  49818. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  49819. }
  49820. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49821. const cipherConstructor = function buildCipherCipherConstructor() {
  49822. return new ARCFourCipher(key);
  49823. };
  49824. return new CipherTransform(cipherConstructor, cipherConstructor);
  49825. }
  49826. }
  49827. return CipherTransformFactory;
  49828. }();
  49829. exports.CipherTransformFactory = CipherTransformFactory;
  49830. /***/ }),
  49831. /* 73 */
  49832. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49833. Object.defineProperty(exports, "__esModule", ({
  49834. value: true
  49835. }));
  49836. exports.DecryptStream = void 0;
  49837. var _decode_stream = __w_pdfjs_require__(29);
  49838. const chunkSize = 512;
  49839. class DecryptStream extends _decode_stream.DecodeStream {
  49840. constructor(str, maybeLength, decrypt) {
  49841. super(maybeLength);
  49842. this.str = str;
  49843. this.dict = str.dict;
  49844. this.decrypt = decrypt;
  49845. this.nextChunk = null;
  49846. this.initialized = false;
  49847. }
  49848. readBlock() {
  49849. let chunk;
  49850. if (this.initialized) {
  49851. chunk = this.nextChunk;
  49852. } else {
  49853. chunk = this.str.getBytes(chunkSize);
  49854. this.initialized = true;
  49855. }
  49856. if (!chunk || chunk.length === 0) {
  49857. this.eof = true;
  49858. return;
  49859. }
  49860. this.nextChunk = this.str.getBytes(chunkSize);
  49861. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49862. const decrypt = this.decrypt;
  49863. chunk = decrypt(chunk, !hasMoreData);
  49864. let bufferLength = this.bufferLength;
  49865. const n = chunk.length,
  49866. buffer = this.ensureBuffer(bufferLength + n);
  49867. for (let i = 0; i < n; i++) {
  49868. buffer[bufferLength++] = chunk[i];
  49869. }
  49870. this.bufferLength = bufferLength;
  49871. }
  49872. }
  49873. exports.DecryptStream = DecryptStream;
  49874. /***/ }),
  49875. /* 74 */
  49876. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49877. Object.defineProperty(exports, "__esModule", ({
  49878. value: true
  49879. }));
  49880. exports.XFAFactory = void 0;
  49881. var _xfa_object = __w_pdfjs_require__(75);
  49882. var _bind = __w_pdfjs_require__(79);
  49883. var _data = __w_pdfjs_require__(85);
  49884. var _fonts = __w_pdfjs_require__(83);
  49885. var _utils = __w_pdfjs_require__(76);
  49886. var _util = __w_pdfjs_require__(2);
  49887. var _parser = __w_pdfjs_require__(86);
  49888. var _xhtml = __w_pdfjs_require__(96);
  49889. class XFAFactory {
  49890. constructor(data) {
  49891. try {
  49892. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  49893. const binder = new _bind.Binder(this.root);
  49894. this.form = binder.bind();
  49895. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  49896. this.form[_xfa_object.$globalData].template = this.form;
  49897. } catch (e) {
  49898. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  49899. }
  49900. }
  49901. isValid() {
  49902. return this.root && this.form;
  49903. }
  49904. _createPagesHelper() {
  49905. const iterator = this.form[_xfa_object.$toPages]();
  49906. return new Promise((resolve, reject) => {
  49907. const nextIteration = () => {
  49908. try {
  49909. const value = iterator.next();
  49910. if (value.done) {
  49911. resolve(value.value);
  49912. } else {
  49913. setTimeout(nextIteration, 0);
  49914. }
  49915. } catch (e) {
  49916. reject(e);
  49917. }
  49918. };
  49919. setTimeout(nextIteration, 0);
  49920. });
  49921. }
  49922. async _createPages() {
  49923. try {
  49924. this.pages = await this._createPagesHelper();
  49925. this.dims = this.pages.children.map(c => {
  49926. const {
  49927. width,
  49928. height
  49929. } = c.attributes.style;
  49930. return [0, 0, parseInt(width), parseInt(height)];
  49931. });
  49932. } catch (e) {
  49933. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  49934. }
  49935. }
  49936. getBoundingBox(pageIndex) {
  49937. return this.dims[pageIndex];
  49938. }
  49939. async getNumPages() {
  49940. if (!this.pages) {
  49941. await this._createPages();
  49942. }
  49943. return this.dims.length;
  49944. }
  49945. setImages(images) {
  49946. this.form[_xfa_object.$globalData].images = images;
  49947. }
  49948. setFonts(fonts) {
  49949. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  49950. const missingFonts = [];
  49951. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  49952. typeface = (0, _utils.stripQuotes)(typeface);
  49953. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  49954. if (!font) {
  49955. missingFonts.push(typeface);
  49956. }
  49957. }
  49958. if (missingFonts.length > 0) {
  49959. return missingFonts;
  49960. }
  49961. return null;
  49962. }
  49963. appendFonts(fonts, reallyMissingFonts) {
  49964. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  49965. }
  49966. async getPages() {
  49967. if (!this.pages) {
  49968. await this._createPages();
  49969. }
  49970. const pages = this.pages;
  49971. this.pages = null;
  49972. return pages;
  49973. }
  49974. serializeData(storage) {
  49975. return this.dataHandler.serialize(storage);
  49976. }
  49977. static _createDocument(data) {
  49978. if (!data["/xdp:xdp"]) {
  49979. return data["xdp:xdp"];
  49980. }
  49981. return Object.values(data).join("");
  49982. }
  49983. static getRichTextAsHtml(rc) {
  49984. if (!rc || typeof rc !== "string") {
  49985. return null;
  49986. }
  49987. try {
  49988. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  49989. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  49990. const newRoot = _xhtml.XhtmlNamespace.body({});
  49991. newRoot[_xfa_object.$appendChild](root);
  49992. root = newRoot;
  49993. }
  49994. const result = root[_xfa_object.$toHTML]();
  49995. if (!result.success) {
  49996. return null;
  49997. }
  49998. const {
  49999. html
  50000. } = result;
  50001. const {
  50002. attributes
  50003. } = html;
  50004. if (attributes) {
  50005. if (attributes.class) {
  50006. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  50007. }
  50008. attributes.dir = "auto";
  50009. }
  50010. return {
  50011. html,
  50012. str: root[_xfa_object.$text]()
  50013. };
  50014. } catch (e) {
  50015. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  50016. }
  50017. return null;
  50018. }
  50019. }
  50020. exports.XFAFactory = XFAFactory;
  50021. /***/ }),
  50022. /* 75 */
  50023. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50024. Object.defineProperty(exports, "__esModule", ({
  50025. value: true
  50026. }));
  50027. 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.$toPages = 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;
  50028. var _utils = __w_pdfjs_require__(76);
  50029. var _util = __w_pdfjs_require__(2);
  50030. var _core_utils = __w_pdfjs_require__(9);
  50031. var _namespaces = __w_pdfjs_require__(77);
  50032. var _som = __w_pdfjs_require__(78);
  50033. const $acceptWhitespace = Symbol();
  50034. exports.$acceptWhitespace = $acceptWhitespace;
  50035. const $addHTML = Symbol();
  50036. exports.$addHTML = $addHTML;
  50037. const $appendChild = Symbol();
  50038. exports.$appendChild = $appendChild;
  50039. const $childrenToHTML = Symbol();
  50040. exports.$childrenToHTML = $childrenToHTML;
  50041. const $clean = Symbol();
  50042. exports.$clean = $clean;
  50043. const $cleanPage = Symbol();
  50044. exports.$cleanPage = $cleanPage;
  50045. const $cleanup = Symbol();
  50046. exports.$cleanup = $cleanup;
  50047. const $clone = Symbol();
  50048. exports.$clone = $clone;
  50049. const $consumed = Symbol();
  50050. exports.$consumed = $consumed;
  50051. const $content = Symbol("content");
  50052. exports.$content = $content;
  50053. const $data = Symbol("data");
  50054. exports.$data = $data;
  50055. const $dump = Symbol();
  50056. exports.$dump = $dump;
  50057. const $extra = Symbol("extra");
  50058. exports.$extra = $extra;
  50059. const $finalize = Symbol();
  50060. exports.$finalize = $finalize;
  50061. const $flushHTML = Symbol();
  50062. exports.$flushHTML = $flushHTML;
  50063. const $getAttributeIt = Symbol();
  50064. exports.$getAttributeIt = $getAttributeIt;
  50065. const $getAttributes = Symbol();
  50066. exports.$getAttributes = $getAttributes;
  50067. const $getAvailableSpace = Symbol();
  50068. exports.$getAvailableSpace = $getAvailableSpace;
  50069. const $getChildrenByClass = Symbol();
  50070. exports.$getChildrenByClass = $getChildrenByClass;
  50071. const $getChildrenByName = Symbol();
  50072. exports.$getChildrenByName = $getChildrenByName;
  50073. const $getChildrenByNameIt = Symbol();
  50074. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  50075. const $getDataValue = Symbol();
  50076. exports.$getDataValue = $getDataValue;
  50077. const $getExtra = Symbol();
  50078. exports.$getExtra = $getExtra;
  50079. const $getRealChildrenByNameIt = Symbol();
  50080. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  50081. const $getChildren = Symbol();
  50082. exports.$getChildren = $getChildren;
  50083. const $getContainedChildren = Symbol();
  50084. exports.$getContainedChildren = $getContainedChildren;
  50085. const $getNextPage = Symbol();
  50086. exports.$getNextPage = $getNextPage;
  50087. const $getSubformParent = Symbol();
  50088. exports.$getSubformParent = $getSubformParent;
  50089. const $getParent = Symbol();
  50090. exports.$getParent = $getParent;
  50091. const $getTemplateRoot = Symbol();
  50092. exports.$getTemplateRoot = $getTemplateRoot;
  50093. const $globalData = Symbol();
  50094. exports.$globalData = $globalData;
  50095. const $hasSettableValue = Symbol();
  50096. exports.$hasSettableValue = $hasSettableValue;
  50097. const $ids = Symbol();
  50098. exports.$ids = $ids;
  50099. const $indexOf = Symbol();
  50100. exports.$indexOf = $indexOf;
  50101. const $insertAt = Symbol();
  50102. exports.$insertAt = $insertAt;
  50103. const $isCDATAXml = Symbol();
  50104. exports.$isCDATAXml = $isCDATAXml;
  50105. const $isBindable = Symbol();
  50106. exports.$isBindable = $isBindable;
  50107. const $isDataValue = Symbol();
  50108. exports.$isDataValue = $isDataValue;
  50109. const $isDescendent = Symbol();
  50110. exports.$isDescendent = $isDescendent;
  50111. const $isNsAgnostic = Symbol();
  50112. exports.$isNsAgnostic = $isNsAgnostic;
  50113. const $isSplittable = Symbol();
  50114. exports.$isSplittable = $isSplittable;
  50115. const $isThereMoreWidth = Symbol();
  50116. exports.$isThereMoreWidth = $isThereMoreWidth;
  50117. const $isTransparent = Symbol();
  50118. exports.$isTransparent = $isTransparent;
  50119. const $isUsable = Symbol();
  50120. exports.$isUsable = $isUsable;
  50121. const $lastAttribute = Symbol();
  50122. const $namespaceId = Symbol("namespaceId");
  50123. exports.$namespaceId = $namespaceId;
  50124. const $nodeName = Symbol("nodeName");
  50125. exports.$nodeName = $nodeName;
  50126. const $nsAttributes = Symbol();
  50127. exports.$nsAttributes = $nsAttributes;
  50128. const $onChild = Symbol();
  50129. exports.$onChild = $onChild;
  50130. const $onChildCheck = Symbol();
  50131. exports.$onChildCheck = $onChildCheck;
  50132. const $onText = Symbol();
  50133. exports.$onText = $onText;
  50134. const $pushGlyphs = Symbol();
  50135. exports.$pushGlyphs = $pushGlyphs;
  50136. const $popPara = Symbol();
  50137. exports.$popPara = $popPara;
  50138. const $pushPara = Symbol();
  50139. exports.$pushPara = $pushPara;
  50140. const $removeChild = Symbol();
  50141. exports.$removeChild = $removeChild;
  50142. const $root = Symbol("root");
  50143. exports.$root = $root;
  50144. const $resolvePrototypes = Symbol();
  50145. exports.$resolvePrototypes = $resolvePrototypes;
  50146. const $searchNode = Symbol();
  50147. exports.$searchNode = $searchNode;
  50148. const $setId = Symbol();
  50149. exports.$setId = $setId;
  50150. const $setSetAttributes = Symbol();
  50151. exports.$setSetAttributes = $setSetAttributes;
  50152. const $setValue = Symbol();
  50153. exports.$setValue = $setValue;
  50154. const $tabIndex = Symbol();
  50155. exports.$tabIndex = $tabIndex;
  50156. const $text = Symbol();
  50157. exports.$text = $text;
  50158. const $toPages = Symbol();
  50159. exports.$toPages = $toPages;
  50160. const $toHTML = Symbol();
  50161. exports.$toHTML = $toHTML;
  50162. const $toString = Symbol();
  50163. exports.$toString = $toString;
  50164. const $toStyle = Symbol();
  50165. exports.$toStyle = $toStyle;
  50166. const $uid = Symbol("uid");
  50167. exports.$uid = $uid;
  50168. const _applyPrototype = Symbol();
  50169. const _attributes = Symbol();
  50170. const _attributeNames = Symbol();
  50171. const _children = Symbol("_children");
  50172. const _cloneAttribute = Symbol();
  50173. const _dataValue = Symbol();
  50174. const _defaultValue = Symbol();
  50175. const _filteredChildrenGenerator = Symbol();
  50176. const _getPrototype = Symbol();
  50177. const _getUnsetAttributes = Symbol();
  50178. const _hasChildren = Symbol();
  50179. const _max = Symbol();
  50180. const _options = Symbol();
  50181. const _parent = Symbol("parent");
  50182. const _resolvePrototypesHelper = Symbol();
  50183. const _setAttributes = Symbol();
  50184. const _validator = Symbol();
  50185. let uid = 0;
  50186. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  50187. class XFAObject {
  50188. constructor(nsId, name, hasChildren = false) {
  50189. this[$namespaceId] = nsId;
  50190. this[$nodeName] = name;
  50191. this[_hasChildren] = hasChildren;
  50192. this[_parent] = null;
  50193. this[_children] = [];
  50194. this[$uid] = `${name}${uid++}`;
  50195. this[$globalData] = null;
  50196. }
  50197. [$onChild](child) {
  50198. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  50199. return false;
  50200. }
  50201. const name = child[$nodeName];
  50202. const node = this[name];
  50203. if (node instanceof XFAObjectArray) {
  50204. if (node.push(child)) {
  50205. this[$appendChild](child);
  50206. return true;
  50207. }
  50208. } else {
  50209. if (node !== null) {
  50210. this[$removeChild](node);
  50211. }
  50212. this[name] = child;
  50213. this[$appendChild](child);
  50214. return true;
  50215. }
  50216. let id = "";
  50217. if (this.id) {
  50218. id = ` (id: ${this.id})`;
  50219. } else if (this.name) {
  50220. id = ` (name: ${this.name} ${this.h.value})`;
  50221. }
  50222. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  50223. return false;
  50224. }
  50225. [$onChildCheck](child) {
  50226. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  50227. }
  50228. [$isNsAgnostic]() {
  50229. return false;
  50230. }
  50231. [$acceptWhitespace]() {
  50232. return false;
  50233. }
  50234. [$isCDATAXml]() {
  50235. return false;
  50236. }
  50237. [$isBindable]() {
  50238. return false;
  50239. }
  50240. [$popPara]() {
  50241. if (this.para) {
  50242. this[$getTemplateRoot]()[$extra].paraStack.pop();
  50243. }
  50244. }
  50245. [$pushPara]() {
  50246. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  50247. }
  50248. [$setId](ids) {
  50249. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  50250. ids.set(this.id, this);
  50251. }
  50252. }
  50253. [$getTemplateRoot]() {
  50254. return this[$globalData].template;
  50255. }
  50256. [$isSplittable]() {
  50257. return false;
  50258. }
  50259. [$isThereMoreWidth]() {
  50260. return false;
  50261. }
  50262. [$appendChild](child) {
  50263. child[_parent] = this;
  50264. this[_children].push(child);
  50265. if (!child[$globalData] && this[$globalData]) {
  50266. child[$globalData] = this[$globalData];
  50267. }
  50268. }
  50269. [$removeChild](child) {
  50270. const i = this[_children].indexOf(child);
  50271. this[_children].splice(i, 1);
  50272. }
  50273. [$hasSettableValue]() {
  50274. return this.hasOwnProperty("value");
  50275. }
  50276. [$setValue](_) {}
  50277. [$onText](_) {}
  50278. [$finalize]() {}
  50279. [$clean](builder) {
  50280. delete this[_hasChildren];
  50281. if (this[$cleanup]) {
  50282. builder.clean(this[$cleanup]);
  50283. delete this[$cleanup];
  50284. }
  50285. }
  50286. [$indexOf](child) {
  50287. return this[_children].indexOf(child);
  50288. }
  50289. [$insertAt](i, child) {
  50290. child[_parent] = this;
  50291. this[_children].splice(i, 0, child);
  50292. if (!child[$globalData] && this[$globalData]) {
  50293. child[$globalData] = this[$globalData];
  50294. }
  50295. }
  50296. [$isTransparent]() {
  50297. return !this.name;
  50298. }
  50299. [$lastAttribute]() {
  50300. return "";
  50301. }
  50302. [$text]() {
  50303. if (this[_children].length === 0) {
  50304. return this[$content];
  50305. }
  50306. return this[_children].map(c => c[$text]()).join("");
  50307. }
  50308. get [_attributeNames]() {
  50309. const proto = Object.getPrototypeOf(this);
  50310. if (!proto._attributes) {
  50311. const attributes = proto._attributes = new Set();
  50312. for (const name of Object.getOwnPropertyNames(this)) {
  50313. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  50314. break;
  50315. }
  50316. attributes.add(name);
  50317. }
  50318. }
  50319. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  50320. }
  50321. [$isDescendent](parent) {
  50322. let node = this;
  50323. while (node) {
  50324. if (node === parent) {
  50325. return true;
  50326. }
  50327. node = node[$getParent]();
  50328. }
  50329. return false;
  50330. }
  50331. [$getParent]() {
  50332. return this[_parent];
  50333. }
  50334. [$getSubformParent]() {
  50335. return this[$getParent]();
  50336. }
  50337. [$getChildren](name = null) {
  50338. if (!name) {
  50339. return this[_children];
  50340. }
  50341. return this[name];
  50342. }
  50343. [$dump]() {
  50344. const dumped = Object.create(null);
  50345. if (this[$content]) {
  50346. dumped.$content = this[$content];
  50347. }
  50348. for (const name of Object.getOwnPropertyNames(this)) {
  50349. const value = this[name];
  50350. if (value === null) {
  50351. continue;
  50352. }
  50353. if (value instanceof XFAObject) {
  50354. dumped[name] = value[$dump]();
  50355. } else if (value instanceof XFAObjectArray) {
  50356. if (!value.isEmpty()) {
  50357. dumped[name] = value.dump();
  50358. }
  50359. } else {
  50360. dumped[name] = value;
  50361. }
  50362. }
  50363. return dumped;
  50364. }
  50365. [$toStyle]() {
  50366. return null;
  50367. }
  50368. [$toHTML]() {
  50369. return _utils.HTMLResult.EMPTY;
  50370. }
  50371. *[$getContainedChildren]() {
  50372. for (const node of this[$getChildren]()) {
  50373. yield node;
  50374. }
  50375. }
  50376. *[_filteredChildrenGenerator](filter, include) {
  50377. for (const node of this[$getContainedChildren]()) {
  50378. if (!filter || include === filter.has(node[$nodeName])) {
  50379. const availableSpace = this[$getAvailableSpace]();
  50380. const res = node[$toHTML](availableSpace);
  50381. if (!res.success) {
  50382. this[$extra].failingNode = node;
  50383. }
  50384. yield res;
  50385. }
  50386. }
  50387. }
  50388. [$flushHTML]() {
  50389. return null;
  50390. }
  50391. [$addHTML](html, bbox) {
  50392. this[$extra].children.push(html);
  50393. }
  50394. [$getAvailableSpace]() {}
  50395. [$childrenToHTML]({
  50396. filter = null,
  50397. include = true
  50398. }) {
  50399. if (!this[$extra].generator) {
  50400. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  50401. } else {
  50402. const availableSpace = this[$getAvailableSpace]();
  50403. const res = this[$extra].failingNode[$toHTML](availableSpace);
  50404. if (!res.success) {
  50405. return res;
  50406. }
  50407. if (res.html) {
  50408. this[$addHTML](res.html, res.bbox);
  50409. }
  50410. delete this[$extra].failingNode;
  50411. }
  50412. while (true) {
  50413. const gen = this[$extra].generator.next();
  50414. if (gen.done) {
  50415. break;
  50416. }
  50417. const res = gen.value;
  50418. if (!res.success) {
  50419. return res;
  50420. }
  50421. if (res.html) {
  50422. this[$addHTML](res.html, res.bbox);
  50423. }
  50424. }
  50425. this[$extra].generator = null;
  50426. return _utils.HTMLResult.EMPTY;
  50427. }
  50428. [$setSetAttributes](attributes) {
  50429. this[_setAttributes] = new Set(Object.keys(attributes));
  50430. }
  50431. [_getUnsetAttributes](protoAttributes) {
  50432. const allAttr = this[_attributeNames];
  50433. const setAttr = this[_setAttributes];
  50434. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  50435. }
  50436. [$resolvePrototypes](ids, ancestors = new Set()) {
  50437. for (const child of this[_children]) {
  50438. child[_resolvePrototypesHelper](ids, ancestors);
  50439. }
  50440. }
  50441. [_resolvePrototypesHelper](ids, ancestors) {
  50442. const proto = this[_getPrototype](ids, ancestors);
  50443. if (proto) {
  50444. this[_applyPrototype](proto, ids, ancestors);
  50445. } else {
  50446. this[$resolvePrototypes](ids, ancestors);
  50447. }
  50448. }
  50449. [_getPrototype](ids, ancestors) {
  50450. const {
  50451. use,
  50452. usehref
  50453. } = this;
  50454. if (!use && !usehref) {
  50455. return null;
  50456. }
  50457. let proto = null;
  50458. let somExpression = null;
  50459. let id = null;
  50460. let ref = use;
  50461. if (usehref) {
  50462. ref = usehref;
  50463. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  50464. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  50465. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  50466. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  50467. } else if (usehref.startsWith("#")) {
  50468. id = usehref.slice(1);
  50469. } else if (usehref.startsWith(".#")) {
  50470. id = usehref.slice(2);
  50471. }
  50472. } else if (use.startsWith("#")) {
  50473. id = use.slice(1);
  50474. } else {
  50475. somExpression = use;
  50476. }
  50477. this.use = this.usehref = "";
  50478. if (id) {
  50479. proto = ids.get(id);
  50480. } else {
  50481. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  50482. if (proto) {
  50483. proto = proto[0];
  50484. }
  50485. }
  50486. if (!proto) {
  50487. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  50488. return null;
  50489. }
  50490. if (proto[$nodeName] !== this[$nodeName]) {
  50491. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  50492. return null;
  50493. }
  50494. if (ancestors.has(proto)) {
  50495. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50496. return null;
  50497. }
  50498. ancestors.add(proto);
  50499. const protoProto = proto[_getPrototype](ids, ancestors);
  50500. if (protoProto) {
  50501. proto[_applyPrototype](protoProto, ids, ancestors);
  50502. }
  50503. proto[$resolvePrototypes](ids, ancestors);
  50504. ancestors.delete(proto);
  50505. return proto;
  50506. }
  50507. [_applyPrototype](proto, ids, ancestors) {
  50508. if (ancestors.has(proto)) {
  50509. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50510. return;
  50511. }
  50512. if (!this[$content] && proto[$content]) {
  50513. this[$content] = proto[$content];
  50514. }
  50515. const newAncestors = new Set(ancestors);
  50516. newAncestors.add(proto);
  50517. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  50518. this[unsetAttrName] = proto[unsetAttrName];
  50519. if (this[_setAttributes]) {
  50520. this[_setAttributes].add(unsetAttrName);
  50521. }
  50522. }
  50523. for (const name of Object.getOwnPropertyNames(this)) {
  50524. if (this[_attributeNames].has(name)) {
  50525. continue;
  50526. }
  50527. const value = this[name];
  50528. const protoValue = proto[name];
  50529. if (value instanceof XFAObjectArray) {
  50530. for (const child of value[_children]) {
  50531. child[_resolvePrototypesHelper](ids, ancestors);
  50532. }
  50533. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  50534. const child = proto[_children][i][$clone]();
  50535. if (value.push(child)) {
  50536. child[_parent] = this;
  50537. this[_children].push(child);
  50538. child[_resolvePrototypesHelper](ids, ancestors);
  50539. } else {
  50540. break;
  50541. }
  50542. }
  50543. continue;
  50544. }
  50545. if (value !== null) {
  50546. value[$resolvePrototypes](ids, ancestors);
  50547. if (protoValue) {
  50548. value[_applyPrototype](protoValue, ids, ancestors);
  50549. }
  50550. continue;
  50551. }
  50552. if (protoValue !== null) {
  50553. const child = protoValue[$clone]();
  50554. child[_parent] = this;
  50555. this[name] = child;
  50556. this[_children].push(child);
  50557. child[_resolvePrototypesHelper](ids, ancestors);
  50558. }
  50559. }
  50560. }
  50561. static [_cloneAttribute](obj) {
  50562. if (Array.isArray(obj)) {
  50563. return obj.map(x => XFAObject[_cloneAttribute](x));
  50564. }
  50565. if (typeof obj === "object" && obj !== null) {
  50566. return Object.assign({}, obj);
  50567. }
  50568. return obj;
  50569. }
  50570. [$clone]() {
  50571. const clone = Object.create(Object.getPrototypeOf(this));
  50572. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  50573. try {
  50574. clone[$symbol] = this[$symbol];
  50575. } catch (_) {
  50576. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  50577. }
  50578. }
  50579. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  50580. clone[_children] = [];
  50581. for (const name of Object.getOwnPropertyNames(this)) {
  50582. if (this[_attributeNames].has(name)) {
  50583. clone[name] = XFAObject[_cloneAttribute](this[name]);
  50584. continue;
  50585. }
  50586. const value = this[name];
  50587. if (value instanceof XFAObjectArray) {
  50588. clone[name] = new XFAObjectArray(value[_max]);
  50589. } else {
  50590. clone[name] = null;
  50591. }
  50592. }
  50593. for (const child of this[_children]) {
  50594. const name = child[$nodeName];
  50595. const clonedChild = child[$clone]();
  50596. clone[_children].push(clonedChild);
  50597. clonedChild[_parent] = clone;
  50598. if (clone[name] === null) {
  50599. clone[name] = clonedChild;
  50600. } else {
  50601. clone[name][_children].push(clonedChild);
  50602. }
  50603. }
  50604. return clone;
  50605. }
  50606. [$getChildren](name = null) {
  50607. if (!name) {
  50608. return this[_children];
  50609. }
  50610. return this[_children].filter(c => c[$nodeName] === name);
  50611. }
  50612. [$getChildrenByClass](name) {
  50613. return this[name];
  50614. }
  50615. [$getChildrenByName](name, allTransparent, first = true) {
  50616. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  50617. }
  50618. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  50619. if (name === "parent") {
  50620. yield this[_parent];
  50621. return;
  50622. }
  50623. for (const child of this[_children]) {
  50624. if (child[$nodeName] === name) {
  50625. yield child;
  50626. }
  50627. if (child.name === name) {
  50628. yield child;
  50629. }
  50630. if (allTransparent || child[$isTransparent]()) {
  50631. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  50632. }
  50633. }
  50634. if (first && this[_attributeNames].has(name)) {
  50635. yield new XFAAttribute(this, name, this[name]);
  50636. }
  50637. }
  50638. }
  50639. exports.XFAObject = XFAObject;
  50640. class XFAObjectArray {
  50641. constructor(max = Infinity) {
  50642. this[_max] = max;
  50643. this[_children] = [];
  50644. }
  50645. push(child) {
  50646. const len = this[_children].length;
  50647. if (len <= this[_max]) {
  50648. this[_children].push(child);
  50649. return true;
  50650. }
  50651. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  50652. return false;
  50653. }
  50654. isEmpty() {
  50655. return this[_children].length === 0;
  50656. }
  50657. dump() {
  50658. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  50659. }
  50660. [$clone]() {
  50661. const clone = new XFAObjectArray(this[_max]);
  50662. clone[_children] = this[_children].map(c => c[$clone]());
  50663. return clone;
  50664. }
  50665. get children() {
  50666. return this[_children];
  50667. }
  50668. clear() {
  50669. this[_children].length = 0;
  50670. }
  50671. }
  50672. exports.XFAObjectArray = XFAObjectArray;
  50673. class XFAAttribute {
  50674. constructor(node, name, value) {
  50675. this[_parent] = node;
  50676. this[$nodeName] = name;
  50677. this[$content] = value;
  50678. this[$consumed] = false;
  50679. this[$uid] = `attribute${uid++}`;
  50680. }
  50681. [$getParent]() {
  50682. return this[_parent];
  50683. }
  50684. [$isDataValue]() {
  50685. return true;
  50686. }
  50687. [$getDataValue]() {
  50688. return this[$content].trim();
  50689. }
  50690. [$setValue](value) {
  50691. value = value.value || "";
  50692. this[$content] = value.toString();
  50693. }
  50694. [$text]() {
  50695. return this[$content];
  50696. }
  50697. [$isDescendent](parent) {
  50698. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  50699. }
  50700. }
  50701. exports.XFAAttribute = XFAAttribute;
  50702. class XmlObject extends XFAObject {
  50703. constructor(nsId, name, attributes = {}) {
  50704. super(nsId, name);
  50705. this[$content] = "";
  50706. this[_dataValue] = null;
  50707. if (name !== "#text") {
  50708. const map = new Map();
  50709. this[_attributes] = map;
  50710. for (const [attrName, value] of Object.entries(attributes)) {
  50711. map.set(attrName, new XFAAttribute(this, attrName, value));
  50712. }
  50713. if (attributes.hasOwnProperty($nsAttributes)) {
  50714. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  50715. if (dataNode !== undefined) {
  50716. if (dataNode === "dataGroup") {
  50717. this[_dataValue] = false;
  50718. } else if (dataNode === "dataValue") {
  50719. this[_dataValue] = true;
  50720. }
  50721. }
  50722. }
  50723. }
  50724. this[$consumed] = false;
  50725. }
  50726. [$toString](buf) {
  50727. const tagName = this[$nodeName];
  50728. if (tagName === "#text") {
  50729. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50730. return;
  50731. }
  50732. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  50733. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  50734. buf.push(`<${prefix}${utf8TagName}`);
  50735. for (const [name, value] of this[_attributes].entries()) {
  50736. const utf8Name = (0, _util.utf8StringToString)(name);
  50737. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  50738. }
  50739. if (this[_dataValue] !== null) {
  50740. if (this[_dataValue]) {
  50741. buf.push(` xfa:dataNode="dataValue"`);
  50742. } else {
  50743. buf.push(` xfa:dataNode="dataGroup"`);
  50744. }
  50745. }
  50746. if (!this[$content] && this[_children].length === 0) {
  50747. buf.push("/>");
  50748. return;
  50749. }
  50750. buf.push(">");
  50751. if (this[$content]) {
  50752. if (typeof this[$content] === "string") {
  50753. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50754. } else {
  50755. this[$content][$toString](buf);
  50756. }
  50757. } else {
  50758. for (const child of this[_children]) {
  50759. child[$toString](buf);
  50760. }
  50761. }
  50762. buf.push(`</${prefix}${utf8TagName}>`);
  50763. }
  50764. [$onChild](child) {
  50765. if (this[$content]) {
  50766. const node = new XmlObject(this[$namespaceId], "#text");
  50767. this[$appendChild](node);
  50768. node[$content] = this[$content];
  50769. this[$content] = "";
  50770. }
  50771. this[$appendChild](child);
  50772. return true;
  50773. }
  50774. [$onText](str) {
  50775. this[$content] += str;
  50776. }
  50777. [$finalize]() {
  50778. if (this[$content] && this[_children].length > 0) {
  50779. const node = new XmlObject(this[$namespaceId], "#text");
  50780. this[$appendChild](node);
  50781. node[$content] = this[$content];
  50782. delete this[$content];
  50783. }
  50784. }
  50785. [$toHTML]() {
  50786. if (this[$nodeName] === "#text") {
  50787. return _utils.HTMLResult.success({
  50788. name: "#text",
  50789. value: this[$content]
  50790. });
  50791. }
  50792. return _utils.HTMLResult.EMPTY;
  50793. }
  50794. [$getChildren](name = null) {
  50795. if (!name) {
  50796. return this[_children];
  50797. }
  50798. return this[_children].filter(c => c[$nodeName] === name);
  50799. }
  50800. [$getAttributes]() {
  50801. return this[_attributes];
  50802. }
  50803. [$getChildrenByClass](name) {
  50804. const value = this[_attributes].get(name);
  50805. if (value !== undefined) {
  50806. return value;
  50807. }
  50808. return this[$getChildren](name);
  50809. }
  50810. *[$getChildrenByNameIt](name, allTransparent) {
  50811. const value = this[_attributes].get(name);
  50812. if (value) {
  50813. yield value;
  50814. }
  50815. for (const child of this[_children]) {
  50816. if (child[$nodeName] === name) {
  50817. yield child;
  50818. }
  50819. if (allTransparent) {
  50820. yield* child[$getChildrenByNameIt](name, allTransparent);
  50821. }
  50822. }
  50823. }
  50824. *[$getAttributeIt](name, skipConsumed) {
  50825. const value = this[_attributes].get(name);
  50826. if (value && (!skipConsumed || !value[$consumed])) {
  50827. yield value;
  50828. }
  50829. for (const child of this[_children]) {
  50830. yield* child[$getAttributeIt](name, skipConsumed);
  50831. }
  50832. }
  50833. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  50834. for (const child of this[_children]) {
  50835. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  50836. yield child;
  50837. }
  50838. if (allTransparent) {
  50839. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  50840. }
  50841. }
  50842. }
  50843. [$isDataValue]() {
  50844. if (this[_dataValue] === null) {
  50845. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  50846. }
  50847. return this[_dataValue];
  50848. }
  50849. [$getDataValue]() {
  50850. if (this[_dataValue] === null) {
  50851. if (this[_children].length === 0) {
  50852. return this[$content].trim();
  50853. }
  50854. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  50855. return this[_children][0][$text]().trim();
  50856. }
  50857. return null;
  50858. }
  50859. return this[$content].trim();
  50860. }
  50861. [$setValue](value) {
  50862. value = value.value || "";
  50863. this[$content] = value.toString();
  50864. }
  50865. [$dump](hasNS = false) {
  50866. const dumped = Object.create(null);
  50867. if (hasNS) {
  50868. dumped.$ns = this[$namespaceId];
  50869. }
  50870. if (this[$content]) {
  50871. dumped.$content = this[$content];
  50872. }
  50873. dumped.$name = this[$nodeName];
  50874. dumped.children = [];
  50875. for (const child of this[_children]) {
  50876. dumped.children.push(child[$dump](hasNS));
  50877. }
  50878. dumped.attributes = Object.create(null);
  50879. for (const [name, value] of this[_attributes]) {
  50880. dumped.attributes[name] = value[$content];
  50881. }
  50882. return dumped;
  50883. }
  50884. }
  50885. exports.XmlObject = XmlObject;
  50886. class ContentObject extends XFAObject {
  50887. constructor(nsId, name) {
  50888. super(nsId, name);
  50889. this[$content] = "";
  50890. }
  50891. [$onText](text) {
  50892. this[$content] += text;
  50893. }
  50894. [$finalize]() {}
  50895. }
  50896. exports.ContentObject = ContentObject;
  50897. class OptionObject extends ContentObject {
  50898. constructor(nsId, name, options) {
  50899. super(nsId, name);
  50900. this[_options] = options;
  50901. }
  50902. [$finalize]() {
  50903. this[$content] = (0, _utils.getKeyword)({
  50904. data: this[$content],
  50905. defaultValue: this[_options][0],
  50906. validate: k => this[_options].includes(k)
  50907. });
  50908. }
  50909. [$clean](builder) {
  50910. super[$clean](builder);
  50911. delete this[_options];
  50912. }
  50913. }
  50914. exports.OptionObject = OptionObject;
  50915. class StringObject extends ContentObject {
  50916. [$finalize]() {
  50917. this[$content] = this[$content].trim();
  50918. }
  50919. }
  50920. exports.StringObject = StringObject;
  50921. class IntegerObject extends ContentObject {
  50922. constructor(nsId, name, defaultValue, validator) {
  50923. super(nsId, name);
  50924. this[_defaultValue] = defaultValue;
  50925. this[_validator] = validator;
  50926. }
  50927. [$finalize]() {
  50928. this[$content] = (0, _utils.getInteger)({
  50929. data: this[$content],
  50930. defaultValue: this[_defaultValue],
  50931. validate: this[_validator]
  50932. });
  50933. }
  50934. [$clean](builder) {
  50935. super[$clean](builder);
  50936. delete this[_defaultValue];
  50937. delete this[_validator];
  50938. }
  50939. }
  50940. exports.IntegerObject = IntegerObject;
  50941. class Option01 extends IntegerObject {
  50942. constructor(nsId, name) {
  50943. super(nsId, name, 0, n => n === 1);
  50944. }
  50945. }
  50946. exports.Option01 = Option01;
  50947. class Option10 extends IntegerObject {
  50948. constructor(nsId, name) {
  50949. super(nsId, name, 1, n => n === 0);
  50950. }
  50951. }
  50952. exports.Option10 = Option10;
  50953. /***/ }),
  50954. /* 76 */
  50955. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50956. Object.defineProperty(exports, "__esModule", ({
  50957. value: true
  50958. }));
  50959. exports.HTMLResult = void 0;
  50960. exports.getBBox = getBBox;
  50961. exports.getColor = getColor;
  50962. exports.getFloat = getFloat;
  50963. exports.getInteger = getInteger;
  50964. exports.getKeyword = getKeyword;
  50965. exports.getMeasurement = getMeasurement;
  50966. exports.getRatio = getRatio;
  50967. exports.getRelevant = getRelevant;
  50968. exports.getStringOption = getStringOption;
  50969. exports.stripQuotes = stripQuotes;
  50970. var _util = __w_pdfjs_require__(2);
  50971. const dimConverters = {
  50972. pt: x => x,
  50973. cm: x => x / 2.54 * 72,
  50974. mm: x => x / (10 * 2.54) * 72,
  50975. in: x => x * 72,
  50976. px: x => x
  50977. };
  50978. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  50979. function stripQuotes(str) {
  50980. if (str.startsWith("'") || str.startsWith('"')) {
  50981. return str.slice(1, str.length - 1);
  50982. }
  50983. return str;
  50984. }
  50985. function getInteger({
  50986. data,
  50987. defaultValue,
  50988. validate
  50989. }) {
  50990. if (!data) {
  50991. return defaultValue;
  50992. }
  50993. data = data.trim();
  50994. const n = parseInt(data, 10);
  50995. if (!isNaN(n) && validate(n)) {
  50996. return n;
  50997. }
  50998. return defaultValue;
  50999. }
  51000. function getFloat({
  51001. data,
  51002. defaultValue,
  51003. validate
  51004. }) {
  51005. if (!data) {
  51006. return defaultValue;
  51007. }
  51008. data = data.trim();
  51009. const n = parseFloat(data);
  51010. if (!isNaN(n) && validate(n)) {
  51011. return n;
  51012. }
  51013. return defaultValue;
  51014. }
  51015. function getKeyword({
  51016. data,
  51017. defaultValue,
  51018. validate
  51019. }) {
  51020. if (!data) {
  51021. return defaultValue;
  51022. }
  51023. data = data.trim();
  51024. if (validate(data)) {
  51025. return data;
  51026. }
  51027. return defaultValue;
  51028. }
  51029. function getStringOption(data, options) {
  51030. return getKeyword({
  51031. data,
  51032. defaultValue: options[0],
  51033. validate: k => options.includes(k)
  51034. });
  51035. }
  51036. function getMeasurement(str, def = "0") {
  51037. def = def || "0";
  51038. if (!str) {
  51039. return getMeasurement(def);
  51040. }
  51041. const match = str.trim().match(measurementPattern);
  51042. if (!match) {
  51043. return getMeasurement(def);
  51044. }
  51045. const [, valueStr, unit] = match;
  51046. const value = parseFloat(valueStr);
  51047. if (isNaN(value)) {
  51048. return getMeasurement(def);
  51049. }
  51050. if (value === 0) {
  51051. return 0;
  51052. }
  51053. const conv = dimConverters[unit];
  51054. if (conv) {
  51055. return conv(value);
  51056. }
  51057. return value;
  51058. }
  51059. function getRatio(data) {
  51060. if (!data) {
  51061. return {
  51062. num: 1,
  51063. den: 1
  51064. };
  51065. }
  51066. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  51067. if (ratio.length === 1) {
  51068. ratio.push(1);
  51069. }
  51070. if (ratio.length === 0) {
  51071. return {
  51072. num: 1,
  51073. den: 1
  51074. };
  51075. }
  51076. const [num, den] = ratio;
  51077. return {
  51078. num,
  51079. den
  51080. };
  51081. }
  51082. function getRelevant(data) {
  51083. if (!data) {
  51084. return [];
  51085. }
  51086. return data.trim().split(/\s+/).map(e => {
  51087. return {
  51088. excluded: e[0] === "-",
  51089. viewname: e.substring(1)
  51090. };
  51091. });
  51092. }
  51093. function getColor(data, def = [0, 0, 0]) {
  51094. let [r, g, b] = def;
  51095. if (!data) {
  51096. return {
  51097. r,
  51098. g,
  51099. b
  51100. };
  51101. }
  51102. 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);
  51103. if (color.length < 3) {
  51104. return {
  51105. r,
  51106. g,
  51107. b
  51108. };
  51109. }
  51110. [r, g, b] = color;
  51111. return {
  51112. r,
  51113. g,
  51114. b
  51115. };
  51116. }
  51117. function getBBox(data) {
  51118. const def = -1;
  51119. if (!data) {
  51120. return {
  51121. x: def,
  51122. y: def,
  51123. width: def,
  51124. height: def
  51125. };
  51126. }
  51127. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  51128. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  51129. return {
  51130. x: def,
  51131. y: def,
  51132. width: def,
  51133. height: def
  51134. };
  51135. }
  51136. const [x, y, width, height] = bbox;
  51137. return {
  51138. x,
  51139. y,
  51140. width,
  51141. height
  51142. };
  51143. }
  51144. class HTMLResult {
  51145. static get FAILURE() {
  51146. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  51147. }
  51148. static get EMPTY() {
  51149. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  51150. }
  51151. constructor(success, html, bbox, breakNode) {
  51152. this.success = success;
  51153. this.html = html;
  51154. this.bbox = bbox;
  51155. this.breakNode = breakNode;
  51156. }
  51157. isBreak() {
  51158. return !!this.breakNode;
  51159. }
  51160. static breakNode(node) {
  51161. return new HTMLResult(false, null, null, node);
  51162. }
  51163. static success(html, bbox = null) {
  51164. return new HTMLResult(true, html, bbox, null);
  51165. }
  51166. }
  51167. exports.HTMLResult = HTMLResult;
  51168. /***/ }),
  51169. /* 77 */
  51170. /***/ ((__unused_webpack_module, exports) => {
  51171. Object.defineProperty(exports, "__esModule", ({
  51172. value: true
  51173. }));
  51174. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  51175. const $buildXFAObject = Symbol();
  51176. exports.$buildXFAObject = $buildXFAObject;
  51177. const NamespaceIds = {
  51178. config: {
  51179. id: 0,
  51180. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  51181. },
  51182. connectionSet: {
  51183. id: 1,
  51184. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  51185. },
  51186. datasets: {
  51187. id: 2,
  51188. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  51189. },
  51190. form: {
  51191. id: 3,
  51192. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  51193. },
  51194. localeSet: {
  51195. id: 4,
  51196. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  51197. },
  51198. pdf: {
  51199. id: 5,
  51200. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  51201. },
  51202. signature: {
  51203. id: 6,
  51204. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  51205. },
  51206. sourceSet: {
  51207. id: 7,
  51208. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  51209. },
  51210. stylesheet: {
  51211. id: 8,
  51212. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  51213. },
  51214. template: {
  51215. id: 9,
  51216. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  51217. },
  51218. xdc: {
  51219. id: 10,
  51220. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  51221. },
  51222. xdp: {
  51223. id: 11,
  51224. check: ns => ns === "http://ns.adobe.com/xdp/"
  51225. },
  51226. xfdf: {
  51227. id: 12,
  51228. check: ns => ns === "http://ns.adobe.com/xfdf/"
  51229. },
  51230. xhtml: {
  51231. id: 13,
  51232. check: ns => ns === "http://www.w3.org/1999/xhtml"
  51233. },
  51234. xmpmeta: {
  51235. id: 14,
  51236. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  51237. }
  51238. };
  51239. exports.NamespaceIds = NamespaceIds;
  51240. /***/ }),
  51241. /* 78 */
  51242. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51243. Object.defineProperty(exports, "__esModule", ({
  51244. value: true
  51245. }));
  51246. exports.createDataNode = createDataNode;
  51247. exports.searchNode = searchNode;
  51248. var _xfa_object = __w_pdfjs_require__(75);
  51249. var _namespaces = __w_pdfjs_require__(77);
  51250. var _util = __w_pdfjs_require__(2);
  51251. const namePattern = /^[^.[]+/;
  51252. const indexPattern = /^[^\]]+/;
  51253. const operators = {
  51254. dot: 0,
  51255. dotDot: 1,
  51256. dotHash: 2,
  51257. dotBracket: 3,
  51258. dotParen: 4
  51259. };
  51260. 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]]);
  51261. const somCache = new WeakMap();
  51262. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51263. function parseIndex(index) {
  51264. index = index.trim();
  51265. if (index === "*") {
  51266. return Infinity;
  51267. }
  51268. return parseInt(index, 10) || 0;
  51269. }
  51270. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  51271. let match = expr.match(namePattern);
  51272. if (!match) {
  51273. return null;
  51274. }
  51275. let [name] = match;
  51276. const parsed = [{
  51277. name,
  51278. cacheName: "." + name,
  51279. index: 0,
  51280. js: null,
  51281. formCalc: null,
  51282. operator: operators.dot
  51283. }];
  51284. let pos = name.length;
  51285. while (pos < expr.length) {
  51286. const spos = pos;
  51287. const char = expr.charAt(pos++);
  51288. if (char === "[") {
  51289. match = expr.slice(pos).match(indexPattern);
  51290. if (!match) {
  51291. (0, _util.warn)("XFA - Invalid index in SOM expression");
  51292. return null;
  51293. }
  51294. parsed[parsed.length - 1].index = parseIndex(match[0]);
  51295. pos += match[0].length + 1;
  51296. continue;
  51297. }
  51298. let operator;
  51299. switch (expr.charAt(pos)) {
  51300. case ".":
  51301. if (!dotDotAllowed) {
  51302. return null;
  51303. }
  51304. pos++;
  51305. operator = operators.dotDot;
  51306. break;
  51307. case "#":
  51308. pos++;
  51309. operator = operators.dotHash;
  51310. break;
  51311. case "[":
  51312. if (noExpr) {
  51313. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  51314. return null;
  51315. }
  51316. operator = operators.dotBracket;
  51317. break;
  51318. case "(":
  51319. if (noExpr) {
  51320. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  51321. return null;
  51322. }
  51323. operator = operators.dotParen;
  51324. break;
  51325. default:
  51326. operator = operators.dot;
  51327. break;
  51328. }
  51329. match = expr.slice(pos).match(namePattern);
  51330. if (!match) {
  51331. break;
  51332. }
  51333. [name] = match;
  51334. pos += name.length;
  51335. parsed.push({
  51336. name,
  51337. cacheName: expr.slice(spos, pos),
  51338. operator,
  51339. index: 0,
  51340. js: null,
  51341. formCalc: null
  51342. });
  51343. }
  51344. return parsed;
  51345. }
  51346. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  51347. const parsed = parseExpression(expr, dotDotAllowed);
  51348. if (!parsed) {
  51349. return null;
  51350. }
  51351. const fn = shortcuts.get(parsed[0].name);
  51352. let i = 0;
  51353. let isQualified;
  51354. if (fn) {
  51355. isQualified = true;
  51356. root = [fn(root, container)];
  51357. i = 1;
  51358. } else {
  51359. isQualified = container === null;
  51360. root = [container || root];
  51361. }
  51362. for (let ii = parsed.length; i < ii; i++) {
  51363. const {
  51364. name,
  51365. cacheName,
  51366. operator,
  51367. index
  51368. } = parsed[i];
  51369. const nodes = [];
  51370. for (const node of root) {
  51371. if (!(node instanceof _xfa_object.XFAObject)) {
  51372. continue;
  51373. }
  51374. let children, cached;
  51375. if (useCache) {
  51376. cached = somCache.get(node);
  51377. if (!cached) {
  51378. cached = new Map();
  51379. somCache.set(node, cached);
  51380. }
  51381. children = cached.get(cacheName);
  51382. }
  51383. if (!children) {
  51384. switch (operator) {
  51385. case operators.dot:
  51386. children = node[_xfa_object.$getChildrenByName](name, false);
  51387. break;
  51388. case operators.dotDot:
  51389. children = node[_xfa_object.$getChildrenByName](name, true);
  51390. break;
  51391. case operators.dotHash:
  51392. children = node[_xfa_object.$getChildrenByClass](name);
  51393. if (children instanceof _xfa_object.XFAObjectArray) {
  51394. children = children.children;
  51395. } else {
  51396. children = [children];
  51397. }
  51398. break;
  51399. default:
  51400. break;
  51401. }
  51402. if (useCache) {
  51403. cached.set(cacheName, children);
  51404. }
  51405. }
  51406. if (children.length > 0) {
  51407. nodes.push(children);
  51408. }
  51409. }
  51410. if (nodes.length === 0 && !isQualified && i === 0) {
  51411. const parent = container[_xfa_object.$getParent]();
  51412. container = parent;
  51413. if (!container) {
  51414. return null;
  51415. }
  51416. i = -1;
  51417. root = [container];
  51418. continue;
  51419. }
  51420. if (isFinite(index)) {
  51421. root = nodes.filter(node => index < node.length).map(node => node[index]);
  51422. } else {
  51423. root = nodes.reduce((acc, node) => acc.concat(node), []);
  51424. }
  51425. }
  51426. if (root.length === 0) {
  51427. return null;
  51428. }
  51429. return root;
  51430. }
  51431. function createNodes(root, path) {
  51432. let node = null;
  51433. for (const {
  51434. name,
  51435. index
  51436. } of path) {
  51437. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  51438. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  51439. node = new _xfa_object.XmlObject(nsId, name);
  51440. root[_xfa_object.$appendChild](node);
  51441. }
  51442. root = node;
  51443. }
  51444. return node;
  51445. }
  51446. function createDataNode(root, container, expr) {
  51447. const parsed = parseExpression(expr);
  51448. if (!parsed) {
  51449. return null;
  51450. }
  51451. if (parsed.some(x => x.operator === operators.dotDot)) {
  51452. return null;
  51453. }
  51454. const fn = shortcuts.get(parsed[0].name);
  51455. let i = 0;
  51456. if (fn) {
  51457. root = fn(root, container);
  51458. i = 1;
  51459. } else {
  51460. root = container || root;
  51461. }
  51462. for (let ii = parsed.length; i < ii; i++) {
  51463. const {
  51464. name,
  51465. operator,
  51466. index
  51467. } = parsed[i];
  51468. if (!isFinite(index)) {
  51469. parsed[i].index = 0;
  51470. return createNodes(root, parsed.slice(i));
  51471. }
  51472. let children;
  51473. switch (operator) {
  51474. case operators.dot:
  51475. children = root[_xfa_object.$getChildrenByName](name, false);
  51476. break;
  51477. case operators.dotDot:
  51478. children = root[_xfa_object.$getChildrenByName](name, true);
  51479. break;
  51480. case operators.dotHash:
  51481. children = root[_xfa_object.$getChildrenByClass](name);
  51482. if (children instanceof _xfa_object.XFAObjectArray) {
  51483. children = children.children;
  51484. } else {
  51485. children = [children];
  51486. }
  51487. break;
  51488. default:
  51489. break;
  51490. }
  51491. if (children.length === 0) {
  51492. return createNodes(root, parsed.slice(i));
  51493. }
  51494. if (index < children.length) {
  51495. const child = children[index];
  51496. if (!(child instanceof _xfa_object.XFAObject)) {
  51497. (0, _util.warn)(`XFA - Cannot create a node.`);
  51498. return null;
  51499. }
  51500. root = child;
  51501. } else {
  51502. parsed[i].index = index - children.length;
  51503. return createNodes(root, parsed.slice(i));
  51504. }
  51505. }
  51506. return null;
  51507. }
  51508. /***/ }),
  51509. /* 79 */
  51510. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51511. Object.defineProperty(exports, "__esModule", ({
  51512. value: true
  51513. }));
  51514. exports.Binder = void 0;
  51515. var _xfa_object = __w_pdfjs_require__(75);
  51516. var _template = __w_pdfjs_require__(80);
  51517. var _som = __w_pdfjs_require__(78);
  51518. var _namespaces = __w_pdfjs_require__(77);
  51519. var _util = __w_pdfjs_require__(2);
  51520. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51521. function createText(content) {
  51522. const node = new _template.Text({});
  51523. node[_xfa_object.$content] = content;
  51524. return node;
  51525. }
  51526. class Binder {
  51527. constructor(root) {
  51528. this.root = root;
  51529. this.datasets = root.datasets;
  51530. if (root.datasets && root.datasets.data) {
  51531. this.data = root.datasets.data;
  51532. } else {
  51533. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  51534. }
  51535. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  51536. this.root.form = this.form = root.template[_xfa_object.$clone]();
  51537. }
  51538. _isConsumeData() {
  51539. return !this.emptyMerge && this._mergeMode;
  51540. }
  51541. _isMatchTemplate() {
  51542. return !this._isConsumeData();
  51543. }
  51544. bind() {
  51545. this._bindElement(this.form, this.data);
  51546. return this.form;
  51547. }
  51548. getData() {
  51549. return this.data;
  51550. }
  51551. _bindValue(formNode, data, picture) {
  51552. formNode[_xfa_object.$data] = data;
  51553. if (formNode[_xfa_object.$hasSettableValue]()) {
  51554. if (data[_xfa_object.$isDataValue]()) {
  51555. const value = data[_xfa_object.$getDataValue]();
  51556. formNode[_xfa_object.$setValue](createText(value));
  51557. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  51558. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  51559. formNode[_xfa_object.$setValue](createText(value));
  51560. } else if (this._isConsumeData()) {
  51561. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51562. }
  51563. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  51564. this._bindElement(formNode, data);
  51565. } else {
  51566. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51567. }
  51568. }
  51569. _findDataByNameToConsume(name, isValue, dataNode, global) {
  51570. if (!name) {
  51571. return null;
  51572. }
  51573. let generator, match;
  51574. for (let i = 0; i < 3; i++) {
  51575. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  51576. while (true) {
  51577. match = generator.next().value;
  51578. if (!match) {
  51579. break;
  51580. }
  51581. if (isValue === match[_xfa_object.$isDataValue]()) {
  51582. return match;
  51583. }
  51584. }
  51585. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  51586. break;
  51587. }
  51588. dataNode = dataNode[_xfa_object.$getParent]();
  51589. }
  51590. if (!global) {
  51591. return null;
  51592. }
  51593. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  51594. match = generator.next().value;
  51595. if (match) {
  51596. return match;
  51597. }
  51598. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  51599. match = generator.next().value;
  51600. if (match && match[_xfa_object.$isDataValue]()) {
  51601. return match;
  51602. }
  51603. return null;
  51604. }
  51605. _setProperties(formNode, dataNode) {
  51606. if (!formNode.hasOwnProperty("setProperty")) {
  51607. return;
  51608. }
  51609. for (const {
  51610. ref,
  51611. target,
  51612. connection
  51613. } of formNode.setProperty.children) {
  51614. if (connection) {
  51615. continue;
  51616. }
  51617. if (!ref) {
  51618. continue;
  51619. }
  51620. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51621. if (!nodes) {
  51622. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51623. continue;
  51624. }
  51625. const [node] = nodes;
  51626. if (!node[_xfa_object.$isDescendent](this.data)) {
  51627. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  51628. continue;
  51629. }
  51630. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  51631. if (!targetNodes) {
  51632. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  51633. continue;
  51634. }
  51635. const [targetNode] = targetNodes;
  51636. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  51637. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  51638. continue;
  51639. }
  51640. const targetParent = targetNode[_xfa_object.$getParent]();
  51641. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  51642. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  51643. continue;
  51644. }
  51645. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  51646. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  51647. continue;
  51648. }
  51649. const content = node[_xfa_object.$text]();
  51650. const name = targetNode[_xfa_object.$nodeName];
  51651. if (targetNode instanceof _xfa_object.XFAAttribute) {
  51652. const attrs = Object.create(null);
  51653. attrs[name] = content;
  51654. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  51655. targetParent[name] = obj[name];
  51656. continue;
  51657. }
  51658. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  51659. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  51660. continue;
  51661. }
  51662. targetNode[_xfa_object.$data] = node;
  51663. targetNode[_xfa_object.$content] = content;
  51664. targetNode[_xfa_object.$finalize]();
  51665. }
  51666. }
  51667. _bindItems(formNode, dataNode) {
  51668. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  51669. return;
  51670. }
  51671. for (const item of formNode.items.children) {
  51672. formNode[_xfa_object.$removeChild](item);
  51673. }
  51674. formNode.items.clear();
  51675. const labels = new _template.Items({});
  51676. const values = new _template.Items({});
  51677. formNode[_xfa_object.$appendChild](labels);
  51678. formNode.items.push(labels);
  51679. formNode[_xfa_object.$appendChild](values);
  51680. formNode.items.push(values);
  51681. for (const {
  51682. ref,
  51683. labelRef,
  51684. valueRef,
  51685. connection
  51686. } of formNode.bindItems.children) {
  51687. if (connection) {
  51688. continue;
  51689. }
  51690. if (!ref) {
  51691. continue;
  51692. }
  51693. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51694. if (!nodes) {
  51695. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51696. continue;
  51697. }
  51698. for (const node of nodes) {
  51699. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  51700. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  51701. continue;
  51702. }
  51703. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  51704. if (!labelNodes) {
  51705. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  51706. continue;
  51707. }
  51708. const [labelNode] = labelNodes;
  51709. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  51710. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  51711. continue;
  51712. }
  51713. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  51714. if (!valueNodes) {
  51715. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  51716. continue;
  51717. }
  51718. const [valueNode] = valueNodes;
  51719. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  51720. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  51721. continue;
  51722. }
  51723. const label = createText(labelNode[_xfa_object.$text]());
  51724. const value = createText(valueNode[_xfa_object.$text]());
  51725. labels[_xfa_object.$appendChild](label);
  51726. labels.text.push(label);
  51727. values[_xfa_object.$appendChild](value);
  51728. values.text.push(value);
  51729. }
  51730. }
  51731. }
  51732. _bindOccurrences(formNode, matches, picture) {
  51733. let baseClone;
  51734. if (matches.length > 1) {
  51735. baseClone = formNode[_xfa_object.$clone]();
  51736. baseClone[_xfa_object.$removeChild](baseClone.occur);
  51737. baseClone.occur = null;
  51738. }
  51739. this._bindValue(formNode, matches[0], picture);
  51740. this._setProperties(formNode, matches[0]);
  51741. this._bindItems(formNode, matches[0]);
  51742. if (matches.length === 1) {
  51743. return;
  51744. }
  51745. const parent = formNode[_xfa_object.$getParent]();
  51746. const name = formNode[_xfa_object.$nodeName];
  51747. const pos = parent[_xfa_object.$indexOf](formNode);
  51748. for (let i = 1, ii = matches.length; i < ii; i++) {
  51749. const match = matches[i];
  51750. const clone = baseClone[_xfa_object.$clone]();
  51751. parent[name].push(clone);
  51752. parent[_xfa_object.$insertAt](pos + i, clone);
  51753. this._bindValue(clone, match, picture);
  51754. this._setProperties(clone, match);
  51755. this._bindItems(clone, match);
  51756. }
  51757. }
  51758. _createOccurrences(formNode) {
  51759. if (!this.emptyMerge) {
  51760. return;
  51761. }
  51762. const {
  51763. occur
  51764. } = formNode;
  51765. if (!occur || occur.initial <= 1) {
  51766. return;
  51767. }
  51768. const parent = formNode[_xfa_object.$getParent]();
  51769. const name = formNode[_xfa_object.$nodeName];
  51770. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  51771. return;
  51772. }
  51773. let currentNumber;
  51774. if (formNode.name) {
  51775. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  51776. } else {
  51777. currentNumber = parent[name].children.length;
  51778. }
  51779. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  51780. const ii = occur.initial - currentNumber;
  51781. if (ii) {
  51782. const nodeClone = formNode[_xfa_object.$clone]();
  51783. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  51784. nodeClone.occur = null;
  51785. parent[name].push(nodeClone);
  51786. parent[_xfa_object.$insertAt](pos, nodeClone);
  51787. for (let i = 1; i < ii; i++) {
  51788. const clone = nodeClone[_xfa_object.$clone]();
  51789. parent[name].push(clone);
  51790. parent[_xfa_object.$insertAt](pos + i, clone);
  51791. }
  51792. }
  51793. }
  51794. _getOccurInfo(formNode) {
  51795. const {
  51796. name,
  51797. occur
  51798. } = formNode;
  51799. if (!occur || !name) {
  51800. return [1, 1];
  51801. }
  51802. const max = occur.max === -1 ? Infinity : occur.max;
  51803. return [occur.min, max];
  51804. }
  51805. _setAndBind(formNode, dataNode) {
  51806. this._setProperties(formNode, dataNode);
  51807. this._bindItems(formNode, dataNode);
  51808. this._bindElement(formNode, dataNode);
  51809. }
  51810. _bindElement(formNode, dataNode) {
  51811. const uselessNodes = [];
  51812. this._createOccurrences(formNode);
  51813. for (const child of formNode[_xfa_object.$getChildren]()) {
  51814. if (child[_xfa_object.$data]) {
  51815. continue;
  51816. }
  51817. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  51818. this._mergeMode = child.mergeMode === "consumeData";
  51819. const dataChildren = dataNode[_xfa_object.$getChildren]();
  51820. if (dataChildren.length > 0) {
  51821. this._bindOccurrences(child, [dataChildren[0]], null);
  51822. } else if (this.emptyMerge) {
  51823. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  51824. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  51825. dataNode[_xfa_object.$appendChild](dataChild);
  51826. this._bindElement(child, dataChild);
  51827. }
  51828. continue;
  51829. }
  51830. if (!child[_xfa_object.$isBindable]()) {
  51831. continue;
  51832. }
  51833. let global = false;
  51834. let picture = null;
  51835. let ref = null;
  51836. let match = null;
  51837. if (child.bind) {
  51838. switch (child.bind.match) {
  51839. case "none":
  51840. this._setAndBind(child, dataNode);
  51841. continue;
  51842. case "global":
  51843. global = true;
  51844. break;
  51845. case "dataRef":
  51846. if (!child.bind.ref) {
  51847. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  51848. this._setAndBind(child, dataNode);
  51849. continue;
  51850. }
  51851. ref = child.bind.ref;
  51852. break;
  51853. default:
  51854. break;
  51855. }
  51856. if (child.bind.picture) {
  51857. picture = child.bind.picture[_xfa_object.$content];
  51858. }
  51859. }
  51860. const [min, max] = this._getOccurInfo(child);
  51861. if (ref) {
  51862. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  51863. if (match === null) {
  51864. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  51865. if (!match) {
  51866. continue;
  51867. }
  51868. if (this._isConsumeData()) {
  51869. match[_xfa_object.$consumed] = true;
  51870. }
  51871. this._setAndBind(child, match);
  51872. continue;
  51873. } else {
  51874. if (this._isConsumeData()) {
  51875. match = match.filter(node => !node[_xfa_object.$consumed]);
  51876. }
  51877. if (match.length > max) {
  51878. match = match.slice(0, max);
  51879. } else if (match.length === 0) {
  51880. match = null;
  51881. }
  51882. if (match && this._isConsumeData()) {
  51883. match.forEach(node => {
  51884. node[_xfa_object.$consumed] = true;
  51885. });
  51886. }
  51887. }
  51888. } else {
  51889. if (!child.name) {
  51890. this._setAndBind(child, dataNode);
  51891. continue;
  51892. }
  51893. if (this._isConsumeData()) {
  51894. const matches = [];
  51895. while (matches.length < max) {
  51896. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  51897. if (!found) {
  51898. break;
  51899. }
  51900. found[_xfa_object.$consumed] = true;
  51901. matches.push(found);
  51902. }
  51903. match = matches.length > 0 ? matches : null;
  51904. } else {
  51905. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  51906. if (!match) {
  51907. if (min === 0) {
  51908. uselessNodes.push(child);
  51909. continue;
  51910. }
  51911. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  51912. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  51913. if (this.emptyMerge) {
  51914. match[_xfa_object.$consumed] = true;
  51915. }
  51916. dataNode[_xfa_object.$appendChild](match);
  51917. this._setAndBind(child, match);
  51918. continue;
  51919. }
  51920. if (this.emptyMerge) {
  51921. match[_xfa_object.$consumed] = true;
  51922. }
  51923. match = [match];
  51924. }
  51925. }
  51926. if (match) {
  51927. this._bindOccurrences(child, match, picture);
  51928. } else if (min > 0) {
  51929. this._setAndBind(child, dataNode);
  51930. } else {
  51931. uselessNodes.push(child);
  51932. }
  51933. }
  51934. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  51935. }
  51936. }
  51937. exports.Binder = Binder;
  51938. /***/ }),
  51939. /* 80 */
  51940. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51941. Object.defineProperty(exports, "__esModule", ({
  51942. value: true
  51943. }));
  51944. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  51945. var _xfa_object = __w_pdfjs_require__(75);
  51946. var _namespaces = __w_pdfjs_require__(77);
  51947. var _layout = __w_pdfjs_require__(81);
  51948. var _html_utils = __w_pdfjs_require__(82);
  51949. var _utils = __w_pdfjs_require__(76);
  51950. var _util = __w_pdfjs_require__(2);
  51951. var _fonts = __w_pdfjs_require__(83);
  51952. var _core_utils = __w_pdfjs_require__(9);
  51953. var _som = __w_pdfjs_require__(78);
  51954. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  51955. const SVG_NS = "http://www.w3.org/2000/svg";
  51956. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  51957. const MAX_EMPTY_PAGES = 3;
  51958. const DEFAULT_TAB_INDEX = 5000;
  51959. const HEADING_PATTERN = /^H(\d+)$/;
  51960. 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", "application/octet-stream"]);
  51961. 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"]];
  51962. function getBorderDims(node) {
  51963. if (!node || !node.border) {
  51964. return {
  51965. w: 0,
  51966. h: 0
  51967. };
  51968. }
  51969. const borderExtra = node.border[_xfa_object.$getExtra]();
  51970. if (!borderExtra) {
  51971. return {
  51972. w: 0,
  51973. h: 0
  51974. };
  51975. }
  51976. return {
  51977. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  51978. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  51979. };
  51980. }
  51981. function hasMargin(node) {
  51982. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  51983. }
  51984. function _setValue(templateNode, value) {
  51985. if (!templateNode.value) {
  51986. const nodeValue = new Value({});
  51987. templateNode[_xfa_object.$appendChild](nodeValue);
  51988. templateNode.value = nodeValue;
  51989. }
  51990. templateNode.value[_xfa_object.$setValue](value);
  51991. }
  51992. function* getContainedChildren(node) {
  51993. for (const child of node[_xfa_object.$getChildren]()) {
  51994. if (child instanceof SubformSet) {
  51995. yield* child[_xfa_object.$getContainedChildren]();
  51996. continue;
  51997. }
  51998. yield child;
  51999. }
  52000. }
  52001. function setTabIndex(node) {
  52002. while (node) {
  52003. if (!node.traversal) {
  52004. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52005. return;
  52006. }
  52007. if (node[_xfa_object.$tabIndex]) {
  52008. return;
  52009. }
  52010. let next = null;
  52011. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  52012. if (child.operation === "next") {
  52013. next = child;
  52014. break;
  52015. }
  52016. }
  52017. if (!next || !next.ref) {
  52018. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52019. return;
  52020. }
  52021. const root = node[_xfa_object.$getTemplateRoot]();
  52022. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  52023. const ref = root[_xfa_object.$searchNode](next.ref, node);
  52024. if (!ref) {
  52025. return;
  52026. }
  52027. node = ref[0];
  52028. }
  52029. }
  52030. function applyAssist(obj, attributes) {
  52031. const assist = obj.assist;
  52032. if (assist) {
  52033. const assistTitle = assist[_xfa_object.$toHTML]();
  52034. if (assistTitle) {
  52035. attributes.title = assistTitle;
  52036. }
  52037. const role = assist.role;
  52038. const match = role.match(HEADING_PATTERN);
  52039. if (match) {
  52040. const ariaRole = "heading";
  52041. const ariaLevel = match[1];
  52042. attributes.role = ariaRole;
  52043. attributes["aria-level"] = ariaLevel;
  52044. }
  52045. }
  52046. if (obj.layout === "table") {
  52047. attributes.role = "table";
  52048. } else if (obj.layout === "row") {
  52049. attributes.role = "row";
  52050. } else {
  52051. const parent = obj[_xfa_object.$getParent]();
  52052. if (parent.layout === "row") {
  52053. if (parent.assist && parent.assist.role === "TH") {
  52054. attributes.role = "columnheader";
  52055. } else {
  52056. attributes.role = "cell";
  52057. }
  52058. }
  52059. }
  52060. }
  52061. function ariaLabel(obj) {
  52062. if (!obj.assist) {
  52063. return null;
  52064. }
  52065. const assist = obj.assist;
  52066. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  52067. return assist.speak[_xfa_object.$content];
  52068. }
  52069. if (assist.toolTip) {
  52070. return assist.toolTip[_xfa_object.$content];
  52071. }
  52072. return null;
  52073. }
  52074. function valueToHtml(value) {
  52075. return _utils.HTMLResult.success({
  52076. name: "div",
  52077. attributes: {
  52078. class: ["xfaRich"],
  52079. style: Object.create(null)
  52080. },
  52081. children: [{
  52082. name: "span",
  52083. attributes: {
  52084. style: Object.create(null)
  52085. },
  52086. value
  52087. }]
  52088. });
  52089. }
  52090. function setFirstUnsplittable(node) {
  52091. const root = node[_xfa_object.$getTemplateRoot]();
  52092. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  52093. root[_xfa_object.$extra].firstUnsplittable = node;
  52094. root[_xfa_object.$extra].noLayoutFailure = true;
  52095. }
  52096. }
  52097. function unsetFirstUnsplittable(node) {
  52098. const root = node[_xfa_object.$getTemplateRoot]();
  52099. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  52100. root[_xfa_object.$extra].noLayoutFailure = false;
  52101. }
  52102. }
  52103. function handleBreak(node) {
  52104. if (node[_xfa_object.$extra]) {
  52105. return false;
  52106. }
  52107. node[_xfa_object.$extra] = Object.create(null);
  52108. if (node.targetType === "auto") {
  52109. return false;
  52110. }
  52111. const root = node[_xfa_object.$getTemplateRoot]();
  52112. let target = null;
  52113. if (node.target) {
  52114. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  52115. if (!target) {
  52116. return false;
  52117. }
  52118. target = target[0];
  52119. }
  52120. const {
  52121. currentPageArea,
  52122. currentContentArea
  52123. } = root[_xfa_object.$extra];
  52124. if (node.targetType === "pageArea") {
  52125. if (!(target instanceof PageArea)) {
  52126. target = null;
  52127. }
  52128. if (node.startNew) {
  52129. node[_xfa_object.$extra].target = target || currentPageArea;
  52130. return true;
  52131. } else if (target && target !== currentPageArea) {
  52132. node[_xfa_object.$extra].target = target;
  52133. return true;
  52134. }
  52135. return false;
  52136. }
  52137. if (!(target instanceof ContentArea)) {
  52138. target = null;
  52139. }
  52140. const pageArea = target && target[_xfa_object.$getParent]();
  52141. let index;
  52142. let nextPageArea = pageArea;
  52143. if (node.startNew) {
  52144. if (target) {
  52145. const contentAreas = pageArea.contentArea.children;
  52146. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  52147. const indexForTarget = contentAreas.indexOf(target);
  52148. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  52149. nextPageArea = null;
  52150. }
  52151. index = indexForTarget - 1;
  52152. } else {
  52153. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  52154. }
  52155. } else if (target && target !== currentContentArea) {
  52156. const contentAreas = pageArea.contentArea.children;
  52157. index = contentAreas.indexOf(target) - 1;
  52158. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  52159. } else {
  52160. return false;
  52161. }
  52162. node[_xfa_object.$extra].target = nextPageArea;
  52163. node[_xfa_object.$extra].index = index;
  52164. return true;
  52165. }
  52166. function handleOverflow(node, extraNode, space) {
  52167. const root = node[_xfa_object.$getTemplateRoot]();
  52168. const saved = root[_xfa_object.$extra].noLayoutFailure;
  52169. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  52170. extraNode[_xfa_object.$getSubformParent] = () => node;
  52171. root[_xfa_object.$extra].noLayoutFailure = true;
  52172. const res = extraNode[_xfa_object.$toHTML](space);
  52173. node[_xfa_object.$addHTML](res.html, res.bbox);
  52174. root[_xfa_object.$extra].noLayoutFailure = saved;
  52175. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  52176. }
  52177. class AppearanceFilter extends _xfa_object.StringObject {
  52178. constructor(attributes) {
  52179. super(TEMPLATE_NS_ID, "appearanceFilter");
  52180. this.id = attributes.id || "";
  52181. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52182. this.use = attributes.use || "";
  52183. this.usehref = attributes.usehref || "";
  52184. }
  52185. }
  52186. class Arc extends _xfa_object.XFAObject {
  52187. constructor(attributes) {
  52188. super(TEMPLATE_NS_ID, "arc", true);
  52189. this.circular = (0, _utils.getInteger)({
  52190. data: attributes.circular,
  52191. defaultValue: 0,
  52192. validate: x => x === 1
  52193. });
  52194. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52195. this.id = attributes.id || "";
  52196. this.startAngle = (0, _utils.getFloat)({
  52197. data: attributes.startAngle,
  52198. defaultValue: 0,
  52199. validate: x => true
  52200. });
  52201. this.sweepAngle = (0, _utils.getFloat)({
  52202. data: attributes.sweepAngle,
  52203. defaultValue: 360,
  52204. validate: x => true
  52205. });
  52206. this.use = attributes.use || "";
  52207. this.usehref = attributes.usehref || "";
  52208. this.edge = null;
  52209. this.fill = null;
  52210. }
  52211. [_xfa_object.$toHTML]() {
  52212. const edge = this.edge ? this.edge : new Edge({});
  52213. const edgeStyle = edge[_xfa_object.$toStyle]();
  52214. const style = Object.create(null);
  52215. if (this.fill && this.fill.presence === "visible") {
  52216. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52217. } else {
  52218. style.fill = "transparent";
  52219. }
  52220. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  52221. style.stroke = edgeStyle.color;
  52222. let arc;
  52223. const attributes = {
  52224. xmlns: SVG_NS,
  52225. style: {
  52226. width: "100%",
  52227. height: "100%",
  52228. overflow: "visible"
  52229. }
  52230. };
  52231. if (this.sweepAngle === 360) {
  52232. arc = {
  52233. name: "ellipse",
  52234. attributes: {
  52235. xmlns: SVG_NS,
  52236. cx: "50%",
  52237. cy: "50%",
  52238. rx: "50%",
  52239. ry: "50%",
  52240. style
  52241. }
  52242. };
  52243. } else {
  52244. const startAngle = this.startAngle * Math.PI / 180;
  52245. const sweepAngle = this.sweepAngle * Math.PI / 180;
  52246. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  52247. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
  52248. arc = {
  52249. name: "path",
  52250. attributes: {
  52251. xmlns: SVG_NS,
  52252. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  52253. vectorEffect: "non-scaling-stroke",
  52254. style
  52255. }
  52256. };
  52257. Object.assign(attributes, {
  52258. viewBox: "0 0 100 100",
  52259. preserveAspectRatio: "none"
  52260. });
  52261. }
  52262. const svg = {
  52263. name: "svg",
  52264. children: [arc],
  52265. attributes
  52266. };
  52267. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52268. if (hasMargin(parent)) {
  52269. return _utils.HTMLResult.success({
  52270. name: "div",
  52271. attributes: {
  52272. style: {
  52273. display: "inline",
  52274. width: "100%",
  52275. height: "100%"
  52276. }
  52277. },
  52278. children: [svg]
  52279. });
  52280. }
  52281. svg.attributes.style.position = "absolute";
  52282. return _utils.HTMLResult.success(svg);
  52283. }
  52284. }
  52285. class Area extends _xfa_object.XFAObject {
  52286. constructor(attributes) {
  52287. super(TEMPLATE_NS_ID, "area", true);
  52288. this.colSpan = (0, _utils.getInteger)({
  52289. data: attributes.colSpan,
  52290. defaultValue: 1,
  52291. validate: n => n >= 1 || n === -1
  52292. });
  52293. this.id = attributes.id || "";
  52294. this.name = attributes.name || "";
  52295. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52296. this.use = attributes.use || "";
  52297. this.usehref = attributes.usehref || "";
  52298. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52299. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52300. this.desc = null;
  52301. this.extras = null;
  52302. this.area = new _xfa_object.XFAObjectArray();
  52303. this.draw = new _xfa_object.XFAObjectArray();
  52304. this.exObject = new _xfa_object.XFAObjectArray();
  52305. this.exclGroup = new _xfa_object.XFAObjectArray();
  52306. this.field = new _xfa_object.XFAObjectArray();
  52307. this.subform = new _xfa_object.XFAObjectArray();
  52308. this.subformSet = new _xfa_object.XFAObjectArray();
  52309. }
  52310. *[_xfa_object.$getContainedChildren]() {
  52311. yield* getContainedChildren(this);
  52312. }
  52313. [_xfa_object.$isTransparent]() {
  52314. return true;
  52315. }
  52316. [_xfa_object.$isBindable]() {
  52317. return true;
  52318. }
  52319. [_xfa_object.$addHTML](html, bbox) {
  52320. const [x, y, w, h] = bbox;
  52321. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  52322. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  52323. this[_xfa_object.$extra].children.push(html);
  52324. }
  52325. [_xfa_object.$getAvailableSpace]() {
  52326. return this[_xfa_object.$extra].availableSpace;
  52327. }
  52328. [_xfa_object.$toHTML](availableSpace) {
  52329. const style = (0, _html_utils.toStyle)(this, "position");
  52330. const attributes = {
  52331. style,
  52332. id: this[_xfa_object.$uid],
  52333. class: ["xfaArea"]
  52334. };
  52335. if ((0, _html_utils.isPrintOnly)(this)) {
  52336. attributes.class.push("xfaPrintOnly");
  52337. }
  52338. if (this.name) {
  52339. attributes.xfaName = this.name;
  52340. }
  52341. const children = [];
  52342. this[_xfa_object.$extra] = {
  52343. children,
  52344. width: 0,
  52345. height: 0,
  52346. availableSpace
  52347. };
  52348. const result = this[_xfa_object.$childrenToHTML]({
  52349. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  52350. include: true
  52351. });
  52352. if (!result.success) {
  52353. if (result.isBreak()) {
  52354. return result;
  52355. }
  52356. delete this[_xfa_object.$extra];
  52357. return _utils.HTMLResult.FAILURE;
  52358. }
  52359. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  52360. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  52361. const html = {
  52362. name: "div",
  52363. attributes,
  52364. children
  52365. };
  52366. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  52367. delete this[_xfa_object.$extra];
  52368. return _utils.HTMLResult.success(html, bbox);
  52369. }
  52370. }
  52371. class Assist extends _xfa_object.XFAObject {
  52372. constructor(attributes) {
  52373. super(TEMPLATE_NS_ID, "assist", true);
  52374. this.id = attributes.id || "";
  52375. this.role = attributes.role || "";
  52376. this.use = attributes.use || "";
  52377. this.usehref = attributes.usehref || "";
  52378. this.speak = null;
  52379. this.toolTip = null;
  52380. }
  52381. [_xfa_object.$toHTML]() {
  52382. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  52383. }
  52384. }
  52385. class Barcode extends _xfa_object.XFAObject {
  52386. constructor(attributes) {
  52387. super(TEMPLATE_NS_ID, "barcode", true);
  52388. this.charEncoding = (0, _utils.getKeyword)({
  52389. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  52390. defaultValue: "",
  52391. 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}/)
  52392. });
  52393. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  52394. this.dataColumnCount = (0, _utils.getInteger)({
  52395. data: attributes.dataColumnCount,
  52396. defaultValue: -1,
  52397. validate: x => x >= 0
  52398. });
  52399. this.dataLength = (0, _utils.getInteger)({
  52400. data: attributes.dataLength,
  52401. defaultValue: -1,
  52402. validate: x => x >= 0
  52403. });
  52404. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  52405. this.dataRowCount = (0, _utils.getInteger)({
  52406. data: attributes.dataRowCount,
  52407. defaultValue: -1,
  52408. validate: x => x >= 0
  52409. });
  52410. this.endChar = attributes.endChar || "";
  52411. this.errorCorrectionLevel = (0, _utils.getInteger)({
  52412. data: attributes.errorCorrectionLevel,
  52413. defaultValue: -1,
  52414. validate: x => x >= 0 && x <= 8
  52415. });
  52416. this.id = attributes.id || "";
  52417. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  52418. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  52419. this.printCheckDigit = (0, _utils.getInteger)({
  52420. data: attributes.printCheckDigit,
  52421. defaultValue: 0,
  52422. validate: x => x === 1
  52423. });
  52424. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  52425. this.startChar = attributes.startChar || "";
  52426. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  52427. this.truncate = (0, _utils.getInteger)({
  52428. data: attributes.truncate,
  52429. defaultValue: 0,
  52430. validate: x => x === 1
  52431. });
  52432. 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"]);
  52433. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  52434. this.use = attributes.use || "";
  52435. this.usehref = attributes.usehref || "";
  52436. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  52437. this.encrypt = null;
  52438. this.extras = null;
  52439. }
  52440. }
  52441. class Bind extends _xfa_object.XFAObject {
  52442. constructor(attributes) {
  52443. super(TEMPLATE_NS_ID, "bind", true);
  52444. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  52445. this.ref = attributes.ref || "";
  52446. this.picture = null;
  52447. }
  52448. }
  52449. class BindItems extends _xfa_object.XFAObject {
  52450. constructor(attributes) {
  52451. super(TEMPLATE_NS_ID, "bindItems");
  52452. this.connection = attributes.connection || "";
  52453. this.labelRef = attributes.labelRef || "";
  52454. this.ref = attributes.ref || "";
  52455. this.valueRef = attributes.valueRef || "";
  52456. }
  52457. }
  52458. exports.BindItems = BindItems;
  52459. class Bookend extends _xfa_object.XFAObject {
  52460. constructor(attributes) {
  52461. super(TEMPLATE_NS_ID, "bookend");
  52462. this.id = attributes.id || "";
  52463. this.leader = attributes.leader || "";
  52464. this.trailer = attributes.trailer || "";
  52465. this.use = attributes.use || "";
  52466. this.usehref = attributes.usehref || "";
  52467. }
  52468. }
  52469. class BooleanElement extends _xfa_object.Option01 {
  52470. constructor(attributes) {
  52471. super(TEMPLATE_NS_ID, "boolean");
  52472. this.id = attributes.id || "";
  52473. this.name = attributes.name || "";
  52474. this.use = attributes.use || "";
  52475. this.usehref = attributes.usehref || "";
  52476. }
  52477. [_xfa_object.$toHTML](availableSpace) {
  52478. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  52479. }
  52480. }
  52481. class Border extends _xfa_object.XFAObject {
  52482. constructor(attributes) {
  52483. super(TEMPLATE_NS_ID, "border", true);
  52484. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  52485. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52486. this.id = attributes.id || "";
  52487. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52488. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52489. this.use = attributes.use || "";
  52490. this.usehref = attributes.usehref || "";
  52491. this.corner = new _xfa_object.XFAObjectArray(4);
  52492. this.edge = new _xfa_object.XFAObjectArray(4);
  52493. this.extras = null;
  52494. this.fill = null;
  52495. this.margin = null;
  52496. }
  52497. [_xfa_object.$getExtra]() {
  52498. if (!this[_xfa_object.$extra]) {
  52499. const edges = this.edge.children.slice();
  52500. if (edges.length < 4) {
  52501. const defaultEdge = edges[edges.length - 1] || new Edge({});
  52502. for (let i = edges.length; i < 4; i++) {
  52503. edges.push(defaultEdge);
  52504. }
  52505. }
  52506. const widths = edges.map(edge => edge.thickness);
  52507. const insets = [0, 0, 0, 0];
  52508. if (this.margin) {
  52509. insets[0] = this.margin.topInset;
  52510. insets[1] = this.margin.rightInset;
  52511. insets[2] = this.margin.bottomInset;
  52512. insets[3] = this.margin.leftInset;
  52513. }
  52514. this[_xfa_object.$extra] = {
  52515. widths,
  52516. insets,
  52517. edges
  52518. };
  52519. }
  52520. return this[_xfa_object.$extra];
  52521. }
  52522. [_xfa_object.$toStyle]() {
  52523. const {
  52524. edges
  52525. } = this[_xfa_object.$getExtra]();
  52526. const edgeStyles = edges.map(node => {
  52527. const style = node[_xfa_object.$toStyle]();
  52528. style.color = style.color || "#000000";
  52529. return style;
  52530. });
  52531. const style = Object.create(null);
  52532. if (this.margin) {
  52533. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  52534. }
  52535. if (this.fill && this.fill.presence === "visible") {
  52536. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52537. }
  52538. if (this.corner.children.some(node => node.radius !== 0)) {
  52539. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  52540. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  52541. const last = cornerStyles[cornerStyles.length - 1];
  52542. for (let i = cornerStyles.length; i < 4; i++) {
  52543. cornerStyles.push(last);
  52544. }
  52545. }
  52546. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  52547. }
  52548. switch (this.presence) {
  52549. case "invisible":
  52550. case "hidden":
  52551. style.borderStyle = "";
  52552. break;
  52553. case "inactive":
  52554. style.borderStyle = "none";
  52555. break;
  52556. default:
  52557. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  52558. break;
  52559. }
  52560. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  52561. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  52562. return style;
  52563. }
  52564. }
  52565. class Break extends _xfa_object.XFAObject {
  52566. constructor(attributes) {
  52567. super(TEMPLATE_NS_ID, "break", true);
  52568. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52569. this.afterTarget = attributes.afterTarget || "";
  52570. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52571. this.beforeTarget = attributes.beforeTarget || "";
  52572. this.bookendLeader = attributes.bookendLeader || "";
  52573. this.bookendTrailer = attributes.bookendTrailer || "";
  52574. this.id = attributes.id || "";
  52575. this.overflowLeader = attributes.overflowLeader || "";
  52576. this.overflowTarget = attributes.overflowTarget || "";
  52577. this.overflowTrailer = attributes.overflowTrailer || "";
  52578. this.startNew = (0, _utils.getInteger)({
  52579. data: attributes.startNew,
  52580. defaultValue: 0,
  52581. validate: x => x === 1
  52582. });
  52583. this.use = attributes.use || "";
  52584. this.usehref = attributes.usehref || "";
  52585. this.extras = null;
  52586. }
  52587. }
  52588. class BreakAfter extends _xfa_object.XFAObject {
  52589. constructor(attributes) {
  52590. super(TEMPLATE_NS_ID, "breakAfter", true);
  52591. this.id = attributes.id || "";
  52592. this.leader = attributes.leader || "";
  52593. this.startNew = (0, _utils.getInteger)({
  52594. data: attributes.startNew,
  52595. defaultValue: 0,
  52596. validate: x => x === 1
  52597. });
  52598. this.target = attributes.target || "";
  52599. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52600. this.trailer = attributes.trailer || "";
  52601. this.use = attributes.use || "";
  52602. this.usehref = attributes.usehref || "";
  52603. this.script = null;
  52604. }
  52605. }
  52606. class BreakBefore extends _xfa_object.XFAObject {
  52607. constructor(attributes) {
  52608. super(TEMPLATE_NS_ID, "breakBefore", true);
  52609. this.id = attributes.id || "";
  52610. this.leader = attributes.leader || "";
  52611. this.startNew = (0, _utils.getInteger)({
  52612. data: attributes.startNew,
  52613. defaultValue: 0,
  52614. validate: x => x === 1
  52615. });
  52616. this.target = attributes.target || "";
  52617. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52618. this.trailer = attributes.trailer || "";
  52619. this.use = attributes.use || "";
  52620. this.usehref = attributes.usehref || "";
  52621. this.script = null;
  52622. }
  52623. [_xfa_object.$toHTML](availableSpace) {
  52624. this[_xfa_object.$extra] = {};
  52625. return _utils.HTMLResult.FAILURE;
  52626. }
  52627. }
  52628. class Button extends _xfa_object.XFAObject {
  52629. constructor(attributes) {
  52630. super(TEMPLATE_NS_ID, "button", true);
  52631. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  52632. this.id = attributes.id || "";
  52633. this.use = attributes.use || "";
  52634. this.usehref = attributes.usehref || "";
  52635. this.extras = null;
  52636. }
  52637. [_xfa_object.$toHTML](availableSpace) {
  52638. const parent = this[_xfa_object.$getParent]();
  52639. const grandpa = parent[_xfa_object.$getParent]();
  52640. const htmlButton = {
  52641. name: "button",
  52642. attributes: {
  52643. id: this[_xfa_object.$uid],
  52644. class: ["xfaButton"],
  52645. style: {}
  52646. },
  52647. children: []
  52648. };
  52649. for (const event of grandpa.event.children) {
  52650. if (event.activity !== "click" || !event.script) {
  52651. continue;
  52652. }
  52653. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  52654. if (!jsURL) {
  52655. continue;
  52656. }
  52657. const href = (0, _html_utils.fixURL)(jsURL.url);
  52658. if (!href) {
  52659. continue;
  52660. }
  52661. htmlButton.children.push({
  52662. name: "a",
  52663. attributes: {
  52664. id: "link" + this[_xfa_object.$uid],
  52665. href,
  52666. newWindow: jsURL.newWindow,
  52667. class: ["xfaLink"],
  52668. style: {}
  52669. },
  52670. children: []
  52671. });
  52672. }
  52673. return _utils.HTMLResult.success(htmlButton);
  52674. }
  52675. }
  52676. class Calculate extends _xfa_object.XFAObject {
  52677. constructor(attributes) {
  52678. super(TEMPLATE_NS_ID, "calculate", true);
  52679. this.id = attributes.id || "";
  52680. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  52681. this.use = attributes.use || "";
  52682. this.usehref = attributes.usehref || "";
  52683. this.extras = null;
  52684. this.message = null;
  52685. this.script = null;
  52686. }
  52687. }
  52688. class Caption extends _xfa_object.XFAObject {
  52689. constructor(attributes) {
  52690. super(TEMPLATE_NS_ID, "caption", true);
  52691. this.id = attributes.id || "";
  52692. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  52693. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52694. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  52695. this.use = attributes.use || "";
  52696. this.usehref = attributes.usehref || "";
  52697. this.extras = null;
  52698. this.font = null;
  52699. this.margin = null;
  52700. this.para = null;
  52701. this.value = null;
  52702. }
  52703. [_xfa_object.$setValue](value) {
  52704. _setValue(this, value);
  52705. }
  52706. [_xfa_object.$getExtra](availableSpace) {
  52707. if (!this[_xfa_object.$extra]) {
  52708. let {
  52709. width,
  52710. height
  52711. } = availableSpace;
  52712. switch (this.placement) {
  52713. case "left":
  52714. case "right":
  52715. case "inline":
  52716. width = this.reserve <= 0 ? width : this.reserve;
  52717. break;
  52718. case "top":
  52719. case "bottom":
  52720. height = this.reserve <= 0 ? height : this.reserve;
  52721. break;
  52722. }
  52723. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  52724. width,
  52725. height
  52726. });
  52727. }
  52728. return this[_xfa_object.$extra];
  52729. }
  52730. [_xfa_object.$toHTML](availableSpace) {
  52731. if (!this.value) {
  52732. return _utils.HTMLResult.EMPTY;
  52733. }
  52734. this[_xfa_object.$pushPara]();
  52735. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  52736. if (!value) {
  52737. this[_xfa_object.$popPara]();
  52738. return _utils.HTMLResult.EMPTY;
  52739. }
  52740. const savedReserve = this.reserve;
  52741. if (this.reserve <= 0) {
  52742. const {
  52743. w,
  52744. h
  52745. } = this[_xfa_object.$getExtra](availableSpace);
  52746. switch (this.placement) {
  52747. case "left":
  52748. case "right":
  52749. case "inline":
  52750. this.reserve = w;
  52751. break;
  52752. case "top":
  52753. case "bottom":
  52754. this.reserve = h;
  52755. break;
  52756. }
  52757. }
  52758. const children = [];
  52759. if (typeof value === "string") {
  52760. children.push({
  52761. name: "#text",
  52762. value
  52763. });
  52764. } else {
  52765. children.push(value);
  52766. }
  52767. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  52768. switch (this.placement) {
  52769. case "left":
  52770. case "right":
  52771. if (this.reserve > 0) {
  52772. style.width = (0, _html_utils.measureToString)(this.reserve);
  52773. }
  52774. break;
  52775. case "top":
  52776. case "bottom":
  52777. if (this.reserve > 0) {
  52778. style.height = (0, _html_utils.measureToString)(this.reserve);
  52779. }
  52780. break;
  52781. }
  52782. (0, _html_utils.setPara)(this, null, value);
  52783. this[_xfa_object.$popPara]();
  52784. this.reserve = savedReserve;
  52785. return _utils.HTMLResult.success({
  52786. name: "div",
  52787. attributes: {
  52788. style,
  52789. class: ["xfaCaption"]
  52790. },
  52791. children
  52792. });
  52793. }
  52794. }
  52795. class Certificate extends _xfa_object.StringObject {
  52796. constructor(attributes) {
  52797. super(TEMPLATE_NS_ID, "certificate");
  52798. this.id = attributes.id || "";
  52799. this.name = attributes.name || "";
  52800. this.use = attributes.use || "";
  52801. this.usehref = attributes.usehref || "";
  52802. }
  52803. }
  52804. class Certificates extends _xfa_object.XFAObject {
  52805. constructor(attributes) {
  52806. super(TEMPLATE_NS_ID, "certificates", true);
  52807. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  52808. this.id = attributes.id || "";
  52809. this.url = attributes.url || "";
  52810. this.urlPolicy = attributes.urlPolicy || "";
  52811. this.use = attributes.use || "";
  52812. this.usehref = attributes.usehref || "";
  52813. this.encryption = null;
  52814. this.issuers = null;
  52815. this.keyUsage = null;
  52816. this.oids = null;
  52817. this.signing = null;
  52818. this.subjectDNs = null;
  52819. }
  52820. }
  52821. class CheckButton extends _xfa_object.XFAObject {
  52822. constructor(attributes) {
  52823. super(TEMPLATE_NS_ID, "checkButton", true);
  52824. this.id = attributes.id || "";
  52825. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  52826. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  52827. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  52828. this.use = attributes.use || "";
  52829. this.usehref = attributes.usehref || "";
  52830. this.border = null;
  52831. this.extras = null;
  52832. this.margin = null;
  52833. }
  52834. [_xfa_object.$toHTML](availableSpace) {
  52835. const style = (0, _html_utils.toStyle)("margin");
  52836. const size = (0, _html_utils.measureToString)(this.size);
  52837. style.width = style.height = size;
  52838. let type;
  52839. let className;
  52840. let groupId;
  52841. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52842. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  52843. const exportedValue = {
  52844. on: (items[0] !== undefined ? items[0] : "on").toString(),
  52845. off: (items[1] !== undefined ? items[1] : "off").toString()
  52846. };
  52847. const value = field.value && field.value[_xfa_object.$text]() || "off";
  52848. const checked = value === exportedValue.on || undefined;
  52849. const container = field[_xfa_object.$getSubformParent]();
  52850. const fieldId = field[_xfa_object.$uid];
  52851. let dataId;
  52852. if (container instanceof ExclGroup) {
  52853. groupId = container[_xfa_object.$uid];
  52854. type = "radio";
  52855. className = "xfaRadio";
  52856. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  52857. } else {
  52858. type = "checkbox";
  52859. className = "xfaCheckbox";
  52860. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  52861. }
  52862. const input = {
  52863. name: "input",
  52864. attributes: {
  52865. class: [className],
  52866. style,
  52867. fieldId,
  52868. dataId,
  52869. type,
  52870. checked,
  52871. xfaOn: exportedValue.on,
  52872. xfaOff: exportedValue.off,
  52873. "aria-label": ariaLabel(field)
  52874. }
  52875. };
  52876. if (groupId) {
  52877. input.attributes.name = groupId;
  52878. }
  52879. return _utils.HTMLResult.success({
  52880. name: "label",
  52881. attributes: {
  52882. class: ["xfaLabel"]
  52883. },
  52884. children: [input]
  52885. });
  52886. }
  52887. }
  52888. class ChoiceList extends _xfa_object.XFAObject {
  52889. constructor(attributes) {
  52890. super(TEMPLATE_NS_ID, "choiceList", true);
  52891. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  52892. this.id = attributes.id || "";
  52893. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  52894. this.textEntry = (0, _utils.getInteger)({
  52895. data: attributes.textEntry,
  52896. defaultValue: 0,
  52897. validate: x => x === 1
  52898. });
  52899. this.use = attributes.use || "";
  52900. this.usehref = attributes.usehref || "";
  52901. this.border = null;
  52902. this.extras = null;
  52903. this.margin = null;
  52904. }
  52905. [_xfa_object.$toHTML](availableSpace) {
  52906. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  52907. const ui = this[_xfa_object.$getParent]();
  52908. const field = ui[_xfa_object.$getParent]();
  52909. const fontSize = field.font && field.font.size || 10;
  52910. const optionStyle = {
  52911. fontSize: `calc(${fontSize}px * var(--zoom-factor))`
  52912. };
  52913. const children = [];
  52914. if (field.items.children.length > 0) {
  52915. const items = field.items;
  52916. let displayedIndex = 0;
  52917. let saveIndex = 0;
  52918. if (items.children.length === 2) {
  52919. displayedIndex = items.children[0].save;
  52920. saveIndex = 1 - displayedIndex;
  52921. }
  52922. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  52923. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  52924. let selected = false;
  52925. const value = field.value && field.value[_xfa_object.$text]() || "";
  52926. for (let i = 0, ii = displayed.length; i < ii; i++) {
  52927. const option = {
  52928. name: "option",
  52929. attributes: {
  52930. value: values[i] || displayed[i],
  52931. style: optionStyle
  52932. },
  52933. value: displayed[i]
  52934. };
  52935. if (values[i] === value) {
  52936. option.attributes.selected = selected = true;
  52937. }
  52938. children.push(option);
  52939. }
  52940. if (!selected) {
  52941. children.splice(0, 0, {
  52942. name: "option",
  52943. attributes: {
  52944. hidden: true,
  52945. selected: true
  52946. },
  52947. value: " "
  52948. });
  52949. }
  52950. }
  52951. const selectAttributes = {
  52952. class: ["xfaSelect"],
  52953. fieldId: field[_xfa_object.$uid],
  52954. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  52955. style,
  52956. "aria-label": ariaLabel(field)
  52957. };
  52958. if (this.open === "multiSelect") {
  52959. selectAttributes.multiple = true;
  52960. }
  52961. return _utils.HTMLResult.success({
  52962. name: "label",
  52963. attributes: {
  52964. class: ["xfaLabel"]
  52965. },
  52966. children: [{
  52967. name: "select",
  52968. children,
  52969. attributes: selectAttributes
  52970. }]
  52971. });
  52972. }
  52973. }
  52974. class Color extends _xfa_object.XFAObject {
  52975. constructor(attributes) {
  52976. super(TEMPLATE_NS_ID, "color", true);
  52977. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  52978. this.id = attributes.id || "";
  52979. this.use = attributes.use || "";
  52980. this.usehref = attributes.usehref || "";
  52981. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  52982. this.extras = null;
  52983. }
  52984. [_xfa_object.$hasSettableValue]() {
  52985. return false;
  52986. }
  52987. [_xfa_object.$toStyle]() {
  52988. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  52989. }
  52990. }
  52991. class Comb extends _xfa_object.XFAObject {
  52992. constructor(attributes) {
  52993. super(TEMPLATE_NS_ID, "comb");
  52994. this.id = attributes.id || "";
  52995. this.numberOfCells = (0, _utils.getInteger)({
  52996. data: attributes.numberOfCells,
  52997. defaultValue: 0,
  52998. validate: x => x >= 0
  52999. });
  53000. this.use = attributes.use || "";
  53001. this.usehref = attributes.usehref || "";
  53002. }
  53003. }
  53004. class Connect extends _xfa_object.XFAObject {
  53005. constructor(attributes) {
  53006. super(TEMPLATE_NS_ID, "connect", true);
  53007. this.connection = attributes.connection || "";
  53008. this.id = attributes.id || "";
  53009. this.ref = attributes.ref || "";
  53010. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  53011. this.use = attributes.use || "";
  53012. this.usehref = attributes.usehref || "";
  53013. this.picture = null;
  53014. }
  53015. }
  53016. class ContentArea extends _xfa_object.XFAObject {
  53017. constructor(attributes) {
  53018. super(TEMPLATE_NS_ID, "contentArea", true);
  53019. this.h = (0, _utils.getMeasurement)(attributes.h);
  53020. this.id = attributes.id || "";
  53021. this.name = attributes.name || "";
  53022. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53023. this.use = attributes.use || "";
  53024. this.usehref = attributes.usehref || "";
  53025. this.w = (0, _utils.getMeasurement)(attributes.w);
  53026. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53027. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53028. this.desc = null;
  53029. this.extras = null;
  53030. }
  53031. [_xfa_object.$toHTML](availableSpace) {
  53032. const left = (0, _html_utils.measureToString)(this.x);
  53033. const top = (0, _html_utils.measureToString)(this.y);
  53034. const style = {
  53035. left,
  53036. top,
  53037. width: (0, _html_utils.measureToString)(this.w),
  53038. height: (0, _html_utils.measureToString)(this.h)
  53039. };
  53040. const classNames = ["xfaContentarea"];
  53041. if ((0, _html_utils.isPrintOnly)(this)) {
  53042. classNames.push("xfaPrintOnly");
  53043. }
  53044. return _utils.HTMLResult.success({
  53045. name: "div",
  53046. children: [],
  53047. attributes: {
  53048. style,
  53049. class: classNames,
  53050. id: this[_xfa_object.$uid]
  53051. }
  53052. });
  53053. }
  53054. }
  53055. class Corner extends _xfa_object.XFAObject {
  53056. constructor(attributes) {
  53057. super(TEMPLATE_NS_ID, "corner", true);
  53058. this.id = attributes.id || "";
  53059. this.inverted = (0, _utils.getInteger)({
  53060. data: attributes.inverted,
  53061. defaultValue: 0,
  53062. validate: x => x === 1
  53063. });
  53064. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  53065. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53066. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  53067. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53068. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53069. this.use = attributes.use || "";
  53070. this.usehref = attributes.usehref || "";
  53071. this.color = null;
  53072. this.extras = null;
  53073. }
  53074. [_xfa_object.$toStyle]() {
  53075. const style = (0, _html_utils.toStyle)(this, "visibility");
  53076. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  53077. return style;
  53078. }
  53079. }
  53080. class DateElement extends _xfa_object.ContentObject {
  53081. constructor(attributes) {
  53082. super(TEMPLATE_NS_ID, "date");
  53083. this.id = attributes.id || "";
  53084. this.name = attributes.name || "";
  53085. this.use = attributes.use || "";
  53086. this.usehref = attributes.usehref || "";
  53087. }
  53088. [_xfa_object.$finalize]() {
  53089. const date = this[_xfa_object.$content].trim();
  53090. this[_xfa_object.$content] = date ? new Date(date) : null;
  53091. }
  53092. [_xfa_object.$toHTML](availableSpace) {
  53093. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53094. }
  53095. }
  53096. class DateTime extends _xfa_object.ContentObject {
  53097. constructor(attributes) {
  53098. super(TEMPLATE_NS_ID, "dateTime");
  53099. this.id = attributes.id || "";
  53100. this.name = attributes.name || "";
  53101. this.use = attributes.use || "";
  53102. this.usehref = attributes.usehref || "";
  53103. }
  53104. [_xfa_object.$finalize]() {
  53105. const date = this[_xfa_object.$content].trim();
  53106. this[_xfa_object.$content] = date ? new Date(date) : null;
  53107. }
  53108. [_xfa_object.$toHTML](availableSpace) {
  53109. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53110. }
  53111. }
  53112. class DateTimeEdit extends _xfa_object.XFAObject {
  53113. constructor(attributes) {
  53114. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  53115. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53116. this.id = attributes.id || "";
  53117. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  53118. this.use = attributes.use || "";
  53119. this.usehref = attributes.usehref || "";
  53120. this.border = null;
  53121. this.comb = null;
  53122. this.extras = null;
  53123. this.margin = null;
  53124. }
  53125. [_xfa_object.$toHTML](availableSpace) {
  53126. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  53127. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53128. const html = {
  53129. name: "input",
  53130. attributes: {
  53131. type: "text",
  53132. fieldId: field[_xfa_object.$uid],
  53133. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53134. class: ["xfaTextfield"],
  53135. style,
  53136. "aria-label": ariaLabel(field)
  53137. }
  53138. };
  53139. return _utils.HTMLResult.success({
  53140. name: "label",
  53141. attributes: {
  53142. class: ["xfaLabel"]
  53143. },
  53144. children: [html]
  53145. });
  53146. }
  53147. }
  53148. class Decimal extends _xfa_object.ContentObject {
  53149. constructor(attributes) {
  53150. super(TEMPLATE_NS_ID, "decimal");
  53151. this.fracDigits = (0, _utils.getInteger)({
  53152. data: attributes.fracDigits,
  53153. defaultValue: 2,
  53154. validate: x => true
  53155. });
  53156. this.id = attributes.id || "";
  53157. this.leadDigits = (0, _utils.getInteger)({
  53158. data: attributes.leadDigits,
  53159. defaultValue: -1,
  53160. validate: x => true
  53161. });
  53162. this.name = attributes.name || "";
  53163. this.use = attributes.use || "";
  53164. this.usehref = attributes.usehref || "";
  53165. }
  53166. [_xfa_object.$finalize]() {
  53167. const number = parseFloat(this[_xfa_object.$content].trim());
  53168. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53169. }
  53170. [_xfa_object.$toHTML](availableSpace) {
  53171. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53172. }
  53173. }
  53174. class DefaultUi extends _xfa_object.XFAObject {
  53175. constructor(attributes) {
  53176. super(TEMPLATE_NS_ID, "defaultUi", true);
  53177. this.id = attributes.id || "";
  53178. this.use = attributes.use || "";
  53179. this.usehref = attributes.usehref || "";
  53180. this.extras = null;
  53181. }
  53182. }
  53183. class Desc extends _xfa_object.XFAObject {
  53184. constructor(attributes) {
  53185. super(TEMPLATE_NS_ID, "desc", true);
  53186. this.id = attributes.id || "";
  53187. this.use = attributes.use || "";
  53188. this.usehref = attributes.usehref || "";
  53189. this.boolean = new _xfa_object.XFAObjectArray();
  53190. this.date = new _xfa_object.XFAObjectArray();
  53191. this.dateTime = new _xfa_object.XFAObjectArray();
  53192. this.decimal = new _xfa_object.XFAObjectArray();
  53193. this.exData = new _xfa_object.XFAObjectArray();
  53194. this.float = new _xfa_object.XFAObjectArray();
  53195. this.image = new _xfa_object.XFAObjectArray();
  53196. this.integer = new _xfa_object.XFAObjectArray();
  53197. this.text = new _xfa_object.XFAObjectArray();
  53198. this.time = new _xfa_object.XFAObjectArray();
  53199. }
  53200. }
  53201. class DigestMethod extends _xfa_object.OptionObject {
  53202. constructor(attributes) {
  53203. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  53204. this.id = attributes.id || "";
  53205. this.use = attributes.use || "";
  53206. this.usehref = attributes.usehref || "";
  53207. }
  53208. }
  53209. class DigestMethods extends _xfa_object.XFAObject {
  53210. constructor(attributes) {
  53211. super(TEMPLATE_NS_ID, "digestMethods", true);
  53212. this.id = attributes.id || "";
  53213. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53214. this.use = attributes.use || "";
  53215. this.usehref = attributes.usehref || "";
  53216. this.digestMethod = new _xfa_object.XFAObjectArray();
  53217. }
  53218. }
  53219. class Draw extends _xfa_object.XFAObject {
  53220. constructor(attributes) {
  53221. super(TEMPLATE_NS_ID, "draw", true);
  53222. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53223. this.colSpan = (0, _utils.getInteger)({
  53224. data: attributes.colSpan,
  53225. defaultValue: 1,
  53226. validate: n => n >= 1 || n === -1
  53227. });
  53228. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53229. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53230. this.id = attributes.id || "";
  53231. this.locale = attributes.locale || "";
  53232. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53233. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53234. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53235. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53236. this.name = attributes.name || "";
  53237. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53238. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53239. this.rotate = (0, _utils.getInteger)({
  53240. data: attributes.rotate,
  53241. defaultValue: 0,
  53242. validate: x => x % 90 === 0
  53243. });
  53244. this.use = attributes.use || "";
  53245. this.usehref = attributes.usehref || "";
  53246. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53247. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53248. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53249. this.assist = null;
  53250. this.border = null;
  53251. this.caption = null;
  53252. this.desc = null;
  53253. this.extras = null;
  53254. this.font = null;
  53255. this.keep = null;
  53256. this.margin = null;
  53257. this.para = null;
  53258. this.traversal = null;
  53259. this.ui = null;
  53260. this.value = null;
  53261. this.setProperty = new _xfa_object.XFAObjectArray();
  53262. }
  53263. [_xfa_object.$setValue](value) {
  53264. _setValue(this, value);
  53265. }
  53266. [_xfa_object.$toHTML](availableSpace) {
  53267. setTabIndex(this);
  53268. if (this.presence === "hidden" || this.presence === "inactive") {
  53269. return _utils.HTMLResult.EMPTY;
  53270. }
  53271. (0, _html_utils.fixDimensions)(this);
  53272. this[_xfa_object.$pushPara]();
  53273. const savedW = this.w;
  53274. const savedH = this.h;
  53275. const {
  53276. w,
  53277. h,
  53278. isBroken
  53279. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53280. if (w && this.w === "") {
  53281. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53282. this[_xfa_object.$popPara]();
  53283. return _utils.HTMLResult.FAILURE;
  53284. }
  53285. this.w = w;
  53286. }
  53287. if (h && this.h === "") {
  53288. this.h = h;
  53289. }
  53290. setFirstUnsplittable(this);
  53291. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53292. this.w = savedW;
  53293. this.h = savedH;
  53294. this[_xfa_object.$popPara]();
  53295. return _utils.HTMLResult.FAILURE;
  53296. }
  53297. unsetFirstUnsplittable(this);
  53298. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  53299. (0, _html_utils.setMinMaxDimensions)(this, style);
  53300. if (style.margin) {
  53301. style.padding = style.margin;
  53302. delete style.margin;
  53303. }
  53304. const classNames = ["xfaDraw"];
  53305. if (this.font) {
  53306. classNames.push("xfaFont");
  53307. }
  53308. if ((0, _html_utils.isPrintOnly)(this)) {
  53309. classNames.push("xfaPrintOnly");
  53310. }
  53311. const attributes = {
  53312. style,
  53313. id: this[_xfa_object.$uid],
  53314. class: classNames
  53315. };
  53316. if (this.name) {
  53317. attributes.xfaName = this.name;
  53318. }
  53319. const html = {
  53320. name: "div",
  53321. attributes,
  53322. children: []
  53323. };
  53324. applyAssist(this, attributes);
  53325. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53326. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  53327. if (value === null) {
  53328. this.w = savedW;
  53329. this.h = savedH;
  53330. this[_xfa_object.$popPara]();
  53331. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53332. }
  53333. html.children.push(value);
  53334. (0, _html_utils.setPara)(this, style, value);
  53335. this.w = savedW;
  53336. this.h = savedH;
  53337. this[_xfa_object.$popPara]();
  53338. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53339. }
  53340. }
  53341. class Edge extends _xfa_object.XFAObject {
  53342. constructor(attributes) {
  53343. super(TEMPLATE_NS_ID, "edge", true);
  53344. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  53345. this.id = attributes.id || "";
  53346. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53347. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53348. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53349. this.use = attributes.use || "";
  53350. this.usehref = attributes.usehref || "";
  53351. this.color = null;
  53352. this.extras = null;
  53353. }
  53354. [_xfa_object.$toStyle]() {
  53355. const style = (0, _html_utils.toStyle)(this, "visibility");
  53356. Object.assign(style, {
  53357. linecap: this.cap,
  53358. width: (0, _html_utils.measureToString)(this.thickness),
  53359. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  53360. style: ""
  53361. });
  53362. if (this.presence !== "visible") {
  53363. style.style = "none";
  53364. } else {
  53365. switch (this.stroke) {
  53366. case "solid":
  53367. style.style = "solid";
  53368. break;
  53369. case "dashDot":
  53370. style.style = "dashed";
  53371. break;
  53372. case "dashDotDot":
  53373. style.style = "dashed";
  53374. break;
  53375. case "dashed":
  53376. style.style = "dashed";
  53377. break;
  53378. case "dotted":
  53379. style.style = "dotted";
  53380. break;
  53381. case "embossed":
  53382. style.style = "ridge";
  53383. break;
  53384. case "etched":
  53385. style.style = "groove";
  53386. break;
  53387. case "lowered":
  53388. style.style = "inset";
  53389. break;
  53390. case "raised":
  53391. style.style = "outset";
  53392. break;
  53393. }
  53394. }
  53395. return style;
  53396. }
  53397. }
  53398. class Encoding extends _xfa_object.OptionObject {
  53399. constructor(attributes) {
  53400. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  53401. this.id = attributes.id || "";
  53402. this.use = attributes.use || "";
  53403. this.usehref = attributes.usehref || "";
  53404. }
  53405. }
  53406. class Encodings extends _xfa_object.XFAObject {
  53407. constructor(attributes) {
  53408. super(TEMPLATE_NS_ID, "encodings", true);
  53409. this.id = attributes.id || "";
  53410. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53411. this.use = attributes.use || "";
  53412. this.usehref = attributes.usehref || "";
  53413. this.encoding = new _xfa_object.XFAObjectArray();
  53414. }
  53415. }
  53416. class Encrypt extends _xfa_object.XFAObject {
  53417. constructor(attributes) {
  53418. super(TEMPLATE_NS_ID, "encrypt", true);
  53419. this.id = attributes.id || "";
  53420. this.use = attributes.use || "";
  53421. this.usehref = attributes.usehref || "";
  53422. this.certificate = null;
  53423. }
  53424. }
  53425. class EncryptData extends _xfa_object.XFAObject {
  53426. constructor(attributes) {
  53427. super(TEMPLATE_NS_ID, "encryptData", true);
  53428. this.id = attributes.id || "";
  53429. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  53430. this.target = attributes.target || "";
  53431. this.use = attributes.use || "";
  53432. this.usehref = attributes.usehref || "";
  53433. this.filter = null;
  53434. this.manifest = null;
  53435. }
  53436. }
  53437. class Encryption extends _xfa_object.XFAObject {
  53438. constructor(attributes) {
  53439. super(TEMPLATE_NS_ID, "encryption", true);
  53440. this.id = attributes.id || "";
  53441. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53442. this.use = attributes.use || "";
  53443. this.usehref = attributes.usehref || "";
  53444. this.certificate = new _xfa_object.XFAObjectArray();
  53445. }
  53446. }
  53447. class EncryptionMethod extends _xfa_object.OptionObject {
  53448. constructor(attributes) {
  53449. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  53450. this.id = attributes.id || "";
  53451. this.use = attributes.use || "";
  53452. this.usehref = attributes.usehref || "";
  53453. }
  53454. }
  53455. class EncryptionMethods extends _xfa_object.XFAObject {
  53456. constructor(attributes) {
  53457. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  53458. this.id = attributes.id || "";
  53459. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53460. this.use = attributes.use || "";
  53461. this.usehref = attributes.usehref || "";
  53462. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  53463. }
  53464. }
  53465. class Event extends _xfa_object.XFAObject {
  53466. constructor(attributes) {
  53467. super(TEMPLATE_NS_ID, "event", true);
  53468. 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"]);
  53469. this.id = attributes.id || "";
  53470. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  53471. this.name = attributes.name || "";
  53472. this.ref = attributes.ref || "";
  53473. this.use = attributes.use || "";
  53474. this.usehref = attributes.usehref || "";
  53475. this.extras = null;
  53476. this.encryptData = null;
  53477. this.execute = null;
  53478. this.script = null;
  53479. this.signData = null;
  53480. this.submit = null;
  53481. }
  53482. }
  53483. class ExData extends _xfa_object.ContentObject {
  53484. constructor(attributes) {
  53485. super(TEMPLATE_NS_ID, "exData");
  53486. this.contentType = attributes.contentType || "";
  53487. this.href = attributes.href || "";
  53488. this.id = attributes.id || "";
  53489. this.maxLength = (0, _utils.getInteger)({
  53490. data: attributes.maxLength,
  53491. defaultValue: -1,
  53492. validate: x => x >= -1
  53493. });
  53494. this.name = attributes.name || "";
  53495. this.rid = attributes.rid || "";
  53496. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  53497. this.use = attributes.use || "";
  53498. this.usehref = attributes.usehref || "";
  53499. }
  53500. [_xfa_object.$isCDATAXml]() {
  53501. return this.contentType === "text/html";
  53502. }
  53503. [_xfa_object.$onChild](child) {
  53504. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  53505. this[_xfa_object.$content] = child;
  53506. return true;
  53507. }
  53508. if (this.contentType === "text/xml") {
  53509. this[_xfa_object.$content] = child;
  53510. return true;
  53511. }
  53512. return false;
  53513. }
  53514. [_xfa_object.$toHTML](availableSpace) {
  53515. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  53516. return _utils.HTMLResult.EMPTY;
  53517. }
  53518. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  53519. }
  53520. }
  53521. class ExObject extends _xfa_object.XFAObject {
  53522. constructor(attributes) {
  53523. super(TEMPLATE_NS_ID, "exObject", true);
  53524. this.archive = attributes.archive || "";
  53525. this.classId = attributes.classId || "";
  53526. this.codeBase = attributes.codeBase || "";
  53527. this.codeType = attributes.codeType || "";
  53528. this.id = attributes.id || "";
  53529. this.name = attributes.name || "";
  53530. this.use = attributes.use || "";
  53531. this.usehref = attributes.usehref || "";
  53532. this.extras = null;
  53533. this.boolean = new _xfa_object.XFAObjectArray();
  53534. this.date = new _xfa_object.XFAObjectArray();
  53535. this.dateTime = new _xfa_object.XFAObjectArray();
  53536. this.decimal = new _xfa_object.XFAObjectArray();
  53537. this.exData = new _xfa_object.XFAObjectArray();
  53538. this.exObject = new _xfa_object.XFAObjectArray();
  53539. this.float = new _xfa_object.XFAObjectArray();
  53540. this.image = new _xfa_object.XFAObjectArray();
  53541. this.integer = new _xfa_object.XFAObjectArray();
  53542. this.text = new _xfa_object.XFAObjectArray();
  53543. this.time = new _xfa_object.XFAObjectArray();
  53544. }
  53545. }
  53546. class ExclGroup extends _xfa_object.XFAObject {
  53547. constructor(attributes) {
  53548. super(TEMPLATE_NS_ID, "exclGroup", true);
  53549. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53550. this.accessKey = attributes.accessKey || "";
  53551. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53552. this.colSpan = (0, _utils.getInteger)({
  53553. data: attributes.colSpan,
  53554. defaultValue: 1,
  53555. validate: n => n >= 1 || n === -1
  53556. });
  53557. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53558. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53559. this.id = attributes.id || "";
  53560. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  53561. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53562. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53563. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53564. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53565. this.name = attributes.name || "";
  53566. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53567. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53568. this.use = attributes.use || "";
  53569. this.usehref = attributes.usehref || "";
  53570. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53571. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53572. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53573. this.assist = null;
  53574. this.bind = null;
  53575. this.border = null;
  53576. this.calculate = null;
  53577. this.caption = null;
  53578. this.desc = null;
  53579. this.extras = null;
  53580. this.margin = null;
  53581. this.para = null;
  53582. this.traversal = null;
  53583. this.validate = null;
  53584. this.connect = new _xfa_object.XFAObjectArray();
  53585. this.event = new _xfa_object.XFAObjectArray();
  53586. this.field = new _xfa_object.XFAObjectArray();
  53587. this.setProperty = new _xfa_object.XFAObjectArray();
  53588. }
  53589. [_xfa_object.$isBindable]() {
  53590. return true;
  53591. }
  53592. [_xfa_object.$hasSettableValue]() {
  53593. return true;
  53594. }
  53595. [_xfa_object.$setValue](value) {
  53596. for (const field of this.field.children) {
  53597. if (!field.value) {
  53598. const nodeValue = new Value({});
  53599. field[_xfa_object.$appendChild](nodeValue);
  53600. field.value = nodeValue;
  53601. }
  53602. field.value[_xfa_object.$setValue](value);
  53603. }
  53604. }
  53605. [_xfa_object.$isThereMoreWidth]() {
  53606. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  53607. }
  53608. [_xfa_object.$isSplittable]() {
  53609. const parent = this[_xfa_object.$getSubformParent]();
  53610. if (!parent[_xfa_object.$isSplittable]()) {
  53611. return false;
  53612. }
  53613. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  53614. return this[_xfa_object.$extra]._isSplittable;
  53615. }
  53616. if (this.layout === "position" || this.layout.includes("row")) {
  53617. this[_xfa_object.$extra]._isSplittable = false;
  53618. return false;
  53619. }
  53620. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  53621. return false;
  53622. }
  53623. this[_xfa_object.$extra]._isSplittable = true;
  53624. return true;
  53625. }
  53626. [_xfa_object.$flushHTML]() {
  53627. return (0, _layout.flushHTML)(this);
  53628. }
  53629. [_xfa_object.$addHTML](html, bbox) {
  53630. (0, _layout.addHTML)(this, html, bbox);
  53631. }
  53632. [_xfa_object.$getAvailableSpace]() {
  53633. return (0, _layout.getAvailableSpace)(this);
  53634. }
  53635. [_xfa_object.$toHTML](availableSpace) {
  53636. setTabIndex(this);
  53637. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  53638. return _utils.HTMLResult.EMPTY;
  53639. }
  53640. (0, _html_utils.fixDimensions)(this);
  53641. const children = [];
  53642. const attributes = {
  53643. id: this[_xfa_object.$uid],
  53644. class: []
  53645. };
  53646. (0, _html_utils.setAccess)(this, attributes.class);
  53647. if (!this[_xfa_object.$extra]) {
  53648. this[_xfa_object.$extra] = Object.create(null);
  53649. }
  53650. Object.assign(this[_xfa_object.$extra], {
  53651. children,
  53652. attributes,
  53653. attempt: 0,
  53654. line: null,
  53655. numberInLine: 0,
  53656. availableSpace: {
  53657. width: Math.min(this.w || Infinity, availableSpace.width),
  53658. height: Math.min(this.h || Infinity, availableSpace.height)
  53659. },
  53660. width: 0,
  53661. height: 0,
  53662. prevHeight: 0,
  53663. currentWidth: 0
  53664. });
  53665. const isSplittable = this[_xfa_object.$isSplittable]();
  53666. if (!isSplittable) {
  53667. setFirstUnsplittable(this);
  53668. }
  53669. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53670. return _utils.HTMLResult.FAILURE;
  53671. }
  53672. const filter = new Set(["field"]);
  53673. if (this.layout.includes("row")) {
  53674. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  53675. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  53676. this[_xfa_object.$extra].columnWidths = columnWidths;
  53677. this[_xfa_object.$extra].currentColumn = 0;
  53678. }
  53679. }
  53680. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  53681. const classNames = ["xfaExclgroup"];
  53682. const cl = (0, _html_utils.layoutClass)(this);
  53683. if (cl) {
  53684. classNames.push(cl);
  53685. }
  53686. if ((0, _html_utils.isPrintOnly)(this)) {
  53687. classNames.push("xfaPrintOnly");
  53688. }
  53689. attributes.style = style;
  53690. attributes.class = classNames;
  53691. if (this.name) {
  53692. attributes.xfaName = this.name;
  53693. }
  53694. this[_xfa_object.$pushPara]();
  53695. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  53696. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  53697. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  53698. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  53699. this[_xfa_object.$extra].numberInLine = 0;
  53700. }
  53701. const result = this[_xfa_object.$childrenToHTML]({
  53702. filter,
  53703. include: true
  53704. });
  53705. if (result.success) {
  53706. break;
  53707. }
  53708. if (result.isBreak()) {
  53709. this[_xfa_object.$popPara]();
  53710. return result;
  53711. }
  53712. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  53713. this[_xfa_object.$extra].attempt = maxRun;
  53714. break;
  53715. }
  53716. }
  53717. this[_xfa_object.$popPara]();
  53718. if (!isSplittable) {
  53719. unsetFirstUnsplittable(this);
  53720. }
  53721. if (this[_xfa_object.$extra].attempt === maxRun) {
  53722. if (!isSplittable) {
  53723. delete this[_xfa_object.$extra];
  53724. }
  53725. return _utils.HTMLResult.FAILURE;
  53726. }
  53727. let marginH = 0;
  53728. let marginV = 0;
  53729. if (this.margin) {
  53730. marginH = this.margin.leftInset + this.margin.rightInset;
  53731. marginV = this.margin.topInset + this.margin.bottomInset;
  53732. }
  53733. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  53734. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  53735. const bbox = [this.x, this.y, width, height];
  53736. if (this.w === "") {
  53737. style.width = (0, _html_utils.measureToString)(width);
  53738. }
  53739. if (this.h === "") {
  53740. style.height = (0, _html_utils.measureToString)(height);
  53741. }
  53742. const html = {
  53743. name: "div",
  53744. attributes,
  53745. children
  53746. };
  53747. applyAssist(this, attributes);
  53748. delete this[_xfa_object.$extra];
  53749. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53750. }
  53751. }
  53752. class Execute extends _xfa_object.XFAObject {
  53753. constructor(attributes) {
  53754. super(TEMPLATE_NS_ID, "execute");
  53755. this.connection = attributes.connection || "";
  53756. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  53757. this.id = attributes.id || "";
  53758. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  53759. this.use = attributes.use || "";
  53760. this.usehref = attributes.usehref || "";
  53761. }
  53762. }
  53763. class Extras extends _xfa_object.XFAObject {
  53764. constructor(attributes) {
  53765. super(TEMPLATE_NS_ID, "extras", true);
  53766. this.id = attributes.id || "";
  53767. this.name = attributes.name || "";
  53768. this.use = attributes.use || "";
  53769. this.usehref = attributes.usehref || "";
  53770. this.boolean = new _xfa_object.XFAObjectArray();
  53771. this.date = new _xfa_object.XFAObjectArray();
  53772. this.dateTime = new _xfa_object.XFAObjectArray();
  53773. this.decimal = new _xfa_object.XFAObjectArray();
  53774. this.exData = new _xfa_object.XFAObjectArray();
  53775. this.extras = new _xfa_object.XFAObjectArray();
  53776. this.float = new _xfa_object.XFAObjectArray();
  53777. this.image = new _xfa_object.XFAObjectArray();
  53778. this.integer = new _xfa_object.XFAObjectArray();
  53779. this.text = new _xfa_object.XFAObjectArray();
  53780. this.time = new _xfa_object.XFAObjectArray();
  53781. }
  53782. }
  53783. class Field extends _xfa_object.XFAObject {
  53784. constructor(attributes) {
  53785. super(TEMPLATE_NS_ID, "field", true);
  53786. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53787. this.accessKey = attributes.accessKey || "";
  53788. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53789. this.colSpan = (0, _utils.getInteger)({
  53790. data: attributes.colSpan,
  53791. defaultValue: 1,
  53792. validate: n => n >= 1 || n === -1
  53793. });
  53794. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53795. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53796. this.id = attributes.id || "";
  53797. this.locale = attributes.locale || "";
  53798. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53799. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53800. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53801. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53802. this.name = attributes.name || "";
  53803. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53804. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53805. this.rotate = (0, _utils.getInteger)({
  53806. data: attributes.rotate,
  53807. defaultValue: 0,
  53808. validate: x => x % 90 === 0
  53809. });
  53810. this.use = attributes.use || "";
  53811. this.usehref = attributes.usehref || "";
  53812. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53813. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53814. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53815. this.assist = null;
  53816. this.bind = null;
  53817. this.border = null;
  53818. this.calculate = null;
  53819. this.caption = null;
  53820. this.desc = null;
  53821. this.extras = null;
  53822. this.font = null;
  53823. this.format = null;
  53824. this.items = new _xfa_object.XFAObjectArray(2);
  53825. this.keep = null;
  53826. this.margin = null;
  53827. this.para = null;
  53828. this.traversal = null;
  53829. this.ui = null;
  53830. this.validate = null;
  53831. this.value = null;
  53832. this.bindItems = new _xfa_object.XFAObjectArray();
  53833. this.connect = new _xfa_object.XFAObjectArray();
  53834. this.event = new _xfa_object.XFAObjectArray();
  53835. this.setProperty = new _xfa_object.XFAObjectArray();
  53836. }
  53837. [_xfa_object.$isBindable]() {
  53838. return true;
  53839. }
  53840. [_xfa_object.$setValue](value) {
  53841. _setValue(this, value);
  53842. }
  53843. [_xfa_object.$toHTML](availableSpace) {
  53844. setTabIndex(this);
  53845. if (!this.ui) {
  53846. this.ui = new Ui({});
  53847. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  53848. this[_xfa_object.$appendChild](this.ui);
  53849. let node;
  53850. switch (this.items.children.length) {
  53851. case 0:
  53852. node = new TextEdit({});
  53853. this.ui.textEdit = node;
  53854. break;
  53855. case 1:
  53856. node = new CheckButton({});
  53857. this.ui.checkButton = node;
  53858. break;
  53859. case 2:
  53860. node = new ChoiceList({});
  53861. this.ui.choiceList = node;
  53862. break;
  53863. }
  53864. this.ui[_xfa_object.$appendChild](node);
  53865. }
  53866. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  53867. return _utils.HTMLResult.EMPTY;
  53868. }
  53869. if (this.caption) {
  53870. delete this.caption[_xfa_object.$extra];
  53871. }
  53872. this[_xfa_object.$pushPara]();
  53873. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  53874. const savedW = this.w;
  53875. const savedH = this.h;
  53876. let marginH = 0;
  53877. let marginV = 0;
  53878. if (this.margin) {
  53879. marginH = this.margin.leftInset + this.margin.rightInset;
  53880. marginV = this.margin.topInset + this.margin.bottomInset;
  53881. }
  53882. let borderDims = null;
  53883. if (this.w === "" || this.h === "") {
  53884. let width = null;
  53885. let height = null;
  53886. let uiW = 0;
  53887. let uiH = 0;
  53888. if (this.ui.checkButton) {
  53889. uiW = uiH = this.ui.checkButton.size;
  53890. } else {
  53891. const {
  53892. w,
  53893. h
  53894. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53895. if (w !== null) {
  53896. uiW = w;
  53897. uiH = h;
  53898. } else {
  53899. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  53900. }
  53901. }
  53902. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  53903. uiW += borderDims.w;
  53904. uiH += borderDims.h;
  53905. if (this.caption) {
  53906. const {
  53907. w,
  53908. h,
  53909. isBroken
  53910. } = this.caption[_xfa_object.$getExtra](availableSpace);
  53911. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53912. this[_xfa_object.$popPara]();
  53913. return _utils.HTMLResult.FAILURE;
  53914. }
  53915. width = w;
  53916. height = h;
  53917. switch (this.caption.placement) {
  53918. case "left":
  53919. case "right":
  53920. case "inline":
  53921. width += uiW;
  53922. break;
  53923. case "top":
  53924. case "bottom":
  53925. height += uiH;
  53926. break;
  53927. }
  53928. } else {
  53929. width = uiW;
  53930. height = uiH;
  53931. }
  53932. if (width && this.w === "") {
  53933. width += marginH;
  53934. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  53935. }
  53936. if (height && this.h === "") {
  53937. height += marginV;
  53938. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  53939. }
  53940. }
  53941. this[_xfa_object.$popPara]();
  53942. (0, _html_utils.fixDimensions)(this);
  53943. setFirstUnsplittable(this);
  53944. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53945. this.w = savedW;
  53946. this.h = savedH;
  53947. this[_xfa_object.$popPara]();
  53948. return _utils.HTMLResult.FAILURE;
  53949. }
  53950. unsetFirstUnsplittable(this);
  53951. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  53952. (0, _html_utils.setMinMaxDimensions)(this, style);
  53953. const classNames = ["xfaField"];
  53954. if (this.font) {
  53955. classNames.push("xfaFont");
  53956. }
  53957. if ((0, _html_utils.isPrintOnly)(this)) {
  53958. classNames.push("xfaPrintOnly");
  53959. }
  53960. const attributes = {
  53961. style,
  53962. id: this[_xfa_object.$uid],
  53963. class: classNames
  53964. };
  53965. if (style.margin) {
  53966. style.padding = style.margin;
  53967. delete style.margin;
  53968. }
  53969. (0, _html_utils.setAccess)(this, classNames);
  53970. if (this.name) {
  53971. attributes.xfaName = this.name;
  53972. }
  53973. const children = [];
  53974. const html = {
  53975. name: "div",
  53976. attributes,
  53977. children
  53978. };
  53979. applyAssist(this, attributes);
  53980. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  53981. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53982. const ui = this.ui[_xfa_object.$toHTML]().html;
  53983. if (!ui) {
  53984. Object.assign(style, borderStyle);
  53985. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53986. }
  53987. if (this[_xfa_object.$tabIndex]) {
  53988. if (ui.children && ui.children[0]) {
  53989. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  53990. } else {
  53991. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  53992. }
  53993. }
  53994. if (!ui.attributes.style) {
  53995. ui.attributes.style = Object.create(null);
  53996. }
  53997. let aElement = null;
  53998. if (this.ui.button) {
  53999. if (ui.children.length === 1) {
  54000. [aElement] = ui.children.splice(0, 1);
  54001. }
  54002. Object.assign(ui.attributes.style, borderStyle);
  54003. } else {
  54004. Object.assign(style, borderStyle);
  54005. }
  54006. children.push(ui);
  54007. if (this.value) {
  54008. if (this.ui.imageEdit) {
  54009. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  54010. } else if (!this.ui.button) {
  54011. let value = "";
  54012. if (this.value.exData) {
  54013. value = this.value.exData[_xfa_object.$text]();
  54014. } else if (this.value.text) {
  54015. value = this.value.text[_xfa_object.$getExtra]();
  54016. } else {
  54017. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  54018. if (htmlValue !== null) {
  54019. value = htmlValue.children[0].value;
  54020. }
  54021. }
  54022. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  54023. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  54024. }
  54025. if (value) {
  54026. if (this.ui.numericEdit) {
  54027. value = parseFloat(value);
  54028. value = isNaN(value) ? "" : value.toString();
  54029. }
  54030. if (ui.children[0].name === "textarea") {
  54031. ui.children[0].attributes.textContent = value;
  54032. } else {
  54033. ui.children[0].attributes.value = value;
  54034. }
  54035. }
  54036. }
  54037. }
  54038. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  54039. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  54040. let captionHeight = 0;
  54041. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  54042. captionHeight = this.caption.reserve;
  54043. if (captionHeight <= 0) {
  54044. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  54045. }
  54046. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  54047. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  54048. } else {
  54049. ui.children[0].attributes.style.height = "100%";
  54050. }
  54051. }
  54052. if (aElement) {
  54053. ui.children.push(aElement);
  54054. }
  54055. if (!caption) {
  54056. if (ui.attributes.class) {
  54057. ui.attributes.class.push("xfaLeft");
  54058. }
  54059. this.w = savedW;
  54060. this.h = savedH;
  54061. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54062. }
  54063. if (this.ui.button) {
  54064. if (style.padding) {
  54065. delete style.padding;
  54066. }
  54067. if (caption.name === "div") {
  54068. caption.name = "span";
  54069. }
  54070. ui.children.push(caption);
  54071. return _utils.HTMLResult.success(html, bbox);
  54072. } else if (this.ui.checkButton) {
  54073. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  54074. }
  54075. if (!ui.attributes.class) {
  54076. ui.attributes.class = [];
  54077. }
  54078. ui.children.splice(0, 0, caption);
  54079. switch (this.caption.placement) {
  54080. case "left":
  54081. ui.attributes.class.push("xfaLeft");
  54082. break;
  54083. case "right":
  54084. ui.attributes.class.push("xfaRight");
  54085. break;
  54086. case "top":
  54087. ui.attributes.class.push("xfaTop");
  54088. break;
  54089. case "bottom":
  54090. ui.attributes.class.push("xfaBottom");
  54091. break;
  54092. case "inline":
  54093. ui.attributes.class.push("xfaLeft");
  54094. break;
  54095. }
  54096. this.w = savedW;
  54097. this.h = savedH;
  54098. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54099. }
  54100. }
  54101. exports.Field = Field;
  54102. class Fill extends _xfa_object.XFAObject {
  54103. constructor(attributes) {
  54104. super(TEMPLATE_NS_ID, "fill", true);
  54105. this.id = attributes.id || "";
  54106. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54107. this.use = attributes.use || "";
  54108. this.usehref = attributes.usehref || "";
  54109. this.color = null;
  54110. this.extras = null;
  54111. this.linear = null;
  54112. this.pattern = null;
  54113. this.radial = null;
  54114. this.solid = null;
  54115. this.stipple = null;
  54116. }
  54117. [_xfa_object.$toStyle]() {
  54118. const parent = this[_xfa_object.$getParent]();
  54119. const grandpa = parent[_xfa_object.$getParent]();
  54120. const ggrandpa = grandpa[_xfa_object.$getParent]();
  54121. const style = Object.create(null);
  54122. let propName = "color";
  54123. let altPropName = propName;
  54124. if (parent instanceof Border) {
  54125. propName = "background-color";
  54126. altPropName = "background";
  54127. if (ggrandpa instanceof Ui) {
  54128. style.backgroundColor = "white";
  54129. }
  54130. }
  54131. if (parent instanceof Rectangle || parent instanceof Arc) {
  54132. propName = altPropName = "fill";
  54133. style.fill = "white";
  54134. }
  54135. for (const name of Object.getOwnPropertyNames(this)) {
  54136. if (name === "extras" || name === "color") {
  54137. continue;
  54138. }
  54139. const obj = this[name];
  54140. if (!(obj instanceof _xfa_object.XFAObject)) {
  54141. continue;
  54142. }
  54143. const color = obj[_xfa_object.$toStyle](this.color);
  54144. if (color) {
  54145. style[color.startsWith("#") ? propName : altPropName] = color;
  54146. }
  54147. return style;
  54148. }
  54149. if (this.color && this.color.value) {
  54150. const color = this.color[_xfa_object.$toStyle]();
  54151. style[color.startsWith("#") ? propName : altPropName] = color;
  54152. }
  54153. return style;
  54154. }
  54155. }
  54156. class Filter extends _xfa_object.XFAObject {
  54157. constructor(attributes) {
  54158. super(TEMPLATE_NS_ID, "filter", true);
  54159. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  54160. this.id = attributes.id || "";
  54161. this.name = attributes.name || "";
  54162. this.use = attributes.use || "";
  54163. this.usehref = attributes.usehref || "";
  54164. this.version = (0, _utils.getInteger)({
  54165. data: this.version,
  54166. defaultValue: 5,
  54167. validate: x => x >= 1 && x <= 5
  54168. });
  54169. this.appearanceFilter = null;
  54170. this.certificates = null;
  54171. this.digestMethods = null;
  54172. this.encodings = null;
  54173. this.encryptionMethods = null;
  54174. this.handler = null;
  54175. this.lockDocument = null;
  54176. this.mdp = null;
  54177. this.reasons = null;
  54178. this.timeStamp = null;
  54179. }
  54180. }
  54181. class Float extends _xfa_object.ContentObject {
  54182. constructor(attributes) {
  54183. super(TEMPLATE_NS_ID, "float");
  54184. this.id = attributes.id || "";
  54185. this.name = attributes.name || "";
  54186. this.use = attributes.use || "";
  54187. this.usehref = attributes.usehref || "";
  54188. }
  54189. [_xfa_object.$finalize]() {
  54190. const number = parseFloat(this[_xfa_object.$content].trim());
  54191. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54192. }
  54193. [_xfa_object.$toHTML](availableSpace) {
  54194. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54195. }
  54196. }
  54197. class Font extends _xfa_object.XFAObject {
  54198. constructor(attributes) {
  54199. super(TEMPLATE_NS_ID, "font", true);
  54200. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  54201. this.fontHorizontalScale = (0, _utils.getFloat)({
  54202. data: attributes.fontHorizontalScale,
  54203. defaultValue: 100,
  54204. validate: x => x >= 0
  54205. });
  54206. this.fontVerticalScale = (0, _utils.getFloat)({
  54207. data: attributes.fontVerticalScale,
  54208. defaultValue: 100,
  54209. validate: x => x >= 0
  54210. });
  54211. this.id = attributes.id || "";
  54212. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  54213. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  54214. this.lineThrough = (0, _utils.getInteger)({
  54215. data: attributes.lineThrough,
  54216. defaultValue: 0,
  54217. validate: x => x === 1 || x === 2
  54218. });
  54219. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  54220. this.overline = (0, _utils.getInteger)({
  54221. data: attributes.overline,
  54222. defaultValue: 0,
  54223. validate: x => x === 1 || x === 2
  54224. });
  54225. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  54226. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  54227. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54228. this.typeface = attributes.typeface || "Courier";
  54229. this.underline = (0, _utils.getInteger)({
  54230. data: attributes.underline,
  54231. defaultValue: 0,
  54232. validate: x => x === 1 || x === 2
  54233. });
  54234. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  54235. this.use = attributes.use || "";
  54236. this.usehref = attributes.usehref || "";
  54237. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  54238. this.extras = null;
  54239. this.fill = null;
  54240. }
  54241. [_xfa_object.$clean](builder) {
  54242. super[_xfa_object.$clean](builder);
  54243. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  54244. }
  54245. [_xfa_object.$toStyle]() {
  54246. const style = (0, _html_utils.toStyle)(this, "fill");
  54247. const color = style.color;
  54248. if (color) {
  54249. if (color === "#000000") {
  54250. delete style.color;
  54251. } else if (!color.startsWith("#")) {
  54252. style.background = color;
  54253. style.backgroundClip = "text";
  54254. style.color = "transparent";
  54255. }
  54256. }
  54257. if (this.baselineShift) {
  54258. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  54259. }
  54260. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  54261. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  54262. if (this.lineThrough !== 0) {
  54263. style.textDecoration = "line-through";
  54264. if (this.lineThrough === 2) {
  54265. style.textDecorationStyle = "double";
  54266. }
  54267. }
  54268. if (this.overline !== 0) {
  54269. style.textDecoration = "overline";
  54270. if (this.overline === 2) {
  54271. style.textDecorationStyle = "double";
  54272. }
  54273. }
  54274. style.fontStyle = this.posture;
  54275. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  54276. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  54277. if (this.underline !== 0) {
  54278. style.textDecoration = "underline";
  54279. if (this.underline === 2) {
  54280. style.textDecorationStyle = "double";
  54281. }
  54282. }
  54283. style.fontWeight = this.weight;
  54284. return style;
  54285. }
  54286. }
  54287. class Format extends _xfa_object.XFAObject {
  54288. constructor(attributes) {
  54289. super(TEMPLATE_NS_ID, "format", true);
  54290. this.id = attributes.id || "";
  54291. this.use = attributes.use || "";
  54292. this.usehref = attributes.usehref || "";
  54293. this.extras = null;
  54294. this.picture = null;
  54295. }
  54296. }
  54297. class Handler extends _xfa_object.StringObject {
  54298. constructor(attributes) {
  54299. super(TEMPLATE_NS_ID, "handler");
  54300. this.id = attributes.id || "";
  54301. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54302. this.use = attributes.use || "";
  54303. this.usehref = attributes.usehref || "";
  54304. }
  54305. }
  54306. class Hyphenation extends _xfa_object.XFAObject {
  54307. constructor(attributes) {
  54308. super(TEMPLATE_NS_ID, "hyphenation");
  54309. this.excludeAllCaps = (0, _utils.getInteger)({
  54310. data: attributes.excludeAllCaps,
  54311. defaultValue: 0,
  54312. validate: x => x === 1
  54313. });
  54314. this.excludeInitialCap = (0, _utils.getInteger)({
  54315. data: attributes.excludeInitialCap,
  54316. defaultValue: 0,
  54317. validate: x => x === 1
  54318. });
  54319. this.hyphenate = (0, _utils.getInteger)({
  54320. data: attributes.hyphenate,
  54321. defaultValue: 0,
  54322. validate: x => x === 1
  54323. });
  54324. this.id = attributes.id || "";
  54325. this.pushCharacterCount = (0, _utils.getInteger)({
  54326. data: attributes.pushCharacterCount,
  54327. defaultValue: 3,
  54328. validate: x => x >= 0
  54329. });
  54330. this.remainCharacterCount = (0, _utils.getInteger)({
  54331. data: attributes.remainCharacterCount,
  54332. defaultValue: 3,
  54333. validate: x => x >= 0
  54334. });
  54335. this.use = attributes.use || "";
  54336. this.usehref = attributes.usehref || "";
  54337. this.wordCharacterCount = (0, _utils.getInteger)({
  54338. data: attributes.wordCharacterCount,
  54339. defaultValue: 7,
  54340. validate: x => x >= 0
  54341. });
  54342. }
  54343. }
  54344. class Image extends _xfa_object.StringObject {
  54345. constructor(attributes) {
  54346. super(TEMPLATE_NS_ID, "image");
  54347. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  54348. this.contentType = attributes.contentType || "";
  54349. this.href = attributes.href || "";
  54350. this.id = attributes.id || "";
  54351. this.name = attributes.name || "";
  54352. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  54353. this.use = attributes.use || "";
  54354. this.usehref = attributes.usehref || "";
  54355. }
  54356. [_xfa_object.$toHTML]() {
  54357. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  54358. return _utils.HTMLResult.EMPTY;
  54359. }
  54360. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  54361. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  54362. return _utils.HTMLResult.EMPTY;
  54363. }
  54364. if (!buffer && this.transferEncoding === "base64") {
  54365. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  54366. }
  54367. if (!buffer) {
  54368. return _utils.HTMLResult.EMPTY;
  54369. }
  54370. if (!this.contentType) {
  54371. for (const [header, type] of IMAGES_HEADERS) {
  54372. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  54373. this.contentType = type;
  54374. break;
  54375. }
  54376. }
  54377. if (!this.contentType) {
  54378. return _utils.HTMLResult.EMPTY;
  54379. }
  54380. }
  54381. const blob = new Blob([buffer], {
  54382. type: this.contentType
  54383. });
  54384. let style;
  54385. switch (this.aspect) {
  54386. case "fit":
  54387. case "actual":
  54388. break;
  54389. case "height":
  54390. style = {
  54391. height: "100%",
  54392. objectFit: "fill"
  54393. };
  54394. break;
  54395. case "none":
  54396. style = {
  54397. width: "100%",
  54398. height: "100%",
  54399. objectFit: "fill"
  54400. };
  54401. break;
  54402. case "width":
  54403. style = {
  54404. width: "100%",
  54405. objectFit: "fill"
  54406. };
  54407. break;
  54408. }
  54409. const parent = this[_xfa_object.$getParent]();
  54410. return _utils.HTMLResult.success({
  54411. name: "img",
  54412. attributes: {
  54413. class: ["xfaImage"],
  54414. style,
  54415. src: URL.createObjectURL(blob),
  54416. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  54417. }
  54418. });
  54419. }
  54420. }
  54421. class ImageEdit extends _xfa_object.XFAObject {
  54422. constructor(attributes) {
  54423. super(TEMPLATE_NS_ID, "imageEdit", true);
  54424. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  54425. this.id = attributes.id || "";
  54426. this.use = attributes.use || "";
  54427. this.usehref = attributes.usehref || "";
  54428. this.border = null;
  54429. this.extras = null;
  54430. this.margin = null;
  54431. }
  54432. [_xfa_object.$toHTML](availableSpace) {
  54433. if (this.data === "embed") {
  54434. return _utils.HTMLResult.success({
  54435. name: "div",
  54436. children: [],
  54437. attributes: {}
  54438. });
  54439. }
  54440. return _utils.HTMLResult.EMPTY;
  54441. }
  54442. }
  54443. class Integer extends _xfa_object.ContentObject {
  54444. constructor(attributes) {
  54445. super(TEMPLATE_NS_ID, "integer");
  54446. this.id = attributes.id || "";
  54447. this.name = attributes.name || "";
  54448. this.use = attributes.use || "";
  54449. this.usehref = attributes.usehref || "";
  54450. }
  54451. [_xfa_object.$finalize]() {
  54452. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  54453. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54454. }
  54455. [_xfa_object.$toHTML](availableSpace) {
  54456. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54457. }
  54458. }
  54459. class Issuers extends _xfa_object.XFAObject {
  54460. constructor(attributes) {
  54461. super(TEMPLATE_NS_ID, "issuers", true);
  54462. this.id = attributes.id || "";
  54463. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54464. this.use = attributes.use || "";
  54465. this.usehref = attributes.usehref || "";
  54466. this.certificate = new _xfa_object.XFAObjectArray();
  54467. }
  54468. }
  54469. class Items extends _xfa_object.XFAObject {
  54470. constructor(attributes) {
  54471. super(TEMPLATE_NS_ID, "items", true);
  54472. this.id = attributes.id || "";
  54473. this.name = attributes.name || "";
  54474. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54475. this.ref = attributes.ref || "";
  54476. this.save = (0, _utils.getInteger)({
  54477. data: attributes.save,
  54478. defaultValue: 0,
  54479. validate: x => x === 1
  54480. });
  54481. this.use = attributes.use || "";
  54482. this.usehref = attributes.usehref || "";
  54483. this.boolean = new _xfa_object.XFAObjectArray();
  54484. this.date = new _xfa_object.XFAObjectArray();
  54485. this.dateTime = new _xfa_object.XFAObjectArray();
  54486. this.decimal = new _xfa_object.XFAObjectArray();
  54487. this.exData = new _xfa_object.XFAObjectArray();
  54488. this.float = new _xfa_object.XFAObjectArray();
  54489. this.image = new _xfa_object.XFAObjectArray();
  54490. this.integer = new _xfa_object.XFAObjectArray();
  54491. this.text = new _xfa_object.XFAObjectArray();
  54492. this.time = new _xfa_object.XFAObjectArray();
  54493. }
  54494. [_xfa_object.$toHTML]() {
  54495. const output = [];
  54496. for (const child of this[_xfa_object.$getChildren]()) {
  54497. output.push(child[_xfa_object.$text]());
  54498. }
  54499. return _utils.HTMLResult.success(output);
  54500. }
  54501. }
  54502. exports.Items = Items;
  54503. class Keep extends _xfa_object.XFAObject {
  54504. constructor(attributes) {
  54505. super(TEMPLATE_NS_ID, "keep", true);
  54506. this.id = attributes.id || "";
  54507. const options = ["none", "contentArea", "pageArea"];
  54508. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  54509. this.next = (0, _utils.getStringOption)(attributes.next, options);
  54510. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  54511. this.use = attributes.use || "";
  54512. this.usehref = attributes.usehref || "";
  54513. this.extras = null;
  54514. }
  54515. }
  54516. class KeyUsage extends _xfa_object.XFAObject {
  54517. constructor(attributes) {
  54518. super(TEMPLATE_NS_ID, "keyUsage");
  54519. const options = ["", "yes", "no"];
  54520. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  54521. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  54522. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  54523. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  54524. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  54525. this.id = attributes.id || "";
  54526. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  54527. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  54528. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  54529. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  54530. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54531. this.use = attributes.use || "";
  54532. this.usehref = attributes.usehref || "";
  54533. }
  54534. }
  54535. class Line extends _xfa_object.XFAObject {
  54536. constructor(attributes) {
  54537. super(TEMPLATE_NS_ID, "line", true);
  54538. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54539. this.id = attributes.id || "";
  54540. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  54541. this.use = attributes.use || "";
  54542. this.usehref = attributes.usehref || "";
  54543. this.edge = null;
  54544. }
  54545. [_xfa_object.$toHTML]() {
  54546. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54547. const edge = this.edge ? this.edge : new Edge({});
  54548. const edgeStyle = edge[_xfa_object.$toStyle]();
  54549. const style = Object.create(null);
  54550. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  54551. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  54552. style.stroke = edgeStyle.color;
  54553. let x1, y1, x2, y2;
  54554. let width = "100%";
  54555. let height = "100%";
  54556. if (parent.w <= thickness) {
  54557. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  54558. width = style.strokeWidth;
  54559. } else if (parent.h <= thickness) {
  54560. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  54561. height = style.strokeWidth;
  54562. } else {
  54563. if (this.slope === "\\") {
  54564. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  54565. } else {
  54566. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  54567. }
  54568. }
  54569. const line = {
  54570. name: "line",
  54571. attributes: {
  54572. xmlns: SVG_NS,
  54573. x1,
  54574. y1,
  54575. x2,
  54576. y2,
  54577. style
  54578. }
  54579. };
  54580. const svg = {
  54581. name: "svg",
  54582. children: [line],
  54583. attributes: {
  54584. xmlns: SVG_NS,
  54585. width,
  54586. height,
  54587. style: {
  54588. overflow: "visible"
  54589. }
  54590. }
  54591. };
  54592. if (hasMargin(parent)) {
  54593. return _utils.HTMLResult.success({
  54594. name: "div",
  54595. attributes: {
  54596. style: {
  54597. display: "inline",
  54598. width: "100%",
  54599. height: "100%"
  54600. }
  54601. },
  54602. children: [svg]
  54603. });
  54604. }
  54605. svg.attributes.style.position = "absolute";
  54606. return _utils.HTMLResult.success(svg);
  54607. }
  54608. }
  54609. class Linear extends _xfa_object.XFAObject {
  54610. constructor(attributes) {
  54611. super(TEMPLATE_NS_ID, "linear", true);
  54612. this.id = attributes.id || "";
  54613. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  54614. this.use = attributes.use || "";
  54615. this.usehref = attributes.usehref || "";
  54616. this.color = null;
  54617. this.extras = null;
  54618. }
  54619. [_xfa_object.$toStyle](startColor) {
  54620. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54621. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  54622. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54623. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  54624. }
  54625. }
  54626. class LockDocument extends _xfa_object.ContentObject {
  54627. constructor(attributes) {
  54628. super(TEMPLATE_NS_ID, "lockDocument");
  54629. this.id = attributes.id || "";
  54630. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54631. this.use = attributes.use || "";
  54632. this.usehref = attributes.usehref || "";
  54633. }
  54634. [_xfa_object.$finalize]() {
  54635. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  54636. }
  54637. }
  54638. class Manifest extends _xfa_object.XFAObject {
  54639. constructor(attributes) {
  54640. super(TEMPLATE_NS_ID, "manifest", true);
  54641. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  54642. this.id = attributes.id || "";
  54643. this.name = attributes.name || "";
  54644. this.use = attributes.use || "";
  54645. this.usehref = attributes.usehref || "";
  54646. this.extras = null;
  54647. this.ref = new _xfa_object.XFAObjectArray();
  54648. }
  54649. }
  54650. class Margin extends _xfa_object.XFAObject {
  54651. constructor(attributes) {
  54652. super(TEMPLATE_NS_ID, "margin", true);
  54653. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  54654. this.id = attributes.id || "";
  54655. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  54656. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  54657. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  54658. this.use = attributes.use || "";
  54659. this.usehref = attributes.usehref || "";
  54660. this.extras = null;
  54661. }
  54662. [_xfa_object.$toStyle]() {
  54663. return {
  54664. 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)
  54665. };
  54666. }
  54667. }
  54668. class Mdp extends _xfa_object.XFAObject {
  54669. constructor(attributes) {
  54670. super(TEMPLATE_NS_ID, "mdp");
  54671. this.id = attributes.id || "";
  54672. this.permissions = (0, _utils.getInteger)({
  54673. data: attributes.permissions,
  54674. defaultValue: 2,
  54675. validate: x => x === 1 || x === 3
  54676. });
  54677. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  54678. this.use = attributes.use || "";
  54679. this.usehref = attributes.usehref || "";
  54680. }
  54681. }
  54682. class Medium extends _xfa_object.XFAObject {
  54683. constructor(attributes) {
  54684. super(TEMPLATE_NS_ID, "medium");
  54685. this.id = attributes.id || "";
  54686. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  54687. this.long = (0, _utils.getMeasurement)(attributes.long);
  54688. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  54689. this.short = (0, _utils.getMeasurement)(attributes.short);
  54690. this.stock = attributes.stock || "";
  54691. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  54692. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  54693. this.use = attributes.use || "";
  54694. this.usehref = attributes.usehref || "";
  54695. }
  54696. }
  54697. class Message extends _xfa_object.XFAObject {
  54698. constructor(attributes) {
  54699. super(TEMPLATE_NS_ID, "message", true);
  54700. this.id = attributes.id || "";
  54701. this.use = attributes.use || "";
  54702. this.usehref = attributes.usehref || "";
  54703. this.text = new _xfa_object.XFAObjectArray();
  54704. }
  54705. }
  54706. class NumericEdit extends _xfa_object.XFAObject {
  54707. constructor(attributes) {
  54708. super(TEMPLATE_NS_ID, "numericEdit", true);
  54709. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54710. this.id = attributes.id || "";
  54711. this.use = attributes.use || "";
  54712. this.usehref = attributes.usehref || "";
  54713. this.border = null;
  54714. this.comb = null;
  54715. this.extras = null;
  54716. this.margin = null;
  54717. }
  54718. [_xfa_object.$toHTML](availableSpace) {
  54719. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54720. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54721. const html = {
  54722. name: "input",
  54723. attributes: {
  54724. type: "text",
  54725. fieldId: field[_xfa_object.$uid],
  54726. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54727. class: ["xfaTextfield"],
  54728. style,
  54729. "aria-label": ariaLabel(field)
  54730. }
  54731. };
  54732. return _utils.HTMLResult.success({
  54733. name: "label",
  54734. attributes: {
  54735. class: ["xfaLabel"]
  54736. },
  54737. children: [html]
  54738. });
  54739. }
  54740. }
  54741. class Occur extends _xfa_object.XFAObject {
  54742. constructor(attributes) {
  54743. super(TEMPLATE_NS_ID, "occur", true);
  54744. this.id = attributes.id || "";
  54745. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  54746. data: attributes.initial,
  54747. defaultValue: "",
  54748. validate: x => true
  54749. }) : "";
  54750. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  54751. data: attributes.max,
  54752. defaultValue: 1,
  54753. validate: x => true
  54754. }) : "";
  54755. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  54756. data: attributes.min,
  54757. defaultValue: 1,
  54758. validate: x => true
  54759. }) : "";
  54760. this.use = attributes.use || "";
  54761. this.usehref = attributes.usehref || "";
  54762. this.extras = null;
  54763. }
  54764. [_xfa_object.$clean]() {
  54765. const parent = this[_xfa_object.$getParent]();
  54766. const originalMin = this.min;
  54767. if (this.min === "") {
  54768. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  54769. }
  54770. if (this.max === "") {
  54771. if (originalMin === "") {
  54772. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  54773. } else {
  54774. this.max = this.min;
  54775. }
  54776. }
  54777. if (this.max !== -1 && this.max < this.min) {
  54778. this.max = this.min;
  54779. }
  54780. if (this.initial === "") {
  54781. this.initial = parent instanceof Template ? 1 : this.min;
  54782. }
  54783. }
  54784. }
  54785. class Oid extends _xfa_object.StringObject {
  54786. constructor(attributes) {
  54787. super(TEMPLATE_NS_ID, "oid");
  54788. this.id = attributes.id || "";
  54789. this.name = attributes.name || "";
  54790. this.use = attributes.use || "";
  54791. this.usehref = attributes.usehref || "";
  54792. }
  54793. }
  54794. class Oids extends _xfa_object.XFAObject {
  54795. constructor(attributes) {
  54796. super(TEMPLATE_NS_ID, "oids", true);
  54797. this.id = attributes.id || "";
  54798. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54799. this.use = attributes.use || "";
  54800. this.usehref = attributes.usehref || "";
  54801. this.oid = new _xfa_object.XFAObjectArray();
  54802. }
  54803. }
  54804. class Overflow extends _xfa_object.XFAObject {
  54805. constructor(attributes) {
  54806. super(TEMPLATE_NS_ID, "overflow");
  54807. this.id = attributes.id || "";
  54808. this.leader = attributes.leader || "";
  54809. this.target = attributes.target || "";
  54810. this.trailer = attributes.trailer || "";
  54811. this.use = attributes.use || "";
  54812. this.usehref = attributes.usehref || "";
  54813. }
  54814. [_xfa_object.$getExtra]() {
  54815. if (!this[_xfa_object.$extra]) {
  54816. const parent = this[_xfa_object.$getParent]();
  54817. const root = this[_xfa_object.$getTemplateRoot]();
  54818. const target = root[_xfa_object.$searchNode](this.target, parent);
  54819. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  54820. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  54821. this[_xfa_object.$extra] = {
  54822. target: target && target[0] || null,
  54823. leader: leader && leader[0] || null,
  54824. trailer: trailer && trailer[0] || null,
  54825. addLeader: false,
  54826. addTrailer: false
  54827. };
  54828. }
  54829. return this[_xfa_object.$extra];
  54830. }
  54831. }
  54832. class PageArea extends _xfa_object.XFAObject {
  54833. constructor(attributes) {
  54834. super(TEMPLATE_NS_ID, "pageArea", true);
  54835. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  54836. this.id = attributes.id || "";
  54837. this.initialNumber = (0, _utils.getInteger)({
  54838. data: attributes.initialNumber,
  54839. defaultValue: 1,
  54840. validate: x => true
  54841. });
  54842. this.name = attributes.name || "";
  54843. this.numbered = (0, _utils.getInteger)({
  54844. data: attributes.numbered,
  54845. defaultValue: 1,
  54846. validate: x => true
  54847. });
  54848. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  54849. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  54850. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54851. this.use = attributes.use || "";
  54852. this.usehref = attributes.usehref || "";
  54853. this.desc = null;
  54854. this.extras = null;
  54855. this.medium = null;
  54856. this.occur = null;
  54857. this.area = new _xfa_object.XFAObjectArray();
  54858. this.contentArea = new _xfa_object.XFAObjectArray();
  54859. this.draw = new _xfa_object.XFAObjectArray();
  54860. this.exclGroup = new _xfa_object.XFAObjectArray();
  54861. this.field = new _xfa_object.XFAObjectArray();
  54862. this.subform = new _xfa_object.XFAObjectArray();
  54863. }
  54864. [_xfa_object.$isUsable]() {
  54865. if (!this[_xfa_object.$extra]) {
  54866. this[_xfa_object.$extra] = {
  54867. numberOfUse: 0
  54868. };
  54869. return true;
  54870. }
  54871. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  54872. }
  54873. [_xfa_object.$cleanPage]() {
  54874. delete this[_xfa_object.$extra];
  54875. }
  54876. [_xfa_object.$getNextPage]() {
  54877. if (!this[_xfa_object.$extra]) {
  54878. this[_xfa_object.$extra] = {
  54879. numberOfUse: 0
  54880. };
  54881. }
  54882. const parent = this[_xfa_object.$getParent]();
  54883. if (parent.relation === "orderedOccurrence") {
  54884. if (this[_xfa_object.$isUsable]()) {
  54885. this[_xfa_object.$extra].numberOfUse += 1;
  54886. return this;
  54887. }
  54888. }
  54889. return parent[_xfa_object.$getNextPage]();
  54890. }
  54891. [_xfa_object.$getAvailableSpace]() {
  54892. return this[_xfa_object.$extra].space || {
  54893. width: 0,
  54894. height: 0
  54895. };
  54896. }
  54897. [_xfa_object.$toHTML]() {
  54898. if (!this[_xfa_object.$extra]) {
  54899. this[_xfa_object.$extra] = {
  54900. numberOfUse: 1
  54901. };
  54902. }
  54903. const children = [];
  54904. this[_xfa_object.$extra].children = children;
  54905. const style = Object.create(null);
  54906. if (this.medium && this.medium.short && this.medium.long) {
  54907. style.width = (0, _html_utils.measureToString)(this.medium.short);
  54908. style.height = (0, _html_utils.measureToString)(this.medium.long);
  54909. this[_xfa_object.$extra].space = {
  54910. width: this.medium.short,
  54911. height: this.medium.long
  54912. };
  54913. if (this.medium.orientation === "landscape") {
  54914. const x = style.width;
  54915. style.width = style.height;
  54916. style.height = x;
  54917. this[_xfa_object.$extra].space = {
  54918. width: this.medium.long,
  54919. height: this.medium.short
  54920. };
  54921. }
  54922. } else {
  54923. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  54924. }
  54925. this[_xfa_object.$childrenToHTML]({
  54926. filter: new Set(["area", "draw", "field", "subform"]),
  54927. include: true
  54928. });
  54929. this[_xfa_object.$childrenToHTML]({
  54930. filter: new Set(["contentArea"]),
  54931. include: true
  54932. });
  54933. return _utils.HTMLResult.success({
  54934. name: "div",
  54935. children,
  54936. attributes: {
  54937. class: ["xfaPage"],
  54938. id: this[_xfa_object.$uid],
  54939. style,
  54940. xfaName: this.name
  54941. }
  54942. });
  54943. }
  54944. }
  54945. class PageSet extends _xfa_object.XFAObject {
  54946. constructor(attributes) {
  54947. super(TEMPLATE_NS_ID, "pageSet", true);
  54948. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  54949. this.id = attributes.id || "";
  54950. this.name = attributes.name || "";
  54951. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  54952. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54953. this.use = attributes.use || "";
  54954. this.usehref = attributes.usehref || "";
  54955. this.extras = null;
  54956. this.occur = null;
  54957. this.pageArea = new _xfa_object.XFAObjectArray();
  54958. this.pageSet = new _xfa_object.XFAObjectArray();
  54959. }
  54960. [_xfa_object.$cleanPage]() {
  54961. for (const page of this.pageArea.children) {
  54962. page[_xfa_object.$cleanPage]();
  54963. }
  54964. for (const page of this.pageSet.children) {
  54965. page[_xfa_object.$cleanPage]();
  54966. }
  54967. }
  54968. [_xfa_object.$isUsable]() {
  54969. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  54970. }
  54971. [_xfa_object.$getNextPage]() {
  54972. if (!this[_xfa_object.$extra]) {
  54973. this[_xfa_object.$extra] = {
  54974. numberOfUse: 1,
  54975. pageIndex: -1,
  54976. pageSetIndex: -1
  54977. };
  54978. }
  54979. if (this.relation === "orderedOccurrence") {
  54980. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  54981. this[_xfa_object.$extra].pageIndex += 1;
  54982. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  54983. return pageArea[_xfa_object.$getNextPage]();
  54984. }
  54985. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  54986. this[_xfa_object.$extra].pageSetIndex += 1;
  54987. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  54988. }
  54989. if (this[_xfa_object.$isUsable]()) {
  54990. this[_xfa_object.$extra].numberOfUse += 1;
  54991. this[_xfa_object.$extra].pageIndex = -1;
  54992. this[_xfa_object.$extra].pageSetIndex = -1;
  54993. return this[_xfa_object.$getNextPage]();
  54994. }
  54995. const parent = this[_xfa_object.$getParent]();
  54996. if (parent instanceof PageSet) {
  54997. return parent[_xfa_object.$getNextPage]();
  54998. }
  54999. this[_xfa_object.$cleanPage]();
  55000. return this[_xfa_object.$getNextPage]();
  55001. }
  55002. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  55003. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  55004. const position = pageNumber === 0 ? "first" : "rest";
  55005. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  55006. if (page) {
  55007. return page;
  55008. }
  55009. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  55010. if (page) {
  55011. return page;
  55012. }
  55013. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  55014. if (page) {
  55015. return page;
  55016. }
  55017. return this.pageArea.children[0];
  55018. }
  55019. }
  55020. class Para extends _xfa_object.XFAObject {
  55021. constructor(attributes) {
  55022. super(TEMPLATE_NS_ID, "para", true);
  55023. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55024. this.id = attributes.id || "";
  55025. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  55026. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  55027. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  55028. this.orphans = (0, _utils.getInteger)({
  55029. data: attributes.orphans,
  55030. defaultValue: 0,
  55031. validate: x => x >= 0
  55032. });
  55033. this.preserve = attributes.preserve || "";
  55034. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  55035. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  55036. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  55037. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  55038. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  55039. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  55040. this.use = attributes.use || "";
  55041. this.usehref = attributes.usehref || "";
  55042. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  55043. this.widows = (0, _utils.getInteger)({
  55044. data: attributes.widows,
  55045. defaultValue: 0,
  55046. validate: x => x >= 0
  55047. });
  55048. this.hyphenation = null;
  55049. }
  55050. [_xfa_object.$toStyle]() {
  55051. const style = (0, _html_utils.toStyle)(this, "hAlign");
  55052. if (this.marginLeft !== "") {
  55053. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  55054. }
  55055. if (this.marginRight !== "") {
  55056. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  55057. }
  55058. if (this.spaceAbove !== "") {
  55059. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  55060. }
  55061. if (this.spaceBelow !== "") {
  55062. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  55063. }
  55064. if (this.textIndent !== "") {
  55065. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  55066. (0, _html_utils.fixTextIndent)(style);
  55067. }
  55068. if (this.lineHeight > 0) {
  55069. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  55070. }
  55071. if (this.tabDefault !== "") {
  55072. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  55073. }
  55074. if (this.tabStops.length > 0) {}
  55075. if (this.hyphenatation) {
  55076. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  55077. }
  55078. return style;
  55079. }
  55080. }
  55081. class PasswordEdit extends _xfa_object.XFAObject {
  55082. constructor(attributes) {
  55083. super(TEMPLATE_NS_ID, "passwordEdit", true);
  55084. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55085. this.id = attributes.id || "";
  55086. this.passwordChar = attributes.passwordChar || "*";
  55087. this.use = attributes.use || "";
  55088. this.usehref = attributes.usehref || "";
  55089. this.border = null;
  55090. this.extras = null;
  55091. this.margin = null;
  55092. }
  55093. }
  55094. class Pattern extends _xfa_object.XFAObject {
  55095. constructor(attributes) {
  55096. super(TEMPLATE_NS_ID, "pattern", true);
  55097. this.id = attributes.id || "";
  55098. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  55099. this.use = attributes.use || "";
  55100. this.usehref = attributes.usehref || "";
  55101. this.color = null;
  55102. this.extras = null;
  55103. }
  55104. [_xfa_object.$toStyle](startColor) {
  55105. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55106. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55107. const width = 5;
  55108. const cmd = "repeating-linear-gradient";
  55109. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  55110. switch (this.type) {
  55111. case "crossHatch":
  55112. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  55113. case "crossDiagonal":
  55114. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  55115. case "diagonalLeft":
  55116. return `${cmd}(45deg,${colors})`;
  55117. case "diagonalRight":
  55118. return `${cmd}(-45deg,${colors})`;
  55119. case "horizontal":
  55120. return `${cmd}(to top,${colors})`;
  55121. case "vertical":
  55122. return `${cmd}(to right,${colors})`;
  55123. }
  55124. return "";
  55125. }
  55126. }
  55127. class Picture extends _xfa_object.StringObject {
  55128. constructor(attributes) {
  55129. super(TEMPLATE_NS_ID, "picture");
  55130. this.id = attributes.id || "";
  55131. this.use = attributes.use || "";
  55132. this.usehref = attributes.usehref || "";
  55133. }
  55134. }
  55135. class Proto extends _xfa_object.XFAObject {
  55136. constructor(attributes) {
  55137. super(TEMPLATE_NS_ID, "proto", true);
  55138. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  55139. this.arc = new _xfa_object.XFAObjectArray();
  55140. this.area = new _xfa_object.XFAObjectArray();
  55141. this.assist = new _xfa_object.XFAObjectArray();
  55142. this.barcode = new _xfa_object.XFAObjectArray();
  55143. this.bindItems = new _xfa_object.XFAObjectArray();
  55144. this.bookend = new _xfa_object.XFAObjectArray();
  55145. this.boolean = new _xfa_object.XFAObjectArray();
  55146. this.border = new _xfa_object.XFAObjectArray();
  55147. this.break = new _xfa_object.XFAObjectArray();
  55148. this.breakAfter = new _xfa_object.XFAObjectArray();
  55149. this.breakBefore = new _xfa_object.XFAObjectArray();
  55150. this.button = new _xfa_object.XFAObjectArray();
  55151. this.calculate = new _xfa_object.XFAObjectArray();
  55152. this.caption = new _xfa_object.XFAObjectArray();
  55153. this.certificate = new _xfa_object.XFAObjectArray();
  55154. this.certificates = new _xfa_object.XFAObjectArray();
  55155. this.checkButton = new _xfa_object.XFAObjectArray();
  55156. this.choiceList = new _xfa_object.XFAObjectArray();
  55157. this.color = new _xfa_object.XFAObjectArray();
  55158. this.comb = new _xfa_object.XFAObjectArray();
  55159. this.connect = new _xfa_object.XFAObjectArray();
  55160. this.contentArea = new _xfa_object.XFAObjectArray();
  55161. this.corner = new _xfa_object.XFAObjectArray();
  55162. this.date = new _xfa_object.XFAObjectArray();
  55163. this.dateTime = new _xfa_object.XFAObjectArray();
  55164. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  55165. this.decimal = new _xfa_object.XFAObjectArray();
  55166. this.defaultUi = new _xfa_object.XFAObjectArray();
  55167. this.desc = new _xfa_object.XFAObjectArray();
  55168. this.digestMethod = new _xfa_object.XFAObjectArray();
  55169. this.digestMethods = new _xfa_object.XFAObjectArray();
  55170. this.draw = new _xfa_object.XFAObjectArray();
  55171. this.edge = new _xfa_object.XFAObjectArray();
  55172. this.encoding = new _xfa_object.XFAObjectArray();
  55173. this.encodings = new _xfa_object.XFAObjectArray();
  55174. this.encrypt = new _xfa_object.XFAObjectArray();
  55175. this.encryptData = new _xfa_object.XFAObjectArray();
  55176. this.encryption = new _xfa_object.XFAObjectArray();
  55177. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55178. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  55179. this.event = new _xfa_object.XFAObjectArray();
  55180. this.exData = new _xfa_object.XFAObjectArray();
  55181. this.exObject = new _xfa_object.XFAObjectArray();
  55182. this.exclGroup = new _xfa_object.XFAObjectArray();
  55183. this.execute = new _xfa_object.XFAObjectArray();
  55184. this.extras = new _xfa_object.XFAObjectArray();
  55185. this.field = new _xfa_object.XFAObjectArray();
  55186. this.fill = new _xfa_object.XFAObjectArray();
  55187. this.filter = new _xfa_object.XFAObjectArray();
  55188. this.float = new _xfa_object.XFAObjectArray();
  55189. this.font = new _xfa_object.XFAObjectArray();
  55190. this.format = new _xfa_object.XFAObjectArray();
  55191. this.handler = new _xfa_object.XFAObjectArray();
  55192. this.hyphenation = new _xfa_object.XFAObjectArray();
  55193. this.image = new _xfa_object.XFAObjectArray();
  55194. this.imageEdit = new _xfa_object.XFAObjectArray();
  55195. this.integer = new _xfa_object.XFAObjectArray();
  55196. this.issuers = new _xfa_object.XFAObjectArray();
  55197. this.items = new _xfa_object.XFAObjectArray();
  55198. this.keep = new _xfa_object.XFAObjectArray();
  55199. this.keyUsage = new _xfa_object.XFAObjectArray();
  55200. this.line = new _xfa_object.XFAObjectArray();
  55201. this.linear = new _xfa_object.XFAObjectArray();
  55202. this.lockDocument = new _xfa_object.XFAObjectArray();
  55203. this.manifest = new _xfa_object.XFAObjectArray();
  55204. this.margin = new _xfa_object.XFAObjectArray();
  55205. this.mdp = new _xfa_object.XFAObjectArray();
  55206. this.medium = new _xfa_object.XFAObjectArray();
  55207. this.message = new _xfa_object.XFAObjectArray();
  55208. this.numericEdit = new _xfa_object.XFAObjectArray();
  55209. this.occur = new _xfa_object.XFAObjectArray();
  55210. this.oid = new _xfa_object.XFAObjectArray();
  55211. this.oids = new _xfa_object.XFAObjectArray();
  55212. this.overflow = new _xfa_object.XFAObjectArray();
  55213. this.pageArea = new _xfa_object.XFAObjectArray();
  55214. this.pageSet = new _xfa_object.XFAObjectArray();
  55215. this.para = new _xfa_object.XFAObjectArray();
  55216. this.passwordEdit = new _xfa_object.XFAObjectArray();
  55217. this.pattern = new _xfa_object.XFAObjectArray();
  55218. this.picture = new _xfa_object.XFAObjectArray();
  55219. this.radial = new _xfa_object.XFAObjectArray();
  55220. this.reason = new _xfa_object.XFAObjectArray();
  55221. this.reasons = new _xfa_object.XFAObjectArray();
  55222. this.rectangle = new _xfa_object.XFAObjectArray();
  55223. this.ref = new _xfa_object.XFAObjectArray();
  55224. this.script = new _xfa_object.XFAObjectArray();
  55225. this.setProperty = new _xfa_object.XFAObjectArray();
  55226. this.signData = new _xfa_object.XFAObjectArray();
  55227. this.signature = new _xfa_object.XFAObjectArray();
  55228. this.signing = new _xfa_object.XFAObjectArray();
  55229. this.solid = new _xfa_object.XFAObjectArray();
  55230. this.speak = new _xfa_object.XFAObjectArray();
  55231. this.stipple = new _xfa_object.XFAObjectArray();
  55232. this.subform = new _xfa_object.XFAObjectArray();
  55233. this.subformSet = new _xfa_object.XFAObjectArray();
  55234. this.subjectDN = new _xfa_object.XFAObjectArray();
  55235. this.subjectDNs = new _xfa_object.XFAObjectArray();
  55236. this.submit = new _xfa_object.XFAObjectArray();
  55237. this.text = new _xfa_object.XFAObjectArray();
  55238. this.textEdit = new _xfa_object.XFAObjectArray();
  55239. this.time = new _xfa_object.XFAObjectArray();
  55240. this.timeStamp = new _xfa_object.XFAObjectArray();
  55241. this.toolTip = new _xfa_object.XFAObjectArray();
  55242. this.traversal = new _xfa_object.XFAObjectArray();
  55243. this.traverse = new _xfa_object.XFAObjectArray();
  55244. this.ui = new _xfa_object.XFAObjectArray();
  55245. this.validate = new _xfa_object.XFAObjectArray();
  55246. this.value = new _xfa_object.XFAObjectArray();
  55247. this.variables = new _xfa_object.XFAObjectArray();
  55248. }
  55249. }
  55250. class Radial extends _xfa_object.XFAObject {
  55251. constructor(attributes) {
  55252. super(TEMPLATE_NS_ID, "radial", true);
  55253. this.id = attributes.id || "";
  55254. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  55255. this.use = attributes.use || "";
  55256. this.usehref = attributes.usehref || "";
  55257. this.color = null;
  55258. this.extras = null;
  55259. }
  55260. [_xfa_object.$toStyle](startColor) {
  55261. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55262. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55263. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  55264. return `radial-gradient(circle at center, ${colors})`;
  55265. }
  55266. }
  55267. class Reason extends _xfa_object.StringObject {
  55268. constructor(attributes) {
  55269. super(TEMPLATE_NS_ID, "reason");
  55270. this.id = attributes.id || "";
  55271. this.name = attributes.name || "";
  55272. this.use = attributes.use || "";
  55273. this.usehref = attributes.usehref || "";
  55274. }
  55275. }
  55276. class Reasons extends _xfa_object.XFAObject {
  55277. constructor(attributes) {
  55278. super(TEMPLATE_NS_ID, "reasons", true);
  55279. this.id = attributes.id || "";
  55280. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55281. this.use = attributes.use || "";
  55282. this.usehref = attributes.usehref || "";
  55283. this.reason = new _xfa_object.XFAObjectArray();
  55284. }
  55285. }
  55286. class Rectangle extends _xfa_object.XFAObject {
  55287. constructor(attributes) {
  55288. super(TEMPLATE_NS_ID, "rectangle", true);
  55289. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55290. this.id = attributes.id || "";
  55291. this.use = attributes.use || "";
  55292. this.usehref = attributes.usehref || "";
  55293. this.corner = new _xfa_object.XFAObjectArray(4);
  55294. this.edge = new _xfa_object.XFAObjectArray(4);
  55295. this.fill = null;
  55296. }
  55297. [_xfa_object.$toHTML]() {
  55298. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  55299. const edgeStyle = edge[_xfa_object.$toStyle]();
  55300. const style = Object.create(null);
  55301. if (this.fill && this.fill.presence === "visible") {
  55302. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  55303. } else {
  55304. style.fill = "transparent";
  55305. }
  55306. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  55307. style.stroke = edgeStyle.color;
  55308. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  55309. const cornerStyle = corner[_xfa_object.$toStyle]();
  55310. const rect = {
  55311. name: "rect",
  55312. attributes: {
  55313. xmlns: SVG_NS,
  55314. width: "100%",
  55315. height: "100%",
  55316. x: 0,
  55317. y: 0,
  55318. rx: cornerStyle.radius,
  55319. ry: cornerStyle.radius,
  55320. style
  55321. }
  55322. };
  55323. const svg = {
  55324. name: "svg",
  55325. children: [rect],
  55326. attributes: {
  55327. xmlns: SVG_NS,
  55328. style: {
  55329. overflow: "visible"
  55330. },
  55331. width: "100%",
  55332. height: "100%"
  55333. }
  55334. };
  55335. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55336. if (hasMargin(parent)) {
  55337. return _utils.HTMLResult.success({
  55338. name: "div",
  55339. attributes: {
  55340. style: {
  55341. display: "inline",
  55342. width: "100%",
  55343. height: "100%"
  55344. }
  55345. },
  55346. children: [svg]
  55347. });
  55348. }
  55349. svg.attributes.style.position = "absolute";
  55350. return _utils.HTMLResult.success(svg);
  55351. }
  55352. }
  55353. class RefElement extends _xfa_object.StringObject {
  55354. constructor(attributes) {
  55355. super(TEMPLATE_NS_ID, "ref");
  55356. this.id = attributes.id || "";
  55357. this.use = attributes.use || "";
  55358. this.usehref = attributes.usehref || "";
  55359. }
  55360. }
  55361. class Script extends _xfa_object.StringObject {
  55362. constructor(attributes) {
  55363. super(TEMPLATE_NS_ID, "script");
  55364. this.binding = attributes.binding || "";
  55365. this.contentType = attributes.contentType || "";
  55366. this.id = attributes.id || "";
  55367. this.name = attributes.name || "";
  55368. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55369. this.use = attributes.use || "";
  55370. this.usehref = attributes.usehref || "";
  55371. }
  55372. }
  55373. class SetProperty extends _xfa_object.XFAObject {
  55374. constructor(attributes) {
  55375. super(TEMPLATE_NS_ID, "setProperty");
  55376. this.connection = attributes.connection || "";
  55377. this.ref = attributes.ref || "";
  55378. this.target = attributes.target || "";
  55379. }
  55380. }
  55381. exports.SetProperty = SetProperty;
  55382. class SignData extends _xfa_object.XFAObject {
  55383. constructor(attributes) {
  55384. super(TEMPLATE_NS_ID, "signData", true);
  55385. this.id = attributes.id || "";
  55386. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  55387. this.ref = attributes.ref || "";
  55388. this.target = attributes.target || "";
  55389. this.use = attributes.use || "";
  55390. this.usehref = attributes.usehref || "";
  55391. this.filter = null;
  55392. this.manifest = null;
  55393. }
  55394. }
  55395. class Signature extends _xfa_object.XFAObject {
  55396. constructor(attributes) {
  55397. super(TEMPLATE_NS_ID, "signature", true);
  55398. this.id = attributes.id || "";
  55399. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  55400. this.use = attributes.use || "";
  55401. this.usehref = attributes.usehref || "";
  55402. this.border = null;
  55403. this.extras = null;
  55404. this.filter = null;
  55405. this.manifest = null;
  55406. this.margin = null;
  55407. }
  55408. }
  55409. class Signing extends _xfa_object.XFAObject {
  55410. constructor(attributes) {
  55411. super(TEMPLATE_NS_ID, "signing", true);
  55412. this.id = attributes.id || "";
  55413. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55414. this.use = attributes.use || "";
  55415. this.usehref = attributes.usehref || "";
  55416. this.certificate = new _xfa_object.XFAObjectArray();
  55417. }
  55418. }
  55419. class Solid extends _xfa_object.XFAObject {
  55420. constructor(attributes) {
  55421. super(TEMPLATE_NS_ID, "solid", true);
  55422. this.id = attributes.id || "";
  55423. this.use = attributes.use || "";
  55424. this.usehref = attributes.usehref || "";
  55425. this.extras = null;
  55426. }
  55427. [_xfa_object.$toStyle](startColor) {
  55428. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55429. }
  55430. }
  55431. class Speak extends _xfa_object.StringObject {
  55432. constructor(attributes) {
  55433. super(TEMPLATE_NS_ID, "speak");
  55434. this.disable = (0, _utils.getInteger)({
  55435. data: attributes.disable,
  55436. defaultValue: 0,
  55437. validate: x => x === 1
  55438. });
  55439. this.id = attributes.id || "";
  55440. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  55441. this.rid = attributes.rid || "";
  55442. this.use = attributes.use || "";
  55443. this.usehref = attributes.usehref || "";
  55444. }
  55445. }
  55446. class Stipple extends _xfa_object.XFAObject {
  55447. constructor(attributes) {
  55448. super(TEMPLATE_NS_ID, "stipple", true);
  55449. this.id = attributes.id || "";
  55450. this.rate = (0, _utils.getInteger)({
  55451. data: attributes.rate,
  55452. defaultValue: 50,
  55453. validate: x => x >= 0 && x <= 100
  55454. });
  55455. this.use = attributes.use || "";
  55456. this.usehref = attributes.usehref || "";
  55457. this.color = null;
  55458. this.extras = null;
  55459. }
  55460. [_xfa_object.$toStyle](bgColor) {
  55461. const alpha = this.rate / 100;
  55462. 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));
  55463. }
  55464. }
  55465. class Subform extends _xfa_object.XFAObject {
  55466. constructor(attributes) {
  55467. super(TEMPLATE_NS_ID, "subform", true);
  55468. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55469. this.allowMacro = (0, _utils.getInteger)({
  55470. data: attributes.allowMacro,
  55471. defaultValue: 0,
  55472. validate: x => x === 1
  55473. });
  55474. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55475. this.colSpan = (0, _utils.getInteger)({
  55476. data: attributes.colSpan,
  55477. defaultValue: 1,
  55478. validate: n => n >= 1 || n === -1
  55479. });
  55480. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  55481. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55482. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55483. this.id = attributes.id || "";
  55484. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55485. this.locale = attributes.locale || "";
  55486. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55487. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55488. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  55489. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55490. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55491. this.name = attributes.name || "";
  55492. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55493. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55494. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  55495. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  55496. this.use = attributes.use || "";
  55497. this.usehref = attributes.usehref || "";
  55498. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55499. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55500. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55501. this.assist = null;
  55502. this.bind = null;
  55503. this.bookend = null;
  55504. this.border = null;
  55505. this.break = null;
  55506. this.calculate = null;
  55507. this.desc = null;
  55508. this.extras = null;
  55509. this.keep = null;
  55510. this.margin = null;
  55511. this.occur = null;
  55512. this.overflow = null;
  55513. this.pageSet = null;
  55514. this.para = null;
  55515. this.traversal = null;
  55516. this.validate = null;
  55517. this.variables = null;
  55518. this.area = new _xfa_object.XFAObjectArray();
  55519. this.breakAfter = new _xfa_object.XFAObjectArray();
  55520. this.breakBefore = new _xfa_object.XFAObjectArray();
  55521. this.connect = new _xfa_object.XFAObjectArray();
  55522. this.draw = new _xfa_object.XFAObjectArray();
  55523. this.event = new _xfa_object.XFAObjectArray();
  55524. this.exObject = new _xfa_object.XFAObjectArray();
  55525. this.exclGroup = new _xfa_object.XFAObjectArray();
  55526. this.field = new _xfa_object.XFAObjectArray();
  55527. this.proto = new _xfa_object.XFAObjectArray();
  55528. this.setProperty = new _xfa_object.XFAObjectArray();
  55529. this.subform = new _xfa_object.XFAObjectArray();
  55530. this.subformSet = new _xfa_object.XFAObjectArray();
  55531. }
  55532. [_xfa_object.$getSubformParent]() {
  55533. const parent = this[_xfa_object.$getParent]();
  55534. if (parent instanceof SubformSet) {
  55535. return parent[_xfa_object.$getSubformParent]();
  55536. }
  55537. return parent;
  55538. }
  55539. [_xfa_object.$isBindable]() {
  55540. return true;
  55541. }
  55542. [_xfa_object.$isThereMoreWidth]() {
  55543. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55544. }
  55545. *[_xfa_object.$getContainedChildren]() {
  55546. yield* getContainedChildren(this);
  55547. }
  55548. [_xfa_object.$flushHTML]() {
  55549. return (0, _layout.flushHTML)(this);
  55550. }
  55551. [_xfa_object.$addHTML](html, bbox) {
  55552. (0, _layout.addHTML)(this, html, bbox);
  55553. }
  55554. [_xfa_object.$getAvailableSpace]() {
  55555. return (0, _layout.getAvailableSpace)(this);
  55556. }
  55557. [_xfa_object.$isSplittable]() {
  55558. const parent = this[_xfa_object.$getSubformParent]();
  55559. if (!parent[_xfa_object.$isSplittable]()) {
  55560. return false;
  55561. }
  55562. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55563. return this[_xfa_object.$extra]._isSplittable;
  55564. }
  55565. if (this.layout === "position" || this.layout.includes("row")) {
  55566. this[_xfa_object.$extra]._isSplittable = false;
  55567. return false;
  55568. }
  55569. if (this.keep && this.keep.intact !== "none") {
  55570. this[_xfa_object.$extra]._isSplittable = false;
  55571. return false;
  55572. }
  55573. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55574. return false;
  55575. }
  55576. this[_xfa_object.$extra]._isSplittable = true;
  55577. return true;
  55578. }
  55579. [_xfa_object.$toHTML](availableSpace) {
  55580. setTabIndex(this);
  55581. if (this.break) {
  55582. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  55583. const node = new BreakAfter({
  55584. targetType: this.break.after,
  55585. target: this.break.afterTarget,
  55586. startNew: this.break.startNew.toString()
  55587. });
  55588. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55589. this[_xfa_object.$appendChild](node);
  55590. this.breakAfter.push(node);
  55591. }
  55592. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  55593. const node = new BreakBefore({
  55594. targetType: this.break.before,
  55595. target: this.break.beforeTarget,
  55596. startNew: this.break.startNew.toString()
  55597. });
  55598. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55599. this[_xfa_object.$appendChild](node);
  55600. this.breakBefore.push(node);
  55601. }
  55602. if (this.break.overflowTarget !== "") {
  55603. const node = new Overflow({
  55604. target: this.break.overflowTarget,
  55605. leader: this.break.overflowLeader,
  55606. trailer: this.break.overflowTrailer
  55607. });
  55608. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55609. this[_xfa_object.$appendChild](node);
  55610. this.overflow.push(node);
  55611. }
  55612. this[_xfa_object.$removeChild](this.break);
  55613. this.break = null;
  55614. }
  55615. if (this.presence === "hidden" || this.presence === "inactive") {
  55616. return _utils.HTMLResult.EMPTY;
  55617. }
  55618. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  55619. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  55620. }
  55621. if (this.breakBefore.children.length >= 1) {
  55622. const breakBefore = this.breakBefore.children[0];
  55623. if (handleBreak(breakBefore)) {
  55624. return _utils.HTMLResult.breakNode(breakBefore);
  55625. }
  55626. }
  55627. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  55628. return _utils.HTMLResult.EMPTY;
  55629. }
  55630. (0, _html_utils.fixDimensions)(this);
  55631. const children = [];
  55632. const attributes = {
  55633. id: this[_xfa_object.$uid],
  55634. class: []
  55635. };
  55636. (0, _html_utils.setAccess)(this, attributes.class);
  55637. if (!this[_xfa_object.$extra]) {
  55638. this[_xfa_object.$extra] = Object.create(null);
  55639. }
  55640. Object.assign(this[_xfa_object.$extra], {
  55641. children,
  55642. line: null,
  55643. attributes,
  55644. attempt: 0,
  55645. numberInLine: 0,
  55646. availableSpace: {
  55647. width: Math.min(this.w || Infinity, availableSpace.width),
  55648. height: Math.min(this.h || Infinity, availableSpace.height)
  55649. },
  55650. width: 0,
  55651. height: 0,
  55652. prevHeight: 0,
  55653. currentWidth: 0
  55654. });
  55655. const root = this[_xfa_object.$getTemplateRoot]();
  55656. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  55657. const isSplittable = this[_xfa_object.$isSplittable]();
  55658. if (!isSplittable) {
  55659. setFirstUnsplittable(this);
  55660. }
  55661. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55662. return _utils.HTMLResult.FAILURE;
  55663. }
  55664. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  55665. if (this.layout.includes("row")) {
  55666. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55667. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55668. this[_xfa_object.$extra].columnWidths = columnWidths;
  55669. this[_xfa_object.$extra].currentColumn = 0;
  55670. }
  55671. }
  55672. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55673. const classNames = ["xfaSubform"];
  55674. const cl = (0, _html_utils.layoutClass)(this);
  55675. if (cl) {
  55676. classNames.push(cl);
  55677. }
  55678. attributes.style = style;
  55679. attributes.class = classNames;
  55680. if (this.name) {
  55681. attributes.xfaName = this.name;
  55682. }
  55683. if (this.overflow) {
  55684. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55685. if (overflowExtra.addLeader) {
  55686. overflowExtra.addLeader = false;
  55687. handleOverflow(this, overflowExtra.leader, availableSpace);
  55688. }
  55689. }
  55690. this[_xfa_object.$pushPara]();
  55691. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55692. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55693. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55694. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55695. this[_xfa_object.$extra].numberInLine = 0;
  55696. }
  55697. const result = this[_xfa_object.$childrenToHTML]({
  55698. filter,
  55699. include: true
  55700. });
  55701. if (result.success) {
  55702. break;
  55703. }
  55704. if (result.isBreak()) {
  55705. this[_xfa_object.$popPara]();
  55706. return result;
  55707. }
  55708. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  55709. this[_xfa_object.$extra].attempt = maxRun;
  55710. break;
  55711. }
  55712. }
  55713. this[_xfa_object.$popPara]();
  55714. if (!isSplittable) {
  55715. unsetFirstUnsplittable(this);
  55716. }
  55717. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  55718. if (this[_xfa_object.$extra].attempt === maxRun) {
  55719. if (this.overflow) {
  55720. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  55721. }
  55722. if (!isSplittable) {
  55723. delete this[_xfa_object.$extra];
  55724. }
  55725. return _utils.HTMLResult.FAILURE;
  55726. }
  55727. if (this.overflow) {
  55728. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55729. if (overflowExtra.addTrailer) {
  55730. overflowExtra.addTrailer = false;
  55731. handleOverflow(this, overflowExtra.trailer, availableSpace);
  55732. }
  55733. }
  55734. let marginH = 0;
  55735. let marginV = 0;
  55736. if (this.margin) {
  55737. marginH = this.margin.leftInset + this.margin.rightInset;
  55738. marginV = this.margin.topInset + this.margin.bottomInset;
  55739. }
  55740. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55741. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55742. const bbox = [this.x, this.y, width, height];
  55743. if (this.w === "") {
  55744. style.width = (0, _html_utils.measureToString)(width);
  55745. }
  55746. if (this.h === "") {
  55747. style.height = (0, _html_utils.measureToString)(height);
  55748. }
  55749. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  55750. return _utils.HTMLResult.EMPTY;
  55751. }
  55752. const html = {
  55753. name: "div",
  55754. attributes,
  55755. children
  55756. };
  55757. applyAssist(this, attributes);
  55758. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55759. if (this.breakAfter.children.length >= 1) {
  55760. const breakAfter = this.breakAfter.children[0];
  55761. if (handleBreak(breakAfter)) {
  55762. this[_xfa_object.$extra].afterBreakAfter = result;
  55763. return _utils.HTMLResult.breakNode(breakAfter);
  55764. }
  55765. }
  55766. delete this[_xfa_object.$extra];
  55767. return result;
  55768. }
  55769. }
  55770. class SubformSet extends _xfa_object.XFAObject {
  55771. constructor(attributes) {
  55772. super(TEMPLATE_NS_ID, "subformSet", true);
  55773. this.id = attributes.id || "";
  55774. this.name = attributes.name || "";
  55775. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  55776. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55777. this.use = attributes.use || "";
  55778. this.usehref = attributes.usehref || "";
  55779. this.bookend = null;
  55780. this.break = null;
  55781. this.desc = null;
  55782. this.extras = null;
  55783. this.occur = null;
  55784. this.overflow = null;
  55785. this.breakAfter = new _xfa_object.XFAObjectArray();
  55786. this.breakBefore = new _xfa_object.XFAObjectArray();
  55787. this.subform = new _xfa_object.XFAObjectArray();
  55788. this.subformSet = new _xfa_object.XFAObjectArray();
  55789. }
  55790. *[_xfa_object.$getContainedChildren]() {
  55791. yield* getContainedChildren(this);
  55792. }
  55793. [_xfa_object.$getSubformParent]() {
  55794. let parent = this[_xfa_object.$getParent]();
  55795. while (!(parent instanceof Subform)) {
  55796. parent = parent[_xfa_object.$getParent]();
  55797. }
  55798. return parent;
  55799. }
  55800. [_xfa_object.$isBindable]() {
  55801. return true;
  55802. }
  55803. }
  55804. class SubjectDN extends _xfa_object.ContentObject {
  55805. constructor(attributes) {
  55806. super(TEMPLATE_NS_ID, "subjectDN");
  55807. this.delimiter = attributes.delimiter || ",";
  55808. this.id = attributes.id || "";
  55809. this.name = attributes.name || "";
  55810. this.use = attributes.use || "";
  55811. this.usehref = attributes.usehref || "";
  55812. }
  55813. [_xfa_object.$finalize]() {
  55814. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  55815. kv = kv.split("=", 2);
  55816. kv[0] = kv[0].trim();
  55817. return kv;
  55818. }));
  55819. }
  55820. }
  55821. class SubjectDNs extends _xfa_object.XFAObject {
  55822. constructor(attributes) {
  55823. super(TEMPLATE_NS_ID, "subjectDNs", true);
  55824. this.id = attributes.id || "";
  55825. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55826. this.use = attributes.use || "";
  55827. this.usehref = attributes.usehref || "";
  55828. this.subjectDN = new _xfa_object.XFAObjectArray();
  55829. }
  55830. }
  55831. class Submit extends _xfa_object.XFAObject {
  55832. constructor(attributes) {
  55833. super(TEMPLATE_NS_ID, "submit", true);
  55834. this.embedPDF = (0, _utils.getInteger)({
  55835. data: attributes.embedPDF,
  55836. defaultValue: 0,
  55837. validate: x => x === 1
  55838. });
  55839. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  55840. this.id = attributes.id || "";
  55841. this.target = attributes.target || "";
  55842. this.textEncoding = (0, _utils.getKeyword)({
  55843. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  55844. defaultValue: "",
  55845. 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}/)
  55846. });
  55847. this.use = attributes.use || "";
  55848. this.usehref = attributes.usehref || "";
  55849. this.xdpContent = attributes.xdpContent || "";
  55850. this.encrypt = null;
  55851. this.encryptData = new _xfa_object.XFAObjectArray();
  55852. this.signData = new _xfa_object.XFAObjectArray();
  55853. }
  55854. }
  55855. class Template extends _xfa_object.XFAObject {
  55856. constructor(attributes) {
  55857. super(TEMPLATE_NS_ID, "template", true);
  55858. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  55859. this.extras = null;
  55860. this.subform = new _xfa_object.XFAObjectArray();
  55861. }
  55862. [_xfa_object.$finalize]() {
  55863. if (this.subform.children.length === 0) {
  55864. (0, _util.warn)("XFA - No subforms in template node.");
  55865. }
  55866. if (this.subform.children.length >= 2) {
  55867. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  55868. }
  55869. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  55870. }
  55871. [_xfa_object.$isSplittable]() {
  55872. return true;
  55873. }
  55874. [_xfa_object.$searchNode](expr, container) {
  55875. if (expr.startsWith("#")) {
  55876. return [this[_xfa_object.$ids].get(expr.slice(1))];
  55877. }
  55878. return (0, _som.searchNode)(this, container, expr, true, true);
  55879. }
  55880. *[_xfa_object.$toPages]() {
  55881. if (!this.subform.children.length) {
  55882. return _utils.HTMLResult.success({
  55883. name: "div",
  55884. children: []
  55885. });
  55886. }
  55887. this[_xfa_object.$extra] = {
  55888. overflowNode: null,
  55889. firstUnsplittable: null,
  55890. currentContentArea: null,
  55891. currentPageArea: null,
  55892. noLayoutFailure: false,
  55893. pageNumber: 1,
  55894. pagePosition: "first",
  55895. oddOrEven: "odd",
  55896. blankOrNotBlank: "nonBlank",
  55897. paraStack: []
  55898. };
  55899. const root = this.subform.children[0];
  55900. root.pageSet[_xfa_object.$cleanPage]();
  55901. const pageAreas = root.pageSet.pageArea.children;
  55902. const mainHtml = {
  55903. name: "div",
  55904. children: []
  55905. };
  55906. let pageArea = null;
  55907. let breakBefore = null;
  55908. let breakBeforeTarget = null;
  55909. if (root.breakBefore.children.length >= 1) {
  55910. breakBefore = root.breakBefore.children[0];
  55911. breakBeforeTarget = breakBefore.target;
  55912. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  55913. breakBefore = root.subform.children[0].breakBefore.children[0];
  55914. breakBeforeTarget = breakBefore.target;
  55915. } else if (root.break && root.break.beforeTarget) {
  55916. breakBefore = root.break;
  55917. breakBeforeTarget = breakBefore.beforeTarget;
  55918. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  55919. breakBefore = root.subform.children[0].break;
  55920. breakBeforeTarget = breakBefore.beforeTarget;
  55921. }
  55922. if (breakBefore) {
  55923. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  55924. if (target instanceof PageArea) {
  55925. pageArea = target;
  55926. breakBefore[_xfa_object.$extra] = {};
  55927. }
  55928. }
  55929. if (!pageArea) {
  55930. pageArea = pageAreas[0];
  55931. }
  55932. pageArea[_xfa_object.$extra] = {
  55933. numberOfUse: 1
  55934. };
  55935. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  55936. pageAreaParent[_xfa_object.$extra] = {
  55937. numberOfUse: 1,
  55938. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  55939. pageSetIndex: 0
  55940. };
  55941. let targetPageArea;
  55942. let leader = null;
  55943. let trailer = null;
  55944. let hasSomething = true;
  55945. let hasSomethingCounter = 0;
  55946. let startIndex = 0;
  55947. while (true) {
  55948. if (!hasSomething) {
  55949. mainHtml.children.pop();
  55950. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  55951. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  55952. return mainHtml;
  55953. }
  55954. } else {
  55955. hasSomethingCounter = 0;
  55956. }
  55957. targetPageArea = null;
  55958. this[_xfa_object.$extra].currentPageArea = pageArea;
  55959. const page = pageArea[_xfa_object.$toHTML]().html;
  55960. mainHtml.children.push(page);
  55961. if (leader) {
  55962. this[_xfa_object.$extra].noLayoutFailure = true;
  55963. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  55964. leader = null;
  55965. }
  55966. if (trailer) {
  55967. this[_xfa_object.$extra].noLayoutFailure = true;
  55968. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  55969. trailer = null;
  55970. }
  55971. const contentAreas = pageArea.contentArea.children;
  55972. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  55973. hasSomething = false;
  55974. this[_xfa_object.$extra].firstUnsplittable = null;
  55975. this[_xfa_object.$extra].noLayoutFailure = false;
  55976. const flush = index => {
  55977. const html = root[_xfa_object.$flushHTML]();
  55978. if (html) {
  55979. hasSomething = hasSomething || html.children && html.children.length !== 0;
  55980. htmlContentAreas[index].children.push(html);
  55981. }
  55982. };
  55983. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  55984. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  55985. const space = {
  55986. width: contentArea.w,
  55987. height: contentArea.h
  55988. };
  55989. startIndex = 0;
  55990. if (leader) {
  55991. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  55992. leader = null;
  55993. }
  55994. if (trailer) {
  55995. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  55996. trailer = null;
  55997. }
  55998. const html = root[_xfa_object.$toHTML](space);
  55999. if (html.success) {
  56000. if (html.html) {
  56001. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  56002. htmlContentAreas[i].children.push(html.html);
  56003. } else if (!hasSomething && mainHtml.children.length > 1) {
  56004. mainHtml.children.pop();
  56005. }
  56006. return mainHtml;
  56007. }
  56008. if (html.isBreak()) {
  56009. const node = html.breakNode;
  56010. flush(i);
  56011. if (node.targetType === "auto") {
  56012. continue;
  56013. }
  56014. if (node.leader) {
  56015. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  56016. leader = leader ? leader[0] : null;
  56017. }
  56018. if (node.trailer) {
  56019. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  56020. trailer = trailer ? trailer[0] : null;
  56021. }
  56022. if (node.targetType === "pageArea") {
  56023. targetPageArea = node[_xfa_object.$extra].target;
  56024. i = Infinity;
  56025. } else if (!node[_xfa_object.$extra].target) {
  56026. i = node[_xfa_object.$extra].index;
  56027. } else {
  56028. targetPageArea = node[_xfa_object.$extra].target;
  56029. startIndex = node[_xfa_object.$extra].index + 1;
  56030. i = Infinity;
  56031. }
  56032. continue;
  56033. }
  56034. if (this[_xfa_object.$extra].overflowNode) {
  56035. const node = this[_xfa_object.$extra].overflowNode;
  56036. this[_xfa_object.$extra].overflowNode = null;
  56037. const overflowExtra = node[_xfa_object.$getExtra]();
  56038. const target = overflowExtra.target;
  56039. overflowExtra.addLeader = overflowExtra.leader !== null;
  56040. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  56041. flush(i);
  56042. const currentIndex = i;
  56043. i = Infinity;
  56044. if (target instanceof PageArea) {
  56045. targetPageArea = target;
  56046. } else if (target instanceof ContentArea) {
  56047. const index = contentAreas.findIndex(e => e === target);
  56048. if (index !== -1) {
  56049. if (index > currentIndex) {
  56050. i = index - 1;
  56051. } else {
  56052. startIndex = index;
  56053. }
  56054. } else {
  56055. targetPageArea = target[_xfa_object.$getParent]();
  56056. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  56057. }
  56058. }
  56059. continue;
  56060. }
  56061. flush(i);
  56062. }
  56063. this[_xfa_object.$extra].pageNumber += 1;
  56064. if (targetPageArea) {
  56065. if (targetPageArea[_xfa_object.$isUsable]()) {
  56066. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  56067. } else {
  56068. targetPageArea = null;
  56069. }
  56070. }
  56071. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  56072. yield null;
  56073. }
  56074. }
  56075. }
  56076. exports.Template = Template;
  56077. class Text extends _xfa_object.ContentObject {
  56078. constructor(attributes) {
  56079. super(TEMPLATE_NS_ID, "text");
  56080. this.id = attributes.id || "";
  56081. this.maxChars = (0, _utils.getInteger)({
  56082. data: attributes.maxChars,
  56083. defaultValue: 0,
  56084. validate: x => x >= 0
  56085. });
  56086. this.name = attributes.name || "";
  56087. this.rid = attributes.rid || "";
  56088. this.use = attributes.use || "";
  56089. this.usehref = attributes.usehref || "";
  56090. }
  56091. [_xfa_object.$acceptWhitespace]() {
  56092. return true;
  56093. }
  56094. [_xfa_object.$onChild](child) {
  56095. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56096. this[_xfa_object.$content] = child;
  56097. return true;
  56098. }
  56099. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  56100. return false;
  56101. }
  56102. [_xfa_object.$onText](str) {
  56103. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  56104. return;
  56105. }
  56106. super[_xfa_object.$onText](str);
  56107. }
  56108. [_xfa_object.$finalize]() {
  56109. if (typeof this[_xfa_object.$content] === "string") {
  56110. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  56111. }
  56112. }
  56113. [_xfa_object.$getExtra]() {
  56114. if (typeof this[_xfa_object.$content] === "string") {
  56115. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  56116. if (line) {
  56117. acc.push(line);
  56118. }
  56119. return acc;
  56120. }, []).join("\n");
  56121. }
  56122. return this[_xfa_object.$content][_xfa_object.$text]();
  56123. }
  56124. [_xfa_object.$toHTML](availableSpace) {
  56125. if (typeof this[_xfa_object.$content] === "string") {
  56126. const html = valueToHtml(this[_xfa_object.$content]).html;
  56127. if (this[_xfa_object.$content].includes("\u2029")) {
  56128. html.name = "div";
  56129. html.children = [];
  56130. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  56131. acc.push({
  56132. name: "span",
  56133. value: line
  56134. }, {
  56135. name: "br"
  56136. });
  56137. return acc;
  56138. }, [])).forEach(lines => {
  56139. html.children.push({
  56140. name: "p",
  56141. children: lines
  56142. });
  56143. });
  56144. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  56145. html.name = "div";
  56146. html.children = [];
  56147. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  56148. html.children.push({
  56149. name: "span",
  56150. value: line
  56151. }, {
  56152. name: "br"
  56153. });
  56154. });
  56155. }
  56156. return _utils.HTMLResult.success(html);
  56157. }
  56158. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  56159. }
  56160. }
  56161. exports.Text = Text;
  56162. class TextEdit extends _xfa_object.XFAObject {
  56163. constructor(attributes) {
  56164. super(TEMPLATE_NS_ID, "textEdit", true);
  56165. this.allowRichText = (0, _utils.getInteger)({
  56166. data: attributes.allowRichText,
  56167. defaultValue: 0,
  56168. validate: x => x === 1
  56169. });
  56170. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56171. this.id = attributes.id || "";
  56172. this.multiLine = (0, _utils.getInteger)({
  56173. data: attributes.multiLine,
  56174. defaultValue: "",
  56175. validate: x => x === 0 || x === 1
  56176. });
  56177. this.use = attributes.use || "";
  56178. this.usehref = attributes.usehref || "";
  56179. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  56180. this.border = null;
  56181. this.comb = null;
  56182. this.extras = null;
  56183. this.margin = null;
  56184. }
  56185. [_xfa_object.$toHTML](availableSpace) {
  56186. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56187. let html;
  56188. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56189. if (this.multiLine === "") {
  56190. this.multiLine = field instanceof Draw ? 1 : 0;
  56191. }
  56192. if (this.multiLine === 1) {
  56193. html = {
  56194. name: "textarea",
  56195. attributes: {
  56196. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56197. fieldId: field[_xfa_object.$uid],
  56198. class: ["xfaTextfield"],
  56199. style,
  56200. "aria-label": ariaLabel(field)
  56201. }
  56202. };
  56203. } else {
  56204. html = {
  56205. name: "input",
  56206. attributes: {
  56207. type: "text",
  56208. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56209. fieldId: field[_xfa_object.$uid],
  56210. class: ["xfaTextfield"],
  56211. style,
  56212. "aria-label": ariaLabel(field)
  56213. }
  56214. };
  56215. }
  56216. return _utils.HTMLResult.success({
  56217. name: "label",
  56218. attributes: {
  56219. class: ["xfaLabel"]
  56220. },
  56221. children: [html]
  56222. });
  56223. }
  56224. }
  56225. class Time extends _xfa_object.StringObject {
  56226. constructor(attributes) {
  56227. super(TEMPLATE_NS_ID, "time");
  56228. this.id = attributes.id || "";
  56229. this.name = attributes.name || "";
  56230. this.use = attributes.use || "";
  56231. this.usehref = attributes.usehref || "";
  56232. }
  56233. [_xfa_object.$finalize]() {
  56234. const date = this[_xfa_object.$content].trim();
  56235. this[_xfa_object.$content] = date ? new Date(date) : null;
  56236. }
  56237. [_xfa_object.$toHTML](availableSpace) {
  56238. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  56239. }
  56240. }
  56241. class TimeStamp extends _xfa_object.XFAObject {
  56242. constructor(attributes) {
  56243. super(TEMPLATE_NS_ID, "timeStamp");
  56244. this.id = attributes.id || "";
  56245. this.server = attributes.server || "";
  56246. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56247. this.use = attributes.use || "";
  56248. this.usehref = attributes.usehref || "";
  56249. }
  56250. }
  56251. class ToolTip extends _xfa_object.StringObject {
  56252. constructor(attributes) {
  56253. super(TEMPLATE_NS_ID, "toolTip");
  56254. this.id = attributes.id || "";
  56255. this.rid = attributes.rid || "";
  56256. this.use = attributes.use || "";
  56257. this.usehref = attributes.usehref || "";
  56258. }
  56259. }
  56260. class Traversal extends _xfa_object.XFAObject {
  56261. constructor(attributes) {
  56262. super(TEMPLATE_NS_ID, "traversal", true);
  56263. this.id = attributes.id || "";
  56264. this.use = attributes.use || "";
  56265. this.usehref = attributes.usehref || "";
  56266. this.extras = null;
  56267. this.traverse = new _xfa_object.XFAObjectArray();
  56268. }
  56269. }
  56270. class Traverse extends _xfa_object.XFAObject {
  56271. constructor(attributes) {
  56272. super(TEMPLATE_NS_ID, "traverse", true);
  56273. this.id = attributes.id || "";
  56274. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  56275. this.ref = attributes.ref || "";
  56276. this.use = attributes.use || "";
  56277. this.usehref = attributes.usehref || "";
  56278. this.extras = null;
  56279. this.script = null;
  56280. }
  56281. get name() {
  56282. return this.operation;
  56283. }
  56284. [_xfa_object.$isTransparent]() {
  56285. return false;
  56286. }
  56287. }
  56288. class Ui extends _xfa_object.XFAObject {
  56289. constructor(attributes) {
  56290. super(TEMPLATE_NS_ID, "ui", true);
  56291. this.id = attributes.id || "";
  56292. this.use = attributes.use || "";
  56293. this.usehref = attributes.usehref || "";
  56294. this.extras = null;
  56295. this.picture = null;
  56296. this.barcode = null;
  56297. this.button = null;
  56298. this.checkButton = null;
  56299. this.choiceList = null;
  56300. this.dateTimeEdit = null;
  56301. this.defaultUi = null;
  56302. this.imageEdit = null;
  56303. this.numericEdit = null;
  56304. this.passwordEdit = null;
  56305. this.signature = null;
  56306. this.textEdit = null;
  56307. }
  56308. [_xfa_object.$getExtra]() {
  56309. if (this[_xfa_object.$extra] === undefined) {
  56310. for (const name of Object.getOwnPropertyNames(this)) {
  56311. if (name === "extras" || name === "picture") {
  56312. continue;
  56313. }
  56314. const obj = this[name];
  56315. if (!(obj instanceof _xfa_object.XFAObject)) {
  56316. continue;
  56317. }
  56318. this[_xfa_object.$extra] = obj;
  56319. return obj;
  56320. }
  56321. this[_xfa_object.$extra] = null;
  56322. }
  56323. return this[_xfa_object.$extra];
  56324. }
  56325. [_xfa_object.$toHTML](availableSpace) {
  56326. const obj = this[_xfa_object.$getExtra]();
  56327. if (obj) {
  56328. return obj[_xfa_object.$toHTML](availableSpace);
  56329. }
  56330. return _utils.HTMLResult.EMPTY;
  56331. }
  56332. }
  56333. class Validate extends _xfa_object.XFAObject {
  56334. constructor(attributes) {
  56335. super(TEMPLATE_NS_ID, "validate", true);
  56336. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  56337. this.id = attributes.id || "";
  56338. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  56339. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  56340. this.use = attributes.use || "";
  56341. this.usehref = attributes.usehref || "";
  56342. this.extras = null;
  56343. this.message = null;
  56344. this.picture = null;
  56345. this.script = null;
  56346. }
  56347. }
  56348. class Value extends _xfa_object.XFAObject {
  56349. constructor(attributes) {
  56350. super(TEMPLATE_NS_ID, "value", true);
  56351. this.id = attributes.id || "";
  56352. this.override = (0, _utils.getInteger)({
  56353. data: attributes.override,
  56354. defaultValue: 0,
  56355. validate: x => x === 1
  56356. });
  56357. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56358. this.use = attributes.use || "";
  56359. this.usehref = attributes.usehref || "";
  56360. this.arc = null;
  56361. this.boolean = null;
  56362. this.date = null;
  56363. this.dateTime = null;
  56364. this.decimal = null;
  56365. this.exData = null;
  56366. this.float = null;
  56367. this.image = null;
  56368. this.integer = null;
  56369. this.line = null;
  56370. this.rectangle = null;
  56371. this.text = null;
  56372. this.time = null;
  56373. }
  56374. [_xfa_object.$setValue](value) {
  56375. const parent = this[_xfa_object.$getParent]();
  56376. if (parent instanceof Field) {
  56377. if (parent.ui && parent.ui.imageEdit) {
  56378. if (!this.image) {
  56379. this.image = new Image({});
  56380. this[_xfa_object.$appendChild](this.image);
  56381. }
  56382. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  56383. return;
  56384. }
  56385. }
  56386. const valueName = value[_xfa_object.$nodeName];
  56387. if (this[valueName] !== null) {
  56388. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  56389. return;
  56390. }
  56391. for (const name of Object.getOwnPropertyNames(this)) {
  56392. const obj = this[name];
  56393. if (obj instanceof _xfa_object.XFAObject) {
  56394. this[name] = null;
  56395. this[_xfa_object.$removeChild](obj);
  56396. }
  56397. }
  56398. this[value[_xfa_object.$nodeName]] = value;
  56399. this[_xfa_object.$appendChild](value);
  56400. }
  56401. [_xfa_object.$text]() {
  56402. if (this.exData) {
  56403. if (typeof this.exData[_xfa_object.$content] === "string") {
  56404. return this.exData[_xfa_object.$content].trim();
  56405. }
  56406. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  56407. }
  56408. for (const name of Object.getOwnPropertyNames(this)) {
  56409. if (name === "image") {
  56410. continue;
  56411. }
  56412. const obj = this[name];
  56413. if (obj instanceof _xfa_object.XFAObject) {
  56414. return (obj[_xfa_object.$content] || "").toString().trim();
  56415. }
  56416. }
  56417. return null;
  56418. }
  56419. [_xfa_object.$toHTML](availableSpace) {
  56420. for (const name of Object.getOwnPropertyNames(this)) {
  56421. const obj = this[name];
  56422. if (!(obj instanceof _xfa_object.XFAObject)) {
  56423. continue;
  56424. }
  56425. return obj[_xfa_object.$toHTML](availableSpace);
  56426. }
  56427. return _utils.HTMLResult.EMPTY;
  56428. }
  56429. }
  56430. exports.Value = Value;
  56431. class Variables extends _xfa_object.XFAObject {
  56432. constructor(attributes) {
  56433. super(TEMPLATE_NS_ID, "variables", true);
  56434. this.id = attributes.id || "";
  56435. this.use = attributes.use || "";
  56436. this.usehref = attributes.usehref || "";
  56437. this.boolean = new _xfa_object.XFAObjectArray();
  56438. this.date = new _xfa_object.XFAObjectArray();
  56439. this.dateTime = new _xfa_object.XFAObjectArray();
  56440. this.decimal = new _xfa_object.XFAObjectArray();
  56441. this.exData = new _xfa_object.XFAObjectArray();
  56442. this.float = new _xfa_object.XFAObjectArray();
  56443. this.image = new _xfa_object.XFAObjectArray();
  56444. this.integer = new _xfa_object.XFAObjectArray();
  56445. this.manifest = new _xfa_object.XFAObjectArray();
  56446. this.script = new _xfa_object.XFAObjectArray();
  56447. this.text = new _xfa_object.XFAObjectArray();
  56448. this.time = new _xfa_object.XFAObjectArray();
  56449. }
  56450. [_xfa_object.$isTransparent]() {
  56451. return true;
  56452. }
  56453. }
  56454. class TemplateNamespace {
  56455. static [_namespaces.$buildXFAObject](name, attributes) {
  56456. if (TemplateNamespace.hasOwnProperty(name)) {
  56457. const node = TemplateNamespace[name](attributes);
  56458. node[_xfa_object.$setSetAttributes](attributes);
  56459. return node;
  56460. }
  56461. return undefined;
  56462. }
  56463. static appearanceFilter(attrs) {
  56464. return new AppearanceFilter(attrs);
  56465. }
  56466. static arc(attrs) {
  56467. return new Arc(attrs);
  56468. }
  56469. static area(attrs) {
  56470. return new Area(attrs);
  56471. }
  56472. static assist(attrs) {
  56473. return new Assist(attrs);
  56474. }
  56475. static barcode(attrs) {
  56476. return new Barcode(attrs);
  56477. }
  56478. static bind(attrs) {
  56479. return new Bind(attrs);
  56480. }
  56481. static bindItems(attrs) {
  56482. return new BindItems(attrs);
  56483. }
  56484. static bookend(attrs) {
  56485. return new Bookend(attrs);
  56486. }
  56487. static boolean(attrs) {
  56488. return new BooleanElement(attrs);
  56489. }
  56490. static border(attrs) {
  56491. return new Border(attrs);
  56492. }
  56493. static break(attrs) {
  56494. return new Break(attrs);
  56495. }
  56496. static breakAfter(attrs) {
  56497. return new BreakAfter(attrs);
  56498. }
  56499. static breakBefore(attrs) {
  56500. return new BreakBefore(attrs);
  56501. }
  56502. static button(attrs) {
  56503. return new Button(attrs);
  56504. }
  56505. static calculate(attrs) {
  56506. return new Calculate(attrs);
  56507. }
  56508. static caption(attrs) {
  56509. return new Caption(attrs);
  56510. }
  56511. static certificate(attrs) {
  56512. return new Certificate(attrs);
  56513. }
  56514. static certificates(attrs) {
  56515. return new Certificates(attrs);
  56516. }
  56517. static checkButton(attrs) {
  56518. return new CheckButton(attrs);
  56519. }
  56520. static choiceList(attrs) {
  56521. return new ChoiceList(attrs);
  56522. }
  56523. static color(attrs) {
  56524. return new Color(attrs);
  56525. }
  56526. static comb(attrs) {
  56527. return new Comb(attrs);
  56528. }
  56529. static connect(attrs) {
  56530. return new Connect(attrs);
  56531. }
  56532. static contentArea(attrs) {
  56533. return new ContentArea(attrs);
  56534. }
  56535. static corner(attrs) {
  56536. return new Corner(attrs);
  56537. }
  56538. static date(attrs) {
  56539. return new DateElement(attrs);
  56540. }
  56541. static dateTime(attrs) {
  56542. return new DateTime(attrs);
  56543. }
  56544. static dateTimeEdit(attrs) {
  56545. return new DateTimeEdit(attrs);
  56546. }
  56547. static decimal(attrs) {
  56548. return new Decimal(attrs);
  56549. }
  56550. static defaultUi(attrs) {
  56551. return new DefaultUi(attrs);
  56552. }
  56553. static desc(attrs) {
  56554. return new Desc(attrs);
  56555. }
  56556. static digestMethod(attrs) {
  56557. return new DigestMethod(attrs);
  56558. }
  56559. static digestMethods(attrs) {
  56560. return new DigestMethods(attrs);
  56561. }
  56562. static draw(attrs) {
  56563. return new Draw(attrs);
  56564. }
  56565. static edge(attrs) {
  56566. return new Edge(attrs);
  56567. }
  56568. static encoding(attrs) {
  56569. return new Encoding(attrs);
  56570. }
  56571. static encodings(attrs) {
  56572. return new Encodings(attrs);
  56573. }
  56574. static encrypt(attrs) {
  56575. return new Encrypt(attrs);
  56576. }
  56577. static encryptData(attrs) {
  56578. return new EncryptData(attrs);
  56579. }
  56580. static encryption(attrs) {
  56581. return new Encryption(attrs);
  56582. }
  56583. static encryptionMethod(attrs) {
  56584. return new EncryptionMethod(attrs);
  56585. }
  56586. static encryptionMethods(attrs) {
  56587. return new EncryptionMethods(attrs);
  56588. }
  56589. static event(attrs) {
  56590. return new Event(attrs);
  56591. }
  56592. static exData(attrs) {
  56593. return new ExData(attrs);
  56594. }
  56595. static exObject(attrs) {
  56596. return new ExObject(attrs);
  56597. }
  56598. static exclGroup(attrs) {
  56599. return new ExclGroup(attrs);
  56600. }
  56601. static execute(attrs) {
  56602. return new Execute(attrs);
  56603. }
  56604. static extras(attrs) {
  56605. return new Extras(attrs);
  56606. }
  56607. static field(attrs) {
  56608. return new Field(attrs);
  56609. }
  56610. static fill(attrs) {
  56611. return new Fill(attrs);
  56612. }
  56613. static filter(attrs) {
  56614. return new Filter(attrs);
  56615. }
  56616. static float(attrs) {
  56617. return new Float(attrs);
  56618. }
  56619. static font(attrs) {
  56620. return new Font(attrs);
  56621. }
  56622. static format(attrs) {
  56623. return new Format(attrs);
  56624. }
  56625. static handler(attrs) {
  56626. return new Handler(attrs);
  56627. }
  56628. static hyphenation(attrs) {
  56629. return new Hyphenation(attrs);
  56630. }
  56631. static image(attrs) {
  56632. return new Image(attrs);
  56633. }
  56634. static imageEdit(attrs) {
  56635. return new ImageEdit(attrs);
  56636. }
  56637. static integer(attrs) {
  56638. return new Integer(attrs);
  56639. }
  56640. static issuers(attrs) {
  56641. return new Issuers(attrs);
  56642. }
  56643. static items(attrs) {
  56644. return new Items(attrs);
  56645. }
  56646. static keep(attrs) {
  56647. return new Keep(attrs);
  56648. }
  56649. static keyUsage(attrs) {
  56650. return new KeyUsage(attrs);
  56651. }
  56652. static line(attrs) {
  56653. return new Line(attrs);
  56654. }
  56655. static linear(attrs) {
  56656. return new Linear(attrs);
  56657. }
  56658. static lockDocument(attrs) {
  56659. return new LockDocument(attrs);
  56660. }
  56661. static manifest(attrs) {
  56662. return new Manifest(attrs);
  56663. }
  56664. static margin(attrs) {
  56665. return new Margin(attrs);
  56666. }
  56667. static mdp(attrs) {
  56668. return new Mdp(attrs);
  56669. }
  56670. static medium(attrs) {
  56671. return new Medium(attrs);
  56672. }
  56673. static message(attrs) {
  56674. return new Message(attrs);
  56675. }
  56676. static numericEdit(attrs) {
  56677. return new NumericEdit(attrs);
  56678. }
  56679. static occur(attrs) {
  56680. return new Occur(attrs);
  56681. }
  56682. static oid(attrs) {
  56683. return new Oid(attrs);
  56684. }
  56685. static oids(attrs) {
  56686. return new Oids(attrs);
  56687. }
  56688. static overflow(attrs) {
  56689. return new Overflow(attrs);
  56690. }
  56691. static pageArea(attrs) {
  56692. return new PageArea(attrs);
  56693. }
  56694. static pageSet(attrs) {
  56695. return new PageSet(attrs);
  56696. }
  56697. static para(attrs) {
  56698. return new Para(attrs);
  56699. }
  56700. static passwordEdit(attrs) {
  56701. return new PasswordEdit(attrs);
  56702. }
  56703. static pattern(attrs) {
  56704. return new Pattern(attrs);
  56705. }
  56706. static picture(attrs) {
  56707. return new Picture(attrs);
  56708. }
  56709. static proto(attrs) {
  56710. return new Proto(attrs);
  56711. }
  56712. static radial(attrs) {
  56713. return new Radial(attrs);
  56714. }
  56715. static reason(attrs) {
  56716. return new Reason(attrs);
  56717. }
  56718. static reasons(attrs) {
  56719. return new Reasons(attrs);
  56720. }
  56721. static rectangle(attrs) {
  56722. return new Rectangle(attrs);
  56723. }
  56724. static ref(attrs) {
  56725. return new RefElement(attrs);
  56726. }
  56727. static script(attrs) {
  56728. return new Script(attrs);
  56729. }
  56730. static setProperty(attrs) {
  56731. return new SetProperty(attrs);
  56732. }
  56733. static signData(attrs) {
  56734. return new SignData(attrs);
  56735. }
  56736. static signature(attrs) {
  56737. return new Signature(attrs);
  56738. }
  56739. static signing(attrs) {
  56740. return new Signing(attrs);
  56741. }
  56742. static solid(attrs) {
  56743. return new Solid(attrs);
  56744. }
  56745. static speak(attrs) {
  56746. return new Speak(attrs);
  56747. }
  56748. static stipple(attrs) {
  56749. return new Stipple(attrs);
  56750. }
  56751. static subform(attrs) {
  56752. return new Subform(attrs);
  56753. }
  56754. static subformSet(attrs) {
  56755. return new SubformSet(attrs);
  56756. }
  56757. static subjectDN(attrs) {
  56758. return new SubjectDN(attrs);
  56759. }
  56760. static subjectDNs(attrs) {
  56761. return new SubjectDNs(attrs);
  56762. }
  56763. static submit(attrs) {
  56764. return new Submit(attrs);
  56765. }
  56766. static template(attrs) {
  56767. return new Template(attrs);
  56768. }
  56769. static text(attrs) {
  56770. return new Text(attrs);
  56771. }
  56772. static textEdit(attrs) {
  56773. return new TextEdit(attrs);
  56774. }
  56775. static time(attrs) {
  56776. return new Time(attrs);
  56777. }
  56778. static timeStamp(attrs) {
  56779. return new TimeStamp(attrs);
  56780. }
  56781. static toolTip(attrs) {
  56782. return new ToolTip(attrs);
  56783. }
  56784. static traversal(attrs) {
  56785. return new Traversal(attrs);
  56786. }
  56787. static traverse(attrs) {
  56788. return new Traverse(attrs);
  56789. }
  56790. static ui(attrs) {
  56791. return new Ui(attrs);
  56792. }
  56793. static validate(attrs) {
  56794. return new Validate(attrs);
  56795. }
  56796. static value(attrs) {
  56797. return new Value(attrs);
  56798. }
  56799. static variables(attrs) {
  56800. return new Variables(attrs);
  56801. }
  56802. }
  56803. exports.TemplateNamespace = TemplateNamespace;
  56804. /***/ }),
  56805. /* 81 */
  56806. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56807. Object.defineProperty(exports, "__esModule", ({
  56808. value: true
  56809. }));
  56810. exports.addHTML = addHTML;
  56811. exports.checkDimensions = checkDimensions;
  56812. exports.flushHTML = flushHTML;
  56813. exports.getAvailableSpace = getAvailableSpace;
  56814. var _xfa_object = __w_pdfjs_require__(75);
  56815. var _html_utils = __w_pdfjs_require__(82);
  56816. function createLine(node, children) {
  56817. return {
  56818. name: "div",
  56819. attributes: {
  56820. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  56821. },
  56822. children
  56823. };
  56824. }
  56825. function flushHTML(node) {
  56826. if (!node[_xfa_object.$extra]) {
  56827. return null;
  56828. }
  56829. const attributes = node[_xfa_object.$extra].attributes;
  56830. const html = {
  56831. name: "div",
  56832. attributes,
  56833. children: node[_xfa_object.$extra].children
  56834. };
  56835. if (node[_xfa_object.$extra].failingNode) {
  56836. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  56837. if (htmlFromFailing) {
  56838. if (node.layout.endsWith("-tb")) {
  56839. html.children.push(createLine(node, [htmlFromFailing]));
  56840. } else {
  56841. html.children.push(htmlFromFailing);
  56842. }
  56843. }
  56844. }
  56845. if (html.children.length === 0) {
  56846. return null;
  56847. }
  56848. return html;
  56849. }
  56850. function addHTML(node, html, bbox) {
  56851. const extra = node[_xfa_object.$extra];
  56852. const availableSpace = extra.availableSpace;
  56853. const [x, y, w, h] = bbox;
  56854. switch (node.layout) {
  56855. case "position":
  56856. {
  56857. extra.width = Math.max(extra.width, x + w);
  56858. extra.height = Math.max(extra.height, y + h);
  56859. extra.children.push(html);
  56860. break;
  56861. }
  56862. case "lr-tb":
  56863. case "rl-tb":
  56864. if (!extra.line || extra.attempt === 1) {
  56865. extra.line = createLine(node, []);
  56866. extra.children.push(extra.line);
  56867. extra.numberInLine = 0;
  56868. }
  56869. extra.numberInLine += 1;
  56870. extra.line.children.push(html);
  56871. if (extra.attempt === 0) {
  56872. extra.currentWidth += w;
  56873. extra.height = Math.max(extra.height, extra.prevHeight + h);
  56874. } else {
  56875. extra.currentWidth = w;
  56876. extra.prevHeight = extra.height;
  56877. extra.height += h;
  56878. extra.attempt = 0;
  56879. }
  56880. extra.width = Math.max(extra.width, extra.currentWidth);
  56881. break;
  56882. case "rl-row":
  56883. case "row":
  56884. {
  56885. extra.children.push(html);
  56886. extra.width += w;
  56887. extra.height = Math.max(extra.height, h);
  56888. const height = (0, _html_utils.measureToString)(extra.height);
  56889. for (const child of extra.children) {
  56890. child.attributes.style.height = height;
  56891. }
  56892. break;
  56893. }
  56894. case "table":
  56895. {
  56896. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  56897. extra.height += h;
  56898. extra.children.push(html);
  56899. break;
  56900. }
  56901. case "tb":
  56902. {
  56903. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  56904. extra.height += h;
  56905. extra.children.push(html);
  56906. break;
  56907. }
  56908. }
  56909. }
  56910. function getAvailableSpace(node) {
  56911. const availableSpace = node[_xfa_object.$extra].availableSpace;
  56912. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  56913. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  56914. switch (node.layout) {
  56915. case "lr-tb":
  56916. case "rl-tb":
  56917. if (node[_xfa_object.$extra].attempt === 0) {
  56918. return {
  56919. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  56920. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  56921. };
  56922. }
  56923. return {
  56924. width: availableSpace.width - marginH,
  56925. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  56926. };
  56927. case "rl-row":
  56928. case "row":
  56929. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  56930. return {
  56931. width,
  56932. height: availableSpace.height - marginH
  56933. };
  56934. case "table":
  56935. case "tb":
  56936. return {
  56937. width: availableSpace.width - marginH,
  56938. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  56939. };
  56940. case "position":
  56941. default:
  56942. return availableSpace;
  56943. }
  56944. }
  56945. function getTransformedBBox(node) {
  56946. let w = node.w === "" ? NaN : node.w;
  56947. let h = node.h === "" ? NaN : node.h;
  56948. let [centerX, centerY] = [0, 0];
  56949. switch (node.anchorType || "") {
  56950. case "bottomCenter":
  56951. [centerX, centerY] = [w / 2, h];
  56952. break;
  56953. case "bottomLeft":
  56954. [centerX, centerY] = [0, h];
  56955. break;
  56956. case "bottomRight":
  56957. [centerX, centerY] = [w, h];
  56958. break;
  56959. case "middleCenter":
  56960. [centerX, centerY] = [w / 2, h / 2];
  56961. break;
  56962. case "middleLeft":
  56963. [centerX, centerY] = [0, h / 2];
  56964. break;
  56965. case "middleRight":
  56966. [centerX, centerY] = [w, h / 2];
  56967. break;
  56968. case "topCenter":
  56969. [centerX, centerY] = [w / 2, 0];
  56970. break;
  56971. case "topRight":
  56972. [centerX, centerY] = [w, 0];
  56973. break;
  56974. }
  56975. let x, y;
  56976. switch (node.rotate || 0) {
  56977. case 0:
  56978. [x, y] = [-centerX, -centerY];
  56979. break;
  56980. case 90:
  56981. [x, y] = [-centerY, centerX];
  56982. [w, h] = [h, -w];
  56983. break;
  56984. case 180:
  56985. [x, y] = [centerX, centerY];
  56986. [w, h] = [-w, -h];
  56987. break;
  56988. case 270:
  56989. [x, y] = [centerY, -centerX];
  56990. [w, h] = [-h, w];
  56991. break;
  56992. }
  56993. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  56994. }
  56995. function checkDimensions(node, space) {
  56996. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  56997. return true;
  56998. }
  56999. if (node.w === 0 || node.h === 0) {
  57000. return true;
  57001. }
  57002. const ERROR = 2;
  57003. const parent = node[_xfa_object.$getSubformParent]();
  57004. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  57005. const [, y, w, h] = getTransformedBBox(node);
  57006. switch (parent.layout) {
  57007. case "lr-tb":
  57008. case "rl-tb":
  57009. if (attempt === 0) {
  57010. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57011. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57012. return false;
  57013. }
  57014. if (node.w !== "") {
  57015. if (Math.round(w - space.width) <= ERROR) {
  57016. return true;
  57017. }
  57018. if (parent[_xfa_object.$extra].numberInLine === 0) {
  57019. return space.height > ERROR;
  57020. }
  57021. return false;
  57022. }
  57023. return space.width > ERROR;
  57024. }
  57025. if (node.w !== "") {
  57026. return Math.round(w - space.width) <= ERROR;
  57027. }
  57028. return space.width > ERROR;
  57029. }
  57030. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57031. return true;
  57032. }
  57033. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57034. return false;
  57035. }
  57036. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57037. return space.height > ERROR;
  57038. }
  57039. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57040. return false;
  57041. }
  57042. return space.height > ERROR;
  57043. case "table":
  57044. case "tb":
  57045. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57046. return true;
  57047. }
  57048. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  57049. return Math.round(h - space.height) <= ERROR;
  57050. }
  57051. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57052. return space.height > ERROR;
  57053. }
  57054. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57055. return false;
  57056. }
  57057. return space.height > ERROR;
  57058. case "position":
  57059. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57060. return true;
  57061. }
  57062. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  57063. return true;
  57064. }
  57065. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  57066. return h + y > area.h;
  57067. case "rl-row":
  57068. case "row":
  57069. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57070. return true;
  57071. }
  57072. if (node.h !== "") {
  57073. return Math.round(h - space.height) <= ERROR;
  57074. }
  57075. return true;
  57076. default:
  57077. return true;
  57078. }
  57079. }
  57080. /***/ }),
  57081. /* 82 */
  57082. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57083. Object.defineProperty(exports, "__esModule", ({
  57084. value: true
  57085. }));
  57086. exports.computeBbox = computeBbox;
  57087. exports.createWrapper = createWrapper;
  57088. exports.fixDimensions = fixDimensions;
  57089. exports.fixTextIndent = fixTextIndent;
  57090. exports.fixURL = fixURL;
  57091. exports.isPrintOnly = isPrintOnly;
  57092. exports.layoutClass = layoutClass;
  57093. exports.layoutNode = layoutNode;
  57094. exports.measureToString = measureToString;
  57095. exports.setAccess = setAccess;
  57096. exports.setFontFamily = setFontFamily;
  57097. exports.setMinMaxDimensions = setMinMaxDimensions;
  57098. exports.setPara = setPara;
  57099. exports.toStyle = toStyle;
  57100. var _xfa_object = __w_pdfjs_require__(75);
  57101. var _util = __w_pdfjs_require__(2);
  57102. var _utils = __w_pdfjs_require__(76);
  57103. var _fonts = __w_pdfjs_require__(83);
  57104. var _text = __w_pdfjs_require__(84);
  57105. function measureToString(m) {
  57106. if (typeof m === "string") {
  57107. return "0px";
  57108. }
  57109. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  57110. }
  57111. const converters = {
  57112. anchorType(node, style) {
  57113. const parent = node[_xfa_object.$getSubformParent]();
  57114. if (!parent || parent.layout && parent.layout !== "position") {
  57115. return;
  57116. }
  57117. if (!("transform" in style)) {
  57118. style.transform = "";
  57119. }
  57120. switch (node.anchorType) {
  57121. case "bottomCenter":
  57122. style.transform += "translate(-50%, -100%)";
  57123. break;
  57124. case "bottomLeft":
  57125. style.transform += "translate(0,-100%)";
  57126. break;
  57127. case "bottomRight":
  57128. style.transform += "translate(-100%,-100%)";
  57129. break;
  57130. case "middleCenter":
  57131. style.transform += "translate(-50%,-50%)";
  57132. break;
  57133. case "middleLeft":
  57134. style.transform += "translate(0,-50%)";
  57135. break;
  57136. case "middleRight":
  57137. style.transform += "translate(-100%,-50%)";
  57138. break;
  57139. case "topCenter":
  57140. style.transform += "translate(-50%,0)";
  57141. break;
  57142. case "topRight":
  57143. style.transform += "translate(-100%,0)";
  57144. break;
  57145. }
  57146. },
  57147. dimensions(node, style) {
  57148. const parent = node[_xfa_object.$getSubformParent]();
  57149. let width = node.w;
  57150. const height = node.h;
  57151. if (parent.layout && parent.layout.includes("row")) {
  57152. const extra = parent[_xfa_object.$extra];
  57153. const colSpan = node.colSpan;
  57154. let w;
  57155. if (colSpan === -1) {
  57156. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  57157. extra.currentColumn = 0;
  57158. } else {
  57159. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  57160. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  57161. }
  57162. if (!isNaN(w)) {
  57163. width = node.w = w;
  57164. }
  57165. }
  57166. if (width !== "") {
  57167. style.width = measureToString(width);
  57168. } else {
  57169. style.width = "auto";
  57170. }
  57171. if (height !== "") {
  57172. style.height = measureToString(height);
  57173. } else {
  57174. style.height = "auto";
  57175. }
  57176. },
  57177. position(node, style) {
  57178. const parent = node[_xfa_object.$getSubformParent]();
  57179. if (parent && parent.layout && parent.layout !== "position") {
  57180. return;
  57181. }
  57182. style.position = "absolute";
  57183. style.left = measureToString(node.x);
  57184. style.top = measureToString(node.y);
  57185. },
  57186. rotate(node, style) {
  57187. if (node.rotate) {
  57188. if (!("transform" in style)) {
  57189. style.transform = "";
  57190. }
  57191. style.transform += `rotate(-${node.rotate}deg)`;
  57192. style.transformOrigin = "top left";
  57193. }
  57194. },
  57195. presence(node, style) {
  57196. switch (node.presence) {
  57197. case "invisible":
  57198. style.visibility = "hidden";
  57199. break;
  57200. case "hidden":
  57201. case "inactive":
  57202. style.display = "none";
  57203. break;
  57204. }
  57205. },
  57206. hAlign(node, style) {
  57207. if (node[_xfa_object.$nodeName] === "para") {
  57208. switch (node.hAlign) {
  57209. case "justifyAll":
  57210. style.textAlign = "justify-all";
  57211. break;
  57212. case "radix":
  57213. style.textAlign = "left";
  57214. break;
  57215. default:
  57216. style.textAlign = node.hAlign;
  57217. }
  57218. } else {
  57219. switch (node.hAlign) {
  57220. case "left":
  57221. style.alignSelf = "start";
  57222. break;
  57223. case "center":
  57224. style.alignSelf = "center";
  57225. break;
  57226. case "right":
  57227. style.alignSelf = "end";
  57228. break;
  57229. }
  57230. }
  57231. },
  57232. margin(node, style) {
  57233. if (node.margin) {
  57234. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  57235. }
  57236. }
  57237. };
  57238. function setMinMaxDimensions(node, style) {
  57239. const parent = node[_xfa_object.$getSubformParent]();
  57240. if (parent.layout === "position") {
  57241. if (node.minW > 0) {
  57242. style.minWidth = measureToString(node.minW);
  57243. }
  57244. if (node.maxW > 0) {
  57245. style.maxWidth = measureToString(node.maxW);
  57246. }
  57247. if (node.minH > 0) {
  57248. style.minHeight = measureToString(node.minH);
  57249. }
  57250. if (node.maxH > 0) {
  57251. style.maxHeight = measureToString(node.maxH);
  57252. }
  57253. }
  57254. }
  57255. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  57256. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  57257. if (typeof text === "string") {
  57258. measure.addString(text);
  57259. } else {
  57260. text[_xfa_object.$pushGlyphs](measure);
  57261. }
  57262. return measure.compute(width);
  57263. }
  57264. function layoutNode(node, availableSpace) {
  57265. let height = null;
  57266. let width = null;
  57267. let isBroken = false;
  57268. if ((!node.w || !node.h) && node.value) {
  57269. let marginH = 0;
  57270. let marginV = 0;
  57271. if (node.margin) {
  57272. marginH = node.margin.leftInset + node.margin.rightInset;
  57273. marginV = node.margin.topInset + node.margin.bottomInset;
  57274. }
  57275. let lineHeight = null;
  57276. let margin = null;
  57277. if (node.para) {
  57278. margin = Object.create(null);
  57279. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  57280. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  57281. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  57282. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  57283. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  57284. }
  57285. let font = node.font;
  57286. if (!font) {
  57287. const root = node[_xfa_object.$getTemplateRoot]();
  57288. let parent = node[_xfa_object.$getParent]();
  57289. while (parent && parent !== root) {
  57290. if (parent.font) {
  57291. font = parent.font;
  57292. break;
  57293. }
  57294. parent = parent[_xfa_object.$getParent]();
  57295. }
  57296. }
  57297. const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
  57298. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  57299. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  57300. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  57301. width = res.width;
  57302. height = res.height;
  57303. isBroken = res.isBroken;
  57304. } else {
  57305. const text = node.value[_xfa_object.$text]();
  57306. if (text) {
  57307. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  57308. width = res.width;
  57309. height = res.height;
  57310. isBroken = res.isBroken;
  57311. }
  57312. }
  57313. if (width !== null && !node.w) {
  57314. width += marginH;
  57315. }
  57316. if (height !== null && !node.h) {
  57317. height += marginV;
  57318. }
  57319. }
  57320. return {
  57321. w: width,
  57322. h: height,
  57323. isBroken
  57324. };
  57325. }
  57326. function computeBbox(node, html, availableSpace) {
  57327. let bbox;
  57328. if (node.w !== "" && node.h !== "") {
  57329. bbox = [node.x, node.y, node.w, node.h];
  57330. } else {
  57331. if (!availableSpace) {
  57332. return null;
  57333. }
  57334. let width = node.w;
  57335. if (width === "") {
  57336. if (node.maxW === 0) {
  57337. const parent = node[_xfa_object.$getSubformParent]();
  57338. if (parent.layout === "position" && parent.w !== "") {
  57339. width = 0;
  57340. } else {
  57341. width = node.minW;
  57342. }
  57343. } else {
  57344. width = Math.min(node.maxW, availableSpace.width);
  57345. }
  57346. html.attributes.style.width = measureToString(width);
  57347. }
  57348. let height = node.h;
  57349. if (height === "") {
  57350. if (node.maxH === 0) {
  57351. const parent = node[_xfa_object.$getSubformParent]();
  57352. if (parent.layout === "position" && parent.h !== "") {
  57353. height = 0;
  57354. } else {
  57355. height = node.minH;
  57356. }
  57357. } else {
  57358. height = Math.min(node.maxH, availableSpace.height);
  57359. }
  57360. html.attributes.style.height = measureToString(height);
  57361. }
  57362. bbox = [node.x, node.y, width, height];
  57363. }
  57364. return bbox;
  57365. }
  57366. function fixDimensions(node) {
  57367. const parent = node[_xfa_object.$getSubformParent]();
  57368. if (parent.layout && parent.layout.includes("row")) {
  57369. const extra = parent[_xfa_object.$extra];
  57370. const colSpan = node.colSpan;
  57371. let width;
  57372. if (colSpan === -1) {
  57373. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  57374. } else {
  57375. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  57376. }
  57377. if (!isNaN(width)) {
  57378. node.w = width;
  57379. }
  57380. }
  57381. if (parent.layout && parent.layout !== "position") {
  57382. node.x = node.y = 0;
  57383. }
  57384. if (node.layout === "table") {
  57385. if (node.w === "" && Array.isArray(node.columnWidths)) {
  57386. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  57387. }
  57388. }
  57389. }
  57390. function layoutClass(node) {
  57391. switch (node.layout) {
  57392. case "position":
  57393. return "xfaPosition";
  57394. case "lr-tb":
  57395. return "xfaLrTb";
  57396. case "rl-row":
  57397. return "xfaRlRow";
  57398. case "rl-tb":
  57399. return "xfaRlTb";
  57400. case "row":
  57401. return "xfaRow";
  57402. case "table":
  57403. return "xfaTable";
  57404. case "tb":
  57405. return "xfaTb";
  57406. default:
  57407. return "xfaPosition";
  57408. }
  57409. }
  57410. function toStyle(node, ...names) {
  57411. const style = Object.create(null);
  57412. for (const name of names) {
  57413. const value = node[name];
  57414. if (value === null) {
  57415. continue;
  57416. }
  57417. if (converters.hasOwnProperty(name)) {
  57418. converters[name](node, style);
  57419. continue;
  57420. }
  57421. if (value instanceof _xfa_object.XFAObject) {
  57422. const newStyle = value[_xfa_object.$toStyle]();
  57423. if (newStyle) {
  57424. Object.assign(style, newStyle);
  57425. } else {
  57426. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  57427. }
  57428. }
  57429. }
  57430. return style;
  57431. }
  57432. function createWrapper(node, html) {
  57433. const {
  57434. attributes
  57435. } = html;
  57436. const {
  57437. style
  57438. } = attributes;
  57439. const wrapper = {
  57440. name: "div",
  57441. attributes: {
  57442. class: ["xfaWrapper"],
  57443. style: Object.create(null)
  57444. },
  57445. children: []
  57446. };
  57447. attributes.class.push("xfaWrapped");
  57448. if (node.border) {
  57449. const {
  57450. widths,
  57451. insets
  57452. } = node.border[_xfa_object.$extra];
  57453. let width, height;
  57454. let top = insets[0];
  57455. let left = insets[3];
  57456. const insetsH = insets[0] + insets[2];
  57457. const insetsW = insets[1] + insets[3];
  57458. switch (node.border.hand) {
  57459. case "even":
  57460. top -= widths[0] / 2;
  57461. left -= widths[3] / 2;
  57462. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  57463. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  57464. break;
  57465. case "left":
  57466. top -= widths[0];
  57467. left -= widths[3];
  57468. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  57469. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  57470. break;
  57471. case "right":
  57472. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  57473. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  57474. break;
  57475. }
  57476. const classNames = ["xfaBorder"];
  57477. if (isPrintOnly(node.border)) {
  57478. classNames.push("xfaPrintOnly");
  57479. }
  57480. const border = {
  57481. name: "div",
  57482. attributes: {
  57483. class: classNames,
  57484. style: {
  57485. top: `${top}px`,
  57486. left: `${left}px`,
  57487. width,
  57488. height
  57489. }
  57490. },
  57491. children: []
  57492. };
  57493. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  57494. if (style[key] !== undefined) {
  57495. border.attributes.style[key] = style[key];
  57496. delete style[key];
  57497. }
  57498. }
  57499. wrapper.children.push(border, html);
  57500. } else {
  57501. wrapper.children.push(html);
  57502. }
  57503. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  57504. if (style[key] !== undefined) {
  57505. wrapper.attributes.style[key] = style[key];
  57506. delete style[key];
  57507. }
  57508. }
  57509. if (style.position === "absolute") {
  57510. wrapper.attributes.style.position = "absolute";
  57511. } else {
  57512. wrapper.attributes.style.position = "relative";
  57513. }
  57514. delete style.position;
  57515. if (style.alignSelf) {
  57516. wrapper.attributes.style.alignSelf = style.alignSelf;
  57517. delete style.alignSelf;
  57518. }
  57519. return wrapper;
  57520. }
  57521. function fixTextIndent(styles) {
  57522. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  57523. if (indent >= 0) {
  57524. return;
  57525. }
  57526. const align = styles.textAlign === "right" ? "right" : "left";
  57527. const name = "padding" + (align === "left" ? "Left" : "Right");
  57528. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  57529. styles[name] = `${padding - indent}px`;
  57530. }
  57531. function setAccess(node, classNames) {
  57532. switch (node.access) {
  57533. case "nonInteractive":
  57534. classNames.push("xfaNonInteractive");
  57535. break;
  57536. case "readOnly":
  57537. classNames.push("xfaReadOnly");
  57538. break;
  57539. case "protected":
  57540. classNames.push("xfaDisabled");
  57541. break;
  57542. }
  57543. }
  57544. function isPrintOnly(node) {
  57545. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  57546. }
  57547. function getCurrentPara(node) {
  57548. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  57549. return stack.length ? stack[stack.length - 1] : null;
  57550. }
  57551. function setPara(node, nodeStyle, value) {
  57552. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  57553. if (nodeStyle) {
  57554. if (node.h === "") {
  57555. nodeStyle.height = "auto";
  57556. }
  57557. if (node.w === "") {
  57558. nodeStyle.width = "auto";
  57559. }
  57560. }
  57561. const para = getCurrentPara(node);
  57562. if (para) {
  57563. const valueStyle = value.attributes.style;
  57564. valueStyle.display = "flex";
  57565. valueStyle.flexDirection = "column";
  57566. switch (para.vAlign) {
  57567. case "top":
  57568. valueStyle.justifyContent = "start";
  57569. break;
  57570. case "bottom":
  57571. valueStyle.justifyContent = "end";
  57572. break;
  57573. case "middle":
  57574. valueStyle.justifyContent = "center";
  57575. break;
  57576. }
  57577. const paraStyle = para[_xfa_object.$toStyle]();
  57578. for (const [key, val] of Object.entries(paraStyle)) {
  57579. if (!(key in valueStyle)) {
  57580. valueStyle[key] = val;
  57581. }
  57582. }
  57583. }
  57584. }
  57585. }
  57586. function setFontFamily(xfaFont, node, fontFinder, style) {
  57587. if (!fontFinder) {
  57588. delete style.fontFamily;
  57589. return;
  57590. }
  57591. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57592. style.fontFamily = `"${name}"`;
  57593. const typeface = fontFinder.find(name);
  57594. if (typeface) {
  57595. const {
  57596. fontFamily
  57597. } = typeface.regular.cssFontInfo;
  57598. if (fontFamily !== name) {
  57599. style.fontFamily = `"${fontFamily}"`;
  57600. }
  57601. const para = getCurrentPara(node);
  57602. if (para && para.lineHeight !== "") {
  57603. return;
  57604. }
  57605. if (style.lineHeight) {
  57606. return;
  57607. }
  57608. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  57609. if (pdfFont) {
  57610. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  57611. }
  57612. }
  57613. }
  57614. function fixURL(str) {
  57615. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  57616. addDefaultProtocol: true,
  57617. tryConvertEncoding: true
  57618. });
  57619. return absoluteUrl ? absoluteUrl.href : null;
  57620. }
  57621. /***/ }),
  57622. /* 83 */
  57623. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57624. Object.defineProperty(exports, "__esModule", ({
  57625. value: true
  57626. }));
  57627. exports.FontFinder = void 0;
  57628. exports.getMetrics = getMetrics;
  57629. exports.selectFont = selectFont;
  57630. var _xfa_object = __w_pdfjs_require__(75);
  57631. var _utils = __w_pdfjs_require__(76);
  57632. var _util = __w_pdfjs_require__(2);
  57633. class FontFinder {
  57634. constructor(pdfFonts) {
  57635. this.fonts = new Map();
  57636. this.cache = new Map();
  57637. this.warned = new Set();
  57638. this.defaultFont = null;
  57639. this.add(pdfFonts);
  57640. }
  57641. add(pdfFonts, reallyMissingFonts = null) {
  57642. for (const pdfFont of pdfFonts) {
  57643. this.addPdfFont(pdfFont);
  57644. }
  57645. for (const pdfFont of this.fonts.values()) {
  57646. if (!pdfFont.regular) {
  57647. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  57648. }
  57649. }
  57650. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  57651. return;
  57652. }
  57653. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  57654. for (const missing of reallyMissingFonts) {
  57655. this.fonts.set(missing, myriad);
  57656. }
  57657. }
  57658. addPdfFont(pdfFont) {
  57659. const cssFontInfo = pdfFont.cssFontInfo;
  57660. const name = cssFontInfo.fontFamily;
  57661. let font = this.fonts.get(name);
  57662. if (!font) {
  57663. font = Object.create(null);
  57664. this.fonts.set(name, font);
  57665. if (!this.defaultFont) {
  57666. this.defaultFont = font;
  57667. }
  57668. }
  57669. let property = "";
  57670. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  57671. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  57672. property = fontWeight >= 700 ? "bolditalic" : "italic";
  57673. } else if (fontWeight >= 700) {
  57674. property = "bold";
  57675. }
  57676. if (!property) {
  57677. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  57678. property = "bold";
  57679. }
  57680. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  57681. property += "italic";
  57682. }
  57683. }
  57684. if (!property) {
  57685. property = "regular";
  57686. }
  57687. font[property] = pdfFont;
  57688. }
  57689. getDefault() {
  57690. return this.defaultFont;
  57691. }
  57692. find(fontName, mustWarn = true) {
  57693. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  57694. if (font) {
  57695. return font;
  57696. }
  57697. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  57698. let name = fontName.replace(pattern, "");
  57699. font = this.fonts.get(name);
  57700. if (font) {
  57701. this.cache.set(fontName, font);
  57702. return font;
  57703. }
  57704. name = name.toLowerCase();
  57705. const maybe = [];
  57706. for (const [family, pdfFont] of this.fonts.entries()) {
  57707. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57708. maybe.push(pdfFont);
  57709. }
  57710. }
  57711. if (maybe.length === 0) {
  57712. for (const [, pdfFont] of this.fonts.entries()) {
  57713. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57714. maybe.push(pdfFont);
  57715. }
  57716. }
  57717. }
  57718. if (maybe.length === 0) {
  57719. name = name.replace(/psmt|mt/gi, "");
  57720. for (const [family, pdfFont] of this.fonts.entries()) {
  57721. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57722. maybe.push(pdfFont);
  57723. }
  57724. }
  57725. }
  57726. if (maybe.length === 0) {
  57727. for (const pdfFont of this.fonts.values()) {
  57728. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57729. maybe.push(pdfFont);
  57730. }
  57731. }
  57732. }
  57733. if (maybe.length >= 1) {
  57734. if (maybe.length !== 1 && mustWarn) {
  57735. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  57736. }
  57737. this.cache.set(fontName, maybe[0]);
  57738. return maybe[0];
  57739. }
  57740. if (mustWarn && !this.warned.has(fontName)) {
  57741. this.warned.add(fontName);
  57742. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  57743. }
  57744. return null;
  57745. }
  57746. }
  57747. exports.FontFinder = FontFinder;
  57748. function selectFont(xfaFont, typeface) {
  57749. if (xfaFont.posture === "italic") {
  57750. if (xfaFont.weight === "bold") {
  57751. return typeface.bolditalic;
  57752. }
  57753. return typeface.italic;
  57754. } else if (xfaFont.weight === "bold") {
  57755. return typeface.bold;
  57756. }
  57757. return typeface.regular;
  57758. }
  57759. function getMetrics(xfaFont, real = false) {
  57760. let pdfFont = null;
  57761. if (xfaFont) {
  57762. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57763. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  57764. pdfFont = selectFont(xfaFont, typeface);
  57765. }
  57766. if (!pdfFont) {
  57767. return {
  57768. lineHeight: 12,
  57769. lineGap: 2,
  57770. lineNoGap: 10
  57771. };
  57772. }
  57773. const size = xfaFont.size || 10;
  57774. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  57775. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  57776. return {
  57777. lineHeight: lineHeight * size,
  57778. lineGap: lineGap * size,
  57779. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  57780. };
  57781. }
  57782. /***/ }),
  57783. /* 84 */
  57784. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57785. Object.defineProperty(exports, "__esModule", ({
  57786. value: true
  57787. }));
  57788. exports.TextMeasure = void 0;
  57789. var _fonts = __w_pdfjs_require__(83);
  57790. const WIDTH_FACTOR = 1.02;
  57791. class FontInfo {
  57792. constructor(xfaFont, margin, lineHeight, fontFinder) {
  57793. this.lineHeight = lineHeight;
  57794. this.paraMargin = margin || {
  57795. top: 0,
  57796. bottom: 0,
  57797. left: 0,
  57798. right: 0
  57799. };
  57800. if (!xfaFont) {
  57801. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57802. return;
  57803. }
  57804. this.xfaFont = {
  57805. typeface: xfaFont.typeface,
  57806. posture: xfaFont.posture,
  57807. weight: xfaFont.weight,
  57808. size: xfaFont.size,
  57809. letterSpacing: xfaFont.letterSpacing
  57810. };
  57811. const typeface = fontFinder.find(xfaFont.typeface);
  57812. if (!typeface) {
  57813. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57814. return;
  57815. }
  57816. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  57817. if (!this.pdfFont) {
  57818. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57819. }
  57820. }
  57821. defaultFont(fontFinder) {
  57822. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  57823. if (font && font.regular) {
  57824. const pdfFont = font.regular;
  57825. const info = pdfFont.cssFontInfo;
  57826. const xfaFont = {
  57827. typeface: info.fontFamily,
  57828. posture: "normal",
  57829. weight: "normal",
  57830. size: 10,
  57831. letterSpacing: 0
  57832. };
  57833. return [pdfFont, xfaFont];
  57834. }
  57835. const xfaFont = {
  57836. typeface: "Courier",
  57837. posture: "normal",
  57838. weight: "normal",
  57839. size: 10,
  57840. letterSpacing: 0
  57841. };
  57842. return [null, xfaFont];
  57843. }
  57844. }
  57845. class FontSelector {
  57846. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  57847. this.fontFinder = fontFinder;
  57848. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  57849. }
  57850. pushData(xfaFont, margin, lineHeight) {
  57851. const lastFont = this.stack[this.stack.length - 1];
  57852. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  57853. if (!xfaFont[name]) {
  57854. xfaFont[name] = lastFont.xfaFont[name];
  57855. }
  57856. }
  57857. for (const name of ["top", "bottom", "left", "right"]) {
  57858. if (isNaN(margin[name])) {
  57859. margin[name] = lastFont.paraMargin[name];
  57860. }
  57861. }
  57862. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  57863. if (!fontInfo.pdfFont) {
  57864. fontInfo.pdfFont = lastFont.pdfFont;
  57865. }
  57866. this.stack.push(fontInfo);
  57867. }
  57868. popFont() {
  57869. this.stack.pop();
  57870. }
  57871. topFont() {
  57872. return this.stack[this.stack.length - 1];
  57873. }
  57874. }
  57875. class TextMeasure {
  57876. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  57877. this.glyphs = [];
  57878. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  57879. this.extraHeight = 0;
  57880. }
  57881. pushData(xfaFont, margin, lineHeight) {
  57882. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  57883. }
  57884. popFont(xfaFont) {
  57885. return this.fontSelector.popFont();
  57886. }
  57887. addPara() {
  57888. const lastFont = this.fontSelector.topFont();
  57889. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  57890. }
  57891. addString(str) {
  57892. if (!str) {
  57893. return;
  57894. }
  57895. const lastFont = this.fontSelector.topFont();
  57896. const fontSize = lastFont.xfaFont.size;
  57897. if (lastFont.pdfFont) {
  57898. const letterSpacing = lastFont.xfaFont.letterSpacing;
  57899. const pdfFont = lastFont.pdfFont;
  57900. const fontLineHeight = pdfFont.lineHeight || 1.2;
  57901. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  57902. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  57903. const noGap = fontLineHeight - lineGap;
  57904. const firstLineHeight = Math.max(1, noGap) * fontSize;
  57905. const scale = fontSize / 1000;
  57906. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  57907. for (const line of str.split(/[\u2029\n]/)) {
  57908. const encodedLine = pdfFont.encodeString(line).join("");
  57909. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  57910. for (const glyph of glyphs) {
  57911. const width = glyph.width || fallbackWidth;
  57912. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  57913. }
  57914. this.glyphs.push([0, 0, 0, "\n", true]);
  57915. }
  57916. this.glyphs.pop();
  57917. return;
  57918. }
  57919. for (const line of str.split(/[\u2029\n]/)) {
  57920. for (const char of line.split("")) {
  57921. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  57922. }
  57923. this.glyphs.push([0, 0, 0, "\n", true]);
  57924. }
  57925. this.glyphs.pop();
  57926. }
  57927. compute(maxWidth) {
  57928. let lastSpacePos = -1,
  57929. lastSpaceWidth = 0,
  57930. width = 0,
  57931. height = 0,
  57932. currentLineWidth = 0,
  57933. currentLineHeight = 0;
  57934. let isBroken = false;
  57935. let isFirstLine = true;
  57936. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  57937. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  57938. const isSpace = char === " ";
  57939. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  57940. if (isEOL) {
  57941. width = Math.max(width, currentLineWidth);
  57942. currentLineWidth = 0;
  57943. height += currentLineHeight;
  57944. currentLineHeight = glyphHeight;
  57945. lastSpacePos = -1;
  57946. lastSpaceWidth = 0;
  57947. isFirstLine = false;
  57948. continue;
  57949. }
  57950. if (isSpace) {
  57951. if (currentLineWidth + glyphWidth > maxWidth) {
  57952. width = Math.max(width, currentLineWidth);
  57953. currentLineWidth = 0;
  57954. height += currentLineHeight;
  57955. currentLineHeight = glyphHeight;
  57956. lastSpacePos = -1;
  57957. lastSpaceWidth = 0;
  57958. isBroken = true;
  57959. isFirstLine = false;
  57960. } else {
  57961. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  57962. lastSpaceWidth = currentLineWidth;
  57963. currentLineWidth += glyphWidth;
  57964. lastSpacePos = i;
  57965. }
  57966. continue;
  57967. }
  57968. if (currentLineWidth + glyphWidth > maxWidth) {
  57969. height += currentLineHeight;
  57970. currentLineHeight = glyphHeight;
  57971. if (lastSpacePos !== -1) {
  57972. i = lastSpacePos;
  57973. width = Math.max(width, lastSpaceWidth);
  57974. currentLineWidth = 0;
  57975. lastSpacePos = -1;
  57976. lastSpaceWidth = 0;
  57977. } else {
  57978. width = Math.max(width, currentLineWidth);
  57979. currentLineWidth = glyphWidth;
  57980. }
  57981. isBroken = true;
  57982. isFirstLine = false;
  57983. continue;
  57984. }
  57985. currentLineWidth += glyphWidth;
  57986. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  57987. }
  57988. width = Math.max(width, currentLineWidth);
  57989. height += currentLineHeight + this.extraHeight;
  57990. return {
  57991. width: WIDTH_FACTOR * width,
  57992. height,
  57993. isBroken
  57994. };
  57995. }
  57996. }
  57997. exports.TextMeasure = TextMeasure;
  57998. /***/ }),
  57999. /* 85 */
  58000. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58001. Object.defineProperty(exports, "__esModule", ({
  58002. value: true
  58003. }));
  58004. exports.DataHandler = void 0;
  58005. var _xfa_object = __w_pdfjs_require__(75);
  58006. class DataHandler {
  58007. constructor(root, data) {
  58008. this.data = data;
  58009. this.dataset = root.datasets || null;
  58010. }
  58011. serialize(storage) {
  58012. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  58013. while (stack.length > 0) {
  58014. const last = stack[stack.length - 1];
  58015. const [i, children] = last;
  58016. if (i + 1 === children.length) {
  58017. stack.pop();
  58018. continue;
  58019. }
  58020. const child = children[++last[0]];
  58021. const storageEntry = storage.get(child[_xfa_object.$uid]);
  58022. if (storageEntry) {
  58023. child[_xfa_object.$setValue](storageEntry);
  58024. } else {
  58025. const attributes = child[_xfa_object.$getAttributes]();
  58026. for (const value of attributes.values()) {
  58027. const entry = storage.get(value[_xfa_object.$uid]);
  58028. if (entry) {
  58029. value[_xfa_object.$setValue](entry);
  58030. break;
  58031. }
  58032. }
  58033. }
  58034. const nodes = child[_xfa_object.$getChildren]();
  58035. if (nodes.length > 0) {
  58036. stack.push([-1, nodes]);
  58037. }
  58038. }
  58039. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  58040. if (this.dataset) {
  58041. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  58042. if (child[_xfa_object.$nodeName] !== "data") {
  58043. child[_xfa_object.$toString](buf);
  58044. }
  58045. }
  58046. }
  58047. this.data[_xfa_object.$toString](buf);
  58048. buf.push("</xfa:datasets>");
  58049. return buf.join("");
  58050. }
  58051. }
  58052. exports.DataHandler = DataHandler;
  58053. /***/ }),
  58054. /* 86 */
  58055. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58056. Object.defineProperty(exports, "__esModule", ({
  58057. value: true
  58058. }));
  58059. exports.XFAParser = void 0;
  58060. var _xfa_object = __w_pdfjs_require__(75);
  58061. var _xml_parser = __w_pdfjs_require__(68);
  58062. var _builder = __w_pdfjs_require__(87);
  58063. var _util = __w_pdfjs_require__(2);
  58064. class XFAParser extends _xml_parser.XMLParserBase {
  58065. constructor(rootNameSpace = null, richText = false) {
  58066. super();
  58067. this._builder = new _builder.Builder(rootNameSpace);
  58068. this._stack = [];
  58069. this._globalData = {
  58070. usedTypefaces: new Set()
  58071. };
  58072. this._ids = new Map();
  58073. this._current = this._builder.buildRoot(this._ids);
  58074. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  58075. this._whiteRegex = /^\s+$/;
  58076. this._nbsps = /\xa0+/g;
  58077. this._richText = richText;
  58078. }
  58079. parse(data) {
  58080. this.parseXml(data);
  58081. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  58082. return undefined;
  58083. }
  58084. this._current[_xfa_object.$finalize]();
  58085. return this._current.element;
  58086. }
  58087. onText(text) {
  58088. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  58089. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  58090. this._current[_xfa_object.$onText](text, this._richText);
  58091. return;
  58092. }
  58093. if (this._whiteRegex.test(text)) {
  58094. return;
  58095. }
  58096. this._current[_xfa_object.$onText](text.trim());
  58097. }
  58098. onCdata(text) {
  58099. this._current[_xfa_object.$onText](text);
  58100. }
  58101. _mkAttributes(attributes, tagName) {
  58102. let namespace = null;
  58103. let prefixes = null;
  58104. const attributeObj = Object.create({});
  58105. for (const {
  58106. name,
  58107. value
  58108. } of attributes) {
  58109. if (name === "xmlns") {
  58110. if (!namespace) {
  58111. namespace = value;
  58112. } else {
  58113. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  58114. }
  58115. } else if (name.startsWith("xmlns:")) {
  58116. const prefix = name.substring("xmlns:".length);
  58117. if (!prefixes) {
  58118. prefixes = [];
  58119. }
  58120. prefixes.push({
  58121. prefix,
  58122. value
  58123. });
  58124. } else {
  58125. const i = name.indexOf(":");
  58126. if (i === -1) {
  58127. attributeObj[name] = value;
  58128. } else {
  58129. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  58130. if (!nsAttrs) {
  58131. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  58132. }
  58133. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  58134. let attrs = nsAttrs[ns];
  58135. if (!attrs) {
  58136. attrs = nsAttrs[ns] = Object.create(null);
  58137. }
  58138. attrs[attrName] = value;
  58139. }
  58140. }
  58141. }
  58142. return [namespace, prefixes, attributeObj];
  58143. }
  58144. _getNameAndPrefix(name, nsAgnostic) {
  58145. const i = name.indexOf(":");
  58146. if (i === -1) {
  58147. return [name, null];
  58148. }
  58149. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  58150. }
  58151. onBeginElement(tagName, attributes, isEmpty) {
  58152. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  58153. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  58154. const node = this._builder.build({
  58155. nsPrefix,
  58156. name,
  58157. attributes: attributesObj,
  58158. namespace,
  58159. prefixes
  58160. });
  58161. node[_xfa_object.$globalData] = this._globalData;
  58162. if (isEmpty) {
  58163. node[_xfa_object.$finalize]();
  58164. if (this._current[_xfa_object.$onChild](node)) {
  58165. node[_xfa_object.$setId](this._ids);
  58166. }
  58167. node[_xfa_object.$clean](this._builder);
  58168. return;
  58169. }
  58170. this._stack.push(this._current);
  58171. this._current = node;
  58172. }
  58173. onEndElement(name) {
  58174. const node = this._current;
  58175. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  58176. const parser = new XFAParser();
  58177. parser._globalData = this._globalData;
  58178. const root = parser.parse(node[_xfa_object.$content]);
  58179. node[_xfa_object.$content] = null;
  58180. node[_xfa_object.$onChild](root);
  58181. }
  58182. node[_xfa_object.$finalize]();
  58183. this._current = this._stack.pop();
  58184. if (this._current[_xfa_object.$onChild](node)) {
  58185. node[_xfa_object.$setId](this._ids);
  58186. }
  58187. node[_xfa_object.$clean](this._builder);
  58188. }
  58189. onError(code) {
  58190. this._errorCode = code;
  58191. }
  58192. }
  58193. exports.XFAParser = XFAParser;
  58194. /***/ }),
  58195. /* 87 */
  58196. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58197. Object.defineProperty(exports, "__esModule", ({
  58198. value: true
  58199. }));
  58200. exports.Builder = void 0;
  58201. var _namespaces = __w_pdfjs_require__(77);
  58202. var _xfa_object = __w_pdfjs_require__(75);
  58203. var _setup = __w_pdfjs_require__(88);
  58204. var _template = __w_pdfjs_require__(80);
  58205. var _unknown = __w_pdfjs_require__(97);
  58206. var _util = __w_pdfjs_require__(2);
  58207. class Root extends _xfa_object.XFAObject {
  58208. constructor(ids) {
  58209. super(-1, "root", Object.create(null));
  58210. this.element = null;
  58211. this[_xfa_object.$ids] = ids;
  58212. }
  58213. [_xfa_object.$onChild](child) {
  58214. this.element = child;
  58215. return true;
  58216. }
  58217. [_xfa_object.$finalize]() {
  58218. super[_xfa_object.$finalize]();
  58219. if (this.element.template instanceof _template.Template) {
  58220. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  58221. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  58222. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  58223. }
  58224. }
  58225. }
  58226. class Empty extends _xfa_object.XFAObject {
  58227. constructor() {
  58228. super(-1, "", Object.create(null));
  58229. }
  58230. [_xfa_object.$onChild](_) {
  58231. return false;
  58232. }
  58233. }
  58234. class Builder {
  58235. constructor(rootNameSpace = null) {
  58236. this._namespaceStack = [];
  58237. this._nsAgnosticLevel = 0;
  58238. this._namespacePrefixes = new Map();
  58239. this._namespaces = new Map();
  58240. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  58241. id
  58242. }) => id));
  58243. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  58244. }
  58245. buildRoot(ids) {
  58246. return new Root(ids);
  58247. }
  58248. build({
  58249. nsPrefix,
  58250. name,
  58251. attributes,
  58252. namespace,
  58253. prefixes
  58254. }) {
  58255. const hasNamespaceDef = namespace !== null;
  58256. if (hasNamespaceDef) {
  58257. this._namespaceStack.push(this._currentNamespace);
  58258. this._currentNamespace = this._searchNamespace(namespace);
  58259. }
  58260. if (prefixes) {
  58261. this._addNamespacePrefix(prefixes);
  58262. }
  58263. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  58264. const dataTemplate = _setup.NamespaceSetUp.datasets;
  58265. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  58266. let xfaAttrs = null;
  58267. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  58268. const nsToUse = this._getNamespaceToUse(ns);
  58269. if (nsToUse === dataTemplate) {
  58270. xfaAttrs = {
  58271. xfa: attrs
  58272. };
  58273. break;
  58274. }
  58275. }
  58276. if (xfaAttrs) {
  58277. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  58278. } else {
  58279. delete attributes[_xfa_object.$nsAttributes];
  58280. }
  58281. }
  58282. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  58283. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  58284. if (node[_xfa_object.$isNsAgnostic]()) {
  58285. this._nsAgnosticLevel++;
  58286. }
  58287. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  58288. node[_xfa_object.$cleanup] = {
  58289. hasNamespace: hasNamespaceDef,
  58290. prefixes,
  58291. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  58292. };
  58293. }
  58294. return node;
  58295. }
  58296. isNsAgnostic() {
  58297. return this._nsAgnosticLevel > 0;
  58298. }
  58299. _searchNamespace(nsName) {
  58300. let ns = this._namespaces.get(nsName);
  58301. if (ns) {
  58302. return ns;
  58303. }
  58304. for (const [name, {
  58305. check
  58306. }] of Object.entries(_namespaces.NamespaceIds)) {
  58307. if (check(nsName)) {
  58308. ns = _setup.NamespaceSetUp[name];
  58309. if (ns) {
  58310. this._namespaces.set(nsName, ns);
  58311. return ns;
  58312. }
  58313. break;
  58314. }
  58315. }
  58316. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  58317. this._namespaces.set(nsName, ns);
  58318. return ns;
  58319. }
  58320. _addNamespacePrefix(prefixes) {
  58321. for (const {
  58322. prefix,
  58323. value
  58324. } of prefixes) {
  58325. const namespace = this._searchNamespace(value);
  58326. let prefixStack = this._namespacePrefixes.get(prefix);
  58327. if (!prefixStack) {
  58328. prefixStack = [];
  58329. this._namespacePrefixes.set(prefix, prefixStack);
  58330. }
  58331. prefixStack.push(namespace);
  58332. }
  58333. }
  58334. _getNamespaceToUse(prefix) {
  58335. if (!prefix) {
  58336. return this._currentNamespace;
  58337. }
  58338. const prefixStack = this._namespacePrefixes.get(prefix);
  58339. if (prefixStack && prefixStack.length > 0) {
  58340. return prefixStack[prefixStack.length - 1];
  58341. }
  58342. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  58343. return null;
  58344. }
  58345. clean(data) {
  58346. const {
  58347. hasNamespace,
  58348. prefixes,
  58349. nsAgnostic
  58350. } = data;
  58351. if (hasNamespace) {
  58352. this._currentNamespace = this._namespaceStack.pop();
  58353. }
  58354. if (prefixes) {
  58355. prefixes.forEach(({
  58356. prefix
  58357. }) => {
  58358. this._namespacePrefixes.get(prefix).pop();
  58359. });
  58360. }
  58361. if (nsAgnostic) {
  58362. this._nsAgnosticLevel--;
  58363. }
  58364. }
  58365. }
  58366. exports.Builder = Builder;
  58367. /***/ }),
  58368. /* 88 */
  58369. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58370. Object.defineProperty(exports, "__esModule", ({
  58371. value: true
  58372. }));
  58373. exports.NamespaceSetUp = void 0;
  58374. var _config = __w_pdfjs_require__(89);
  58375. var _connection_set = __w_pdfjs_require__(90);
  58376. var _datasets = __w_pdfjs_require__(91);
  58377. var _locale_set = __w_pdfjs_require__(92);
  58378. var _signature = __w_pdfjs_require__(93);
  58379. var _stylesheet = __w_pdfjs_require__(94);
  58380. var _template = __w_pdfjs_require__(80);
  58381. var _xdp = __w_pdfjs_require__(95);
  58382. var _xhtml = __w_pdfjs_require__(96);
  58383. const NamespaceSetUp = {
  58384. config: _config.ConfigNamespace,
  58385. connection: _connection_set.ConnectionSetNamespace,
  58386. datasets: _datasets.DatasetsNamespace,
  58387. localeSet: _locale_set.LocaleSetNamespace,
  58388. signature: _signature.SignatureNamespace,
  58389. stylesheet: _stylesheet.StylesheetNamespace,
  58390. template: _template.TemplateNamespace,
  58391. xdp: _xdp.XdpNamespace,
  58392. xhtml: _xhtml.XhtmlNamespace
  58393. };
  58394. exports.NamespaceSetUp = NamespaceSetUp;
  58395. /***/ }),
  58396. /* 89 */
  58397. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58398. Object.defineProperty(exports, "__esModule", ({
  58399. value: true
  58400. }));
  58401. exports.ConfigNamespace = void 0;
  58402. var _namespaces = __w_pdfjs_require__(77);
  58403. var _xfa_object = __w_pdfjs_require__(75);
  58404. var _utils = __w_pdfjs_require__(76);
  58405. var _util = __w_pdfjs_require__(2);
  58406. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  58407. class Acrobat extends _xfa_object.XFAObject {
  58408. constructor(attributes) {
  58409. super(CONFIG_NS_ID, "acrobat", true);
  58410. this.acrobat7 = null;
  58411. this.autoSave = null;
  58412. this.common = null;
  58413. this.validate = null;
  58414. this.validateApprovalSignatures = null;
  58415. this.submitUrl = new _xfa_object.XFAObjectArray();
  58416. }
  58417. }
  58418. class Acrobat7 extends _xfa_object.XFAObject {
  58419. constructor(attributes) {
  58420. super(CONFIG_NS_ID, "acrobat7", true);
  58421. this.dynamicRender = null;
  58422. }
  58423. }
  58424. class ADBE_JSConsole extends _xfa_object.OptionObject {
  58425. constructor(attributes) {
  58426. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  58427. }
  58428. }
  58429. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  58430. constructor(attributes) {
  58431. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  58432. }
  58433. }
  58434. class AddSilentPrint extends _xfa_object.Option01 {
  58435. constructor(attributes) {
  58436. super(CONFIG_NS_ID, "addSilentPrint");
  58437. }
  58438. }
  58439. class AddViewerPreferences extends _xfa_object.Option01 {
  58440. constructor(attributes) {
  58441. super(CONFIG_NS_ID, "addViewerPreferences");
  58442. }
  58443. }
  58444. class AdjustData extends _xfa_object.Option10 {
  58445. constructor(attributes) {
  58446. super(CONFIG_NS_ID, "adjustData");
  58447. }
  58448. }
  58449. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  58450. constructor(attributes) {
  58451. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  58452. }
  58453. }
  58454. class Agent extends _xfa_object.XFAObject {
  58455. constructor(attributes) {
  58456. super(CONFIG_NS_ID, "agent", true);
  58457. this.name = attributes.name ? attributes.name.trim() : "";
  58458. this.common = new _xfa_object.XFAObjectArray();
  58459. }
  58460. }
  58461. class AlwaysEmbed extends _xfa_object.ContentObject {
  58462. constructor(attributes) {
  58463. super(CONFIG_NS_ID, "alwaysEmbed");
  58464. }
  58465. }
  58466. class Amd extends _xfa_object.StringObject {
  58467. constructor(attributes) {
  58468. super(CONFIG_NS_ID, "amd");
  58469. }
  58470. }
  58471. class Area extends _xfa_object.XFAObject {
  58472. constructor(attributes) {
  58473. super(CONFIG_NS_ID, "area");
  58474. this.level = (0, _utils.getInteger)({
  58475. data: attributes.level,
  58476. defaultValue: 0,
  58477. validate: n => n >= 1 && n <= 3
  58478. });
  58479. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  58480. }
  58481. }
  58482. class Attributes extends _xfa_object.OptionObject {
  58483. constructor(attributes) {
  58484. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  58485. }
  58486. }
  58487. class AutoSave extends _xfa_object.OptionObject {
  58488. constructor(attributes) {
  58489. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  58490. }
  58491. }
  58492. class Base extends _xfa_object.StringObject {
  58493. constructor(attributes) {
  58494. super(CONFIG_NS_ID, "base");
  58495. }
  58496. }
  58497. class BatchOutput extends _xfa_object.XFAObject {
  58498. constructor(attributes) {
  58499. super(CONFIG_NS_ID, "batchOutput");
  58500. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  58501. }
  58502. }
  58503. class BehaviorOverride extends _xfa_object.ContentObject {
  58504. constructor(attributes) {
  58505. super(CONFIG_NS_ID, "behaviorOverride");
  58506. }
  58507. [_xfa_object.$finalize]() {
  58508. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  58509. }
  58510. }
  58511. class Cache extends _xfa_object.XFAObject {
  58512. constructor(attributes) {
  58513. super(CONFIG_NS_ID, "cache", true);
  58514. this.templateCache = null;
  58515. }
  58516. }
  58517. class Change extends _xfa_object.Option01 {
  58518. constructor(attributes) {
  58519. super(CONFIG_NS_ID, "change");
  58520. }
  58521. }
  58522. class Common extends _xfa_object.XFAObject {
  58523. constructor(attributes) {
  58524. super(CONFIG_NS_ID, "common", true);
  58525. this.data = null;
  58526. this.locale = null;
  58527. this.localeSet = null;
  58528. this.messaging = null;
  58529. this.suppressBanner = null;
  58530. this.template = null;
  58531. this.validationMessaging = null;
  58532. this.versionControl = null;
  58533. this.log = new _xfa_object.XFAObjectArray();
  58534. }
  58535. }
  58536. class Compress extends _xfa_object.XFAObject {
  58537. constructor(attributes) {
  58538. super(CONFIG_NS_ID, "compress");
  58539. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  58540. }
  58541. }
  58542. class CompressLogicalStructure extends _xfa_object.Option01 {
  58543. constructor(attributes) {
  58544. super(CONFIG_NS_ID, "compressLogicalStructure");
  58545. }
  58546. }
  58547. class CompressObjectStream extends _xfa_object.Option10 {
  58548. constructor(attributes) {
  58549. super(CONFIG_NS_ID, "compressObjectStream");
  58550. }
  58551. }
  58552. class Compression extends _xfa_object.XFAObject {
  58553. constructor(attributes) {
  58554. super(CONFIG_NS_ID, "compression", true);
  58555. this.compressLogicalStructure = null;
  58556. this.compressObjectStream = null;
  58557. this.level = null;
  58558. this.type = null;
  58559. }
  58560. }
  58561. class Config extends _xfa_object.XFAObject {
  58562. constructor(attributes) {
  58563. super(CONFIG_NS_ID, "config", true);
  58564. this.acrobat = null;
  58565. this.present = null;
  58566. this.trace = null;
  58567. this.agent = new _xfa_object.XFAObjectArray();
  58568. }
  58569. }
  58570. class Conformance extends _xfa_object.OptionObject {
  58571. constructor(attributes) {
  58572. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  58573. }
  58574. }
  58575. class ContentCopy extends _xfa_object.Option01 {
  58576. constructor(attributes) {
  58577. super(CONFIG_NS_ID, "contentCopy");
  58578. }
  58579. }
  58580. class Copies extends _xfa_object.IntegerObject {
  58581. constructor(attributes) {
  58582. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  58583. }
  58584. }
  58585. class Creator extends _xfa_object.StringObject {
  58586. constructor(attributes) {
  58587. super(CONFIG_NS_ID, "creator");
  58588. }
  58589. }
  58590. class CurrentPage extends _xfa_object.IntegerObject {
  58591. constructor(attributes) {
  58592. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  58593. }
  58594. }
  58595. class Data extends _xfa_object.XFAObject {
  58596. constructor(attributes) {
  58597. super(CONFIG_NS_ID, "data", true);
  58598. this.adjustData = null;
  58599. this.attributes = null;
  58600. this.incrementalLoad = null;
  58601. this.outputXSL = null;
  58602. this.range = null;
  58603. this.record = null;
  58604. this.startNode = null;
  58605. this.uri = null;
  58606. this.window = null;
  58607. this.xsl = null;
  58608. this.excludeNS = new _xfa_object.XFAObjectArray();
  58609. this.transform = new _xfa_object.XFAObjectArray();
  58610. }
  58611. }
  58612. class Debug extends _xfa_object.XFAObject {
  58613. constructor(attributes) {
  58614. super(CONFIG_NS_ID, "debug", true);
  58615. this.uri = null;
  58616. }
  58617. }
  58618. class DefaultTypeface extends _xfa_object.ContentObject {
  58619. constructor(attributes) {
  58620. super(CONFIG_NS_ID, "defaultTypeface");
  58621. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  58622. }
  58623. }
  58624. class Destination extends _xfa_object.OptionObject {
  58625. constructor(attributes) {
  58626. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  58627. }
  58628. }
  58629. class DocumentAssembly extends _xfa_object.Option01 {
  58630. constructor(attributes) {
  58631. super(CONFIG_NS_ID, "documentAssembly");
  58632. }
  58633. }
  58634. class Driver extends _xfa_object.XFAObject {
  58635. constructor(attributes) {
  58636. super(CONFIG_NS_ID, "driver", true);
  58637. this.name = attributes.name ? attributes.name.trim() : "";
  58638. this.fontInfo = null;
  58639. this.xdc = null;
  58640. }
  58641. }
  58642. class DuplexOption extends _xfa_object.OptionObject {
  58643. constructor(attributes) {
  58644. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  58645. }
  58646. }
  58647. class DynamicRender extends _xfa_object.OptionObject {
  58648. constructor(attributes) {
  58649. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  58650. }
  58651. }
  58652. class Embed extends _xfa_object.Option01 {
  58653. constructor(attributes) {
  58654. super(CONFIG_NS_ID, "embed");
  58655. }
  58656. }
  58657. class Encrypt extends _xfa_object.Option01 {
  58658. constructor(attributes) {
  58659. super(CONFIG_NS_ID, "encrypt");
  58660. }
  58661. }
  58662. class Encryption extends _xfa_object.XFAObject {
  58663. constructor(attributes) {
  58664. super(CONFIG_NS_ID, "encryption", true);
  58665. this.encrypt = null;
  58666. this.encryptionLevel = null;
  58667. this.permissions = null;
  58668. }
  58669. }
  58670. class EncryptionLevel extends _xfa_object.OptionObject {
  58671. constructor(attributes) {
  58672. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  58673. }
  58674. }
  58675. class Enforce extends _xfa_object.StringObject {
  58676. constructor(attributes) {
  58677. super(CONFIG_NS_ID, "enforce");
  58678. }
  58679. }
  58680. class Equate extends _xfa_object.XFAObject {
  58681. constructor(attributes) {
  58682. super(CONFIG_NS_ID, "equate");
  58683. this.force = (0, _utils.getInteger)({
  58684. data: attributes.force,
  58685. defaultValue: 1,
  58686. validate: n => n === 0
  58687. });
  58688. this.from = attributes.from || "";
  58689. this.to = attributes.to || "";
  58690. }
  58691. }
  58692. class EquateRange extends _xfa_object.XFAObject {
  58693. constructor(attributes) {
  58694. super(CONFIG_NS_ID, "equateRange");
  58695. this.from = attributes.from || "";
  58696. this.to = attributes.to || "";
  58697. this._unicodeRange = attributes.unicodeRange || "";
  58698. }
  58699. get unicodeRange() {
  58700. const ranges = [];
  58701. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  58702. const unicodeRange = this._unicodeRange;
  58703. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  58704. range = range.split("-", 2).map(x => {
  58705. const found = x.match(unicodeRegex);
  58706. if (!found) {
  58707. return 0;
  58708. }
  58709. return parseInt(found[1], 16);
  58710. });
  58711. if (range.length === 1) {
  58712. range.push(range[0]);
  58713. }
  58714. ranges.push(range);
  58715. }
  58716. return (0, _util.shadow)(this, "unicodeRange", ranges);
  58717. }
  58718. }
  58719. class Exclude extends _xfa_object.ContentObject {
  58720. constructor(attributes) {
  58721. super(CONFIG_NS_ID, "exclude");
  58722. }
  58723. [_xfa_object.$finalize]() {
  58724. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  58725. }
  58726. }
  58727. class ExcludeNS extends _xfa_object.StringObject {
  58728. constructor(attributes) {
  58729. super(CONFIG_NS_ID, "excludeNS");
  58730. }
  58731. }
  58732. class FlipLabel extends _xfa_object.OptionObject {
  58733. constructor(attributes) {
  58734. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  58735. }
  58736. }
  58737. class FontInfo extends _xfa_object.XFAObject {
  58738. constructor(attributes) {
  58739. super(CONFIG_NS_ID, "fontInfo", true);
  58740. this.embed = null;
  58741. this.map = null;
  58742. this.subsetBelow = null;
  58743. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  58744. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  58745. this.neverEmbed = new _xfa_object.XFAObjectArray();
  58746. }
  58747. }
  58748. class FormFieldFilling extends _xfa_object.Option01 {
  58749. constructor(attributes) {
  58750. super(CONFIG_NS_ID, "formFieldFilling");
  58751. }
  58752. }
  58753. class GroupParent extends _xfa_object.StringObject {
  58754. constructor(attributes) {
  58755. super(CONFIG_NS_ID, "groupParent");
  58756. }
  58757. }
  58758. class IfEmpty extends _xfa_object.OptionObject {
  58759. constructor(attributes) {
  58760. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  58761. }
  58762. }
  58763. class IncludeXDPContent extends _xfa_object.StringObject {
  58764. constructor(attributes) {
  58765. super(CONFIG_NS_ID, "includeXDPContent");
  58766. }
  58767. }
  58768. class IncrementalLoad extends _xfa_object.OptionObject {
  58769. constructor(attributes) {
  58770. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  58771. }
  58772. }
  58773. class IncrementalMerge extends _xfa_object.Option01 {
  58774. constructor(attributes) {
  58775. super(CONFIG_NS_ID, "incrementalMerge");
  58776. }
  58777. }
  58778. class Interactive extends _xfa_object.Option01 {
  58779. constructor(attributes) {
  58780. super(CONFIG_NS_ID, "interactive");
  58781. }
  58782. }
  58783. class Jog extends _xfa_object.OptionObject {
  58784. constructor(attributes) {
  58785. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  58786. }
  58787. }
  58788. class LabelPrinter extends _xfa_object.XFAObject {
  58789. constructor(attributes) {
  58790. super(CONFIG_NS_ID, "labelPrinter", true);
  58791. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  58792. this.batchOutput = null;
  58793. this.flipLabel = null;
  58794. this.fontInfo = null;
  58795. this.xdc = null;
  58796. }
  58797. }
  58798. class Layout extends _xfa_object.OptionObject {
  58799. constructor(attributes) {
  58800. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  58801. }
  58802. }
  58803. class Level extends _xfa_object.IntegerObject {
  58804. constructor(attributes) {
  58805. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  58806. }
  58807. }
  58808. class Linearized extends _xfa_object.Option01 {
  58809. constructor(attributes) {
  58810. super(CONFIG_NS_ID, "linearized");
  58811. }
  58812. }
  58813. class Locale extends _xfa_object.StringObject {
  58814. constructor(attributes) {
  58815. super(CONFIG_NS_ID, "locale");
  58816. }
  58817. }
  58818. class LocaleSet extends _xfa_object.StringObject {
  58819. constructor(attributes) {
  58820. super(CONFIG_NS_ID, "localeSet");
  58821. }
  58822. }
  58823. class Log extends _xfa_object.XFAObject {
  58824. constructor(attributes) {
  58825. super(CONFIG_NS_ID, "log", true);
  58826. this.mode = null;
  58827. this.threshold = null;
  58828. this.to = null;
  58829. this.uri = null;
  58830. }
  58831. }
  58832. class MapElement extends _xfa_object.XFAObject {
  58833. constructor(attributes) {
  58834. super(CONFIG_NS_ID, "map", true);
  58835. this.equate = new _xfa_object.XFAObjectArray();
  58836. this.equateRange = new _xfa_object.XFAObjectArray();
  58837. }
  58838. }
  58839. class MediumInfo extends _xfa_object.XFAObject {
  58840. constructor(attributes) {
  58841. super(CONFIG_NS_ID, "mediumInfo", true);
  58842. this.map = null;
  58843. }
  58844. }
  58845. class Message extends _xfa_object.XFAObject {
  58846. constructor(attributes) {
  58847. super(CONFIG_NS_ID, "message", true);
  58848. this.msgId = null;
  58849. this.severity = null;
  58850. }
  58851. }
  58852. class Messaging extends _xfa_object.XFAObject {
  58853. constructor(attributes) {
  58854. super(CONFIG_NS_ID, "messaging", true);
  58855. this.message = new _xfa_object.XFAObjectArray();
  58856. }
  58857. }
  58858. class Mode extends _xfa_object.OptionObject {
  58859. constructor(attributes) {
  58860. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  58861. }
  58862. }
  58863. class ModifyAnnots extends _xfa_object.Option01 {
  58864. constructor(attributes) {
  58865. super(CONFIG_NS_ID, "modifyAnnots");
  58866. }
  58867. }
  58868. class MsgId extends _xfa_object.IntegerObject {
  58869. constructor(attributes) {
  58870. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  58871. }
  58872. }
  58873. class NameAttr extends _xfa_object.StringObject {
  58874. constructor(attributes) {
  58875. super(CONFIG_NS_ID, "nameAttr");
  58876. }
  58877. }
  58878. class NeverEmbed extends _xfa_object.ContentObject {
  58879. constructor(attributes) {
  58880. super(CONFIG_NS_ID, "neverEmbed");
  58881. }
  58882. }
  58883. class NumberOfCopies extends _xfa_object.IntegerObject {
  58884. constructor(attributes) {
  58885. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  58886. }
  58887. }
  58888. class OpenAction extends _xfa_object.XFAObject {
  58889. constructor(attributes) {
  58890. super(CONFIG_NS_ID, "openAction", true);
  58891. this.destination = null;
  58892. }
  58893. }
  58894. class Output extends _xfa_object.XFAObject {
  58895. constructor(attributes) {
  58896. super(CONFIG_NS_ID, "output", true);
  58897. this.to = null;
  58898. this.type = null;
  58899. this.uri = null;
  58900. }
  58901. }
  58902. class OutputBin extends _xfa_object.StringObject {
  58903. constructor(attributes) {
  58904. super(CONFIG_NS_ID, "outputBin");
  58905. }
  58906. }
  58907. class OutputXSL extends _xfa_object.XFAObject {
  58908. constructor(attributes) {
  58909. super(CONFIG_NS_ID, "outputXSL", true);
  58910. this.uri = null;
  58911. }
  58912. }
  58913. class Overprint extends _xfa_object.OptionObject {
  58914. constructor(attributes) {
  58915. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  58916. }
  58917. }
  58918. class Packets extends _xfa_object.StringObject {
  58919. constructor(attributes) {
  58920. super(CONFIG_NS_ID, "packets");
  58921. }
  58922. [_xfa_object.$finalize]() {
  58923. if (this[_xfa_object.$content] === "*") {
  58924. return;
  58925. }
  58926. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  58927. }
  58928. }
  58929. class PageOffset extends _xfa_object.XFAObject {
  58930. constructor(attributes) {
  58931. super(CONFIG_NS_ID, "pageOffset");
  58932. this.x = (0, _utils.getInteger)({
  58933. data: attributes.x,
  58934. defaultValue: "useXDCSetting",
  58935. validate: n => true
  58936. });
  58937. this.y = (0, _utils.getInteger)({
  58938. data: attributes.y,
  58939. defaultValue: "useXDCSetting",
  58940. validate: n => true
  58941. });
  58942. }
  58943. }
  58944. class PageRange extends _xfa_object.StringObject {
  58945. constructor(attributes) {
  58946. super(CONFIG_NS_ID, "pageRange");
  58947. }
  58948. [_xfa_object.$finalize]() {
  58949. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  58950. const ranges = [];
  58951. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  58952. ranges.push(numbers.slice(i, i + 2));
  58953. }
  58954. this[_xfa_object.$content] = ranges;
  58955. }
  58956. }
  58957. class Pagination extends _xfa_object.OptionObject {
  58958. constructor(attributes) {
  58959. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  58960. }
  58961. }
  58962. class PaginationOverride extends _xfa_object.OptionObject {
  58963. constructor(attributes) {
  58964. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  58965. }
  58966. }
  58967. class Part extends _xfa_object.IntegerObject {
  58968. constructor(attributes) {
  58969. super(CONFIG_NS_ID, "part", 1, n => false);
  58970. }
  58971. }
  58972. class Pcl extends _xfa_object.XFAObject {
  58973. constructor(attributes) {
  58974. super(CONFIG_NS_ID, "pcl", true);
  58975. this.name = attributes.name || "";
  58976. this.batchOutput = null;
  58977. this.fontInfo = null;
  58978. this.jog = null;
  58979. this.mediumInfo = null;
  58980. this.outputBin = null;
  58981. this.pageOffset = null;
  58982. this.staple = null;
  58983. this.xdc = null;
  58984. }
  58985. }
  58986. class Pdf extends _xfa_object.XFAObject {
  58987. constructor(attributes) {
  58988. super(CONFIG_NS_ID, "pdf", true);
  58989. this.name = attributes.name || "";
  58990. this.adobeExtensionLevel = null;
  58991. this.batchOutput = null;
  58992. this.compression = null;
  58993. this.creator = null;
  58994. this.encryption = null;
  58995. this.fontInfo = null;
  58996. this.interactive = null;
  58997. this.linearized = null;
  58998. this.openAction = null;
  58999. this.pdfa = null;
  59000. this.producer = null;
  59001. this.renderPolicy = null;
  59002. this.scriptModel = null;
  59003. this.silentPrint = null;
  59004. this.submitFormat = null;
  59005. this.tagged = null;
  59006. this.version = null;
  59007. this.viewerPreferences = null;
  59008. this.xdc = null;
  59009. }
  59010. }
  59011. class Pdfa extends _xfa_object.XFAObject {
  59012. constructor(attributes) {
  59013. super(CONFIG_NS_ID, "pdfa", true);
  59014. this.amd = null;
  59015. this.conformance = null;
  59016. this.includeXDPContent = null;
  59017. this.part = null;
  59018. }
  59019. }
  59020. class Permissions extends _xfa_object.XFAObject {
  59021. constructor(attributes) {
  59022. super(CONFIG_NS_ID, "permissions", true);
  59023. this.accessibleContent = null;
  59024. this.change = null;
  59025. this.contentCopy = null;
  59026. this.documentAssembly = null;
  59027. this.formFieldFilling = null;
  59028. this.modifyAnnots = null;
  59029. this.plaintextMetadata = null;
  59030. this.print = null;
  59031. this.printHighQuality = null;
  59032. }
  59033. }
  59034. class PickTrayByPDFSize extends _xfa_object.Option01 {
  59035. constructor(attributes) {
  59036. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  59037. }
  59038. }
  59039. class Picture extends _xfa_object.StringObject {
  59040. constructor(attributes) {
  59041. super(CONFIG_NS_ID, "picture");
  59042. }
  59043. }
  59044. class PlaintextMetadata extends _xfa_object.Option01 {
  59045. constructor(attributes) {
  59046. super(CONFIG_NS_ID, "plaintextMetadata");
  59047. }
  59048. }
  59049. class Presence extends _xfa_object.OptionObject {
  59050. constructor(attributes) {
  59051. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  59052. }
  59053. }
  59054. class Present extends _xfa_object.XFAObject {
  59055. constructor(attributes) {
  59056. super(CONFIG_NS_ID, "present", true);
  59057. this.behaviorOverride = null;
  59058. this.cache = null;
  59059. this.common = null;
  59060. this.copies = null;
  59061. this.destination = null;
  59062. this.incrementalMerge = null;
  59063. this.layout = null;
  59064. this.output = null;
  59065. this.overprint = null;
  59066. this.pagination = null;
  59067. this.paginationOverride = null;
  59068. this.script = null;
  59069. this.validate = null;
  59070. this.xdp = null;
  59071. this.driver = new _xfa_object.XFAObjectArray();
  59072. this.labelPrinter = new _xfa_object.XFAObjectArray();
  59073. this.pcl = new _xfa_object.XFAObjectArray();
  59074. this.pdf = new _xfa_object.XFAObjectArray();
  59075. this.ps = new _xfa_object.XFAObjectArray();
  59076. this.submitUrl = new _xfa_object.XFAObjectArray();
  59077. this.webClient = new _xfa_object.XFAObjectArray();
  59078. this.zpl = new _xfa_object.XFAObjectArray();
  59079. }
  59080. }
  59081. class Print extends _xfa_object.Option01 {
  59082. constructor(attributes) {
  59083. super(CONFIG_NS_ID, "print");
  59084. }
  59085. }
  59086. class PrintHighQuality extends _xfa_object.Option01 {
  59087. constructor(attributes) {
  59088. super(CONFIG_NS_ID, "printHighQuality");
  59089. }
  59090. }
  59091. class PrintScaling extends _xfa_object.OptionObject {
  59092. constructor(attributes) {
  59093. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  59094. }
  59095. }
  59096. class PrinterName extends _xfa_object.StringObject {
  59097. constructor(attributes) {
  59098. super(CONFIG_NS_ID, "printerName");
  59099. }
  59100. }
  59101. class Producer extends _xfa_object.StringObject {
  59102. constructor(attributes) {
  59103. super(CONFIG_NS_ID, "producer");
  59104. }
  59105. }
  59106. class Ps extends _xfa_object.XFAObject {
  59107. constructor(attributes) {
  59108. super(CONFIG_NS_ID, "ps", true);
  59109. this.name = attributes.name || "";
  59110. this.batchOutput = null;
  59111. this.fontInfo = null;
  59112. this.jog = null;
  59113. this.mediumInfo = null;
  59114. this.outputBin = null;
  59115. this.staple = null;
  59116. this.xdc = null;
  59117. }
  59118. }
  59119. class Range extends _xfa_object.ContentObject {
  59120. constructor(attributes) {
  59121. super(CONFIG_NS_ID, "range");
  59122. }
  59123. [_xfa_object.$finalize]() {
  59124. 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 => {
  59125. if (range.length === 1) {
  59126. range.push(range[0]);
  59127. }
  59128. return range;
  59129. });
  59130. }
  59131. }
  59132. class Record extends _xfa_object.ContentObject {
  59133. constructor(attributes) {
  59134. super(CONFIG_NS_ID, "record");
  59135. }
  59136. [_xfa_object.$finalize]() {
  59137. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59138. const n = parseInt(this[_xfa_object.$content], 10);
  59139. if (!isNaN(n) && n >= 0) {
  59140. this[_xfa_object.$content] = n;
  59141. }
  59142. }
  59143. }
  59144. class Relevant extends _xfa_object.ContentObject {
  59145. constructor(attributes) {
  59146. super(CONFIG_NS_ID, "relevant");
  59147. }
  59148. [_xfa_object.$finalize]() {
  59149. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  59150. }
  59151. }
  59152. class Rename extends _xfa_object.ContentObject {
  59153. constructor(attributes) {
  59154. super(CONFIG_NS_ID, "rename");
  59155. }
  59156. [_xfa_object.$finalize]() {
  59157. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59158. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  59159. (0, _util.warn)("XFA - Rename: invalid XFA name");
  59160. }
  59161. }
  59162. }
  59163. class RenderPolicy extends _xfa_object.OptionObject {
  59164. constructor(attributes) {
  59165. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  59166. }
  59167. }
  59168. class RunScripts extends _xfa_object.OptionObject {
  59169. constructor(attributes) {
  59170. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  59171. }
  59172. }
  59173. class Script extends _xfa_object.XFAObject {
  59174. constructor(attributes) {
  59175. super(CONFIG_NS_ID, "script", true);
  59176. this.currentPage = null;
  59177. this.exclude = null;
  59178. this.runScripts = null;
  59179. }
  59180. }
  59181. class ScriptModel extends _xfa_object.OptionObject {
  59182. constructor(attributes) {
  59183. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  59184. }
  59185. }
  59186. class Severity extends _xfa_object.OptionObject {
  59187. constructor(attributes) {
  59188. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  59189. }
  59190. }
  59191. class SilentPrint extends _xfa_object.XFAObject {
  59192. constructor(attributes) {
  59193. super(CONFIG_NS_ID, "silentPrint", true);
  59194. this.addSilentPrint = null;
  59195. this.printerName = null;
  59196. }
  59197. }
  59198. class Staple extends _xfa_object.XFAObject {
  59199. constructor(attributes) {
  59200. super(CONFIG_NS_ID, "staple");
  59201. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  59202. }
  59203. }
  59204. class StartNode extends _xfa_object.StringObject {
  59205. constructor(attributes) {
  59206. super(CONFIG_NS_ID, "startNode");
  59207. }
  59208. }
  59209. class StartPage extends _xfa_object.IntegerObject {
  59210. constructor(attributes) {
  59211. super(CONFIG_NS_ID, "startPage", 0, n => true);
  59212. }
  59213. }
  59214. class SubmitFormat extends _xfa_object.OptionObject {
  59215. constructor(attributes) {
  59216. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  59217. }
  59218. }
  59219. class SubmitUrl extends _xfa_object.StringObject {
  59220. constructor(attributes) {
  59221. super(CONFIG_NS_ID, "submitUrl");
  59222. }
  59223. }
  59224. class SubsetBelow extends _xfa_object.IntegerObject {
  59225. constructor(attributes) {
  59226. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  59227. }
  59228. }
  59229. class SuppressBanner extends _xfa_object.Option01 {
  59230. constructor(attributes) {
  59231. super(CONFIG_NS_ID, "suppressBanner");
  59232. }
  59233. }
  59234. class Tagged extends _xfa_object.Option01 {
  59235. constructor(attributes) {
  59236. super(CONFIG_NS_ID, "tagged");
  59237. }
  59238. }
  59239. class Template extends _xfa_object.XFAObject {
  59240. constructor(attributes) {
  59241. super(CONFIG_NS_ID, "template", true);
  59242. this.base = null;
  59243. this.relevant = null;
  59244. this.startPage = null;
  59245. this.uri = null;
  59246. this.xsl = null;
  59247. }
  59248. }
  59249. class Threshold extends _xfa_object.OptionObject {
  59250. constructor(attributes) {
  59251. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  59252. }
  59253. }
  59254. class To extends _xfa_object.OptionObject {
  59255. constructor(attributes) {
  59256. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  59257. }
  59258. }
  59259. class TemplateCache extends _xfa_object.XFAObject {
  59260. constructor(attributes) {
  59261. super(CONFIG_NS_ID, "templateCache");
  59262. this.maxEntries = (0, _utils.getInteger)({
  59263. data: attributes.maxEntries,
  59264. defaultValue: 5,
  59265. validate: n => n >= 0
  59266. });
  59267. }
  59268. }
  59269. class Trace extends _xfa_object.XFAObject {
  59270. constructor(attributes) {
  59271. super(CONFIG_NS_ID, "trace", true);
  59272. this.area = new _xfa_object.XFAObjectArray();
  59273. }
  59274. }
  59275. class Transform extends _xfa_object.XFAObject {
  59276. constructor(attributes) {
  59277. super(CONFIG_NS_ID, "transform", true);
  59278. this.groupParent = null;
  59279. this.ifEmpty = null;
  59280. this.nameAttr = null;
  59281. this.picture = null;
  59282. this.presence = null;
  59283. this.rename = null;
  59284. this.whitespace = null;
  59285. }
  59286. }
  59287. class Type extends _xfa_object.OptionObject {
  59288. constructor(attributes) {
  59289. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  59290. }
  59291. }
  59292. class Uri extends _xfa_object.StringObject {
  59293. constructor(attributes) {
  59294. super(CONFIG_NS_ID, "uri");
  59295. }
  59296. }
  59297. class Validate extends _xfa_object.OptionObject {
  59298. constructor(attributes) {
  59299. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  59300. }
  59301. }
  59302. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  59303. constructor(attributes) {
  59304. super(CONFIG_NS_ID, "validateApprovalSignatures");
  59305. }
  59306. [_xfa_object.$finalize]() {
  59307. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  59308. }
  59309. }
  59310. class ValidationMessaging extends _xfa_object.OptionObject {
  59311. constructor(attributes) {
  59312. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  59313. }
  59314. }
  59315. class Version extends _xfa_object.OptionObject {
  59316. constructor(attributes) {
  59317. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  59318. }
  59319. }
  59320. class VersionControl extends _xfa_object.XFAObject {
  59321. constructor(attributes) {
  59322. super(CONFIG_NS_ID, "VersionControl");
  59323. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  59324. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  59325. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  59326. }
  59327. }
  59328. class ViewerPreferences extends _xfa_object.XFAObject {
  59329. constructor(attributes) {
  59330. super(CONFIG_NS_ID, "viewerPreferences", true);
  59331. this.ADBE_JSConsole = null;
  59332. this.ADBE_JSDebugger = null;
  59333. this.addViewerPreferences = null;
  59334. this.duplexOption = null;
  59335. this.enforce = null;
  59336. this.numberOfCopies = null;
  59337. this.pageRange = null;
  59338. this.pickTrayByPDFSize = null;
  59339. this.printScaling = null;
  59340. }
  59341. }
  59342. class WebClient extends _xfa_object.XFAObject {
  59343. constructor(attributes) {
  59344. super(CONFIG_NS_ID, "webClient", true);
  59345. this.name = attributes.name ? attributes.name.trim() : "";
  59346. this.fontInfo = null;
  59347. this.xdc = null;
  59348. }
  59349. }
  59350. class Whitespace extends _xfa_object.OptionObject {
  59351. constructor(attributes) {
  59352. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  59353. }
  59354. }
  59355. class Window extends _xfa_object.ContentObject {
  59356. constructor(attributes) {
  59357. super(CONFIG_NS_ID, "window");
  59358. }
  59359. [_xfa_object.$finalize]() {
  59360. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  59361. if (pair.some(x => isNaN(x))) {
  59362. this[_xfa_object.$content] = [0, 0];
  59363. return;
  59364. }
  59365. if (pair.length === 1) {
  59366. pair.push(pair[0]);
  59367. }
  59368. this[_xfa_object.$content] = pair;
  59369. }
  59370. }
  59371. class Xdc extends _xfa_object.XFAObject {
  59372. constructor(attributes) {
  59373. super(CONFIG_NS_ID, "xdc", true);
  59374. this.uri = new _xfa_object.XFAObjectArray();
  59375. this.xsl = new _xfa_object.XFAObjectArray();
  59376. }
  59377. }
  59378. class Xdp extends _xfa_object.XFAObject {
  59379. constructor(attributes) {
  59380. super(CONFIG_NS_ID, "xdp", true);
  59381. this.packets = null;
  59382. }
  59383. }
  59384. class Xsl extends _xfa_object.XFAObject {
  59385. constructor(attributes) {
  59386. super(CONFIG_NS_ID, "xsl", true);
  59387. this.debug = null;
  59388. this.uri = null;
  59389. }
  59390. }
  59391. class Zpl extends _xfa_object.XFAObject {
  59392. constructor(attributes) {
  59393. super(CONFIG_NS_ID, "zpl", true);
  59394. this.name = attributes.name ? attributes.name.trim() : "";
  59395. this.batchOutput = null;
  59396. this.flipLabel = null;
  59397. this.fontInfo = null;
  59398. this.xdc = null;
  59399. }
  59400. }
  59401. class ConfigNamespace {
  59402. static [_namespaces.$buildXFAObject](name, attributes) {
  59403. if (ConfigNamespace.hasOwnProperty(name)) {
  59404. return ConfigNamespace[name](attributes);
  59405. }
  59406. return undefined;
  59407. }
  59408. static acrobat(attrs) {
  59409. return new Acrobat(attrs);
  59410. }
  59411. static acrobat7(attrs) {
  59412. return new Acrobat7(attrs);
  59413. }
  59414. static ADBE_JSConsole(attrs) {
  59415. return new ADBE_JSConsole(attrs);
  59416. }
  59417. static ADBE_JSDebugger(attrs) {
  59418. return new ADBE_JSDebugger(attrs);
  59419. }
  59420. static addSilentPrint(attrs) {
  59421. return new AddSilentPrint(attrs);
  59422. }
  59423. static addViewerPreferences(attrs) {
  59424. return new AddViewerPreferences(attrs);
  59425. }
  59426. static adjustData(attrs) {
  59427. return new AdjustData(attrs);
  59428. }
  59429. static adobeExtensionLevel(attrs) {
  59430. return new AdobeExtensionLevel(attrs);
  59431. }
  59432. static agent(attrs) {
  59433. return new Agent(attrs);
  59434. }
  59435. static alwaysEmbed(attrs) {
  59436. return new AlwaysEmbed(attrs);
  59437. }
  59438. static amd(attrs) {
  59439. return new Amd(attrs);
  59440. }
  59441. static area(attrs) {
  59442. return new Area(attrs);
  59443. }
  59444. static attributes(attrs) {
  59445. return new Attributes(attrs);
  59446. }
  59447. static autoSave(attrs) {
  59448. return new AutoSave(attrs);
  59449. }
  59450. static base(attrs) {
  59451. return new Base(attrs);
  59452. }
  59453. static batchOutput(attrs) {
  59454. return new BatchOutput(attrs);
  59455. }
  59456. static behaviorOverride(attrs) {
  59457. return new BehaviorOverride(attrs);
  59458. }
  59459. static cache(attrs) {
  59460. return new Cache(attrs);
  59461. }
  59462. static change(attrs) {
  59463. return new Change(attrs);
  59464. }
  59465. static common(attrs) {
  59466. return new Common(attrs);
  59467. }
  59468. static compress(attrs) {
  59469. return new Compress(attrs);
  59470. }
  59471. static compressLogicalStructure(attrs) {
  59472. return new CompressLogicalStructure(attrs);
  59473. }
  59474. static compressObjectStream(attrs) {
  59475. return new CompressObjectStream(attrs);
  59476. }
  59477. static compression(attrs) {
  59478. return new Compression(attrs);
  59479. }
  59480. static config(attrs) {
  59481. return new Config(attrs);
  59482. }
  59483. static conformance(attrs) {
  59484. return new Conformance(attrs);
  59485. }
  59486. static contentCopy(attrs) {
  59487. return new ContentCopy(attrs);
  59488. }
  59489. static copies(attrs) {
  59490. return new Copies(attrs);
  59491. }
  59492. static creator(attrs) {
  59493. return new Creator(attrs);
  59494. }
  59495. static currentPage(attrs) {
  59496. return new CurrentPage(attrs);
  59497. }
  59498. static data(attrs) {
  59499. return new Data(attrs);
  59500. }
  59501. static debug(attrs) {
  59502. return new Debug(attrs);
  59503. }
  59504. static defaultTypeface(attrs) {
  59505. return new DefaultTypeface(attrs);
  59506. }
  59507. static destination(attrs) {
  59508. return new Destination(attrs);
  59509. }
  59510. static documentAssembly(attrs) {
  59511. return new DocumentAssembly(attrs);
  59512. }
  59513. static driver(attrs) {
  59514. return new Driver(attrs);
  59515. }
  59516. static duplexOption(attrs) {
  59517. return new DuplexOption(attrs);
  59518. }
  59519. static dynamicRender(attrs) {
  59520. return new DynamicRender(attrs);
  59521. }
  59522. static embed(attrs) {
  59523. return new Embed(attrs);
  59524. }
  59525. static encrypt(attrs) {
  59526. return new Encrypt(attrs);
  59527. }
  59528. static encryption(attrs) {
  59529. return new Encryption(attrs);
  59530. }
  59531. static encryptionLevel(attrs) {
  59532. return new EncryptionLevel(attrs);
  59533. }
  59534. static enforce(attrs) {
  59535. return new Enforce(attrs);
  59536. }
  59537. static equate(attrs) {
  59538. return new Equate(attrs);
  59539. }
  59540. static equateRange(attrs) {
  59541. return new EquateRange(attrs);
  59542. }
  59543. static exclude(attrs) {
  59544. return new Exclude(attrs);
  59545. }
  59546. static excludeNS(attrs) {
  59547. return new ExcludeNS(attrs);
  59548. }
  59549. static flipLabel(attrs) {
  59550. return new FlipLabel(attrs);
  59551. }
  59552. static fontInfo(attrs) {
  59553. return new FontInfo(attrs);
  59554. }
  59555. static formFieldFilling(attrs) {
  59556. return new FormFieldFilling(attrs);
  59557. }
  59558. static groupParent(attrs) {
  59559. return new GroupParent(attrs);
  59560. }
  59561. static ifEmpty(attrs) {
  59562. return new IfEmpty(attrs);
  59563. }
  59564. static includeXDPContent(attrs) {
  59565. return new IncludeXDPContent(attrs);
  59566. }
  59567. static incrementalLoad(attrs) {
  59568. return new IncrementalLoad(attrs);
  59569. }
  59570. static incrementalMerge(attrs) {
  59571. return new IncrementalMerge(attrs);
  59572. }
  59573. static interactive(attrs) {
  59574. return new Interactive(attrs);
  59575. }
  59576. static jog(attrs) {
  59577. return new Jog(attrs);
  59578. }
  59579. static labelPrinter(attrs) {
  59580. return new LabelPrinter(attrs);
  59581. }
  59582. static layout(attrs) {
  59583. return new Layout(attrs);
  59584. }
  59585. static level(attrs) {
  59586. return new Level(attrs);
  59587. }
  59588. static linearized(attrs) {
  59589. return new Linearized(attrs);
  59590. }
  59591. static locale(attrs) {
  59592. return new Locale(attrs);
  59593. }
  59594. static localeSet(attrs) {
  59595. return new LocaleSet(attrs);
  59596. }
  59597. static log(attrs) {
  59598. return new Log(attrs);
  59599. }
  59600. static map(attrs) {
  59601. return new MapElement(attrs);
  59602. }
  59603. static mediumInfo(attrs) {
  59604. return new MediumInfo(attrs);
  59605. }
  59606. static message(attrs) {
  59607. return new Message(attrs);
  59608. }
  59609. static messaging(attrs) {
  59610. return new Messaging(attrs);
  59611. }
  59612. static mode(attrs) {
  59613. return new Mode(attrs);
  59614. }
  59615. static modifyAnnots(attrs) {
  59616. return new ModifyAnnots(attrs);
  59617. }
  59618. static msgId(attrs) {
  59619. return new MsgId(attrs);
  59620. }
  59621. static nameAttr(attrs) {
  59622. return new NameAttr(attrs);
  59623. }
  59624. static neverEmbed(attrs) {
  59625. return new NeverEmbed(attrs);
  59626. }
  59627. static numberOfCopies(attrs) {
  59628. return new NumberOfCopies(attrs);
  59629. }
  59630. static openAction(attrs) {
  59631. return new OpenAction(attrs);
  59632. }
  59633. static output(attrs) {
  59634. return new Output(attrs);
  59635. }
  59636. static outputBin(attrs) {
  59637. return new OutputBin(attrs);
  59638. }
  59639. static outputXSL(attrs) {
  59640. return new OutputXSL(attrs);
  59641. }
  59642. static overprint(attrs) {
  59643. return new Overprint(attrs);
  59644. }
  59645. static packets(attrs) {
  59646. return new Packets(attrs);
  59647. }
  59648. static pageOffset(attrs) {
  59649. return new PageOffset(attrs);
  59650. }
  59651. static pageRange(attrs) {
  59652. return new PageRange(attrs);
  59653. }
  59654. static pagination(attrs) {
  59655. return new Pagination(attrs);
  59656. }
  59657. static paginationOverride(attrs) {
  59658. return new PaginationOverride(attrs);
  59659. }
  59660. static part(attrs) {
  59661. return new Part(attrs);
  59662. }
  59663. static pcl(attrs) {
  59664. return new Pcl(attrs);
  59665. }
  59666. static pdf(attrs) {
  59667. return new Pdf(attrs);
  59668. }
  59669. static pdfa(attrs) {
  59670. return new Pdfa(attrs);
  59671. }
  59672. static permissions(attrs) {
  59673. return new Permissions(attrs);
  59674. }
  59675. static pickTrayByPDFSize(attrs) {
  59676. return new PickTrayByPDFSize(attrs);
  59677. }
  59678. static picture(attrs) {
  59679. return new Picture(attrs);
  59680. }
  59681. static plaintextMetadata(attrs) {
  59682. return new PlaintextMetadata(attrs);
  59683. }
  59684. static presence(attrs) {
  59685. return new Presence(attrs);
  59686. }
  59687. static present(attrs) {
  59688. return new Present(attrs);
  59689. }
  59690. static print(attrs) {
  59691. return new Print(attrs);
  59692. }
  59693. static printHighQuality(attrs) {
  59694. return new PrintHighQuality(attrs);
  59695. }
  59696. static printScaling(attrs) {
  59697. return new PrintScaling(attrs);
  59698. }
  59699. static printerName(attrs) {
  59700. return new PrinterName(attrs);
  59701. }
  59702. static producer(attrs) {
  59703. return new Producer(attrs);
  59704. }
  59705. static ps(attrs) {
  59706. return new Ps(attrs);
  59707. }
  59708. static range(attrs) {
  59709. return new Range(attrs);
  59710. }
  59711. static record(attrs) {
  59712. return new Record(attrs);
  59713. }
  59714. static relevant(attrs) {
  59715. return new Relevant(attrs);
  59716. }
  59717. static rename(attrs) {
  59718. return new Rename(attrs);
  59719. }
  59720. static renderPolicy(attrs) {
  59721. return new RenderPolicy(attrs);
  59722. }
  59723. static runScripts(attrs) {
  59724. return new RunScripts(attrs);
  59725. }
  59726. static script(attrs) {
  59727. return new Script(attrs);
  59728. }
  59729. static scriptModel(attrs) {
  59730. return new ScriptModel(attrs);
  59731. }
  59732. static severity(attrs) {
  59733. return new Severity(attrs);
  59734. }
  59735. static silentPrint(attrs) {
  59736. return new SilentPrint(attrs);
  59737. }
  59738. static staple(attrs) {
  59739. return new Staple(attrs);
  59740. }
  59741. static startNode(attrs) {
  59742. return new StartNode(attrs);
  59743. }
  59744. static startPage(attrs) {
  59745. return new StartPage(attrs);
  59746. }
  59747. static submitFormat(attrs) {
  59748. return new SubmitFormat(attrs);
  59749. }
  59750. static submitUrl(attrs) {
  59751. return new SubmitUrl(attrs);
  59752. }
  59753. static subsetBelow(attrs) {
  59754. return new SubsetBelow(attrs);
  59755. }
  59756. static suppressBanner(attrs) {
  59757. return new SuppressBanner(attrs);
  59758. }
  59759. static tagged(attrs) {
  59760. return new Tagged(attrs);
  59761. }
  59762. static template(attrs) {
  59763. return new Template(attrs);
  59764. }
  59765. static templateCache(attrs) {
  59766. return new TemplateCache(attrs);
  59767. }
  59768. static threshold(attrs) {
  59769. return new Threshold(attrs);
  59770. }
  59771. static to(attrs) {
  59772. return new To(attrs);
  59773. }
  59774. static trace(attrs) {
  59775. return new Trace(attrs);
  59776. }
  59777. static transform(attrs) {
  59778. return new Transform(attrs);
  59779. }
  59780. static type(attrs) {
  59781. return new Type(attrs);
  59782. }
  59783. static uri(attrs) {
  59784. return new Uri(attrs);
  59785. }
  59786. static validate(attrs) {
  59787. return new Validate(attrs);
  59788. }
  59789. static validateApprovalSignatures(attrs) {
  59790. return new ValidateApprovalSignatures(attrs);
  59791. }
  59792. static validationMessaging(attrs) {
  59793. return new ValidationMessaging(attrs);
  59794. }
  59795. static version(attrs) {
  59796. return new Version(attrs);
  59797. }
  59798. static versionControl(attrs) {
  59799. return new VersionControl(attrs);
  59800. }
  59801. static viewerPreferences(attrs) {
  59802. return new ViewerPreferences(attrs);
  59803. }
  59804. static webClient(attrs) {
  59805. return new WebClient(attrs);
  59806. }
  59807. static whitespace(attrs) {
  59808. return new Whitespace(attrs);
  59809. }
  59810. static window(attrs) {
  59811. return new Window(attrs);
  59812. }
  59813. static xdc(attrs) {
  59814. return new Xdc(attrs);
  59815. }
  59816. static xdp(attrs) {
  59817. return new Xdp(attrs);
  59818. }
  59819. static xsl(attrs) {
  59820. return new Xsl(attrs);
  59821. }
  59822. static zpl(attrs) {
  59823. return new Zpl(attrs);
  59824. }
  59825. }
  59826. exports.ConfigNamespace = ConfigNamespace;
  59827. /***/ }),
  59828. /* 90 */
  59829. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59830. Object.defineProperty(exports, "__esModule", ({
  59831. value: true
  59832. }));
  59833. exports.ConnectionSetNamespace = void 0;
  59834. var _namespaces = __w_pdfjs_require__(77);
  59835. var _xfa_object = __w_pdfjs_require__(75);
  59836. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  59837. class ConnectionSet extends _xfa_object.XFAObject {
  59838. constructor(attributes) {
  59839. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  59840. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  59841. this.xmlConnection = new _xfa_object.XFAObjectArray();
  59842. this.xsdConnection = new _xfa_object.XFAObjectArray();
  59843. }
  59844. }
  59845. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  59846. constructor(attributes) {
  59847. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  59848. this.id = attributes.id || "";
  59849. this.name = attributes.name || "";
  59850. this.use = attributes.use || "";
  59851. this.usehref = attributes.usehref || "";
  59852. }
  59853. }
  59854. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  59855. constructor(attributes) {
  59856. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  59857. this.id = attributes.id || "";
  59858. this.name = attributes.name || "";
  59859. this.use = attributes.use || "";
  59860. this.usehref = attributes.usehref || "";
  59861. }
  59862. }
  59863. class Operation extends _xfa_object.StringObject {
  59864. constructor(attributes) {
  59865. super(CONNECTION_SET_NS_ID, "operation");
  59866. this.id = attributes.id || "";
  59867. this.input = attributes.input || "";
  59868. this.name = attributes.name || "";
  59869. this.output = attributes.output || "";
  59870. this.use = attributes.use || "";
  59871. this.usehref = attributes.usehref || "";
  59872. }
  59873. }
  59874. class RootElement extends _xfa_object.StringObject {
  59875. constructor(attributes) {
  59876. super(CONNECTION_SET_NS_ID, "rootElement");
  59877. this.id = attributes.id || "";
  59878. this.name = attributes.name || "";
  59879. this.use = attributes.use || "";
  59880. this.usehref = attributes.usehref || "";
  59881. }
  59882. }
  59883. class SoapAction extends _xfa_object.StringObject {
  59884. constructor(attributes) {
  59885. super(CONNECTION_SET_NS_ID, "soapAction");
  59886. this.id = attributes.id || "";
  59887. this.name = attributes.name || "";
  59888. this.use = attributes.use || "";
  59889. this.usehref = attributes.usehref || "";
  59890. }
  59891. }
  59892. class SoapAddress extends _xfa_object.StringObject {
  59893. constructor(attributes) {
  59894. super(CONNECTION_SET_NS_ID, "soapAddress");
  59895. this.id = attributes.id || "";
  59896. this.name = attributes.name || "";
  59897. this.use = attributes.use || "";
  59898. this.usehref = attributes.usehref || "";
  59899. }
  59900. }
  59901. class Uri extends _xfa_object.StringObject {
  59902. constructor(attributes) {
  59903. super(CONNECTION_SET_NS_ID, "uri");
  59904. this.id = attributes.id || "";
  59905. this.name = attributes.name || "";
  59906. this.use = attributes.use || "";
  59907. this.usehref = attributes.usehref || "";
  59908. }
  59909. }
  59910. class WsdlAddress extends _xfa_object.StringObject {
  59911. constructor(attributes) {
  59912. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  59913. this.id = attributes.id || "";
  59914. this.name = attributes.name || "";
  59915. this.use = attributes.use || "";
  59916. this.usehref = attributes.usehref || "";
  59917. }
  59918. }
  59919. class WsdlConnection extends _xfa_object.XFAObject {
  59920. constructor(attributes) {
  59921. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  59922. this.dataDescription = attributes.dataDescription || "";
  59923. this.name = attributes.name || "";
  59924. this.effectiveInputPolicy = null;
  59925. this.effectiveOutputPolicy = null;
  59926. this.operation = null;
  59927. this.soapAction = null;
  59928. this.soapAddress = null;
  59929. this.wsdlAddress = null;
  59930. }
  59931. }
  59932. class XmlConnection extends _xfa_object.XFAObject {
  59933. constructor(attributes) {
  59934. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  59935. this.dataDescription = attributes.dataDescription || "";
  59936. this.name = attributes.name || "";
  59937. this.uri = null;
  59938. }
  59939. }
  59940. class XsdConnection extends _xfa_object.XFAObject {
  59941. constructor(attributes) {
  59942. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  59943. this.dataDescription = attributes.dataDescription || "";
  59944. this.name = attributes.name || "";
  59945. this.rootElement = null;
  59946. this.uri = null;
  59947. }
  59948. }
  59949. class ConnectionSetNamespace {
  59950. static [_namespaces.$buildXFAObject](name, attributes) {
  59951. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  59952. return ConnectionSetNamespace[name](attributes);
  59953. }
  59954. return undefined;
  59955. }
  59956. static connectionSet(attrs) {
  59957. return new ConnectionSet(attrs);
  59958. }
  59959. static effectiveInputPolicy(attrs) {
  59960. return new EffectiveInputPolicy(attrs);
  59961. }
  59962. static effectiveOutputPolicy(attrs) {
  59963. return new EffectiveOutputPolicy(attrs);
  59964. }
  59965. static operation(attrs) {
  59966. return new Operation(attrs);
  59967. }
  59968. static rootElement(attrs) {
  59969. return new RootElement(attrs);
  59970. }
  59971. static soapAction(attrs) {
  59972. return new SoapAction(attrs);
  59973. }
  59974. static soapAddress(attrs) {
  59975. return new SoapAddress(attrs);
  59976. }
  59977. static uri(attrs) {
  59978. return new Uri(attrs);
  59979. }
  59980. static wsdlAddress(attrs) {
  59981. return new WsdlAddress(attrs);
  59982. }
  59983. static wsdlConnection(attrs) {
  59984. return new WsdlConnection(attrs);
  59985. }
  59986. static xmlConnection(attrs) {
  59987. return new XmlConnection(attrs);
  59988. }
  59989. static xsdConnection(attrs) {
  59990. return new XsdConnection(attrs);
  59991. }
  59992. }
  59993. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  59994. /***/ }),
  59995. /* 91 */
  59996. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59997. Object.defineProperty(exports, "__esModule", ({
  59998. value: true
  59999. }));
  60000. exports.DatasetsNamespace = void 0;
  60001. var _xfa_object = __w_pdfjs_require__(75);
  60002. var _namespaces = __w_pdfjs_require__(77);
  60003. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  60004. class Data extends _xfa_object.XmlObject {
  60005. constructor(attributes) {
  60006. super(DATASETS_NS_ID, "data", attributes);
  60007. }
  60008. [_xfa_object.$isNsAgnostic]() {
  60009. return true;
  60010. }
  60011. }
  60012. class Datasets extends _xfa_object.XFAObject {
  60013. constructor(attributes) {
  60014. super(DATASETS_NS_ID, "datasets", true);
  60015. this.data = null;
  60016. this.Signature = null;
  60017. }
  60018. [_xfa_object.$onChild](child) {
  60019. const name = child[_xfa_object.$nodeName];
  60020. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  60021. this[name] = child;
  60022. }
  60023. this[_xfa_object.$appendChild](child);
  60024. }
  60025. }
  60026. class DatasetsNamespace {
  60027. static [_namespaces.$buildXFAObject](name, attributes) {
  60028. if (DatasetsNamespace.hasOwnProperty(name)) {
  60029. return DatasetsNamespace[name](attributes);
  60030. }
  60031. return undefined;
  60032. }
  60033. static datasets(attributes) {
  60034. return new Datasets(attributes);
  60035. }
  60036. static data(attributes) {
  60037. return new Data(attributes);
  60038. }
  60039. }
  60040. exports.DatasetsNamespace = DatasetsNamespace;
  60041. /***/ }),
  60042. /* 92 */
  60043. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60044. Object.defineProperty(exports, "__esModule", ({
  60045. value: true
  60046. }));
  60047. exports.LocaleSetNamespace = void 0;
  60048. var _namespaces = __w_pdfjs_require__(77);
  60049. var _xfa_object = __w_pdfjs_require__(75);
  60050. var _utils = __w_pdfjs_require__(76);
  60051. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  60052. class CalendarSymbols extends _xfa_object.XFAObject {
  60053. constructor(attributes) {
  60054. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  60055. this.name = "gregorian";
  60056. this.dayNames = new _xfa_object.XFAObjectArray(2);
  60057. this.eraNames = null;
  60058. this.meridiemNames = null;
  60059. this.monthNames = new _xfa_object.XFAObjectArray(2);
  60060. }
  60061. }
  60062. class CurrencySymbol extends _xfa_object.StringObject {
  60063. constructor(attributes) {
  60064. super(LOCALE_SET_NS_ID, "currencySymbol");
  60065. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  60066. }
  60067. }
  60068. class CurrencySymbols extends _xfa_object.XFAObject {
  60069. constructor(attributes) {
  60070. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  60071. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  60072. }
  60073. }
  60074. class DatePattern extends _xfa_object.StringObject {
  60075. constructor(attributes) {
  60076. super(LOCALE_SET_NS_ID, "datePattern");
  60077. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60078. }
  60079. }
  60080. class DatePatterns extends _xfa_object.XFAObject {
  60081. constructor(attributes) {
  60082. super(LOCALE_SET_NS_ID, "datePatterns", true);
  60083. this.datePattern = new _xfa_object.XFAObjectArray(4);
  60084. }
  60085. }
  60086. class DateTimeSymbols extends _xfa_object.ContentObject {
  60087. constructor(attributes) {
  60088. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  60089. }
  60090. }
  60091. class Day extends _xfa_object.StringObject {
  60092. constructor(attributes) {
  60093. super(LOCALE_SET_NS_ID, "day");
  60094. }
  60095. }
  60096. class DayNames extends _xfa_object.XFAObject {
  60097. constructor(attributes) {
  60098. super(LOCALE_SET_NS_ID, "dayNames", true);
  60099. this.abbr = (0, _utils.getInteger)({
  60100. data: attributes.abbr,
  60101. defaultValue: 0,
  60102. validate: x => x === 1
  60103. });
  60104. this.day = new _xfa_object.XFAObjectArray(7);
  60105. }
  60106. }
  60107. class Era extends _xfa_object.StringObject {
  60108. constructor(attributes) {
  60109. super(LOCALE_SET_NS_ID, "era");
  60110. }
  60111. }
  60112. class EraNames extends _xfa_object.XFAObject {
  60113. constructor(attributes) {
  60114. super(LOCALE_SET_NS_ID, "eraNames", true);
  60115. this.era = new _xfa_object.XFAObjectArray(2);
  60116. }
  60117. }
  60118. class Locale extends _xfa_object.XFAObject {
  60119. constructor(attributes) {
  60120. super(LOCALE_SET_NS_ID, "locale", true);
  60121. this.desc = attributes.desc || "";
  60122. this.name = "isoname";
  60123. this.calendarSymbols = null;
  60124. this.currencySymbols = null;
  60125. this.datePatterns = null;
  60126. this.dateTimeSymbols = null;
  60127. this.numberPatterns = null;
  60128. this.numberSymbols = null;
  60129. this.timePatterns = null;
  60130. this.typeFaces = null;
  60131. }
  60132. }
  60133. class LocaleSet extends _xfa_object.XFAObject {
  60134. constructor(attributes) {
  60135. super(LOCALE_SET_NS_ID, "localeSet", true);
  60136. this.locale = new _xfa_object.XFAObjectArray();
  60137. }
  60138. }
  60139. class Meridiem extends _xfa_object.StringObject {
  60140. constructor(attributes) {
  60141. super(LOCALE_SET_NS_ID, "meridiem");
  60142. }
  60143. }
  60144. class MeridiemNames extends _xfa_object.XFAObject {
  60145. constructor(attributes) {
  60146. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  60147. this.meridiem = new _xfa_object.XFAObjectArray(2);
  60148. }
  60149. }
  60150. class Month extends _xfa_object.StringObject {
  60151. constructor(attributes) {
  60152. super(LOCALE_SET_NS_ID, "month");
  60153. }
  60154. }
  60155. class MonthNames extends _xfa_object.XFAObject {
  60156. constructor(attributes) {
  60157. super(LOCALE_SET_NS_ID, "monthNames", true);
  60158. this.abbr = (0, _utils.getInteger)({
  60159. data: attributes.abbr,
  60160. defaultValue: 0,
  60161. validate: x => x === 1
  60162. });
  60163. this.month = new _xfa_object.XFAObjectArray(12);
  60164. }
  60165. }
  60166. class NumberPattern extends _xfa_object.StringObject {
  60167. constructor(attributes) {
  60168. super(LOCALE_SET_NS_ID, "numberPattern");
  60169. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60170. }
  60171. }
  60172. class NumberPatterns extends _xfa_object.XFAObject {
  60173. constructor(attributes) {
  60174. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  60175. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  60176. }
  60177. }
  60178. class NumberSymbol extends _xfa_object.StringObject {
  60179. constructor(attributes) {
  60180. super(LOCALE_SET_NS_ID, "numberSymbol");
  60181. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  60182. }
  60183. }
  60184. class NumberSymbols extends _xfa_object.XFAObject {
  60185. constructor(attributes) {
  60186. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  60187. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  60188. }
  60189. }
  60190. class TimePattern extends _xfa_object.StringObject {
  60191. constructor(attributes) {
  60192. super(LOCALE_SET_NS_ID, "timePattern");
  60193. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60194. }
  60195. }
  60196. class TimePatterns extends _xfa_object.XFAObject {
  60197. constructor(attributes) {
  60198. super(LOCALE_SET_NS_ID, "timePatterns", true);
  60199. this.timePattern = new _xfa_object.XFAObjectArray(4);
  60200. }
  60201. }
  60202. class TypeFace extends _xfa_object.XFAObject {
  60203. constructor(attributes) {
  60204. super(LOCALE_SET_NS_ID, "typeFace", true);
  60205. this.name = attributes.name | "";
  60206. }
  60207. }
  60208. class TypeFaces extends _xfa_object.XFAObject {
  60209. constructor(attributes) {
  60210. super(LOCALE_SET_NS_ID, "typeFaces", true);
  60211. this.typeFace = new _xfa_object.XFAObjectArray();
  60212. }
  60213. }
  60214. class LocaleSetNamespace {
  60215. static [_namespaces.$buildXFAObject](name, attributes) {
  60216. if (LocaleSetNamespace.hasOwnProperty(name)) {
  60217. return LocaleSetNamespace[name](attributes);
  60218. }
  60219. return undefined;
  60220. }
  60221. static calendarSymbols(attrs) {
  60222. return new CalendarSymbols(attrs);
  60223. }
  60224. static currencySymbol(attrs) {
  60225. return new CurrencySymbol(attrs);
  60226. }
  60227. static currencySymbols(attrs) {
  60228. return new CurrencySymbols(attrs);
  60229. }
  60230. static datePattern(attrs) {
  60231. return new DatePattern(attrs);
  60232. }
  60233. static datePatterns(attrs) {
  60234. return new DatePatterns(attrs);
  60235. }
  60236. static dateTimeSymbols(attrs) {
  60237. return new DateTimeSymbols(attrs);
  60238. }
  60239. static day(attrs) {
  60240. return new Day(attrs);
  60241. }
  60242. static dayNames(attrs) {
  60243. return new DayNames(attrs);
  60244. }
  60245. static era(attrs) {
  60246. return new Era(attrs);
  60247. }
  60248. static eraNames(attrs) {
  60249. return new EraNames(attrs);
  60250. }
  60251. static locale(attrs) {
  60252. return new Locale(attrs);
  60253. }
  60254. static localeSet(attrs) {
  60255. return new LocaleSet(attrs);
  60256. }
  60257. static meridiem(attrs) {
  60258. return new Meridiem(attrs);
  60259. }
  60260. static meridiemNames(attrs) {
  60261. return new MeridiemNames(attrs);
  60262. }
  60263. static month(attrs) {
  60264. return new Month(attrs);
  60265. }
  60266. static monthNames(attrs) {
  60267. return new MonthNames(attrs);
  60268. }
  60269. static numberPattern(attrs) {
  60270. return new NumberPattern(attrs);
  60271. }
  60272. static numberPatterns(attrs) {
  60273. return new NumberPatterns(attrs);
  60274. }
  60275. static numberSymbol(attrs) {
  60276. return new NumberSymbol(attrs);
  60277. }
  60278. static numberSymbols(attrs) {
  60279. return new NumberSymbols(attrs);
  60280. }
  60281. static timePattern(attrs) {
  60282. return new TimePattern(attrs);
  60283. }
  60284. static timePatterns(attrs) {
  60285. return new TimePatterns(attrs);
  60286. }
  60287. static typeFace(attrs) {
  60288. return new TypeFace(attrs);
  60289. }
  60290. static typeFaces(attrs) {
  60291. return new TypeFaces(attrs);
  60292. }
  60293. }
  60294. exports.LocaleSetNamespace = LocaleSetNamespace;
  60295. /***/ }),
  60296. /* 93 */
  60297. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60298. Object.defineProperty(exports, "__esModule", ({
  60299. value: true
  60300. }));
  60301. exports.SignatureNamespace = void 0;
  60302. var _namespaces = __w_pdfjs_require__(77);
  60303. var _xfa_object = __w_pdfjs_require__(75);
  60304. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  60305. class Signature extends _xfa_object.XFAObject {
  60306. constructor(attributes) {
  60307. super(SIGNATURE_NS_ID, "signature", true);
  60308. }
  60309. }
  60310. class SignatureNamespace {
  60311. static [_namespaces.$buildXFAObject](name, attributes) {
  60312. if (SignatureNamespace.hasOwnProperty(name)) {
  60313. return SignatureNamespace[name](attributes);
  60314. }
  60315. return undefined;
  60316. }
  60317. static signature(attributes) {
  60318. return new Signature(attributes);
  60319. }
  60320. }
  60321. exports.SignatureNamespace = SignatureNamespace;
  60322. /***/ }),
  60323. /* 94 */
  60324. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60325. Object.defineProperty(exports, "__esModule", ({
  60326. value: true
  60327. }));
  60328. exports.StylesheetNamespace = void 0;
  60329. var _namespaces = __w_pdfjs_require__(77);
  60330. var _xfa_object = __w_pdfjs_require__(75);
  60331. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  60332. class Stylesheet extends _xfa_object.XFAObject {
  60333. constructor(attributes) {
  60334. super(STYLESHEET_NS_ID, "stylesheet", true);
  60335. }
  60336. }
  60337. class StylesheetNamespace {
  60338. static [_namespaces.$buildXFAObject](name, attributes) {
  60339. if (StylesheetNamespace.hasOwnProperty(name)) {
  60340. return StylesheetNamespace[name](attributes);
  60341. }
  60342. return undefined;
  60343. }
  60344. static stylesheet(attributes) {
  60345. return new Stylesheet(attributes);
  60346. }
  60347. }
  60348. exports.StylesheetNamespace = StylesheetNamespace;
  60349. /***/ }),
  60350. /* 95 */
  60351. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60352. Object.defineProperty(exports, "__esModule", ({
  60353. value: true
  60354. }));
  60355. exports.XdpNamespace = void 0;
  60356. var _namespaces = __w_pdfjs_require__(77);
  60357. var _xfa_object = __w_pdfjs_require__(75);
  60358. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  60359. class Xdp extends _xfa_object.XFAObject {
  60360. constructor(attributes) {
  60361. super(XDP_NS_ID, "xdp", true);
  60362. this.uuid = attributes.uuid || "";
  60363. this.timeStamp = attributes.timeStamp || "";
  60364. this.config = null;
  60365. this.connectionSet = null;
  60366. this.datasets = null;
  60367. this.localeSet = null;
  60368. this.stylesheet = new _xfa_object.XFAObjectArray();
  60369. this.template = null;
  60370. }
  60371. [_xfa_object.$onChildCheck](child) {
  60372. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  60373. return ns && child[_xfa_object.$namespaceId] === ns.id;
  60374. }
  60375. }
  60376. class XdpNamespace {
  60377. static [_namespaces.$buildXFAObject](name, attributes) {
  60378. if (XdpNamespace.hasOwnProperty(name)) {
  60379. return XdpNamespace[name](attributes);
  60380. }
  60381. return undefined;
  60382. }
  60383. static xdp(attributes) {
  60384. return new Xdp(attributes);
  60385. }
  60386. }
  60387. exports.XdpNamespace = XdpNamespace;
  60388. /***/ }),
  60389. /* 96 */
  60390. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60391. Object.defineProperty(exports, "__esModule", ({
  60392. value: true
  60393. }));
  60394. exports.XhtmlNamespace = void 0;
  60395. var _xfa_object = __w_pdfjs_require__(75);
  60396. var _namespaces = __w_pdfjs_require__(77);
  60397. var _html_utils = __w_pdfjs_require__(82);
  60398. var _utils = __w_pdfjs_require__(76);
  60399. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  60400. const $richText = Symbol();
  60401. 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"]);
  60402. 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) => {
  60403. value = original.fontSize = (0, _utils.getMeasurement)(value);
  60404. return (0, _html_utils.measureToString)(0.99 * value);
  60405. }], ["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], ["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]);
  60406. const spacesRegExp = /\s+/g;
  60407. const crlfRegExp = /[\r\n]+/g;
  60408. const crlfForRichTextRegExp = /\r\n?/g;
  60409. function mapStyle(styleStr, node, richText) {
  60410. const style = Object.create(null);
  60411. if (!styleStr) {
  60412. return style;
  60413. }
  60414. const original = Object.create(null);
  60415. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  60416. const mapping = StyleMapping.get(key);
  60417. if (mapping === "") {
  60418. continue;
  60419. }
  60420. let newValue = value;
  60421. if (mapping) {
  60422. if (typeof mapping === "string") {
  60423. newValue = mapping;
  60424. } else {
  60425. newValue = mapping(value, original);
  60426. }
  60427. }
  60428. if (key.endsWith("scale")) {
  60429. if (style.transform) {
  60430. style.transform = `${style[key]} ${newValue}`;
  60431. } else {
  60432. style.transform = newValue;
  60433. }
  60434. } else {
  60435. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  60436. }
  60437. }
  60438. if (style.fontFamily) {
  60439. (0, _html_utils.setFontFamily)({
  60440. typeface: style.fontFamily,
  60441. weight: style.fontWeight || "normal",
  60442. posture: style.fontStyle || "normal",
  60443. size: original.fontSize || 0
  60444. }, node, node[_xfa_object.$globalData].fontFinder, style);
  60445. }
  60446. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  60447. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  60448. const VERTICAL_FACTOR = 0.333;
  60449. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  60450. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  60451. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  60452. }
  60453. (0, _html_utils.fixTextIndent)(style);
  60454. return style;
  60455. }
  60456. function checkStyle(node) {
  60457. if (!node.style) {
  60458. return "";
  60459. }
  60460. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  60461. if (key === "font-family") {
  60462. node[_xfa_object.$globalData].usedTypefaces.add(value);
  60463. }
  60464. return VALID_STYLES.has(key);
  60465. }).map(kv => kv.join(":")).join(";");
  60466. }
  60467. const NoWhites = new Set(["body", "html"]);
  60468. class XhtmlObject extends _xfa_object.XmlObject {
  60469. constructor(attributes, name) {
  60470. super(XHTML_NS_ID, name);
  60471. this[$richText] = false;
  60472. this.style = attributes.style || "";
  60473. }
  60474. [_xfa_object.$clean](builder) {
  60475. super[_xfa_object.$clean](builder);
  60476. this.style = checkStyle(this);
  60477. }
  60478. [_xfa_object.$acceptWhitespace]() {
  60479. return !NoWhites.has(this[_xfa_object.$nodeName]);
  60480. }
  60481. [_xfa_object.$onText](str, richText = false) {
  60482. if (!richText) {
  60483. str = str.replace(crlfRegExp, "");
  60484. if (!this.style.includes("xfa-spacerun:yes")) {
  60485. str = str.replace(spacesRegExp, " ");
  60486. }
  60487. } else {
  60488. this[$richText] = true;
  60489. }
  60490. if (str) {
  60491. this[_xfa_object.$content] += str;
  60492. }
  60493. }
  60494. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  60495. const xfaFont = Object.create(null);
  60496. const margin = {
  60497. top: NaN,
  60498. bottom: NaN,
  60499. left: NaN,
  60500. right: NaN
  60501. };
  60502. let lineHeight = null;
  60503. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  60504. switch (key) {
  60505. case "font-family":
  60506. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  60507. break;
  60508. case "font-size":
  60509. xfaFont.size = (0, _utils.getMeasurement)(value);
  60510. break;
  60511. case "font-weight":
  60512. xfaFont.weight = value;
  60513. break;
  60514. case "font-style":
  60515. xfaFont.posture = value;
  60516. break;
  60517. case "letter-spacing":
  60518. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  60519. break;
  60520. case "margin":
  60521. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  60522. switch (values.length) {
  60523. case 1:
  60524. margin.top = margin.bottom = margin.left = margin.right = values[0];
  60525. break;
  60526. case 2:
  60527. margin.top = margin.bottom = values[0];
  60528. margin.left = margin.right = values[1];
  60529. break;
  60530. case 3:
  60531. margin.top = values[0];
  60532. margin.bottom = values[2];
  60533. margin.left = margin.right = values[1];
  60534. break;
  60535. case 4:
  60536. margin.top = values[0];
  60537. margin.left = values[1];
  60538. margin.bottom = values[2];
  60539. margin.right = values[3];
  60540. break;
  60541. }
  60542. break;
  60543. case "margin-top":
  60544. margin.top = (0, _utils.getMeasurement)(value);
  60545. break;
  60546. case "margin-bottom":
  60547. margin.bottom = (0, _utils.getMeasurement)(value);
  60548. break;
  60549. case "margin-left":
  60550. margin.left = (0, _utils.getMeasurement)(value);
  60551. break;
  60552. case "margin-right":
  60553. margin.right = (0, _utils.getMeasurement)(value);
  60554. break;
  60555. case "line-height":
  60556. lineHeight = (0, _utils.getMeasurement)(value);
  60557. break;
  60558. }
  60559. }
  60560. measure.pushData(xfaFont, margin, lineHeight);
  60561. if (this[_xfa_object.$content]) {
  60562. measure.addString(this[_xfa_object.$content]);
  60563. } else {
  60564. for (const child of this[_xfa_object.$getChildren]()) {
  60565. if (child[_xfa_object.$nodeName] === "#text") {
  60566. measure.addString(child[_xfa_object.$content]);
  60567. continue;
  60568. }
  60569. child[_xfa_object.$pushGlyphs](measure);
  60570. }
  60571. }
  60572. if (mustPop) {
  60573. measure.popFont();
  60574. }
  60575. }
  60576. [_xfa_object.$toHTML](availableSpace) {
  60577. const children = [];
  60578. this[_xfa_object.$extra] = {
  60579. children
  60580. };
  60581. this[_xfa_object.$childrenToHTML]({});
  60582. if (children.length === 0 && !this[_xfa_object.$content]) {
  60583. return _utils.HTMLResult.EMPTY;
  60584. }
  60585. let value;
  60586. if (this[$richText]) {
  60587. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  60588. } else {
  60589. value = this[_xfa_object.$content] || undefined;
  60590. }
  60591. return _utils.HTMLResult.success({
  60592. name: this[_xfa_object.$nodeName],
  60593. attributes: {
  60594. href: this.href,
  60595. style: mapStyle(this.style, this, this[$richText])
  60596. },
  60597. children,
  60598. value
  60599. });
  60600. }
  60601. }
  60602. class A extends XhtmlObject {
  60603. constructor(attributes) {
  60604. super(attributes, "a");
  60605. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  60606. }
  60607. }
  60608. class B extends XhtmlObject {
  60609. constructor(attributes) {
  60610. super(attributes, "b");
  60611. }
  60612. [_xfa_object.$pushGlyphs](measure) {
  60613. measure.pushFont({
  60614. weight: "bold"
  60615. });
  60616. super[_xfa_object.$pushGlyphs](measure);
  60617. measure.popFont();
  60618. }
  60619. }
  60620. class Body extends XhtmlObject {
  60621. constructor(attributes) {
  60622. super(attributes, "body");
  60623. }
  60624. [_xfa_object.$toHTML](availableSpace) {
  60625. const res = super[_xfa_object.$toHTML](availableSpace);
  60626. const {
  60627. html
  60628. } = res;
  60629. if (!html) {
  60630. return _utils.HTMLResult.EMPTY;
  60631. }
  60632. html.name = "div";
  60633. html.attributes.class = ["xfaRich"];
  60634. return res;
  60635. }
  60636. }
  60637. class Br extends XhtmlObject {
  60638. constructor(attributes) {
  60639. super(attributes, "br");
  60640. }
  60641. [_xfa_object.$text]() {
  60642. return "\n";
  60643. }
  60644. [_xfa_object.$pushGlyphs](measure) {
  60645. measure.addString("\n");
  60646. }
  60647. [_xfa_object.$toHTML](availableSpace) {
  60648. return _utils.HTMLResult.success({
  60649. name: "br"
  60650. });
  60651. }
  60652. }
  60653. class Html extends XhtmlObject {
  60654. constructor(attributes) {
  60655. super(attributes, "html");
  60656. }
  60657. [_xfa_object.$toHTML](availableSpace) {
  60658. const children = [];
  60659. this[_xfa_object.$extra] = {
  60660. children
  60661. };
  60662. this[_xfa_object.$childrenToHTML]({});
  60663. if (children.length === 0) {
  60664. return _utils.HTMLResult.success({
  60665. name: "div",
  60666. attributes: {
  60667. class: ["xfaRich"],
  60668. style: {}
  60669. },
  60670. value: this[_xfa_object.$content] || ""
  60671. });
  60672. }
  60673. if (children.length === 1) {
  60674. const child = children[0];
  60675. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  60676. return _utils.HTMLResult.success(child);
  60677. }
  60678. }
  60679. return _utils.HTMLResult.success({
  60680. name: "div",
  60681. attributes: {
  60682. class: ["xfaRich"],
  60683. style: {}
  60684. },
  60685. children
  60686. });
  60687. }
  60688. }
  60689. class I extends XhtmlObject {
  60690. constructor(attributes) {
  60691. super(attributes, "i");
  60692. }
  60693. [_xfa_object.$pushGlyphs](measure) {
  60694. measure.pushFont({
  60695. posture: "italic"
  60696. });
  60697. super[_xfa_object.$pushGlyphs](measure);
  60698. measure.popFont();
  60699. }
  60700. }
  60701. class Li extends XhtmlObject {
  60702. constructor(attributes) {
  60703. super(attributes, "li");
  60704. }
  60705. }
  60706. class Ol extends XhtmlObject {
  60707. constructor(attributes) {
  60708. super(attributes, "ol");
  60709. }
  60710. }
  60711. class P extends XhtmlObject {
  60712. constructor(attributes) {
  60713. super(attributes, "p");
  60714. }
  60715. [_xfa_object.$pushGlyphs](measure) {
  60716. super[_xfa_object.$pushGlyphs](measure, false);
  60717. measure.addString("\n");
  60718. measure.addPara();
  60719. measure.popFont();
  60720. }
  60721. [_xfa_object.$text]() {
  60722. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  60723. if (siblings[siblings.length - 1] === this) {
  60724. return super[_xfa_object.$text]();
  60725. }
  60726. return super[_xfa_object.$text]() + "\n";
  60727. }
  60728. }
  60729. class Span extends XhtmlObject {
  60730. constructor(attributes) {
  60731. super(attributes, "span");
  60732. }
  60733. }
  60734. class Sub extends XhtmlObject {
  60735. constructor(attributes) {
  60736. super(attributes, "sub");
  60737. }
  60738. }
  60739. class Sup extends XhtmlObject {
  60740. constructor(attributes) {
  60741. super(attributes, "sup");
  60742. }
  60743. }
  60744. class Ul extends XhtmlObject {
  60745. constructor(attributes) {
  60746. super(attributes, "ul");
  60747. }
  60748. }
  60749. class XhtmlNamespace {
  60750. static [_namespaces.$buildXFAObject](name, attributes) {
  60751. if (XhtmlNamespace.hasOwnProperty(name)) {
  60752. return XhtmlNamespace[name](attributes);
  60753. }
  60754. return undefined;
  60755. }
  60756. static a(attributes) {
  60757. return new A(attributes);
  60758. }
  60759. static b(attributes) {
  60760. return new B(attributes);
  60761. }
  60762. static body(attributes) {
  60763. return new Body(attributes);
  60764. }
  60765. static br(attributes) {
  60766. return new Br(attributes);
  60767. }
  60768. static html(attributes) {
  60769. return new Html(attributes);
  60770. }
  60771. static i(attributes) {
  60772. return new I(attributes);
  60773. }
  60774. static li(attributes) {
  60775. return new Li(attributes);
  60776. }
  60777. static ol(attributes) {
  60778. return new Ol(attributes);
  60779. }
  60780. static p(attributes) {
  60781. return new P(attributes);
  60782. }
  60783. static span(attributes) {
  60784. return new Span(attributes);
  60785. }
  60786. static sub(attributes) {
  60787. return new Sub(attributes);
  60788. }
  60789. static sup(attributes) {
  60790. return new Sup(attributes);
  60791. }
  60792. static ul(attributes) {
  60793. return new Ul(attributes);
  60794. }
  60795. }
  60796. exports.XhtmlNamespace = XhtmlNamespace;
  60797. /***/ }),
  60798. /* 97 */
  60799. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60800. Object.defineProperty(exports, "__esModule", ({
  60801. value: true
  60802. }));
  60803. exports.UnknownNamespace = void 0;
  60804. var _namespaces = __w_pdfjs_require__(77);
  60805. var _xfa_object = __w_pdfjs_require__(75);
  60806. class UnknownNamespace {
  60807. constructor(nsId) {
  60808. this.namespaceId = nsId;
  60809. }
  60810. [_namespaces.$buildXFAObject](name, attributes) {
  60811. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  60812. }
  60813. }
  60814. exports.UnknownNamespace = UnknownNamespace;
  60815. /***/ }),
  60816. /* 98 */
  60817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60818. Object.defineProperty(exports, "__esModule", ({
  60819. value: true
  60820. }));
  60821. exports.XRef = void 0;
  60822. var _util = __w_pdfjs_require__(2);
  60823. var _primitives = __w_pdfjs_require__(5);
  60824. var _core_utils = __w_pdfjs_require__(9);
  60825. var _parser = __w_pdfjs_require__(27);
  60826. var _base_stream = __w_pdfjs_require__(6);
  60827. var _crypto = __w_pdfjs_require__(72);
  60828. class XRef {
  60829. constructor(stream, pdfManager) {
  60830. this.stream = stream;
  60831. this.pdfManager = pdfManager;
  60832. this.entries = [];
  60833. this.xrefstms = Object.create(null);
  60834. this._cacheMap = new Map();
  60835. this._pendingRefs = new _primitives.RefSet();
  60836. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  60837. this._newRefNum = null;
  60838. }
  60839. getNewRef() {
  60840. if (this._newRefNum === null) {
  60841. this._newRefNum = this.entries.length;
  60842. }
  60843. return _primitives.Ref.get(this._newRefNum++, 0);
  60844. }
  60845. resetNewRef() {
  60846. this._newRefNum = null;
  60847. }
  60848. setStartXRef(startXRef) {
  60849. this.startXRefQueue = [startXRef];
  60850. }
  60851. parse(recoveryMode = false) {
  60852. let trailerDict;
  60853. if (!recoveryMode) {
  60854. trailerDict = this.readXRef();
  60855. } else {
  60856. (0, _util.warn)("Indexing all PDF objects");
  60857. trailerDict = this.indexObjects();
  60858. }
  60859. trailerDict.assignXref(this);
  60860. this.trailer = trailerDict;
  60861. let encrypt;
  60862. try {
  60863. encrypt = trailerDict.get("Encrypt");
  60864. } catch (ex) {
  60865. if (ex instanceof _core_utils.MissingDataException) {
  60866. throw ex;
  60867. }
  60868. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  60869. }
  60870. if (encrypt instanceof _primitives.Dict) {
  60871. const ids = trailerDict.get("ID");
  60872. const fileId = ids && ids.length ? ids[0] : "";
  60873. encrypt.suppressEncryption = true;
  60874. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  60875. }
  60876. let root;
  60877. try {
  60878. root = trailerDict.get("Root");
  60879. } catch (ex) {
  60880. if (ex instanceof _core_utils.MissingDataException) {
  60881. throw ex;
  60882. }
  60883. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  60884. }
  60885. if (root instanceof _primitives.Dict) {
  60886. try {
  60887. const pages = root.get("Pages");
  60888. if (pages instanceof _primitives.Dict) {
  60889. this.root = root;
  60890. return;
  60891. }
  60892. } catch (ex) {
  60893. if (ex instanceof _core_utils.MissingDataException) {
  60894. throw ex;
  60895. }
  60896. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  60897. }
  60898. }
  60899. if (!recoveryMode) {
  60900. throw new _core_utils.XRefParseException();
  60901. }
  60902. throw new _util.InvalidPDFException("Invalid Root reference.");
  60903. }
  60904. processXRefTable(parser) {
  60905. if (!("tableState" in this)) {
  60906. this.tableState = {
  60907. entryNum: 0,
  60908. streamPos: parser.lexer.stream.pos,
  60909. parserBuf1: parser.buf1,
  60910. parserBuf2: parser.buf2
  60911. };
  60912. }
  60913. const obj = this.readXRefTable(parser);
  60914. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  60915. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  60916. }
  60917. let dict = parser.getObj();
  60918. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  60919. dict = dict.dict;
  60920. }
  60921. if (!(dict instanceof _primitives.Dict)) {
  60922. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  60923. }
  60924. delete this.tableState;
  60925. return dict;
  60926. }
  60927. readXRefTable(parser) {
  60928. const stream = parser.lexer.stream;
  60929. const tableState = this.tableState;
  60930. stream.pos = tableState.streamPos;
  60931. parser.buf1 = tableState.parserBuf1;
  60932. parser.buf2 = tableState.parserBuf2;
  60933. let obj;
  60934. while (true) {
  60935. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  60936. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  60937. break;
  60938. }
  60939. tableState.firstEntryNum = obj;
  60940. tableState.entryCount = parser.getObj();
  60941. }
  60942. let first = tableState.firstEntryNum;
  60943. const count = tableState.entryCount;
  60944. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  60945. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  60946. }
  60947. for (let i = tableState.entryNum; i < count; i++) {
  60948. tableState.streamPos = stream.pos;
  60949. tableState.entryNum = i;
  60950. tableState.parserBuf1 = parser.buf1;
  60951. tableState.parserBuf2 = parser.buf2;
  60952. const entry = {};
  60953. entry.offset = parser.getObj();
  60954. entry.gen = parser.getObj();
  60955. const type = parser.getObj();
  60956. if (type instanceof _primitives.Cmd) {
  60957. switch (type.cmd) {
  60958. case "f":
  60959. entry.free = true;
  60960. break;
  60961. case "n":
  60962. entry.uncompressed = true;
  60963. break;
  60964. }
  60965. }
  60966. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  60967. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  60968. }
  60969. if (i === 0 && entry.free && first === 1) {
  60970. first = 0;
  60971. }
  60972. if (!this.entries[i + first]) {
  60973. this.entries[i + first] = entry;
  60974. }
  60975. }
  60976. tableState.entryNum = 0;
  60977. tableState.streamPos = stream.pos;
  60978. tableState.parserBuf1 = parser.buf1;
  60979. tableState.parserBuf2 = parser.buf2;
  60980. delete tableState.firstEntryNum;
  60981. delete tableState.entryCount;
  60982. }
  60983. if (this.entries[0] && !this.entries[0].free) {
  60984. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  60985. }
  60986. return obj;
  60987. }
  60988. processXRefStream(stream) {
  60989. if (!("streamState" in this)) {
  60990. const streamParameters = stream.dict;
  60991. const byteWidths = streamParameters.get("W");
  60992. let range = streamParameters.get("Index");
  60993. if (!range) {
  60994. range = [0, streamParameters.get("Size")];
  60995. }
  60996. this.streamState = {
  60997. entryRanges: range,
  60998. byteWidths,
  60999. entryNum: 0,
  61000. streamPos: stream.pos
  61001. };
  61002. }
  61003. this.readXRefStream(stream);
  61004. delete this.streamState;
  61005. return stream.dict;
  61006. }
  61007. readXRefStream(stream) {
  61008. const streamState = this.streamState;
  61009. stream.pos = streamState.streamPos;
  61010. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  61011. const entryRanges = streamState.entryRanges;
  61012. while (entryRanges.length > 0) {
  61013. const [first, n] = entryRanges;
  61014. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61015. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  61016. }
  61017. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  61018. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  61019. }
  61020. for (let i = streamState.entryNum; i < n; ++i) {
  61021. streamState.entryNum = i;
  61022. streamState.streamPos = stream.pos;
  61023. let type = 0,
  61024. offset = 0,
  61025. generation = 0;
  61026. for (let j = 0; j < typeFieldWidth; ++j) {
  61027. const typeByte = stream.getByte();
  61028. if (typeByte === -1) {
  61029. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  61030. }
  61031. type = type << 8 | typeByte;
  61032. }
  61033. if (typeFieldWidth === 0) {
  61034. type = 1;
  61035. }
  61036. for (let j = 0; j < offsetFieldWidth; ++j) {
  61037. const offsetByte = stream.getByte();
  61038. if (offsetByte === -1) {
  61039. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  61040. }
  61041. offset = offset << 8 | offsetByte;
  61042. }
  61043. for (let j = 0; j < generationFieldWidth; ++j) {
  61044. const generationByte = stream.getByte();
  61045. if (generationByte === -1) {
  61046. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  61047. }
  61048. generation = generation << 8 | generationByte;
  61049. }
  61050. const entry = {};
  61051. entry.offset = offset;
  61052. entry.gen = generation;
  61053. switch (type) {
  61054. case 0:
  61055. entry.free = true;
  61056. break;
  61057. case 1:
  61058. entry.uncompressed = true;
  61059. break;
  61060. case 2:
  61061. break;
  61062. default:
  61063. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  61064. }
  61065. if (!this.entries[first + i]) {
  61066. this.entries[first + i] = entry;
  61067. }
  61068. }
  61069. streamState.entryNum = 0;
  61070. streamState.streamPos = stream.pos;
  61071. entryRanges.splice(0, 2);
  61072. }
  61073. }
  61074. indexObjects() {
  61075. const TAB = 0x9,
  61076. LF = 0xa,
  61077. CR = 0xd,
  61078. SPACE = 0x20;
  61079. const PERCENT = 0x25,
  61080. LT = 0x3c;
  61081. function readToken(data, offset) {
  61082. let token = "",
  61083. ch = data[offset];
  61084. while (ch !== LF && ch !== CR && ch !== LT) {
  61085. if (++offset >= data.length) {
  61086. break;
  61087. }
  61088. token += String.fromCharCode(ch);
  61089. ch = data[offset];
  61090. }
  61091. return token;
  61092. }
  61093. function skipUntil(data, offset, what) {
  61094. const length = what.length,
  61095. dataLength = data.length;
  61096. let skipped = 0;
  61097. while (offset < dataLength) {
  61098. let i = 0;
  61099. while (i < length && data[offset + i] === what[i]) {
  61100. ++i;
  61101. }
  61102. if (i >= length) {
  61103. break;
  61104. }
  61105. offset++;
  61106. skipped++;
  61107. }
  61108. return skipped;
  61109. }
  61110. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  61111. const endobjRegExp = /\bendobj[\b\s]$/;
  61112. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  61113. const CHECK_CONTENT_LENGTH = 25;
  61114. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  61115. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  61116. const objBytes = new Uint8Array([111, 98, 106]);
  61117. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  61118. this.entries.length = 0;
  61119. this._cacheMap.clear();
  61120. const stream = this.stream;
  61121. stream.pos = 0;
  61122. const buffer = stream.getBytes(),
  61123. length = buffer.length;
  61124. let position = stream.start;
  61125. const trailers = [],
  61126. xrefStms = [];
  61127. while (position < length) {
  61128. let ch = buffer[position];
  61129. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  61130. ++position;
  61131. continue;
  61132. }
  61133. if (ch === PERCENT) {
  61134. do {
  61135. ++position;
  61136. if (position >= length) {
  61137. break;
  61138. }
  61139. ch = buffer[position];
  61140. } while (ch !== LF && ch !== CR);
  61141. continue;
  61142. }
  61143. const token = readToken(buffer, position);
  61144. let m;
  61145. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  61146. position += skipUntil(buffer, position, trailerBytes);
  61147. trailers.push(position);
  61148. position += skipUntil(buffer, position, startxrefBytes);
  61149. } else if (m = objRegExp.exec(token)) {
  61150. const num = m[1] | 0,
  61151. gen = m[2] | 0;
  61152. let contentLength,
  61153. startPos = position + token.length,
  61154. updateEntries = false;
  61155. if (!this.entries[num]) {
  61156. updateEntries = true;
  61157. } else if (this.entries[num].gen === gen) {
  61158. try {
  61159. const parser = new _parser.Parser({
  61160. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  61161. });
  61162. parser.getObj();
  61163. updateEntries = true;
  61164. } catch (ex) {
  61165. if (ex instanceof _core_utils.ParserEOFException) {
  61166. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  61167. } else {
  61168. updateEntries = true;
  61169. }
  61170. }
  61171. }
  61172. if (updateEntries) {
  61173. this.entries[num] = {
  61174. offset: position - stream.start,
  61175. gen,
  61176. uncompressed: true
  61177. };
  61178. }
  61179. while (startPos < buffer.length) {
  61180. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  61181. contentLength = endPos - position;
  61182. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  61183. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  61184. if (endobjRegExp.test(tokenStr)) {
  61185. break;
  61186. } else {
  61187. const objToken = nestedObjRegExp.exec(tokenStr);
  61188. if (objToken && objToken[1]) {
  61189. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  61190. contentLength -= objToken[1].length;
  61191. break;
  61192. }
  61193. }
  61194. startPos = endPos;
  61195. }
  61196. const content = buffer.subarray(position, position + contentLength);
  61197. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  61198. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  61199. xrefStms.push(position - stream.start);
  61200. this.xrefstms[position - stream.start] = 1;
  61201. }
  61202. position += contentLength;
  61203. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  61204. trailers.push(position);
  61205. position += skipUntil(buffer, position, startxrefBytes);
  61206. } else {
  61207. position += token.length + 1;
  61208. }
  61209. }
  61210. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  61211. this.startXRefQueue.push(xrefStms[i]);
  61212. this.readXRef(true);
  61213. }
  61214. let trailerDict;
  61215. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  61216. stream.pos = trailers[i];
  61217. const parser = new _parser.Parser({
  61218. lexer: new _parser.Lexer(stream),
  61219. xref: this,
  61220. allowStreams: true,
  61221. recoveryMode: true
  61222. });
  61223. const obj = parser.getObj();
  61224. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61225. continue;
  61226. }
  61227. const dict = parser.getObj();
  61228. if (!(dict instanceof _primitives.Dict)) {
  61229. continue;
  61230. }
  61231. try {
  61232. const rootDict = dict.get("Root");
  61233. if (!(rootDict instanceof _primitives.Dict)) {
  61234. continue;
  61235. }
  61236. const pagesDict = rootDict.get("Pages");
  61237. if (!(pagesDict instanceof _primitives.Dict)) {
  61238. continue;
  61239. }
  61240. const pagesCount = pagesDict.get("Count");
  61241. if (!Number.isInteger(pagesCount)) {
  61242. continue;
  61243. }
  61244. } catch (ex) {
  61245. continue;
  61246. }
  61247. if (dict.has("ID")) {
  61248. return dict;
  61249. }
  61250. trailerDict = dict;
  61251. }
  61252. if (trailerDict) {
  61253. return trailerDict;
  61254. }
  61255. if (this.topDict) {
  61256. return this.topDict;
  61257. }
  61258. throw new _util.InvalidPDFException("Invalid PDF structure.");
  61259. }
  61260. readXRef(recoveryMode = false) {
  61261. const stream = this.stream;
  61262. const startXRefParsedCache = new Set();
  61263. try {
  61264. while (this.startXRefQueue.length) {
  61265. const startXRef = this.startXRefQueue[0];
  61266. if (startXRefParsedCache.has(startXRef)) {
  61267. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  61268. this.startXRefQueue.shift();
  61269. continue;
  61270. }
  61271. startXRefParsedCache.add(startXRef);
  61272. stream.pos = startXRef + stream.start;
  61273. const parser = new _parser.Parser({
  61274. lexer: new _parser.Lexer(stream),
  61275. xref: this,
  61276. allowStreams: true
  61277. });
  61278. let obj = parser.getObj();
  61279. let dict;
  61280. if ((0, _primitives.isCmd)(obj, "xref")) {
  61281. dict = this.processXRefTable(parser);
  61282. if (!this.topDict) {
  61283. this.topDict = dict;
  61284. }
  61285. obj = dict.get("XRefStm");
  61286. if (Number.isInteger(obj)) {
  61287. const pos = obj;
  61288. if (!(pos in this.xrefstms)) {
  61289. this.xrefstms[pos] = 1;
  61290. this.startXRefQueue.push(pos);
  61291. }
  61292. }
  61293. } else if (Number.isInteger(obj)) {
  61294. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  61295. throw new _util.FormatError("Invalid XRef stream");
  61296. }
  61297. dict = this.processXRefStream(obj);
  61298. if (!this.topDict) {
  61299. this.topDict = dict;
  61300. }
  61301. if (!dict) {
  61302. throw new _util.FormatError("Failed to read XRef stream");
  61303. }
  61304. } else {
  61305. throw new _util.FormatError("Invalid XRef stream header");
  61306. }
  61307. obj = dict.get("Prev");
  61308. if (Number.isInteger(obj)) {
  61309. this.startXRefQueue.push(obj);
  61310. } else if (obj instanceof _primitives.Ref) {
  61311. this.startXRefQueue.push(obj.num);
  61312. }
  61313. this.startXRefQueue.shift();
  61314. }
  61315. return this.topDict;
  61316. } catch (e) {
  61317. if (e instanceof _core_utils.MissingDataException) {
  61318. throw e;
  61319. }
  61320. (0, _util.info)("(while reading XRef): " + e);
  61321. this.startXRefQueue.shift();
  61322. }
  61323. if (recoveryMode) {
  61324. return undefined;
  61325. }
  61326. throw new _core_utils.XRefParseException();
  61327. }
  61328. getEntry(i) {
  61329. const xrefEntry = this.entries[i];
  61330. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  61331. return xrefEntry;
  61332. }
  61333. return null;
  61334. }
  61335. fetchIfRef(obj, suppressEncryption = false) {
  61336. if (obj instanceof _primitives.Ref) {
  61337. return this.fetch(obj, suppressEncryption);
  61338. }
  61339. return obj;
  61340. }
  61341. fetch(ref, suppressEncryption = false) {
  61342. if (!(ref instanceof _primitives.Ref)) {
  61343. throw new Error("ref object is not a reference");
  61344. }
  61345. const num = ref.num;
  61346. const cacheEntry = this._cacheMap.get(num);
  61347. if (cacheEntry !== undefined) {
  61348. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  61349. cacheEntry.objId = ref.toString();
  61350. }
  61351. return cacheEntry;
  61352. }
  61353. let xrefEntry = this.getEntry(num);
  61354. if (xrefEntry === null) {
  61355. this._cacheMap.set(num, xrefEntry);
  61356. return xrefEntry;
  61357. }
  61358. if (this._pendingRefs.has(ref)) {
  61359. this._pendingRefs.remove(ref);
  61360. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  61361. return _primitives.CIRCULAR_REF;
  61362. }
  61363. this._pendingRefs.put(ref);
  61364. try {
  61365. if (xrefEntry.uncompressed) {
  61366. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  61367. } else {
  61368. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  61369. }
  61370. this._pendingRefs.remove(ref);
  61371. } catch (ex) {
  61372. this._pendingRefs.remove(ref);
  61373. throw ex;
  61374. }
  61375. if (xrefEntry instanceof _primitives.Dict) {
  61376. xrefEntry.objId = ref.toString();
  61377. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  61378. xrefEntry.dict.objId = ref.toString();
  61379. }
  61380. return xrefEntry;
  61381. }
  61382. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  61383. const gen = ref.gen;
  61384. let num = ref.num;
  61385. if (xrefEntry.gen !== gen) {
  61386. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  61387. }
  61388. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  61389. const parser = new _parser.Parser({
  61390. lexer: new _parser.Lexer(stream),
  61391. xref: this,
  61392. allowStreams: true
  61393. });
  61394. const obj1 = parser.getObj();
  61395. const obj2 = parser.getObj();
  61396. const obj3 = parser.getObj();
  61397. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  61398. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  61399. }
  61400. if (obj3.cmd !== "obj") {
  61401. if (obj3.cmd.startsWith("obj")) {
  61402. num = parseInt(obj3.cmd.substring(3), 10);
  61403. if (!Number.isNaN(num)) {
  61404. return num;
  61405. }
  61406. }
  61407. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  61408. }
  61409. if (this.encrypt && !suppressEncryption) {
  61410. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  61411. } else {
  61412. xrefEntry = parser.getObj();
  61413. }
  61414. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  61415. this._cacheMap.set(num, xrefEntry);
  61416. }
  61417. return xrefEntry;
  61418. }
  61419. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  61420. const tableOffset = xrefEntry.offset;
  61421. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  61422. if (!(stream instanceof _base_stream.BaseStream)) {
  61423. throw new _util.FormatError("bad ObjStm stream");
  61424. }
  61425. const first = stream.dict.get("First");
  61426. const n = stream.dict.get("N");
  61427. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61428. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  61429. }
  61430. let parser = new _parser.Parser({
  61431. lexer: new _parser.Lexer(stream),
  61432. xref: this,
  61433. allowStreams: true
  61434. });
  61435. const nums = new Array(n);
  61436. const offsets = new Array(n);
  61437. for (let i = 0; i < n; ++i) {
  61438. const num = parser.getObj();
  61439. if (!Number.isInteger(num)) {
  61440. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  61441. }
  61442. const offset = parser.getObj();
  61443. if (!Number.isInteger(offset)) {
  61444. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  61445. }
  61446. nums[i] = num;
  61447. offsets[i] = offset;
  61448. }
  61449. const start = (stream.start || 0) + first;
  61450. const entries = new Array(n);
  61451. for (let i = 0; i < n; ++i) {
  61452. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  61453. if (length < 0) {
  61454. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  61455. }
  61456. parser = new _parser.Parser({
  61457. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  61458. xref: this,
  61459. allowStreams: true
  61460. });
  61461. const obj = parser.getObj();
  61462. entries[i] = obj;
  61463. if (obj instanceof _base_stream.BaseStream) {
  61464. continue;
  61465. }
  61466. const num = nums[i],
  61467. entry = this.entries[num];
  61468. if (entry && entry.offset === tableOffset && entry.gen === i) {
  61469. this._cacheMap.set(num, obj);
  61470. }
  61471. }
  61472. xrefEntry = entries[xrefEntry.gen];
  61473. if (xrefEntry === undefined) {
  61474. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  61475. }
  61476. return xrefEntry;
  61477. }
  61478. async fetchIfRefAsync(obj, suppressEncryption) {
  61479. if (obj instanceof _primitives.Ref) {
  61480. return this.fetchAsync(obj, suppressEncryption);
  61481. }
  61482. return obj;
  61483. }
  61484. async fetchAsync(ref, suppressEncryption) {
  61485. try {
  61486. return this.fetch(ref, suppressEncryption);
  61487. } catch (ex) {
  61488. if (!(ex instanceof _core_utils.MissingDataException)) {
  61489. throw ex;
  61490. }
  61491. await this.pdfManager.requestRange(ex.begin, ex.end);
  61492. return this.fetchAsync(ref, suppressEncryption);
  61493. }
  61494. }
  61495. getCatalogObj() {
  61496. return this.root;
  61497. }
  61498. }
  61499. exports.XRef = XRef;
  61500. /***/ }),
  61501. /* 99 */
  61502. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61503. Object.defineProperty(exports, "__esModule", ({
  61504. value: true
  61505. }));
  61506. exports.MessageHandler = void 0;
  61507. var _util = __w_pdfjs_require__(2);
  61508. const CallbackKind = {
  61509. UNKNOWN: 0,
  61510. DATA: 1,
  61511. ERROR: 2
  61512. };
  61513. const StreamKind = {
  61514. UNKNOWN: 0,
  61515. CANCEL: 1,
  61516. CANCEL_COMPLETE: 2,
  61517. CLOSE: 3,
  61518. ENQUEUE: 4,
  61519. ERROR: 5,
  61520. PULL: 6,
  61521. PULL_COMPLETE: 7,
  61522. START_COMPLETE: 8
  61523. };
  61524. function wrapReason(reason) {
  61525. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  61526. (0, _util.warn)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  61527. return reason;
  61528. }
  61529. switch (reason.name) {
  61530. case "AbortException":
  61531. return new _util.AbortException(reason.message);
  61532. case "MissingPDFException":
  61533. return new _util.MissingPDFException(reason.message);
  61534. case "PasswordException":
  61535. return new _util.PasswordException(reason.message, reason.code);
  61536. case "UnexpectedResponseException":
  61537. return new _util.UnexpectedResponseException(reason.message, reason.status);
  61538. case "UnknownErrorException":
  61539. return new _util.UnknownErrorException(reason.message, reason.details);
  61540. default:
  61541. return new _util.UnknownErrorException(reason.message, reason.toString());
  61542. }
  61543. }
  61544. class MessageHandler {
  61545. constructor(sourceName, targetName, comObj) {
  61546. this.sourceName = sourceName;
  61547. this.targetName = targetName;
  61548. this.comObj = comObj;
  61549. this.callbackId = 1;
  61550. this.streamId = 1;
  61551. this.streamSinks = Object.create(null);
  61552. this.streamControllers = Object.create(null);
  61553. this.callbackCapabilities = Object.create(null);
  61554. this.actionHandler = Object.create(null);
  61555. this._onComObjOnMessage = event => {
  61556. const data = event.data;
  61557. if (data.targetName !== this.sourceName) {
  61558. return;
  61559. }
  61560. if (data.stream) {
  61561. this._processStreamMessage(data);
  61562. return;
  61563. }
  61564. if (data.callback) {
  61565. const callbackId = data.callbackId;
  61566. const capability = this.callbackCapabilities[callbackId];
  61567. if (!capability) {
  61568. throw new Error(`Cannot resolve callback ${callbackId}`);
  61569. }
  61570. delete this.callbackCapabilities[callbackId];
  61571. if (data.callback === CallbackKind.DATA) {
  61572. capability.resolve(data.data);
  61573. } else if (data.callback === CallbackKind.ERROR) {
  61574. capability.reject(wrapReason(data.reason));
  61575. } else {
  61576. throw new Error("Unexpected callback case");
  61577. }
  61578. return;
  61579. }
  61580. const action = this.actionHandler[data.action];
  61581. if (!action) {
  61582. throw new Error(`Unknown action from worker: ${data.action}`);
  61583. }
  61584. if (data.callbackId) {
  61585. const cbSourceName = this.sourceName;
  61586. const cbTargetName = data.sourceName;
  61587. new Promise(function (resolve) {
  61588. resolve(action(data.data));
  61589. }).then(function (result) {
  61590. comObj.postMessage({
  61591. sourceName: cbSourceName,
  61592. targetName: cbTargetName,
  61593. callback: CallbackKind.DATA,
  61594. callbackId: data.callbackId,
  61595. data: result
  61596. });
  61597. }, function (reason) {
  61598. comObj.postMessage({
  61599. sourceName: cbSourceName,
  61600. targetName: cbTargetName,
  61601. callback: CallbackKind.ERROR,
  61602. callbackId: data.callbackId,
  61603. reason: wrapReason(reason)
  61604. });
  61605. });
  61606. return;
  61607. }
  61608. if (data.streamId) {
  61609. this._createStreamSink(data);
  61610. return;
  61611. }
  61612. action(data.data);
  61613. };
  61614. comObj.addEventListener("message", this._onComObjOnMessage);
  61615. }
  61616. on(actionName, handler) {
  61617. const ah = this.actionHandler;
  61618. if (ah[actionName]) {
  61619. throw new Error(`There is already an actionName called "${actionName}"`);
  61620. }
  61621. ah[actionName] = handler;
  61622. }
  61623. send(actionName, data, transfers) {
  61624. this.comObj.postMessage({
  61625. sourceName: this.sourceName,
  61626. targetName: this.targetName,
  61627. action: actionName,
  61628. data
  61629. }, transfers);
  61630. }
  61631. sendWithPromise(actionName, data, transfers) {
  61632. const callbackId = this.callbackId++;
  61633. const capability = (0, _util.createPromiseCapability)();
  61634. this.callbackCapabilities[callbackId] = capability;
  61635. try {
  61636. this.comObj.postMessage({
  61637. sourceName: this.sourceName,
  61638. targetName: this.targetName,
  61639. action: actionName,
  61640. callbackId,
  61641. data
  61642. }, transfers);
  61643. } catch (ex) {
  61644. capability.reject(ex);
  61645. }
  61646. return capability.promise;
  61647. }
  61648. sendWithStream(actionName, data, queueingStrategy, transfers) {
  61649. const streamId = this.streamId++,
  61650. sourceName = this.sourceName,
  61651. targetName = this.targetName,
  61652. comObj = this.comObj;
  61653. return new ReadableStream({
  61654. start: controller => {
  61655. const startCapability = (0, _util.createPromiseCapability)();
  61656. this.streamControllers[streamId] = {
  61657. controller,
  61658. startCall: startCapability,
  61659. pullCall: null,
  61660. cancelCall: null,
  61661. isClosed: false
  61662. };
  61663. comObj.postMessage({
  61664. sourceName,
  61665. targetName,
  61666. action: actionName,
  61667. streamId,
  61668. data,
  61669. desiredSize: controller.desiredSize
  61670. }, transfers);
  61671. return startCapability.promise;
  61672. },
  61673. pull: controller => {
  61674. const pullCapability = (0, _util.createPromiseCapability)();
  61675. this.streamControllers[streamId].pullCall = pullCapability;
  61676. comObj.postMessage({
  61677. sourceName,
  61678. targetName,
  61679. stream: StreamKind.PULL,
  61680. streamId,
  61681. desiredSize: controller.desiredSize
  61682. });
  61683. return pullCapability.promise;
  61684. },
  61685. cancel: reason => {
  61686. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  61687. const cancelCapability = (0, _util.createPromiseCapability)();
  61688. this.streamControllers[streamId].cancelCall = cancelCapability;
  61689. this.streamControllers[streamId].isClosed = true;
  61690. comObj.postMessage({
  61691. sourceName,
  61692. targetName,
  61693. stream: StreamKind.CANCEL,
  61694. streamId,
  61695. reason: wrapReason(reason)
  61696. });
  61697. return cancelCapability.promise;
  61698. }
  61699. }, queueingStrategy);
  61700. }
  61701. _createStreamSink(data) {
  61702. const streamId = data.streamId,
  61703. sourceName = this.sourceName,
  61704. targetName = data.sourceName,
  61705. comObj = this.comObj;
  61706. const self = this,
  61707. action = this.actionHandler[data.action];
  61708. const streamSink = {
  61709. enqueue(chunk, size = 1, transfers) {
  61710. if (this.isCancelled) {
  61711. return;
  61712. }
  61713. const lastDesiredSize = this.desiredSize;
  61714. this.desiredSize -= size;
  61715. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  61716. this.sinkCapability = (0, _util.createPromiseCapability)();
  61717. this.ready = this.sinkCapability.promise;
  61718. }
  61719. comObj.postMessage({
  61720. sourceName,
  61721. targetName,
  61722. stream: StreamKind.ENQUEUE,
  61723. streamId,
  61724. chunk
  61725. }, transfers);
  61726. },
  61727. close() {
  61728. if (this.isCancelled) {
  61729. return;
  61730. }
  61731. this.isCancelled = true;
  61732. comObj.postMessage({
  61733. sourceName,
  61734. targetName,
  61735. stream: StreamKind.CLOSE,
  61736. streamId
  61737. });
  61738. delete self.streamSinks[streamId];
  61739. },
  61740. error(reason) {
  61741. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  61742. if (this.isCancelled) {
  61743. return;
  61744. }
  61745. this.isCancelled = true;
  61746. comObj.postMessage({
  61747. sourceName,
  61748. targetName,
  61749. stream: StreamKind.ERROR,
  61750. streamId,
  61751. reason: wrapReason(reason)
  61752. });
  61753. },
  61754. sinkCapability: (0, _util.createPromiseCapability)(),
  61755. onPull: null,
  61756. onCancel: null,
  61757. isCancelled: false,
  61758. desiredSize: data.desiredSize,
  61759. ready: null
  61760. };
  61761. streamSink.sinkCapability.resolve();
  61762. streamSink.ready = streamSink.sinkCapability.promise;
  61763. this.streamSinks[streamId] = streamSink;
  61764. new Promise(function (resolve) {
  61765. resolve(action(data.data, streamSink));
  61766. }).then(function () {
  61767. comObj.postMessage({
  61768. sourceName,
  61769. targetName,
  61770. stream: StreamKind.START_COMPLETE,
  61771. streamId,
  61772. success: true
  61773. });
  61774. }, function (reason) {
  61775. comObj.postMessage({
  61776. sourceName,
  61777. targetName,
  61778. stream: StreamKind.START_COMPLETE,
  61779. streamId,
  61780. reason: wrapReason(reason)
  61781. });
  61782. });
  61783. }
  61784. _processStreamMessage(data) {
  61785. const streamId = data.streamId,
  61786. sourceName = this.sourceName,
  61787. targetName = data.sourceName,
  61788. comObj = this.comObj;
  61789. const streamController = this.streamControllers[streamId],
  61790. streamSink = this.streamSinks[streamId];
  61791. switch (data.stream) {
  61792. case StreamKind.START_COMPLETE:
  61793. if (data.success) {
  61794. streamController.startCall.resolve();
  61795. } else {
  61796. streamController.startCall.reject(wrapReason(data.reason));
  61797. }
  61798. break;
  61799. case StreamKind.PULL_COMPLETE:
  61800. if (data.success) {
  61801. streamController.pullCall.resolve();
  61802. } else {
  61803. streamController.pullCall.reject(wrapReason(data.reason));
  61804. }
  61805. break;
  61806. case StreamKind.PULL:
  61807. if (!streamSink) {
  61808. comObj.postMessage({
  61809. sourceName,
  61810. targetName,
  61811. stream: StreamKind.PULL_COMPLETE,
  61812. streamId,
  61813. success: true
  61814. });
  61815. break;
  61816. }
  61817. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  61818. streamSink.sinkCapability.resolve();
  61819. }
  61820. streamSink.desiredSize = data.desiredSize;
  61821. new Promise(function (resolve) {
  61822. resolve(streamSink.onPull && streamSink.onPull());
  61823. }).then(function () {
  61824. comObj.postMessage({
  61825. sourceName,
  61826. targetName,
  61827. stream: StreamKind.PULL_COMPLETE,
  61828. streamId,
  61829. success: true
  61830. });
  61831. }, function (reason) {
  61832. comObj.postMessage({
  61833. sourceName,
  61834. targetName,
  61835. stream: StreamKind.PULL_COMPLETE,
  61836. streamId,
  61837. reason: wrapReason(reason)
  61838. });
  61839. });
  61840. break;
  61841. case StreamKind.ENQUEUE:
  61842. (0, _util.assert)(streamController, "enqueue should have stream controller");
  61843. if (streamController.isClosed) {
  61844. break;
  61845. }
  61846. streamController.controller.enqueue(data.chunk);
  61847. break;
  61848. case StreamKind.CLOSE:
  61849. (0, _util.assert)(streamController, "close should have stream controller");
  61850. if (streamController.isClosed) {
  61851. break;
  61852. }
  61853. streamController.isClosed = true;
  61854. streamController.controller.close();
  61855. this._deleteStreamController(streamController, streamId);
  61856. break;
  61857. case StreamKind.ERROR:
  61858. (0, _util.assert)(streamController, "error should have stream controller");
  61859. streamController.controller.error(wrapReason(data.reason));
  61860. this._deleteStreamController(streamController, streamId);
  61861. break;
  61862. case StreamKind.CANCEL_COMPLETE:
  61863. if (data.success) {
  61864. streamController.cancelCall.resolve();
  61865. } else {
  61866. streamController.cancelCall.reject(wrapReason(data.reason));
  61867. }
  61868. this._deleteStreamController(streamController, streamId);
  61869. break;
  61870. case StreamKind.CANCEL:
  61871. if (!streamSink) {
  61872. break;
  61873. }
  61874. new Promise(function (resolve) {
  61875. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  61876. }).then(function () {
  61877. comObj.postMessage({
  61878. sourceName,
  61879. targetName,
  61880. stream: StreamKind.CANCEL_COMPLETE,
  61881. streamId,
  61882. success: true
  61883. });
  61884. }, function (reason) {
  61885. comObj.postMessage({
  61886. sourceName,
  61887. targetName,
  61888. stream: StreamKind.CANCEL_COMPLETE,
  61889. streamId,
  61890. reason: wrapReason(reason)
  61891. });
  61892. });
  61893. streamSink.sinkCapability.reject(wrapReason(data.reason));
  61894. streamSink.isCancelled = true;
  61895. delete this.streamSinks[streamId];
  61896. break;
  61897. default:
  61898. throw new Error("Unexpected stream case");
  61899. }
  61900. }
  61901. async _deleteStreamController(streamController, streamId) {
  61902. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  61903. delete this.streamControllers[streamId];
  61904. }
  61905. destroy() {
  61906. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  61907. }
  61908. }
  61909. exports.MessageHandler = MessageHandler;
  61910. /***/ }),
  61911. /* 100 */
  61912. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61913. Object.defineProperty(exports, "__esModule", ({
  61914. value: true
  61915. }));
  61916. exports.PDFWorkerStream = void 0;
  61917. var _util = __w_pdfjs_require__(2);
  61918. class PDFWorkerStream {
  61919. constructor(msgHandler) {
  61920. this._msgHandler = msgHandler;
  61921. this._contentLength = null;
  61922. this._fullRequestReader = null;
  61923. this._rangeRequestReaders = [];
  61924. }
  61925. getFullReader() {
  61926. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  61927. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  61928. return this._fullRequestReader;
  61929. }
  61930. getRangeReader(begin, end) {
  61931. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  61932. this._rangeRequestReaders.push(reader);
  61933. return reader;
  61934. }
  61935. cancelAllRequests(reason) {
  61936. if (this._fullRequestReader) {
  61937. this._fullRequestReader.cancel(reason);
  61938. }
  61939. for (const reader of this._rangeRequestReaders.slice(0)) {
  61940. reader.cancel(reason);
  61941. }
  61942. }
  61943. }
  61944. exports.PDFWorkerStream = PDFWorkerStream;
  61945. class PDFWorkerStreamReader {
  61946. constructor(msgHandler) {
  61947. this._msgHandler = msgHandler;
  61948. this.onProgress = null;
  61949. this._contentLength = null;
  61950. this._isRangeSupported = false;
  61951. this._isStreamingSupported = false;
  61952. const readableStream = this._msgHandler.sendWithStream("GetReader");
  61953. this._reader = readableStream.getReader();
  61954. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  61955. this._isStreamingSupported = data.isStreamingSupported;
  61956. this._isRangeSupported = data.isRangeSupported;
  61957. this._contentLength = data.contentLength;
  61958. });
  61959. }
  61960. get headersReady() {
  61961. return this._headersReady;
  61962. }
  61963. get contentLength() {
  61964. return this._contentLength;
  61965. }
  61966. get isStreamingSupported() {
  61967. return this._isStreamingSupported;
  61968. }
  61969. get isRangeSupported() {
  61970. return this._isRangeSupported;
  61971. }
  61972. async read() {
  61973. const {
  61974. value,
  61975. done
  61976. } = await this._reader.read();
  61977. if (done) {
  61978. return {
  61979. value: undefined,
  61980. done: true
  61981. };
  61982. }
  61983. return {
  61984. value: value.buffer,
  61985. done: false
  61986. };
  61987. }
  61988. cancel(reason) {
  61989. this._reader.cancel(reason);
  61990. }
  61991. }
  61992. class PDFWorkerStreamRangeReader {
  61993. constructor(begin, end, msgHandler) {
  61994. this._msgHandler = msgHandler;
  61995. this.onProgress = null;
  61996. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  61997. begin,
  61998. end
  61999. });
  62000. this._reader = readableStream.getReader();
  62001. }
  62002. get isStreamingSupported() {
  62003. return false;
  62004. }
  62005. async read() {
  62006. const {
  62007. value,
  62008. done
  62009. } = await this._reader.read();
  62010. if (done) {
  62011. return {
  62012. value: undefined,
  62013. done: true
  62014. };
  62015. }
  62016. return {
  62017. value: value.buffer,
  62018. done: false
  62019. };
  62020. }
  62021. cancel(reason) {
  62022. this._reader.cancel(reason);
  62023. }
  62024. }
  62025. /***/ })
  62026. /******/ ]);
  62027. /************************************************************************/
  62028. /******/ // The module cache
  62029. /******/ var __webpack_module_cache__ = {};
  62030. /******/
  62031. /******/ // The require function
  62032. /******/ function __w_pdfjs_require__(moduleId) {
  62033. /******/ // Check if module is in cache
  62034. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  62035. /******/ if (cachedModule !== undefined) {
  62036. /******/ return cachedModule.exports;
  62037. /******/ }
  62038. /******/ // Create a new module (and put it into the cache)
  62039. /******/ var module = __webpack_module_cache__[moduleId] = {
  62040. /******/ // no module.id needed
  62041. /******/ // no module.loaded needed
  62042. /******/ exports: {}
  62043. /******/ };
  62044. /******/
  62045. /******/ // Execute the module function
  62046. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  62047. /******/
  62048. /******/ // Return the exports of the module
  62049. /******/ return module.exports;
  62050. /******/ }
  62051. /******/
  62052. /************************************************************************/
  62053. /******/ /* webpack/runtime/define property getters */
  62054. /******/ (() => {
  62055. /******/ // define getter functions for harmony exports
  62056. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  62057. /******/ for(var key in definition) {
  62058. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  62059. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  62060. /******/ }
  62061. /******/ }
  62062. /******/ };
  62063. /******/ })();
  62064. /******/
  62065. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  62066. /******/ (() => {
  62067. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  62068. /******/ })();
  62069. /******/
  62070. /******/ /* webpack/runtime/make namespace object */
  62071. /******/ (() => {
  62072. /******/ // define __esModule on exports
  62073. /******/ __w_pdfjs_require__.r = (exports) => {
  62074. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  62075. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  62076. /******/ }
  62077. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  62078. /******/ };
  62079. /******/ })();
  62080. /******/
  62081. /************************************************************************/
  62082. var __webpack_exports__ = {};
  62083. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  62084. (() => {
  62085. var exports = __webpack_exports__;
  62086. Object.defineProperty(exports, "__esModule", ({
  62087. value: true
  62088. }));
  62089. Object.defineProperty(exports, "WorkerMessageHandler", ({
  62090. enumerable: true,
  62091. get: function () {
  62092. return _worker.WorkerMessageHandler;
  62093. }
  62094. }));
  62095. var _worker = __w_pdfjs_require__(1);
  62096. const pdfjsVersion = '2.12.313';
  62097. const pdfjsBuild = 'a2ae56f39';
  62098. })();
  62099. /******/ return __webpack_exports__;
  62100. /******/ })()
  62101. ;
  62102. });
  62103. //# sourceMappingURL=pdf.worker.js.map