pdf.worker.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 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. })(globalThis, () => {
  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__(3);
  44. var _core_utils = __w_pdfjs_require__(4);
  45. var _pdf_manager = __w_pdfjs_require__(6);
  46. var _cleanup_helper = __w_pdfjs_require__(69);
  47. var _writer = __w_pdfjs_require__(63);
  48. var _is_node = __w_pdfjs_require__(100);
  49. var _message_handler = __w_pdfjs_require__(101);
  50. var _worker_stream = __w_pdfjs_require__(102);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.0.279';
  101. if (apiVersion !== workerVersion) {
  102. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  103. }
  104. const enumerableProperties = [];
  105. for (const property in []) {
  106. enumerableProperties.push(property);
  107. }
  108. if (enumerableProperties.length) {
  109. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  110. }
  111. if (typeof ReadableStream === "undefined") {
  112. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  113. if (_is_node.isNodeJS) {
  114. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  115. }
  116. throw new Error(partialMsg + "please update to a supported browser.");
  117. }
  118. const workerHandlerName = docId + "_worker";
  119. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  120. function ensureNotTerminated() {
  121. if (terminated) {
  122. throw new Error("Worker was terminated");
  123. }
  124. }
  125. function startWorkerTask(task) {
  126. WorkerTasks.push(task);
  127. }
  128. function finishWorkerTask(task) {
  129. task.finish();
  130. const i = WorkerTasks.indexOf(task);
  131. WorkerTasks.splice(i, 1);
  132. }
  133. async function loadDocument(recoveryMode) {
  134. await pdfManager.ensureDoc("checkHeader");
  135. await pdfManager.ensureDoc("parseStartXRef");
  136. await pdfManager.ensureDoc("parse", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  138. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  139. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  140. if (isPureXfa) {
  141. const task = new WorkerTask("loadXfaFonts");
  142. startWorkerTask(task);
  143. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  144. }
  145. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  146. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  147. return {
  148. numPages,
  149. fingerprints,
  150. htmlForXfa
  151. };
  152. }
  153. function getPdfManager({
  154. data,
  155. password,
  156. disableAutoFetch,
  157. rangeChunkSize,
  158. length,
  159. docBaseUrl,
  160. enableXfa,
  161. evaluatorOptions
  162. }) {
  163. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  164. let newPdfManager;
  165. if (data) {
  166. try {
  167. newPdfManager = new _pdf_manager.LocalPdfManager(docId, data, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  168. pdfManagerCapability.resolve(newPdfManager);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. }
  172. return pdfManagerCapability.promise;
  173. }
  174. let pdfStream,
  175. cachedChunks = [];
  176. try {
  177. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  178. } catch (ex) {
  179. pdfManagerCapability.reject(ex);
  180. return pdfManagerCapability.promise;
  181. }
  182. const fullRequest = pdfStream.getFullReader();
  183. fullRequest.headersReady.then(function () {
  184. if (!fullRequest.isRangeSupported) {
  185. return;
  186. }
  187. disableAutoFetch = disableAutoFetch || fullRequest.isStreamingSupported;
  188. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  189. msgHandler: handler,
  190. password,
  191. length: fullRequest.contentLength,
  192. disableAutoFetch,
  193. rangeChunkSize
  194. }, evaluatorOptions, enableXfa, docBaseUrl);
  195. for (const chunk of cachedChunks) {
  196. newPdfManager.sendProgressiveData(chunk);
  197. }
  198. cachedChunks = [];
  199. pdfManagerCapability.resolve(newPdfManager);
  200. cancelXHRs = null;
  201. }).catch(function (reason) {
  202. pdfManagerCapability.reject(reason);
  203. cancelXHRs = null;
  204. });
  205. let loaded = 0;
  206. const flushChunks = function () {
  207. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  208. if (length && pdfFile.length !== length) {
  209. (0, _util.warn)("reported HTTP length is different from actual");
  210. }
  211. try {
  212. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  213. pdfManagerCapability.resolve(newPdfManager);
  214. } catch (ex) {
  215. pdfManagerCapability.reject(ex);
  216. }
  217. cachedChunks = [];
  218. };
  219. const readPromise = new Promise(function (resolve, reject) {
  220. const readChunk = function ({
  221. value,
  222. done
  223. }) {
  224. try {
  225. ensureNotTerminated();
  226. if (done) {
  227. if (!newPdfManager) {
  228. flushChunks();
  229. }
  230. cancelXHRs = null;
  231. return;
  232. }
  233. loaded += (0, _util.arrayByteLength)(value);
  234. if (!fullRequest.isStreamingSupported) {
  235. handler.send("DocProgress", {
  236. loaded,
  237. total: Math.max(loaded, fullRequest.contentLength || 0)
  238. });
  239. }
  240. if (newPdfManager) {
  241. newPdfManager.sendProgressiveData(value);
  242. } else {
  243. cachedChunks.push(value);
  244. }
  245. fullRequest.read().then(readChunk, reject);
  246. } catch (e) {
  247. reject(e);
  248. }
  249. };
  250. fullRequest.read().then(readChunk, reject);
  251. });
  252. readPromise.catch(function (e) {
  253. pdfManagerCapability.reject(e);
  254. cancelXHRs = null;
  255. });
  256. cancelXHRs = function (reason) {
  257. pdfStream.cancelAllRequests(reason);
  258. };
  259. return pdfManagerCapability.promise;
  260. }
  261. function setupDoc(data) {
  262. function onSuccess(doc) {
  263. ensureNotTerminated();
  264. handler.send("GetDoc", {
  265. pdfInfo: doc
  266. });
  267. }
  268. function onFailure(ex) {
  269. ensureNotTerminated();
  270. if (ex instanceof _util.PasswordException) {
  271. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  272. startWorkerTask(task);
  273. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  274. password
  275. }) {
  276. finishWorkerTask(task);
  277. pdfManager.updatePassword(password);
  278. pdfManagerReady();
  279. }).catch(function () {
  280. finishWorkerTask(task);
  281. handler.send("DocException", ex);
  282. });
  283. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  284. handler.send("DocException", ex);
  285. } else {
  286. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  287. }
  288. }
  289. function pdfManagerReady() {
  290. ensureNotTerminated();
  291. loadDocument(false).then(onSuccess, function (reason) {
  292. ensureNotTerminated();
  293. if (!(reason instanceof _core_utils.XRefParseException)) {
  294. onFailure(reason);
  295. return;
  296. }
  297. pdfManager.requestLoadedStream().then(function () {
  298. ensureNotTerminated();
  299. loadDocument(true).then(onSuccess, onFailure);
  300. });
  301. });
  302. }
  303. ensureNotTerminated();
  304. getPdfManager(data).then(function (newPdfManager) {
  305. if (terminated) {
  306. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  307. throw new Error("Worker was terminated");
  308. }
  309. pdfManager = newPdfManager;
  310. pdfManager.requestLoadedStream(true).then(stream => {
  311. handler.send("DataLoaded", {
  312. length: stream.bytes.byteLength
  313. });
  314. });
  315. }).then(pdfManagerReady, onFailure);
  316. }
  317. handler.on("GetPage", function wphSetupGetPage(data) {
  318. return pdfManager.getPage(data.pageIndex).then(function (page) {
  319. 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]) {
  320. return {
  321. rotate,
  322. ref,
  323. userUnit,
  324. view
  325. };
  326. });
  327. });
  328. });
  329. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  330. const pageRef = _primitives.Ref.get(data.num, data.gen);
  331. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  332. });
  333. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  334. return pdfManager.ensureCatalog("destinations");
  335. });
  336. handler.on("GetDestination", function wphSetupGetDestination(data) {
  337. return pdfManager.ensureCatalog("getDestination", [data.id]);
  338. });
  339. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  340. return pdfManager.ensureCatalog("pageLabels");
  341. });
  342. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  343. return pdfManager.ensureCatalog("pageLayout");
  344. });
  345. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  346. return pdfManager.ensureCatalog("pageMode");
  347. });
  348. handler.on("GetViewerPreferences", function (data) {
  349. return pdfManager.ensureCatalog("viewerPreferences");
  350. });
  351. handler.on("GetOpenAction", function (data) {
  352. return pdfManager.ensureCatalog("openAction");
  353. });
  354. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  355. return pdfManager.ensureCatalog("attachments");
  356. });
  357. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  358. return pdfManager.ensureCatalog("javaScript");
  359. });
  360. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  361. return pdfManager.ensureCatalog("jsActions");
  362. });
  363. handler.on("GetPageJSActions", function ({
  364. pageIndex
  365. }) {
  366. return pdfManager.getPage(pageIndex).then(function (page) {
  367. return pdfManager.ensure(page, "jsActions");
  368. });
  369. });
  370. handler.on("GetOutline", function wphSetupGetOutline(data) {
  371. return pdfManager.ensureCatalog("documentOutline");
  372. });
  373. handler.on("GetOptionalContentConfig", function (data) {
  374. return pdfManager.ensureCatalog("optionalContentConfig");
  375. });
  376. handler.on("GetPermissions", function (data) {
  377. return pdfManager.ensureCatalog("permissions");
  378. });
  379. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  380. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  381. });
  382. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  383. return pdfManager.ensureCatalog("markInfo");
  384. });
  385. handler.on("GetData", function wphSetupGetData(data) {
  386. return pdfManager.requestLoadedStream().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. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  396. startWorkerTask(task);
  397. return page.getAnnotationsData(handler, task, intent).then(data => {
  398. finishWorkerTask(task);
  399. return data;
  400. }, reason => {
  401. finishWorkerTask(task);
  402. });
  403. });
  404. });
  405. handler.on("GetFieldObjects", function (data) {
  406. return pdfManager.ensureDoc("fieldObjects");
  407. });
  408. handler.on("HasJSActions", function (data) {
  409. return pdfManager.ensureDoc("hasJSActions");
  410. });
  411. handler.on("GetCalculationOrderIds", function (data) {
  412. return pdfManager.ensureDoc("calculationOrderIds");
  413. });
  414. handler.on("SaveDocument", function ({
  415. isPureXfa,
  416. numPages,
  417. annotationStorage,
  418. filename
  419. }) {
  420. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  421. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  422. if (newAnnotationsByPage) {
  423. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  424. promises.push(pdfManager.getPage(pageIndex).then(page => {
  425. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  426. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  427. finishWorkerTask(task);
  428. });
  429. }));
  430. }
  431. }
  432. if (isPureXfa) {
  433. promises.push(pdfManager.serializeXfaData(annotationStorage));
  434. } else {
  435. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  436. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  437. const task = new WorkerTask(`Save: page ${pageIndex}`);
  438. return page.save(handler, task, annotationStorage).finally(function () {
  439. finishWorkerTask(task);
  440. });
  441. }));
  442. }
  443. }
  444. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  445. let newRefs = [];
  446. let xfaData = null;
  447. if (isPureXfa) {
  448. xfaData = refs[0];
  449. if (!xfaData) {
  450. return stream.bytes;
  451. }
  452. } else {
  453. newRefs = refs.flat(2);
  454. if (newRefs.length === 0) {
  455. return stream.bytes;
  456. }
  457. }
  458. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  459. let xfaDatasetsRef = null;
  460. let hasXfaDatasetsEntry = false;
  461. if (Array.isArray(xfa)) {
  462. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  463. if (xfa[i] === "datasets") {
  464. xfaDatasetsRef = xfa[i + 1];
  465. acroFormRef = null;
  466. hasXfaDatasetsEntry = true;
  467. }
  468. }
  469. if (xfaDatasetsRef === null) {
  470. xfaDatasetsRef = xref.getNewRef();
  471. }
  472. } else if (xfa) {
  473. acroFormRef = null;
  474. (0, _util.warn)("Unsupported XFA type.");
  475. }
  476. let newXrefInfo = Object.create(null);
  477. if (xref.trailer) {
  478. const infoObj = Object.create(null);
  479. const xrefInfo = xref.trailer.get("Info") || null;
  480. if (xrefInfo instanceof _primitives.Dict) {
  481. xrefInfo.forEach((key, value) => {
  482. if (typeof value === "string") {
  483. infoObj[key] = (0, _util.stringToPDFString)(value);
  484. }
  485. });
  486. }
  487. newXrefInfo = {
  488. rootRef: xref.trailer.getRaw("Root") || null,
  489. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  490. newRef: xref.getNewRef(),
  491. infoRef: xref.trailer.getRaw("Info") || null,
  492. info: infoObj,
  493. fileIds: xref.trailer.get("ID") || null,
  494. startXRef,
  495. filename
  496. };
  497. }
  498. xref.resetNewRef();
  499. return (0, _writer.incrementalUpdate)({
  500. originalData: stream.bytes,
  501. xrefInfo: newXrefInfo,
  502. newRefs,
  503. xref,
  504. hasXfa: !!xfa,
  505. xfaDatasetsRef,
  506. hasXfaDatasetsEntry,
  507. acroFormRef,
  508. acroForm,
  509. xfaData
  510. });
  511. });
  512. });
  513. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  514. const pageIndex = data.pageIndex;
  515. pdfManager.getPage(pageIndex).then(function (page) {
  516. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  517. startWorkerTask(task);
  518. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  519. page.getOperatorList({
  520. handler,
  521. sink,
  522. task,
  523. intent: data.intent,
  524. cacheKey: data.cacheKey,
  525. annotationStorage: data.annotationStorage
  526. }).then(function (operatorListInfo) {
  527. finishWorkerTask(task);
  528. if (start) {
  529. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  530. }
  531. sink.close();
  532. }, function (reason) {
  533. finishWorkerTask(task);
  534. if (task.terminated) {
  535. return;
  536. }
  537. sink.error(reason);
  538. });
  539. });
  540. });
  541. handler.on("GetTextContent", function wphExtractText(data, sink) {
  542. const pageIndex = data.pageIndex;
  543. pdfManager.getPage(pageIndex).then(function (page) {
  544. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  545. startWorkerTask(task);
  546. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  547. page.extractTextContent({
  548. handler,
  549. task,
  550. sink,
  551. includeMarkedContent: data.includeMarkedContent,
  552. combineTextItems: data.combineTextItems
  553. }).then(function () {
  554. finishWorkerTask(task);
  555. if (start) {
  556. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  557. }
  558. sink.close();
  559. }, function (reason) {
  560. finishWorkerTask(task);
  561. if (task.terminated) {
  562. return;
  563. }
  564. sink.error(reason);
  565. });
  566. });
  567. });
  568. handler.on("GetStructTree", function wphGetStructTree(data) {
  569. return pdfManager.getPage(data.pageIndex).then(function (page) {
  570. return pdfManager.ensure(page, "getStructTree");
  571. });
  572. });
  573. handler.on("FontFallback", function (data) {
  574. return pdfManager.fontFallback(data.id, handler);
  575. });
  576. handler.on("Cleanup", function wphCleanup(data) {
  577. return pdfManager.cleanup(true);
  578. });
  579. handler.on("Terminate", function wphTerminate(data) {
  580. terminated = true;
  581. const waitOn = [];
  582. if (pdfManager) {
  583. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  584. const cleanupPromise = pdfManager.cleanup();
  585. waitOn.push(cleanupPromise);
  586. pdfManager = null;
  587. } else {
  588. (0, _cleanup_helper.clearGlobalCaches)();
  589. }
  590. if (cancelXHRs) {
  591. cancelXHRs(new _util.AbortException("Worker was terminated."));
  592. }
  593. for (const task of WorkerTasks) {
  594. waitOn.push(task.finished);
  595. task.terminate();
  596. }
  597. return Promise.all(waitOn).then(function () {
  598. handler.destroy();
  599. handler = null;
  600. });
  601. });
  602. handler.on("Ready", function wphReady(data) {
  603. setupDoc(docParams);
  604. docParams = null;
  605. });
  606. return workerHandlerName;
  607. }
  608. static initializeFromPort(port) {
  609. const handler = new _message_handler.MessageHandler("worker", "main", port);
  610. WorkerMessageHandler.setup(handler, port);
  611. handler.send("ready", null);
  612. }
  613. }
  614. exports.WorkerMessageHandler = WorkerMessageHandler;
  615. function isMessagePort(maybePort) {
  616. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  617. }
  618. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  619. WorkerMessageHandler.initializeFromPort(self);
  620. }
  621. /***/ }),
  622. /* 2 */
  623. /***/ ((__unused_webpack_module, exports) => {
  624. Object.defineProperty(exports, "__esModule", ({
  625. value: true
  626. }));
  627. 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.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = 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.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  628. exports.arrayByteLength = arrayByteLength;
  629. exports.arraysToBytes = arraysToBytes;
  630. exports.assert = assert;
  631. exports.bytesToString = bytesToString;
  632. exports.createPromiseCapability = createPromiseCapability;
  633. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  634. exports.escapeString = escapeString;
  635. exports.getModificationDate = getModificationDate;
  636. exports.getVerbosityLevel = getVerbosityLevel;
  637. exports.info = info;
  638. exports.isArrayBuffer = isArrayBuffer;
  639. exports.isArrayEqual = isArrayEqual;
  640. exports.isAscii = isAscii;
  641. exports.objectFromMap = objectFromMap;
  642. exports.objectSize = objectSize;
  643. exports.setVerbosityLevel = setVerbosityLevel;
  644. exports.shadow = shadow;
  645. exports.string32 = string32;
  646. exports.stringToBytes = stringToBytes;
  647. exports.stringToPDFString = stringToPDFString;
  648. exports.stringToUTF16BEString = stringToUTF16BEString;
  649. exports.stringToUTF8String = stringToUTF8String;
  650. exports.unreachable = unreachable;
  651. exports.utf8StringToString = utf8StringToString;
  652. exports.warn = warn;
  653. ;
  654. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  655. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  656. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  657. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  658. const LINE_FACTOR = 1.35;
  659. exports.LINE_FACTOR = LINE_FACTOR;
  660. const LINE_DESCENT_FACTOR = 0.35;
  661. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  662. const RenderingIntentFlag = {
  663. ANY: 0x01,
  664. DISPLAY: 0x02,
  665. PRINT: 0x04,
  666. ANNOTATIONS_FORMS: 0x10,
  667. ANNOTATIONS_STORAGE: 0x20,
  668. ANNOTATIONS_DISABLE: 0x40,
  669. OPLIST: 0x100
  670. };
  671. exports.RenderingIntentFlag = RenderingIntentFlag;
  672. const AnnotationMode = {
  673. DISABLE: 0,
  674. ENABLE: 1,
  675. ENABLE_FORMS: 2,
  676. ENABLE_STORAGE: 3
  677. };
  678. exports.AnnotationMode = AnnotationMode;
  679. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  680. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  681. const AnnotationEditorType = {
  682. DISABLE: -1,
  683. NONE: 0,
  684. FREETEXT: 3,
  685. INK: 15
  686. };
  687. exports.AnnotationEditorType = AnnotationEditorType;
  688. const AnnotationEditorParamsType = {
  689. FREETEXT_SIZE: 1,
  690. FREETEXT_COLOR: 2,
  691. FREETEXT_OPACITY: 3,
  692. INK_COLOR: 11,
  693. INK_THICKNESS: 12,
  694. INK_OPACITY: 13
  695. };
  696. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  697. const PermissionFlag = {
  698. PRINT: 0x04,
  699. MODIFY_CONTENTS: 0x08,
  700. COPY: 0x10,
  701. MODIFY_ANNOTATIONS: 0x20,
  702. FILL_INTERACTIVE_FORMS: 0x100,
  703. COPY_FOR_ACCESSIBILITY: 0x200,
  704. ASSEMBLE: 0x400,
  705. PRINT_HIGH_QUALITY: 0x800
  706. };
  707. exports.PermissionFlag = PermissionFlag;
  708. const TextRenderingMode = {
  709. FILL: 0,
  710. STROKE: 1,
  711. FILL_STROKE: 2,
  712. INVISIBLE: 3,
  713. FILL_ADD_TO_PATH: 4,
  714. STROKE_ADD_TO_PATH: 5,
  715. FILL_STROKE_ADD_TO_PATH: 6,
  716. ADD_TO_PATH: 7,
  717. FILL_STROKE_MASK: 3,
  718. ADD_TO_PATH_FLAG: 4
  719. };
  720. exports.TextRenderingMode = TextRenderingMode;
  721. const ImageKind = {
  722. GRAYSCALE_1BPP: 1,
  723. RGB_24BPP: 2,
  724. RGBA_32BPP: 3
  725. };
  726. exports.ImageKind = ImageKind;
  727. const AnnotationType = {
  728. TEXT: 1,
  729. LINK: 2,
  730. FREETEXT: 3,
  731. LINE: 4,
  732. SQUARE: 5,
  733. CIRCLE: 6,
  734. POLYGON: 7,
  735. POLYLINE: 8,
  736. HIGHLIGHT: 9,
  737. UNDERLINE: 10,
  738. SQUIGGLY: 11,
  739. STRIKEOUT: 12,
  740. STAMP: 13,
  741. CARET: 14,
  742. INK: 15,
  743. POPUP: 16,
  744. FILEATTACHMENT: 17,
  745. SOUND: 18,
  746. MOVIE: 19,
  747. WIDGET: 20,
  748. SCREEN: 21,
  749. PRINTERMARK: 22,
  750. TRAPNET: 23,
  751. WATERMARK: 24,
  752. THREED: 25,
  753. REDACT: 26
  754. };
  755. exports.AnnotationType = AnnotationType;
  756. const AnnotationStateModelType = {
  757. MARKED: "Marked",
  758. REVIEW: "Review"
  759. };
  760. exports.AnnotationStateModelType = AnnotationStateModelType;
  761. const AnnotationMarkedState = {
  762. MARKED: "Marked",
  763. UNMARKED: "Unmarked"
  764. };
  765. exports.AnnotationMarkedState = AnnotationMarkedState;
  766. const AnnotationReviewState = {
  767. ACCEPTED: "Accepted",
  768. REJECTED: "Rejected",
  769. CANCELLED: "Cancelled",
  770. COMPLETED: "Completed",
  771. NONE: "None"
  772. };
  773. exports.AnnotationReviewState = AnnotationReviewState;
  774. const AnnotationReplyType = {
  775. GROUP: "Group",
  776. REPLY: "R"
  777. };
  778. exports.AnnotationReplyType = AnnotationReplyType;
  779. const AnnotationFlag = {
  780. INVISIBLE: 0x01,
  781. HIDDEN: 0x02,
  782. PRINT: 0x04,
  783. NOZOOM: 0x08,
  784. NOROTATE: 0x10,
  785. NOVIEW: 0x20,
  786. READONLY: 0x40,
  787. LOCKED: 0x80,
  788. TOGGLENOVIEW: 0x100,
  789. LOCKEDCONTENTS: 0x200
  790. };
  791. exports.AnnotationFlag = AnnotationFlag;
  792. const AnnotationFieldFlag = {
  793. READONLY: 0x0000001,
  794. REQUIRED: 0x0000002,
  795. NOEXPORT: 0x0000004,
  796. MULTILINE: 0x0001000,
  797. PASSWORD: 0x0002000,
  798. NOTOGGLETOOFF: 0x0004000,
  799. RADIO: 0x0008000,
  800. PUSHBUTTON: 0x0010000,
  801. COMBO: 0x0020000,
  802. EDIT: 0x0040000,
  803. SORT: 0x0080000,
  804. FILESELECT: 0x0100000,
  805. MULTISELECT: 0x0200000,
  806. DONOTSPELLCHECK: 0x0400000,
  807. DONOTSCROLL: 0x0800000,
  808. COMB: 0x1000000,
  809. RICHTEXT: 0x2000000,
  810. RADIOSINUNISON: 0x2000000,
  811. COMMITONSELCHANGE: 0x4000000
  812. };
  813. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  814. const AnnotationBorderStyleType = {
  815. SOLID: 1,
  816. DASHED: 2,
  817. BEVELED: 3,
  818. INSET: 4,
  819. UNDERLINE: 5
  820. };
  821. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  822. const AnnotationActionEventType = {
  823. E: "Mouse Enter",
  824. X: "Mouse Exit",
  825. D: "Mouse Down",
  826. U: "Mouse Up",
  827. Fo: "Focus",
  828. Bl: "Blur",
  829. PO: "PageOpen",
  830. PC: "PageClose",
  831. PV: "PageVisible",
  832. PI: "PageInvisible",
  833. K: "Keystroke",
  834. F: "Format",
  835. V: "Validate",
  836. C: "Calculate"
  837. };
  838. exports.AnnotationActionEventType = AnnotationActionEventType;
  839. const DocumentActionEventType = {
  840. WC: "WillClose",
  841. WS: "WillSave",
  842. DS: "DidSave",
  843. WP: "WillPrint",
  844. DP: "DidPrint"
  845. };
  846. exports.DocumentActionEventType = DocumentActionEventType;
  847. const PageActionEventType = {
  848. O: "PageOpen",
  849. C: "PageClose"
  850. };
  851. exports.PageActionEventType = PageActionEventType;
  852. const StreamType = {
  853. UNKNOWN: "UNKNOWN",
  854. FLATE: "FLATE",
  855. LZW: "LZW",
  856. DCT: "DCT",
  857. JPX: "JPX",
  858. JBIG: "JBIG",
  859. A85: "A85",
  860. AHX: "AHX",
  861. CCF: "CCF",
  862. RLX: "RLX"
  863. };
  864. exports.StreamType = StreamType;
  865. const FontType = {
  866. UNKNOWN: "UNKNOWN",
  867. TYPE1: "TYPE1",
  868. TYPE1STANDARD: "TYPE1STANDARD",
  869. TYPE1C: "TYPE1C",
  870. CIDFONTTYPE0: "CIDFONTTYPE0",
  871. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  872. TRUETYPE: "TRUETYPE",
  873. CIDFONTTYPE2: "CIDFONTTYPE2",
  874. TYPE3: "TYPE3",
  875. OPENTYPE: "OPENTYPE",
  876. TYPE0: "TYPE0",
  877. MMTYPE1: "MMTYPE1"
  878. };
  879. exports.FontType = FontType;
  880. const VerbosityLevel = {
  881. ERRORS: 0,
  882. WARNINGS: 1,
  883. INFOS: 5
  884. };
  885. exports.VerbosityLevel = VerbosityLevel;
  886. const CMapCompressionType = {
  887. NONE: 0,
  888. BINARY: 1
  889. };
  890. exports.CMapCompressionType = CMapCompressionType;
  891. const OPS = {
  892. dependency: 1,
  893. setLineWidth: 2,
  894. setLineCap: 3,
  895. setLineJoin: 4,
  896. setMiterLimit: 5,
  897. setDash: 6,
  898. setRenderingIntent: 7,
  899. setFlatness: 8,
  900. setGState: 9,
  901. save: 10,
  902. restore: 11,
  903. transform: 12,
  904. moveTo: 13,
  905. lineTo: 14,
  906. curveTo: 15,
  907. curveTo2: 16,
  908. curveTo3: 17,
  909. closePath: 18,
  910. rectangle: 19,
  911. stroke: 20,
  912. closeStroke: 21,
  913. fill: 22,
  914. eoFill: 23,
  915. fillStroke: 24,
  916. eoFillStroke: 25,
  917. closeFillStroke: 26,
  918. closeEOFillStroke: 27,
  919. endPath: 28,
  920. clip: 29,
  921. eoClip: 30,
  922. beginText: 31,
  923. endText: 32,
  924. setCharSpacing: 33,
  925. setWordSpacing: 34,
  926. setHScale: 35,
  927. setLeading: 36,
  928. setFont: 37,
  929. setTextRenderingMode: 38,
  930. setTextRise: 39,
  931. moveText: 40,
  932. setLeadingMoveText: 41,
  933. setTextMatrix: 42,
  934. nextLine: 43,
  935. showText: 44,
  936. showSpacedText: 45,
  937. nextLineShowText: 46,
  938. nextLineSetSpacingShowText: 47,
  939. setCharWidth: 48,
  940. setCharWidthAndBounds: 49,
  941. setStrokeColorSpace: 50,
  942. setFillColorSpace: 51,
  943. setStrokeColor: 52,
  944. setStrokeColorN: 53,
  945. setFillColor: 54,
  946. setFillColorN: 55,
  947. setStrokeGray: 56,
  948. setFillGray: 57,
  949. setStrokeRGBColor: 58,
  950. setFillRGBColor: 59,
  951. setStrokeCMYKColor: 60,
  952. setFillCMYKColor: 61,
  953. shadingFill: 62,
  954. beginInlineImage: 63,
  955. beginImageData: 64,
  956. endInlineImage: 65,
  957. paintXObject: 66,
  958. markPoint: 67,
  959. markPointProps: 68,
  960. beginMarkedContent: 69,
  961. beginMarkedContentProps: 70,
  962. endMarkedContent: 71,
  963. beginCompat: 72,
  964. endCompat: 73,
  965. paintFormXObjectBegin: 74,
  966. paintFormXObjectEnd: 75,
  967. beginGroup: 76,
  968. endGroup: 77,
  969. beginAnnotation: 80,
  970. endAnnotation: 81,
  971. paintImageMaskXObject: 83,
  972. paintImageMaskXObjectGroup: 84,
  973. paintImageXObject: 85,
  974. paintInlineImageXObject: 86,
  975. paintInlineImageXObjectGroup: 87,
  976. paintImageXObjectRepeat: 88,
  977. paintImageMaskXObjectRepeat: 89,
  978. paintSolidColorImageMask: 90,
  979. constructPath: 91
  980. };
  981. exports.OPS = OPS;
  982. const UNSUPPORTED_FEATURES = {
  983. forms: "forms",
  984. javaScript: "javaScript",
  985. signatures: "signatures",
  986. smask: "smask",
  987. shadingPattern: "shadingPattern",
  988. errorTilingPattern: "errorTilingPattern",
  989. errorExtGState: "errorExtGState",
  990. errorXObject: "errorXObject",
  991. errorFontLoadType3: "errorFontLoadType3",
  992. errorFontState: "errorFontState",
  993. errorFontMissing: "errorFontMissing",
  994. errorFontTranslate: "errorFontTranslate",
  995. errorColorSpace: "errorColorSpace",
  996. errorOperatorList: "errorOperatorList",
  997. errorFontToUnicode: "errorFontToUnicode",
  998. errorFontLoadNative: "errorFontLoadNative",
  999. errorFontBuildPath: "errorFontBuildPath",
  1000. errorFontGetPath: "errorFontGetPath",
  1001. errorMarkedContent: "errorMarkedContent",
  1002. errorContentSubStream: "errorContentSubStream"
  1003. };
  1004. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1005. const PasswordResponses = {
  1006. NEED_PASSWORD: 1,
  1007. INCORRECT_PASSWORD: 2
  1008. };
  1009. exports.PasswordResponses = PasswordResponses;
  1010. let verbosity = VerbosityLevel.WARNINGS;
  1011. function setVerbosityLevel(level) {
  1012. if (Number.isInteger(level)) {
  1013. verbosity = level;
  1014. }
  1015. }
  1016. function getVerbosityLevel() {
  1017. return verbosity;
  1018. }
  1019. function info(msg) {
  1020. if (verbosity >= VerbosityLevel.INFOS) {
  1021. console.log(`Info: ${msg}`);
  1022. }
  1023. }
  1024. function warn(msg) {
  1025. if (verbosity >= VerbosityLevel.WARNINGS) {
  1026. console.log(`Warning: ${msg}`);
  1027. }
  1028. }
  1029. function unreachable(msg) {
  1030. throw new Error(msg);
  1031. }
  1032. function assert(cond, msg) {
  1033. if (!cond) {
  1034. unreachable(msg);
  1035. }
  1036. }
  1037. function _isValidProtocol(url) {
  1038. if (!url) {
  1039. return false;
  1040. }
  1041. switch (url.protocol) {
  1042. case "http:":
  1043. case "https:":
  1044. case "ftp:":
  1045. case "mailto:":
  1046. case "tel:":
  1047. return true;
  1048. default:
  1049. return false;
  1050. }
  1051. }
  1052. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1053. if (!url) {
  1054. return null;
  1055. }
  1056. try {
  1057. if (options && typeof url === "string") {
  1058. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1059. const dots = url.match(/\./g);
  1060. if (dots && dots.length >= 2) {
  1061. url = `http://${url}`;
  1062. }
  1063. }
  1064. if (options.tryConvertEncoding) {
  1065. try {
  1066. url = stringToUTF8String(url);
  1067. } catch (ex) {}
  1068. }
  1069. }
  1070. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1071. if (_isValidProtocol(absoluteUrl)) {
  1072. return absoluteUrl;
  1073. }
  1074. } catch (ex) {}
  1075. return null;
  1076. }
  1077. function shadow(obj, prop, value) {
  1078. Object.defineProperty(obj, prop, {
  1079. value,
  1080. enumerable: true,
  1081. configurable: true,
  1082. writable: false
  1083. });
  1084. return value;
  1085. }
  1086. const BaseException = function BaseExceptionClosure() {
  1087. function BaseException(message, name) {
  1088. if (this.constructor === BaseException) {
  1089. unreachable("Cannot initialize BaseException.");
  1090. }
  1091. this.message = message;
  1092. this.name = name;
  1093. }
  1094. BaseException.prototype = new Error();
  1095. BaseException.constructor = BaseException;
  1096. return BaseException;
  1097. }();
  1098. exports.BaseException = BaseException;
  1099. class PasswordException extends BaseException {
  1100. constructor(msg, code) {
  1101. super(msg, "PasswordException");
  1102. this.code = code;
  1103. }
  1104. }
  1105. exports.PasswordException = PasswordException;
  1106. class UnknownErrorException extends BaseException {
  1107. constructor(msg, details) {
  1108. super(msg, "UnknownErrorException");
  1109. this.details = details;
  1110. }
  1111. }
  1112. exports.UnknownErrorException = UnknownErrorException;
  1113. class InvalidPDFException extends BaseException {
  1114. constructor(msg) {
  1115. super(msg, "InvalidPDFException");
  1116. }
  1117. }
  1118. exports.InvalidPDFException = InvalidPDFException;
  1119. class MissingPDFException extends BaseException {
  1120. constructor(msg) {
  1121. super(msg, "MissingPDFException");
  1122. }
  1123. }
  1124. exports.MissingPDFException = MissingPDFException;
  1125. class UnexpectedResponseException extends BaseException {
  1126. constructor(msg, status) {
  1127. super(msg, "UnexpectedResponseException");
  1128. this.status = status;
  1129. }
  1130. }
  1131. exports.UnexpectedResponseException = UnexpectedResponseException;
  1132. class FormatError extends BaseException {
  1133. constructor(msg) {
  1134. super(msg, "FormatError");
  1135. }
  1136. }
  1137. exports.FormatError = FormatError;
  1138. class AbortException extends BaseException {
  1139. constructor(msg) {
  1140. super(msg, "AbortException");
  1141. }
  1142. }
  1143. exports.AbortException = AbortException;
  1144. function bytesToString(bytes) {
  1145. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1146. unreachable("Invalid argument for bytesToString");
  1147. }
  1148. const length = bytes.length;
  1149. const MAX_ARGUMENT_COUNT = 8192;
  1150. if (length < MAX_ARGUMENT_COUNT) {
  1151. return String.fromCharCode.apply(null, bytes);
  1152. }
  1153. const strBuf = [];
  1154. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1155. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1156. const chunk = bytes.subarray(i, chunkEnd);
  1157. strBuf.push(String.fromCharCode.apply(null, chunk));
  1158. }
  1159. return strBuf.join("");
  1160. }
  1161. function stringToBytes(str) {
  1162. if (typeof str !== "string") {
  1163. unreachable("Invalid argument for stringToBytes");
  1164. }
  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. if (arr.byteLength !== undefined) {
  1177. return arr.byteLength;
  1178. }
  1179. unreachable("Invalid argument for arrayByteLength");
  1180. }
  1181. function arraysToBytes(arr) {
  1182. const length = arr.length;
  1183. if (length === 1 && arr[0] instanceof Uint8Array) {
  1184. return arr[0];
  1185. }
  1186. let resultLength = 0;
  1187. for (let i = 0; i < length; i++) {
  1188. resultLength += arrayByteLength(arr[i]);
  1189. }
  1190. let pos = 0;
  1191. const data = new Uint8Array(resultLength);
  1192. for (let i = 0; i < length; i++) {
  1193. let item = arr[i];
  1194. if (!(item instanceof Uint8Array)) {
  1195. if (typeof item === "string") {
  1196. item = stringToBytes(item);
  1197. } else {
  1198. item = new Uint8Array(item);
  1199. }
  1200. }
  1201. const itemLength = item.byteLength;
  1202. data.set(item, pos);
  1203. pos += itemLength;
  1204. }
  1205. return data;
  1206. }
  1207. function string32(value) {
  1208. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1209. }
  1210. function objectSize(obj) {
  1211. return Object.keys(obj).length;
  1212. }
  1213. function objectFromMap(map) {
  1214. const obj = Object.create(null);
  1215. for (const [key, value] of map) {
  1216. obj[key] = value;
  1217. }
  1218. return obj;
  1219. }
  1220. function isLittleEndian() {
  1221. const buffer8 = new Uint8Array(4);
  1222. buffer8[0] = 1;
  1223. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1224. return view32[0] === 1;
  1225. }
  1226. function isEvalSupported() {
  1227. try {
  1228. new Function("");
  1229. return true;
  1230. } catch (e) {
  1231. return false;
  1232. }
  1233. }
  1234. class FeatureTest {
  1235. static get isLittleEndian() {
  1236. return shadow(this, "isLittleEndian", isLittleEndian());
  1237. }
  1238. static get isEvalSupported() {
  1239. return shadow(this, "isEvalSupported", isEvalSupported());
  1240. }
  1241. static get isOffscreenCanvasSupported() {
  1242. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1243. }
  1244. }
  1245. exports.FeatureTest = FeatureTest;
  1246. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1247. class Util {
  1248. static makeHexColor(r, g, b) {
  1249. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1250. }
  1251. static scaleMinMax(transform, minMax) {
  1252. let temp;
  1253. if (transform[0]) {
  1254. if (transform[0] < 0) {
  1255. temp = minMax[0];
  1256. minMax[0] = minMax[1];
  1257. minMax[1] = temp;
  1258. }
  1259. minMax[0] *= transform[0];
  1260. minMax[1] *= transform[0];
  1261. if (transform[3] < 0) {
  1262. temp = minMax[2];
  1263. minMax[2] = minMax[3];
  1264. minMax[3] = temp;
  1265. }
  1266. minMax[2] *= transform[3];
  1267. minMax[3] *= transform[3];
  1268. } else {
  1269. temp = minMax[0];
  1270. minMax[0] = minMax[2];
  1271. minMax[2] = temp;
  1272. temp = minMax[1];
  1273. minMax[1] = minMax[3];
  1274. minMax[3] = temp;
  1275. if (transform[1] < 0) {
  1276. temp = minMax[2];
  1277. minMax[2] = minMax[3];
  1278. minMax[3] = temp;
  1279. }
  1280. minMax[2] *= transform[1];
  1281. minMax[3] *= transform[1];
  1282. if (transform[2] < 0) {
  1283. temp = minMax[0];
  1284. minMax[0] = minMax[1];
  1285. minMax[1] = temp;
  1286. }
  1287. minMax[0] *= transform[2];
  1288. minMax[1] *= transform[2];
  1289. }
  1290. minMax[0] += transform[4];
  1291. minMax[1] += transform[4];
  1292. minMax[2] += transform[5];
  1293. minMax[3] += transform[5];
  1294. }
  1295. static transform(m1, m2) {
  1296. 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]];
  1297. }
  1298. static applyTransform(p, m) {
  1299. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1300. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1301. return [xt, yt];
  1302. }
  1303. static applyInverseTransform(p, m) {
  1304. const d = m[0] * m[3] - m[1] * m[2];
  1305. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1306. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1307. return [xt, yt];
  1308. }
  1309. static getAxialAlignedBoundingBox(r, m) {
  1310. const p1 = Util.applyTransform(r, m);
  1311. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1312. const p3 = Util.applyTransform([r[0], r[3]], m);
  1313. const p4 = Util.applyTransform([r[2], r[1]], m);
  1314. 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])];
  1315. }
  1316. static inverseTransform(m) {
  1317. const d = m[0] * m[3] - m[1] * m[2];
  1318. 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];
  1319. }
  1320. static singularValueDecompose2dScale(m) {
  1321. const transpose = [m[0], m[2], m[1], m[3]];
  1322. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1323. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1324. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1325. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1326. const first = (a + d) / 2;
  1327. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1328. const sx = first + second || 1;
  1329. const sy = first - second || 1;
  1330. return [Math.sqrt(sx), Math.sqrt(sy)];
  1331. }
  1332. static normalizeRect(rect) {
  1333. const r = rect.slice(0);
  1334. if (rect[0] > rect[2]) {
  1335. r[0] = rect[2];
  1336. r[2] = rect[0];
  1337. }
  1338. if (rect[1] > rect[3]) {
  1339. r[1] = rect[3];
  1340. r[3] = rect[1];
  1341. }
  1342. return r;
  1343. }
  1344. static intersect(rect1, rect2) {
  1345. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1346. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1347. if (xLow > xHigh) {
  1348. return null;
  1349. }
  1350. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1351. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1352. if (yLow > yHigh) {
  1353. return null;
  1354. }
  1355. return [xLow, yLow, xHigh, yHigh];
  1356. }
  1357. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1358. const tvalues = [],
  1359. bounds = [[], []];
  1360. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1361. for (let i = 0; i < 2; ++i) {
  1362. if (i === 0) {
  1363. b = 6 * x0 - 12 * x1 + 6 * x2;
  1364. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1365. c = 3 * x1 - 3 * x0;
  1366. } else {
  1367. b = 6 * y0 - 12 * y1 + 6 * y2;
  1368. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1369. c = 3 * y1 - 3 * y0;
  1370. }
  1371. if (Math.abs(a) < 1e-12) {
  1372. if (Math.abs(b) < 1e-12) {
  1373. continue;
  1374. }
  1375. t = -c / b;
  1376. if (0 < t && t < 1) {
  1377. tvalues.push(t);
  1378. }
  1379. continue;
  1380. }
  1381. b2ac = b * b - 4 * c * a;
  1382. sqrtb2ac = Math.sqrt(b2ac);
  1383. if (b2ac < 0) {
  1384. continue;
  1385. }
  1386. t1 = (-b + sqrtb2ac) / (2 * a);
  1387. if (0 < t1 && t1 < 1) {
  1388. tvalues.push(t1);
  1389. }
  1390. t2 = (-b - sqrtb2ac) / (2 * a);
  1391. if (0 < t2 && t2 < 1) {
  1392. tvalues.push(t2);
  1393. }
  1394. }
  1395. let j = tvalues.length,
  1396. mt;
  1397. const jlen = j;
  1398. while (j--) {
  1399. t = tvalues[j];
  1400. mt = 1 - t;
  1401. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1402. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1403. }
  1404. bounds[0][jlen] = x0;
  1405. bounds[1][jlen] = y0;
  1406. bounds[0][jlen + 1] = x3;
  1407. bounds[1][jlen + 1] = y3;
  1408. bounds[0].length = bounds[1].length = jlen + 2;
  1409. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1410. }
  1411. }
  1412. exports.Util = Util;
  1413. 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];
  1414. function stringToPDFString(str) {
  1415. if (str[0] >= "\xEF") {
  1416. let encoding;
  1417. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1418. encoding = "utf-16be";
  1419. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1420. encoding = "utf-16le";
  1421. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1422. encoding = "utf-8";
  1423. }
  1424. if (encoding) {
  1425. try {
  1426. const decoder = new TextDecoder(encoding, {
  1427. fatal: true
  1428. });
  1429. const buffer = stringToBytes(str);
  1430. return decoder.decode(buffer);
  1431. } catch (ex) {
  1432. warn(`stringToPDFString: "${ex}".`);
  1433. }
  1434. }
  1435. }
  1436. const strBuf = [];
  1437. for (let i = 0, ii = str.length; i < ii; i++) {
  1438. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1439. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1440. }
  1441. return strBuf.join("");
  1442. }
  1443. function escapeString(str) {
  1444. return str.replace(/([()\\\n\r])/g, match => {
  1445. if (match === "\n") {
  1446. return "\\n";
  1447. } else if (match === "\r") {
  1448. return "\\r";
  1449. }
  1450. return `\\${match}`;
  1451. });
  1452. }
  1453. function isAscii(str) {
  1454. return /^[\x00-\x7F]*$/.test(str);
  1455. }
  1456. function stringToUTF16BEString(str) {
  1457. const buf = ["\xFE\xFF"];
  1458. for (let i = 0, ii = str.length; i < ii; i++) {
  1459. const char = str.charCodeAt(i);
  1460. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1461. }
  1462. return buf.join("");
  1463. }
  1464. function stringToUTF8String(str) {
  1465. return decodeURIComponent(escape(str));
  1466. }
  1467. function utf8StringToString(str) {
  1468. return unescape(encodeURIComponent(str));
  1469. }
  1470. function isArrayBuffer(v) {
  1471. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1472. }
  1473. function isArrayEqual(arr1, arr2) {
  1474. if (arr1.length !== arr2.length) {
  1475. return false;
  1476. }
  1477. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1478. if (arr1[i] !== arr2[i]) {
  1479. return false;
  1480. }
  1481. }
  1482. return true;
  1483. }
  1484. function getModificationDate(date = new Date()) {
  1485. 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")];
  1486. return buffer.join("");
  1487. }
  1488. function createPromiseCapability() {
  1489. const capability = Object.create(null);
  1490. let isSettled = false;
  1491. Object.defineProperty(capability, "settled", {
  1492. get() {
  1493. return isSettled;
  1494. }
  1495. });
  1496. capability.promise = new Promise(function (resolve, reject) {
  1497. capability.resolve = function (data) {
  1498. isSettled = true;
  1499. resolve(data);
  1500. };
  1501. capability.reject = function (reason) {
  1502. isSettled = true;
  1503. reject(reason);
  1504. };
  1505. });
  1506. return capability;
  1507. }
  1508. /***/ }),
  1509. /* 3 */
  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.isRefsEqual = isRefsEqual;
  1520. var _util = __w_pdfjs_require__(2);
  1521. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1522. exports.CIRCULAR_REF = CIRCULAR_REF;
  1523. const EOF = Symbol("EOF");
  1524. exports.EOF = EOF;
  1525. const Name = function NameClosure() {
  1526. let nameCache = Object.create(null);
  1527. class Name {
  1528. constructor(name) {
  1529. this.name = name;
  1530. }
  1531. static get(name) {
  1532. return nameCache[name] || (nameCache[name] = new Name(name));
  1533. }
  1534. static _clearCache() {
  1535. nameCache = Object.create(null);
  1536. }
  1537. }
  1538. return Name;
  1539. }();
  1540. exports.Name = Name;
  1541. const Cmd = function CmdClosure() {
  1542. let cmdCache = Object.create(null);
  1543. class Cmd {
  1544. constructor(cmd) {
  1545. this.cmd = cmd;
  1546. }
  1547. static get(cmd) {
  1548. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1549. }
  1550. static _clearCache() {
  1551. cmdCache = Object.create(null);
  1552. }
  1553. }
  1554. return Cmd;
  1555. }();
  1556. exports.Cmd = Cmd;
  1557. const nonSerializable = function nonSerializableClosure() {
  1558. return nonSerializable;
  1559. };
  1560. class Dict {
  1561. constructor(xref = null) {
  1562. this._map = Object.create(null);
  1563. this.xref = xref;
  1564. this.objId = null;
  1565. this.suppressEncryption = false;
  1566. this.__nonSerializable__ = nonSerializable;
  1567. }
  1568. assignXref(newXref) {
  1569. this.xref = newXref;
  1570. }
  1571. get size() {
  1572. return Object.keys(this._map).length;
  1573. }
  1574. get(key1, key2, key3) {
  1575. let value = this._map[key1];
  1576. if (value === undefined && key2 !== undefined) {
  1577. value = this._map[key2];
  1578. if (value === undefined && key3 !== undefined) {
  1579. value = this._map[key3];
  1580. }
  1581. }
  1582. if (value instanceof Ref && this.xref) {
  1583. return this.xref.fetch(value, this.suppressEncryption);
  1584. }
  1585. return value;
  1586. }
  1587. async getAsync(key1, key2, key3) {
  1588. let value = this._map[key1];
  1589. if (value === undefined && key2 !== undefined) {
  1590. value = this._map[key2];
  1591. if (value === undefined && key3 !== undefined) {
  1592. value = this._map[key3];
  1593. }
  1594. }
  1595. if (value instanceof Ref && this.xref) {
  1596. return this.xref.fetchAsync(value, this.suppressEncryption);
  1597. }
  1598. return value;
  1599. }
  1600. getArray(key1, key2, key3) {
  1601. let value = this._map[key1];
  1602. if (value === undefined && key2 !== undefined) {
  1603. value = this._map[key2];
  1604. if (value === undefined && key3 !== undefined) {
  1605. value = this._map[key3];
  1606. }
  1607. }
  1608. if (value instanceof Ref && this.xref) {
  1609. value = this.xref.fetch(value, this.suppressEncryption);
  1610. }
  1611. if (Array.isArray(value)) {
  1612. value = value.slice();
  1613. for (let i = 0, ii = value.length; i < ii; i++) {
  1614. if (value[i] instanceof Ref && this.xref) {
  1615. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1616. }
  1617. }
  1618. }
  1619. return value;
  1620. }
  1621. getRaw(key) {
  1622. return this._map[key];
  1623. }
  1624. getKeys() {
  1625. return Object.keys(this._map);
  1626. }
  1627. getRawValues() {
  1628. return Object.values(this._map);
  1629. }
  1630. set(key, value) {
  1631. this._map[key] = value;
  1632. }
  1633. has(key) {
  1634. return this._map[key] !== undefined;
  1635. }
  1636. forEach(callback) {
  1637. for (const key in this._map) {
  1638. callback(key, this.get(key));
  1639. }
  1640. }
  1641. static get empty() {
  1642. const emptyDict = new Dict(null);
  1643. emptyDict.set = (key, value) => {
  1644. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1645. };
  1646. return (0, _util.shadow)(this, "empty", emptyDict);
  1647. }
  1648. static merge({
  1649. xref,
  1650. dictArray,
  1651. mergeSubDicts = false
  1652. }) {
  1653. const mergedDict = new Dict(xref),
  1654. properties = new Map();
  1655. for (const dict of dictArray) {
  1656. if (!(dict instanceof Dict)) {
  1657. continue;
  1658. }
  1659. for (const [key, value] of Object.entries(dict._map)) {
  1660. let property = properties.get(key);
  1661. if (property === undefined) {
  1662. property = [];
  1663. properties.set(key, property);
  1664. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1665. continue;
  1666. }
  1667. property.push(value);
  1668. }
  1669. }
  1670. for (const [name, values] of properties) {
  1671. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1672. mergedDict._map[name] = values[0];
  1673. continue;
  1674. }
  1675. const subDict = new Dict(xref);
  1676. for (const dict of values) {
  1677. for (const [key, value] of Object.entries(dict._map)) {
  1678. if (subDict._map[key] === undefined) {
  1679. subDict._map[key] = value;
  1680. }
  1681. }
  1682. }
  1683. if (subDict.size > 0) {
  1684. mergedDict._map[name] = subDict;
  1685. }
  1686. }
  1687. properties.clear();
  1688. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1689. }
  1690. }
  1691. exports.Dict = Dict;
  1692. const Ref = function RefClosure() {
  1693. let refCache = Object.create(null);
  1694. class Ref {
  1695. constructor(num, gen) {
  1696. this.num = num;
  1697. this.gen = gen;
  1698. }
  1699. toString() {
  1700. if (this.gen === 0) {
  1701. return `${this.num}R`;
  1702. }
  1703. return `${this.num}R${this.gen}`;
  1704. }
  1705. static get(num, gen) {
  1706. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1707. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1708. }
  1709. static _clearCache() {
  1710. refCache = Object.create(null);
  1711. }
  1712. }
  1713. return Ref;
  1714. }();
  1715. exports.Ref = Ref;
  1716. class RefSet {
  1717. constructor(parent = null) {
  1718. this._set = new Set(parent && parent._set);
  1719. }
  1720. has(ref) {
  1721. return this._set.has(ref.toString());
  1722. }
  1723. put(ref) {
  1724. this._set.add(ref.toString());
  1725. }
  1726. remove(ref) {
  1727. this._set.delete(ref.toString());
  1728. }
  1729. [Symbol.iterator]() {
  1730. return this._set.values();
  1731. }
  1732. clear() {
  1733. this._set.clear();
  1734. }
  1735. }
  1736. exports.RefSet = RefSet;
  1737. class RefSetCache {
  1738. constructor() {
  1739. this._map = new Map();
  1740. }
  1741. get size() {
  1742. return this._map.size;
  1743. }
  1744. get(ref) {
  1745. return this._map.get(ref.toString());
  1746. }
  1747. has(ref) {
  1748. return this._map.has(ref.toString());
  1749. }
  1750. put(ref, obj) {
  1751. this._map.set(ref.toString(), obj);
  1752. }
  1753. putAlias(ref, aliasRef) {
  1754. this._map.set(ref.toString(), this.get(aliasRef));
  1755. }
  1756. [Symbol.iterator]() {
  1757. return this._map.values();
  1758. }
  1759. clear() {
  1760. this._map.clear();
  1761. }
  1762. }
  1763. exports.RefSetCache = RefSetCache;
  1764. function isName(v, name) {
  1765. return v instanceof Name && (name === undefined || v.name === name);
  1766. }
  1767. function isCmd(v, cmd) {
  1768. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1769. }
  1770. function isDict(v, type) {
  1771. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1772. }
  1773. function isRefsEqual(v1, v2) {
  1774. return v1.num === v2.num && v1.gen === v2.gen;
  1775. }
  1776. function clearPrimitiveCaches() {
  1777. Cmd._clearCache();
  1778. Name._clearCache();
  1779. Ref._clearCache();
  1780. }
  1781. /***/ }),
  1782. /* 4 */
  1783. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1784. Object.defineProperty(exports, "__esModule", ({
  1785. value: true
  1786. }));
  1787. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  1788. exports.collectActions = collectActions;
  1789. exports.encodeToXmlString = encodeToXmlString;
  1790. exports.escapePDFName = escapePDFName;
  1791. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1792. exports.getInheritableProperty = getInheritableProperty;
  1793. exports.getLookupTableFactory = getLookupTableFactory;
  1794. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1795. exports.isWhiteSpace = isWhiteSpace;
  1796. exports.log2 = log2;
  1797. exports.numberToString = numberToString;
  1798. exports.parseXFAPath = parseXFAPath;
  1799. exports.readInt8 = readInt8;
  1800. exports.readUint16 = readUint16;
  1801. exports.readUint32 = readUint32;
  1802. exports.recoverJsURL = recoverJsURL;
  1803. exports.toRomanNumerals = toRomanNumerals;
  1804. exports.validateCSSFont = validateCSSFont;
  1805. var _util = __w_pdfjs_require__(2);
  1806. var _primitives = __w_pdfjs_require__(3);
  1807. var _base_stream = __w_pdfjs_require__(5);
  1808. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1809. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  1810. function getLookupTableFactory(initializer) {
  1811. let lookup;
  1812. return function () {
  1813. if (initializer) {
  1814. lookup = Object.create(null);
  1815. initializer(lookup);
  1816. initializer = null;
  1817. }
  1818. return lookup;
  1819. };
  1820. }
  1821. function getArrayLookupTableFactory(initializer) {
  1822. let lookup;
  1823. return function () {
  1824. if (initializer) {
  1825. let arr = initializer();
  1826. initializer = null;
  1827. lookup = Object.create(null);
  1828. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1829. lookup[arr[i]] = arr[i + 1];
  1830. }
  1831. arr = null;
  1832. }
  1833. return lookup;
  1834. };
  1835. }
  1836. class MissingDataException extends _util.BaseException {
  1837. constructor(begin, end) {
  1838. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1839. this.begin = begin;
  1840. this.end = end;
  1841. }
  1842. }
  1843. exports.MissingDataException = MissingDataException;
  1844. class ParserEOFException extends _util.BaseException {
  1845. constructor(msg) {
  1846. super(msg, "ParserEOFException");
  1847. }
  1848. }
  1849. exports.ParserEOFException = ParserEOFException;
  1850. class XRefEntryException extends _util.BaseException {
  1851. constructor(msg) {
  1852. super(msg, "XRefEntryException");
  1853. }
  1854. }
  1855. exports.XRefEntryException = XRefEntryException;
  1856. class XRefParseException extends _util.BaseException {
  1857. constructor(msg) {
  1858. super(msg, "XRefParseException");
  1859. }
  1860. }
  1861. exports.XRefParseException = XRefParseException;
  1862. class DocStats {
  1863. constructor(handler) {
  1864. this._handler = handler;
  1865. this._streamTypes = new Set();
  1866. this._fontTypes = new Set();
  1867. }
  1868. _send() {
  1869. const streamTypes = Object.create(null),
  1870. fontTypes = Object.create(null);
  1871. for (const type of this._streamTypes) {
  1872. streamTypes[type] = true;
  1873. }
  1874. for (const type of this._fontTypes) {
  1875. fontTypes[type] = true;
  1876. }
  1877. this._handler.send("DocStats", {
  1878. streamTypes,
  1879. fontTypes
  1880. });
  1881. }
  1882. addStreamType(type) {
  1883. if (this._streamTypes.has(type)) {
  1884. return;
  1885. }
  1886. this._streamTypes.add(type);
  1887. this._send();
  1888. }
  1889. addFontType(type) {
  1890. if (this._fontTypes.has(type)) {
  1891. return;
  1892. }
  1893. this._fontTypes.add(type);
  1894. this._send();
  1895. }
  1896. }
  1897. exports.DocStats = DocStats;
  1898. function getInheritableProperty({
  1899. dict,
  1900. key,
  1901. getArray = false,
  1902. stopWhenFound = true
  1903. }) {
  1904. let values;
  1905. const visited = new _primitives.RefSet();
  1906. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1907. if (dict.objId) {
  1908. visited.put(dict.objId);
  1909. }
  1910. const value = getArray ? dict.getArray(key) : dict.get(key);
  1911. if (value !== undefined) {
  1912. if (stopWhenFound) {
  1913. return value;
  1914. }
  1915. if (!values) {
  1916. values = [];
  1917. }
  1918. values.push(value);
  1919. }
  1920. dict = dict.get("Parent");
  1921. }
  1922. return values;
  1923. }
  1924. 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"];
  1925. function toRomanNumerals(number, lowerCase = false) {
  1926. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1927. const romanBuf = [];
  1928. let pos;
  1929. while (number >= 1000) {
  1930. number -= 1000;
  1931. romanBuf.push("M");
  1932. }
  1933. pos = number / 100 | 0;
  1934. number %= 100;
  1935. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1936. pos = number / 10 | 0;
  1937. number %= 10;
  1938. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1939. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1940. const romanStr = romanBuf.join("");
  1941. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1942. }
  1943. function log2(x) {
  1944. if (x <= 0) {
  1945. return 0;
  1946. }
  1947. return Math.ceil(Math.log2(x));
  1948. }
  1949. function readInt8(data, offset) {
  1950. return data[offset] << 24 >> 24;
  1951. }
  1952. function readUint16(data, offset) {
  1953. return data[offset] << 8 | data[offset + 1];
  1954. }
  1955. function readUint32(data, offset) {
  1956. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1957. }
  1958. function isWhiteSpace(ch) {
  1959. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1960. }
  1961. function parseXFAPath(path) {
  1962. const positionPattern = /(.+)\[(\d+)\]$/;
  1963. return path.split(".").map(component => {
  1964. const m = component.match(positionPattern);
  1965. if (m) {
  1966. return {
  1967. name: m[1],
  1968. pos: parseInt(m[2], 10)
  1969. };
  1970. }
  1971. return {
  1972. name: component,
  1973. pos: 0
  1974. };
  1975. });
  1976. }
  1977. function escapePDFName(str) {
  1978. const buffer = [];
  1979. let start = 0;
  1980. for (let i = 0, ii = str.length; i < ii; i++) {
  1981. const char = str.charCodeAt(i);
  1982. 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) {
  1983. if (start < i) {
  1984. buffer.push(str.substring(start, i));
  1985. }
  1986. buffer.push(`#${char.toString(16)}`);
  1987. start = i + 1;
  1988. }
  1989. }
  1990. if (buffer.length === 0) {
  1991. return str;
  1992. }
  1993. if (start < str.length) {
  1994. buffer.push(str.substring(start, str.length));
  1995. }
  1996. return buffer.join("");
  1997. }
  1998. function _collectJS(entry, xref, list, parents) {
  1999. if (!entry) {
  2000. return;
  2001. }
  2002. let parent = null;
  2003. if (entry instanceof _primitives.Ref) {
  2004. if (parents.has(entry)) {
  2005. return;
  2006. }
  2007. parent = entry;
  2008. parents.put(parent);
  2009. entry = xref.fetch(entry);
  2010. }
  2011. if (Array.isArray(entry)) {
  2012. for (const element of entry) {
  2013. _collectJS(element, xref, list, parents);
  2014. }
  2015. } else if (entry instanceof _primitives.Dict) {
  2016. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2017. const js = entry.get("JS");
  2018. let code;
  2019. if (js instanceof _base_stream.BaseStream) {
  2020. code = js.getString();
  2021. } else if (typeof js === "string") {
  2022. code = js;
  2023. }
  2024. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2025. if (code) {
  2026. list.push(code);
  2027. }
  2028. }
  2029. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2030. }
  2031. if (parent) {
  2032. parents.remove(parent);
  2033. }
  2034. }
  2035. function collectActions(xref, dict, eventType) {
  2036. const actions = Object.create(null);
  2037. const additionalActionsDicts = getInheritableProperty({
  2038. dict,
  2039. key: "AA",
  2040. stopWhenFound: false
  2041. });
  2042. if (additionalActionsDicts) {
  2043. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2044. const additionalActions = additionalActionsDicts[i];
  2045. if (!(additionalActions instanceof _primitives.Dict)) {
  2046. continue;
  2047. }
  2048. for (const key of additionalActions.getKeys()) {
  2049. const action = eventType[key];
  2050. if (!action) {
  2051. continue;
  2052. }
  2053. const actionDict = additionalActions.getRaw(key);
  2054. const parents = new _primitives.RefSet();
  2055. const list = [];
  2056. _collectJS(actionDict, xref, list, parents);
  2057. if (list.length > 0) {
  2058. actions[action] = list;
  2059. }
  2060. }
  2061. }
  2062. }
  2063. if (dict.has("A")) {
  2064. const actionDict = dict.get("A");
  2065. const parents = new _primitives.RefSet();
  2066. const list = [];
  2067. _collectJS(actionDict, xref, list, parents);
  2068. if (list.length > 0) {
  2069. actions.Action = list;
  2070. }
  2071. }
  2072. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2073. }
  2074. const XMLEntities = {
  2075. 0x3c: "&lt;",
  2076. 0x3e: "&gt;",
  2077. 0x26: "&amp;",
  2078. 0x22: "&quot;",
  2079. 0x27: "&apos;"
  2080. };
  2081. function encodeToXmlString(str) {
  2082. const buffer = [];
  2083. let start = 0;
  2084. for (let i = 0, ii = str.length; i < ii; i++) {
  2085. const char = str.codePointAt(i);
  2086. if (0x20 <= char && char <= 0x7e) {
  2087. const entity = XMLEntities[char];
  2088. if (entity) {
  2089. if (start < i) {
  2090. buffer.push(str.substring(start, i));
  2091. }
  2092. buffer.push(entity);
  2093. start = i + 1;
  2094. }
  2095. } else {
  2096. if (start < i) {
  2097. buffer.push(str.substring(start, i));
  2098. }
  2099. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2100. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2101. i++;
  2102. }
  2103. start = i + 1;
  2104. }
  2105. }
  2106. if (buffer.length === 0) {
  2107. return str;
  2108. }
  2109. if (start < str.length) {
  2110. buffer.push(str.substring(start, str.length));
  2111. }
  2112. return buffer.join("");
  2113. }
  2114. function validateCSSFont(cssFontInfo) {
  2115. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2116. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2117. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2118. const {
  2119. fontFamily,
  2120. fontWeight,
  2121. italicAngle
  2122. } = cssFontInfo;
  2123. if (/^".*"$/.test(fontFamily)) {
  2124. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2125. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2126. return false;
  2127. }
  2128. } else if (/^'.*'$/.test(fontFamily)) {
  2129. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2130. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2131. return false;
  2132. }
  2133. } else {
  2134. for (const ident of fontFamily.split(/[ \t]+/)) {
  2135. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2136. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2137. return false;
  2138. }
  2139. }
  2140. }
  2141. const weight = fontWeight ? fontWeight.toString() : "";
  2142. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2143. const angle = parseFloat(italicAngle);
  2144. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2145. return true;
  2146. }
  2147. function recoverJsURL(str) {
  2148. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2149. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2150. const jsUrl = regex.exec(str);
  2151. if (jsUrl && jsUrl[2]) {
  2152. const url = jsUrl[2];
  2153. let newWindow = false;
  2154. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2155. newWindow = true;
  2156. }
  2157. return {
  2158. url,
  2159. newWindow
  2160. };
  2161. }
  2162. return null;
  2163. }
  2164. function numberToString(value) {
  2165. if (Number.isInteger(value)) {
  2166. return value.toString();
  2167. }
  2168. const roundedValue = Math.round(value * 100);
  2169. if (roundedValue % 100 === 0) {
  2170. return (roundedValue / 100).toString();
  2171. }
  2172. if (roundedValue % 10 === 0) {
  2173. return value.toFixed(1);
  2174. }
  2175. return value.toFixed(2);
  2176. }
  2177. function getNewAnnotationsMap(annotationStorage) {
  2178. if (!annotationStorage) {
  2179. return null;
  2180. }
  2181. const newAnnotationsByPage = new Map();
  2182. for (const [key, value] of annotationStorage) {
  2183. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2184. continue;
  2185. }
  2186. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2187. if (!annotations) {
  2188. annotations = [];
  2189. newAnnotationsByPage.set(value.pageIndex, annotations);
  2190. }
  2191. annotations.push(value);
  2192. }
  2193. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2194. }
  2195. /***/ }),
  2196. /* 5 */
  2197. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2198. Object.defineProperty(exports, "__esModule", ({
  2199. value: true
  2200. }));
  2201. exports.BaseStream = void 0;
  2202. var _util = __w_pdfjs_require__(2);
  2203. class BaseStream {
  2204. constructor() {
  2205. if (this.constructor === BaseStream) {
  2206. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2207. }
  2208. }
  2209. get length() {
  2210. (0, _util.unreachable)("Abstract getter `length` accessed");
  2211. }
  2212. get isEmpty() {
  2213. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2214. }
  2215. get isDataLoaded() {
  2216. return (0, _util.shadow)(this, "isDataLoaded", true);
  2217. }
  2218. getByte() {
  2219. (0, _util.unreachable)("Abstract method `getByte` called");
  2220. }
  2221. getBytes(length) {
  2222. (0, _util.unreachable)("Abstract method `getBytes` called");
  2223. }
  2224. peekByte() {
  2225. const peekedByte = this.getByte();
  2226. if (peekedByte !== -1) {
  2227. this.pos--;
  2228. }
  2229. return peekedByte;
  2230. }
  2231. peekBytes(length) {
  2232. const bytes = this.getBytes(length);
  2233. this.pos -= bytes.length;
  2234. return bytes;
  2235. }
  2236. getUint16() {
  2237. const b0 = this.getByte();
  2238. const b1 = this.getByte();
  2239. if (b0 === -1 || b1 === -1) {
  2240. return -1;
  2241. }
  2242. return (b0 << 8) + b1;
  2243. }
  2244. getInt32() {
  2245. const b0 = this.getByte();
  2246. const b1 = this.getByte();
  2247. const b2 = this.getByte();
  2248. const b3 = this.getByte();
  2249. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2250. }
  2251. getByteRange(begin, end) {
  2252. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2253. }
  2254. getString(length) {
  2255. return (0, _util.bytesToString)(this.getBytes(length));
  2256. }
  2257. skip(n) {
  2258. this.pos += n || 1;
  2259. }
  2260. reset() {
  2261. (0, _util.unreachable)("Abstract method `reset` called");
  2262. }
  2263. moveStart() {
  2264. (0, _util.unreachable)("Abstract method `moveStart` called");
  2265. }
  2266. makeSubStream(start, length, dict = null) {
  2267. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2268. }
  2269. getBaseStreams() {
  2270. return null;
  2271. }
  2272. }
  2273. exports.BaseStream = BaseStream;
  2274. /***/ }),
  2275. /* 6 */
  2276. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2277. Object.defineProperty(exports, "__esModule", ({
  2278. value: true
  2279. }));
  2280. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2281. var _util = __w_pdfjs_require__(2);
  2282. var _chunked_stream = __w_pdfjs_require__(7);
  2283. var _core_utils = __w_pdfjs_require__(4);
  2284. var _document = __w_pdfjs_require__(9);
  2285. var _stream = __w_pdfjs_require__(8);
  2286. function parseDocBaseUrl(url) {
  2287. if (url) {
  2288. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2289. if (absoluteUrl) {
  2290. return absoluteUrl.href;
  2291. }
  2292. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2293. }
  2294. return null;
  2295. }
  2296. class BasePdfManager {
  2297. constructor() {
  2298. if (this.constructor === BasePdfManager) {
  2299. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2300. }
  2301. }
  2302. get docId() {
  2303. return this._docId;
  2304. }
  2305. get password() {
  2306. return this._password;
  2307. }
  2308. get docBaseUrl() {
  2309. const catalog = this.pdfDocument.catalog;
  2310. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2311. }
  2312. ensureDoc(prop, args) {
  2313. return this.ensure(this.pdfDocument, prop, args);
  2314. }
  2315. ensureXRef(prop, args) {
  2316. return this.ensure(this.pdfDocument.xref, prop, args);
  2317. }
  2318. ensureCatalog(prop, args) {
  2319. return this.ensure(this.pdfDocument.catalog, prop, args);
  2320. }
  2321. getPage(pageIndex) {
  2322. return this.pdfDocument.getPage(pageIndex);
  2323. }
  2324. fontFallback(id, handler) {
  2325. return this.pdfDocument.fontFallback(id, handler);
  2326. }
  2327. loadXfaFonts(handler, task) {
  2328. return this.pdfDocument.loadXfaFonts(handler, task);
  2329. }
  2330. loadXfaImages() {
  2331. return this.pdfDocument.loadXfaImages();
  2332. }
  2333. serializeXfaData(annotationStorage) {
  2334. return this.pdfDocument.serializeXfaData(annotationStorage);
  2335. }
  2336. cleanup(manuallyTriggered = false) {
  2337. return this.pdfDocument.cleanup(manuallyTriggered);
  2338. }
  2339. async ensure(obj, prop, args) {
  2340. (0, _util.unreachable)("Abstract method `ensure` called");
  2341. }
  2342. requestRange(begin, end) {
  2343. (0, _util.unreachable)("Abstract method `requestRange` called");
  2344. }
  2345. requestLoadedStream(noFetch = false) {
  2346. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2347. }
  2348. sendProgressiveData(chunk) {
  2349. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2350. }
  2351. updatePassword(password) {
  2352. this._password = password;
  2353. }
  2354. terminate(reason) {
  2355. (0, _util.unreachable)("Abstract method `terminate` called");
  2356. }
  2357. }
  2358. class LocalPdfManager extends BasePdfManager {
  2359. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2360. super();
  2361. this._docId = docId;
  2362. this._password = password;
  2363. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2364. this.msgHandler = msgHandler;
  2365. this.evaluatorOptions = evaluatorOptions;
  2366. this.enableXfa = enableXfa;
  2367. const stream = new _stream.Stream(data);
  2368. this.pdfDocument = new _document.PDFDocument(this, stream);
  2369. this._loadedStreamPromise = Promise.resolve(stream);
  2370. }
  2371. async ensure(obj, prop, args) {
  2372. const value = obj[prop];
  2373. if (typeof value === "function") {
  2374. return value.apply(obj, args);
  2375. }
  2376. return value;
  2377. }
  2378. requestRange(begin, end) {
  2379. return Promise.resolve();
  2380. }
  2381. requestLoadedStream(noFetch = false) {
  2382. return this._loadedStreamPromise;
  2383. }
  2384. terminate(reason) {}
  2385. }
  2386. exports.LocalPdfManager = LocalPdfManager;
  2387. class NetworkPdfManager extends BasePdfManager {
  2388. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2389. super();
  2390. this._docId = docId;
  2391. this._password = args.password;
  2392. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2393. this.msgHandler = args.msgHandler;
  2394. this.evaluatorOptions = evaluatorOptions;
  2395. this.enableXfa = enableXfa;
  2396. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2397. msgHandler: args.msgHandler,
  2398. length: args.length,
  2399. disableAutoFetch: args.disableAutoFetch,
  2400. rangeChunkSize: args.rangeChunkSize
  2401. });
  2402. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2403. }
  2404. async ensure(obj, prop, args) {
  2405. try {
  2406. const value = obj[prop];
  2407. if (typeof value === "function") {
  2408. return value.apply(obj, args);
  2409. }
  2410. return value;
  2411. } catch (ex) {
  2412. if (!(ex instanceof _core_utils.MissingDataException)) {
  2413. throw ex;
  2414. }
  2415. await this.requestRange(ex.begin, ex.end);
  2416. return this.ensure(obj, prop, args);
  2417. }
  2418. }
  2419. requestRange(begin, end) {
  2420. return this.streamManager.requestRange(begin, end);
  2421. }
  2422. requestLoadedStream(noFetch = false) {
  2423. return this.streamManager.requestAllChunks(noFetch);
  2424. }
  2425. sendProgressiveData(chunk) {
  2426. this.streamManager.onReceiveData({
  2427. chunk
  2428. });
  2429. }
  2430. terminate(reason) {
  2431. this.streamManager.abort(reason);
  2432. }
  2433. }
  2434. exports.NetworkPdfManager = NetworkPdfManager;
  2435. /***/ }),
  2436. /* 7 */
  2437. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2438. Object.defineProperty(exports, "__esModule", ({
  2439. value: true
  2440. }));
  2441. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2442. var _util = __w_pdfjs_require__(2);
  2443. var _core_utils = __w_pdfjs_require__(4);
  2444. var _stream = __w_pdfjs_require__(8);
  2445. class ChunkedStream extends _stream.Stream {
  2446. constructor(length, chunkSize, manager) {
  2447. super(new Uint8Array(length), 0, length, null);
  2448. this.chunkSize = chunkSize;
  2449. this._loadedChunks = new Set();
  2450. this.numChunks = Math.ceil(length / chunkSize);
  2451. this.manager = manager;
  2452. this.progressiveDataLength = 0;
  2453. this.lastSuccessfulEnsureByteChunk = -1;
  2454. }
  2455. getMissingChunks() {
  2456. const chunks = [];
  2457. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2458. if (!this._loadedChunks.has(chunk)) {
  2459. chunks.push(chunk);
  2460. }
  2461. }
  2462. return chunks;
  2463. }
  2464. get numChunksLoaded() {
  2465. return this._loadedChunks.size;
  2466. }
  2467. get isDataLoaded() {
  2468. return this.numChunksLoaded === this.numChunks;
  2469. }
  2470. onReceiveData(begin, chunk) {
  2471. const chunkSize = this.chunkSize;
  2472. if (begin % chunkSize !== 0) {
  2473. throw new Error(`Bad begin offset: ${begin}`);
  2474. }
  2475. const end = begin + chunk.byteLength;
  2476. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2477. throw new Error(`Bad end offset: ${end}`);
  2478. }
  2479. this.bytes.set(new Uint8Array(chunk), begin);
  2480. const beginChunk = Math.floor(begin / chunkSize);
  2481. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2482. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2483. this._loadedChunks.add(curChunk);
  2484. }
  2485. }
  2486. onReceiveProgressiveData(data) {
  2487. let position = this.progressiveDataLength;
  2488. const beginChunk = Math.floor(position / this.chunkSize);
  2489. this.bytes.set(new Uint8Array(data), position);
  2490. position += data.byteLength;
  2491. this.progressiveDataLength = position;
  2492. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2493. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2494. this._loadedChunks.add(curChunk);
  2495. }
  2496. }
  2497. ensureByte(pos) {
  2498. if (pos < this.progressiveDataLength) {
  2499. return;
  2500. }
  2501. const chunk = Math.floor(pos / this.chunkSize);
  2502. if (chunk > this.numChunks) {
  2503. return;
  2504. }
  2505. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2506. return;
  2507. }
  2508. if (!this._loadedChunks.has(chunk)) {
  2509. throw new _core_utils.MissingDataException(pos, pos + 1);
  2510. }
  2511. this.lastSuccessfulEnsureByteChunk = chunk;
  2512. }
  2513. ensureRange(begin, end) {
  2514. if (begin >= end) {
  2515. return;
  2516. }
  2517. if (end <= this.progressiveDataLength) {
  2518. return;
  2519. }
  2520. const beginChunk = Math.floor(begin / this.chunkSize);
  2521. if (beginChunk > this.numChunks) {
  2522. return;
  2523. }
  2524. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2525. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2526. if (!this._loadedChunks.has(chunk)) {
  2527. throw new _core_utils.MissingDataException(begin, end);
  2528. }
  2529. }
  2530. }
  2531. nextEmptyChunk(beginChunk) {
  2532. const numChunks = this.numChunks;
  2533. for (let i = 0; i < numChunks; ++i) {
  2534. const chunk = (beginChunk + i) % numChunks;
  2535. if (!this._loadedChunks.has(chunk)) {
  2536. return chunk;
  2537. }
  2538. }
  2539. return null;
  2540. }
  2541. hasChunk(chunk) {
  2542. return this._loadedChunks.has(chunk);
  2543. }
  2544. getByte() {
  2545. const pos = this.pos;
  2546. if (pos >= this.end) {
  2547. return -1;
  2548. }
  2549. if (pos >= this.progressiveDataLength) {
  2550. this.ensureByte(pos);
  2551. }
  2552. return this.bytes[this.pos++];
  2553. }
  2554. getBytes(length) {
  2555. const bytes = this.bytes;
  2556. const pos = this.pos;
  2557. const strEnd = this.end;
  2558. if (!length) {
  2559. if (strEnd > this.progressiveDataLength) {
  2560. this.ensureRange(pos, strEnd);
  2561. }
  2562. return bytes.subarray(pos, strEnd);
  2563. }
  2564. let end = pos + length;
  2565. if (end > strEnd) {
  2566. end = strEnd;
  2567. }
  2568. if (end > this.progressiveDataLength) {
  2569. this.ensureRange(pos, end);
  2570. }
  2571. this.pos = end;
  2572. return bytes.subarray(pos, end);
  2573. }
  2574. getByteRange(begin, end) {
  2575. if (begin < 0) {
  2576. begin = 0;
  2577. }
  2578. if (end > this.end) {
  2579. end = this.end;
  2580. }
  2581. if (end > this.progressiveDataLength) {
  2582. this.ensureRange(begin, end);
  2583. }
  2584. return this.bytes.subarray(begin, end);
  2585. }
  2586. makeSubStream(start, length, dict = null) {
  2587. if (length) {
  2588. if (start + length > this.progressiveDataLength) {
  2589. this.ensureRange(start, start + length);
  2590. }
  2591. } else {
  2592. if (start >= this.progressiveDataLength) {
  2593. this.ensureByte(start);
  2594. }
  2595. }
  2596. function ChunkedStreamSubstream() {}
  2597. ChunkedStreamSubstream.prototype = Object.create(this);
  2598. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2599. const chunkSize = this.chunkSize;
  2600. const beginChunk = Math.floor(this.start / chunkSize);
  2601. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2602. const missingChunks = [];
  2603. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2604. if (!this._loadedChunks.has(chunk)) {
  2605. missingChunks.push(chunk);
  2606. }
  2607. }
  2608. return missingChunks;
  2609. };
  2610. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2611. get() {
  2612. if (this.numChunksLoaded === this.numChunks) {
  2613. return true;
  2614. }
  2615. return this.getMissingChunks().length === 0;
  2616. },
  2617. configurable: true
  2618. });
  2619. const subStream = new ChunkedStreamSubstream();
  2620. subStream.pos = subStream.start = start;
  2621. subStream.end = start + length || this.end;
  2622. subStream.dict = dict;
  2623. return subStream;
  2624. }
  2625. getBaseStreams() {
  2626. return [this];
  2627. }
  2628. }
  2629. exports.ChunkedStream = ChunkedStream;
  2630. class ChunkedStreamManager {
  2631. constructor(pdfNetworkStream, args) {
  2632. this.length = args.length;
  2633. this.chunkSize = args.rangeChunkSize;
  2634. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2635. this.pdfNetworkStream = pdfNetworkStream;
  2636. this.disableAutoFetch = args.disableAutoFetch;
  2637. this.msgHandler = args.msgHandler;
  2638. this.currRequestId = 0;
  2639. this._chunksNeededByRequest = new Map();
  2640. this._requestsByChunk = new Map();
  2641. this._promisesByRequest = new Map();
  2642. this.progressiveDataLength = 0;
  2643. this.aborted = false;
  2644. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2645. }
  2646. sendRequest(begin, end) {
  2647. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2648. if (!rangeReader.isStreamingSupported) {
  2649. rangeReader.onProgress = this.onProgress.bind(this);
  2650. }
  2651. let chunks = [],
  2652. loaded = 0;
  2653. return new Promise((resolve, reject) => {
  2654. const readChunk = chunk => {
  2655. try {
  2656. if (!chunk.done) {
  2657. const data = chunk.value;
  2658. chunks.push(data);
  2659. loaded += (0, _util.arrayByteLength)(data);
  2660. if (rangeReader.isStreamingSupported) {
  2661. this.onProgress({
  2662. loaded
  2663. });
  2664. }
  2665. rangeReader.read().then(readChunk, reject);
  2666. return;
  2667. }
  2668. const chunkData = (0, _util.arraysToBytes)(chunks);
  2669. chunks = null;
  2670. resolve(chunkData);
  2671. } catch (e) {
  2672. reject(e);
  2673. }
  2674. };
  2675. rangeReader.read().then(readChunk, reject);
  2676. }).then(data => {
  2677. if (this.aborted) {
  2678. return;
  2679. }
  2680. this.onReceiveData({
  2681. chunk: data,
  2682. begin
  2683. });
  2684. });
  2685. }
  2686. requestAllChunks(noFetch = false) {
  2687. if (!noFetch) {
  2688. const missingChunks = this.stream.getMissingChunks();
  2689. this._requestChunks(missingChunks);
  2690. }
  2691. return this._loadedStreamCapability.promise;
  2692. }
  2693. _requestChunks(chunks) {
  2694. const requestId = this.currRequestId++;
  2695. const chunksNeeded = new Set();
  2696. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2697. for (const chunk of chunks) {
  2698. if (!this.stream.hasChunk(chunk)) {
  2699. chunksNeeded.add(chunk);
  2700. }
  2701. }
  2702. if (chunksNeeded.size === 0) {
  2703. return Promise.resolve();
  2704. }
  2705. const capability = (0, _util.createPromiseCapability)();
  2706. this._promisesByRequest.set(requestId, capability);
  2707. const chunksToRequest = [];
  2708. for (const chunk of chunksNeeded) {
  2709. let requestIds = this._requestsByChunk.get(chunk);
  2710. if (!requestIds) {
  2711. requestIds = [];
  2712. this._requestsByChunk.set(chunk, requestIds);
  2713. chunksToRequest.push(chunk);
  2714. }
  2715. requestIds.push(requestId);
  2716. }
  2717. if (chunksToRequest.length > 0) {
  2718. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2719. for (const groupedChunk of groupedChunksToRequest) {
  2720. const begin = groupedChunk.beginChunk * this.chunkSize;
  2721. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2722. this.sendRequest(begin, end).catch(capability.reject);
  2723. }
  2724. }
  2725. return capability.promise.catch(reason => {
  2726. if (this.aborted) {
  2727. return;
  2728. }
  2729. throw reason;
  2730. });
  2731. }
  2732. getStream() {
  2733. return this.stream;
  2734. }
  2735. requestRange(begin, end) {
  2736. end = Math.min(end, this.length);
  2737. const beginChunk = this.getBeginChunk(begin);
  2738. const endChunk = this.getEndChunk(end);
  2739. const chunks = [];
  2740. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2741. chunks.push(chunk);
  2742. }
  2743. return this._requestChunks(chunks);
  2744. }
  2745. requestRanges(ranges = []) {
  2746. const chunksToRequest = [];
  2747. for (const range of ranges) {
  2748. const beginChunk = this.getBeginChunk(range.begin);
  2749. const endChunk = this.getEndChunk(range.end);
  2750. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2751. if (!chunksToRequest.includes(chunk)) {
  2752. chunksToRequest.push(chunk);
  2753. }
  2754. }
  2755. }
  2756. chunksToRequest.sort(function (a, b) {
  2757. return a - b;
  2758. });
  2759. return this._requestChunks(chunksToRequest);
  2760. }
  2761. groupChunks(chunks) {
  2762. const groupedChunks = [];
  2763. let beginChunk = -1;
  2764. let prevChunk = -1;
  2765. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2766. const chunk = chunks[i];
  2767. if (beginChunk < 0) {
  2768. beginChunk = chunk;
  2769. }
  2770. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2771. groupedChunks.push({
  2772. beginChunk,
  2773. endChunk: prevChunk + 1
  2774. });
  2775. beginChunk = chunk;
  2776. }
  2777. if (i + 1 === chunks.length) {
  2778. groupedChunks.push({
  2779. beginChunk,
  2780. endChunk: chunk + 1
  2781. });
  2782. }
  2783. prevChunk = chunk;
  2784. }
  2785. return groupedChunks;
  2786. }
  2787. onProgress(args) {
  2788. this.msgHandler.send("DocProgress", {
  2789. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2790. total: this.length
  2791. });
  2792. }
  2793. onReceiveData(args) {
  2794. const chunk = args.chunk;
  2795. const isProgressive = args.begin === undefined;
  2796. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2797. const end = begin + chunk.byteLength;
  2798. const beginChunk = Math.floor(begin / this.chunkSize);
  2799. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2800. if (isProgressive) {
  2801. this.stream.onReceiveProgressiveData(chunk);
  2802. this.progressiveDataLength = end;
  2803. } else {
  2804. this.stream.onReceiveData(begin, chunk);
  2805. }
  2806. if (this.stream.isDataLoaded) {
  2807. this._loadedStreamCapability.resolve(this.stream);
  2808. }
  2809. const loadedRequests = [];
  2810. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2811. const requestIds = this._requestsByChunk.get(curChunk);
  2812. if (!requestIds) {
  2813. continue;
  2814. }
  2815. this._requestsByChunk.delete(curChunk);
  2816. for (const requestId of requestIds) {
  2817. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2818. if (chunksNeeded.has(curChunk)) {
  2819. chunksNeeded.delete(curChunk);
  2820. }
  2821. if (chunksNeeded.size > 0) {
  2822. continue;
  2823. }
  2824. loadedRequests.push(requestId);
  2825. }
  2826. }
  2827. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2828. let nextEmptyChunk;
  2829. if (this.stream.numChunksLoaded === 1) {
  2830. const lastChunk = this.stream.numChunks - 1;
  2831. if (!this.stream.hasChunk(lastChunk)) {
  2832. nextEmptyChunk = lastChunk;
  2833. }
  2834. } else {
  2835. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2836. }
  2837. if (Number.isInteger(nextEmptyChunk)) {
  2838. this._requestChunks([nextEmptyChunk]);
  2839. }
  2840. }
  2841. for (const requestId of loadedRequests) {
  2842. const capability = this._promisesByRequest.get(requestId);
  2843. this._promisesByRequest.delete(requestId);
  2844. capability.resolve();
  2845. }
  2846. this.msgHandler.send("DocProgress", {
  2847. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2848. total: this.length
  2849. });
  2850. }
  2851. onError(err) {
  2852. this._loadedStreamCapability.reject(err);
  2853. }
  2854. getBeginChunk(begin) {
  2855. return Math.floor(begin / this.chunkSize);
  2856. }
  2857. getEndChunk(end) {
  2858. return Math.floor((end - 1) / this.chunkSize) + 1;
  2859. }
  2860. abort(reason) {
  2861. this.aborted = true;
  2862. if (this.pdfNetworkStream) {
  2863. this.pdfNetworkStream.cancelAllRequests(reason);
  2864. }
  2865. for (const capability of this._promisesByRequest.values()) {
  2866. capability.reject(reason);
  2867. }
  2868. }
  2869. }
  2870. exports.ChunkedStreamManager = ChunkedStreamManager;
  2871. /***/ }),
  2872. /* 8 */
  2873. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2874. Object.defineProperty(exports, "__esModule", ({
  2875. value: true
  2876. }));
  2877. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2878. var _base_stream = __w_pdfjs_require__(5);
  2879. var _util = __w_pdfjs_require__(2);
  2880. class Stream extends _base_stream.BaseStream {
  2881. constructor(arrayBuffer, start, length, dict) {
  2882. super();
  2883. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2884. this.start = start || 0;
  2885. this.pos = this.start;
  2886. this.end = start + length || this.bytes.length;
  2887. this.dict = dict;
  2888. }
  2889. get length() {
  2890. return this.end - this.start;
  2891. }
  2892. get isEmpty() {
  2893. return this.length === 0;
  2894. }
  2895. getByte() {
  2896. if (this.pos >= this.end) {
  2897. return -1;
  2898. }
  2899. return this.bytes[this.pos++];
  2900. }
  2901. getBytes(length) {
  2902. const bytes = this.bytes;
  2903. const pos = this.pos;
  2904. const strEnd = this.end;
  2905. if (!length) {
  2906. return bytes.subarray(pos, strEnd);
  2907. }
  2908. let end = pos + length;
  2909. if (end > strEnd) {
  2910. end = strEnd;
  2911. }
  2912. this.pos = end;
  2913. return bytes.subarray(pos, end);
  2914. }
  2915. getByteRange(begin, end) {
  2916. if (begin < 0) {
  2917. begin = 0;
  2918. }
  2919. if (end > this.end) {
  2920. end = this.end;
  2921. }
  2922. return this.bytes.subarray(begin, end);
  2923. }
  2924. reset() {
  2925. this.pos = this.start;
  2926. }
  2927. moveStart() {
  2928. this.start = this.pos;
  2929. }
  2930. makeSubStream(start, length, dict = null) {
  2931. return new Stream(this.bytes.buffer, start, length, dict);
  2932. }
  2933. }
  2934. exports.Stream = Stream;
  2935. class StringStream extends Stream {
  2936. constructor(str) {
  2937. super((0, _util.stringToBytes)(str));
  2938. }
  2939. }
  2940. exports.StringStream = StringStream;
  2941. class NullStream extends Stream {
  2942. constructor() {
  2943. super(new Uint8Array(0));
  2944. }
  2945. }
  2946. exports.NullStream = NullStream;
  2947. /***/ }),
  2948. /* 9 */
  2949. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2950. Object.defineProperty(exports, "__esModule", ({
  2951. value: true
  2952. }));
  2953. exports.Page = exports.PDFDocument = void 0;
  2954. var _annotation = __w_pdfjs_require__(10);
  2955. var _util = __w_pdfjs_require__(2);
  2956. var _core_utils = __w_pdfjs_require__(4);
  2957. var _primitives = __w_pdfjs_require__(3);
  2958. var _xfa_fonts = __w_pdfjs_require__(49);
  2959. var _base_stream = __w_pdfjs_require__(5);
  2960. var _crypto = __w_pdfjs_require__(65);
  2961. var _catalog = __w_pdfjs_require__(67);
  2962. var _cleanup_helper = __w_pdfjs_require__(69);
  2963. var _dataset_reader = __w_pdfjs_require__(98);
  2964. var _parser = __w_pdfjs_require__(15);
  2965. var _stream = __w_pdfjs_require__(8);
  2966. var _object_loader = __w_pdfjs_require__(73);
  2967. var _operator_list = __w_pdfjs_require__(60);
  2968. var _evaluator = __w_pdfjs_require__(13);
  2969. var _decode_stream = __w_pdfjs_require__(17);
  2970. var _struct_tree = __w_pdfjs_require__(72);
  2971. var _writer = __w_pdfjs_require__(63);
  2972. var _factory = __w_pdfjs_require__(74);
  2973. var _xref = __w_pdfjs_require__(99);
  2974. const DEFAULT_USER_UNIT = 1.0;
  2975. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2976. class Page {
  2977. constructor({
  2978. pdfManager,
  2979. xref,
  2980. pageIndex,
  2981. pageDict,
  2982. ref,
  2983. globalIdFactory,
  2984. fontCache,
  2985. builtInCMapCache,
  2986. standardFontDataCache,
  2987. globalImageCache,
  2988. nonBlendModesSet,
  2989. xfaFactory
  2990. }) {
  2991. this.pdfManager = pdfManager;
  2992. this.pageIndex = pageIndex;
  2993. this.pageDict = pageDict;
  2994. this.xref = xref;
  2995. this.ref = ref;
  2996. this.fontCache = fontCache;
  2997. this.builtInCMapCache = builtInCMapCache;
  2998. this.standardFontDataCache = standardFontDataCache;
  2999. this.globalImageCache = globalImageCache;
  3000. this.nonBlendModesSet = nonBlendModesSet;
  3001. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3002. this.resourcesPromise = null;
  3003. this.xfaFactory = xfaFactory;
  3004. const idCounters = {
  3005. obj: 0
  3006. };
  3007. this._localIdFactory = class extends globalIdFactory {
  3008. static createObjId() {
  3009. return `p${pageIndex}_${++idCounters.obj}`;
  3010. }
  3011. static getPageObjId() {
  3012. return `page${ref.toString()}`;
  3013. }
  3014. };
  3015. }
  3016. _getInheritableProperty(key, getArray = false) {
  3017. const value = (0, _core_utils.getInheritableProperty)({
  3018. dict: this.pageDict,
  3019. key,
  3020. getArray,
  3021. stopWhenFound: false
  3022. });
  3023. if (!Array.isArray(value)) {
  3024. return value;
  3025. }
  3026. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3027. return value[0];
  3028. }
  3029. return _primitives.Dict.merge({
  3030. xref: this.xref,
  3031. dictArray: value
  3032. });
  3033. }
  3034. get content() {
  3035. return this.pageDict.getArray("Contents");
  3036. }
  3037. get resources() {
  3038. const resources = this._getInheritableProperty("Resources");
  3039. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3040. }
  3041. _getBoundingBox(name) {
  3042. if (this.xfaData) {
  3043. return this.xfaData.bbox;
  3044. }
  3045. const box = this._getInheritableProperty(name, true);
  3046. if (Array.isArray(box) && box.length === 4) {
  3047. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3048. return box;
  3049. }
  3050. (0, _util.warn)(`Empty /${name} entry.`);
  3051. }
  3052. return null;
  3053. }
  3054. get mediaBox() {
  3055. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3056. }
  3057. get cropBox() {
  3058. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3059. }
  3060. get userUnit() {
  3061. let obj = this.pageDict.get("UserUnit");
  3062. if (typeof obj !== "number" || obj <= 0) {
  3063. obj = DEFAULT_USER_UNIT;
  3064. }
  3065. return (0, _util.shadow)(this, "userUnit", obj);
  3066. }
  3067. get view() {
  3068. const {
  3069. cropBox,
  3070. mediaBox
  3071. } = this;
  3072. let view;
  3073. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3074. view = mediaBox;
  3075. } else {
  3076. const box = _util.Util.intersect(cropBox, mediaBox);
  3077. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3078. view = box;
  3079. } else {
  3080. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3081. }
  3082. }
  3083. return (0, _util.shadow)(this, "view", view || mediaBox);
  3084. }
  3085. get rotate() {
  3086. let rotate = this._getInheritableProperty("Rotate") || 0;
  3087. if (rotate % 90 !== 0) {
  3088. rotate = 0;
  3089. } else if (rotate >= 360) {
  3090. rotate %= 360;
  3091. } else if (rotate < 0) {
  3092. rotate = (rotate % 360 + 360) % 360;
  3093. }
  3094. return (0, _util.shadow)(this, "rotate", rotate);
  3095. }
  3096. _onSubStreamError(handler, reason, objId) {
  3097. if (this.evaluatorOptions.ignoreErrors) {
  3098. handler.send("UnsupportedFeature", {
  3099. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3100. });
  3101. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3102. return;
  3103. }
  3104. throw reason;
  3105. }
  3106. getContentStream(handler) {
  3107. return this.pdfManager.ensure(this, "content").then(content => {
  3108. if (content instanceof _base_stream.BaseStream) {
  3109. return content;
  3110. }
  3111. if (Array.isArray(content)) {
  3112. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3113. }
  3114. return new _stream.NullStream();
  3115. });
  3116. }
  3117. get xfaData() {
  3118. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3119. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3120. } : null);
  3121. }
  3122. async saveNewAnnotations(handler, task, annotations) {
  3123. if (this.xfaFactory) {
  3124. throw new Error("XFA: Cannot save new annotations.");
  3125. }
  3126. const partialEvaluator = new _evaluator.PartialEvaluator({
  3127. xref: this.xref,
  3128. handler,
  3129. pageIndex: this.pageIndex,
  3130. idFactory: this._localIdFactory,
  3131. fontCache: this.fontCache,
  3132. builtInCMapCache: this.builtInCMapCache,
  3133. standardFontDataCache: this.standardFontDataCache,
  3134. globalImageCache: this.globalImageCache,
  3135. options: this.evaluatorOptions
  3136. });
  3137. const pageDict = this.pageDict;
  3138. const annotationsArray = this.annotations.slice();
  3139. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3140. for (const {
  3141. ref
  3142. } of newData.annotations) {
  3143. annotationsArray.push(ref);
  3144. }
  3145. const savedDict = pageDict.get("Annots");
  3146. pageDict.set("Annots", annotationsArray);
  3147. const buffer = [];
  3148. let transform = null;
  3149. if (this.xref.encrypt) {
  3150. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3151. }
  3152. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3153. if (savedDict) {
  3154. pageDict.set("Annots", savedDict);
  3155. }
  3156. const objects = newData.dependencies;
  3157. objects.push({
  3158. ref: this.ref,
  3159. data: buffer.join("")
  3160. }, ...newData.annotations);
  3161. return objects;
  3162. }
  3163. save(handler, task, annotationStorage) {
  3164. const partialEvaluator = new _evaluator.PartialEvaluator({
  3165. xref: this.xref,
  3166. handler,
  3167. pageIndex: this.pageIndex,
  3168. idFactory: this._localIdFactory,
  3169. fontCache: this.fontCache,
  3170. builtInCMapCache: this.builtInCMapCache,
  3171. standardFontDataCache: this.standardFontDataCache,
  3172. globalImageCache: this.globalImageCache,
  3173. options: this.evaluatorOptions
  3174. });
  3175. return this._parsedAnnotations.then(function (annotations) {
  3176. const newRefsPromises = [];
  3177. for (const annotation of annotations) {
  3178. if (!annotation.mustBePrinted(annotationStorage)) {
  3179. continue;
  3180. }
  3181. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3182. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3183. return null;
  3184. }));
  3185. }
  3186. return Promise.all(newRefsPromises).then(function (newRefs) {
  3187. return newRefs.filter(newRef => !!newRef);
  3188. });
  3189. });
  3190. }
  3191. loadResources(keys) {
  3192. if (!this.resourcesPromise) {
  3193. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3194. }
  3195. return this.resourcesPromise.then(() => {
  3196. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3197. return objectLoader.load();
  3198. });
  3199. }
  3200. getOperatorList({
  3201. handler,
  3202. sink,
  3203. task,
  3204. intent,
  3205. cacheKey,
  3206. annotationStorage = null
  3207. }) {
  3208. const contentStreamPromise = this.getContentStream(handler);
  3209. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3210. const partialEvaluator = new _evaluator.PartialEvaluator({
  3211. xref: this.xref,
  3212. handler,
  3213. pageIndex: this.pageIndex,
  3214. idFactory: this._localIdFactory,
  3215. fontCache: this.fontCache,
  3216. builtInCMapCache: this.builtInCMapCache,
  3217. standardFontDataCache: this.standardFontDataCache,
  3218. globalImageCache: this.globalImageCache,
  3219. options: this.evaluatorOptions
  3220. });
  3221. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3222. let newAnnotationsPromise = Promise.resolve(null);
  3223. if (newAnnotationsByPage) {
  3224. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3225. if (newAnnotations) {
  3226. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3227. }
  3228. }
  3229. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3230. const pageListPromise = dataPromises.then(([contentStream]) => {
  3231. const opList = new _operator_list.OperatorList(intent, sink);
  3232. handler.send("StartRenderPage", {
  3233. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3234. pageIndex: this.pageIndex,
  3235. cacheKey
  3236. });
  3237. return partialEvaluator.getOperatorList({
  3238. stream: contentStream,
  3239. task,
  3240. resources: this.resources,
  3241. operatorList: opList
  3242. }).then(function () {
  3243. return opList;
  3244. });
  3245. });
  3246. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3247. if (newAnnotations) {
  3248. annotations = annotations.concat(newAnnotations);
  3249. }
  3250. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3251. pageOpList.flush(true);
  3252. return {
  3253. length: pageOpList.totalLength
  3254. };
  3255. }
  3256. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3257. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3258. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3259. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3260. const opListPromises = [];
  3261. for (const annotation of annotations) {
  3262. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3263. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3264. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3265. return {
  3266. opList: null,
  3267. separateForm: false,
  3268. separateCanvas: false
  3269. };
  3270. }));
  3271. }
  3272. }
  3273. return Promise.all(opListPromises).then(function (opLists) {
  3274. let form = false,
  3275. canvas = false;
  3276. for (const {
  3277. opList,
  3278. separateForm,
  3279. separateCanvas
  3280. } of opLists) {
  3281. pageOpList.addOpList(opList);
  3282. if (separateForm) {
  3283. form = separateForm;
  3284. }
  3285. if (separateCanvas) {
  3286. canvas = separateCanvas;
  3287. }
  3288. }
  3289. pageOpList.flush(true, {
  3290. form,
  3291. canvas
  3292. });
  3293. return {
  3294. length: pageOpList.totalLength
  3295. };
  3296. });
  3297. });
  3298. }
  3299. extractTextContent({
  3300. handler,
  3301. task,
  3302. includeMarkedContent,
  3303. sink,
  3304. combineTextItems
  3305. }) {
  3306. const contentStreamPromise = this.getContentStream(handler);
  3307. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3308. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3309. return dataPromises.then(([contentStream]) => {
  3310. const partialEvaluator = new _evaluator.PartialEvaluator({
  3311. xref: this.xref,
  3312. handler,
  3313. pageIndex: this.pageIndex,
  3314. idFactory: this._localIdFactory,
  3315. fontCache: this.fontCache,
  3316. builtInCMapCache: this.builtInCMapCache,
  3317. standardFontDataCache: this.standardFontDataCache,
  3318. globalImageCache: this.globalImageCache,
  3319. options: this.evaluatorOptions
  3320. });
  3321. return partialEvaluator.getTextContent({
  3322. stream: contentStream,
  3323. task,
  3324. resources: this.resources,
  3325. includeMarkedContent,
  3326. combineTextItems,
  3327. sink,
  3328. viewBox: this.view
  3329. });
  3330. });
  3331. }
  3332. async getStructTree() {
  3333. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3334. if (!structTreeRoot) {
  3335. return null;
  3336. }
  3337. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3338. return structTree.serializable;
  3339. }
  3340. _parseStructTree(structTreeRoot) {
  3341. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3342. tree.parse();
  3343. return tree;
  3344. }
  3345. async getAnnotationsData(handler, task, intent) {
  3346. const annotations = await this._parsedAnnotations;
  3347. if (annotations.length === 0) {
  3348. return [];
  3349. }
  3350. const textContentPromises = [];
  3351. const annotationsData = [];
  3352. let partialEvaluator;
  3353. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3354. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3355. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3356. for (const annotation of annotations) {
  3357. const isVisible = intentAny || intentDisplay && annotation.viewable;
  3358. if (isVisible || intentPrint && annotation.printable) {
  3359. annotationsData.push(annotation.data);
  3360. }
  3361. if (annotation.hasTextContent && isVisible) {
  3362. if (!partialEvaluator) {
  3363. partialEvaluator = new _evaluator.PartialEvaluator({
  3364. xref: this.xref,
  3365. handler,
  3366. pageIndex: this.pageIndex,
  3367. idFactory: this._localIdFactory,
  3368. fontCache: this.fontCache,
  3369. builtInCMapCache: this.builtInCMapCache,
  3370. standardFontDataCache: this.standardFontDataCache,
  3371. globalImageCache: this.globalImageCache,
  3372. options: this.evaluatorOptions
  3373. });
  3374. }
  3375. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  3376. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3377. }));
  3378. }
  3379. }
  3380. await Promise.all(textContentPromises);
  3381. return annotationsData;
  3382. }
  3383. get annotations() {
  3384. const annots = this._getInheritableProperty("Annots");
  3385. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3386. }
  3387. get _parsedAnnotations() {
  3388. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3389. const annotationPromises = [];
  3390. for (const annotationRef of this.annotations) {
  3391. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3392. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3393. return null;
  3394. }));
  3395. }
  3396. return Promise.all(annotationPromises).then(function (annotations) {
  3397. if (annotations.length === 0) {
  3398. return annotations;
  3399. }
  3400. const sortedAnnotations = [];
  3401. let popupAnnotations;
  3402. for (const annotation of annotations) {
  3403. if (!annotation) {
  3404. continue;
  3405. }
  3406. if (annotation instanceof _annotation.PopupAnnotation) {
  3407. if (!popupAnnotations) {
  3408. popupAnnotations = [];
  3409. }
  3410. popupAnnotations.push(annotation);
  3411. continue;
  3412. }
  3413. sortedAnnotations.push(annotation);
  3414. }
  3415. if (popupAnnotations) {
  3416. sortedAnnotations.push(...popupAnnotations);
  3417. }
  3418. return sortedAnnotations;
  3419. });
  3420. });
  3421. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3422. }
  3423. get jsActions() {
  3424. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3425. return (0, _util.shadow)(this, "jsActions", actions);
  3426. }
  3427. }
  3428. exports.Page = Page;
  3429. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3430. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3431. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3432. const FINGERPRINT_FIRST_BYTES = 1024;
  3433. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3434. function find(stream, signature, limit = 1024, backwards = false) {
  3435. const signatureLength = signature.length;
  3436. const scanBytes = stream.peekBytes(limit);
  3437. const scanLength = scanBytes.length - signatureLength;
  3438. if (scanLength <= 0) {
  3439. return false;
  3440. }
  3441. if (backwards) {
  3442. const signatureEnd = signatureLength - 1;
  3443. let pos = scanBytes.length - 1;
  3444. while (pos >= signatureEnd) {
  3445. let j = 0;
  3446. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3447. j++;
  3448. }
  3449. if (j >= signatureLength) {
  3450. stream.pos += pos - signatureEnd;
  3451. return true;
  3452. }
  3453. pos--;
  3454. }
  3455. } else {
  3456. let pos = 0;
  3457. while (pos <= scanLength) {
  3458. let j = 0;
  3459. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3460. j++;
  3461. }
  3462. if (j >= signatureLength) {
  3463. stream.pos += pos;
  3464. return true;
  3465. }
  3466. pos++;
  3467. }
  3468. }
  3469. return false;
  3470. }
  3471. class PDFDocument {
  3472. constructor(pdfManager, stream) {
  3473. if (stream.length <= 0) {
  3474. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3475. }
  3476. this.pdfManager = pdfManager;
  3477. this.stream = stream;
  3478. this.xref = new _xref.XRef(stream, pdfManager);
  3479. this._pagePromises = new Map();
  3480. this._version = null;
  3481. const idCounters = {
  3482. font: 0
  3483. };
  3484. this._globalIdFactory = class {
  3485. static getDocId() {
  3486. return `g_${pdfManager.docId}`;
  3487. }
  3488. static createFontId() {
  3489. return `f${++idCounters.font}`;
  3490. }
  3491. static createObjId() {
  3492. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3493. }
  3494. static getPageObjId() {
  3495. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3496. }
  3497. };
  3498. }
  3499. parse(recoveryMode) {
  3500. this.xref.parse(recoveryMode);
  3501. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3502. }
  3503. get linearization() {
  3504. let linearization = null;
  3505. try {
  3506. linearization = _parser.Linearization.create(this.stream);
  3507. } catch (err) {
  3508. if (err instanceof _core_utils.MissingDataException) {
  3509. throw err;
  3510. }
  3511. (0, _util.info)(err);
  3512. }
  3513. return (0, _util.shadow)(this, "linearization", linearization);
  3514. }
  3515. get startXRef() {
  3516. const stream = this.stream;
  3517. let startXRef = 0;
  3518. if (this.linearization) {
  3519. stream.reset();
  3520. if (find(stream, ENDOBJ_SIGNATURE)) {
  3521. startXRef = stream.pos + 6 - stream.start;
  3522. }
  3523. } else {
  3524. const step = 1024;
  3525. const startXRefLength = STARTXREF_SIGNATURE.length;
  3526. let found = false,
  3527. pos = stream.end;
  3528. while (!found && pos > 0) {
  3529. pos -= step - startXRefLength;
  3530. if (pos < 0) {
  3531. pos = 0;
  3532. }
  3533. stream.pos = pos;
  3534. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3535. }
  3536. if (found) {
  3537. stream.skip(9);
  3538. let ch;
  3539. do {
  3540. ch = stream.getByte();
  3541. } while ((0, _core_utils.isWhiteSpace)(ch));
  3542. let str = "";
  3543. while (ch >= 0x20 && ch <= 0x39) {
  3544. str += String.fromCharCode(ch);
  3545. ch = stream.getByte();
  3546. }
  3547. startXRef = parseInt(str, 10);
  3548. if (isNaN(startXRef)) {
  3549. startXRef = 0;
  3550. }
  3551. }
  3552. }
  3553. return (0, _util.shadow)(this, "startXRef", startXRef);
  3554. }
  3555. checkHeader() {
  3556. const stream = this.stream;
  3557. stream.reset();
  3558. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3559. return;
  3560. }
  3561. stream.moveStart();
  3562. stream.skip(PDF_HEADER_SIGNATURE.length);
  3563. let version = "",
  3564. ch;
  3565. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  3566. version += String.fromCharCode(ch);
  3567. }
  3568. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  3569. this._version = version;
  3570. } else {
  3571. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  3572. }
  3573. }
  3574. parseStartXRef() {
  3575. this.xref.setStartXRef(this.startXRef);
  3576. }
  3577. get numPages() {
  3578. let num = 0;
  3579. if (this.catalog.hasActualNumPages) {
  3580. num = this.catalog.numPages;
  3581. } else if (this.xfaFactory) {
  3582. num = this.xfaFactory.getNumPages();
  3583. } else if (this.linearization) {
  3584. num = this.linearization.numPages;
  3585. } else {
  3586. num = this.catalog.numPages;
  3587. }
  3588. return (0, _util.shadow)(this, "numPages", num);
  3589. }
  3590. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3591. const RECURSION_LIMIT = 10;
  3592. if (!Array.isArray(fields)) {
  3593. return false;
  3594. }
  3595. return fields.every(field => {
  3596. field = this.xref.fetchIfRef(field);
  3597. if (!(field instanceof _primitives.Dict)) {
  3598. return false;
  3599. }
  3600. if (field.has("Kids")) {
  3601. if (++recursionDepth > RECURSION_LIMIT) {
  3602. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3603. return false;
  3604. }
  3605. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3606. }
  3607. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3608. const rectangle = field.get("Rect");
  3609. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3610. return isSignature && isInvisible;
  3611. });
  3612. }
  3613. get _xfaStreams() {
  3614. const acroForm = this.catalog.acroForm;
  3615. if (!acroForm) {
  3616. return null;
  3617. }
  3618. const xfa = acroForm.get("XFA");
  3619. const entries = {
  3620. "xdp:xdp": "",
  3621. template: "",
  3622. datasets: "",
  3623. config: "",
  3624. connectionSet: "",
  3625. localeSet: "",
  3626. stylesheet: "",
  3627. "/xdp:xdp": ""
  3628. };
  3629. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3630. entries["xdp:xdp"] = xfa;
  3631. return entries;
  3632. }
  3633. if (!Array.isArray(xfa) || xfa.length === 0) {
  3634. return null;
  3635. }
  3636. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3637. let name;
  3638. if (i === 0) {
  3639. name = "xdp:xdp";
  3640. } else if (i === ii - 2) {
  3641. name = "/xdp:xdp";
  3642. } else {
  3643. name = xfa[i];
  3644. }
  3645. if (!entries.hasOwnProperty(name)) {
  3646. continue;
  3647. }
  3648. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3649. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3650. continue;
  3651. }
  3652. entries[name] = data;
  3653. }
  3654. return entries;
  3655. }
  3656. get xfaDatasets() {
  3657. const streams = this._xfaStreams;
  3658. if (!streams) {
  3659. return (0, _util.shadow)(this, "xfaDatasets", null);
  3660. }
  3661. for (const key of ["datasets", "xdp:xdp"]) {
  3662. const stream = streams[key];
  3663. if (!stream) {
  3664. continue;
  3665. }
  3666. try {
  3667. const str = (0, _util.stringToUTF8String)(stream.getString());
  3668. const data = {
  3669. [key]: str
  3670. };
  3671. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3672. } catch (_) {
  3673. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3674. break;
  3675. }
  3676. }
  3677. return (0, _util.shadow)(this, "xfaDatasets", null);
  3678. }
  3679. get xfaData() {
  3680. const streams = this._xfaStreams;
  3681. if (!streams) {
  3682. return null;
  3683. }
  3684. const data = Object.create(null);
  3685. for (const [key, stream] of Object.entries(streams)) {
  3686. if (!stream) {
  3687. continue;
  3688. }
  3689. try {
  3690. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3691. } catch (_) {
  3692. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3693. return null;
  3694. }
  3695. }
  3696. return data;
  3697. }
  3698. get xfaFactory() {
  3699. let data;
  3700. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3701. data = this.xfaData;
  3702. }
  3703. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3704. }
  3705. get isPureXfa() {
  3706. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3707. }
  3708. get htmlForXfa() {
  3709. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3710. }
  3711. async loadXfaImages() {
  3712. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3713. if (!xfaImagesDict) {
  3714. return;
  3715. }
  3716. const keys = xfaImagesDict.getKeys();
  3717. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3718. await objectLoader.load();
  3719. const xfaImages = new Map();
  3720. for (const key of keys) {
  3721. const stream = xfaImagesDict.get(key);
  3722. if (stream instanceof _base_stream.BaseStream) {
  3723. xfaImages.set(key, stream.getBytes());
  3724. }
  3725. }
  3726. this.xfaFactory.setImages(xfaImages);
  3727. }
  3728. async loadXfaFonts(handler, task) {
  3729. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3730. if (!acroForm) {
  3731. return;
  3732. }
  3733. const resources = await acroForm.getAsync("DR");
  3734. if (!(resources instanceof _primitives.Dict)) {
  3735. return;
  3736. }
  3737. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3738. await objectLoader.load();
  3739. const fontRes = resources.get("Font");
  3740. if (!(fontRes instanceof _primitives.Dict)) {
  3741. return;
  3742. }
  3743. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3744. options.useSystemFonts = false;
  3745. const partialEvaluator = new _evaluator.PartialEvaluator({
  3746. xref: this.xref,
  3747. handler,
  3748. pageIndex: -1,
  3749. idFactory: this._globalIdFactory,
  3750. fontCache: this.catalog.fontCache,
  3751. builtInCMapCache: this.catalog.builtInCMapCache,
  3752. standardFontDataCache: this.catalog.standardFontDataCache,
  3753. options
  3754. });
  3755. const operatorList = new _operator_list.OperatorList();
  3756. const pdfFonts = [];
  3757. const initialState = {
  3758. get font() {
  3759. return pdfFonts.at(-1);
  3760. },
  3761. set font(font) {
  3762. pdfFonts.push(font);
  3763. },
  3764. clone() {
  3765. return this;
  3766. }
  3767. };
  3768. const fonts = new Map();
  3769. fontRes.forEach((fontName, font) => {
  3770. fonts.set(fontName, font);
  3771. });
  3772. const promises = [];
  3773. for (const [fontName, font] of fonts) {
  3774. const descriptor = font.get("FontDescriptor");
  3775. if (!(descriptor instanceof _primitives.Dict)) {
  3776. continue;
  3777. }
  3778. let fontFamily = descriptor.get("FontFamily");
  3779. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3780. const fontWeight = descriptor.get("FontWeight");
  3781. const italicAngle = -descriptor.get("ItalicAngle");
  3782. const cssFontInfo = {
  3783. fontFamily,
  3784. fontWeight,
  3785. italicAngle
  3786. };
  3787. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3788. continue;
  3789. }
  3790. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3791. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3792. return null;
  3793. }));
  3794. }
  3795. await Promise.all(promises);
  3796. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3797. if (!missingFonts) {
  3798. return;
  3799. }
  3800. options.ignoreErrors = true;
  3801. promises.length = 0;
  3802. pdfFonts.length = 0;
  3803. const reallyMissingFonts = new Set();
  3804. for (const missing of missingFonts) {
  3805. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3806. reallyMissingFonts.add(missing);
  3807. }
  3808. }
  3809. if (reallyMissingFonts.size) {
  3810. missingFonts.push("PdfJS-Fallback");
  3811. }
  3812. for (const missing of missingFonts) {
  3813. if (reallyMissingFonts.has(missing)) {
  3814. continue;
  3815. }
  3816. for (const fontInfo of [{
  3817. name: "Regular",
  3818. fontWeight: 400,
  3819. italicAngle: 0
  3820. }, {
  3821. name: "Bold",
  3822. fontWeight: 700,
  3823. italicAngle: 0
  3824. }, {
  3825. name: "Italic",
  3826. fontWeight: 400,
  3827. italicAngle: 12
  3828. }, {
  3829. name: "BoldItalic",
  3830. fontWeight: 700,
  3831. italicAngle: 12
  3832. }]) {
  3833. const name = `${missing}-${fontInfo.name}`;
  3834. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3835. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3836. fontFamily: missing,
  3837. fontWeight: fontInfo.fontWeight,
  3838. italicAngle: fontInfo.italicAngle
  3839. }).catch(function (reason) {
  3840. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3841. return null;
  3842. }));
  3843. }
  3844. }
  3845. await Promise.all(promises);
  3846. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3847. }
  3848. async serializeXfaData(annotationStorage) {
  3849. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3850. }
  3851. get version() {
  3852. return this.catalog.version || this._version;
  3853. }
  3854. get formInfo() {
  3855. const formInfo = {
  3856. hasFields: false,
  3857. hasAcroForm: false,
  3858. hasXfa: false,
  3859. hasSignatures: false
  3860. };
  3861. const acroForm = this.catalog.acroForm;
  3862. if (!acroForm) {
  3863. return (0, _util.shadow)(this, "formInfo", formInfo);
  3864. }
  3865. try {
  3866. const fields = acroForm.get("Fields");
  3867. const hasFields = Array.isArray(fields) && fields.length > 0;
  3868. formInfo.hasFields = hasFields;
  3869. const xfa = acroForm.get("XFA");
  3870. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3871. const sigFlags = acroForm.get("SigFlags");
  3872. const hasSignatures = !!(sigFlags & 0x1);
  3873. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3874. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3875. formInfo.hasSignatures = hasSignatures;
  3876. } catch (ex) {
  3877. if (ex instanceof _core_utils.MissingDataException) {
  3878. throw ex;
  3879. }
  3880. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3881. }
  3882. return (0, _util.shadow)(this, "formInfo", formInfo);
  3883. }
  3884. get documentInfo() {
  3885. const docInfo = {
  3886. PDFFormatVersion: this.version,
  3887. Language: this.catalog.lang,
  3888. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3889. IsLinearized: !!this.linearization,
  3890. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3891. IsXFAPresent: this.formInfo.hasXfa,
  3892. IsCollectionPresent: !!this.catalog.collection,
  3893. IsSignaturesPresent: this.formInfo.hasSignatures
  3894. };
  3895. let infoDict;
  3896. try {
  3897. infoDict = this.xref.trailer.get("Info");
  3898. } catch (err) {
  3899. if (err instanceof _core_utils.MissingDataException) {
  3900. throw err;
  3901. }
  3902. (0, _util.info)("The document information dictionary is invalid.");
  3903. }
  3904. if (!(infoDict instanceof _primitives.Dict)) {
  3905. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3906. }
  3907. for (const key of infoDict.getKeys()) {
  3908. const value = infoDict.get(key);
  3909. switch (key) {
  3910. case "Title":
  3911. case "Author":
  3912. case "Subject":
  3913. case "Keywords":
  3914. case "Creator":
  3915. case "Producer":
  3916. case "CreationDate":
  3917. case "ModDate":
  3918. if (typeof value === "string") {
  3919. docInfo[key] = (0, _util.stringToPDFString)(value);
  3920. continue;
  3921. }
  3922. break;
  3923. case "Trapped":
  3924. if (value instanceof _primitives.Name) {
  3925. docInfo[key] = value;
  3926. continue;
  3927. }
  3928. break;
  3929. default:
  3930. let customValue;
  3931. switch (typeof value) {
  3932. case "string":
  3933. customValue = (0, _util.stringToPDFString)(value);
  3934. break;
  3935. case "number":
  3936. case "boolean":
  3937. customValue = value;
  3938. break;
  3939. default:
  3940. if (value instanceof _primitives.Name) {
  3941. customValue = value;
  3942. }
  3943. break;
  3944. }
  3945. if (customValue === undefined) {
  3946. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3947. continue;
  3948. }
  3949. if (!docInfo.Custom) {
  3950. docInfo.Custom = Object.create(null);
  3951. }
  3952. docInfo.Custom[key] = customValue;
  3953. continue;
  3954. }
  3955. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3956. }
  3957. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3958. }
  3959. get fingerprints() {
  3960. function validate(data) {
  3961. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3962. }
  3963. function hexString(hash) {
  3964. const buf = [];
  3965. for (const num of hash) {
  3966. const hex = num.toString(16);
  3967. buf.push(hex.padStart(2, "0"));
  3968. }
  3969. return buf.join("");
  3970. }
  3971. const idArray = this.xref.trailer.get("ID");
  3972. let hashOriginal, hashModified;
  3973. if (Array.isArray(idArray) && validate(idArray[0])) {
  3974. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3975. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3976. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3977. }
  3978. } else {
  3979. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3980. }
  3981. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3982. }
  3983. async _getLinearizationPage(pageIndex) {
  3984. const {
  3985. catalog,
  3986. linearization,
  3987. xref
  3988. } = this;
  3989. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3990. try {
  3991. const obj = await xref.fetchAsync(ref);
  3992. if (obj instanceof _primitives.Dict) {
  3993. let type = obj.getRaw("Type");
  3994. if (type instanceof _primitives.Ref) {
  3995. type = await xref.fetchAsync(type);
  3996. }
  3997. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3998. if (!catalog.pageKidsCountCache.has(ref)) {
  3999. catalog.pageKidsCountCache.put(ref, 1);
  4000. }
  4001. if (!catalog.pageIndexCache.has(ref)) {
  4002. catalog.pageIndexCache.put(ref, 0);
  4003. }
  4004. return [obj, ref];
  4005. }
  4006. }
  4007. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  4008. } catch (reason) {
  4009. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4010. return catalog.getPageDict(pageIndex);
  4011. }
  4012. }
  4013. getPage(pageIndex) {
  4014. const cachedPromise = this._pagePromises.get(pageIndex);
  4015. if (cachedPromise) {
  4016. return cachedPromise;
  4017. }
  4018. const {
  4019. catalog,
  4020. linearization,
  4021. xfaFactory
  4022. } = this;
  4023. let promise;
  4024. if (xfaFactory) {
  4025. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4026. } else if (linearization && linearization.pageFirst === pageIndex) {
  4027. promise = this._getLinearizationPage(pageIndex);
  4028. } else {
  4029. promise = catalog.getPageDict(pageIndex);
  4030. }
  4031. promise = promise.then(([pageDict, ref]) => {
  4032. return new Page({
  4033. pdfManager: this.pdfManager,
  4034. xref: this.xref,
  4035. pageIndex,
  4036. pageDict,
  4037. ref,
  4038. globalIdFactory: this._globalIdFactory,
  4039. fontCache: catalog.fontCache,
  4040. builtInCMapCache: catalog.builtInCMapCache,
  4041. standardFontDataCache: catalog.standardFontDataCache,
  4042. globalImageCache: catalog.globalImageCache,
  4043. nonBlendModesSet: catalog.nonBlendModesSet,
  4044. xfaFactory
  4045. });
  4046. });
  4047. this._pagePromises.set(pageIndex, promise);
  4048. return promise;
  4049. }
  4050. async checkFirstPage(recoveryMode = false) {
  4051. if (recoveryMode) {
  4052. return;
  4053. }
  4054. try {
  4055. await this.getPage(0);
  4056. } catch (reason) {
  4057. if (reason instanceof _core_utils.XRefEntryException) {
  4058. this._pagePromises.delete(0);
  4059. await this.cleanup();
  4060. throw new _core_utils.XRefParseException();
  4061. }
  4062. }
  4063. }
  4064. async checkLastPage(recoveryMode = false) {
  4065. const {
  4066. catalog,
  4067. pdfManager
  4068. } = this;
  4069. catalog.setActualNumPages();
  4070. let numPages;
  4071. try {
  4072. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4073. if (this.xfaFactory) {
  4074. return;
  4075. } else if (this.linearization) {
  4076. numPages = this.linearization.numPages;
  4077. } else {
  4078. numPages = catalog.numPages;
  4079. }
  4080. if (!Number.isInteger(numPages)) {
  4081. throw new _util.FormatError("Page count is not an integer.");
  4082. } else if (numPages <= 1) {
  4083. return;
  4084. }
  4085. await this.getPage(numPages - 1);
  4086. } catch (reason) {
  4087. this._pagePromises.delete(numPages - 1);
  4088. await this.cleanup();
  4089. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4090. throw new _core_utils.XRefParseException();
  4091. }
  4092. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4093. let pagesTree;
  4094. try {
  4095. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4096. } catch (reasonAll) {
  4097. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4098. throw new _core_utils.XRefParseException();
  4099. }
  4100. catalog.setActualNumPages(1);
  4101. return;
  4102. }
  4103. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4104. let promise;
  4105. if (pageDict instanceof Error) {
  4106. promise = Promise.reject(pageDict);
  4107. promise.catch(() => {});
  4108. } else {
  4109. promise = Promise.resolve(new Page({
  4110. pdfManager,
  4111. xref: this.xref,
  4112. pageIndex,
  4113. pageDict,
  4114. ref,
  4115. globalIdFactory: this._globalIdFactory,
  4116. fontCache: catalog.fontCache,
  4117. builtInCMapCache: catalog.builtInCMapCache,
  4118. standardFontDataCache: catalog.standardFontDataCache,
  4119. globalImageCache: catalog.globalImageCache,
  4120. nonBlendModesSet: catalog.nonBlendModesSet,
  4121. xfaFactory: null
  4122. }));
  4123. }
  4124. this._pagePromises.set(pageIndex, promise);
  4125. }
  4126. catalog.setActualNumPages(pagesTree.size);
  4127. }
  4128. }
  4129. fontFallback(id, handler) {
  4130. return this.catalog.fontFallback(id, handler);
  4131. }
  4132. async cleanup(manuallyTriggered = false) {
  4133. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4134. }
  4135. _collectFieldObjects(name, fieldRef, promises) {
  4136. const field = this.xref.fetchIfRef(fieldRef);
  4137. if (field.has("T")) {
  4138. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4139. if (name === "") {
  4140. name = partName;
  4141. } else {
  4142. name = `${name}.${partName}`;
  4143. }
  4144. }
  4145. if (!promises.has(name)) {
  4146. promises.set(name, []);
  4147. }
  4148. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4149. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4150. return null;
  4151. }));
  4152. if (field.has("Kids")) {
  4153. const kids = field.get("Kids");
  4154. for (const kid of kids) {
  4155. this._collectFieldObjects(name, kid, promises);
  4156. }
  4157. }
  4158. }
  4159. get fieldObjects() {
  4160. if (!this.formInfo.hasFields) {
  4161. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4162. }
  4163. const allFields = Object.create(null);
  4164. const fieldPromises = new Map();
  4165. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4166. this._collectFieldObjects("", fieldRef, fieldPromises);
  4167. }
  4168. const allPromises = [];
  4169. for (const [name, promises] of fieldPromises) {
  4170. allPromises.push(Promise.all(promises).then(fields => {
  4171. fields = fields.filter(field => !!field);
  4172. if (fields.length > 0) {
  4173. allFields[name] = fields;
  4174. }
  4175. }));
  4176. }
  4177. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4178. }
  4179. get hasJSActions() {
  4180. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4181. return (0, _util.shadow)(this, "hasJSActions", promise);
  4182. }
  4183. async _parseHasJSActions() {
  4184. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4185. if (catalogJsActions) {
  4186. return true;
  4187. }
  4188. if (fieldObjects) {
  4189. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4190. }
  4191. return false;
  4192. }
  4193. get calculationOrderIds() {
  4194. const acroForm = this.catalog.acroForm;
  4195. if (!acroForm || !acroForm.has("CO")) {
  4196. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4197. }
  4198. const calculationOrder = acroForm.get("CO");
  4199. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4200. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4201. }
  4202. const ids = [];
  4203. for (const id of calculationOrder) {
  4204. if (id instanceof _primitives.Ref) {
  4205. ids.push(id.toString());
  4206. }
  4207. }
  4208. if (ids.length === 0) {
  4209. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4210. }
  4211. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4212. }
  4213. }
  4214. exports.PDFDocument = PDFDocument;
  4215. /***/ }),
  4216. /* 10 */
  4217. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4218. Object.defineProperty(exports, "__esModule", ({
  4219. value: true
  4220. }));
  4221. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  4222. exports.getQuadPoints = getQuadPoints;
  4223. var _util = __w_pdfjs_require__(2);
  4224. var _core_utils = __w_pdfjs_require__(4);
  4225. var _default_appearance = __w_pdfjs_require__(11);
  4226. var _primitives = __w_pdfjs_require__(3);
  4227. var _writer = __w_pdfjs_require__(63);
  4228. var _base_stream = __w_pdfjs_require__(5);
  4229. var _bidi = __w_pdfjs_require__(58);
  4230. var _catalog = __w_pdfjs_require__(67);
  4231. var _colorspace = __w_pdfjs_require__(12);
  4232. var _file_spec = __w_pdfjs_require__(70);
  4233. var _object_loader = __w_pdfjs_require__(73);
  4234. var _operator_list = __w_pdfjs_require__(60);
  4235. var _stream = __w_pdfjs_require__(8);
  4236. var _factory = __w_pdfjs_require__(74);
  4237. class AnnotationFactory {
  4238. static create(xref, ref, pdfManager, idFactory, collectFields) {
  4239. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, attachments, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]));
  4240. }
  4241. static _create(xref, ref, pdfManager, idFactory, acroForm, attachments = null, xfaDatasets, collectFields, pageIndex = -1) {
  4242. const dict = xref.fetchIfRef(ref);
  4243. if (!(dict instanceof _primitives.Dict)) {
  4244. return undefined;
  4245. }
  4246. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  4247. let subtype = dict.get("Subtype");
  4248. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  4249. const parameters = {
  4250. xref,
  4251. ref,
  4252. dict,
  4253. subtype,
  4254. id,
  4255. pdfManager,
  4256. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  4257. attachments,
  4258. xfaDatasets,
  4259. collectFields,
  4260. pageIndex
  4261. };
  4262. switch (subtype) {
  4263. case "Link":
  4264. return new LinkAnnotation(parameters);
  4265. case "Text":
  4266. return new TextAnnotation(parameters);
  4267. case "Widget":
  4268. let fieldType = (0, _core_utils.getInheritableProperty)({
  4269. dict,
  4270. key: "FT"
  4271. });
  4272. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  4273. switch (fieldType) {
  4274. case "Tx":
  4275. return new TextWidgetAnnotation(parameters);
  4276. case "Btn":
  4277. return new ButtonWidgetAnnotation(parameters);
  4278. case "Ch":
  4279. return new ChoiceWidgetAnnotation(parameters);
  4280. case "Sig":
  4281. return new SignatureWidgetAnnotation(parameters);
  4282. }
  4283. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  4284. return new WidgetAnnotation(parameters);
  4285. case "Popup":
  4286. return new PopupAnnotation(parameters);
  4287. case "FreeText":
  4288. return new FreeTextAnnotation(parameters);
  4289. case "Line":
  4290. return new LineAnnotation(parameters);
  4291. case "Square":
  4292. return new SquareAnnotation(parameters);
  4293. case "Circle":
  4294. return new CircleAnnotation(parameters);
  4295. case "PolyLine":
  4296. return new PolylineAnnotation(parameters);
  4297. case "Polygon":
  4298. return new PolygonAnnotation(parameters);
  4299. case "Caret":
  4300. return new CaretAnnotation(parameters);
  4301. case "Ink":
  4302. return new InkAnnotation(parameters);
  4303. case "Highlight":
  4304. return new HighlightAnnotation(parameters);
  4305. case "Underline":
  4306. return new UnderlineAnnotation(parameters);
  4307. case "Squiggly":
  4308. return new SquigglyAnnotation(parameters);
  4309. case "StrikeOut":
  4310. return new StrikeOutAnnotation(parameters);
  4311. case "Stamp":
  4312. return new StampAnnotation(parameters);
  4313. case "FileAttachment":
  4314. return new FileAttachmentAnnotation(parameters);
  4315. default:
  4316. if (!collectFields) {
  4317. if (!subtype) {
  4318. (0, _util.warn)("Annotation is missing the required /Subtype.");
  4319. } else {
  4320. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  4321. }
  4322. }
  4323. return new Annotation(parameters);
  4324. }
  4325. }
  4326. static async _getPageIndex(xref, ref, pdfManager) {
  4327. try {
  4328. const annotDict = await xref.fetchIfRefAsync(ref);
  4329. if (!(annotDict instanceof _primitives.Dict)) {
  4330. return -1;
  4331. }
  4332. const pageRef = annotDict.getRaw("P");
  4333. if (!(pageRef instanceof _primitives.Ref)) {
  4334. return -1;
  4335. }
  4336. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  4337. return pageIndex;
  4338. } catch (ex) {
  4339. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  4340. return -1;
  4341. }
  4342. }
  4343. static async saveNewAnnotations(evaluator, task, annotations) {
  4344. const xref = evaluator.xref;
  4345. let baseFontRef;
  4346. const dependencies = [];
  4347. const promises = [];
  4348. for (const annotation of annotations) {
  4349. switch (annotation.annotationType) {
  4350. case _util.AnnotationEditorType.FREETEXT:
  4351. if (!baseFontRef) {
  4352. const baseFont = new _primitives.Dict(xref);
  4353. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  4354. baseFont.set("Type", _primitives.Name.get("Font"));
  4355. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  4356. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  4357. const buffer = [];
  4358. baseFontRef = xref.getNewRef();
  4359. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  4360. dependencies.push({
  4361. ref: baseFontRef,
  4362. data: buffer.join("")
  4363. });
  4364. }
  4365. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  4366. evaluator,
  4367. task,
  4368. baseFontRef
  4369. }));
  4370. break;
  4371. case _util.AnnotationEditorType.INK:
  4372. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  4373. }
  4374. }
  4375. return {
  4376. annotations: await Promise.all(promises),
  4377. dependencies
  4378. };
  4379. }
  4380. static async printNewAnnotations(evaluator, task, annotations) {
  4381. if (!annotations) {
  4382. return null;
  4383. }
  4384. const xref = evaluator.xref;
  4385. const promises = [];
  4386. for (const annotation of annotations) {
  4387. switch (annotation.annotationType) {
  4388. case _util.AnnotationEditorType.FREETEXT:
  4389. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  4390. evaluator,
  4391. task
  4392. }));
  4393. break;
  4394. case _util.AnnotationEditorType.INK:
  4395. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation));
  4396. break;
  4397. }
  4398. }
  4399. return Promise.all(promises);
  4400. }
  4401. }
  4402. exports.AnnotationFactory = AnnotationFactory;
  4403. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  4404. if (!Array.isArray(color)) {
  4405. return defaultColor;
  4406. }
  4407. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  4408. switch (color.length) {
  4409. case 0:
  4410. return null;
  4411. case 1:
  4412. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  4413. return rgbColor;
  4414. case 3:
  4415. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  4416. return rgbColor;
  4417. case 4:
  4418. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  4419. return rgbColor;
  4420. default:
  4421. return defaultColor;
  4422. }
  4423. }
  4424. function getQuadPoints(dict, rect) {
  4425. if (!dict.has("QuadPoints")) {
  4426. return null;
  4427. }
  4428. const quadPoints = dict.getArray("QuadPoints");
  4429. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  4430. return null;
  4431. }
  4432. const quadPointsLists = [];
  4433. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  4434. quadPointsLists.push([]);
  4435. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  4436. const x = quadPoints[j];
  4437. const y = quadPoints[j + 1];
  4438. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  4439. return null;
  4440. }
  4441. quadPointsLists[i].push({
  4442. x,
  4443. y
  4444. });
  4445. }
  4446. }
  4447. return quadPointsLists.map(quadPointsList => {
  4448. 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]);
  4449. return [{
  4450. x: minX,
  4451. y: maxY
  4452. }, {
  4453. x: maxX,
  4454. y: maxY
  4455. }, {
  4456. x: minX,
  4457. y: minY
  4458. }, {
  4459. x: maxX,
  4460. y: minY
  4461. }];
  4462. });
  4463. }
  4464. function getTransformMatrix(rect, bbox, matrix) {
  4465. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  4466. if (minX === maxX || minY === maxY) {
  4467. return [1, 0, 0, 1, rect[0], rect[1]];
  4468. }
  4469. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  4470. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  4471. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  4472. }
  4473. class Annotation {
  4474. constructor(params) {
  4475. const dict = params.dict;
  4476. this.setTitle(dict.get("T"));
  4477. this.setContents(dict.get("Contents"));
  4478. this.setModificationDate(dict.get("M"));
  4479. this.setFlags(dict.get("F"));
  4480. this.setRectangle(dict.getArray("Rect"));
  4481. this.setColor(dict.getArray("C"));
  4482. this.setBorderStyle(dict);
  4483. this.setAppearance(dict);
  4484. this.setOptionalContent(dict);
  4485. const MK = dict.get("MK");
  4486. this.setBorderAndBackgroundColors(MK);
  4487. this.setRotation(MK);
  4488. this._streams = [];
  4489. if (this.appearance) {
  4490. this._streams.push(this.appearance);
  4491. }
  4492. this.data = {
  4493. annotationFlags: this.flags,
  4494. borderStyle: this.borderStyle,
  4495. color: this.color,
  4496. backgroundColor: this.backgroundColor,
  4497. borderColor: this.borderColor,
  4498. rotation: this.rotation,
  4499. contentsObj: this._contents,
  4500. hasAppearance: !!this.appearance,
  4501. id: params.id,
  4502. modificationDate: this.modificationDate,
  4503. rect: this.rectangle,
  4504. subtype: params.subtype,
  4505. hasOwnCanvas: false
  4506. };
  4507. if (params.collectFields) {
  4508. const kids = dict.get("Kids");
  4509. if (Array.isArray(kids)) {
  4510. const kidIds = [];
  4511. for (const kid of kids) {
  4512. if (kid instanceof _primitives.Ref) {
  4513. kidIds.push(kid.toString());
  4514. }
  4515. }
  4516. if (kidIds.length !== 0) {
  4517. this.data.kidIds = kidIds;
  4518. }
  4519. }
  4520. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  4521. this.data.fieldName = this._constructFieldName(dict);
  4522. this.data.pageIndex = params.pageIndex;
  4523. }
  4524. this._fallbackFontDict = null;
  4525. }
  4526. _hasFlag(flags, flag) {
  4527. return !!(flags & flag);
  4528. }
  4529. _isViewable(flags) {
  4530. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4531. }
  4532. _isPrintable(flags) {
  4533. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4534. }
  4535. mustBeViewed(annotationStorage) {
  4536. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4537. if (storageEntry && storageEntry.hidden !== undefined) {
  4538. return !storageEntry.hidden;
  4539. }
  4540. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4541. }
  4542. mustBePrinted(annotationStorage) {
  4543. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4544. if (storageEntry && storageEntry.print !== undefined) {
  4545. return storageEntry.print;
  4546. }
  4547. return this.printable;
  4548. }
  4549. get viewable() {
  4550. if (this.data.quadPoints === null) {
  4551. return false;
  4552. }
  4553. if (this.flags === 0) {
  4554. return true;
  4555. }
  4556. return this._isViewable(this.flags);
  4557. }
  4558. get printable() {
  4559. if (this.data.quadPoints === null) {
  4560. return false;
  4561. }
  4562. if (this.flags === 0) {
  4563. return false;
  4564. }
  4565. return this._isPrintable(this.flags);
  4566. }
  4567. _parseStringHelper(data) {
  4568. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  4569. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  4570. return {
  4571. str,
  4572. dir
  4573. };
  4574. }
  4575. setTitle(title) {
  4576. this._title = this._parseStringHelper(title);
  4577. }
  4578. setContents(contents) {
  4579. this._contents = this._parseStringHelper(contents);
  4580. }
  4581. setModificationDate(modificationDate) {
  4582. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  4583. }
  4584. setFlags(flags) {
  4585. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4586. }
  4587. hasFlag(flag) {
  4588. return this._hasFlag(this.flags, flag);
  4589. }
  4590. setRectangle(rectangle) {
  4591. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4592. this.rectangle = _util.Util.normalizeRect(rectangle);
  4593. } else {
  4594. this.rectangle = [0, 0, 0, 0];
  4595. }
  4596. }
  4597. setColor(color) {
  4598. this.color = getRgbColor(color);
  4599. }
  4600. setLineEndings(lineEndings) {
  4601. this.lineEndings = ["None", "None"];
  4602. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  4603. for (let i = 0; i < 2; i++) {
  4604. const obj = lineEndings[i];
  4605. if (obj instanceof _primitives.Name) {
  4606. switch (obj.name) {
  4607. case "None":
  4608. continue;
  4609. case "Square":
  4610. case "Circle":
  4611. case "Diamond":
  4612. case "OpenArrow":
  4613. case "ClosedArrow":
  4614. case "Butt":
  4615. case "ROpenArrow":
  4616. case "RClosedArrow":
  4617. case "Slash":
  4618. this.lineEndings[i] = obj.name;
  4619. continue;
  4620. }
  4621. }
  4622. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  4623. }
  4624. }
  4625. }
  4626. setRotation(mk) {
  4627. this.rotation = 0;
  4628. if (mk instanceof _primitives.Dict) {
  4629. let angle = mk.get("R") || 0;
  4630. if (Number.isInteger(angle) && angle !== 0) {
  4631. angle %= 360;
  4632. if (angle < 0) {
  4633. angle += 360;
  4634. }
  4635. if (angle % 90 === 0) {
  4636. this.rotation = angle;
  4637. }
  4638. }
  4639. }
  4640. }
  4641. setBorderAndBackgroundColors(mk) {
  4642. if (mk instanceof _primitives.Dict) {
  4643. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  4644. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  4645. } else {
  4646. this.borderColor = this.backgroundColor = null;
  4647. }
  4648. }
  4649. setBorderStyle(borderStyle) {
  4650. this.borderStyle = new AnnotationBorderStyle();
  4651. if (!(borderStyle instanceof _primitives.Dict)) {
  4652. return;
  4653. }
  4654. if (borderStyle.has("BS")) {
  4655. const dict = borderStyle.get("BS");
  4656. const dictType = dict.get("Type");
  4657. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4658. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4659. this.borderStyle.setStyle(dict.get("S"));
  4660. this.borderStyle.setDashArray(dict.getArray("D"));
  4661. }
  4662. } else if (borderStyle.has("Border")) {
  4663. const array = borderStyle.getArray("Border");
  4664. if (Array.isArray(array) && array.length >= 3) {
  4665. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4666. this.borderStyle.setVerticalCornerRadius(array[1]);
  4667. this.borderStyle.setWidth(array[2], this.rectangle);
  4668. if (array.length === 4) {
  4669. this.borderStyle.setDashArray(array[3], true);
  4670. }
  4671. }
  4672. } else {
  4673. this.borderStyle.setWidth(0);
  4674. }
  4675. }
  4676. setAppearance(dict) {
  4677. this.appearance = null;
  4678. const appearanceStates = dict.get("AP");
  4679. if (!(appearanceStates instanceof _primitives.Dict)) {
  4680. return;
  4681. }
  4682. const normalAppearanceState = appearanceStates.get("N");
  4683. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  4684. this.appearance = normalAppearanceState;
  4685. return;
  4686. }
  4687. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  4688. return;
  4689. }
  4690. const as = dict.get("AS");
  4691. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  4692. return;
  4693. }
  4694. this.appearance = normalAppearanceState.get(as.name);
  4695. }
  4696. setOptionalContent(dict) {
  4697. this.oc = null;
  4698. const oc = dict.get("OC");
  4699. if (oc instanceof _primitives.Name) {
  4700. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  4701. } else if (oc instanceof _primitives.Dict) {
  4702. this.oc = oc;
  4703. }
  4704. }
  4705. loadResources(keys, appearance) {
  4706. return appearance.dict.getAsync("Resources").then(resources => {
  4707. if (!resources) {
  4708. return undefined;
  4709. }
  4710. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4711. return objectLoader.load().then(function () {
  4712. return resources;
  4713. });
  4714. });
  4715. }
  4716. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  4717. const data = this.data;
  4718. let appearance = this.appearance;
  4719. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  4720. if (!appearance) {
  4721. if (!isUsingOwnCanvas) {
  4722. return {
  4723. opList: new _operator_list.OperatorList(),
  4724. separateForm: false,
  4725. separateCanvas: false
  4726. };
  4727. }
  4728. appearance = new _stream.StringStream("");
  4729. appearance.dict = new _primitives.Dict();
  4730. }
  4731. const appearanceDict = appearance.dict;
  4732. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  4733. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4734. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4735. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4736. const opList = new _operator_list.OperatorList();
  4737. let optionalContent;
  4738. if (this.oc) {
  4739. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  4740. }
  4741. if (optionalContent !== undefined) {
  4742. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  4743. }
  4744. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  4745. await evaluator.getOperatorList({
  4746. stream: appearance,
  4747. task,
  4748. resources,
  4749. operatorList: opList,
  4750. fallbackFontDict: this._fallbackFontDict
  4751. });
  4752. opList.addOp(_util.OPS.endAnnotation, []);
  4753. if (optionalContent !== undefined) {
  4754. opList.addOp(_util.OPS.endMarkedContent, []);
  4755. }
  4756. this.reset();
  4757. return {
  4758. opList,
  4759. separateForm: false,
  4760. separateCanvas: isUsingOwnCanvas
  4761. };
  4762. }
  4763. async save(evaluator, task, annotationStorage) {
  4764. return null;
  4765. }
  4766. get hasTextContent() {
  4767. return false;
  4768. }
  4769. async extractTextContent(evaluator, task, viewBox) {
  4770. if (!this.appearance) {
  4771. return;
  4772. }
  4773. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  4774. const text = [];
  4775. const buffer = [];
  4776. const sink = {
  4777. desiredSize: Math.Infinity,
  4778. ready: true,
  4779. enqueue(chunk, size) {
  4780. for (const item of chunk.items) {
  4781. buffer.push(item.str);
  4782. if (item.hasEOL) {
  4783. text.push(buffer.join(""));
  4784. buffer.length = 0;
  4785. }
  4786. }
  4787. }
  4788. };
  4789. await evaluator.getTextContent({
  4790. stream: this.appearance,
  4791. task,
  4792. resources,
  4793. includeMarkedContent: true,
  4794. combineTextItems: true,
  4795. sink,
  4796. viewBox
  4797. });
  4798. this.reset();
  4799. if (buffer.length) {
  4800. text.push(buffer.join(""));
  4801. }
  4802. if (text.length > 0) {
  4803. this.data.textContent = text;
  4804. }
  4805. }
  4806. getFieldObject() {
  4807. if (this.data.kidIds) {
  4808. return {
  4809. id: this.data.id,
  4810. actions: this.data.actions,
  4811. name: this.data.fieldName,
  4812. strokeColor: this.data.borderColor,
  4813. fillColor: this.data.backgroundColor,
  4814. type: "",
  4815. kidIds: this.data.kidIds,
  4816. page: this.data.pageIndex,
  4817. rotation: this.rotation
  4818. };
  4819. }
  4820. return null;
  4821. }
  4822. reset() {
  4823. for (const stream of this._streams) {
  4824. stream.reset();
  4825. }
  4826. }
  4827. _constructFieldName(dict) {
  4828. if (!dict.has("T") && !dict.has("Parent")) {
  4829. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4830. return "";
  4831. }
  4832. if (!dict.has("Parent")) {
  4833. return (0, _util.stringToPDFString)(dict.get("T"));
  4834. }
  4835. const fieldName = [];
  4836. if (dict.has("T")) {
  4837. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4838. }
  4839. let loopDict = dict;
  4840. const visited = new _primitives.RefSet();
  4841. if (dict.objId) {
  4842. visited.put(dict.objId);
  4843. }
  4844. while (loopDict.has("Parent")) {
  4845. loopDict = loopDict.get("Parent");
  4846. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4847. break;
  4848. }
  4849. if (loopDict.objId) {
  4850. visited.put(loopDict.objId);
  4851. }
  4852. if (loopDict.has("T")) {
  4853. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4854. }
  4855. }
  4856. return fieldName.join(".");
  4857. }
  4858. }
  4859. exports.Annotation = Annotation;
  4860. class AnnotationBorderStyle {
  4861. constructor() {
  4862. this.width = 1;
  4863. this.style = _util.AnnotationBorderStyleType.SOLID;
  4864. this.dashArray = [3];
  4865. this.horizontalCornerRadius = 0;
  4866. this.verticalCornerRadius = 0;
  4867. }
  4868. setWidth(width, rect = [0, 0, 0, 0]) {
  4869. if (width instanceof _primitives.Name) {
  4870. this.width = 0;
  4871. return;
  4872. }
  4873. if (typeof width === "number") {
  4874. if (width > 0) {
  4875. const maxWidth = (rect[2] - rect[0]) / 2;
  4876. const maxHeight = (rect[3] - rect[1]) / 2;
  4877. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4878. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4879. width = 1;
  4880. }
  4881. }
  4882. this.width = width;
  4883. }
  4884. }
  4885. setStyle(style) {
  4886. if (!(style instanceof _primitives.Name)) {
  4887. return;
  4888. }
  4889. switch (style.name) {
  4890. case "S":
  4891. this.style = _util.AnnotationBorderStyleType.SOLID;
  4892. break;
  4893. case "D":
  4894. this.style = _util.AnnotationBorderStyleType.DASHED;
  4895. break;
  4896. case "B":
  4897. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4898. break;
  4899. case "I":
  4900. this.style = _util.AnnotationBorderStyleType.INSET;
  4901. break;
  4902. case "U":
  4903. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4904. break;
  4905. default:
  4906. break;
  4907. }
  4908. }
  4909. setDashArray(dashArray, forceStyle = false) {
  4910. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4911. let isValid = true;
  4912. let allZeros = true;
  4913. for (const element of dashArray) {
  4914. const validNumber = +element >= 0;
  4915. if (!validNumber) {
  4916. isValid = false;
  4917. break;
  4918. } else if (element > 0) {
  4919. allZeros = false;
  4920. }
  4921. }
  4922. if (isValid && !allZeros) {
  4923. this.dashArray = dashArray;
  4924. if (forceStyle) {
  4925. this.setStyle(_primitives.Name.get("D"));
  4926. }
  4927. } else {
  4928. this.width = 0;
  4929. }
  4930. } else if (dashArray) {
  4931. this.width = 0;
  4932. }
  4933. }
  4934. setHorizontalCornerRadius(radius) {
  4935. if (Number.isInteger(radius)) {
  4936. this.horizontalCornerRadius = radius;
  4937. }
  4938. }
  4939. setVerticalCornerRadius(radius) {
  4940. if (Number.isInteger(radius)) {
  4941. this.verticalCornerRadius = radius;
  4942. }
  4943. }
  4944. }
  4945. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4946. class MarkupAnnotation extends Annotation {
  4947. constructor(parameters) {
  4948. super(parameters);
  4949. const dict = parameters.dict;
  4950. if (dict.has("IRT")) {
  4951. const rawIRT = dict.getRaw("IRT");
  4952. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  4953. const rt = dict.get("RT");
  4954. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  4955. }
  4956. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  4957. const parent = dict.get("IRT");
  4958. this.setTitle(parent.get("T"));
  4959. this.data.titleObj = this._title;
  4960. this.setContents(parent.get("Contents"));
  4961. this.data.contentsObj = this._contents;
  4962. if (!parent.has("CreationDate")) {
  4963. this.data.creationDate = null;
  4964. } else {
  4965. this.setCreationDate(parent.get("CreationDate"));
  4966. this.data.creationDate = this.creationDate;
  4967. }
  4968. if (!parent.has("M")) {
  4969. this.data.modificationDate = null;
  4970. } else {
  4971. this.setModificationDate(parent.get("M"));
  4972. this.data.modificationDate = this.modificationDate;
  4973. }
  4974. this.data.hasPopup = parent.has("Popup");
  4975. if (!parent.has("C")) {
  4976. this.data.color = null;
  4977. } else {
  4978. this.setColor(parent.getArray("C"));
  4979. this.data.color = this.color;
  4980. }
  4981. } else {
  4982. this.data.titleObj = this._title;
  4983. this.setCreationDate(dict.get("CreationDate"));
  4984. this.data.creationDate = this.creationDate;
  4985. this.data.hasPopup = dict.has("Popup");
  4986. if (!dict.has("C")) {
  4987. this.data.color = null;
  4988. }
  4989. }
  4990. if (dict.has("RC")) {
  4991. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  4992. }
  4993. }
  4994. setCreationDate(creationDate) {
  4995. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  4996. }
  4997. _setDefaultAppearance({
  4998. xref,
  4999. extra,
  5000. strokeColor,
  5001. fillColor,
  5002. blendMode,
  5003. strokeAlpha,
  5004. fillAlpha,
  5005. pointsCallback
  5006. }) {
  5007. let minX = Number.MAX_VALUE;
  5008. let minY = Number.MAX_VALUE;
  5009. let maxX = Number.MIN_VALUE;
  5010. let maxY = Number.MIN_VALUE;
  5011. const buffer = ["q"];
  5012. if (extra) {
  5013. buffer.push(extra);
  5014. }
  5015. if (strokeColor) {
  5016. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  5017. }
  5018. if (fillColor) {
  5019. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  5020. }
  5021. let pointsArray = this.data.quadPoints;
  5022. if (!pointsArray) {
  5023. pointsArray = [[{
  5024. x: this.rectangle[0],
  5025. y: this.rectangle[3]
  5026. }, {
  5027. x: this.rectangle[2],
  5028. y: this.rectangle[3]
  5029. }, {
  5030. x: this.rectangle[0],
  5031. y: this.rectangle[1]
  5032. }, {
  5033. x: this.rectangle[2],
  5034. y: this.rectangle[1]
  5035. }]];
  5036. }
  5037. for (const points of pointsArray) {
  5038. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  5039. minX = Math.min(minX, mX);
  5040. maxX = Math.max(maxX, MX);
  5041. minY = Math.min(minY, mY);
  5042. maxY = Math.max(maxY, MY);
  5043. }
  5044. buffer.push("Q");
  5045. const formDict = new _primitives.Dict(xref);
  5046. const appearanceStreamDict = new _primitives.Dict(xref);
  5047. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5048. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  5049. appearanceStream.dict = appearanceStreamDict;
  5050. formDict.set("Fm0", appearanceStream);
  5051. const gsDict = new _primitives.Dict(xref);
  5052. if (blendMode) {
  5053. gsDict.set("BM", _primitives.Name.get(blendMode));
  5054. }
  5055. if (typeof strokeAlpha === "number") {
  5056. gsDict.set("CA", strokeAlpha);
  5057. }
  5058. if (typeof fillAlpha === "number") {
  5059. gsDict.set("ca", fillAlpha);
  5060. }
  5061. const stateDict = new _primitives.Dict(xref);
  5062. stateDict.set("GS0", gsDict);
  5063. const resources = new _primitives.Dict(xref);
  5064. resources.set("ExtGState", stateDict);
  5065. resources.set("XObject", formDict);
  5066. const appearanceDict = new _primitives.Dict(xref);
  5067. appearanceDict.set("Resources", resources);
  5068. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  5069. appearanceDict.set("BBox", bbox);
  5070. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  5071. this.appearance.dict = appearanceDict;
  5072. this._streams.push(this.appearance, appearanceStream);
  5073. }
  5074. static async createNewAnnotation(xref, annotation, dependencies, params) {
  5075. const annotationRef = xref.getNewRef();
  5076. const apRef = xref.getNewRef();
  5077. const annotationDict = this.createNewDict(annotation, xref, {
  5078. apRef
  5079. });
  5080. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5081. const buffer = [];
  5082. let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  5083. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  5084. dependencies.push({
  5085. ref: apRef,
  5086. data: buffer.join("")
  5087. });
  5088. buffer.length = 0;
  5089. transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  5090. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  5091. return {
  5092. ref: annotationRef,
  5093. data: buffer.join("")
  5094. };
  5095. }
  5096. static async createNewPrintAnnotation(xref, annotation, params) {
  5097. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5098. const annotationDict = this.createNewDict(annotation, xref, {
  5099. ap
  5100. });
  5101. return new this.prototype.constructor({
  5102. dict: annotationDict,
  5103. xref
  5104. });
  5105. }
  5106. }
  5107. exports.MarkupAnnotation = MarkupAnnotation;
  5108. class WidgetAnnotation extends Annotation {
  5109. constructor(params) {
  5110. super(params);
  5111. const dict = params.dict;
  5112. const data = this.data;
  5113. this.ref = params.ref;
  5114. data.annotationType = _util.AnnotationType.WIDGET;
  5115. if (data.fieldName === undefined) {
  5116. data.fieldName = this._constructFieldName(dict);
  5117. }
  5118. if (data.actions === undefined) {
  5119. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  5120. }
  5121. let fieldValue = (0, _core_utils.getInheritableProperty)({
  5122. dict,
  5123. key: "V",
  5124. getArray: true
  5125. });
  5126. data.fieldValue = this._decodeFormValue(fieldValue);
  5127. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  5128. dict,
  5129. key: "DV",
  5130. getArray: true
  5131. });
  5132. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  5133. if (fieldValue === undefined && params.xfaDatasets) {
  5134. const path = this._title.str;
  5135. if (path) {
  5136. this._hasValueFromXFA = true;
  5137. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  5138. }
  5139. }
  5140. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  5141. data.fieldValue = data.defaultFieldValue;
  5142. }
  5143. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  5144. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  5145. dict,
  5146. key: "DA"
  5147. }) || params.acroForm.get("DA");
  5148. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  5149. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  5150. const fieldType = (0, _core_utils.getInheritableProperty)({
  5151. dict,
  5152. key: "FT"
  5153. });
  5154. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  5155. const localResources = (0, _core_utils.getInheritableProperty)({
  5156. dict,
  5157. key: "DR"
  5158. });
  5159. const acroFormResources = params.acroForm.get("DR");
  5160. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  5161. this._fieldResources = {
  5162. localResources,
  5163. acroFormResources,
  5164. appearanceResources,
  5165. mergedResources: _primitives.Dict.merge({
  5166. xref: params.xref,
  5167. dictArray: [localResources, appearanceResources, acroFormResources],
  5168. mergeSubDicts: true
  5169. })
  5170. };
  5171. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  5172. dict,
  5173. key: "Ff"
  5174. });
  5175. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  5176. data.fieldFlags = 0;
  5177. }
  5178. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  5179. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  5180. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  5181. }
  5182. _decodeFormValue(formValue) {
  5183. if (Array.isArray(formValue)) {
  5184. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  5185. } else if (formValue instanceof _primitives.Name) {
  5186. return (0, _util.stringToPDFString)(formValue.name);
  5187. } else if (typeof formValue === "string") {
  5188. return (0, _util.stringToPDFString)(formValue);
  5189. }
  5190. return null;
  5191. }
  5192. hasFieldFlag(flag) {
  5193. return !!(this.data.fieldFlags & flag);
  5194. }
  5195. static _getRotationMatrix(rotation, width, height) {
  5196. switch (rotation) {
  5197. case 90:
  5198. return [0, 1, -1, 0, width, 0];
  5199. case 180:
  5200. return [-1, 0, 0, -1, width, height];
  5201. case 270:
  5202. return [0, -1, 1, 0, 0, height];
  5203. default:
  5204. throw new Error("Invalid rotation");
  5205. }
  5206. }
  5207. getRotationMatrix(annotationStorage) {
  5208. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5209. let rotation = storageEntry && storageEntry.rotation;
  5210. if (rotation === undefined) {
  5211. rotation = this.rotation;
  5212. }
  5213. if (rotation === 0) {
  5214. return _util.IDENTITY_MATRIX;
  5215. }
  5216. const width = this.data.rect[2] - this.data.rect[0];
  5217. const height = this.data.rect[3] - this.data.rect[1];
  5218. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  5219. }
  5220. getBorderAndBackgroundAppearances(annotationStorage) {
  5221. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5222. let rotation = storageEntry && storageEntry.rotation;
  5223. if (rotation === undefined) {
  5224. rotation = this.rotation;
  5225. }
  5226. if (!this.backgroundColor && !this.borderColor) {
  5227. return "";
  5228. }
  5229. const width = this.data.rect[2] - this.data.rect[0];
  5230. const height = this.data.rect[3] - this.data.rect[1];
  5231. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  5232. let str = "";
  5233. if (this.backgroundColor) {
  5234. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  5235. }
  5236. if (this.borderColor) {
  5237. const borderWidth = this.borderStyle.width || 1;
  5238. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  5239. }
  5240. return str;
  5241. }
  5242. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5243. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  5244. return {
  5245. opList: new _operator_list.OperatorList(),
  5246. separateForm: true,
  5247. separateCanvas: false
  5248. };
  5249. }
  5250. if (!this._hasText) {
  5251. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5252. }
  5253. const content = await this._getAppearance(evaluator, task, annotationStorage);
  5254. if (this.appearance && content === null) {
  5255. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5256. }
  5257. const opList = new _operator_list.OperatorList();
  5258. if (!this._defaultAppearance || content === null) {
  5259. return {
  5260. opList,
  5261. separateForm: false,
  5262. separateCanvas: false
  5263. };
  5264. }
  5265. const matrix = [1, 0, 0, 1, 0, 0];
  5266. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5267. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  5268. let optionalContent;
  5269. if (this.oc) {
  5270. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  5271. }
  5272. if (optionalContent !== undefined) {
  5273. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  5274. }
  5275. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  5276. const stream = new _stream.StringStream(content);
  5277. await evaluator.getOperatorList({
  5278. stream,
  5279. task,
  5280. resources: this._fieldResources.mergedResources,
  5281. operatorList: opList
  5282. });
  5283. opList.addOp(_util.OPS.endAnnotation, []);
  5284. if (optionalContent !== undefined) {
  5285. opList.addOp(_util.OPS.endMarkedContent, []);
  5286. }
  5287. return {
  5288. opList,
  5289. separateForm: false,
  5290. separateCanvas: false
  5291. };
  5292. }
  5293. _getMKDict(rotation) {
  5294. const mk = new _primitives.Dict(null);
  5295. if (rotation) {
  5296. mk.set("R", rotation);
  5297. }
  5298. if (this.borderColor) {
  5299. mk.set("BC", Array.from(this.borderColor, c => c / 255));
  5300. }
  5301. if (this.backgroundColor) {
  5302. mk.set("BG", Array.from(this.backgroundColor, c => c / 255));
  5303. }
  5304. return mk.size > 0 ? mk : null;
  5305. }
  5306. async save(evaluator, task, annotationStorage) {
  5307. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5308. let value = storageEntry && storageEntry.value;
  5309. let rotation = storageEntry && storageEntry.rotation;
  5310. if (value === this.data.fieldValue || value === undefined) {
  5311. if (!this._hasValueFromXFA && rotation === undefined) {
  5312. return null;
  5313. }
  5314. value = value || this.data.fieldValue;
  5315. }
  5316. if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) {
  5317. return null;
  5318. }
  5319. if (rotation === undefined) {
  5320. rotation = this.rotation;
  5321. }
  5322. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  5323. if (appearance === null) {
  5324. return null;
  5325. }
  5326. const {
  5327. xref
  5328. } = evaluator;
  5329. const dict = xref.fetchIfRef(this.ref);
  5330. if (!(dict instanceof _primitives.Dict)) {
  5331. return null;
  5332. }
  5333. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5334. const xfa = {
  5335. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5336. value
  5337. };
  5338. const newRef = xref.getNewRef();
  5339. const AP = new _primitives.Dict(xref);
  5340. AP.set("N", newRef);
  5341. const encrypt = xref.encrypt;
  5342. let originalTransform = null;
  5343. let newTransform = null;
  5344. if (encrypt) {
  5345. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5346. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  5347. appearance = newTransform.encryptString(appearance);
  5348. }
  5349. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  5350. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  5351. dict.set("AP", AP);
  5352. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5353. const maybeMK = this._getMKDict(rotation);
  5354. if (maybeMK) {
  5355. dict.set("MK", maybeMK);
  5356. }
  5357. const appearanceDict = new _primitives.Dict(xref);
  5358. appearanceDict.set("Length", appearance.length);
  5359. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  5360. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  5361. appearanceDict.set("BBox", bbox);
  5362. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  5363. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  5364. appearanceDict.set("Matrix", rotationMatrix);
  5365. }
  5366. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5367. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  5368. bufferOriginal.push("\nendobj\n");
  5369. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  5370. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  5371. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  5372. return [{
  5373. ref: this.ref,
  5374. data: bufferOriginal.join(""),
  5375. xfa
  5376. }, {
  5377. ref: newRef,
  5378. data: bufferNew.join(""),
  5379. xfa: null
  5380. }];
  5381. }
  5382. async _getAppearance(evaluator, task, annotationStorage) {
  5383. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  5384. if (isPassword) {
  5385. return null;
  5386. }
  5387. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5388. let value, rotation;
  5389. if (storageEntry) {
  5390. value = storageEntry.formattedValue || storageEntry.value;
  5391. rotation = storageEntry.rotation;
  5392. }
  5393. if (rotation === undefined && value === undefined) {
  5394. if (!this._hasValueFromXFA || this.appearance) {
  5395. return null;
  5396. }
  5397. }
  5398. if (value === undefined) {
  5399. value = this.data.fieldValue;
  5400. if (!value) {
  5401. return "";
  5402. }
  5403. }
  5404. if (Array.isArray(value) && value.length === 1) {
  5405. value = value[0];
  5406. }
  5407. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  5408. value = value.trim();
  5409. if (value === "") {
  5410. return "";
  5411. }
  5412. if (rotation === undefined) {
  5413. rotation = this.rotation;
  5414. }
  5415. let lineCount = -1;
  5416. if (this.data.multiLine) {
  5417. lineCount = value.split(/\r\n|\r|\n/).length;
  5418. }
  5419. const defaultPadding = 2;
  5420. const hPadding = defaultPadding;
  5421. let totalHeight = this.data.rect[3] - this.data.rect[1];
  5422. let totalWidth = this.data.rect[2] - this.data.rect[0];
  5423. if (rotation === 90 || rotation === 270) {
  5424. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  5425. }
  5426. if (!this._defaultAppearance) {
  5427. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  5428. }
  5429. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  5430. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  5431. let descent = font.descent;
  5432. if (isNaN(descent)) {
  5433. descent = 0;
  5434. }
  5435. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  5436. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  5437. const alignment = this.data.textAlignment;
  5438. if (this.data.multiLine) {
  5439. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage);
  5440. }
  5441. const encodedString = font.encodeString(value).join("");
  5442. if (this.data.comb) {
  5443. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage);
  5444. }
  5445. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5446. if (alignment === 0 || alignment > 2) {
  5447. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  5448. }
  5449. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  5450. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  5451. }
  5452. static async _getFontData(evaluator, task, appearanceData, resources) {
  5453. const operatorList = new _operator_list.OperatorList();
  5454. const initialState = {
  5455. font: null,
  5456. clone() {
  5457. return this;
  5458. }
  5459. };
  5460. const {
  5461. fontName,
  5462. fontSize
  5463. } = appearanceData;
  5464. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  5465. return initialState.font;
  5466. }
  5467. _getTextWidth(text, font) {
  5468. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  5469. }
  5470. _computeFontSize(height, width, text, font, lineCount) {
  5471. let {
  5472. fontSize
  5473. } = this.data.defaultAppearanceData;
  5474. if (!fontSize) {
  5475. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  5476. if (lineCount === -1) {
  5477. const textWidth = this._getTextWidth(text, font);
  5478. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth));
  5479. } else {
  5480. const lines = text.split(/\r\n?|\n/);
  5481. const cachedLines = [];
  5482. for (const line of lines) {
  5483. const encoded = font.encodeString(line).join("");
  5484. const glyphs = font.charsToGlyphs(encoded);
  5485. const positions = font.getCharPositions(encoded);
  5486. cachedLines.push({
  5487. line: encoded,
  5488. glyphs,
  5489. positions
  5490. });
  5491. }
  5492. const isTooBig = fsize => {
  5493. let totalHeight = 0;
  5494. for (const cache of cachedLines) {
  5495. const chunks = this._splitLine(null, font, fsize, width, cache);
  5496. totalHeight += chunks.length * fsize;
  5497. if (totalHeight > height) {
  5498. return true;
  5499. }
  5500. }
  5501. return false;
  5502. };
  5503. fontSize = 12;
  5504. let lineHeight = fontSize * _util.LINE_FACTOR;
  5505. let numberOfLines = Math.round(height / lineHeight);
  5506. numberOfLines = Math.max(numberOfLines, lineCount);
  5507. while (true) {
  5508. lineHeight = height / numberOfLines;
  5509. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  5510. if (isTooBig(fontSize)) {
  5511. numberOfLines++;
  5512. continue;
  5513. }
  5514. break;
  5515. }
  5516. }
  5517. const {
  5518. fontName,
  5519. fontColor
  5520. } = this.data.defaultAppearanceData;
  5521. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  5522. fontSize,
  5523. fontName,
  5524. fontColor
  5525. });
  5526. }
  5527. return [this._defaultAppearance, fontSize];
  5528. }
  5529. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  5530. let shift;
  5531. if (alignment === 1) {
  5532. const width = this._getTextWidth(text, font) * fontSize;
  5533. shift = (totalWidth - width) / 2;
  5534. } else if (alignment === 2) {
  5535. const width = this._getTextWidth(text, font) * fontSize;
  5536. shift = totalWidth - width - hPadding;
  5537. } else {
  5538. shift = hPadding;
  5539. }
  5540. shift = (0, _core_utils.numberToString)(shift);
  5541. vPadding = (0, _core_utils.numberToString)(vPadding);
  5542. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  5543. }
  5544. _getSaveFieldResources(xref) {
  5545. const {
  5546. localResources,
  5547. appearanceResources,
  5548. acroFormResources
  5549. } = this._fieldResources;
  5550. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  5551. if (!fontName) {
  5552. return localResources || _primitives.Dict.empty;
  5553. }
  5554. for (const resources of [localResources, appearanceResources]) {
  5555. if (resources instanceof _primitives.Dict) {
  5556. const localFont = resources.get("Font");
  5557. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  5558. return resources;
  5559. }
  5560. }
  5561. }
  5562. if (acroFormResources instanceof _primitives.Dict) {
  5563. const acroFormFont = acroFormResources.get("Font");
  5564. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  5565. const subFontDict = new _primitives.Dict(xref);
  5566. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  5567. const subResourcesDict = new _primitives.Dict(xref);
  5568. subResourcesDict.set("Font", subFontDict);
  5569. return _primitives.Dict.merge({
  5570. xref,
  5571. dictArray: [subResourcesDict, localResources],
  5572. mergeSubDicts: true
  5573. });
  5574. }
  5575. }
  5576. return localResources || _primitives.Dict.empty;
  5577. }
  5578. getFieldObject() {
  5579. return null;
  5580. }
  5581. }
  5582. class TextWidgetAnnotation extends WidgetAnnotation {
  5583. constructor(params) {
  5584. super(params);
  5585. this._hasText = true;
  5586. const dict = params.dict;
  5587. if (typeof this.data.fieldValue !== "string") {
  5588. this.data.fieldValue = "";
  5589. }
  5590. let alignment = (0, _core_utils.getInheritableProperty)({
  5591. dict,
  5592. key: "Q"
  5593. });
  5594. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  5595. alignment = null;
  5596. }
  5597. this.data.textAlignment = alignment;
  5598. let maximumLength = (0, _core_utils.getInheritableProperty)({
  5599. dict,
  5600. key: "MaxLen"
  5601. });
  5602. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  5603. maximumLength = 0;
  5604. }
  5605. this.data.maxLen = maximumLength;
  5606. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  5607. 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 !== 0;
  5608. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  5609. }
  5610. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) {
  5611. const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen);
  5612. const buf = [];
  5613. const positions = font.getCharPositions(text);
  5614. for (const [start, end] of positions) {
  5615. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  5616. }
  5617. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5618. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  5619. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  5620. }
  5621. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) {
  5622. const lines = text.split(/\r\n?|\n/);
  5623. const buf = [];
  5624. const totalWidth = width - 2 * hPadding;
  5625. for (const line of lines) {
  5626. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  5627. for (const chunk of chunks) {
  5628. const padding = buf.length === 0 ? hPadding : 0;
  5629. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  5630. }
  5631. }
  5632. const renderedText = buf.join("\n");
  5633. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5634. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  5635. }
  5636. _splitLine(line, font, fontSize, width, cache = {}) {
  5637. line = cache.line || font.encodeString(line).join("");
  5638. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  5639. if (glyphs.length <= 1) {
  5640. return [line];
  5641. }
  5642. const positions = cache.positions || font.getCharPositions(line);
  5643. const scale = fontSize / 1000;
  5644. const chunks = [];
  5645. let lastSpacePosInStringStart = -1,
  5646. lastSpacePosInStringEnd = -1,
  5647. lastSpacePos = -1,
  5648. startChunk = 0,
  5649. currentWidth = 0;
  5650. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  5651. const [start, end] = positions[i];
  5652. const glyph = glyphs[i];
  5653. const glyphWidth = glyph.width * scale;
  5654. if (glyph.unicode === " ") {
  5655. if (currentWidth + glyphWidth > width) {
  5656. chunks.push(line.substring(startChunk, start));
  5657. startChunk = start;
  5658. currentWidth = glyphWidth;
  5659. lastSpacePosInStringStart = -1;
  5660. lastSpacePos = -1;
  5661. } else {
  5662. currentWidth += glyphWidth;
  5663. lastSpacePosInStringStart = start;
  5664. lastSpacePosInStringEnd = end;
  5665. lastSpacePos = i;
  5666. }
  5667. } else {
  5668. if (currentWidth + glyphWidth > width) {
  5669. if (lastSpacePosInStringStart !== -1) {
  5670. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  5671. startChunk = lastSpacePosInStringEnd;
  5672. i = lastSpacePos + 1;
  5673. lastSpacePosInStringStart = -1;
  5674. currentWidth = 0;
  5675. } else {
  5676. chunks.push(line.substring(startChunk, start));
  5677. startChunk = start;
  5678. currentWidth = glyphWidth;
  5679. }
  5680. } else {
  5681. currentWidth += glyphWidth;
  5682. }
  5683. }
  5684. }
  5685. if (startChunk < line.length) {
  5686. chunks.push(line.substring(startChunk, line.length));
  5687. }
  5688. return chunks;
  5689. }
  5690. getFieldObject() {
  5691. return {
  5692. id: this.data.id,
  5693. value: this.data.fieldValue,
  5694. defaultValue: this.data.defaultFieldValue || "",
  5695. multiline: this.data.multiLine,
  5696. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  5697. charLimit: this.data.maxLen,
  5698. comb: this.data.comb,
  5699. editable: !this.data.readOnly,
  5700. hidden: this.data.hidden,
  5701. name: this.data.fieldName,
  5702. rect: this.data.rect,
  5703. actions: this.data.actions,
  5704. page: this.data.pageIndex,
  5705. strokeColor: this.data.borderColor,
  5706. fillColor: this.data.backgroundColor,
  5707. rotation: this.rotation,
  5708. type: "text"
  5709. };
  5710. }
  5711. }
  5712. class ButtonWidgetAnnotation extends WidgetAnnotation {
  5713. constructor(params) {
  5714. super(params);
  5715. this.checkedAppearance = null;
  5716. this.uncheckedAppearance = null;
  5717. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5718. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5719. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5720. this.data.isTooltipOnly = false;
  5721. if (this.data.checkBox) {
  5722. this._processCheckBox(params);
  5723. } else if (this.data.radioButton) {
  5724. this._processRadioButton(params);
  5725. } else if (this.data.pushButton) {
  5726. this.data.hasOwnCanvas = true;
  5727. this._processPushButton(params);
  5728. } else {
  5729. (0, _util.warn)("Invalid field flags for button widget annotation");
  5730. }
  5731. }
  5732. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5733. if (this.data.pushButton) {
  5734. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  5735. }
  5736. let value = null;
  5737. let rotation = null;
  5738. if (annotationStorage) {
  5739. const storageEntry = annotationStorage.get(this.data.id);
  5740. value = storageEntry ? storageEntry.value : null;
  5741. rotation = storageEntry ? storageEntry.rotation : null;
  5742. }
  5743. if (value === null && this.appearance) {
  5744. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5745. }
  5746. if (value === null || value === undefined) {
  5747. if (this.data.checkBox) {
  5748. value = this.data.fieldValue === this.data.exportValue;
  5749. } else {
  5750. value = this.data.fieldValue === this.data.buttonValue;
  5751. }
  5752. }
  5753. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  5754. if (appearance) {
  5755. const savedAppearance = this.appearance;
  5756. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  5757. if (rotation) {
  5758. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  5759. }
  5760. this.appearance = appearance;
  5761. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5762. this.appearance = savedAppearance;
  5763. appearance.dict.set("Matrix", savedMatrix);
  5764. return operatorList;
  5765. }
  5766. return {
  5767. opList: new _operator_list.OperatorList(),
  5768. separateForm: false,
  5769. separateCanvas: false
  5770. };
  5771. }
  5772. async save(evaluator, task, annotationStorage) {
  5773. if (this.data.checkBox) {
  5774. return this._saveCheckbox(evaluator, task, annotationStorage);
  5775. }
  5776. if (this.data.radioButton) {
  5777. return this._saveRadioButton(evaluator, task, annotationStorage);
  5778. }
  5779. return null;
  5780. }
  5781. async _saveCheckbox(evaluator, task, annotationStorage) {
  5782. if (!annotationStorage) {
  5783. return null;
  5784. }
  5785. const storageEntry = annotationStorage.get(this.data.id);
  5786. let rotation = storageEntry && storageEntry.rotation;
  5787. let value = storageEntry && storageEntry.value;
  5788. if (rotation === undefined) {
  5789. if (value === undefined) {
  5790. return null;
  5791. }
  5792. const defaultValue = this.data.fieldValue === this.data.exportValue;
  5793. if (defaultValue === value) {
  5794. return null;
  5795. }
  5796. }
  5797. const dict = evaluator.xref.fetchIfRef(this.ref);
  5798. if (!(dict instanceof _primitives.Dict)) {
  5799. return null;
  5800. }
  5801. if (rotation === undefined) {
  5802. rotation = this.rotation;
  5803. }
  5804. if (value === undefined) {
  5805. value = this.data.fieldValue === this.data.exportValue;
  5806. }
  5807. const xfa = {
  5808. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5809. value: value ? this.data.exportValue : ""
  5810. };
  5811. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  5812. dict.set("V", name);
  5813. dict.set("AS", name);
  5814. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5815. const maybeMK = this._getMKDict(rotation);
  5816. if (maybeMK) {
  5817. dict.set("MK", maybeMK);
  5818. }
  5819. const encrypt = evaluator.xref.encrypt;
  5820. let originalTransform = null;
  5821. if (encrypt) {
  5822. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5823. }
  5824. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5825. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5826. buffer.push("\nendobj\n");
  5827. return [{
  5828. ref: this.ref,
  5829. data: buffer.join(""),
  5830. xfa
  5831. }];
  5832. }
  5833. async _saveRadioButton(evaluator, task, annotationStorage) {
  5834. if (!annotationStorage) {
  5835. return null;
  5836. }
  5837. const storageEntry = annotationStorage.get(this.data.id);
  5838. let rotation = storageEntry && storageEntry.rotation;
  5839. let value = storageEntry && storageEntry.value;
  5840. if (rotation === undefined) {
  5841. if (value === undefined) {
  5842. return null;
  5843. }
  5844. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  5845. if (defaultValue === value) {
  5846. return null;
  5847. }
  5848. }
  5849. const dict = evaluator.xref.fetchIfRef(this.ref);
  5850. if (!(dict instanceof _primitives.Dict)) {
  5851. return null;
  5852. }
  5853. if (value === undefined) {
  5854. value = this.data.fieldValue === this.data.buttonValue;
  5855. }
  5856. if (rotation === undefined) {
  5857. rotation = this.rotation;
  5858. }
  5859. const xfa = {
  5860. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5861. value: value ? this.data.buttonValue : ""
  5862. };
  5863. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  5864. let parentBuffer = null;
  5865. const encrypt = evaluator.xref.encrypt;
  5866. if (value) {
  5867. if (this.parent instanceof _primitives.Ref) {
  5868. const parent = evaluator.xref.fetch(this.parent);
  5869. let parentTransform = null;
  5870. if (encrypt) {
  5871. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  5872. }
  5873. parent.set("V", name);
  5874. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  5875. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  5876. parentBuffer.push("\nendobj\n");
  5877. } else if (this.parent instanceof _primitives.Dict) {
  5878. this.parent.set("V", name);
  5879. }
  5880. }
  5881. dict.set("AS", name);
  5882. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5883. const maybeMK = this._getMKDict(rotation);
  5884. if (maybeMK) {
  5885. dict.set("MK", maybeMK);
  5886. }
  5887. let originalTransform = null;
  5888. if (encrypt) {
  5889. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5890. }
  5891. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5892. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5893. buffer.push("\nendobj\n");
  5894. const newRefs = [{
  5895. ref: this.ref,
  5896. data: buffer.join(""),
  5897. xfa
  5898. }];
  5899. if (parentBuffer !== null) {
  5900. newRefs.push({
  5901. ref: this.parent,
  5902. data: parentBuffer.join(""),
  5903. xfa: null
  5904. });
  5905. }
  5906. return newRefs;
  5907. }
  5908. _getDefaultCheckedAppearance(params, type) {
  5909. const width = this.data.rect[2] - this.data.rect[0];
  5910. const height = this.data.rect[3] - this.data.rect[1];
  5911. const bbox = [0, 0, width, height];
  5912. const FONT_RATIO = 0.8;
  5913. const fontSize = Math.min(width, height) * FONT_RATIO;
  5914. let metrics, char;
  5915. if (type === "check") {
  5916. metrics = {
  5917. width: 0.755 * fontSize,
  5918. height: 0.705 * fontSize
  5919. };
  5920. char = "\x33";
  5921. } else if (type === "disc") {
  5922. metrics = {
  5923. width: 0.791 * fontSize,
  5924. height: 0.705 * fontSize
  5925. };
  5926. char = "\x6C";
  5927. } else {
  5928. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  5929. }
  5930. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  5931. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  5932. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  5933. const appearanceStreamDict = new _primitives.Dict(params.xref);
  5934. appearanceStreamDict.set("FormType", 1);
  5935. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5936. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  5937. appearanceStreamDict.set("BBox", bbox);
  5938. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  5939. appearanceStreamDict.set("Length", appearance.length);
  5940. const resources = new _primitives.Dict(params.xref);
  5941. const font = new _primitives.Dict(params.xref);
  5942. font.set("PdfJsZaDb", this.fallbackFontDict);
  5943. resources.set("Font", font);
  5944. appearanceStreamDict.set("Resources", resources);
  5945. this.checkedAppearance = new _stream.StringStream(appearance);
  5946. this.checkedAppearance.dict = appearanceStreamDict;
  5947. this._streams.push(this.checkedAppearance);
  5948. }
  5949. _processCheckBox(params) {
  5950. const customAppearance = params.dict.get("AP");
  5951. if (!(customAppearance instanceof _primitives.Dict)) {
  5952. return;
  5953. }
  5954. const normalAppearance = customAppearance.get("N");
  5955. if (!(normalAppearance instanceof _primitives.Dict)) {
  5956. return;
  5957. }
  5958. const asValue = this._decodeFormValue(params.dict.get("AS"));
  5959. if (typeof asValue === "string") {
  5960. this.data.fieldValue = asValue;
  5961. }
  5962. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  5963. const exportValues = normalAppearance.getKeys();
  5964. if (exportValues.length === 0) {
  5965. exportValues.push("Off", yes);
  5966. } else if (exportValues.length === 1) {
  5967. if (exportValues[0] === "Off") {
  5968. exportValues.push(yes);
  5969. } else {
  5970. exportValues.unshift("Off");
  5971. }
  5972. } else if (exportValues.includes(yes)) {
  5973. exportValues.length = 0;
  5974. exportValues.push("Off", yes);
  5975. } else {
  5976. const otherYes = exportValues.find(v => v !== "Off");
  5977. exportValues.length = 0;
  5978. exportValues.push("Off", otherYes);
  5979. }
  5980. if (!exportValues.includes(this.data.fieldValue)) {
  5981. this.data.fieldValue = "Off";
  5982. }
  5983. this.data.exportValue = exportValues[1];
  5984. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  5985. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  5986. if (this.checkedAppearance) {
  5987. this._streams.push(this.checkedAppearance);
  5988. } else {
  5989. this._getDefaultCheckedAppearance(params, "check");
  5990. }
  5991. if (this.uncheckedAppearance) {
  5992. this._streams.push(this.uncheckedAppearance);
  5993. }
  5994. this._fallbackFontDict = this.fallbackFontDict;
  5995. }
  5996. _processRadioButton(params) {
  5997. this.data.fieldValue = this.data.buttonValue = null;
  5998. const fieldParent = params.dict.get("Parent");
  5999. if (fieldParent instanceof _primitives.Dict) {
  6000. this.parent = params.dict.getRaw("Parent");
  6001. const fieldParentValue = fieldParent.get("V");
  6002. if (fieldParentValue instanceof _primitives.Name) {
  6003. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  6004. }
  6005. }
  6006. const appearanceStates = params.dict.get("AP");
  6007. if (!(appearanceStates instanceof _primitives.Dict)) {
  6008. return;
  6009. }
  6010. const normalAppearance = appearanceStates.get("N");
  6011. if (!(normalAppearance instanceof _primitives.Dict)) {
  6012. return;
  6013. }
  6014. for (const key of normalAppearance.getKeys()) {
  6015. if (key !== "Off") {
  6016. this.data.buttonValue = this._decodeFormValue(key);
  6017. break;
  6018. }
  6019. }
  6020. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  6021. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6022. if (this.checkedAppearance) {
  6023. this._streams.push(this.checkedAppearance);
  6024. } else {
  6025. this._getDefaultCheckedAppearance(params, "disc");
  6026. }
  6027. if (this.uncheckedAppearance) {
  6028. this._streams.push(this.uncheckedAppearance);
  6029. }
  6030. this._fallbackFontDict = this.fallbackFontDict;
  6031. }
  6032. _processPushButton(params) {
  6033. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  6034. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  6035. return;
  6036. }
  6037. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  6038. _catalog.Catalog.parseDestDictionary({
  6039. destDict: params.dict,
  6040. resultObj: this.data,
  6041. docBaseUrl: params.pdfManager.docBaseUrl,
  6042. docAttachments: params.attachments
  6043. });
  6044. }
  6045. getFieldObject() {
  6046. let type = "button";
  6047. let exportValues;
  6048. if (this.data.checkBox) {
  6049. type = "checkbox";
  6050. exportValues = this.data.exportValue;
  6051. } else if (this.data.radioButton) {
  6052. type = "radiobutton";
  6053. exportValues = this.data.buttonValue;
  6054. }
  6055. return {
  6056. id: this.data.id,
  6057. value: this.data.fieldValue || "Off",
  6058. defaultValue: this.data.defaultFieldValue,
  6059. exportValues,
  6060. editable: !this.data.readOnly,
  6061. name: this.data.fieldName,
  6062. rect: this.data.rect,
  6063. hidden: this.data.hidden,
  6064. actions: this.data.actions,
  6065. page: this.data.pageIndex,
  6066. strokeColor: this.data.borderColor,
  6067. fillColor: this.data.backgroundColor,
  6068. rotation: this.rotation,
  6069. type
  6070. };
  6071. }
  6072. get fallbackFontDict() {
  6073. const dict = new _primitives.Dict();
  6074. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  6075. dict.set("Type", _primitives.Name.get("FallbackType"));
  6076. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  6077. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  6078. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  6079. }
  6080. }
  6081. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  6082. constructor(params) {
  6083. super(params);
  6084. this.data.options = [];
  6085. const options = (0, _core_utils.getInheritableProperty)({
  6086. dict: params.dict,
  6087. key: "Opt"
  6088. });
  6089. if (Array.isArray(options)) {
  6090. const xref = params.xref;
  6091. for (let i = 0, ii = options.length; i < ii; i++) {
  6092. const option = xref.fetchIfRef(options[i]);
  6093. const isOptionArray = Array.isArray(option);
  6094. this.data.options[i] = {
  6095. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  6096. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  6097. };
  6098. }
  6099. }
  6100. if (typeof this.data.fieldValue === "string") {
  6101. this.data.fieldValue = [this.data.fieldValue];
  6102. } else if (!this.data.fieldValue) {
  6103. this.data.fieldValue = [];
  6104. }
  6105. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  6106. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  6107. this._hasText = true;
  6108. }
  6109. getFieldObject() {
  6110. const type = this.data.combo ? "combobox" : "listbox";
  6111. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  6112. return {
  6113. id: this.data.id,
  6114. value,
  6115. defaultValue: this.data.defaultFieldValue,
  6116. editable: !this.data.readOnly,
  6117. name: this.data.fieldName,
  6118. rect: this.data.rect,
  6119. numItems: this.data.fieldValue.length,
  6120. multipleSelection: this.data.multiSelect,
  6121. hidden: this.data.hidden,
  6122. actions: this.data.actions,
  6123. items: this.data.options,
  6124. page: this.data.pageIndex,
  6125. strokeColor: this.data.borderColor,
  6126. fillColor: this.data.backgroundColor,
  6127. rotation: this.rotation,
  6128. type
  6129. };
  6130. }
  6131. async _getAppearance(evaluator, task, annotationStorage) {
  6132. if (this.data.combo) {
  6133. return super._getAppearance(evaluator, task, annotationStorage);
  6134. }
  6135. if (!annotationStorage) {
  6136. return null;
  6137. }
  6138. const storageEntry = annotationStorage.get(this.data.id);
  6139. if (!storageEntry) {
  6140. return null;
  6141. }
  6142. const rotation = storageEntry.rotation;
  6143. let exportedValue = storageEntry.value;
  6144. if (rotation === undefined && exportedValue === undefined) {
  6145. return null;
  6146. }
  6147. if (exportedValue === undefined) {
  6148. exportedValue = this.data.fieldValue;
  6149. } else if (!Array.isArray(exportedValue)) {
  6150. exportedValue = [exportedValue];
  6151. }
  6152. const defaultPadding = 2;
  6153. const hPadding = defaultPadding;
  6154. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6155. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6156. if (rotation === 90 || rotation === 270) {
  6157. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6158. }
  6159. const lineCount = this.data.options.length;
  6160. const valueIndices = [];
  6161. for (let i = 0; i < lineCount; i++) {
  6162. const {
  6163. exportValue
  6164. } = this.data.options[i];
  6165. if (exportedValue.includes(exportValue)) {
  6166. valueIndices.push(i);
  6167. }
  6168. }
  6169. if (!this._defaultAppearance) {
  6170. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  6171. }
  6172. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  6173. let defaultAppearance;
  6174. let {
  6175. fontSize
  6176. } = this.data.defaultAppearanceData;
  6177. if (!fontSize) {
  6178. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  6179. let lineWidth = -1;
  6180. let value;
  6181. for (const {
  6182. displayValue
  6183. } of this.data.options) {
  6184. const width = this._getTextWidth(displayValue, font);
  6185. if (width > lineWidth) {
  6186. lineWidth = width;
  6187. value = displayValue;
  6188. }
  6189. }
  6190. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  6191. } else {
  6192. defaultAppearance = this._defaultAppearance;
  6193. }
  6194. const lineHeight = fontSize * _util.LINE_FACTOR;
  6195. const vPadding = (lineHeight - fontSize) / 2;
  6196. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  6197. let firstIndex;
  6198. if (valueIndices.length === 1) {
  6199. const valuePosition = valueIndices[0];
  6200. const indexInPage = valuePosition % numberOfVisibleLines;
  6201. firstIndex = valuePosition - indexInPage;
  6202. } else {
  6203. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  6204. }
  6205. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  6206. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  6207. if (valueIndices.length) {
  6208. buf.push("0.600006 0.756866 0.854904 rg");
  6209. for (const index of valueIndices) {
  6210. if (firstIndex <= index && index < end) {
  6211. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  6212. }
  6213. }
  6214. }
  6215. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  6216. for (let i = firstIndex; i < end; i++) {
  6217. const {
  6218. displayValue
  6219. } = this.data.options[i];
  6220. const hpadding = i === firstIndex ? hPadding : 0;
  6221. const vpadding = i === firstIndex ? vPadding : 0;
  6222. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  6223. }
  6224. buf.push("ET Q EMC");
  6225. return buf.join("\n");
  6226. }
  6227. }
  6228. class SignatureWidgetAnnotation extends WidgetAnnotation {
  6229. constructor(params) {
  6230. super(params);
  6231. this.data.fieldValue = null;
  6232. }
  6233. getFieldObject() {
  6234. return {
  6235. id: this.data.id,
  6236. value: null,
  6237. page: this.data.pageIndex,
  6238. type: "signature"
  6239. };
  6240. }
  6241. }
  6242. class TextAnnotation extends MarkupAnnotation {
  6243. constructor(parameters) {
  6244. const DEFAULT_ICON_SIZE = 22;
  6245. super(parameters);
  6246. const dict = parameters.dict;
  6247. this.data.annotationType = _util.AnnotationType.TEXT;
  6248. if (this.data.hasAppearance) {
  6249. this.data.name = "NoIcon";
  6250. } else {
  6251. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  6252. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  6253. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  6254. }
  6255. if (dict.has("State")) {
  6256. this.data.state = dict.get("State") || null;
  6257. this.data.stateModel = dict.get("StateModel") || null;
  6258. } else {
  6259. this.data.state = null;
  6260. this.data.stateModel = null;
  6261. }
  6262. }
  6263. }
  6264. class LinkAnnotation extends Annotation {
  6265. constructor(params) {
  6266. super(params);
  6267. this.data.annotationType = _util.AnnotationType.LINK;
  6268. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  6269. if (quadPoints) {
  6270. this.data.quadPoints = quadPoints;
  6271. }
  6272. this.data.borderColor = this.data.borderColor || this.data.color;
  6273. _catalog.Catalog.parseDestDictionary({
  6274. destDict: params.dict,
  6275. resultObj: this.data,
  6276. docBaseUrl: params.pdfManager.docBaseUrl,
  6277. docAttachments: params.attachments
  6278. });
  6279. }
  6280. }
  6281. class PopupAnnotation extends Annotation {
  6282. constructor(parameters) {
  6283. super(parameters);
  6284. this.data.annotationType = _util.AnnotationType.POPUP;
  6285. let parentItem = parameters.dict.get("Parent");
  6286. if (!parentItem) {
  6287. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  6288. return;
  6289. }
  6290. const parentSubtype = parentItem.get("Subtype");
  6291. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  6292. const rawParent = parameters.dict.getRaw("Parent");
  6293. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  6294. const parentRect = parentItem.getArray("Rect");
  6295. if (Array.isArray(parentRect) && parentRect.length === 4) {
  6296. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  6297. } else {
  6298. this.data.parentRect = [0, 0, 0, 0];
  6299. }
  6300. const rt = parentItem.get("RT");
  6301. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  6302. parentItem = parentItem.get("IRT");
  6303. }
  6304. if (!parentItem.has("M")) {
  6305. this.data.modificationDate = null;
  6306. } else {
  6307. this.setModificationDate(parentItem.get("M"));
  6308. this.data.modificationDate = this.modificationDate;
  6309. }
  6310. if (!parentItem.has("C")) {
  6311. this.data.color = null;
  6312. } else {
  6313. this.setColor(parentItem.getArray("C"));
  6314. this.data.color = this.color;
  6315. }
  6316. if (!this.viewable) {
  6317. const parentFlags = parentItem.get("F");
  6318. if (this._isViewable(parentFlags)) {
  6319. this.setFlags(parentFlags);
  6320. }
  6321. }
  6322. this.setTitle(parentItem.get("T"));
  6323. this.data.titleObj = this._title;
  6324. this.setContents(parentItem.get("Contents"));
  6325. this.data.contentsObj = this._contents;
  6326. if (parentItem.has("RC")) {
  6327. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  6328. }
  6329. }
  6330. }
  6331. exports.PopupAnnotation = PopupAnnotation;
  6332. class FreeTextAnnotation extends MarkupAnnotation {
  6333. constructor(parameters) {
  6334. super(parameters);
  6335. this.data.annotationType = _util.AnnotationType.FREETEXT;
  6336. }
  6337. get hasTextContent() {
  6338. return !!this.appearance;
  6339. }
  6340. static createNewDict(annotation, xref, {
  6341. apRef,
  6342. ap
  6343. }) {
  6344. const {
  6345. color,
  6346. fontSize,
  6347. rect,
  6348. rotation,
  6349. user,
  6350. value
  6351. } = annotation;
  6352. const freetext = new _primitives.Dict(xref);
  6353. freetext.set("Type", _primitives.Name.get("Annot"));
  6354. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  6355. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6356. freetext.set("Rect", rect);
  6357. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  6358. freetext.set("DA", da);
  6359. freetext.set("Contents", value);
  6360. freetext.set("F", 4);
  6361. freetext.set("Border", [0, 0, 0]);
  6362. freetext.set("Rotate", rotation);
  6363. if (user) {
  6364. freetext.set("T", (0, _util.stringToUTF8String)(user));
  6365. }
  6366. const n = new _primitives.Dict(xref);
  6367. freetext.set("AP", n);
  6368. if (apRef) {
  6369. n.set("N", apRef);
  6370. } else {
  6371. n.set("N", ap);
  6372. }
  6373. return freetext;
  6374. }
  6375. static async createNewAppearanceStream(annotation, xref, params) {
  6376. const {
  6377. baseFontRef,
  6378. evaluator,
  6379. task
  6380. } = params;
  6381. const {
  6382. color,
  6383. fontSize,
  6384. rect,
  6385. rotation,
  6386. value
  6387. } = annotation;
  6388. const resources = new _primitives.Dict(xref);
  6389. const font = new _primitives.Dict(xref);
  6390. if (baseFontRef) {
  6391. font.set("Helv", baseFontRef);
  6392. } else {
  6393. const baseFont = new _primitives.Dict(xref);
  6394. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  6395. baseFont.set("Type", _primitives.Name.get("Font"));
  6396. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  6397. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  6398. font.set("Helv", baseFont);
  6399. }
  6400. resources.set("Font", font);
  6401. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  6402. fontName: "Helvetica",
  6403. fontSize
  6404. }, resources);
  6405. const [x1, y1, x2, y2] = rect;
  6406. let w = x2 - x1;
  6407. let h = y2 - y1;
  6408. if (rotation % 180 !== 0) {
  6409. [w, h] = [h, w];
  6410. }
  6411. const lines = value.split("\n");
  6412. const scale = fontSize / 1000;
  6413. let totalWidth = -Infinity;
  6414. const encodedLines = [];
  6415. for (let line of lines) {
  6416. line = helv.encodeString(line).join("");
  6417. encodedLines.push(line);
  6418. let lineWidth = 0;
  6419. const glyphs = helv.charsToGlyphs(line);
  6420. for (const glyph of glyphs) {
  6421. lineWidth += glyph.width * scale;
  6422. }
  6423. totalWidth = Math.max(totalWidth, lineWidth);
  6424. }
  6425. let hscale = 1;
  6426. if (totalWidth > w) {
  6427. hscale = w / totalWidth;
  6428. }
  6429. let vscale = 1;
  6430. const lineHeight = _util.LINE_FACTOR * fontSize;
  6431. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  6432. const totalHeight = lineHeight * lines.length;
  6433. if (totalHeight > h) {
  6434. vscale = h / totalHeight;
  6435. }
  6436. const fscale = Math.min(hscale, vscale);
  6437. const newFontSize = fontSize * fscale;
  6438. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${(0, _default_appearance.getPdfColor)(color, true)}`, `/Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  6439. const vShift = (0, _core_utils.numberToString)(lineHeight);
  6440. for (const line of encodedLines) {
  6441. buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`);
  6442. }
  6443. buffer.push("ET", "Q");
  6444. const appearance = buffer.join("\n");
  6445. const appearanceStreamDict = new _primitives.Dict(xref);
  6446. appearanceStreamDict.set("FormType", 1);
  6447. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6448. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6449. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6450. appearanceStreamDict.set("Length", appearance.length);
  6451. appearanceStreamDict.set("Resources", resources);
  6452. if (rotation) {
  6453. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  6454. appearanceStreamDict.set("Matrix", matrix);
  6455. }
  6456. const ap = new _stream.StringStream(appearance);
  6457. ap.dict = appearanceStreamDict;
  6458. return ap;
  6459. }
  6460. }
  6461. class LineAnnotation extends MarkupAnnotation {
  6462. constructor(parameters) {
  6463. super(parameters);
  6464. const {
  6465. dict
  6466. } = parameters;
  6467. this.data.annotationType = _util.AnnotationType.LINE;
  6468. const lineCoordinates = dict.getArray("L");
  6469. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  6470. this.setLineEndings(dict.getArray("LE"));
  6471. this.data.lineEndings = this.lineEndings;
  6472. if (!this.appearance) {
  6473. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6474. const strokeAlpha = dict.get("CA");
  6475. let fillColor = null,
  6476. interiorColor = dict.getArray("IC");
  6477. if (interiorColor) {
  6478. interiorColor = getRgbColor(interiorColor, null);
  6479. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  6480. }
  6481. const fillAlpha = fillColor ? strokeAlpha : null;
  6482. const borderWidth = this.borderStyle.width || 1,
  6483. borderAdjust = 2 * borderWidth;
  6484. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  6485. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6486. this.rectangle = bbox;
  6487. }
  6488. this._setDefaultAppearance({
  6489. xref: parameters.xref,
  6490. extra: `${borderWidth} w`,
  6491. strokeColor,
  6492. fillColor,
  6493. strokeAlpha,
  6494. fillAlpha,
  6495. pointsCallback: (buffer, points) => {
  6496. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  6497. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  6498. }
  6499. });
  6500. }
  6501. }
  6502. }
  6503. class SquareAnnotation extends MarkupAnnotation {
  6504. constructor(parameters) {
  6505. super(parameters);
  6506. this.data.annotationType = _util.AnnotationType.SQUARE;
  6507. if (!this.appearance) {
  6508. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6509. const strokeAlpha = parameters.dict.get("CA");
  6510. let fillColor = null,
  6511. interiorColor = parameters.dict.getArray("IC");
  6512. if (interiorColor) {
  6513. interiorColor = getRgbColor(interiorColor, null);
  6514. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  6515. }
  6516. const fillAlpha = fillColor ? strokeAlpha : null;
  6517. if (this.borderStyle.width === 0 && !fillColor) {
  6518. return;
  6519. }
  6520. this._setDefaultAppearance({
  6521. xref: parameters.xref,
  6522. extra: `${this.borderStyle.width} w`,
  6523. strokeColor,
  6524. fillColor,
  6525. strokeAlpha,
  6526. fillAlpha,
  6527. pointsCallback: (buffer, points) => {
  6528. const x = points[2].x + this.borderStyle.width / 2;
  6529. const y = points[2].y + this.borderStyle.width / 2;
  6530. const width = points[3].x - points[2].x - this.borderStyle.width;
  6531. const height = points[1].y - points[3].y - this.borderStyle.width;
  6532. buffer.push(`${x} ${y} ${width} ${height} re`);
  6533. if (fillColor) {
  6534. buffer.push("B");
  6535. } else {
  6536. buffer.push("S");
  6537. }
  6538. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6539. }
  6540. });
  6541. }
  6542. }
  6543. }
  6544. class CircleAnnotation extends MarkupAnnotation {
  6545. constructor(parameters) {
  6546. super(parameters);
  6547. this.data.annotationType = _util.AnnotationType.CIRCLE;
  6548. if (!this.appearance) {
  6549. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6550. const strokeAlpha = parameters.dict.get("CA");
  6551. let fillColor = null;
  6552. let interiorColor = parameters.dict.getArray("IC");
  6553. if (interiorColor) {
  6554. interiorColor = getRgbColor(interiorColor, null);
  6555. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  6556. }
  6557. const fillAlpha = fillColor ? strokeAlpha : null;
  6558. if (this.borderStyle.width === 0 && !fillColor) {
  6559. return;
  6560. }
  6561. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  6562. this._setDefaultAppearance({
  6563. xref: parameters.xref,
  6564. extra: `${this.borderStyle.width} w`,
  6565. strokeColor,
  6566. fillColor,
  6567. strokeAlpha,
  6568. fillAlpha,
  6569. pointsCallback: (buffer, points) => {
  6570. const x0 = points[0].x + this.borderStyle.width / 2;
  6571. const y0 = points[0].y - this.borderStyle.width / 2;
  6572. const x1 = points[3].x - this.borderStyle.width / 2;
  6573. const y1 = points[3].y + this.borderStyle.width / 2;
  6574. const xMid = x0 + (x1 - x0) / 2;
  6575. const yMid = y0 + (y1 - y0) / 2;
  6576. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  6577. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  6578. 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");
  6579. if (fillColor) {
  6580. buffer.push("B");
  6581. } else {
  6582. buffer.push("S");
  6583. }
  6584. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6585. }
  6586. });
  6587. }
  6588. }
  6589. }
  6590. class PolylineAnnotation extends MarkupAnnotation {
  6591. constructor(parameters) {
  6592. super(parameters);
  6593. const {
  6594. dict
  6595. } = parameters;
  6596. this.data.annotationType = _util.AnnotationType.POLYLINE;
  6597. this.data.vertices = [];
  6598. if (!(this instanceof PolygonAnnotation)) {
  6599. this.setLineEndings(dict.getArray("LE"));
  6600. this.data.lineEndings = this.lineEndings;
  6601. }
  6602. const rawVertices = dict.getArray("Vertices");
  6603. if (!Array.isArray(rawVertices)) {
  6604. return;
  6605. }
  6606. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  6607. this.data.vertices.push({
  6608. x: rawVertices[i],
  6609. y: rawVertices[i + 1]
  6610. });
  6611. }
  6612. if (!this.appearance) {
  6613. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6614. const strokeAlpha = dict.get("CA");
  6615. const borderWidth = this.borderStyle.width || 1,
  6616. borderAdjust = 2 * borderWidth;
  6617. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6618. for (const vertex of this.data.vertices) {
  6619. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6620. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6621. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6622. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6623. }
  6624. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6625. this.rectangle = bbox;
  6626. }
  6627. this._setDefaultAppearance({
  6628. xref: parameters.xref,
  6629. extra: `${borderWidth} w`,
  6630. strokeColor,
  6631. strokeAlpha,
  6632. pointsCallback: (buffer, points) => {
  6633. const vertices = this.data.vertices;
  6634. for (let i = 0, ii = vertices.length; i < ii; i++) {
  6635. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  6636. }
  6637. buffer.push("S");
  6638. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6639. }
  6640. });
  6641. }
  6642. }
  6643. }
  6644. class PolygonAnnotation extends PolylineAnnotation {
  6645. constructor(parameters) {
  6646. super(parameters);
  6647. this.data.annotationType = _util.AnnotationType.POLYGON;
  6648. }
  6649. }
  6650. class CaretAnnotation extends MarkupAnnotation {
  6651. constructor(parameters) {
  6652. super(parameters);
  6653. this.data.annotationType = _util.AnnotationType.CARET;
  6654. }
  6655. }
  6656. class InkAnnotation extends MarkupAnnotation {
  6657. constructor(parameters) {
  6658. super(parameters);
  6659. this.data.annotationType = _util.AnnotationType.INK;
  6660. this.data.inkLists = [];
  6661. const rawInkLists = parameters.dict.getArray("InkList");
  6662. if (!Array.isArray(rawInkLists)) {
  6663. return;
  6664. }
  6665. const xref = parameters.xref;
  6666. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  6667. this.data.inkLists.push([]);
  6668. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  6669. this.data.inkLists[i].push({
  6670. x: xref.fetchIfRef(rawInkLists[i][j]),
  6671. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  6672. });
  6673. }
  6674. }
  6675. if (!this.appearance) {
  6676. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6677. const strokeAlpha = parameters.dict.get("CA");
  6678. const borderWidth = this.borderStyle.width || 1,
  6679. borderAdjust = 2 * borderWidth;
  6680. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6681. for (const inkLists of this.data.inkLists) {
  6682. for (const vertex of inkLists) {
  6683. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6684. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6685. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6686. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6687. }
  6688. }
  6689. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6690. this.rectangle = bbox;
  6691. }
  6692. this._setDefaultAppearance({
  6693. xref: parameters.xref,
  6694. extra: `${borderWidth} w`,
  6695. strokeColor,
  6696. strokeAlpha,
  6697. pointsCallback: (buffer, points) => {
  6698. for (const inkList of this.data.inkLists) {
  6699. for (let i = 0, ii = inkList.length; i < ii; i++) {
  6700. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  6701. }
  6702. buffer.push("S");
  6703. }
  6704. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6705. }
  6706. });
  6707. }
  6708. }
  6709. static createNewDict(annotation, xref, {
  6710. apRef,
  6711. ap
  6712. }) {
  6713. const {
  6714. paths,
  6715. rect,
  6716. rotation
  6717. } = annotation;
  6718. const ink = new _primitives.Dict(xref);
  6719. ink.set("Type", _primitives.Name.get("Annot"));
  6720. ink.set("Subtype", _primitives.Name.get("Ink"));
  6721. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6722. ink.set("Rect", rect);
  6723. ink.set("InkList", paths.map(p => p.points));
  6724. ink.set("F", 4);
  6725. ink.set("Border", [0, 0, 0]);
  6726. ink.set("Rotate", rotation);
  6727. const n = new _primitives.Dict(xref);
  6728. ink.set("AP", n);
  6729. if (apRef) {
  6730. n.set("N", apRef);
  6731. } else {
  6732. n.set("N", ap);
  6733. }
  6734. return ink;
  6735. }
  6736. static async createNewAppearanceStream(annotation, xref, params) {
  6737. const {
  6738. color,
  6739. rect,
  6740. rotation,
  6741. paths,
  6742. thickness,
  6743. opacity
  6744. } = annotation;
  6745. const [x1, y1, x2, y2] = rect;
  6746. let w = x2 - x1;
  6747. let h = y2 - y1;
  6748. if (rotation % 180 !== 0) {
  6749. [w, h] = [h, w];
  6750. }
  6751. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  6752. if (opacity !== 1) {
  6753. appearanceBuffer.push("/R0 gs");
  6754. }
  6755. const buffer = [];
  6756. for (const {
  6757. bezier
  6758. } of paths) {
  6759. buffer.length = 0;
  6760. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  6761. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  6762. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  6763. buffer.push(`${curve} c`);
  6764. }
  6765. buffer.push("S");
  6766. appearanceBuffer.push(buffer.join("\n"));
  6767. }
  6768. const appearance = appearanceBuffer.join("\n");
  6769. const appearanceStreamDict = new _primitives.Dict(xref);
  6770. appearanceStreamDict.set("FormType", 1);
  6771. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6772. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6773. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6774. appearanceStreamDict.set("Length", appearance.length);
  6775. if (rotation) {
  6776. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  6777. appearanceStreamDict.set("Matrix", matrix);
  6778. }
  6779. if (opacity !== 1) {
  6780. const resources = new _primitives.Dict(xref);
  6781. const extGState = new _primitives.Dict(xref);
  6782. const r0 = new _primitives.Dict(xref);
  6783. r0.set("CA", opacity);
  6784. r0.set("Type", _primitives.Name.get("ExtGState"));
  6785. extGState.set("R0", r0);
  6786. resources.set("ExtGState", extGState);
  6787. appearanceStreamDict.set("Resources", resources);
  6788. }
  6789. const ap = new _stream.StringStream(appearance);
  6790. ap.dict = appearanceStreamDict;
  6791. return ap;
  6792. }
  6793. }
  6794. class HighlightAnnotation extends MarkupAnnotation {
  6795. constructor(parameters) {
  6796. super(parameters);
  6797. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  6798. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6799. if (quadPoints) {
  6800. const resources = this.appearance && this.appearance.dict.get("Resources");
  6801. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  6802. if (this.appearance) {
  6803. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  6804. }
  6805. const fillColor = this.color ? Array.from(this.color, c => c / 255) : [1, 1, 0];
  6806. const fillAlpha = parameters.dict.get("CA");
  6807. this._setDefaultAppearance({
  6808. xref: parameters.xref,
  6809. fillColor,
  6810. blendMode: "Multiply",
  6811. fillAlpha,
  6812. pointsCallback: (buffer, points) => {
  6813. 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");
  6814. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6815. }
  6816. });
  6817. }
  6818. } else {
  6819. this.data.hasPopup = false;
  6820. }
  6821. }
  6822. }
  6823. class UnderlineAnnotation extends MarkupAnnotation {
  6824. constructor(parameters) {
  6825. super(parameters);
  6826. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  6827. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6828. if (quadPoints) {
  6829. if (!this.appearance) {
  6830. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6831. const strokeAlpha = parameters.dict.get("CA");
  6832. this._setDefaultAppearance({
  6833. xref: parameters.xref,
  6834. extra: "[] 0 d 1 w",
  6835. strokeColor,
  6836. strokeAlpha,
  6837. pointsCallback: (buffer, points) => {
  6838. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  6839. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6840. }
  6841. });
  6842. }
  6843. } else {
  6844. this.data.hasPopup = false;
  6845. }
  6846. }
  6847. }
  6848. class SquigglyAnnotation extends MarkupAnnotation {
  6849. constructor(parameters) {
  6850. super(parameters);
  6851. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  6852. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6853. if (quadPoints) {
  6854. if (!this.appearance) {
  6855. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6856. const strokeAlpha = parameters.dict.get("CA");
  6857. this._setDefaultAppearance({
  6858. xref: parameters.xref,
  6859. extra: "[] 0 d 1 w",
  6860. strokeColor,
  6861. strokeAlpha,
  6862. pointsCallback: (buffer, points) => {
  6863. const dy = (points[0].y - points[2].y) / 6;
  6864. let shift = dy;
  6865. let x = points[2].x;
  6866. const y = points[2].y;
  6867. const xEnd = points[3].x;
  6868. buffer.push(`${x} ${y + shift} m`);
  6869. do {
  6870. x += 2;
  6871. shift = shift === 0 ? dy : 0;
  6872. buffer.push(`${x} ${y + shift} l`);
  6873. } while (x < xEnd);
  6874. buffer.push("S");
  6875. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  6876. }
  6877. });
  6878. }
  6879. } else {
  6880. this.data.hasPopup = false;
  6881. }
  6882. }
  6883. }
  6884. class StrikeOutAnnotation extends MarkupAnnotation {
  6885. constructor(parameters) {
  6886. super(parameters);
  6887. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  6888. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6889. if (quadPoints) {
  6890. if (!this.appearance) {
  6891. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  6892. const strokeAlpha = parameters.dict.get("CA");
  6893. this._setDefaultAppearance({
  6894. xref: parameters.xref,
  6895. extra: "[] 0 d 1 w",
  6896. strokeColor,
  6897. strokeAlpha,
  6898. pointsCallback: (buffer, points) => {
  6899. 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");
  6900. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6901. }
  6902. });
  6903. }
  6904. } else {
  6905. this.data.hasPopup = false;
  6906. }
  6907. }
  6908. }
  6909. class StampAnnotation extends MarkupAnnotation {
  6910. constructor(parameters) {
  6911. super(parameters);
  6912. this.data.annotationType = _util.AnnotationType.STAMP;
  6913. }
  6914. }
  6915. class FileAttachmentAnnotation extends MarkupAnnotation {
  6916. constructor(parameters) {
  6917. super(parameters);
  6918. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  6919. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  6920. this.data.file = file.serializable;
  6921. }
  6922. }
  6923. /***/ }),
  6924. /* 11 */
  6925. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6926. Object.defineProperty(exports, "__esModule", ({
  6927. value: true
  6928. }));
  6929. exports.createDefaultAppearance = createDefaultAppearance;
  6930. exports.getPdfColor = getPdfColor;
  6931. exports.parseDefaultAppearance = parseDefaultAppearance;
  6932. var _core_utils = __w_pdfjs_require__(4);
  6933. var _util = __w_pdfjs_require__(2);
  6934. var _colorspace = __w_pdfjs_require__(12);
  6935. var _evaluator = __w_pdfjs_require__(13);
  6936. var _primitives = __w_pdfjs_require__(3);
  6937. var _stream = __w_pdfjs_require__(8);
  6938. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  6939. constructor(str) {
  6940. super(new _stream.StringStream(str));
  6941. }
  6942. parse() {
  6943. const operation = {
  6944. fn: 0,
  6945. args: []
  6946. };
  6947. const result = {
  6948. fontSize: 0,
  6949. fontName: "",
  6950. fontColor: new Uint8ClampedArray(3)
  6951. };
  6952. try {
  6953. while (true) {
  6954. operation.args.length = 0;
  6955. if (!this.read(operation)) {
  6956. break;
  6957. }
  6958. if (this.savedStatesDepth !== 0) {
  6959. continue;
  6960. }
  6961. const {
  6962. fn,
  6963. args
  6964. } = operation;
  6965. switch (fn | 0) {
  6966. case _util.OPS.setFont:
  6967. const [fontName, fontSize] = args;
  6968. if (fontName instanceof _primitives.Name) {
  6969. result.fontName = fontName.name;
  6970. }
  6971. if (typeof fontSize === "number" && fontSize > 0) {
  6972. result.fontSize = fontSize;
  6973. }
  6974. break;
  6975. case _util.OPS.setFillRGBColor:
  6976. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  6977. break;
  6978. case _util.OPS.setFillGray:
  6979. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  6980. break;
  6981. case _util.OPS.setFillColorSpace:
  6982. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  6983. break;
  6984. }
  6985. }
  6986. } catch (reason) {
  6987. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  6988. }
  6989. return result;
  6990. }
  6991. }
  6992. function parseDefaultAppearance(str) {
  6993. return new DefaultAppearanceEvaluator(str).parse();
  6994. }
  6995. function getPdfColor(color, isFill) {
  6996. if (color[0] === color[1] && color[1] === color[2]) {
  6997. const gray = color[0] / 255;
  6998. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  6999. }
  7000. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  7001. }
  7002. function createDefaultAppearance({
  7003. fontSize,
  7004. fontName,
  7005. fontColor
  7006. }) {
  7007. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  7008. }
  7009. /***/ }),
  7010. /* 12 */
  7011. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7012. Object.defineProperty(exports, "__esModule", ({
  7013. value: true
  7014. }));
  7015. exports.ColorSpace = void 0;
  7016. var _util = __w_pdfjs_require__(2);
  7017. var _primitives = __w_pdfjs_require__(3);
  7018. var _base_stream = __w_pdfjs_require__(5);
  7019. var _core_utils = __w_pdfjs_require__(4);
  7020. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  7021. const COMPONENTS = 3;
  7022. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  7023. const xRatio = w1 / w2;
  7024. const yRatio = h1 / h2;
  7025. let newIndex = 0,
  7026. oldIndex;
  7027. const xScaled = new Uint16Array(w2);
  7028. const w1Scanline = w1 * COMPONENTS;
  7029. for (let i = 0; i < w2; i++) {
  7030. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  7031. }
  7032. for (let i = 0; i < h2; i++) {
  7033. const py = Math.floor(i * yRatio) * w1Scanline;
  7034. for (let j = 0; j < w2; j++) {
  7035. oldIndex = py + xScaled[j];
  7036. dest[newIndex++] = src[oldIndex++];
  7037. dest[newIndex++] = src[oldIndex++];
  7038. dest[newIndex++] = src[oldIndex++];
  7039. newIndex += alpha01;
  7040. }
  7041. }
  7042. }
  7043. class ColorSpace {
  7044. constructor(name, numComps) {
  7045. if (this.constructor === ColorSpace) {
  7046. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  7047. }
  7048. this.name = name;
  7049. this.numComps = numComps;
  7050. }
  7051. getRgb(src, srcOffset) {
  7052. const rgb = new Uint8ClampedArray(3);
  7053. this.getRgbItem(src, srcOffset, rgb, 0);
  7054. return rgb;
  7055. }
  7056. getRgbItem(src, srcOffset, dest, destOffset) {
  7057. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  7058. }
  7059. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7060. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  7061. }
  7062. getOutputLength(inputLength, alpha01) {
  7063. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  7064. }
  7065. isPassthrough(bits) {
  7066. return false;
  7067. }
  7068. isDefaultDecode(decodeMap, bpc) {
  7069. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  7070. }
  7071. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  7072. const count = originalWidth * originalHeight;
  7073. let rgbBuf = null;
  7074. const numComponentColors = 1 << bpc;
  7075. const needsResizing = originalHeight !== height || originalWidth !== width;
  7076. if (this.isPassthrough(bpc)) {
  7077. rgbBuf = comps;
  7078. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  7079. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  7080. for (let i = 0; i < numComponentColors; i++) {
  7081. allColors[i] = i;
  7082. }
  7083. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  7084. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  7085. if (!needsResizing) {
  7086. let destPos = 0;
  7087. for (let i = 0; i < count; ++i) {
  7088. const key = comps[i] * 3;
  7089. dest[destPos++] = colorMap[key];
  7090. dest[destPos++] = colorMap[key + 1];
  7091. dest[destPos++] = colorMap[key + 2];
  7092. destPos += alpha01;
  7093. }
  7094. } else {
  7095. rgbBuf = new Uint8Array(count * 3);
  7096. let rgbPos = 0;
  7097. for (let i = 0; i < count; ++i) {
  7098. const key = comps[i] * 3;
  7099. rgbBuf[rgbPos++] = colorMap[key];
  7100. rgbBuf[rgbPos++] = colorMap[key + 1];
  7101. rgbBuf[rgbPos++] = colorMap[key + 2];
  7102. }
  7103. }
  7104. } else {
  7105. if (!needsResizing) {
  7106. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  7107. } else {
  7108. rgbBuf = new Uint8ClampedArray(count * 3);
  7109. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  7110. }
  7111. }
  7112. if (rgbBuf) {
  7113. if (needsResizing) {
  7114. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  7115. } else {
  7116. let destPos = 0,
  7117. rgbPos = 0;
  7118. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  7119. dest[destPos++] = rgbBuf[rgbPos++];
  7120. dest[destPos++] = rgbBuf[rgbPos++];
  7121. dest[destPos++] = rgbBuf[rgbPos++];
  7122. destPos += alpha01;
  7123. }
  7124. }
  7125. }
  7126. }
  7127. get usesZeroToOneRange() {
  7128. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  7129. }
  7130. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  7131. if (!localColorSpaceCache) {
  7132. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  7133. }
  7134. if (!parsedColorSpace) {
  7135. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  7136. }
  7137. let csName, csRef;
  7138. if (cacheKey instanceof _primitives.Ref) {
  7139. csRef = cacheKey;
  7140. cacheKey = xref.fetch(cacheKey);
  7141. }
  7142. if (cacheKey instanceof _primitives.Name) {
  7143. csName = cacheKey.name;
  7144. }
  7145. if (csName || csRef) {
  7146. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  7147. }
  7148. }
  7149. static getCached(cacheKey, xref, localColorSpaceCache) {
  7150. if (!localColorSpaceCache) {
  7151. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  7152. }
  7153. if (cacheKey instanceof _primitives.Ref) {
  7154. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  7155. if (localColorSpace) {
  7156. return localColorSpace;
  7157. }
  7158. try {
  7159. cacheKey = xref.fetch(cacheKey);
  7160. } catch (ex) {
  7161. if (ex instanceof _core_utils.MissingDataException) {
  7162. throw ex;
  7163. }
  7164. }
  7165. }
  7166. if (cacheKey instanceof _primitives.Name) {
  7167. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  7168. if (localColorSpace) {
  7169. return localColorSpace;
  7170. }
  7171. }
  7172. return null;
  7173. }
  7174. static async parseAsync({
  7175. cs,
  7176. xref,
  7177. resources = null,
  7178. pdfFunctionFactory,
  7179. localColorSpaceCache
  7180. }) {
  7181. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7182. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7183. return parsedColorSpace;
  7184. }
  7185. static parse({
  7186. cs,
  7187. xref,
  7188. resources = null,
  7189. pdfFunctionFactory,
  7190. localColorSpaceCache
  7191. }) {
  7192. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  7193. if (cachedColorSpace) {
  7194. return cachedColorSpace;
  7195. }
  7196. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7197. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7198. return parsedColorSpace;
  7199. }
  7200. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  7201. cs = xref.fetchIfRef(cs);
  7202. if (cs instanceof _primitives.Name) {
  7203. switch (cs.name) {
  7204. case "G":
  7205. case "DeviceGray":
  7206. return this.singletons.gray;
  7207. case "RGB":
  7208. case "DeviceRGB":
  7209. return this.singletons.rgb;
  7210. case "CMYK":
  7211. case "DeviceCMYK":
  7212. return this.singletons.cmyk;
  7213. case "Pattern":
  7214. return new PatternCS(null);
  7215. default:
  7216. if (resources instanceof _primitives.Dict) {
  7217. const colorSpaces = resources.get("ColorSpace");
  7218. if (colorSpaces instanceof _primitives.Dict) {
  7219. const resourcesCS = colorSpaces.get(cs.name);
  7220. if (resourcesCS) {
  7221. if (resourcesCS instanceof _primitives.Name) {
  7222. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  7223. }
  7224. cs = resourcesCS;
  7225. break;
  7226. }
  7227. }
  7228. }
  7229. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  7230. }
  7231. }
  7232. if (Array.isArray(cs)) {
  7233. const mode = xref.fetchIfRef(cs[0]).name;
  7234. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  7235. switch (mode) {
  7236. case "G":
  7237. case "DeviceGray":
  7238. return this.singletons.gray;
  7239. case "RGB":
  7240. case "DeviceRGB":
  7241. return this.singletons.rgb;
  7242. case "CMYK":
  7243. case "DeviceCMYK":
  7244. return this.singletons.cmyk;
  7245. case "CalGray":
  7246. params = xref.fetchIfRef(cs[1]);
  7247. whitePoint = params.getArray("WhitePoint");
  7248. blackPoint = params.getArray("BlackPoint");
  7249. gamma = params.get("Gamma");
  7250. return new CalGrayCS(whitePoint, blackPoint, gamma);
  7251. case "CalRGB":
  7252. params = xref.fetchIfRef(cs[1]);
  7253. whitePoint = params.getArray("WhitePoint");
  7254. blackPoint = params.getArray("BlackPoint");
  7255. gamma = params.getArray("Gamma");
  7256. const matrix = params.getArray("Matrix");
  7257. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  7258. case "ICCBased":
  7259. const stream = xref.fetchIfRef(cs[1]);
  7260. const dict = stream.dict;
  7261. numComps = dict.get("N");
  7262. const alt = dict.get("Alternate");
  7263. if (alt) {
  7264. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  7265. if (altCS.numComps === numComps) {
  7266. return altCS;
  7267. }
  7268. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  7269. }
  7270. if (numComps === 1) {
  7271. return this.singletons.gray;
  7272. } else if (numComps === 3) {
  7273. return this.singletons.rgb;
  7274. } else if (numComps === 4) {
  7275. return this.singletons.cmyk;
  7276. }
  7277. break;
  7278. case "Pattern":
  7279. baseCS = cs[1] || null;
  7280. if (baseCS) {
  7281. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  7282. }
  7283. return new PatternCS(baseCS);
  7284. case "I":
  7285. case "Indexed":
  7286. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  7287. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  7288. const lookup = xref.fetchIfRef(cs[3]);
  7289. return new IndexedCS(baseCS, hiVal, lookup);
  7290. case "Separation":
  7291. case "DeviceN":
  7292. const name = xref.fetchIfRef(cs[1]);
  7293. numComps = Array.isArray(name) ? name.length : 1;
  7294. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  7295. const tintFn = pdfFunctionFactory.create(cs[3]);
  7296. return new AlternateCS(numComps, baseCS, tintFn);
  7297. case "Lab":
  7298. params = xref.fetchIfRef(cs[1]);
  7299. whitePoint = params.getArray("WhitePoint");
  7300. blackPoint = params.getArray("BlackPoint");
  7301. const range = params.getArray("Range");
  7302. return new LabCS(whitePoint, blackPoint, range);
  7303. default:
  7304. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  7305. }
  7306. }
  7307. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  7308. }
  7309. static isDefaultDecode(decode, numComps) {
  7310. if (!Array.isArray(decode)) {
  7311. return true;
  7312. }
  7313. if (numComps * 2 !== decode.length) {
  7314. (0, _util.warn)("The decode map is not the correct length");
  7315. return true;
  7316. }
  7317. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  7318. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  7319. return false;
  7320. }
  7321. }
  7322. return true;
  7323. }
  7324. static get singletons() {
  7325. return (0, _util.shadow)(this, "singletons", {
  7326. get gray() {
  7327. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  7328. },
  7329. get rgb() {
  7330. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  7331. },
  7332. get cmyk() {
  7333. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  7334. }
  7335. });
  7336. }
  7337. }
  7338. exports.ColorSpace = ColorSpace;
  7339. class AlternateCS extends ColorSpace {
  7340. constructor(numComps, base, tintFn) {
  7341. super("Alternate", numComps);
  7342. this.base = base;
  7343. this.tintFn = tintFn;
  7344. this.tmpBuf = new Float32Array(base.numComps);
  7345. }
  7346. getRgbItem(src, srcOffset, dest, destOffset) {
  7347. const tmpBuf = this.tmpBuf;
  7348. this.tintFn(src, srcOffset, tmpBuf, 0);
  7349. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  7350. }
  7351. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7352. const tintFn = this.tintFn;
  7353. const base = this.base;
  7354. const scale = 1 / ((1 << bits) - 1);
  7355. const baseNumComps = base.numComps;
  7356. const usesZeroToOneRange = base.usesZeroToOneRange;
  7357. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  7358. let pos = isPassthrough ? destOffset : 0;
  7359. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  7360. const numComps = this.numComps;
  7361. const scaled = new Float32Array(numComps);
  7362. const tinted = new Float32Array(baseNumComps);
  7363. let i, j;
  7364. for (i = 0; i < count; i++) {
  7365. for (j = 0; j < numComps; j++) {
  7366. scaled[j] = src[srcOffset++] * scale;
  7367. }
  7368. tintFn(scaled, 0, tinted, 0);
  7369. if (usesZeroToOneRange) {
  7370. for (j = 0; j < baseNumComps; j++) {
  7371. baseBuf[pos++] = tinted[j] * 255;
  7372. }
  7373. } else {
  7374. base.getRgbItem(tinted, 0, baseBuf, pos);
  7375. pos += baseNumComps;
  7376. }
  7377. }
  7378. if (!isPassthrough) {
  7379. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  7380. }
  7381. }
  7382. getOutputLength(inputLength, alpha01) {
  7383. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  7384. }
  7385. }
  7386. class PatternCS extends ColorSpace {
  7387. constructor(baseCS) {
  7388. super("Pattern", null);
  7389. this.base = baseCS;
  7390. }
  7391. isDefaultDecode(decodeMap, bpc) {
  7392. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  7393. }
  7394. }
  7395. class IndexedCS extends ColorSpace {
  7396. constructor(base, highVal, lookup) {
  7397. super("Indexed", 1);
  7398. this.base = base;
  7399. this.highVal = highVal;
  7400. const length = base.numComps * highVal;
  7401. this.lookup = new Uint8Array(length);
  7402. if (lookup instanceof _base_stream.BaseStream) {
  7403. const bytes = lookup.getBytes(length);
  7404. this.lookup.set(bytes);
  7405. } else if (typeof lookup === "string") {
  7406. for (let i = 0; i < length; ++i) {
  7407. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  7408. }
  7409. } else {
  7410. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  7411. }
  7412. }
  7413. getRgbItem(src, srcOffset, dest, destOffset) {
  7414. const numComps = this.base.numComps;
  7415. const start = src[srcOffset] * numComps;
  7416. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  7417. }
  7418. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7419. const base = this.base;
  7420. const numComps = base.numComps;
  7421. const outputDelta = base.getOutputLength(numComps, alpha01);
  7422. const lookup = this.lookup;
  7423. for (let i = 0; i < count; ++i) {
  7424. const lookupPos = src[srcOffset++] * numComps;
  7425. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  7426. destOffset += outputDelta;
  7427. }
  7428. }
  7429. getOutputLength(inputLength, alpha01) {
  7430. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  7431. }
  7432. isDefaultDecode(decodeMap, bpc) {
  7433. if (!Array.isArray(decodeMap)) {
  7434. return true;
  7435. }
  7436. if (decodeMap.length !== 2) {
  7437. (0, _util.warn)("Decode map length is not correct");
  7438. return true;
  7439. }
  7440. if (!Number.isInteger(bpc) || bpc < 1) {
  7441. (0, _util.warn)("Bits per component is not correct");
  7442. return true;
  7443. }
  7444. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  7445. }
  7446. }
  7447. class DeviceGrayCS extends ColorSpace {
  7448. constructor() {
  7449. super("DeviceGray", 1);
  7450. }
  7451. getRgbItem(src, srcOffset, dest, destOffset) {
  7452. const c = src[srcOffset] * 255;
  7453. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  7454. }
  7455. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7456. const scale = 255 / ((1 << bits) - 1);
  7457. let j = srcOffset,
  7458. q = destOffset;
  7459. for (let i = 0; i < count; ++i) {
  7460. const c = scale * src[j++];
  7461. dest[q++] = c;
  7462. dest[q++] = c;
  7463. dest[q++] = c;
  7464. q += alpha01;
  7465. }
  7466. }
  7467. getOutputLength(inputLength, alpha01) {
  7468. return inputLength * (3 + alpha01);
  7469. }
  7470. }
  7471. class DeviceRgbCS extends ColorSpace {
  7472. constructor() {
  7473. super("DeviceRGB", 3);
  7474. }
  7475. getRgbItem(src, srcOffset, dest, destOffset) {
  7476. dest[destOffset] = src[srcOffset] * 255;
  7477. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  7478. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  7479. }
  7480. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7481. if (bits === 8 && alpha01 === 0) {
  7482. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  7483. return;
  7484. }
  7485. const scale = 255 / ((1 << bits) - 1);
  7486. let j = srcOffset,
  7487. q = destOffset;
  7488. for (let i = 0; i < count; ++i) {
  7489. dest[q++] = scale * src[j++];
  7490. dest[q++] = scale * src[j++];
  7491. dest[q++] = scale * src[j++];
  7492. q += alpha01;
  7493. }
  7494. }
  7495. getOutputLength(inputLength, alpha01) {
  7496. return inputLength * (3 + alpha01) / 3 | 0;
  7497. }
  7498. isPassthrough(bits) {
  7499. return bits === 8;
  7500. }
  7501. }
  7502. const DeviceCmykCS = function DeviceCmykCSClosure() {
  7503. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  7504. const c = src[srcOffset] * srcScale;
  7505. const m = src[srcOffset + 1] * srcScale;
  7506. const y = src[srcOffset + 2] * srcScale;
  7507. const k = src[srcOffset + 3] * srcScale;
  7508. 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);
  7509. 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);
  7510. 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);
  7511. }
  7512. class DeviceCmykCS extends ColorSpace {
  7513. constructor() {
  7514. super("DeviceCMYK", 4);
  7515. }
  7516. getRgbItem(src, srcOffset, dest, destOffset) {
  7517. convertToRgb(src, srcOffset, 1, dest, destOffset);
  7518. }
  7519. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7520. const scale = 1 / ((1 << bits) - 1);
  7521. for (let i = 0; i < count; i++) {
  7522. convertToRgb(src, srcOffset, scale, dest, destOffset);
  7523. srcOffset += 4;
  7524. destOffset += 3 + alpha01;
  7525. }
  7526. }
  7527. getOutputLength(inputLength, alpha01) {
  7528. return inputLength / 4 * (3 + alpha01) | 0;
  7529. }
  7530. }
  7531. return DeviceCmykCS;
  7532. }();
  7533. const CalGrayCS = function CalGrayCSClosure() {
  7534. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7535. const A = src[srcOffset] * scale;
  7536. const AG = A ** cs.G;
  7537. const L = cs.YW * AG;
  7538. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  7539. dest[destOffset] = val;
  7540. dest[destOffset + 1] = val;
  7541. dest[destOffset + 2] = val;
  7542. }
  7543. class CalGrayCS extends ColorSpace {
  7544. constructor(whitePoint, blackPoint, gamma) {
  7545. super("CalGray", 1);
  7546. if (!whitePoint) {
  7547. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  7548. }
  7549. blackPoint = blackPoint || [0, 0, 0];
  7550. gamma = gamma || 1;
  7551. this.XW = whitePoint[0];
  7552. this.YW = whitePoint[1];
  7553. this.ZW = whitePoint[2];
  7554. this.XB = blackPoint[0];
  7555. this.YB = blackPoint[1];
  7556. this.ZB = blackPoint[2];
  7557. this.G = gamma;
  7558. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7559. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7560. }
  7561. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7562. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  7563. this.XB = this.YB = this.ZB = 0;
  7564. }
  7565. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  7566. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  7567. }
  7568. if (this.G < 1) {
  7569. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  7570. this.G = 1;
  7571. }
  7572. }
  7573. getRgbItem(src, srcOffset, dest, destOffset) {
  7574. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7575. }
  7576. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7577. const scale = 1 / ((1 << bits) - 1);
  7578. for (let i = 0; i < count; ++i) {
  7579. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7580. srcOffset += 1;
  7581. destOffset += 3 + alpha01;
  7582. }
  7583. }
  7584. getOutputLength(inputLength, alpha01) {
  7585. return inputLength * (3 + alpha01);
  7586. }
  7587. }
  7588. return CalGrayCS;
  7589. }();
  7590. const CalRGBCS = function CalRGBCSClosure() {
  7591. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  7592. 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]);
  7593. 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]);
  7594. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  7595. const tempNormalizeMatrix = new Float32Array(3);
  7596. const tempConvertMatrix1 = new Float32Array(3);
  7597. const tempConvertMatrix2 = new Float32Array(3);
  7598. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  7599. function matrixProduct(a, b, result) {
  7600. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  7601. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  7602. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  7603. }
  7604. function convertToFlat(sourceWhitePoint, LMS, result) {
  7605. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  7606. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  7607. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  7608. }
  7609. function convertToD65(sourceWhitePoint, LMS, result) {
  7610. const D65X = 0.95047;
  7611. const D65Y = 1;
  7612. const D65Z = 1.08883;
  7613. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  7614. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  7615. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  7616. }
  7617. function sRGBTransferFunction(color) {
  7618. if (color <= 0.0031308) {
  7619. return adjustToRange(0, 1, 12.92 * color);
  7620. }
  7621. if (color >= 0.99554525) {
  7622. return 1;
  7623. }
  7624. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  7625. }
  7626. function adjustToRange(min, max, value) {
  7627. return Math.max(min, Math.min(max, value));
  7628. }
  7629. function decodeL(L) {
  7630. if (L < 0) {
  7631. return -decodeL(-L);
  7632. }
  7633. if (L > 8.0) {
  7634. return ((L + 16) / 116) ** 3;
  7635. }
  7636. return L * DECODE_L_CONSTANT;
  7637. }
  7638. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  7639. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  7640. result[0] = XYZ_Flat[0];
  7641. result[1] = XYZ_Flat[1];
  7642. result[2] = XYZ_Flat[2];
  7643. return;
  7644. }
  7645. const zeroDecodeL = decodeL(0);
  7646. const X_DST = zeroDecodeL;
  7647. const X_SRC = decodeL(sourceBlackPoint[0]);
  7648. const Y_DST = zeroDecodeL;
  7649. const Y_SRC = decodeL(sourceBlackPoint[1]);
  7650. const Z_DST = zeroDecodeL;
  7651. const Z_SRC = decodeL(sourceBlackPoint[2]);
  7652. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  7653. const X_Offset = 1 - X_Scale;
  7654. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  7655. const Y_Offset = 1 - Y_Scale;
  7656. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  7657. const Z_Offset = 1 - Z_Scale;
  7658. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  7659. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  7660. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  7661. }
  7662. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  7663. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  7664. result[0] = XYZ_In[0];
  7665. result[1] = XYZ_In[1];
  7666. result[2] = XYZ_In[2];
  7667. return;
  7668. }
  7669. const LMS = result;
  7670. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  7671. const LMS_Flat = tempNormalizeMatrix;
  7672. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  7673. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  7674. }
  7675. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  7676. const LMS = result;
  7677. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  7678. const LMS_D65 = tempNormalizeMatrix;
  7679. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  7680. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  7681. }
  7682. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7683. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  7684. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  7685. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  7686. const AGR = A === 1 ? 1 : A ** cs.GR;
  7687. const BGG = B === 1 ? 1 : B ** cs.GG;
  7688. const CGB = C === 1 ? 1 : C ** cs.GB;
  7689. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  7690. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  7691. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  7692. const XYZ = tempConvertMatrix1;
  7693. XYZ[0] = X;
  7694. XYZ[1] = Y;
  7695. XYZ[2] = Z;
  7696. const XYZ_Flat = tempConvertMatrix2;
  7697. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  7698. const XYZ_Black = tempConvertMatrix1;
  7699. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  7700. const XYZ_D65 = tempConvertMatrix2;
  7701. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  7702. const SRGB = tempConvertMatrix1;
  7703. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  7704. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  7705. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  7706. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  7707. }
  7708. class CalRGBCS extends ColorSpace {
  7709. constructor(whitePoint, blackPoint, gamma, matrix) {
  7710. super("CalRGB", 3);
  7711. if (!whitePoint) {
  7712. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  7713. }
  7714. blackPoint = blackPoint || new Float32Array(3);
  7715. gamma = gamma || new Float32Array([1, 1, 1]);
  7716. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  7717. const XW = whitePoint[0];
  7718. const YW = whitePoint[1];
  7719. const ZW = whitePoint[2];
  7720. this.whitePoint = whitePoint;
  7721. const XB = blackPoint[0];
  7722. const YB = blackPoint[1];
  7723. const ZB = blackPoint[2];
  7724. this.blackPoint = blackPoint;
  7725. this.GR = gamma[0];
  7726. this.GG = gamma[1];
  7727. this.GB = gamma[2];
  7728. this.MXA = matrix[0];
  7729. this.MYA = matrix[1];
  7730. this.MZA = matrix[2];
  7731. this.MXB = matrix[3];
  7732. this.MYB = matrix[4];
  7733. this.MZB = matrix[5];
  7734. this.MXC = matrix[6];
  7735. this.MYC = matrix[7];
  7736. this.MZC = matrix[8];
  7737. if (XW < 0 || ZW < 0 || YW !== 1) {
  7738. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7739. }
  7740. if (XB < 0 || YB < 0 || ZB < 0) {
  7741. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  7742. this.blackPoint = new Float32Array(3);
  7743. }
  7744. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  7745. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  7746. this.GR = this.GG = this.GB = 1;
  7747. }
  7748. }
  7749. getRgbItem(src, srcOffset, dest, destOffset) {
  7750. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7751. }
  7752. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7753. const scale = 1 / ((1 << bits) - 1);
  7754. for (let i = 0; i < count; ++i) {
  7755. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7756. srcOffset += 3;
  7757. destOffset += 3 + alpha01;
  7758. }
  7759. }
  7760. getOutputLength(inputLength, alpha01) {
  7761. return inputLength * (3 + alpha01) / 3 | 0;
  7762. }
  7763. }
  7764. return CalRGBCS;
  7765. }();
  7766. const LabCS = function LabCSClosure() {
  7767. function fn_g(x) {
  7768. let result;
  7769. if (x >= 6 / 29) {
  7770. result = x ** 3;
  7771. } else {
  7772. result = 108 / 841 * (x - 4 / 29);
  7773. }
  7774. return result;
  7775. }
  7776. function decode(value, high1, low2, high2) {
  7777. return low2 + value * (high2 - low2) / high1;
  7778. }
  7779. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  7780. let Ls = src[srcOffset];
  7781. let as = src[srcOffset + 1];
  7782. let bs = src[srcOffset + 2];
  7783. if (maxVal !== false) {
  7784. Ls = decode(Ls, maxVal, 0, 100);
  7785. as = decode(as, maxVal, cs.amin, cs.amax);
  7786. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  7787. }
  7788. if (as > cs.amax) {
  7789. as = cs.amax;
  7790. } else if (as < cs.amin) {
  7791. as = cs.amin;
  7792. }
  7793. if (bs > cs.bmax) {
  7794. bs = cs.bmax;
  7795. } else if (bs < cs.bmin) {
  7796. bs = cs.bmin;
  7797. }
  7798. const M = (Ls + 16) / 116;
  7799. const L = M + as / 500;
  7800. const N = M - bs / 200;
  7801. const X = cs.XW * fn_g(L);
  7802. const Y = cs.YW * fn_g(M);
  7803. const Z = cs.ZW * fn_g(N);
  7804. let r, g, b;
  7805. if (cs.ZW < 1) {
  7806. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  7807. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  7808. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  7809. } else {
  7810. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  7811. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  7812. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  7813. }
  7814. dest[destOffset] = Math.sqrt(r) * 255;
  7815. dest[destOffset + 1] = Math.sqrt(g) * 255;
  7816. dest[destOffset + 2] = Math.sqrt(b) * 255;
  7817. }
  7818. class LabCS extends ColorSpace {
  7819. constructor(whitePoint, blackPoint, range) {
  7820. super("Lab", 3);
  7821. if (!whitePoint) {
  7822. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  7823. }
  7824. blackPoint = blackPoint || [0, 0, 0];
  7825. range = range || [-100, 100, -100, 100];
  7826. this.XW = whitePoint[0];
  7827. this.YW = whitePoint[1];
  7828. this.ZW = whitePoint[2];
  7829. this.amin = range[0];
  7830. this.amax = range[1];
  7831. this.bmin = range[2];
  7832. this.bmax = range[3];
  7833. this.XB = blackPoint[0];
  7834. this.YB = blackPoint[1];
  7835. this.ZB = blackPoint[2];
  7836. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7837. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  7838. }
  7839. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7840. (0, _util.info)("Invalid BlackPoint, falling back to default");
  7841. this.XB = this.YB = this.ZB = 0;
  7842. }
  7843. if (this.amin > this.amax || this.bmin > this.bmax) {
  7844. (0, _util.info)("Invalid Range, falling back to defaults");
  7845. this.amin = -100;
  7846. this.amax = 100;
  7847. this.bmin = -100;
  7848. this.bmax = 100;
  7849. }
  7850. }
  7851. getRgbItem(src, srcOffset, dest, destOffset) {
  7852. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  7853. }
  7854. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7855. const maxVal = (1 << bits) - 1;
  7856. for (let i = 0; i < count; i++) {
  7857. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  7858. srcOffset += 3;
  7859. destOffset += 3 + alpha01;
  7860. }
  7861. }
  7862. getOutputLength(inputLength, alpha01) {
  7863. return inputLength * (3 + alpha01) / 3 | 0;
  7864. }
  7865. isDefaultDecode(decodeMap, bpc) {
  7866. return true;
  7867. }
  7868. get usesZeroToOneRange() {
  7869. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  7870. }
  7871. }
  7872. return LabCS;
  7873. }();
  7874. /***/ }),
  7875. /* 13 */
  7876. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7877. Object.defineProperty(exports, "__esModule", ({
  7878. value: true
  7879. }));
  7880. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  7881. var _util = __w_pdfjs_require__(2);
  7882. var _cmap = __w_pdfjs_require__(14);
  7883. var _primitives = __w_pdfjs_require__(3);
  7884. var _fonts = __w_pdfjs_require__(32);
  7885. var _fonts_utils = __w_pdfjs_require__(36);
  7886. var _encodings = __w_pdfjs_require__(35);
  7887. var _standard_fonts = __w_pdfjs_require__(39);
  7888. var _unicode = __w_pdfjs_require__(38);
  7889. var _pattern = __w_pdfjs_require__(48);
  7890. var _xfa_fonts = __w_pdfjs_require__(49);
  7891. var _to_unicode_map = __w_pdfjs_require__(40);
  7892. var _function = __w_pdfjs_require__(55);
  7893. var _parser = __w_pdfjs_require__(15);
  7894. var _image_utils = __w_pdfjs_require__(57);
  7895. var _stream = __w_pdfjs_require__(8);
  7896. var _base_stream = __w_pdfjs_require__(5);
  7897. var _bidi = __w_pdfjs_require__(58);
  7898. var _colorspace = __w_pdfjs_require__(12);
  7899. var _decode_stream = __w_pdfjs_require__(17);
  7900. var _glyphlist = __w_pdfjs_require__(37);
  7901. var _core_utils = __w_pdfjs_require__(4);
  7902. var _metrics = __w_pdfjs_require__(43);
  7903. var _murmurhash = __w_pdfjs_require__(59);
  7904. var _operator_list = __w_pdfjs_require__(60);
  7905. var _image = __w_pdfjs_require__(61);
  7906. const DefaultPartialEvaluatorOptions = Object.freeze({
  7907. maxImageSize: -1,
  7908. disableFontFace: false,
  7909. ignoreErrors: false,
  7910. isEvalSupported: true,
  7911. isOffscreenCanvasSupported: true,
  7912. fontExtraProperties: false,
  7913. useSystemFonts: true,
  7914. cMapUrl: null,
  7915. standardFontDataUrl: null
  7916. });
  7917. const PatternType = {
  7918. TILING: 1,
  7919. SHADING: 2
  7920. };
  7921. const TEXT_CHUNK_BATCH_SIZE = 10;
  7922. const deferred = Promise.resolve();
  7923. function normalizeBlendMode(value, parsingArray = false) {
  7924. if (Array.isArray(value)) {
  7925. for (const val of value) {
  7926. const maybeBM = normalizeBlendMode(val, true);
  7927. if (maybeBM) {
  7928. return maybeBM;
  7929. }
  7930. }
  7931. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  7932. return "source-over";
  7933. }
  7934. if (!(value instanceof _primitives.Name)) {
  7935. if (parsingArray) {
  7936. return null;
  7937. }
  7938. return "source-over";
  7939. }
  7940. switch (value.name) {
  7941. case "Normal":
  7942. case "Compatible":
  7943. return "source-over";
  7944. case "Multiply":
  7945. return "multiply";
  7946. case "Screen":
  7947. return "screen";
  7948. case "Overlay":
  7949. return "overlay";
  7950. case "Darken":
  7951. return "darken";
  7952. case "Lighten":
  7953. return "lighten";
  7954. case "ColorDodge":
  7955. return "color-dodge";
  7956. case "ColorBurn":
  7957. return "color-burn";
  7958. case "HardLight":
  7959. return "hard-light";
  7960. case "SoftLight":
  7961. return "soft-light";
  7962. case "Difference":
  7963. return "difference";
  7964. case "Exclusion":
  7965. return "exclusion";
  7966. case "Hue":
  7967. return "hue";
  7968. case "Saturation":
  7969. return "saturation";
  7970. case "Color":
  7971. return "color";
  7972. case "Luminosity":
  7973. return "luminosity";
  7974. }
  7975. if (parsingArray) {
  7976. return null;
  7977. }
  7978. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  7979. return "source-over";
  7980. }
  7981. function incrementCachedImageMaskCount(data) {
  7982. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  7983. data.args[0].count++;
  7984. }
  7985. }
  7986. class TimeSlotManager {
  7987. static get TIME_SLOT_DURATION_MS() {
  7988. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  7989. }
  7990. static get CHECK_TIME_EVERY() {
  7991. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  7992. }
  7993. constructor() {
  7994. this.reset();
  7995. }
  7996. check() {
  7997. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  7998. return false;
  7999. }
  8000. this.checked = 0;
  8001. return this.endTime <= Date.now();
  8002. }
  8003. reset() {
  8004. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  8005. this.checked = 0;
  8006. }
  8007. }
  8008. class PartialEvaluator {
  8009. constructor({
  8010. xref,
  8011. handler,
  8012. pageIndex,
  8013. idFactory,
  8014. fontCache,
  8015. builtInCMapCache,
  8016. standardFontDataCache,
  8017. globalImageCache,
  8018. options = null
  8019. }) {
  8020. this.xref = xref;
  8021. this.handler = handler;
  8022. this.pageIndex = pageIndex;
  8023. this.idFactory = idFactory;
  8024. this.fontCache = fontCache;
  8025. this.builtInCMapCache = builtInCMapCache;
  8026. this.standardFontDataCache = standardFontDataCache;
  8027. this.globalImageCache = globalImageCache;
  8028. this.options = options || DefaultPartialEvaluatorOptions;
  8029. this.parsingType3Font = false;
  8030. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  8031. }
  8032. get _pdfFunctionFactory() {
  8033. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  8034. xref: this.xref,
  8035. isEvalSupported: this.options.isEvalSupported
  8036. });
  8037. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  8038. }
  8039. clone(newOptions = null) {
  8040. const newEvaluator = Object.create(this);
  8041. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  8042. return newEvaluator;
  8043. }
  8044. hasBlendModes(resources, nonBlendModesSet) {
  8045. if (!(resources instanceof _primitives.Dict)) {
  8046. return false;
  8047. }
  8048. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  8049. return false;
  8050. }
  8051. const processed = new _primitives.RefSet(nonBlendModesSet);
  8052. if (resources.objId) {
  8053. processed.put(resources.objId);
  8054. }
  8055. const nodes = [resources],
  8056. xref = this.xref;
  8057. while (nodes.length) {
  8058. const node = nodes.shift();
  8059. const graphicStates = node.get("ExtGState");
  8060. if (graphicStates instanceof _primitives.Dict) {
  8061. for (let graphicState of graphicStates.getRawValues()) {
  8062. if (graphicState instanceof _primitives.Ref) {
  8063. if (processed.has(graphicState)) {
  8064. continue;
  8065. }
  8066. try {
  8067. graphicState = xref.fetch(graphicState);
  8068. } catch (ex) {
  8069. processed.put(graphicState);
  8070. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  8071. continue;
  8072. }
  8073. }
  8074. if (!(graphicState instanceof _primitives.Dict)) {
  8075. continue;
  8076. }
  8077. if (graphicState.objId) {
  8078. processed.put(graphicState.objId);
  8079. }
  8080. const bm = graphicState.get("BM");
  8081. if (bm instanceof _primitives.Name) {
  8082. if (bm.name !== "Normal") {
  8083. return true;
  8084. }
  8085. continue;
  8086. }
  8087. if (bm !== undefined && Array.isArray(bm)) {
  8088. for (const element of bm) {
  8089. if (element instanceof _primitives.Name && element.name !== "Normal") {
  8090. return true;
  8091. }
  8092. }
  8093. }
  8094. }
  8095. }
  8096. const xObjects = node.get("XObject");
  8097. if (!(xObjects instanceof _primitives.Dict)) {
  8098. continue;
  8099. }
  8100. for (let xObject of xObjects.getRawValues()) {
  8101. if (xObject instanceof _primitives.Ref) {
  8102. if (processed.has(xObject)) {
  8103. continue;
  8104. }
  8105. try {
  8106. xObject = xref.fetch(xObject);
  8107. } catch (ex) {
  8108. processed.put(xObject);
  8109. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  8110. continue;
  8111. }
  8112. }
  8113. if (!(xObject instanceof _base_stream.BaseStream)) {
  8114. continue;
  8115. }
  8116. if (xObject.dict.objId) {
  8117. processed.put(xObject.dict.objId);
  8118. }
  8119. const xResources = xObject.dict.get("Resources");
  8120. if (!(xResources instanceof _primitives.Dict)) {
  8121. continue;
  8122. }
  8123. if (xResources.objId && processed.has(xResources.objId)) {
  8124. continue;
  8125. }
  8126. nodes.push(xResources);
  8127. if (xResources.objId) {
  8128. processed.put(xResources.objId);
  8129. }
  8130. }
  8131. }
  8132. for (const ref of processed) {
  8133. nonBlendModesSet.put(ref);
  8134. }
  8135. return false;
  8136. }
  8137. async fetchBuiltInCMap(name) {
  8138. const cachedData = this.builtInCMapCache.get(name);
  8139. if (cachedData) {
  8140. return cachedData;
  8141. }
  8142. let data;
  8143. if (this.options.cMapUrl !== null) {
  8144. const url = `${this.options.cMapUrl}${name}.bcmap`;
  8145. const response = await fetch(url);
  8146. if (!response.ok) {
  8147. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  8148. }
  8149. data = {
  8150. cMapData: new Uint8Array(await response.arrayBuffer()),
  8151. compressionType: _util.CMapCompressionType.BINARY
  8152. };
  8153. } else {
  8154. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  8155. name
  8156. });
  8157. }
  8158. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  8159. this.builtInCMapCache.set(name, data);
  8160. }
  8161. return data;
  8162. }
  8163. async fetchStandardFontData(name) {
  8164. const cachedData = this.standardFontDataCache.get(name);
  8165. if (cachedData) {
  8166. return new _stream.Stream(cachedData);
  8167. }
  8168. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  8169. return null;
  8170. }
  8171. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  8172. filename = standardFontNameToFileName[name];
  8173. let data;
  8174. if (this.options.standardFontDataUrl !== null) {
  8175. const url = `${this.options.standardFontDataUrl}${filename}`;
  8176. const response = await fetch(url);
  8177. if (!response.ok) {
  8178. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  8179. } else {
  8180. data = await response.arrayBuffer();
  8181. }
  8182. } else {
  8183. try {
  8184. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  8185. filename
  8186. });
  8187. } catch (e) {
  8188. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  8189. }
  8190. }
  8191. if (!data) {
  8192. return null;
  8193. }
  8194. this.standardFontDataCache.set(name, data);
  8195. return new _stream.Stream(data);
  8196. }
  8197. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  8198. const dict = xobj.dict;
  8199. const matrix = dict.getArray("Matrix");
  8200. let bbox = dict.getArray("BBox");
  8201. if (Array.isArray(bbox) && bbox.length === 4) {
  8202. bbox = _util.Util.normalizeRect(bbox);
  8203. } else {
  8204. bbox = null;
  8205. }
  8206. let optionalContent, groupOptions;
  8207. if (dict.has("OC")) {
  8208. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8209. }
  8210. if (optionalContent !== undefined) {
  8211. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8212. }
  8213. const group = dict.get("Group");
  8214. if (group) {
  8215. groupOptions = {
  8216. matrix,
  8217. bbox,
  8218. smask,
  8219. isolated: false,
  8220. knockout: false
  8221. };
  8222. const groupSubtype = group.get("S");
  8223. let colorSpace = null;
  8224. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  8225. groupOptions.isolated = group.get("I") || false;
  8226. groupOptions.knockout = group.get("K") || false;
  8227. if (group.has("CS")) {
  8228. const cs = group.getRaw("CS");
  8229. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  8230. if (cachedColorSpace) {
  8231. colorSpace = cachedColorSpace;
  8232. } else {
  8233. colorSpace = await this.parseColorSpace({
  8234. cs,
  8235. resources,
  8236. localColorSpaceCache
  8237. });
  8238. }
  8239. }
  8240. }
  8241. if (smask && smask.backdrop) {
  8242. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  8243. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  8244. }
  8245. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  8246. }
  8247. const args = group ? [matrix, null] : [matrix, bbox];
  8248. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  8249. return this.getOperatorList({
  8250. stream: xobj,
  8251. task,
  8252. resources: dict.get("Resources") || resources,
  8253. operatorList,
  8254. initialState
  8255. }).then(function () {
  8256. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  8257. if (group) {
  8258. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  8259. }
  8260. if (optionalContent !== undefined) {
  8261. operatorList.addOp(_util.OPS.endMarkedContent, []);
  8262. }
  8263. });
  8264. }
  8265. _sendImgData(objId, imgData, cacheGlobally = false) {
  8266. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  8267. if (this.parsingType3Font || cacheGlobally) {
  8268. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  8269. }
  8270. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  8271. }
  8272. async buildPaintImageXObject({
  8273. resources,
  8274. image,
  8275. isInline = false,
  8276. operatorList,
  8277. cacheKey,
  8278. localImageCache,
  8279. localColorSpaceCache
  8280. }) {
  8281. const dict = image.dict;
  8282. const imageRef = dict.objId;
  8283. const w = dict.get("W", "Width");
  8284. const h = dict.get("H", "Height");
  8285. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  8286. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  8287. return;
  8288. }
  8289. const maxImageSize = this.options.maxImageSize;
  8290. if (maxImageSize !== -1 && w * h > maxImageSize) {
  8291. const msg = "Image exceeded maximum allowed size and was removed.";
  8292. if (this.options.ignoreErrors) {
  8293. (0, _util.warn)(msg);
  8294. return;
  8295. }
  8296. throw new Error(msg);
  8297. }
  8298. let optionalContent;
  8299. if (dict.has("OC")) {
  8300. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8301. }
  8302. const imageMask = dict.get("IM", "ImageMask") || false;
  8303. let imgData, args;
  8304. if (imageMask) {
  8305. const interpolate = dict.get("I", "Interpolate");
  8306. const bitStrideLength = w + 7 >> 3;
  8307. const imgArray = image.getBytes(bitStrideLength * h);
  8308. const decode = dict.getArray("D", "Decode");
  8309. if (this.parsingType3Font) {
  8310. imgData = _image.PDFImage.createRawMask({
  8311. imgArray,
  8312. width: w,
  8313. height: h,
  8314. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8315. inverseDecode: !!decode && decode[0] > 0,
  8316. interpolate
  8317. });
  8318. imgData.cached = !!cacheKey;
  8319. args = [imgData];
  8320. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8321. if (cacheKey) {
  8322. localImageCache.set(cacheKey, imageRef, {
  8323. fn: _util.OPS.paintImageMaskXObject,
  8324. args,
  8325. optionalContent
  8326. });
  8327. }
  8328. return;
  8329. }
  8330. imgData = _image.PDFImage.createMask({
  8331. imgArray,
  8332. width: w,
  8333. height: h,
  8334. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8335. inverseDecode: !!decode && decode[0] > 0,
  8336. interpolate,
  8337. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  8338. });
  8339. if (imgData.isSingleOpaquePixel) {
  8340. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  8341. if (cacheKey) {
  8342. localImageCache.set(cacheKey, imageRef, {
  8343. fn: _util.OPS.paintSolidColorImageMask,
  8344. args: [],
  8345. optionalContent
  8346. });
  8347. }
  8348. return;
  8349. }
  8350. const objId = `mask_${this.idFactory.createObjId()}`;
  8351. operatorList.addDependency(objId);
  8352. this._sendImgData(objId, imgData);
  8353. args = [{
  8354. data: objId,
  8355. width: imgData.width,
  8356. height: imgData.height,
  8357. interpolate: imgData.interpolate,
  8358. count: 1
  8359. }];
  8360. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8361. if (cacheKey) {
  8362. localImageCache.set(cacheKey, imageRef, {
  8363. fn: _util.OPS.paintImageMaskXObject,
  8364. args,
  8365. optionalContent
  8366. });
  8367. }
  8368. return;
  8369. }
  8370. const softMask = dict.get("SM", "SMask") || false;
  8371. const mask = dict.get("Mask") || false;
  8372. const SMALL_IMAGE_DIMENSIONS = 200;
  8373. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  8374. const imageObj = new _image.PDFImage({
  8375. xref: this.xref,
  8376. res: resources,
  8377. image,
  8378. isInline,
  8379. pdfFunctionFactory: this._pdfFunctionFactory,
  8380. localColorSpaceCache
  8381. });
  8382. imgData = imageObj.createImageData(true);
  8383. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  8384. return;
  8385. }
  8386. let objId = `img_${this.idFactory.createObjId()}`,
  8387. cacheGlobally = false;
  8388. if (this.parsingType3Font) {
  8389. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  8390. } else if (imageRef) {
  8391. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  8392. if (cacheGlobally) {
  8393. objId = `${this.idFactory.getDocId()}_${objId}`;
  8394. }
  8395. }
  8396. operatorList.addDependency(objId);
  8397. args = [objId, w, h];
  8398. _image.PDFImage.buildImage({
  8399. xref: this.xref,
  8400. res: resources,
  8401. image,
  8402. isInline,
  8403. pdfFunctionFactory: this._pdfFunctionFactory,
  8404. localColorSpaceCache
  8405. }).then(imageObj => {
  8406. imgData = imageObj.createImageData(false);
  8407. if (cacheKey && imageRef && cacheGlobally) {
  8408. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  8409. }
  8410. return this._sendImgData(objId, imgData, cacheGlobally);
  8411. }).catch(reason => {
  8412. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  8413. return this._sendImgData(objId, null, cacheGlobally);
  8414. });
  8415. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  8416. if (cacheKey) {
  8417. localImageCache.set(cacheKey, imageRef, {
  8418. fn: _util.OPS.paintImageXObject,
  8419. args,
  8420. optionalContent
  8421. });
  8422. if (imageRef) {
  8423. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  8424. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  8425. if (cacheGlobally) {
  8426. this.globalImageCache.setData(imageRef, {
  8427. objId,
  8428. fn: _util.OPS.paintImageXObject,
  8429. args,
  8430. optionalContent,
  8431. byteSize: 0
  8432. });
  8433. }
  8434. }
  8435. }
  8436. }
  8437. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  8438. const smaskContent = smask.get("G");
  8439. const smaskOptions = {
  8440. subtype: smask.get("S").name,
  8441. backdrop: smask.get("BC")
  8442. };
  8443. const transferObj = smask.get("TR");
  8444. if ((0, _function.isPDFFunction)(transferObj)) {
  8445. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8446. const transferMap = new Uint8Array(256);
  8447. const tmp = new Float32Array(1);
  8448. for (let i = 0; i < 256; i++) {
  8449. tmp[0] = i / 255;
  8450. transferFn(tmp, 0, tmp, 0);
  8451. transferMap[i] = tmp[0] * 255 | 0;
  8452. }
  8453. smaskOptions.transferMap = transferMap;
  8454. }
  8455. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  8456. }
  8457. handleTransferFunction(tr) {
  8458. let transferArray;
  8459. if (Array.isArray(tr)) {
  8460. transferArray = tr;
  8461. } else if ((0, _function.isPDFFunction)(tr)) {
  8462. transferArray = [tr];
  8463. } else {
  8464. return null;
  8465. }
  8466. const transferMaps = [];
  8467. let numFns = 0,
  8468. numEffectfulFns = 0;
  8469. for (const entry of transferArray) {
  8470. const transferObj = this.xref.fetchIfRef(entry);
  8471. numFns++;
  8472. if ((0, _primitives.isName)(transferObj, "Identity")) {
  8473. transferMaps.push(null);
  8474. continue;
  8475. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  8476. return null;
  8477. }
  8478. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8479. const transferMap = new Uint8Array(256),
  8480. tmp = new Float32Array(1);
  8481. for (let j = 0; j < 256; j++) {
  8482. tmp[0] = j / 255;
  8483. transferFn(tmp, 0, tmp, 0);
  8484. transferMap[j] = tmp[0] * 255 | 0;
  8485. }
  8486. transferMaps.push(transferMap);
  8487. numEffectfulFns++;
  8488. }
  8489. if (!(numFns === 1 || numFns === 4)) {
  8490. return null;
  8491. }
  8492. if (numEffectfulFns === 0) {
  8493. return null;
  8494. }
  8495. return transferMaps;
  8496. }
  8497. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  8498. const tilingOpList = new _operator_list.OperatorList();
  8499. const patternResources = _primitives.Dict.merge({
  8500. xref: this.xref,
  8501. dictArray: [patternDict.get("Resources"), resources]
  8502. });
  8503. return this.getOperatorList({
  8504. stream: pattern,
  8505. task,
  8506. resources: patternResources,
  8507. operatorList: tilingOpList
  8508. }).then(function () {
  8509. const operatorListIR = tilingOpList.getIR();
  8510. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  8511. operatorList.addDependencies(tilingOpList.dependencies);
  8512. operatorList.addOp(fn, tilingPatternIR);
  8513. if (patternDict.objId) {
  8514. localTilingPatternCache.set(null, patternDict.objId, {
  8515. operatorListIR,
  8516. dict: patternDict
  8517. });
  8518. }
  8519. }).catch(reason => {
  8520. if (reason instanceof _util.AbortException) {
  8521. return;
  8522. }
  8523. if (this.options.ignoreErrors) {
  8524. this.handler.send("UnsupportedFeature", {
  8525. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  8526. });
  8527. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  8528. return;
  8529. }
  8530. throw reason;
  8531. });
  8532. }
  8533. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  8534. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  8535. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  8536. if (!translated.font.isType3Font) {
  8537. return translated;
  8538. }
  8539. return translated.loadType3Data(this, resources, task).then(function () {
  8540. operatorList.addDependencies(translated.type3Dependencies);
  8541. return translated;
  8542. }).catch(reason => {
  8543. this.handler.send("UnsupportedFeature", {
  8544. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  8545. });
  8546. return new TranslatedFont({
  8547. loadedName: "g_font_error",
  8548. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  8549. dict: translated.font,
  8550. evaluatorOptions: this.options
  8551. });
  8552. });
  8553. }).then(translated => {
  8554. state.font = translated.font;
  8555. translated.send(this.handler);
  8556. return translated.loadedName;
  8557. });
  8558. }
  8559. handleText(chars, state) {
  8560. const font = state.font;
  8561. const glyphs = font.charsToGlyphs(chars);
  8562. if (font.data) {
  8563. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  8564. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  8565. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  8566. }
  8567. }
  8568. return glyphs;
  8569. }
  8570. ensureStateFont(state) {
  8571. if (state.font) {
  8572. return;
  8573. }
  8574. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  8575. if (this.options.ignoreErrors) {
  8576. this.handler.send("UnsupportedFeature", {
  8577. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  8578. });
  8579. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  8580. return;
  8581. }
  8582. throw reason;
  8583. }
  8584. async setGState({
  8585. resources,
  8586. gState,
  8587. operatorList,
  8588. cacheKey,
  8589. task,
  8590. stateManager,
  8591. localGStateCache,
  8592. localColorSpaceCache
  8593. }) {
  8594. const gStateRef = gState.objId;
  8595. let isSimpleGState = true;
  8596. const gStateObj = [];
  8597. let promise = Promise.resolve();
  8598. for (const key of gState.getKeys()) {
  8599. const value = gState.get(key);
  8600. switch (key) {
  8601. case "Type":
  8602. break;
  8603. case "LW":
  8604. case "LC":
  8605. case "LJ":
  8606. case "ML":
  8607. case "D":
  8608. case "RI":
  8609. case "FL":
  8610. case "CA":
  8611. case "ca":
  8612. gStateObj.push([key, value]);
  8613. break;
  8614. case "Font":
  8615. isSimpleGState = false;
  8616. promise = promise.then(() => {
  8617. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  8618. operatorList.addDependency(loadedName);
  8619. gStateObj.push([key, [loadedName, value[1]]]);
  8620. });
  8621. });
  8622. break;
  8623. case "BM":
  8624. gStateObj.push([key, normalizeBlendMode(value)]);
  8625. break;
  8626. case "SMask":
  8627. if ((0, _primitives.isName)(value, "None")) {
  8628. gStateObj.push([key, false]);
  8629. break;
  8630. }
  8631. if (value instanceof _primitives.Dict) {
  8632. isSimpleGState = false;
  8633. promise = promise.then(() => {
  8634. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  8635. });
  8636. gStateObj.push([key, true]);
  8637. } else {
  8638. (0, _util.warn)("Unsupported SMask type");
  8639. }
  8640. break;
  8641. case "TR":
  8642. const transferMaps = this.handleTransferFunction(value);
  8643. gStateObj.push([key, transferMaps]);
  8644. break;
  8645. case "OP":
  8646. case "op":
  8647. case "OPM":
  8648. case "BG":
  8649. case "BG2":
  8650. case "UCR":
  8651. case "UCR2":
  8652. case "TR2":
  8653. case "HT":
  8654. case "SM":
  8655. case "SA":
  8656. case "AIS":
  8657. case "TK":
  8658. (0, _util.info)("graphic state operator " + key);
  8659. break;
  8660. default:
  8661. (0, _util.info)("Unknown graphic state operator " + key);
  8662. break;
  8663. }
  8664. }
  8665. return promise.then(function () {
  8666. if (gStateObj.length > 0) {
  8667. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  8668. }
  8669. if (isSimpleGState) {
  8670. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  8671. }
  8672. });
  8673. }
  8674. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  8675. const errorFont = async () => {
  8676. return new TranslatedFont({
  8677. loadedName: "g_font_error",
  8678. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  8679. dict: font,
  8680. evaluatorOptions: this.options
  8681. });
  8682. };
  8683. const xref = this.xref;
  8684. let fontRef;
  8685. if (font) {
  8686. if (font instanceof _primitives.Ref) {
  8687. fontRef = font;
  8688. }
  8689. } else {
  8690. const fontRes = resources.get("Font");
  8691. if (fontRes) {
  8692. fontRef = fontRes.getRaw(fontName);
  8693. }
  8694. }
  8695. if (!fontRef) {
  8696. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  8697. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  8698. (0, _util.warn)(`${partialMsg}.`);
  8699. return errorFont();
  8700. }
  8701. this.handler.send("UnsupportedFeature", {
  8702. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  8703. });
  8704. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  8705. if (fallbackFontDict) {
  8706. fontRef = fallbackFontDict;
  8707. } else {
  8708. fontRef = PartialEvaluator.fallbackFontDict;
  8709. }
  8710. }
  8711. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  8712. return errorFont();
  8713. }
  8714. if (this.fontCache.has(fontRef)) {
  8715. return this.fontCache.get(fontRef);
  8716. }
  8717. font = xref.fetchIfRef(fontRef);
  8718. if (!(font instanceof _primitives.Dict)) {
  8719. return errorFont();
  8720. }
  8721. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  8722. return this.fontCache.get(font.cacheKey);
  8723. }
  8724. const fontCapability = (0, _util.createPromiseCapability)();
  8725. let preEvaluatedFont;
  8726. try {
  8727. preEvaluatedFont = this.preEvaluateFont(font);
  8728. preEvaluatedFont.cssFontInfo = cssFontInfo;
  8729. } catch (reason) {
  8730. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  8731. return errorFont();
  8732. }
  8733. const {
  8734. descriptor,
  8735. hash
  8736. } = preEvaluatedFont;
  8737. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  8738. let fontID;
  8739. if (fontRefIsRef) {
  8740. fontID = `f${fontRef.toString()}`;
  8741. }
  8742. if (hash && descriptor instanceof _primitives.Dict) {
  8743. if (!descriptor.fontAliases) {
  8744. descriptor.fontAliases = Object.create(null);
  8745. }
  8746. const fontAliases = descriptor.fontAliases;
  8747. if (fontAliases[hash]) {
  8748. const aliasFontRef = fontAliases[hash].aliasRef;
  8749. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  8750. this.fontCache.putAlias(fontRef, aliasFontRef);
  8751. return this.fontCache.get(fontRef);
  8752. }
  8753. } else {
  8754. fontAliases[hash] = {
  8755. fontID: this.idFactory.createFontId()
  8756. };
  8757. }
  8758. if (fontRefIsRef) {
  8759. fontAliases[hash].aliasRef = fontRef;
  8760. }
  8761. fontID = fontAliases[hash].fontID;
  8762. }
  8763. if (fontRefIsRef) {
  8764. this.fontCache.put(fontRef, fontCapability.promise);
  8765. } else {
  8766. if (!fontID) {
  8767. fontID = this.idFactory.createFontId();
  8768. }
  8769. font.cacheKey = `cacheKey_${fontID}`;
  8770. this.fontCache.put(font.cacheKey, fontCapability.promise);
  8771. }
  8772. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  8773. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  8774. this.translateFont(preEvaluatedFont).then(translatedFont => {
  8775. if (translatedFont.fontType !== undefined) {
  8776. xref.stats.addFontType(translatedFont.fontType);
  8777. }
  8778. fontCapability.resolve(new TranslatedFont({
  8779. loadedName: font.loadedName,
  8780. font: translatedFont,
  8781. dict: font,
  8782. evaluatorOptions: this.options
  8783. }));
  8784. }).catch(reason => {
  8785. this.handler.send("UnsupportedFeature", {
  8786. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  8787. });
  8788. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  8789. try {
  8790. const fontFile3 = descriptor && descriptor.get("FontFile3");
  8791. const subtype = fontFile3 && fontFile3.get("Subtype");
  8792. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  8793. if (fontType !== undefined) {
  8794. xref.stats.addFontType(fontType);
  8795. }
  8796. } catch (ex) {}
  8797. fontCapability.resolve(new TranslatedFont({
  8798. loadedName: font.loadedName,
  8799. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  8800. dict: font,
  8801. evaluatorOptions: this.options
  8802. }));
  8803. });
  8804. return fontCapability.promise;
  8805. }
  8806. buildPath(operatorList, fn, args, parsingText = false) {
  8807. const lastIndex = operatorList.length - 1;
  8808. if (!args) {
  8809. args = [];
  8810. }
  8811. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  8812. if (parsingText) {
  8813. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  8814. operatorList.addOp(_util.OPS.save, null);
  8815. }
  8816. let minMax;
  8817. switch (fn) {
  8818. case _util.OPS.rectangle:
  8819. const x = args[0] + args[2];
  8820. const y = args[1] + args[3];
  8821. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  8822. break;
  8823. case _util.OPS.moveTo:
  8824. case _util.OPS.lineTo:
  8825. minMax = [args[0], args[0], args[1], args[1]];
  8826. break;
  8827. default:
  8828. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  8829. break;
  8830. }
  8831. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  8832. if (parsingText) {
  8833. operatorList.addOp(_util.OPS.restore, null);
  8834. }
  8835. } else {
  8836. const opArgs = operatorList.argsArray[lastIndex];
  8837. opArgs[0].push(fn);
  8838. opArgs[1].push(...args);
  8839. const minMax = opArgs[2];
  8840. switch (fn) {
  8841. case _util.OPS.rectangle:
  8842. const x = args[0] + args[2];
  8843. const y = args[1] + args[3];
  8844. minMax[0] = Math.min(minMax[0], args[0], x);
  8845. minMax[1] = Math.max(minMax[1], args[0], x);
  8846. minMax[2] = Math.min(minMax[2], args[1], y);
  8847. minMax[3] = Math.max(minMax[3], args[1], y);
  8848. break;
  8849. case _util.OPS.moveTo:
  8850. case _util.OPS.lineTo:
  8851. minMax[0] = Math.min(minMax[0], args[0]);
  8852. minMax[1] = Math.max(minMax[1], args[0]);
  8853. minMax[2] = Math.min(minMax[2], args[1]);
  8854. minMax[3] = Math.max(minMax[3], args[1]);
  8855. break;
  8856. }
  8857. }
  8858. }
  8859. parseColorSpace({
  8860. cs,
  8861. resources,
  8862. localColorSpaceCache
  8863. }) {
  8864. return _colorspace.ColorSpace.parseAsync({
  8865. cs,
  8866. xref: this.xref,
  8867. resources,
  8868. pdfFunctionFactory: this._pdfFunctionFactory,
  8869. localColorSpaceCache
  8870. }).catch(reason => {
  8871. if (reason instanceof _util.AbortException) {
  8872. return null;
  8873. }
  8874. if (this.options.ignoreErrors) {
  8875. this.handler.send("UnsupportedFeature", {
  8876. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  8877. });
  8878. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  8879. return null;
  8880. }
  8881. throw reason;
  8882. });
  8883. }
  8884. parseShading({
  8885. shading,
  8886. resources,
  8887. localColorSpaceCache,
  8888. localShadingPatternCache
  8889. }) {
  8890. let id = localShadingPatternCache.get(shading);
  8891. if (!id) {
  8892. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  8893. const patternIR = shadingFill.getIR();
  8894. id = `pattern_${this.idFactory.createObjId()}`;
  8895. localShadingPatternCache.set(shading, id);
  8896. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  8897. }
  8898. return id;
  8899. }
  8900. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  8901. const patternName = args.pop();
  8902. if (patternName instanceof _primitives.Name) {
  8903. const rawPattern = patterns.getRaw(patternName.name);
  8904. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  8905. if (localTilingPattern) {
  8906. try {
  8907. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  8908. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  8909. operatorList.addOp(fn, tilingPatternIR);
  8910. return undefined;
  8911. } catch (ex) {}
  8912. }
  8913. const pattern = this.xref.fetchIfRef(rawPattern);
  8914. if (pattern) {
  8915. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  8916. const typeNum = dict.get("PatternType");
  8917. if (typeNum === PatternType.TILING) {
  8918. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  8919. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  8920. } else if (typeNum === PatternType.SHADING) {
  8921. const shading = dict.get("Shading");
  8922. const matrix = dict.getArray("Matrix");
  8923. const objId = this.parseShading({
  8924. shading,
  8925. resources,
  8926. localColorSpaceCache,
  8927. localShadingPatternCache
  8928. });
  8929. operatorList.addOp(fn, ["Shading", objId, matrix]);
  8930. return undefined;
  8931. }
  8932. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  8933. }
  8934. }
  8935. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  8936. }
  8937. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  8938. const MAX_NESTING = 10;
  8939. if (++nestingCounter > MAX_NESTING) {
  8940. (0, _util.warn)("Visibility expression is too deeply nested");
  8941. return;
  8942. }
  8943. const length = array.length;
  8944. const operator = this.xref.fetchIfRef(array[0]);
  8945. if (length < 2 || !(operator instanceof _primitives.Name)) {
  8946. (0, _util.warn)("Invalid visibility expression");
  8947. return;
  8948. }
  8949. switch (operator.name) {
  8950. case "And":
  8951. case "Or":
  8952. case "Not":
  8953. currentResult.push(operator.name);
  8954. break;
  8955. default:
  8956. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  8957. return;
  8958. }
  8959. for (let i = 1; i < length; i++) {
  8960. const raw = array[i];
  8961. const object = this.xref.fetchIfRef(raw);
  8962. if (Array.isArray(object)) {
  8963. const nestedResult = [];
  8964. currentResult.push(nestedResult);
  8965. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  8966. } else if (raw instanceof _primitives.Ref) {
  8967. currentResult.push(raw.toString());
  8968. }
  8969. }
  8970. }
  8971. async parseMarkedContentProps(contentProperties, resources) {
  8972. let optionalContent;
  8973. if (contentProperties instanceof _primitives.Name) {
  8974. const properties = resources.get("Properties");
  8975. optionalContent = properties.get(contentProperties.name);
  8976. } else if (contentProperties instanceof _primitives.Dict) {
  8977. optionalContent = contentProperties;
  8978. } else {
  8979. throw new _util.FormatError("Optional content properties malformed.");
  8980. }
  8981. const optionalContentType = optionalContent.get("Type").name;
  8982. if (optionalContentType === "OCG") {
  8983. return {
  8984. type: optionalContentType,
  8985. id: optionalContent.objId
  8986. };
  8987. } else if (optionalContentType === "OCMD") {
  8988. const expression = optionalContent.get("VE");
  8989. if (Array.isArray(expression)) {
  8990. const result = [];
  8991. this._parseVisibilityExpression(expression, 0, result);
  8992. if (result.length > 0) {
  8993. return {
  8994. type: "OCMD",
  8995. expression: result
  8996. };
  8997. }
  8998. }
  8999. const optionalContentGroups = optionalContent.get("OCGs");
  9000. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  9001. const groupIds = [];
  9002. if (Array.isArray(optionalContentGroups)) {
  9003. for (const ocg of optionalContentGroups) {
  9004. groupIds.push(ocg.toString());
  9005. }
  9006. } else {
  9007. groupIds.push(optionalContentGroups.objId);
  9008. }
  9009. return {
  9010. type: optionalContentType,
  9011. ids: groupIds,
  9012. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  9013. expression: null
  9014. };
  9015. } else if (optionalContentGroups instanceof _primitives.Ref) {
  9016. return {
  9017. type: optionalContentType,
  9018. id: optionalContentGroups.toString()
  9019. };
  9020. }
  9021. }
  9022. return null;
  9023. }
  9024. getOperatorList({
  9025. stream,
  9026. task,
  9027. resources,
  9028. operatorList,
  9029. initialState = null,
  9030. fallbackFontDict = null
  9031. }) {
  9032. resources = resources || _primitives.Dict.empty;
  9033. initialState = initialState || new EvalState();
  9034. if (!operatorList) {
  9035. throw new Error('getOperatorList: missing "operatorList" parameter');
  9036. }
  9037. const self = this;
  9038. const xref = this.xref;
  9039. let parsingText = false;
  9040. const localImageCache = new _image_utils.LocalImageCache();
  9041. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  9042. const localGStateCache = new _image_utils.LocalGStateCache();
  9043. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  9044. const localShadingPatternCache = new Map();
  9045. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  9046. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  9047. const stateManager = new StateManager(initialState);
  9048. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9049. const timeSlotManager = new TimeSlotManager();
  9050. function closePendingRestoreOPS(argument) {
  9051. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  9052. operatorList.addOp(_util.OPS.restore, []);
  9053. }
  9054. }
  9055. return new Promise(function promiseBody(resolve, reject) {
  9056. const next = function (promise) {
  9057. Promise.all([promise, operatorList.ready]).then(function () {
  9058. try {
  9059. promiseBody(resolve, reject);
  9060. } catch (ex) {
  9061. reject(ex);
  9062. }
  9063. }, reject);
  9064. };
  9065. task.ensureNotTerminated();
  9066. timeSlotManager.reset();
  9067. const operation = {};
  9068. let stop, i, ii, cs, name, isValidName;
  9069. while (!(stop = timeSlotManager.check())) {
  9070. operation.args = null;
  9071. if (!preprocessor.read(operation)) {
  9072. break;
  9073. }
  9074. let args = operation.args;
  9075. let fn = operation.fn;
  9076. switch (fn | 0) {
  9077. case _util.OPS.paintXObject:
  9078. isValidName = args[0] instanceof _primitives.Name;
  9079. name = args[0].name;
  9080. if (isValidName) {
  9081. const localImage = localImageCache.getByName(name);
  9082. if (localImage) {
  9083. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9084. incrementCachedImageMaskCount(localImage);
  9085. args = null;
  9086. continue;
  9087. }
  9088. }
  9089. next(new Promise(function (resolveXObject, rejectXObject) {
  9090. if (!isValidName) {
  9091. throw new _util.FormatError("XObject must be referred to by name.");
  9092. }
  9093. let xobj = xobjs.getRaw(name);
  9094. if (xobj instanceof _primitives.Ref) {
  9095. const localImage = localImageCache.getByRef(xobj);
  9096. if (localImage) {
  9097. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9098. incrementCachedImageMaskCount(localImage);
  9099. resolveXObject();
  9100. return;
  9101. }
  9102. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  9103. if (globalImage) {
  9104. operatorList.addDependency(globalImage.objId);
  9105. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  9106. resolveXObject();
  9107. return;
  9108. }
  9109. xobj = xref.fetch(xobj);
  9110. }
  9111. if (!(xobj instanceof _base_stream.BaseStream)) {
  9112. throw new _util.FormatError("XObject should be a stream");
  9113. }
  9114. const type = xobj.dict.get("Subtype");
  9115. if (!(type instanceof _primitives.Name)) {
  9116. throw new _util.FormatError("XObject should have a Name subtype");
  9117. }
  9118. if (type.name === "Form") {
  9119. stateManager.save();
  9120. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  9121. stateManager.restore();
  9122. resolveXObject();
  9123. }, rejectXObject);
  9124. return;
  9125. } else if (type.name === "Image") {
  9126. self.buildPaintImageXObject({
  9127. resources,
  9128. image: xobj,
  9129. operatorList,
  9130. cacheKey: name,
  9131. localImageCache,
  9132. localColorSpaceCache
  9133. }).then(resolveXObject, rejectXObject);
  9134. return;
  9135. } else if (type.name === "PS") {
  9136. (0, _util.info)("Ignored XObject subtype PS");
  9137. } else {
  9138. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  9139. }
  9140. resolveXObject();
  9141. }).catch(function (reason) {
  9142. if (reason instanceof _util.AbortException) {
  9143. return;
  9144. }
  9145. if (self.options.ignoreErrors) {
  9146. self.handler.send("UnsupportedFeature", {
  9147. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  9148. });
  9149. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  9150. return;
  9151. }
  9152. throw reason;
  9153. }));
  9154. return;
  9155. case _util.OPS.setFont:
  9156. var fontSize = args[1];
  9157. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  9158. operatorList.addDependency(loadedName);
  9159. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  9160. }));
  9161. return;
  9162. case _util.OPS.beginText:
  9163. parsingText = true;
  9164. break;
  9165. case _util.OPS.endText:
  9166. parsingText = false;
  9167. break;
  9168. case _util.OPS.endInlineImage:
  9169. var cacheKey = args[0].cacheKey;
  9170. if (cacheKey) {
  9171. const localImage = localImageCache.getByName(cacheKey);
  9172. if (localImage) {
  9173. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9174. incrementCachedImageMaskCount(localImage);
  9175. args = null;
  9176. continue;
  9177. }
  9178. }
  9179. next(self.buildPaintImageXObject({
  9180. resources,
  9181. image: args[0],
  9182. isInline: true,
  9183. operatorList,
  9184. cacheKey,
  9185. localImageCache,
  9186. localColorSpaceCache
  9187. }));
  9188. return;
  9189. case _util.OPS.showText:
  9190. if (!stateManager.state.font) {
  9191. self.ensureStateFont(stateManager.state);
  9192. continue;
  9193. }
  9194. args[0] = self.handleText(args[0], stateManager.state);
  9195. break;
  9196. case _util.OPS.showSpacedText:
  9197. if (!stateManager.state.font) {
  9198. self.ensureStateFont(stateManager.state);
  9199. continue;
  9200. }
  9201. var combinedGlyphs = [];
  9202. var state = stateManager.state;
  9203. for (const arrItem of args[0]) {
  9204. if (typeof arrItem === "string") {
  9205. combinedGlyphs.push(...self.handleText(arrItem, state));
  9206. } else if (typeof arrItem === "number") {
  9207. combinedGlyphs.push(arrItem);
  9208. }
  9209. }
  9210. args[0] = combinedGlyphs;
  9211. fn = _util.OPS.showText;
  9212. break;
  9213. case _util.OPS.nextLineShowText:
  9214. if (!stateManager.state.font) {
  9215. self.ensureStateFont(stateManager.state);
  9216. continue;
  9217. }
  9218. operatorList.addOp(_util.OPS.nextLine);
  9219. args[0] = self.handleText(args[0], stateManager.state);
  9220. fn = _util.OPS.showText;
  9221. break;
  9222. case _util.OPS.nextLineSetSpacingShowText:
  9223. if (!stateManager.state.font) {
  9224. self.ensureStateFont(stateManager.state);
  9225. continue;
  9226. }
  9227. operatorList.addOp(_util.OPS.nextLine);
  9228. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  9229. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  9230. args[0] = self.handleText(args[0], stateManager.state);
  9231. fn = _util.OPS.showText;
  9232. break;
  9233. case _util.OPS.setTextRenderingMode:
  9234. stateManager.state.textRenderingMode = args[0];
  9235. break;
  9236. case _util.OPS.setFillColorSpace:
  9237. {
  9238. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9239. if (cachedColorSpace) {
  9240. stateManager.state.fillColorSpace = cachedColorSpace;
  9241. continue;
  9242. }
  9243. next(self.parseColorSpace({
  9244. cs: args[0],
  9245. resources,
  9246. localColorSpaceCache
  9247. }).then(function (colorSpace) {
  9248. if (colorSpace) {
  9249. stateManager.state.fillColorSpace = colorSpace;
  9250. }
  9251. }));
  9252. return;
  9253. }
  9254. case _util.OPS.setStrokeColorSpace:
  9255. {
  9256. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9257. if (cachedColorSpace) {
  9258. stateManager.state.strokeColorSpace = cachedColorSpace;
  9259. continue;
  9260. }
  9261. next(self.parseColorSpace({
  9262. cs: args[0],
  9263. resources,
  9264. localColorSpaceCache
  9265. }).then(function (colorSpace) {
  9266. if (colorSpace) {
  9267. stateManager.state.strokeColorSpace = colorSpace;
  9268. }
  9269. }));
  9270. return;
  9271. }
  9272. case _util.OPS.setFillColor:
  9273. cs = stateManager.state.fillColorSpace;
  9274. args = cs.getRgb(args, 0);
  9275. fn = _util.OPS.setFillRGBColor;
  9276. break;
  9277. case _util.OPS.setStrokeColor:
  9278. cs = stateManager.state.strokeColorSpace;
  9279. args = cs.getRgb(args, 0);
  9280. fn = _util.OPS.setStrokeRGBColor;
  9281. break;
  9282. case _util.OPS.setFillGray:
  9283. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9284. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9285. fn = _util.OPS.setFillRGBColor;
  9286. break;
  9287. case _util.OPS.setStrokeGray:
  9288. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9289. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9290. fn = _util.OPS.setStrokeRGBColor;
  9291. break;
  9292. case _util.OPS.setFillCMYKColor:
  9293. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9294. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9295. fn = _util.OPS.setFillRGBColor;
  9296. break;
  9297. case _util.OPS.setStrokeCMYKColor:
  9298. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9299. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9300. fn = _util.OPS.setStrokeRGBColor;
  9301. break;
  9302. case _util.OPS.setFillRGBColor:
  9303. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9304. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9305. break;
  9306. case _util.OPS.setStrokeRGBColor:
  9307. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9308. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9309. break;
  9310. case _util.OPS.setFillColorN:
  9311. cs = stateManager.state.fillColorSpace;
  9312. if (cs.name === "Pattern") {
  9313. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9314. return;
  9315. }
  9316. args = cs.getRgb(args, 0);
  9317. fn = _util.OPS.setFillRGBColor;
  9318. break;
  9319. case _util.OPS.setStrokeColorN:
  9320. cs = stateManager.state.strokeColorSpace;
  9321. if (cs.name === "Pattern") {
  9322. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9323. return;
  9324. }
  9325. args = cs.getRgb(args, 0);
  9326. fn = _util.OPS.setStrokeRGBColor;
  9327. break;
  9328. case _util.OPS.shadingFill:
  9329. var shadingRes = resources.get("Shading");
  9330. if (!shadingRes) {
  9331. throw new _util.FormatError("No shading resource found");
  9332. }
  9333. var shading = shadingRes.get(args[0].name);
  9334. if (!shading) {
  9335. throw new _util.FormatError("No shading object found");
  9336. }
  9337. const patternId = self.parseShading({
  9338. shading,
  9339. resources,
  9340. localColorSpaceCache,
  9341. localShadingPatternCache
  9342. });
  9343. args = [patternId];
  9344. fn = _util.OPS.shadingFill;
  9345. break;
  9346. case _util.OPS.setGState:
  9347. isValidName = args[0] instanceof _primitives.Name;
  9348. name = args[0].name;
  9349. if (isValidName) {
  9350. const localGStateObj = localGStateCache.getByName(name);
  9351. if (localGStateObj) {
  9352. if (localGStateObj.length > 0) {
  9353. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  9354. }
  9355. args = null;
  9356. continue;
  9357. }
  9358. }
  9359. next(new Promise(function (resolveGState, rejectGState) {
  9360. if (!isValidName) {
  9361. throw new _util.FormatError("GState must be referred to by name.");
  9362. }
  9363. const extGState = resources.get("ExtGState");
  9364. if (!(extGState instanceof _primitives.Dict)) {
  9365. throw new _util.FormatError("ExtGState should be a dictionary.");
  9366. }
  9367. const gState = extGState.get(name);
  9368. if (!(gState instanceof _primitives.Dict)) {
  9369. throw new _util.FormatError("GState should be a dictionary.");
  9370. }
  9371. self.setGState({
  9372. resources,
  9373. gState,
  9374. operatorList,
  9375. cacheKey: name,
  9376. task,
  9377. stateManager,
  9378. localGStateCache,
  9379. localColorSpaceCache
  9380. }).then(resolveGState, rejectGState);
  9381. }).catch(function (reason) {
  9382. if (reason instanceof _util.AbortException) {
  9383. return;
  9384. }
  9385. if (self.options.ignoreErrors) {
  9386. self.handler.send("UnsupportedFeature", {
  9387. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  9388. });
  9389. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  9390. return;
  9391. }
  9392. throw reason;
  9393. }));
  9394. return;
  9395. case _util.OPS.moveTo:
  9396. case _util.OPS.lineTo:
  9397. case _util.OPS.curveTo:
  9398. case _util.OPS.curveTo2:
  9399. case _util.OPS.curveTo3:
  9400. case _util.OPS.closePath:
  9401. case _util.OPS.rectangle:
  9402. self.buildPath(operatorList, fn, args, parsingText);
  9403. continue;
  9404. case _util.OPS.markPoint:
  9405. case _util.OPS.markPointProps:
  9406. case _util.OPS.beginCompat:
  9407. case _util.OPS.endCompat:
  9408. continue;
  9409. case _util.OPS.beginMarkedContentProps:
  9410. if (!(args[0] instanceof _primitives.Name)) {
  9411. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  9412. continue;
  9413. }
  9414. if (args[0].name === "OC") {
  9415. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  9416. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  9417. }).catch(reason => {
  9418. if (reason instanceof _util.AbortException) {
  9419. return;
  9420. }
  9421. if (self.options.ignoreErrors) {
  9422. self.handler.send("UnsupportedFeature", {
  9423. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  9424. });
  9425. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  9426. return;
  9427. }
  9428. throw reason;
  9429. }));
  9430. return;
  9431. }
  9432. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  9433. break;
  9434. case _util.OPS.beginMarkedContent:
  9435. case _util.OPS.endMarkedContent:
  9436. default:
  9437. if (args !== null) {
  9438. for (i = 0, ii = args.length; i < ii; i++) {
  9439. if (args[i] instanceof _primitives.Dict) {
  9440. break;
  9441. }
  9442. }
  9443. if (i < ii) {
  9444. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  9445. continue;
  9446. }
  9447. }
  9448. }
  9449. operatorList.addOp(fn, args);
  9450. }
  9451. if (stop) {
  9452. next(deferred);
  9453. return;
  9454. }
  9455. closePendingRestoreOPS();
  9456. resolve();
  9457. }).catch(reason => {
  9458. if (reason instanceof _util.AbortException) {
  9459. return;
  9460. }
  9461. if (this.options.ignoreErrors) {
  9462. this.handler.send("UnsupportedFeature", {
  9463. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  9464. });
  9465. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  9466. closePendingRestoreOPS();
  9467. return;
  9468. }
  9469. throw reason;
  9470. });
  9471. }
  9472. getTextContent({
  9473. stream,
  9474. task,
  9475. resources,
  9476. stateManager = null,
  9477. combineTextItems = false,
  9478. includeMarkedContent = false,
  9479. sink,
  9480. seenStyles = new Set(),
  9481. viewBox,
  9482. markedContentData = null
  9483. }) {
  9484. resources = resources || _primitives.Dict.empty;
  9485. stateManager = stateManager || new StateManager(new TextState());
  9486. if (includeMarkedContent) {
  9487. markedContentData = markedContentData || {
  9488. level: 0
  9489. };
  9490. }
  9491. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  9492. const textContent = {
  9493. items: [],
  9494. styles: Object.create(null)
  9495. };
  9496. const textContentItem = {
  9497. initialized: false,
  9498. str: [],
  9499. totalWidth: 0,
  9500. totalHeight: 0,
  9501. width: 0,
  9502. height: 0,
  9503. vertical: false,
  9504. prevTransform: null,
  9505. textAdvanceScale: 0,
  9506. spaceInFlowMin: 0,
  9507. spaceInFlowMax: 0,
  9508. trackingSpaceMin: Infinity,
  9509. negativeSpaceMax: -Infinity,
  9510. notASpace: -Infinity,
  9511. transform: null,
  9512. fontName: null,
  9513. hasEOL: false
  9514. };
  9515. const twoLastChars = [" ", " "];
  9516. let twoLastCharsPos = 0;
  9517. function saveLastChar(char) {
  9518. const nextPos = (twoLastCharsPos + 1) % 2;
  9519. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  9520. twoLastChars[twoLastCharsPos] = char;
  9521. twoLastCharsPos = nextPos;
  9522. return ret;
  9523. }
  9524. function resetLastChars() {
  9525. twoLastChars[0] = twoLastChars[1] = " ";
  9526. twoLastCharsPos = 0;
  9527. }
  9528. const TRACKING_SPACE_FACTOR = 0.1;
  9529. const NOT_A_SPACE_FACTOR = 0.03;
  9530. const NEGATIVE_SPACE_FACTOR = -0.2;
  9531. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  9532. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  9533. const self = this;
  9534. const xref = this.xref;
  9535. const showSpacedTextBuffer = [];
  9536. let xobjs = null;
  9537. const emptyXObjectCache = new _image_utils.LocalImageCache();
  9538. const emptyGStateCache = new _image_utils.LocalGStateCache();
  9539. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9540. let textState;
  9541. function getCurrentTextTransform() {
  9542. const font = textState.font;
  9543. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  9544. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  9545. const glyphHeight = font.bbox[3] - font.bbox[1];
  9546. if (glyphHeight > 0) {
  9547. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  9548. }
  9549. }
  9550. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  9551. }
  9552. function ensureTextContentItem() {
  9553. if (textContentItem.initialized) {
  9554. return textContentItem;
  9555. }
  9556. const font = textState.font,
  9557. loadedName = font.loadedName;
  9558. if (!seenStyles.has(loadedName)) {
  9559. seenStyles.add(loadedName);
  9560. textContent.styles[loadedName] = {
  9561. fontFamily: font.fallbackName,
  9562. ascent: font.ascent,
  9563. descent: font.descent,
  9564. vertical: font.vertical
  9565. };
  9566. }
  9567. textContentItem.fontName = loadedName;
  9568. const trm = textContentItem.transform = getCurrentTextTransform();
  9569. if (!font.vertical) {
  9570. textContentItem.width = textContentItem.totalWidth = 0;
  9571. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  9572. textContentItem.vertical = false;
  9573. } else {
  9574. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  9575. textContentItem.height = textContentItem.totalHeight = 0;
  9576. textContentItem.vertical = true;
  9577. }
  9578. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9579. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9580. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  9581. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  9582. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  9583. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  9584. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  9585. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  9586. textContentItem.hasEOL = false;
  9587. textContentItem.initialized = true;
  9588. return textContentItem;
  9589. }
  9590. function updateAdvanceScale() {
  9591. if (!textContentItem.initialized) {
  9592. return;
  9593. }
  9594. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9595. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9596. const scaleFactor = scaleCtmX * scaleLineX;
  9597. if (scaleFactor === textContentItem.textAdvanceScale) {
  9598. return;
  9599. }
  9600. if (!textContentItem.vertical) {
  9601. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9602. textContentItem.width = 0;
  9603. } else {
  9604. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9605. textContentItem.height = 0;
  9606. }
  9607. textContentItem.textAdvanceScale = scaleFactor;
  9608. }
  9609. function runBidiTransform(textChunk) {
  9610. const text = textChunk.str.join("");
  9611. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  9612. return {
  9613. str: bidiResult.str,
  9614. dir: bidiResult.dir,
  9615. width: Math.abs(textChunk.totalWidth),
  9616. height: Math.abs(textChunk.totalHeight),
  9617. transform: textChunk.transform,
  9618. fontName: textChunk.fontName,
  9619. hasEOL: textChunk.hasEOL
  9620. };
  9621. }
  9622. function handleSetFont(fontName, fontRef) {
  9623. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  9624. if (!translated.font.isType3Font) {
  9625. return translated;
  9626. }
  9627. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  9628. return translated;
  9629. });
  9630. }).then(function (translated) {
  9631. textState.font = translated.font;
  9632. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  9633. });
  9634. }
  9635. function applyInverseRotation(x, y, matrix) {
  9636. const scale = Math.hypot(matrix[0], matrix[1]);
  9637. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  9638. }
  9639. function compareWithLastPosition() {
  9640. const currentTransform = getCurrentTextTransform();
  9641. let posX = currentTransform[4];
  9642. let posY = currentTransform[5];
  9643. const shiftedX = posX - viewBox[0];
  9644. const shiftedY = posY - viewBox[1];
  9645. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  9646. return false;
  9647. }
  9648. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  9649. return true;
  9650. }
  9651. let lastPosX = textContentItem.prevTransform[4];
  9652. let lastPosY = textContentItem.prevTransform[5];
  9653. if (lastPosX === posX && lastPosY === posY) {
  9654. return true;
  9655. }
  9656. let rotate = -1;
  9657. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  9658. rotate = currentTransform[0] > 0 ? 0 : 180;
  9659. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  9660. rotate = currentTransform[1] > 0 ? 90 : 270;
  9661. }
  9662. switch (rotate) {
  9663. case 0:
  9664. break;
  9665. case 90:
  9666. [posX, posY] = [posY, posX];
  9667. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  9668. break;
  9669. case 180:
  9670. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  9671. break;
  9672. case 270:
  9673. [posX, posY] = [-posY, -posX];
  9674. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  9675. break;
  9676. default:
  9677. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  9678. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  9679. }
  9680. if (textState.font.vertical) {
  9681. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  9682. const advanceX = posX - lastPosX;
  9683. const textOrientation = Math.sign(textContentItem.height);
  9684. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  9685. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  9686. appendEOL();
  9687. return true;
  9688. }
  9689. resetLastChars();
  9690. flushTextContentItem();
  9691. return true;
  9692. }
  9693. if (Math.abs(advanceX) > textContentItem.width) {
  9694. appendEOL();
  9695. return true;
  9696. }
  9697. if (advanceY <= textOrientation * textContentItem.notASpace) {
  9698. resetLastChars();
  9699. }
  9700. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  9701. textContentItem.height += advanceY;
  9702. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  9703. if (textContentItem.str.length === 0) {
  9704. resetLastChars();
  9705. textContent.items.push({
  9706. str: " ",
  9707. dir: "ltr",
  9708. width: 0,
  9709. height: Math.abs(advanceY),
  9710. transform: textContentItem.prevTransform,
  9711. fontName: textContentItem.fontName,
  9712. hasEOL: false
  9713. });
  9714. } else {
  9715. textContentItem.height += advanceY;
  9716. }
  9717. }
  9718. return true;
  9719. }
  9720. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  9721. const advanceY = posY - lastPosY;
  9722. const textOrientation = Math.sign(textContentItem.width);
  9723. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  9724. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  9725. appendEOL();
  9726. return true;
  9727. }
  9728. resetLastChars();
  9729. flushTextContentItem();
  9730. return true;
  9731. }
  9732. if (Math.abs(advanceY) > textContentItem.height) {
  9733. appendEOL();
  9734. return true;
  9735. }
  9736. if (advanceX <= textOrientation * textContentItem.notASpace) {
  9737. resetLastChars();
  9738. }
  9739. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  9740. textContentItem.width += advanceX;
  9741. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  9742. if (textContentItem.str.length === 0) {
  9743. resetLastChars();
  9744. textContent.items.push({
  9745. str: " ",
  9746. dir: "ltr",
  9747. width: Math.abs(advanceX),
  9748. height: 0,
  9749. transform: textContentItem.prevTransform,
  9750. fontName: textContentItem.fontName,
  9751. hasEOL: false
  9752. });
  9753. } else {
  9754. textContentItem.width += advanceX;
  9755. }
  9756. }
  9757. return true;
  9758. }
  9759. function buildTextContentItem({
  9760. chars,
  9761. extraSpacing
  9762. }) {
  9763. const font = textState.font;
  9764. if (!chars) {
  9765. const charSpacing = textState.charSpacing + extraSpacing;
  9766. if (charSpacing) {
  9767. if (!font.vertical) {
  9768. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9769. } else {
  9770. textState.translateTextMatrix(0, -charSpacing);
  9771. }
  9772. }
  9773. return;
  9774. }
  9775. const glyphs = font.charsToGlyphs(chars);
  9776. const scale = textState.fontMatrix[0] * textState.fontSize;
  9777. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  9778. const glyph = glyphs[i];
  9779. if (glyph.isInvisibleFormatMark) {
  9780. continue;
  9781. }
  9782. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  9783. let glyphWidth = glyph.width;
  9784. if (font.vertical) {
  9785. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  9786. }
  9787. let scaledDim = glyphWidth * scale;
  9788. if (glyph.isWhitespace) {
  9789. if (!font.vertical) {
  9790. charSpacing += scaledDim + textState.wordSpacing;
  9791. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9792. } else {
  9793. charSpacing += -scaledDim + textState.wordSpacing;
  9794. textState.translateTextMatrix(0, -charSpacing);
  9795. }
  9796. saveLastChar(" ");
  9797. continue;
  9798. }
  9799. if (!compareWithLastPosition()) {
  9800. continue;
  9801. }
  9802. const textChunk = ensureTextContentItem();
  9803. if (glyph.isZeroWidthDiacritic) {
  9804. scaledDim = 0;
  9805. }
  9806. if (!font.vertical) {
  9807. scaledDim *= textState.textHScale;
  9808. textState.translateTextMatrix(scaledDim, 0);
  9809. textChunk.width += scaledDim;
  9810. } else {
  9811. textState.translateTextMatrix(0, scaledDim);
  9812. scaledDim = Math.abs(scaledDim);
  9813. textChunk.height += scaledDim;
  9814. }
  9815. if (scaledDim) {
  9816. textChunk.prevTransform = getCurrentTextTransform();
  9817. }
  9818. let glyphUnicode = glyph.unicode;
  9819. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  9820. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  9821. if (saveLastChar(glyphUnicode)) {
  9822. textChunk.str.push(" ");
  9823. }
  9824. textChunk.str.push(glyphUnicode);
  9825. if (charSpacing) {
  9826. if (!font.vertical) {
  9827. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9828. } else {
  9829. textState.translateTextMatrix(0, -charSpacing);
  9830. }
  9831. }
  9832. }
  9833. }
  9834. function appendEOL() {
  9835. resetLastChars();
  9836. if (textContentItem.initialized) {
  9837. textContentItem.hasEOL = true;
  9838. flushTextContentItem();
  9839. } else {
  9840. textContent.items.push({
  9841. str: "",
  9842. dir: "ltr",
  9843. width: 0,
  9844. height: 0,
  9845. transform: getCurrentTextTransform(),
  9846. fontName: textState.font.loadedName,
  9847. hasEOL: true
  9848. });
  9849. }
  9850. }
  9851. function addFakeSpaces(width, transf, textOrientation) {
  9852. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  9853. if (textContentItem.initialized) {
  9854. resetLastChars();
  9855. textContentItem.str.push(" ");
  9856. }
  9857. return false;
  9858. }
  9859. const fontName = textContentItem.fontName;
  9860. let height = 0;
  9861. if (textContentItem.vertical) {
  9862. height = width;
  9863. width = 0;
  9864. }
  9865. flushTextContentItem();
  9866. resetLastChars();
  9867. textContent.items.push({
  9868. str: " ",
  9869. dir: "ltr",
  9870. width: Math.abs(width),
  9871. height: Math.abs(height),
  9872. transform: transf || getCurrentTextTransform(),
  9873. fontName,
  9874. hasEOL: false
  9875. });
  9876. return true;
  9877. }
  9878. function flushTextContentItem() {
  9879. if (!textContentItem.initialized || !textContentItem.str) {
  9880. return;
  9881. }
  9882. if (!textContentItem.vertical) {
  9883. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9884. } else {
  9885. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9886. }
  9887. textContent.items.push(runBidiTransform(textContentItem));
  9888. textContentItem.initialized = false;
  9889. textContentItem.str.length = 0;
  9890. }
  9891. function enqueueChunk(batch = false) {
  9892. const length = textContent.items.length;
  9893. if (length === 0) {
  9894. return;
  9895. }
  9896. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  9897. return;
  9898. }
  9899. sink.enqueue(textContent, length);
  9900. textContent.items = [];
  9901. textContent.styles = Object.create(null);
  9902. }
  9903. const timeSlotManager = new TimeSlotManager();
  9904. return new Promise(function promiseBody(resolve, reject) {
  9905. const next = function (promise) {
  9906. enqueueChunk(true);
  9907. Promise.all([promise, sink.ready]).then(function () {
  9908. try {
  9909. promiseBody(resolve, reject);
  9910. } catch (ex) {
  9911. reject(ex);
  9912. }
  9913. }, reject);
  9914. };
  9915. task.ensureNotTerminated();
  9916. timeSlotManager.reset();
  9917. const operation = {};
  9918. let stop,
  9919. args = [];
  9920. while (!(stop = timeSlotManager.check())) {
  9921. args.length = 0;
  9922. operation.args = args;
  9923. if (!preprocessor.read(operation)) {
  9924. break;
  9925. }
  9926. textState = stateManager.state;
  9927. const fn = operation.fn;
  9928. args = operation.args;
  9929. switch (fn | 0) {
  9930. case _util.OPS.setFont:
  9931. var fontNameArg = args[0].name,
  9932. fontSizeArg = args[1];
  9933. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  9934. break;
  9935. }
  9936. flushTextContentItem();
  9937. textState.fontName = fontNameArg;
  9938. textState.fontSize = fontSizeArg;
  9939. next(handleSetFont(fontNameArg, null));
  9940. return;
  9941. case _util.OPS.setTextRise:
  9942. textState.textRise = args[0];
  9943. break;
  9944. case _util.OPS.setHScale:
  9945. textState.textHScale = args[0] / 100;
  9946. break;
  9947. case _util.OPS.setLeading:
  9948. textState.leading = args[0];
  9949. break;
  9950. case _util.OPS.moveText:
  9951. textState.translateTextLineMatrix(args[0], args[1]);
  9952. textState.textMatrix = textState.textLineMatrix.slice();
  9953. break;
  9954. case _util.OPS.setLeadingMoveText:
  9955. textState.leading = -args[1];
  9956. textState.translateTextLineMatrix(args[0], args[1]);
  9957. textState.textMatrix = textState.textLineMatrix.slice();
  9958. break;
  9959. case _util.OPS.nextLine:
  9960. textState.carriageReturn();
  9961. break;
  9962. case _util.OPS.setTextMatrix:
  9963. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  9964. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  9965. updateAdvanceScale();
  9966. break;
  9967. case _util.OPS.setCharSpacing:
  9968. textState.charSpacing = args[0];
  9969. break;
  9970. case _util.OPS.setWordSpacing:
  9971. textState.wordSpacing = args[0];
  9972. break;
  9973. case _util.OPS.beginText:
  9974. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  9975. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  9976. break;
  9977. case _util.OPS.showSpacedText:
  9978. if (!stateManager.state.font) {
  9979. self.ensureStateFont(stateManager.state);
  9980. continue;
  9981. }
  9982. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  9983. const elements = args[0];
  9984. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  9985. const item = elements[i];
  9986. if (typeof item === "string") {
  9987. showSpacedTextBuffer.push(item);
  9988. } else if (typeof item === "number" && item !== 0) {
  9989. const str = showSpacedTextBuffer.join("");
  9990. showSpacedTextBuffer.length = 0;
  9991. buildTextContentItem({
  9992. chars: str,
  9993. extraSpacing: item * spaceFactor
  9994. });
  9995. }
  9996. }
  9997. const item = elements.at(-1);
  9998. if (typeof item === "string") {
  9999. showSpacedTextBuffer.push(item);
  10000. }
  10001. if (showSpacedTextBuffer.length > 0) {
  10002. const str = showSpacedTextBuffer.join("");
  10003. showSpacedTextBuffer.length = 0;
  10004. buildTextContentItem({
  10005. chars: str,
  10006. extraSpacing: 0
  10007. });
  10008. }
  10009. break;
  10010. case _util.OPS.showText:
  10011. if (!stateManager.state.font) {
  10012. self.ensureStateFont(stateManager.state);
  10013. continue;
  10014. }
  10015. buildTextContentItem({
  10016. chars: args[0],
  10017. extraSpacing: 0
  10018. });
  10019. break;
  10020. case _util.OPS.nextLineShowText:
  10021. if (!stateManager.state.font) {
  10022. self.ensureStateFont(stateManager.state);
  10023. continue;
  10024. }
  10025. textState.carriageReturn();
  10026. buildTextContentItem({
  10027. chars: args[0],
  10028. extraSpacing: 0
  10029. });
  10030. break;
  10031. case _util.OPS.nextLineSetSpacingShowText:
  10032. if (!stateManager.state.font) {
  10033. self.ensureStateFont(stateManager.state);
  10034. continue;
  10035. }
  10036. textState.wordSpacing = args[0];
  10037. textState.charSpacing = args[1];
  10038. textState.carriageReturn();
  10039. buildTextContentItem({
  10040. chars: args[2],
  10041. extraSpacing: 0
  10042. });
  10043. break;
  10044. case _util.OPS.paintXObject:
  10045. flushTextContentItem();
  10046. if (!xobjs) {
  10047. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  10048. }
  10049. var isValidName = args[0] instanceof _primitives.Name;
  10050. var name = args[0].name;
  10051. if (isValidName && emptyXObjectCache.getByName(name)) {
  10052. break;
  10053. }
  10054. next(new Promise(function (resolveXObject, rejectXObject) {
  10055. if (!isValidName) {
  10056. throw new _util.FormatError("XObject must be referred to by name.");
  10057. }
  10058. let xobj = xobjs.getRaw(name);
  10059. if (xobj instanceof _primitives.Ref) {
  10060. if (emptyXObjectCache.getByRef(xobj)) {
  10061. resolveXObject();
  10062. return;
  10063. }
  10064. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  10065. if (globalImage) {
  10066. resolveXObject();
  10067. return;
  10068. }
  10069. xobj = xref.fetch(xobj);
  10070. }
  10071. if (!(xobj instanceof _base_stream.BaseStream)) {
  10072. throw new _util.FormatError("XObject should be a stream");
  10073. }
  10074. const type = xobj.dict.get("Subtype");
  10075. if (!(type instanceof _primitives.Name)) {
  10076. throw new _util.FormatError("XObject should have a Name subtype");
  10077. }
  10078. if (type.name !== "Form") {
  10079. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10080. resolveXObject();
  10081. return;
  10082. }
  10083. const currentState = stateManager.state.clone();
  10084. const xObjStateManager = new StateManager(currentState);
  10085. const matrix = xobj.dict.getArray("Matrix");
  10086. if (Array.isArray(matrix) && matrix.length === 6) {
  10087. xObjStateManager.transform(matrix);
  10088. }
  10089. enqueueChunk();
  10090. const sinkWrapper = {
  10091. enqueueInvoked: false,
  10092. enqueue(chunk, size) {
  10093. this.enqueueInvoked = true;
  10094. sink.enqueue(chunk, size);
  10095. },
  10096. get desiredSize() {
  10097. return sink.desiredSize;
  10098. },
  10099. get ready() {
  10100. return sink.ready;
  10101. }
  10102. };
  10103. self.getTextContent({
  10104. stream: xobj,
  10105. task,
  10106. resources: xobj.dict.get("Resources") || resources,
  10107. stateManager: xObjStateManager,
  10108. combineTextItems,
  10109. includeMarkedContent,
  10110. sink: sinkWrapper,
  10111. seenStyles,
  10112. viewBox,
  10113. markedContentData
  10114. }).then(function () {
  10115. if (!sinkWrapper.enqueueInvoked) {
  10116. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10117. }
  10118. resolveXObject();
  10119. }, rejectXObject);
  10120. }).catch(function (reason) {
  10121. if (reason instanceof _util.AbortException) {
  10122. return;
  10123. }
  10124. if (self.options.ignoreErrors) {
  10125. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  10126. return;
  10127. }
  10128. throw reason;
  10129. }));
  10130. return;
  10131. case _util.OPS.setGState:
  10132. isValidName = args[0] instanceof _primitives.Name;
  10133. name = args[0].name;
  10134. if (isValidName && emptyGStateCache.getByName(name)) {
  10135. break;
  10136. }
  10137. next(new Promise(function (resolveGState, rejectGState) {
  10138. if (!isValidName) {
  10139. throw new _util.FormatError("GState must be referred to by name.");
  10140. }
  10141. const extGState = resources.get("ExtGState");
  10142. if (!(extGState instanceof _primitives.Dict)) {
  10143. throw new _util.FormatError("ExtGState should be a dictionary.");
  10144. }
  10145. const gState = extGState.get(name);
  10146. if (!(gState instanceof _primitives.Dict)) {
  10147. throw new _util.FormatError("GState should be a dictionary.");
  10148. }
  10149. const gStateFont = gState.get("Font");
  10150. if (!gStateFont) {
  10151. emptyGStateCache.set(name, gState.objId, true);
  10152. resolveGState();
  10153. return;
  10154. }
  10155. flushTextContentItem();
  10156. textState.fontName = null;
  10157. textState.fontSize = gStateFont[1];
  10158. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  10159. }).catch(function (reason) {
  10160. if (reason instanceof _util.AbortException) {
  10161. return;
  10162. }
  10163. if (self.options.ignoreErrors) {
  10164. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  10165. return;
  10166. }
  10167. throw reason;
  10168. }));
  10169. return;
  10170. case _util.OPS.beginMarkedContent:
  10171. flushTextContentItem();
  10172. if (includeMarkedContent) {
  10173. markedContentData.level++;
  10174. textContent.items.push({
  10175. type: "beginMarkedContent",
  10176. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10177. });
  10178. }
  10179. break;
  10180. case _util.OPS.beginMarkedContentProps:
  10181. flushTextContentItem();
  10182. if (includeMarkedContent) {
  10183. markedContentData.level++;
  10184. let mcid = null;
  10185. if (args[1] instanceof _primitives.Dict) {
  10186. mcid = args[1].get("MCID");
  10187. }
  10188. textContent.items.push({
  10189. type: "beginMarkedContentProps",
  10190. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  10191. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10192. });
  10193. }
  10194. break;
  10195. case _util.OPS.endMarkedContent:
  10196. flushTextContentItem();
  10197. if (includeMarkedContent) {
  10198. if (markedContentData.level === 0) {
  10199. break;
  10200. }
  10201. markedContentData.level--;
  10202. textContent.items.push({
  10203. type: "endMarkedContent"
  10204. });
  10205. }
  10206. break;
  10207. }
  10208. if (textContent.items.length >= sink.desiredSize) {
  10209. stop = true;
  10210. break;
  10211. }
  10212. }
  10213. if (stop) {
  10214. next(deferred);
  10215. return;
  10216. }
  10217. flushTextContentItem();
  10218. enqueueChunk();
  10219. resolve();
  10220. }).catch(reason => {
  10221. if (reason instanceof _util.AbortException) {
  10222. return;
  10223. }
  10224. if (this.options.ignoreErrors) {
  10225. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  10226. flushTextContentItem();
  10227. enqueueChunk();
  10228. return;
  10229. }
  10230. throw reason;
  10231. });
  10232. }
  10233. extractDataStructures(dict, baseDict, properties) {
  10234. const xref = this.xref;
  10235. let cidToGidBytes;
  10236. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  10237. if (properties.composite) {
  10238. const cidSystemInfo = dict.get("CIDSystemInfo");
  10239. if (cidSystemInfo instanceof _primitives.Dict) {
  10240. properties.cidSystemInfo = {
  10241. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  10242. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  10243. supplement: cidSystemInfo.get("Supplement")
  10244. };
  10245. }
  10246. try {
  10247. const cidToGidMap = dict.get("CIDToGIDMap");
  10248. if (cidToGidMap instanceof _base_stream.BaseStream) {
  10249. cidToGidBytes = cidToGidMap.getBytes();
  10250. }
  10251. } catch (ex) {
  10252. if (!this.options.ignoreErrors) {
  10253. throw ex;
  10254. }
  10255. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  10256. }
  10257. }
  10258. const differences = [];
  10259. let baseEncodingName = null;
  10260. let encoding;
  10261. if (dict.has("Encoding")) {
  10262. encoding = dict.get("Encoding");
  10263. if (encoding instanceof _primitives.Dict) {
  10264. baseEncodingName = encoding.get("BaseEncoding");
  10265. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  10266. if (encoding.has("Differences")) {
  10267. const diffEncoding = encoding.get("Differences");
  10268. let index = 0;
  10269. for (const entry of diffEncoding) {
  10270. const data = xref.fetchIfRef(entry);
  10271. if (typeof data === "number") {
  10272. index = data;
  10273. } else if (data instanceof _primitives.Name) {
  10274. differences[index++] = data.name;
  10275. } else {
  10276. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  10277. }
  10278. }
  10279. }
  10280. } else if (encoding instanceof _primitives.Name) {
  10281. baseEncodingName = encoding.name;
  10282. } else {
  10283. const msg = "Encoding is not a Name nor a Dict";
  10284. if (!this.options.ignoreErrors) {
  10285. throw new _util.FormatError(msg);
  10286. }
  10287. (0, _util.warn)(msg);
  10288. }
  10289. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  10290. baseEncodingName = null;
  10291. }
  10292. }
  10293. if (baseEncodingName) {
  10294. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10295. } else {
  10296. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  10297. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  10298. encoding = _encodings.StandardEncoding;
  10299. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  10300. encoding = _encodings.WinAnsiEncoding;
  10301. }
  10302. if (isSymbolicFont) {
  10303. encoding = _encodings.MacRomanEncoding;
  10304. if (!properties.file || properties.isInternalFont) {
  10305. if (/Symbol/i.test(properties.name)) {
  10306. encoding = _encodings.SymbolSetEncoding;
  10307. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  10308. encoding = _encodings.ZapfDingbatsEncoding;
  10309. }
  10310. }
  10311. }
  10312. properties.defaultEncoding = encoding;
  10313. }
  10314. properties.differences = differences;
  10315. properties.baseEncodingName = baseEncodingName;
  10316. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  10317. properties.dict = dict;
  10318. return toUnicodePromise.then(readToUnicode => {
  10319. properties.toUnicode = readToUnicode;
  10320. return this.buildToUnicode(properties);
  10321. }).then(builtToUnicode => {
  10322. properties.toUnicode = builtToUnicode;
  10323. if (cidToGidBytes) {
  10324. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  10325. }
  10326. return properties;
  10327. });
  10328. }
  10329. _simpleFontToUnicode(properties, forceGlyphs = false) {
  10330. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  10331. const toUnicode = [];
  10332. const encoding = properties.defaultEncoding.slice();
  10333. const baseEncodingName = properties.baseEncodingName;
  10334. const differences = properties.differences;
  10335. for (const charcode in differences) {
  10336. const glyphName = differences[charcode];
  10337. if (glyphName === ".notdef") {
  10338. continue;
  10339. }
  10340. encoding[charcode] = glyphName;
  10341. }
  10342. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  10343. for (const charcode in encoding) {
  10344. let glyphName = encoding[charcode];
  10345. if (glyphName === "") {
  10346. continue;
  10347. }
  10348. let unicode = glyphsUnicodeMap[glyphName];
  10349. if (unicode !== undefined) {
  10350. toUnicode[charcode] = String.fromCharCode(unicode);
  10351. continue;
  10352. }
  10353. let code = 0;
  10354. switch (glyphName[0]) {
  10355. case "G":
  10356. if (glyphName.length === 3) {
  10357. code = parseInt(glyphName.substring(1), 16);
  10358. }
  10359. break;
  10360. case "g":
  10361. if (glyphName.length === 5) {
  10362. code = parseInt(glyphName.substring(1), 16);
  10363. }
  10364. break;
  10365. case "C":
  10366. case "c":
  10367. if (glyphName.length >= 3 && glyphName.length <= 4) {
  10368. const codeStr = glyphName.substring(1);
  10369. if (forceGlyphs) {
  10370. code = parseInt(codeStr, 16);
  10371. break;
  10372. }
  10373. code = +codeStr;
  10374. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  10375. return this._simpleFontToUnicode(properties, true);
  10376. }
  10377. }
  10378. break;
  10379. case "u":
  10380. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  10381. if (unicode !== -1) {
  10382. code = unicode;
  10383. }
  10384. break;
  10385. }
  10386. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  10387. if (baseEncodingName && code === +charcode) {
  10388. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10389. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  10390. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10391. continue;
  10392. }
  10393. }
  10394. toUnicode[charcode] = String.fromCodePoint(code);
  10395. }
  10396. }
  10397. return toUnicode;
  10398. }
  10399. async buildToUnicode(properties) {
  10400. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  10401. if (properties.hasIncludedToUnicodeMap) {
  10402. if (!properties.composite && properties.hasEncoding) {
  10403. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  10404. }
  10405. return properties.toUnicode;
  10406. }
  10407. if (!properties.composite) {
  10408. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  10409. }
  10410. 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"))) {
  10411. const {
  10412. registry,
  10413. ordering
  10414. } = properties.cidSystemInfo;
  10415. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  10416. const ucs2CMap = await _cmap.CMapFactory.create({
  10417. encoding: ucs2CMapName,
  10418. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10419. useCMap: null
  10420. });
  10421. const toUnicode = [];
  10422. properties.cMap.forEach(function (charcode, cid) {
  10423. if (cid > 0xffff) {
  10424. throw new _util.FormatError("Max size of CID is 65,535");
  10425. }
  10426. const ucs2 = ucs2CMap.lookup(cid);
  10427. if (ucs2) {
  10428. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  10429. }
  10430. });
  10431. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  10432. }
  10433. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  10434. }
  10435. readToUnicode(cmapObj) {
  10436. if (!cmapObj) {
  10437. return Promise.resolve(null);
  10438. }
  10439. if (cmapObj instanceof _primitives.Name) {
  10440. return _cmap.CMapFactory.create({
  10441. encoding: cmapObj,
  10442. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10443. useCMap: null
  10444. }).then(function (cmap) {
  10445. if (cmap instanceof _cmap.IdentityCMap) {
  10446. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10447. }
  10448. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  10449. });
  10450. } else if (cmapObj instanceof _base_stream.BaseStream) {
  10451. return _cmap.CMapFactory.create({
  10452. encoding: cmapObj,
  10453. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10454. useCMap: null
  10455. }).then(function (cmap) {
  10456. if (cmap instanceof _cmap.IdentityCMap) {
  10457. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10458. }
  10459. const map = new Array(cmap.length);
  10460. cmap.forEach(function (charCode, token) {
  10461. if (typeof token === "number") {
  10462. map[charCode] = String.fromCodePoint(token);
  10463. return;
  10464. }
  10465. const str = [];
  10466. for (let k = 0; k < token.length; k += 2) {
  10467. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10468. if ((w1 & 0xf800) !== 0xd800) {
  10469. str.push(w1);
  10470. continue;
  10471. }
  10472. k += 2;
  10473. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10474. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  10475. }
  10476. map[charCode] = String.fromCodePoint(...str);
  10477. });
  10478. return new _to_unicode_map.ToUnicodeMap(map);
  10479. }, reason => {
  10480. if (reason instanceof _util.AbortException) {
  10481. return null;
  10482. }
  10483. if (this.options.ignoreErrors) {
  10484. this.handler.send("UnsupportedFeature", {
  10485. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  10486. });
  10487. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  10488. return null;
  10489. }
  10490. throw reason;
  10491. });
  10492. }
  10493. return Promise.resolve(null);
  10494. }
  10495. readCidToGidMap(glyphsData, toUnicode) {
  10496. const result = [];
  10497. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  10498. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  10499. const code = j >> 1;
  10500. if (glyphID === 0 && !toUnicode.has(code)) {
  10501. continue;
  10502. }
  10503. result[code] = glyphID;
  10504. }
  10505. return result;
  10506. }
  10507. extractWidths(dict, descriptor, properties) {
  10508. const xref = this.xref;
  10509. let glyphsWidths = [];
  10510. let defaultWidth = 0;
  10511. const glyphsVMetrics = [];
  10512. let defaultVMetrics;
  10513. let i, ii, j, jj, start, code, widths;
  10514. if (properties.composite) {
  10515. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  10516. widths = dict.get("W");
  10517. if (widths) {
  10518. for (i = 0, ii = widths.length; i < ii; i++) {
  10519. start = xref.fetchIfRef(widths[i++]);
  10520. code = xref.fetchIfRef(widths[i]);
  10521. if (Array.isArray(code)) {
  10522. for (j = 0, jj = code.length; j < jj; j++) {
  10523. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  10524. }
  10525. } else {
  10526. const width = xref.fetchIfRef(widths[++i]);
  10527. for (j = start; j <= code; j++) {
  10528. glyphsWidths[j] = width;
  10529. }
  10530. }
  10531. }
  10532. }
  10533. if (properties.vertical) {
  10534. let vmetrics = dict.getArray("DW2") || [880, -1000];
  10535. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  10536. vmetrics = dict.get("W2");
  10537. if (vmetrics) {
  10538. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  10539. start = xref.fetchIfRef(vmetrics[i++]);
  10540. code = xref.fetchIfRef(vmetrics[i]);
  10541. if (Array.isArray(code)) {
  10542. for (j = 0, jj = code.length; j < jj; j++) {
  10543. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  10544. }
  10545. } else {
  10546. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  10547. for (j = start; j <= code; j++) {
  10548. glyphsVMetrics[j] = vmetric;
  10549. }
  10550. }
  10551. }
  10552. }
  10553. }
  10554. } else {
  10555. const firstChar = properties.firstChar;
  10556. widths = dict.get("Widths");
  10557. if (widths) {
  10558. j = firstChar;
  10559. for (i = 0, ii = widths.length; i < ii; i++) {
  10560. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  10561. }
  10562. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  10563. } else {
  10564. const baseFontName = dict.get("BaseFont");
  10565. if (baseFontName instanceof _primitives.Name) {
  10566. const metrics = this.getBaseFontMetrics(baseFontName.name);
  10567. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  10568. defaultWidth = metrics.defaultWidth;
  10569. }
  10570. }
  10571. }
  10572. let isMonospace = true;
  10573. let firstWidth = defaultWidth;
  10574. for (const glyph in glyphsWidths) {
  10575. const glyphWidth = glyphsWidths[glyph];
  10576. if (!glyphWidth) {
  10577. continue;
  10578. }
  10579. if (!firstWidth) {
  10580. firstWidth = glyphWidth;
  10581. continue;
  10582. }
  10583. if (firstWidth !== glyphWidth) {
  10584. isMonospace = false;
  10585. break;
  10586. }
  10587. }
  10588. if (isMonospace) {
  10589. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  10590. }
  10591. properties.defaultWidth = defaultWidth;
  10592. properties.widths = glyphsWidths;
  10593. properties.defaultVMetrics = defaultVMetrics;
  10594. properties.vmetrics = glyphsVMetrics;
  10595. }
  10596. isSerifFont(baseFontName) {
  10597. const fontNameWoStyle = baseFontName.split("-")[0];
  10598. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  10599. }
  10600. getBaseFontMetrics(name) {
  10601. let defaultWidth = 0;
  10602. let widths = Object.create(null);
  10603. let monospace = false;
  10604. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  10605. let lookupName = stdFontMap[name] || name;
  10606. const Metrics = (0, _metrics.getMetrics)();
  10607. if (!(lookupName in Metrics)) {
  10608. if (this.isSerifFont(name)) {
  10609. lookupName = "Times-Roman";
  10610. } else {
  10611. lookupName = "Helvetica";
  10612. }
  10613. }
  10614. const glyphWidths = Metrics[lookupName];
  10615. if (typeof glyphWidths === "number") {
  10616. defaultWidth = glyphWidths;
  10617. monospace = true;
  10618. } else {
  10619. widths = glyphWidths();
  10620. }
  10621. return {
  10622. defaultWidth,
  10623. monospace,
  10624. widths
  10625. };
  10626. }
  10627. buildCharCodeToWidth(widthsByGlyphName, properties) {
  10628. const widths = Object.create(null);
  10629. const differences = properties.differences;
  10630. const encoding = properties.defaultEncoding;
  10631. for (let charCode = 0; charCode < 256; charCode++) {
  10632. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  10633. widths[charCode] = widthsByGlyphName[differences[charCode]];
  10634. continue;
  10635. }
  10636. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  10637. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  10638. continue;
  10639. }
  10640. }
  10641. return widths;
  10642. }
  10643. preEvaluateFont(dict) {
  10644. const baseDict = dict;
  10645. let type = dict.get("Subtype");
  10646. if (!(type instanceof _primitives.Name)) {
  10647. throw new _util.FormatError("invalid font Subtype");
  10648. }
  10649. let composite = false;
  10650. let hash, toUnicode;
  10651. if (type.name === "Type0") {
  10652. const df = dict.get("DescendantFonts");
  10653. if (!df) {
  10654. throw new _util.FormatError("Descendant fonts are not specified");
  10655. }
  10656. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  10657. if (!(dict instanceof _primitives.Dict)) {
  10658. throw new _util.FormatError("Descendant font is not a dictionary.");
  10659. }
  10660. type = dict.get("Subtype");
  10661. if (!(type instanceof _primitives.Name)) {
  10662. throw new _util.FormatError("invalid font Subtype");
  10663. }
  10664. composite = true;
  10665. }
  10666. const firstChar = dict.get("FirstChar") || 0,
  10667. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  10668. const descriptor = dict.get("FontDescriptor");
  10669. if (descriptor) {
  10670. hash = new _murmurhash.MurmurHash3_64();
  10671. const encoding = baseDict.getRaw("Encoding");
  10672. if (encoding instanceof _primitives.Name) {
  10673. hash.update(encoding.name);
  10674. } else if (encoding instanceof _primitives.Ref) {
  10675. hash.update(encoding.toString());
  10676. } else if (encoding instanceof _primitives.Dict) {
  10677. for (const entry of encoding.getRawValues()) {
  10678. if (entry instanceof _primitives.Name) {
  10679. hash.update(entry.name);
  10680. } else if (entry instanceof _primitives.Ref) {
  10681. hash.update(entry.toString());
  10682. } else if (Array.isArray(entry)) {
  10683. const diffLength = entry.length,
  10684. diffBuf = new Array(diffLength);
  10685. for (let j = 0; j < diffLength; j++) {
  10686. const diffEntry = entry[j];
  10687. if (diffEntry instanceof _primitives.Name) {
  10688. diffBuf[j] = diffEntry.name;
  10689. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  10690. diffBuf[j] = diffEntry.toString();
  10691. }
  10692. }
  10693. hash.update(diffBuf.join());
  10694. }
  10695. }
  10696. }
  10697. hash.update(`${firstChar}-${lastChar}`);
  10698. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  10699. if (toUnicode instanceof _base_stream.BaseStream) {
  10700. const stream = toUnicode.str || toUnicode;
  10701. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  10702. hash.update(uint8array);
  10703. } else if (toUnicode instanceof _primitives.Name) {
  10704. hash.update(toUnicode.name);
  10705. }
  10706. const widths = dict.get("Widths") || baseDict.get("Widths");
  10707. if (Array.isArray(widths)) {
  10708. const widthsBuf = [];
  10709. for (const entry of widths) {
  10710. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  10711. widthsBuf.push(entry.toString());
  10712. }
  10713. }
  10714. hash.update(widthsBuf.join());
  10715. }
  10716. if (composite) {
  10717. hash.update("compositeFont");
  10718. const compositeWidths = dict.get("W") || baseDict.get("W");
  10719. if (Array.isArray(compositeWidths)) {
  10720. const widthsBuf = [];
  10721. for (const entry of compositeWidths) {
  10722. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  10723. widthsBuf.push(entry.toString());
  10724. } else if (Array.isArray(entry)) {
  10725. const subWidthsBuf = [];
  10726. for (const element of entry) {
  10727. if (typeof element === "number" || element instanceof _primitives.Ref) {
  10728. subWidthsBuf.push(element.toString());
  10729. }
  10730. }
  10731. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  10732. }
  10733. }
  10734. hash.update(widthsBuf.join());
  10735. }
  10736. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  10737. if (cidToGidMap instanceof _primitives.Name) {
  10738. hash.update(cidToGidMap.name);
  10739. } else if (cidToGidMap instanceof _primitives.Ref) {
  10740. hash.update(cidToGidMap.toString());
  10741. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  10742. hash.update(cidToGidMap.peekBytes());
  10743. }
  10744. }
  10745. }
  10746. return {
  10747. descriptor,
  10748. dict,
  10749. baseDict,
  10750. composite,
  10751. type: type.name,
  10752. firstChar,
  10753. lastChar,
  10754. toUnicode,
  10755. hash: hash ? hash.hexdigest() : ""
  10756. };
  10757. }
  10758. async translateFont({
  10759. descriptor,
  10760. dict,
  10761. baseDict,
  10762. composite,
  10763. type,
  10764. firstChar,
  10765. lastChar,
  10766. toUnicode,
  10767. cssFontInfo
  10768. }) {
  10769. const isType3Font = type === "Type3";
  10770. let properties;
  10771. if (!descriptor) {
  10772. if (isType3Font) {
  10773. descriptor = new _primitives.Dict(null);
  10774. descriptor.set("FontName", _primitives.Name.get(type));
  10775. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  10776. } else {
  10777. let baseFontName = dict.get("BaseFont");
  10778. if (!(baseFontName instanceof _primitives.Name)) {
  10779. throw new _util.FormatError("Base font is not specified");
  10780. }
  10781. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  10782. const metrics = this.getBaseFontMetrics(baseFontName);
  10783. const fontNameWoStyle = baseFontName.split("-")[0];
  10784. 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);
  10785. properties = {
  10786. type,
  10787. name: baseFontName,
  10788. loadedName: baseDict.loadedName,
  10789. widths: metrics.widths,
  10790. defaultWidth: metrics.defaultWidth,
  10791. isSimulatedFlags: true,
  10792. flags,
  10793. firstChar,
  10794. lastChar,
  10795. toUnicode,
  10796. xHeight: 0,
  10797. capHeight: 0,
  10798. italicAngle: 0,
  10799. isType3Font
  10800. };
  10801. const widths = dict.get("Widths");
  10802. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  10803. let file = null;
  10804. if (standardFontName) {
  10805. properties.isStandardFont = true;
  10806. file = await this.fetchStandardFontData(standardFontName);
  10807. properties.isInternalFont = !!file;
  10808. }
  10809. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  10810. if (widths) {
  10811. const glyphWidths = [];
  10812. let j = firstChar;
  10813. for (const width of widths) {
  10814. glyphWidths[j++] = this.xref.fetchIfRef(width);
  10815. }
  10816. newProperties.widths = glyphWidths;
  10817. } else {
  10818. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  10819. }
  10820. return new _fonts.Font(baseFontName, file, newProperties);
  10821. });
  10822. }
  10823. }
  10824. let fontName = descriptor.get("FontName");
  10825. let baseFont = dict.get("BaseFont");
  10826. if (typeof fontName === "string") {
  10827. fontName = _primitives.Name.get(fontName);
  10828. }
  10829. if (typeof baseFont === "string") {
  10830. baseFont = _primitives.Name.get(baseFont);
  10831. }
  10832. if (!isType3Font) {
  10833. const fontNameStr = fontName && fontName.name;
  10834. const baseFontStr = baseFont && baseFont.name;
  10835. if (fontNameStr !== baseFontStr) {
  10836. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  10837. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  10838. fontName = baseFont;
  10839. }
  10840. }
  10841. }
  10842. fontName = fontName || baseFont;
  10843. if (!(fontName instanceof _primitives.Name)) {
  10844. throw new _util.FormatError("invalid font name");
  10845. }
  10846. let fontFile, subtype, length1, length2, length3;
  10847. try {
  10848. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  10849. } catch (ex) {
  10850. if (!this.options.ignoreErrors) {
  10851. throw ex;
  10852. }
  10853. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  10854. fontFile = new _stream.NullStream();
  10855. }
  10856. let isStandardFont = false;
  10857. let isInternalFont = false;
  10858. let glyphScaleFactors = null;
  10859. if (fontFile) {
  10860. if (fontFile.dict) {
  10861. const subtypeEntry = fontFile.dict.get("Subtype");
  10862. if (subtypeEntry instanceof _primitives.Name) {
  10863. subtype = subtypeEntry.name;
  10864. }
  10865. length1 = fontFile.dict.get("Length1");
  10866. length2 = fontFile.dict.get("Length2");
  10867. length3 = fontFile.dict.get("Length3");
  10868. }
  10869. } else if (cssFontInfo) {
  10870. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  10871. if (standardFontName) {
  10872. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  10873. cssFontInfo.metrics = standardFontName.metrics || null;
  10874. glyphScaleFactors = standardFontName.factors || null;
  10875. fontFile = await this.fetchStandardFontData(standardFontName.name);
  10876. isInternalFont = !!fontFile;
  10877. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  10878. composite = true;
  10879. }
  10880. } else if (!isType3Font) {
  10881. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  10882. if (standardFontName) {
  10883. isStandardFont = true;
  10884. fontFile = await this.fetchStandardFontData(standardFontName);
  10885. isInternalFont = !!fontFile;
  10886. }
  10887. }
  10888. properties = {
  10889. type,
  10890. name: fontName.name,
  10891. subtype,
  10892. file: fontFile,
  10893. length1,
  10894. length2,
  10895. length3,
  10896. isStandardFont,
  10897. isInternalFont,
  10898. loadedName: baseDict.loadedName,
  10899. composite,
  10900. fixedPitch: false,
  10901. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  10902. firstChar,
  10903. lastChar,
  10904. toUnicode,
  10905. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  10906. ascent: descriptor.get("Ascent"),
  10907. descent: descriptor.get("Descent"),
  10908. xHeight: descriptor.get("XHeight") || 0,
  10909. capHeight: descriptor.get("CapHeight") || 0,
  10910. flags: descriptor.get("Flags"),
  10911. italicAngle: descriptor.get("ItalicAngle") || 0,
  10912. isType3Font,
  10913. cssFontInfo,
  10914. scaleFactors: glyphScaleFactors
  10915. };
  10916. if (composite) {
  10917. const cidEncoding = baseDict.get("Encoding");
  10918. if (cidEncoding instanceof _primitives.Name) {
  10919. properties.cidEncoding = cidEncoding.name;
  10920. }
  10921. const cMap = await _cmap.CMapFactory.create({
  10922. encoding: cidEncoding,
  10923. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10924. useCMap: null
  10925. });
  10926. properties.cMap = cMap;
  10927. properties.vertical = properties.cMap.vertical;
  10928. }
  10929. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  10930. this.extractWidths(dict, descriptor, newProperties);
  10931. return new _fonts.Font(fontName.name, fontFile, newProperties);
  10932. });
  10933. }
  10934. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  10935. function buildPath(fontChar) {
  10936. const glyphName = `${font.loadedName}_path_${fontChar}`;
  10937. try {
  10938. if (font.renderer.hasBuiltPath(fontChar)) {
  10939. return;
  10940. }
  10941. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  10942. } catch (reason) {
  10943. if (evaluatorOptions.ignoreErrors) {
  10944. handler.send("UnsupportedFeature", {
  10945. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  10946. });
  10947. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  10948. return;
  10949. }
  10950. throw reason;
  10951. }
  10952. }
  10953. for (const glyph of glyphs) {
  10954. buildPath(glyph.fontChar);
  10955. const accent = glyph.accent;
  10956. if (accent && accent.fontChar) {
  10957. buildPath(accent.fontChar);
  10958. }
  10959. }
  10960. }
  10961. static get fallbackFontDict() {
  10962. const dict = new _primitives.Dict();
  10963. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  10964. dict.set("Type", _primitives.Name.get("FallbackType"));
  10965. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  10966. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  10967. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  10968. }
  10969. }
  10970. exports.PartialEvaluator = PartialEvaluator;
  10971. class TranslatedFont {
  10972. constructor({
  10973. loadedName,
  10974. font,
  10975. dict,
  10976. evaluatorOptions
  10977. }) {
  10978. this.loadedName = loadedName;
  10979. this.font = font;
  10980. this.dict = dict;
  10981. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  10982. this.type3Loaded = null;
  10983. this.type3Dependencies = font.isType3Font ? new Set() : null;
  10984. this.sent = false;
  10985. }
  10986. send(handler) {
  10987. if (this.sent) {
  10988. return;
  10989. }
  10990. this.sent = true;
  10991. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  10992. }
  10993. fallback(handler) {
  10994. if (!this.font.data) {
  10995. return;
  10996. }
  10997. this.font.disableFontFace = true;
  10998. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  10999. }
  11000. loadType3Data(evaluator, resources, task) {
  11001. if (this.type3Loaded) {
  11002. return this.type3Loaded;
  11003. }
  11004. if (!this.font.isType3Font) {
  11005. throw new Error("Must be a Type3 font.");
  11006. }
  11007. const type3Evaluator = evaluator.clone({
  11008. ignoreErrors: false
  11009. });
  11010. type3Evaluator.parsingType3Font = true;
  11011. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  11012. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  11013. type3FontRefs.put(this.dict.objId);
  11014. }
  11015. type3Evaluator.type3FontRefs = type3FontRefs;
  11016. const translatedFont = this.font,
  11017. type3Dependencies = this.type3Dependencies;
  11018. let loadCharProcsPromise = Promise.resolve();
  11019. const charProcs = this.dict.get("CharProcs");
  11020. const fontResources = this.dict.get("Resources") || resources;
  11021. const charProcOperatorList = Object.create(null);
  11022. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  11023. width = fontBBox[2] - fontBBox[0],
  11024. height = fontBBox[3] - fontBBox[1];
  11025. const fontBBoxSize = Math.hypot(width, height);
  11026. for (const key of charProcs.getKeys()) {
  11027. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  11028. const glyphStream = charProcs.get(key);
  11029. const operatorList = new _operator_list.OperatorList();
  11030. return type3Evaluator.getOperatorList({
  11031. stream: glyphStream,
  11032. task,
  11033. resources: fontResources,
  11034. operatorList
  11035. }).then(() => {
  11036. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  11037. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  11038. }
  11039. charProcOperatorList[key] = operatorList.getIR();
  11040. for (const dependency of operatorList.dependencies) {
  11041. type3Dependencies.add(dependency);
  11042. }
  11043. }).catch(function (reason) {
  11044. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  11045. const dummyOperatorList = new _operator_list.OperatorList();
  11046. charProcOperatorList[key] = dummyOperatorList.getIR();
  11047. });
  11048. });
  11049. }
  11050. this.type3Loaded = loadCharProcsPromise.then(() => {
  11051. translatedFont.charProcOperatorList = charProcOperatorList;
  11052. if (this._bbox) {
  11053. translatedFont.isCharBBox = true;
  11054. translatedFont.bbox = this._bbox;
  11055. }
  11056. });
  11057. return this.type3Loaded;
  11058. }
  11059. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  11060. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  11061. width = charBBox[2] - charBBox[0],
  11062. height = charBBox[3] - charBBox[1];
  11063. const charBBoxSize = Math.hypot(width, height);
  11064. if (width === 0 || height === 0) {
  11065. operatorList.fnArray.splice(0, 1);
  11066. operatorList.argsArray.splice(0, 1);
  11067. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  11068. if (!this._bbox) {
  11069. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  11070. }
  11071. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  11072. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  11073. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  11074. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  11075. }
  11076. let i = 0,
  11077. ii = operatorList.length;
  11078. while (i < ii) {
  11079. switch (operatorList.fnArray[i]) {
  11080. case _util.OPS.setCharWidthAndBounds:
  11081. break;
  11082. case _util.OPS.setStrokeColorSpace:
  11083. case _util.OPS.setFillColorSpace:
  11084. case _util.OPS.setStrokeColor:
  11085. case _util.OPS.setStrokeColorN:
  11086. case _util.OPS.setFillColor:
  11087. case _util.OPS.setFillColorN:
  11088. case _util.OPS.setStrokeGray:
  11089. case _util.OPS.setFillGray:
  11090. case _util.OPS.setStrokeRGBColor:
  11091. case _util.OPS.setFillRGBColor:
  11092. case _util.OPS.setStrokeCMYKColor:
  11093. case _util.OPS.setFillCMYKColor:
  11094. case _util.OPS.shadingFill:
  11095. case _util.OPS.setRenderingIntent:
  11096. operatorList.fnArray.splice(i, 1);
  11097. operatorList.argsArray.splice(i, 1);
  11098. ii--;
  11099. continue;
  11100. case _util.OPS.setGState:
  11101. const [gStateObj] = operatorList.argsArray[i];
  11102. let j = 0,
  11103. jj = gStateObj.length;
  11104. while (j < jj) {
  11105. const [gStateKey] = gStateObj[j];
  11106. switch (gStateKey) {
  11107. case "TR":
  11108. case "TR2":
  11109. case "HT":
  11110. case "BG":
  11111. case "BG2":
  11112. case "UCR":
  11113. case "UCR2":
  11114. gStateObj.splice(j, 1);
  11115. jj--;
  11116. continue;
  11117. }
  11118. j++;
  11119. }
  11120. break;
  11121. }
  11122. i++;
  11123. }
  11124. }
  11125. }
  11126. class StateManager {
  11127. constructor(initialState = new EvalState()) {
  11128. this.state = initialState;
  11129. this.stateStack = [];
  11130. }
  11131. save() {
  11132. const old = this.state;
  11133. this.stateStack.push(this.state);
  11134. this.state = old.clone();
  11135. }
  11136. restore() {
  11137. const prev = this.stateStack.pop();
  11138. if (prev) {
  11139. this.state = prev;
  11140. }
  11141. }
  11142. transform(args) {
  11143. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  11144. }
  11145. }
  11146. class TextState {
  11147. constructor() {
  11148. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11149. this.fontName = null;
  11150. this.fontSize = 0;
  11151. this.font = null;
  11152. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  11153. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  11154. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  11155. this.charSpacing = 0;
  11156. this.wordSpacing = 0;
  11157. this.leading = 0;
  11158. this.textHScale = 1;
  11159. this.textRise = 0;
  11160. }
  11161. setTextMatrix(a, b, c, d, e, f) {
  11162. const m = this.textMatrix;
  11163. m[0] = a;
  11164. m[1] = b;
  11165. m[2] = c;
  11166. m[3] = d;
  11167. m[4] = e;
  11168. m[5] = f;
  11169. }
  11170. setTextLineMatrix(a, b, c, d, e, f) {
  11171. const m = this.textLineMatrix;
  11172. m[0] = a;
  11173. m[1] = b;
  11174. m[2] = c;
  11175. m[3] = d;
  11176. m[4] = e;
  11177. m[5] = f;
  11178. }
  11179. translateTextMatrix(x, y) {
  11180. const m = this.textMatrix;
  11181. m[4] = m[0] * x + m[2] * y + m[4];
  11182. m[5] = m[1] * x + m[3] * y + m[5];
  11183. }
  11184. translateTextLineMatrix(x, y) {
  11185. const m = this.textLineMatrix;
  11186. m[4] = m[0] * x + m[2] * y + m[4];
  11187. m[5] = m[1] * x + m[3] * y + m[5];
  11188. }
  11189. carriageReturn() {
  11190. this.translateTextLineMatrix(0, -this.leading);
  11191. this.textMatrix = this.textLineMatrix.slice();
  11192. }
  11193. clone() {
  11194. const clone = Object.create(this);
  11195. clone.textMatrix = this.textMatrix.slice();
  11196. clone.textLineMatrix = this.textLineMatrix.slice();
  11197. clone.fontMatrix = this.fontMatrix.slice();
  11198. return clone;
  11199. }
  11200. }
  11201. class EvalState {
  11202. constructor() {
  11203. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11204. this.font = null;
  11205. this.textRenderingMode = _util.TextRenderingMode.FILL;
  11206. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  11207. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  11208. }
  11209. clone() {
  11210. return Object.create(this);
  11211. }
  11212. }
  11213. class EvaluatorPreprocessor {
  11214. static get opMap() {
  11215. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  11216. t.w = {
  11217. id: _util.OPS.setLineWidth,
  11218. numArgs: 1,
  11219. variableArgs: false
  11220. };
  11221. t.J = {
  11222. id: _util.OPS.setLineCap,
  11223. numArgs: 1,
  11224. variableArgs: false
  11225. };
  11226. t.j = {
  11227. id: _util.OPS.setLineJoin,
  11228. numArgs: 1,
  11229. variableArgs: false
  11230. };
  11231. t.M = {
  11232. id: _util.OPS.setMiterLimit,
  11233. numArgs: 1,
  11234. variableArgs: false
  11235. };
  11236. t.d = {
  11237. id: _util.OPS.setDash,
  11238. numArgs: 2,
  11239. variableArgs: false
  11240. };
  11241. t.ri = {
  11242. id: _util.OPS.setRenderingIntent,
  11243. numArgs: 1,
  11244. variableArgs: false
  11245. };
  11246. t.i = {
  11247. id: _util.OPS.setFlatness,
  11248. numArgs: 1,
  11249. variableArgs: false
  11250. };
  11251. t.gs = {
  11252. id: _util.OPS.setGState,
  11253. numArgs: 1,
  11254. variableArgs: false
  11255. };
  11256. t.q = {
  11257. id: _util.OPS.save,
  11258. numArgs: 0,
  11259. variableArgs: false
  11260. };
  11261. t.Q = {
  11262. id: _util.OPS.restore,
  11263. numArgs: 0,
  11264. variableArgs: false
  11265. };
  11266. t.cm = {
  11267. id: _util.OPS.transform,
  11268. numArgs: 6,
  11269. variableArgs: false
  11270. };
  11271. t.m = {
  11272. id: _util.OPS.moveTo,
  11273. numArgs: 2,
  11274. variableArgs: false
  11275. };
  11276. t.l = {
  11277. id: _util.OPS.lineTo,
  11278. numArgs: 2,
  11279. variableArgs: false
  11280. };
  11281. t.c = {
  11282. id: _util.OPS.curveTo,
  11283. numArgs: 6,
  11284. variableArgs: false
  11285. };
  11286. t.v = {
  11287. id: _util.OPS.curveTo2,
  11288. numArgs: 4,
  11289. variableArgs: false
  11290. };
  11291. t.y = {
  11292. id: _util.OPS.curveTo3,
  11293. numArgs: 4,
  11294. variableArgs: false
  11295. };
  11296. t.h = {
  11297. id: _util.OPS.closePath,
  11298. numArgs: 0,
  11299. variableArgs: false
  11300. };
  11301. t.re = {
  11302. id: _util.OPS.rectangle,
  11303. numArgs: 4,
  11304. variableArgs: false
  11305. };
  11306. t.S = {
  11307. id: _util.OPS.stroke,
  11308. numArgs: 0,
  11309. variableArgs: false
  11310. };
  11311. t.s = {
  11312. id: _util.OPS.closeStroke,
  11313. numArgs: 0,
  11314. variableArgs: false
  11315. };
  11316. t.f = {
  11317. id: _util.OPS.fill,
  11318. numArgs: 0,
  11319. variableArgs: false
  11320. };
  11321. t.F = {
  11322. id: _util.OPS.fill,
  11323. numArgs: 0,
  11324. variableArgs: false
  11325. };
  11326. t["f*"] = {
  11327. id: _util.OPS.eoFill,
  11328. numArgs: 0,
  11329. variableArgs: false
  11330. };
  11331. t.B = {
  11332. id: _util.OPS.fillStroke,
  11333. numArgs: 0,
  11334. variableArgs: false
  11335. };
  11336. t["B*"] = {
  11337. id: _util.OPS.eoFillStroke,
  11338. numArgs: 0,
  11339. variableArgs: false
  11340. };
  11341. t.b = {
  11342. id: _util.OPS.closeFillStroke,
  11343. numArgs: 0,
  11344. variableArgs: false
  11345. };
  11346. t["b*"] = {
  11347. id: _util.OPS.closeEOFillStroke,
  11348. numArgs: 0,
  11349. variableArgs: false
  11350. };
  11351. t.n = {
  11352. id: _util.OPS.endPath,
  11353. numArgs: 0,
  11354. variableArgs: false
  11355. };
  11356. t.W = {
  11357. id: _util.OPS.clip,
  11358. numArgs: 0,
  11359. variableArgs: false
  11360. };
  11361. t["W*"] = {
  11362. id: _util.OPS.eoClip,
  11363. numArgs: 0,
  11364. variableArgs: false
  11365. };
  11366. t.BT = {
  11367. id: _util.OPS.beginText,
  11368. numArgs: 0,
  11369. variableArgs: false
  11370. };
  11371. t.ET = {
  11372. id: _util.OPS.endText,
  11373. numArgs: 0,
  11374. variableArgs: false
  11375. };
  11376. t.Tc = {
  11377. id: _util.OPS.setCharSpacing,
  11378. numArgs: 1,
  11379. variableArgs: false
  11380. };
  11381. t.Tw = {
  11382. id: _util.OPS.setWordSpacing,
  11383. numArgs: 1,
  11384. variableArgs: false
  11385. };
  11386. t.Tz = {
  11387. id: _util.OPS.setHScale,
  11388. numArgs: 1,
  11389. variableArgs: false
  11390. };
  11391. t.TL = {
  11392. id: _util.OPS.setLeading,
  11393. numArgs: 1,
  11394. variableArgs: false
  11395. };
  11396. t.Tf = {
  11397. id: _util.OPS.setFont,
  11398. numArgs: 2,
  11399. variableArgs: false
  11400. };
  11401. t.Tr = {
  11402. id: _util.OPS.setTextRenderingMode,
  11403. numArgs: 1,
  11404. variableArgs: false
  11405. };
  11406. t.Ts = {
  11407. id: _util.OPS.setTextRise,
  11408. numArgs: 1,
  11409. variableArgs: false
  11410. };
  11411. t.Td = {
  11412. id: _util.OPS.moveText,
  11413. numArgs: 2,
  11414. variableArgs: false
  11415. };
  11416. t.TD = {
  11417. id: _util.OPS.setLeadingMoveText,
  11418. numArgs: 2,
  11419. variableArgs: false
  11420. };
  11421. t.Tm = {
  11422. id: _util.OPS.setTextMatrix,
  11423. numArgs: 6,
  11424. variableArgs: false
  11425. };
  11426. t["T*"] = {
  11427. id: _util.OPS.nextLine,
  11428. numArgs: 0,
  11429. variableArgs: false
  11430. };
  11431. t.Tj = {
  11432. id: _util.OPS.showText,
  11433. numArgs: 1,
  11434. variableArgs: false
  11435. };
  11436. t.TJ = {
  11437. id: _util.OPS.showSpacedText,
  11438. numArgs: 1,
  11439. variableArgs: false
  11440. };
  11441. t["'"] = {
  11442. id: _util.OPS.nextLineShowText,
  11443. numArgs: 1,
  11444. variableArgs: false
  11445. };
  11446. t['"'] = {
  11447. id: _util.OPS.nextLineSetSpacingShowText,
  11448. numArgs: 3,
  11449. variableArgs: false
  11450. };
  11451. t.d0 = {
  11452. id: _util.OPS.setCharWidth,
  11453. numArgs: 2,
  11454. variableArgs: false
  11455. };
  11456. t.d1 = {
  11457. id: _util.OPS.setCharWidthAndBounds,
  11458. numArgs: 6,
  11459. variableArgs: false
  11460. };
  11461. t.CS = {
  11462. id: _util.OPS.setStrokeColorSpace,
  11463. numArgs: 1,
  11464. variableArgs: false
  11465. };
  11466. t.cs = {
  11467. id: _util.OPS.setFillColorSpace,
  11468. numArgs: 1,
  11469. variableArgs: false
  11470. };
  11471. t.SC = {
  11472. id: _util.OPS.setStrokeColor,
  11473. numArgs: 4,
  11474. variableArgs: true
  11475. };
  11476. t.SCN = {
  11477. id: _util.OPS.setStrokeColorN,
  11478. numArgs: 33,
  11479. variableArgs: true
  11480. };
  11481. t.sc = {
  11482. id: _util.OPS.setFillColor,
  11483. numArgs: 4,
  11484. variableArgs: true
  11485. };
  11486. t.scn = {
  11487. id: _util.OPS.setFillColorN,
  11488. numArgs: 33,
  11489. variableArgs: true
  11490. };
  11491. t.G = {
  11492. id: _util.OPS.setStrokeGray,
  11493. numArgs: 1,
  11494. variableArgs: false
  11495. };
  11496. t.g = {
  11497. id: _util.OPS.setFillGray,
  11498. numArgs: 1,
  11499. variableArgs: false
  11500. };
  11501. t.RG = {
  11502. id: _util.OPS.setStrokeRGBColor,
  11503. numArgs: 3,
  11504. variableArgs: false
  11505. };
  11506. t.rg = {
  11507. id: _util.OPS.setFillRGBColor,
  11508. numArgs: 3,
  11509. variableArgs: false
  11510. };
  11511. t.K = {
  11512. id: _util.OPS.setStrokeCMYKColor,
  11513. numArgs: 4,
  11514. variableArgs: false
  11515. };
  11516. t.k = {
  11517. id: _util.OPS.setFillCMYKColor,
  11518. numArgs: 4,
  11519. variableArgs: false
  11520. };
  11521. t.sh = {
  11522. id: _util.OPS.shadingFill,
  11523. numArgs: 1,
  11524. variableArgs: false
  11525. };
  11526. t.BI = {
  11527. id: _util.OPS.beginInlineImage,
  11528. numArgs: 0,
  11529. variableArgs: false
  11530. };
  11531. t.ID = {
  11532. id: _util.OPS.beginImageData,
  11533. numArgs: 0,
  11534. variableArgs: false
  11535. };
  11536. t.EI = {
  11537. id: _util.OPS.endInlineImage,
  11538. numArgs: 1,
  11539. variableArgs: false
  11540. };
  11541. t.Do = {
  11542. id: _util.OPS.paintXObject,
  11543. numArgs: 1,
  11544. variableArgs: false
  11545. };
  11546. t.MP = {
  11547. id: _util.OPS.markPoint,
  11548. numArgs: 1,
  11549. variableArgs: false
  11550. };
  11551. t.DP = {
  11552. id: _util.OPS.markPointProps,
  11553. numArgs: 2,
  11554. variableArgs: false
  11555. };
  11556. t.BMC = {
  11557. id: _util.OPS.beginMarkedContent,
  11558. numArgs: 1,
  11559. variableArgs: false
  11560. };
  11561. t.BDC = {
  11562. id: _util.OPS.beginMarkedContentProps,
  11563. numArgs: 2,
  11564. variableArgs: false
  11565. };
  11566. t.EMC = {
  11567. id: _util.OPS.endMarkedContent,
  11568. numArgs: 0,
  11569. variableArgs: false
  11570. };
  11571. t.BX = {
  11572. id: _util.OPS.beginCompat,
  11573. numArgs: 0,
  11574. variableArgs: false
  11575. };
  11576. t.EX = {
  11577. id: _util.OPS.endCompat,
  11578. numArgs: 0,
  11579. variableArgs: false
  11580. };
  11581. t.BM = null;
  11582. t.BD = null;
  11583. t.true = null;
  11584. t.fa = null;
  11585. t.fal = null;
  11586. t.fals = null;
  11587. t.false = null;
  11588. t.nu = null;
  11589. t.nul = null;
  11590. t.null = null;
  11591. });
  11592. return (0, _util.shadow)(this, "opMap", getOPMap());
  11593. }
  11594. static get MAX_INVALID_PATH_OPS() {
  11595. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  11596. }
  11597. constructor(stream, xref, stateManager = new StateManager()) {
  11598. this.parser = new _parser.Parser({
  11599. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  11600. xref
  11601. });
  11602. this.stateManager = stateManager;
  11603. this.nonProcessedArgs = [];
  11604. this._isPathOp = false;
  11605. this._numInvalidPathOPS = 0;
  11606. }
  11607. get savedStatesDepth() {
  11608. return this.stateManager.stateStack.length;
  11609. }
  11610. read(operation) {
  11611. let args = operation.args;
  11612. while (true) {
  11613. const obj = this.parser.getObj();
  11614. if (obj instanceof _primitives.Cmd) {
  11615. const cmd = obj.cmd;
  11616. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  11617. if (!opSpec) {
  11618. (0, _util.warn)(`Unknown command "${cmd}".`);
  11619. continue;
  11620. }
  11621. const fn = opSpec.id;
  11622. const numArgs = opSpec.numArgs;
  11623. let argsLength = args !== null ? args.length : 0;
  11624. if (!this._isPathOp) {
  11625. this._numInvalidPathOPS = 0;
  11626. }
  11627. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  11628. if (!opSpec.variableArgs) {
  11629. if (argsLength !== numArgs) {
  11630. const nonProcessedArgs = this.nonProcessedArgs;
  11631. while (argsLength > numArgs) {
  11632. nonProcessedArgs.push(args.shift());
  11633. argsLength--;
  11634. }
  11635. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  11636. if (args === null) {
  11637. args = [];
  11638. }
  11639. args.unshift(nonProcessedArgs.pop());
  11640. argsLength++;
  11641. }
  11642. }
  11643. if (argsLength < numArgs) {
  11644. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  11645. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  11646. throw new _util.FormatError(`Invalid ${partialMsg}`);
  11647. }
  11648. (0, _util.warn)(`Skipping ${partialMsg}`);
  11649. if (args !== null) {
  11650. args.length = 0;
  11651. }
  11652. continue;
  11653. }
  11654. } else if (argsLength > numArgs) {
  11655. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  11656. }
  11657. this.preprocessCommand(fn, args);
  11658. operation.fn = fn;
  11659. operation.args = args;
  11660. return true;
  11661. }
  11662. if (obj === _primitives.EOF) {
  11663. return false;
  11664. }
  11665. if (obj !== null) {
  11666. if (args === null) {
  11667. args = [];
  11668. }
  11669. args.push(obj);
  11670. if (args.length > 33) {
  11671. throw new _util.FormatError("Too many arguments");
  11672. }
  11673. }
  11674. }
  11675. }
  11676. preprocessCommand(fn, args) {
  11677. switch (fn | 0) {
  11678. case _util.OPS.save:
  11679. this.stateManager.save();
  11680. break;
  11681. case _util.OPS.restore:
  11682. this.stateManager.restore();
  11683. break;
  11684. case _util.OPS.transform:
  11685. this.stateManager.transform(args);
  11686. break;
  11687. }
  11688. }
  11689. }
  11690. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  11691. /***/ }),
  11692. /* 14 */
  11693. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11694. Object.defineProperty(exports, "__esModule", ({
  11695. value: true
  11696. }));
  11697. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  11698. var _util = __w_pdfjs_require__(2);
  11699. var _primitives = __w_pdfjs_require__(3);
  11700. var _base_stream = __w_pdfjs_require__(5);
  11701. var _parser = __w_pdfjs_require__(15);
  11702. var _core_utils = __w_pdfjs_require__(4);
  11703. var _stream = __w_pdfjs_require__(8);
  11704. 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"];
  11705. const MAX_MAP_RANGE = 2 ** 24 - 1;
  11706. class CMap {
  11707. constructor(builtInCMap = false) {
  11708. this.codespaceRanges = [[], [], [], []];
  11709. this.numCodespaceRanges = 0;
  11710. this._map = [];
  11711. this.name = "";
  11712. this.vertical = false;
  11713. this.useCMap = null;
  11714. this.builtInCMap = builtInCMap;
  11715. }
  11716. addCodespaceRange(n, low, high) {
  11717. this.codespaceRanges[n - 1].push(low, high);
  11718. this.numCodespaceRanges++;
  11719. }
  11720. mapCidRange(low, high, dstLow) {
  11721. if (high - low > MAX_MAP_RANGE) {
  11722. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  11723. }
  11724. while (low <= high) {
  11725. this._map[low++] = dstLow++;
  11726. }
  11727. }
  11728. mapBfRange(low, high, dstLow) {
  11729. if (high - low > MAX_MAP_RANGE) {
  11730. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  11731. }
  11732. const lastByte = dstLow.length - 1;
  11733. while (low <= high) {
  11734. this._map[low++] = dstLow;
  11735. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  11736. if (nextCharCode > 0xff) {
  11737. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  11738. continue;
  11739. }
  11740. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  11741. }
  11742. }
  11743. mapBfRangeToArray(low, high, array) {
  11744. if (high - low > MAX_MAP_RANGE) {
  11745. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  11746. }
  11747. const ii = array.length;
  11748. let i = 0;
  11749. while (low <= high && i < ii) {
  11750. this._map[low] = array[i++];
  11751. ++low;
  11752. }
  11753. }
  11754. mapOne(src, dst) {
  11755. this._map[src] = dst;
  11756. }
  11757. lookup(code) {
  11758. return this._map[code];
  11759. }
  11760. contains(code) {
  11761. return this._map[code] !== undefined;
  11762. }
  11763. forEach(callback) {
  11764. const map = this._map;
  11765. const length = map.length;
  11766. if (length <= 0x10000) {
  11767. for (let i = 0; i < length; i++) {
  11768. if (map[i] !== undefined) {
  11769. callback(i, map[i]);
  11770. }
  11771. }
  11772. } else {
  11773. for (const i in map) {
  11774. callback(i, map[i]);
  11775. }
  11776. }
  11777. }
  11778. charCodeOf(value) {
  11779. const map = this._map;
  11780. if (map.length <= 0x10000) {
  11781. return map.indexOf(value);
  11782. }
  11783. for (const charCode in map) {
  11784. if (map[charCode] === value) {
  11785. return charCode | 0;
  11786. }
  11787. }
  11788. return -1;
  11789. }
  11790. getMap() {
  11791. return this._map;
  11792. }
  11793. readCharCode(str, offset, out) {
  11794. let c = 0;
  11795. const codespaceRanges = this.codespaceRanges;
  11796. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  11797. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  11798. const codespaceRange = codespaceRanges[n];
  11799. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  11800. const low = codespaceRange[k++];
  11801. const high = codespaceRange[k++];
  11802. if (c >= low && c <= high) {
  11803. out.charcode = c;
  11804. out.length = n + 1;
  11805. return;
  11806. }
  11807. }
  11808. }
  11809. out.charcode = 0;
  11810. out.length = 1;
  11811. }
  11812. getCharCodeLength(charCode) {
  11813. const codespaceRanges = this.codespaceRanges;
  11814. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  11815. const codespaceRange = codespaceRanges[n];
  11816. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  11817. const low = codespaceRange[k++];
  11818. const high = codespaceRange[k++];
  11819. if (charCode >= low && charCode <= high) {
  11820. return n + 1;
  11821. }
  11822. }
  11823. }
  11824. return 1;
  11825. }
  11826. get length() {
  11827. return this._map.length;
  11828. }
  11829. get isIdentityCMap() {
  11830. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  11831. return false;
  11832. }
  11833. if (this._map.length !== 0x10000) {
  11834. return false;
  11835. }
  11836. for (let i = 0; i < 0x10000; i++) {
  11837. if (this._map[i] !== i) {
  11838. return false;
  11839. }
  11840. }
  11841. return true;
  11842. }
  11843. }
  11844. exports.CMap = CMap;
  11845. class IdentityCMap extends CMap {
  11846. constructor(vertical, n) {
  11847. super();
  11848. this.vertical = vertical;
  11849. this.addCodespaceRange(n, 0, 0xffff);
  11850. }
  11851. mapCidRange(low, high, dstLow) {
  11852. (0, _util.unreachable)("should not call mapCidRange");
  11853. }
  11854. mapBfRange(low, high, dstLow) {
  11855. (0, _util.unreachable)("should not call mapBfRange");
  11856. }
  11857. mapBfRangeToArray(low, high, array) {
  11858. (0, _util.unreachable)("should not call mapBfRangeToArray");
  11859. }
  11860. mapOne(src, dst) {
  11861. (0, _util.unreachable)("should not call mapCidOne");
  11862. }
  11863. lookup(code) {
  11864. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  11865. }
  11866. contains(code) {
  11867. return Number.isInteger(code) && code <= 0xffff;
  11868. }
  11869. forEach(callback) {
  11870. for (let i = 0; i <= 0xffff; i++) {
  11871. callback(i, i);
  11872. }
  11873. }
  11874. charCodeOf(value) {
  11875. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  11876. }
  11877. getMap() {
  11878. const map = new Array(0x10000);
  11879. for (let i = 0; i <= 0xffff; i++) {
  11880. map[i] = i;
  11881. }
  11882. return map;
  11883. }
  11884. get length() {
  11885. return 0x10000;
  11886. }
  11887. get isIdentityCMap() {
  11888. (0, _util.unreachable)("should not access .isIdentityCMap");
  11889. }
  11890. }
  11891. exports.IdentityCMap = IdentityCMap;
  11892. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  11893. function hexToInt(a, size) {
  11894. let n = 0;
  11895. for (let i = 0; i <= size; i++) {
  11896. n = n << 8 | a[i];
  11897. }
  11898. return n >>> 0;
  11899. }
  11900. function hexToStr(a, size) {
  11901. if (size === 1) {
  11902. return String.fromCharCode(a[0], a[1]);
  11903. }
  11904. if (size === 3) {
  11905. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  11906. }
  11907. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  11908. }
  11909. function addHex(a, b, size) {
  11910. let c = 0;
  11911. for (let i = size; i >= 0; i--) {
  11912. c += a[i] + b[i];
  11913. a[i] = c & 255;
  11914. c >>= 8;
  11915. }
  11916. }
  11917. function incHex(a, size) {
  11918. let c = 1;
  11919. for (let i = size; i >= 0 && c > 0; i--) {
  11920. c += a[i];
  11921. a[i] = c & 255;
  11922. c >>= 8;
  11923. }
  11924. }
  11925. const MAX_NUM_SIZE = 16;
  11926. const MAX_ENCODED_NUM_SIZE = 19;
  11927. class BinaryCMapStream {
  11928. constructor(data) {
  11929. this.buffer = data;
  11930. this.pos = 0;
  11931. this.end = data.length;
  11932. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  11933. }
  11934. readByte() {
  11935. if (this.pos >= this.end) {
  11936. return -1;
  11937. }
  11938. return this.buffer[this.pos++];
  11939. }
  11940. readNumber() {
  11941. let n = 0;
  11942. let last;
  11943. do {
  11944. const b = this.readByte();
  11945. if (b < 0) {
  11946. throw new _util.FormatError("unexpected EOF in bcmap");
  11947. }
  11948. last = !(b & 0x80);
  11949. n = n << 7 | b & 0x7f;
  11950. } while (!last);
  11951. return n;
  11952. }
  11953. readSigned() {
  11954. const n = this.readNumber();
  11955. return n & 1 ? ~(n >>> 1) : n >>> 1;
  11956. }
  11957. readHex(num, size) {
  11958. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  11959. this.pos += size + 1;
  11960. }
  11961. readHexNumber(num, size) {
  11962. let last;
  11963. const stack = this.tmpBuf;
  11964. let sp = 0;
  11965. do {
  11966. const b = this.readByte();
  11967. if (b < 0) {
  11968. throw new _util.FormatError("unexpected EOF in bcmap");
  11969. }
  11970. last = !(b & 0x80);
  11971. stack[sp++] = b & 0x7f;
  11972. } while (!last);
  11973. let i = size,
  11974. buffer = 0,
  11975. bufferSize = 0;
  11976. while (i >= 0) {
  11977. while (bufferSize < 8 && stack.length > 0) {
  11978. buffer |= stack[--sp] << bufferSize;
  11979. bufferSize += 7;
  11980. }
  11981. num[i] = buffer & 255;
  11982. i--;
  11983. buffer >>= 8;
  11984. bufferSize -= 8;
  11985. }
  11986. }
  11987. readHexSigned(num, size) {
  11988. this.readHexNumber(num, size);
  11989. const sign = num[size] & 1 ? 255 : 0;
  11990. let c = 0;
  11991. for (let i = 0; i <= size; i++) {
  11992. c = (c & 1) << 8 | num[i];
  11993. num[i] = c >> 1 ^ sign;
  11994. }
  11995. }
  11996. readString() {
  11997. const len = this.readNumber();
  11998. let s = "";
  11999. for (let i = 0; i < len; i++) {
  12000. s += String.fromCharCode(this.readNumber());
  12001. }
  12002. return s;
  12003. }
  12004. }
  12005. class BinaryCMapReader {
  12006. async process(data, cMap, extend) {
  12007. const stream = new BinaryCMapStream(data);
  12008. const header = stream.readByte();
  12009. cMap.vertical = !!(header & 1);
  12010. let useCMap = null;
  12011. const start = new Uint8Array(MAX_NUM_SIZE);
  12012. const end = new Uint8Array(MAX_NUM_SIZE);
  12013. const char = new Uint8Array(MAX_NUM_SIZE);
  12014. const charCode = new Uint8Array(MAX_NUM_SIZE);
  12015. const tmp = new Uint8Array(MAX_NUM_SIZE);
  12016. let code;
  12017. let b;
  12018. while ((b = stream.readByte()) >= 0) {
  12019. const type = b >> 5;
  12020. if (type === 7) {
  12021. switch (b & 0x1f) {
  12022. case 0:
  12023. stream.readString();
  12024. break;
  12025. case 1:
  12026. useCMap = stream.readString();
  12027. break;
  12028. }
  12029. continue;
  12030. }
  12031. const sequence = !!(b & 0x10);
  12032. const dataSize = b & 15;
  12033. if (dataSize + 1 > MAX_NUM_SIZE) {
  12034. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  12035. }
  12036. const ucs2DataSize = 1;
  12037. const subitemsCount = stream.readNumber();
  12038. switch (type) {
  12039. case 0:
  12040. stream.readHex(start, dataSize);
  12041. stream.readHexNumber(end, dataSize);
  12042. addHex(end, start, dataSize);
  12043. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12044. for (let i = 1; i < subitemsCount; i++) {
  12045. incHex(end, dataSize);
  12046. stream.readHexNumber(start, dataSize);
  12047. addHex(start, end, dataSize);
  12048. stream.readHexNumber(end, dataSize);
  12049. addHex(end, start, dataSize);
  12050. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12051. }
  12052. break;
  12053. case 1:
  12054. stream.readHex(start, dataSize);
  12055. stream.readHexNumber(end, dataSize);
  12056. addHex(end, start, dataSize);
  12057. stream.readNumber();
  12058. for (let i = 1; i < subitemsCount; i++) {
  12059. incHex(end, dataSize);
  12060. stream.readHexNumber(start, dataSize);
  12061. addHex(start, end, dataSize);
  12062. stream.readHexNumber(end, dataSize);
  12063. addHex(end, start, dataSize);
  12064. stream.readNumber();
  12065. }
  12066. break;
  12067. case 2:
  12068. stream.readHex(char, dataSize);
  12069. code = stream.readNumber();
  12070. cMap.mapOne(hexToInt(char, dataSize), code);
  12071. for (let i = 1; i < subitemsCount; i++) {
  12072. incHex(char, dataSize);
  12073. if (!sequence) {
  12074. stream.readHexNumber(tmp, dataSize);
  12075. addHex(char, tmp, dataSize);
  12076. }
  12077. code = stream.readSigned() + (code + 1);
  12078. cMap.mapOne(hexToInt(char, dataSize), code);
  12079. }
  12080. break;
  12081. case 3:
  12082. stream.readHex(start, dataSize);
  12083. stream.readHexNumber(end, dataSize);
  12084. addHex(end, start, dataSize);
  12085. code = stream.readNumber();
  12086. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12087. for (let i = 1; i < subitemsCount; i++) {
  12088. incHex(end, dataSize);
  12089. if (!sequence) {
  12090. stream.readHexNumber(start, dataSize);
  12091. addHex(start, end, dataSize);
  12092. } else {
  12093. start.set(end);
  12094. }
  12095. stream.readHexNumber(end, dataSize);
  12096. addHex(end, start, dataSize);
  12097. code = stream.readNumber();
  12098. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12099. }
  12100. break;
  12101. case 4:
  12102. stream.readHex(char, ucs2DataSize);
  12103. stream.readHex(charCode, dataSize);
  12104. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12105. for (let i = 1; i < subitemsCount; i++) {
  12106. incHex(char, ucs2DataSize);
  12107. if (!sequence) {
  12108. stream.readHexNumber(tmp, ucs2DataSize);
  12109. addHex(char, tmp, ucs2DataSize);
  12110. }
  12111. incHex(charCode, dataSize);
  12112. stream.readHexSigned(tmp, dataSize);
  12113. addHex(charCode, tmp, dataSize);
  12114. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12115. }
  12116. break;
  12117. case 5:
  12118. stream.readHex(start, ucs2DataSize);
  12119. stream.readHexNumber(end, ucs2DataSize);
  12120. addHex(end, start, ucs2DataSize);
  12121. stream.readHex(charCode, dataSize);
  12122. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12123. for (let i = 1; i < subitemsCount; i++) {
  12124. incHex(end, ucs2DataSize);
  12125. if (!sequence) {
  12126. stream.readHexNumber(start, ucs2DataSize);
  12127. addHex(start, end, ucs2DataSize);
  12128. } else {
  12129. start.set(end);
  12130. }
  12131. stream.readHexNumber(end, ucs2DataSize);
  12132. addHex(end, start, ucs2DataSize);
  12133. stream.readHex(charCode, dataSize);
  12134. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12135. }
  12136. break;
  12137. default:
  12138. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  12139. }
  12140. }
  12141. if (useCMap) {
  12142. return extend(useCMap);
  12143. }
  12144. return cMap;
  12145. }
  12146. }
  12147. return BinaryCMapReader;
  12148. }();
  12149. const CMapFactory = function CMapFactoryClosure() {
  12150. function strToInt(str) {
  12151. let a = 0;
  12152. for (let i = 0; i < str.length; i++) {
  12153. a = a << 8 | str.charCodeAt(i);
  12154. }
  12155. return a >>> 0;
  12156. }
  12157. function expectString(obj) {
  12158. if (typeof obj !== "string") {
  12159. throw new _util.FormatError("Malformed CMap: expected string.");
  12160. }
  12161. }
  12162. function expectInt(obj) {
  12163. if (!Number.isInteger(obj)) {
  12164. throw new _util.FormatError("Malformed CMap: expected int.");
  12165. }
  12166. }
  12167. function parseBfChar(cMap, lexer) {
  12168. while (true) {
  12169. let obj = lexer.getObj();
  12170. if (obj === _primitives.EOF) {
  12171. break;
  12172. }
  12173. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  12174. return;
  12175. }
  12176. expectString(obj);
  12177. const src = strToInt(obj);
  12178. obj = lexer.getObj();
  12179. expectString(obj);
  12180. const dst = obj;
  12181. cMap.mapOne(src, dst);
  12182. }
  12183. }
  12184. function parseBfRange(cMap, lexer) {
  12185. while (true) {
  12186. let obj = lexer.getObj();
  12187. if (obj === _primitives.EOF) {
  12188. break;
  12189. }
  12190. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  12191. return;
  12192. }
  12193. expectString(obj);
  12194. const low = strToInt(obj);
  12195. obj = lexer.getObj();
  12196. expectString(obj);
  12197. const high = strToInt(obj);
  12198. obj = lexer.getObj();
  12199. if (Number.isInteger(obj) || typeof obj === "string") {
  12200. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  12201. cMap.mapBfRange(low, high, dstLow);
  12202. } else if ((0, _primitives.isCmd)(obj, "[")) {
  12203. obj = lexer.getObj();
  12204. const array = [];
  12205. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  12206. array.push(obj);
  12207. obj = lexer.getObj();
  12208. }
  12209. cMap.mapBfRangeToArray(low, high, array);
  12210. } else {
  12211. break;
  12212. }
  12213. }
  12214. throw new _util.FormatError("Invalid bf range.");
  12215. }
  12216. function parseCidChar(cMap, lexer) {
  12217. while (true) {
  12218. let obj = lexer.getObj();
  12219. if (obj === _primitives.EOF) {
  12220. break;
  12221. }
  12222. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  12223. return;
  12224. }
  12225. expectString(obj);
  12226. const src = strToInt(obj);
  12227. obj = lexer.getObj();
  12228. expectInt(obj);
  12229. const dst = obj;
  12230. cMap.mapOne(src, dst);
  12231. }
  12232. }
  12233. function parseCidRange(cMap, lexer) {
  12234. while (true) {
  12235. let obj = lexer.getObj();
  12236. if (obj === _primitives.EOF) {
  12237. break;
  12238. }
  12239. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  12240. return;
  12241. }
  12242. expectString(obj);
  12243. const low = strToInt(obj);
  12244. obj = lexer.getObj();
  12245. expectString(obj);
  12246. const high = strToInt(obj);
  12247. obj = lexer.getObj();
  12248. expectInt(obj);
  12249. const dstLow = obj;
  12250. cMap.mapCidRange(low, high, dstLow);
  12251. }
  12252. }
  12253. function parseCodespaceRange(cMap, lexer) {
  12254. while (true) {
  12255. let obj = lexer.getObj();
  12256. if (obj === _primitives.EOF) {
  12257. break;
  12258. }
  12259. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  12260. return;
  12261. }
  12262. if (typeof obj !== "string") {
  12263. break;
  12264. }
  12265. const low = strToInt(obj);
  12266. obj = lexer.getObj();
  12267. if (typeof obj !== "string") {
  12268. break;
  12269. }
  12270. const high = strToInt(obj);
  12271. cMap.addCodespaceRange(obj.length, low, high);
  12272. }
  12273. throw new _util.FormatError("Invalid codespace range.");
  12274. }
  12275. function parseWMode(cMap, lexer) {
  12276. const obj = lexer.getObj();
  12277. if (Number.isInteger(obj)) {
  12278. cMap.vertical = !!obj;
  12279. }
  12280. }
  12281. function parseCMapName(cMap, lexer) {
  12282. const obj = lexer.getObj();
  12283. if (obj instanceof _primitives.Name) {
  12284. cMap.name = obj.name;
  12285. }
  12286. }
  12287. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  12288. let previous, embeddedUseCMap;
  12289. objLoop: while (true) {
  12290. try {
  12291. const obj = lexer.getObj();
  12292. if (obj === _primitives.EOF) {
  12293. break;
  12294. } else if (obj instanceof _primitives.Name) {
  12295. if (obj.name === "WMode") {
  12296. parseWMode(cMap, lexer);
  12297. } else if (obj.name === "CMapName") {
  12298. parseCMapName(cMap, lexer);
  12299. }
  12300. previous = obj;
  12301. } else if (obj instanceof _primitives.Cmd) {
  12302. switch (obj.cmd) {
  12303. case "endcmap":
  12304. break objLoop;
  12305. case "usecmap":
  12306. if (previous instanceof _primitives.Name) {
  12307. embeddedUseCMap = previous.name;
  12308. }
  12309. break;
  12310. case "begincodespacerange":
  12311. parseCodespaceRange(cMap, lexer);
  12312. break;
  12313. case "beginbfchar":
  12314. parseBfChar(cMap, lexer);
  12315. break;
  12316. case "begincidchar":
  12317. parseCidChar(cMap, lexer);
  12318. break;
  12319. case "beginbfrange":
  12320. parseBfRange(cMap, lexer);
  12321. break;
  12322. case "begincidrange":
  12323. parseCidRange(cMap, lexer);
  12324. break;
  12325. }
  12326. }
  12327. } catch (ex) {
  12328. if (ex instanceof _core_utils.MissingDataException) {
  12329. throw ex;
  12330. }
  12331. (0, _util.warn)("Invalid cMap data: " + ex);
  12332. continue;
  12333. }
  12334. }
  12335. if (!useCMap && embeddedUseCMap) {
  12336. useCMap = embeddedUseCMap;
  12337. }
  12338. if (useCMap) {
  12339. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12340. }
  12341. return cMap;
  12342. }
  12343. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  12344. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  12345. if (cMap.numCodespaceRanges === 0) {
  12346. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  12347. for (let i = 0; i < useCodespaceRanges.length; i++) {
  12348. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  12349. }
  12350. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  12351. }
  12352. cMap.useCMap.forEach(function (key, value) {
  12353. if (!cMap.contains(key)) {
  12354. cMap.mapOne(key, cMap.useCMap.lookup(key));
  12355. }
  12356. });
  12357. return cMap;
  12358. }
  12359. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  12360. if (name === "Identity-H") {
  12361. return new IdentityCMap(false, 2);
  12362. } else if (name === "Identity-V") {
  12363. return new IdentityCMap(true, 2);
  12364. }
  12365. if (!BUILT_IN_CMAPS.includes(name)) {
  12366. throw new Error("Unknown CMap name: " + name);
  12367. }
  12368. if (!fetchBuiltInCMap) {
  12369. throw new Error("Built-in CMap parameters are not provided.");
  12370. }
  12371. const {
  12372. cMapData,
  12373. compressionType
  12374. } = await fetchBuiltInCMap(name);
  12375. const cMap = new CMap(true);
  12376. if (compressionType === _util.CMapCompressionType.BINARY) {
  12377. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  12378. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12379. });
  12380. }
  12381. if (compressionType === _util.CMapCompressionType.NONE) {
  12382. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  12383. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  12384. }
  12385. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  12386. }
  12387. return {
  12388. async create(params) {
  12389. const encoding = params.encoding;
  12390. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  12391. const useCMap = params.useCMap;
  12392. if (encoding instanceof _primitives.Name) {
  12393. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  12394. } else if (encoding instanceof _base_stream.BaseStream) {
  12395. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  12396. if (parsedCMap.isIdentityCMap) {
  12397. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  12398. }
  12399. return parsedCMap;
  12400. }
  12401. throw new Error("Encoding required.");
  12402. }
  12403. };
  12404. }();
  12405. exports.CMapFactory = CMapFactory;
  12406. /***/ }),
  12407. /* 15 */
  12408. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12409. Object.defineProperty(exports, "__esModule", ({
  12410. value: true
  12411. }));
  12412. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  12413. var _util = __w_pdfjs_require__(2);
  12414. var _primitives = __w_pdfjs_require__(3);
  12415. var _core_utils = __w_pdfjs_require__(4);
  12416. var _ascii_85_stream = __w_pdfjs_require__(16);
  12417. var _ascii_hex_stream = __w_pdfjs_require__(18);
  12418. var _ccitt_stream = __w_pdfjs_require__(19);
  12419. var _flate_stream = __w_pdfjs_require__(21);
  12420. var _jbig2_stream = __w_pdfjs_require__(22);
  12421. var _jpeg_stream = __w_pdfjs_require__(25);
  12422. var _jpx_stream = __w_pdfjs_require__(27);
  12423. var _lzw_stream = __w_pdfjs_require__(29);
  12424. var _stream = __w_pdfjs_require__(8);
  12425. var _predictor_stream = __w_pdfjs_require__(30);
  12426. var _run_length_stream = __w_pdfjs_require__(31);
  12427. const MAX_LENGTH_TO_CACHE = 1000;
  12428. const MAX_ADLER32_LENGTH = 5552;
  12429. function computeAdler32(bytes) {
  12430. const bytesLength = bytes.length;
  12431. let a = 1,
  12432. b = 0;
  12433. for (let i = 0; i < bytesLength; ++i) {
  12434. a += bytes[i] & 0xff;
  12435. b += a;
  12436. }
  12437. return b % 65521 << 16 | a % 65521;
  12438. }
  12439. class Parser {
  12440. constructor({
  12441. lexer,
  12442. xref,
  12443. allowStreams = false,
  12444. recoveryMode = false
  12445. }) {
  12446. this.lexer = lexer;
  12447. this.xref = xref;
  12448. this.allowStreams = allowStreams;
  12449. this.recoveryMode = recoveryMode;
  12450. this.imageCache = Object.create(null);
  12451. this.refill();
  12452. }
  12453. refill() {
  12454. this.buf1 = this.lexer.getObj();
  12455. this.buf2 = this.lexer.getObj();
  12456. }
  12457. shift() {
  12458. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  12459. this.buf1 = this.buf2;
  12460. this.buf2 = null;
  12461. } else {
  12462. this.buf1 = this.buf2;
  12463. this.buf2 = this.lexer.getObj();
  12464. }
  12465. }
  12466. tryShift() {
  12467. try {
  12468. this.shift();
  12469. return true;
  12470. } catch (e) {
  12471. if (e instanceof _core_utils.MissingDataException) {
  12472. throw e;
  12473. }
  12474. return false;
  12475. }
  12476. }
  12477. getObj(cipherTransform = null) {
  12478. const buf1 = this.buf1;
  12479. this.shift();
  12480. if (buf1 instanceof _primitives.Cmd) {
  12481. switch (buf1.cmd) {
  12482. case "BI":
  12483. return this.makeInlineImage(cipherTransform);
  12484. case "[":
  12485. const array = [];
  12486. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  12487. array.push(this.getObj(cipherTransform));
  12488. }
  12489. if (this.buf1 === _primitives.EOF) {
  12490. if (this.recoveryMode) {
  12491. return array;
  12492. }
  12493. throw new _core_utils.ParserEOFException("End of file inside array.");
  12494. }
  12495. this.shift();
  12496. return array;
  12497. case "<<":
  12498. const dict = new _primitives.Dict(this.xref);
  12499. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  12500. if (!(this.buf1 instanceof _primitives.Name)) {
  12501. (0, _util.info)("Malformed dictionary: key must be a name object");
  12502. this.shift();
  12503. continue;
  12504. }
  12505. const key = this.buf1.name;
  12506. this.shift();
  12507. if (this.buf1 === _primitives.EOF) {
  12508. break;
  12509. }
  12510. dict.set(key, this.getObj(cipherTransform));
  12511. }
  12512. if (this.buf1 === _primitives.EOF) {
  12513. if (this.recoveryMode) {
  12514. return dict;
  12515. }
  12516. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  12517. }
  12518. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  12519. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12520. }
  12521. this.shift();
  12522. return dict;
  12523. default:
  12524. return buf1;
  12525. }
  12526. }
  12527. if (Number.isInteger(buf1)) {
  12528. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  12529. const ref = _primitives.Ref.get(buf1, this.buf1);
  12530. this.shift();
  12531. this.shift();
  12532. return ref;
  12533. }
  12534. return buf1;
  12535. }
  12536. if (typeof buf1 === "string") {
  12537. if (cipherTransform) {
  12538. return cipherTransform.decryptString(buf1);
  12539. }
  12540. return buf1;
  12541. }
  12542. return buf1;
  12543. }
  12544. findDefaultInlineStreamEnd(stream) {
  12545. const E = 0x45,
  12546. I = 0x49,
  12547. SPACE = 0x20,
  12548. LF = 0xa,
  12549. CR = 0xd,
  12550. NUL = 0x0;
  12551. const lexer = this.lexer,
  12552. startPos = stream.pos,
  12553. n = 10;
  12554. let state = 0,
  12555. ch,
  12556. maybeEIPos;
  12557. while ((ch = stream.getByte()) !== -1) {
  12558. if (state === 0) {
  12559. state = ch === E ? 1 : 0;
  12560. } else if (state === 1) {
  12561. state = ch === I ? 2 : 0;
  12562. } else {
  12563. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  12564. if (ch === SPACE || ch === LF || ch === CR) {
  12565. maybeEIPos = stream.pos;
  12566. const followingBytes = stream.peekBytes(n);
  12567. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  12568. ch = followingBytes[i];
  12569. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  12570. continue;
  12571. }
  12572. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  12573. state = 0;
  12574. break;
  12575. }
  12576. }
  12577. if (state !== 2) {
  12578. continue;
  12579. }
  12580. if (lexer.knownCommands) {
  12581. const nextObj = lexer.peekObj();
  12582. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  12583. state = 0;
  12584. }
  12585. } else {
  12586. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  12587. }
  12588. if (state === 2) {
  12589. break;
  12590. }
  12591. } else {
  12592. state = 0;
  12593. }
  12594. }
  12595. }
  12596. if (ch === -1) {
  12597. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  12598. if (maybeEIPos) {
  12599. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  12600. stream.skip(-(stream.pos - maybeEIPos));
  12601. }
  12602. }
  12603. let endOffset = 4;
  12604. stream.skip(-endOffset);
  12605. ch = stream.peekByte();
  12606. stream.skip(endOffset);
  12607. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  12608. endOffset--;
  12609. }
  12610. return stream.pos - endOffset - startPos;
  12611. }
  12612. findDCTDecodeInlineStreamEnd(stream) {
  12613. const startPos = stream.pos;
  12614. let foundEOI = false,
  12615. b,
  12616. markerLength;
  12617. while ((b = stream.getByte()) !== -1) {
  12618. if (b !== 0xff) {
  12619. continue;
  12620. }
  12621. switch (stream.getByte()) {
  12622. case 0x00:
  12623. break;
  12624. case 0xff:
  12625. stream.skip(-1);
  12626. break;
  12627. case 0xd9:
  12628. foundEOI = true;
  12629. break;
  12630. case 0xc0:
  12631. case 0xc1:
  12632. case 0xc2:
  12633. case 0xc3:
  12634. case 0xc5:
  12635. case 0xc6:
  12636. case 0xc7:
  12637. case 0xc9:
  12638. case 0xca:
  12639. case 0xcb:
  12640. case 0xcd:
  12641. case 0xce:
  12642. case 0xcf:
  12643. case 0xc4:
  12644. case 0xcc:
  12645. case 0xda:
  12646. case 0xdb:
  12647. case 0xdc:
  12648. case 0xdd:
  12649. case 0xde:
  12650. case 0xdf:
  12651. case 0xe0:
  12652. case 0xe1:
  12653. case 0xe2:
  12654. case 0xe3:
  12655. case 0xe4:
  12656. case 0xe5:
  12657. case 0xe6:
  12658. case 0xe7:
  12659. case 0xe8:
  12660. case 0xe9:
  12661. case 0xea:
  12662. case 0xeb:
  12663. case 0xec:
  12664. case 0xed:
  12665. case 0xee:
  12666. case 0xef:
  12667. case 0xfe:
  12668. markerLength = stream.getUint16();
  12669. if (markerLength > 2) {
  12670. stream.skip(markerLength - 2);
  12671. } else {
  12672. stream.skip(-2);
  12673. }
  12674. break;
  12675. }
  12676. if (foundEOI) {
  12677. break;
  12678. }
  12679. }
  12680. const length = stream.pos - startPos;
  12681. if (b === -1) {
  12682. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  12683. stream.skip(-length);
  12684. return this.findDefaultInlineStreamEnd(stream);
  12685. }
  12686. this.inlineStreamSkipEI(stream);
  12687. return length;
  12688. }
  12689. findASCII85DecodeInlineStreamEnd(stream) {
  12690. const TILDE = 0x7e,
  12691. GT = 0x3e;
  12692. const startPos = stream.pos;
  12693. let ch;
  12694. while ((ch = stream.getByte()) !== -1) {
  12695. if (ch === TILDE) {
  12696. const tildePos = stream.pos;
  12697. ch = stream.peekByte();
  12698. while ((0, _core_utils.isWhiteSpace)(ch)) {
  12699. stream.skip();
  12700. ch = stream.peekByte();
  12701. }
  12702. if (ch === GT) {
  12703. stream.skip();
  12704. break;
  12705. }
  12706. if (stream.pos > tildePos) {
  12707. const maybeEI = stream.peekBytes(2);
  12708. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  12709. break;
  12710. }
  12711. }
  12712. }
  12713. }
  12714. const length = stream.pos - startPos;
  12715. if (ch === -1) {
  12716. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  12717. stream.skip(-length);
  12718. return this.findDefaultInlineStreamEnd(stream);
  12719. }
  12720. this.inlineStreamSkipEI(stream);
  12721. return length;
  12722. }
  12723. findASCIIHexDecodeInlineStreamEnd(stream) {
  12724. const GT = 0x3e;
  12725. const startPos = stream.pos;
  12726. let ch;
  12727. while ((ch = stream.getByte()) !== -1) {
  12728. if (ch === GT) {
  12729. break;
  12730. }
  12731. }
  12732. const length = stream.pos - startPos;
  12733. if (ch === -1) {
  12734. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  12735. stream.skip(-length);
  12736. return this.findDefaultInlineStreamEnd(stream);
  12737. }
  12738. this.inlineStreamSkipEI(stream);
  12739. return length;
  12740. }
  12741. inlineStreamSkipEI(stream) {
  12742. const E = 0x45,
  12743. I = 0x49;
  12744. let state = 0,
  12745. ch;
  12746. while ((ch = stream.getByte()) !== -1) {
  12747. if (state === 0) {
  12748. state = ch === E ? 1 : 0;
  12749. } else if (state === 1) {
  12750. state = ch === I ? 2 : 0;
  12751. } else if (state === 2) {
  12752. break;
  12753. }
  12754. }
  12755. }
  12756. makeInlineImage(cipherTransform) {
  12757. const lexer = this.lexer;
  12758. const stream = lexer.stream;
  12759. const dict = new _primitives.Dict(this.xref);
  12760. let dictLength;
  12761. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  12762. if (!(this.buf1 instanceof _primitives.Name)) {
  12763. throw new _util.FormatError("Dictionary key must be a name object");
  12764. }
  12765. const key = this.buf1.name;
  12766. this.shift();
  12767. if (this.buf1 === _primitives.EOF) {
  12768. break;
  12769. }
  12770. dict.set(key, this.getObj(cipherTransform));
  12771. }
  12772. if (lexer.beginInlineImagePos !== -1) {
  12773. dictLength = stream.pos - lexer.beginInlineImagePos;
  12774. }
  12775. const filter = dict.get("F", "Filter");
  12776. let filterName;
  12777. if (filter instanceof _primitives.Name) {
  12778. filterName = filter.name;
  12779. } else if (Array.isArray(filter)) {
  12780. const filterZero = this.xref.fetchIfRef(filter[0]);
  12781. if (filterZero instanceof _primitives.Name) {
  12782. filterName = filterZero.name;
  12783. }
  12784. }
  12785. const startPos = stream.pos;
  12786. let length;
  12787. switch (filterName) {
  12788. case "DCT":
  12789. case "DCTDecode":
  12790. length = this.findDCTDecodeInlineStreamEnd(stream);
  12791. break;
  12792. case "A85":
  12793. case "ASCII85Decode":
  12794. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12795. break;
  12796. case "AHx":
  12797. case "ASCIIHexDecode":
  12798. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12799. break;
  12800. default:
  12801. length = this.findDefaultInlineStreamEnd(stream);
  12802. }
  12803. let imageStream = stream.makeSubStream(startPos, length, dict);
  12804. let cacheKey;
  12805. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  12806. const imageBytes = imageStream.getBytes();
  12807. imageStream.reset();
  12808. const initialStreamPos = stream.pos;
  12809. stream.pos = lexer.beginInlineImagePos;
  12810. const dictBytes = stream.getBytes(dictLength);
  12811. stream.pos = initialStreamPos;
  12812. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  12813. const cacheEntry = this.imageCache[cacheKey];
  12814. if (cacheEntry !== undefined) {
  12815. this.buf2 = _primitives.Cmd.get("EI");
  12816. this.shift();
  12817. cacheEntry.reset();
  12818. return cacheEntry;
  12819. }
  12820. }
  12821. if (cipherTransform) {
  12822. imageStream = cipherTransform.createStream(imageStream, length);
  12823. }
  12824. imageStream = this.filter(imageStream, dict, length);
  12825. imageStream.dict = dict;
  12826. if (cacheKey !== undefined) {
  12827. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  12828. this.imageCache[cacheKey] = imageStream;
  12829. }
  12830. this.buf2 = _primitives.Cmd.get("EI");
  12831. this.shift();
  12832. return imageStream;
  12833. }
  12834. _findStreamLength(startPos, signature) {
  12835. const {
  12836. stream
  12837. } = this.lexer;
  12838. stream.pos = startPos;
  12839. const SCAN_BLOCK_LENGTH = 2048;
  12840. const signatureLength = signature.length;
  12841. while (stream.pos < stream.end) {
  12842. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  12843. const scanLength = scanBytes.length - signatureLength;
  12844. if (scanLength <= 0) {
  12845. break;
  12846. }
  12847. let pos = 0;
  12848. while (pos < scanLength) {
  12849. let j = 0;
  12850. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  12851. j++;
  12852. }
  12853. if (j >= signatureLength) {
  12854. stream.pos += pos;
  12855. return stream.pos - startPos;
  12856. }
  12857. pos++;
  12858. }
  12859. stream.pos += scanLength;
  12860. }
  12861. return -1;
  12862. }
  12863. makeStream(dict, cipherTransform) {
  12864. const lexer = this.lexer;
  12865. let stream = lexer.stream;
  12866. lexer.skipToNextLine();
  12867. const startPos = stream.pos - 1;
  12868. let length = dict.get("Length");
  12869. if (!Number.isInteger(length)) {
  12870. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  12871. length = 0;
  12872. }
  12873. stream.pos = startPos + length;
  12874. lexer.nextChar();
  12875. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  12876. this.shift();
  12877. } else {
  12878. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  12879. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  12880. if (actualLength < 0) {
  12881. const MAX_TRUNCATION = 1;
  12882. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  12883. const end = ENDSTREAM_SIGNATURE.length - i;
  12884. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  12885. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  12886. if (maybeLength >= 0) {
  12887. const lastByte = stream.peekBytes(end + 1)[end];
  12888. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  12889. break;
  12890. }
  12891. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  12892. actualLength = maybeLength;
  12893. break;
  12894. }
  12895. }
  12896. if (actualLength < 0) {
  12897. throw new _util.FormatError("Missing endstream command.");
  12898. }
  12899. }
  12900. length = actualLength;
  12901. lexer.nextChar();
  12902. this.shift();
  12903. this.shift();
  12904. }
  12905. this.shift();
  12906. stream = stream.makeSubStream(startPos, length, dict);
  12907. if (cipherTransform) {
  12908. stream = cipherTransform.createStream(stream, length);
  12909. }
  12910. stream = this.filter(stream, dict, length);
  12911. stream.dict = dict;
  12912. return stream;
  12913. }
  12914. filter(stream, dict, length) {
  12915. let filter = dict.get("F", "Filter");
  12916. let params = dict.get("DP", "DecodeParms");
  12917. if (filter instanceof _primitives.Name) {
  12918. if (Array.isArray(params)) {
  12919. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  12920. }
  12921. return this.makeFilter(stream, filter.name, length, params);
  12922. }
  12923. let maybeLength = length;
  12924. if (Array.isArray(filter)) {
  12925. const filterArray = filter;
  12926. const paramsArray = params;
  12927. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  12928. filter = this.xref.fetchIfRef(filterArray[i]);
  12929. if (!(filter instanceof _primitives.Name)) {
  12930. throw new _util.FormatError(`Bad filter name "${filter}"`);
  12931. }
  12932. params = null;
  12933. if (Array.isArray(paramsArray) && i in paramsArray) {
  12934. params = this.xref.fetchIfRef(paramsArray[i]);
  12935. }
  12936. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12937. maybeLength = null;
  12938. }
  12939. }
  12940. return stream;
  12941. }
  12942. makeFilter(stream, name, maybeLength, params) {
  12943. if (maybeLength === 0) {
  12944. (0, _util.warn)(`Empty "${name}" stream.`);
  12945. return new _stream.NullStream();
  12946. }
  12947. const xrefStats = this.xref.stats;
  12948. try {
  12949. switch (name) {
  12950. case "Fl":
  12951. case "FlateDecode":
  12952. xrefStats.addStreamType(_util.StreamType.FLATE);
  12953. if (params) {
  12954. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  12955. }
  12956. return new _flate_stream.FlateStream(stream, maybeLength);
  12957. case "LZW":
  12958. case "LZWDecode":
  12959. xrefStats.addStreamType(_util.StreamType.LZW);
  12960. let earlyChange = 1;
  12961. if (params) {
  12962. if (params.has("EarlyChange")) {
  12963. earlyChange = params.get("EarlyChange");
  12964. }
  12965. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12966. }
  12967. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  12968. case "DCT":
  12969. case "DCTDecode":
  12970. xrefStats.addStreamType(_util.StreamType.DCT);
  12971. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  12972. case "JPX":
  12973. case "JPXDecode":
  12974. xrefStats.addStreamType(_util.StreamType.JPX);
  12975. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  12976. case "A85":
  12977. case "ASCII85Decode":
  12978. xrefStats.addStreamType(_util.StreamType.A85);
  12979. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  12980. case "AHx":
  12981. case "ASCIIHexDecode":
  12982. xrefStats.addStreamType(_util.StreamType.AHX);
  12983. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  12984. case "CCF":
  12985. case "CCITTFaxDecode":
  12986. xrefStats.addStreamType(_util.StreamType.CCF);
  12987. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  12988. case "RL":
  12989. case "RunLengthDecode":
  12990. xrefStats.addStreamType(_util.StreamType.RLX);
  12991. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  12992. case "JBIG2Decode":
  12993. xrefStats.addStreamType(_util.StreamType.JBIG);
  12994. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  12995. }
  12996. (0, _util.warn)(`Filter "${name}" is not supported.`);
  12997. return stream;
  12998. } catch (ex) {
  12999. if (ex instanceof _core_utils.MissingDataException) {
  13000. throw ex;
  13001. }
  13002. (0, _util.warn)(`Invalid stream: "${ex}"`);
  13003. return new _stream.NullStream();
  13004. }
  13005. }
  13006. }
  13007. exports.Parser = Parser;
  13008. 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];
  13009. function toHexDigit(ch) {
  13010. if (ch >= 0x30 && ch <= 0x39) {
  13011. return ch & 0x0f;
  13012. }
  13013. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13014. return (ch & 0x0f) + 9;
  13015. }
  13016. return -1;
  13017. }
  13018. class Lexer {
  13019. constructor(stream, knownCommands = null) {
  13020. this.stream = stream;
  13021. this.nextChar();
  13022. this.strBuf = [];
  13023. this.knownCommands = knownCommands;
  13024. this._hexStringNumWarn = 0;
  13025. this.beginInlineImagePos = -1;
  13026. }
  13027. nextChar() {
  13028. return this.currentChar = this.stream.getByte();
  13029. }
  13030. peekChar() {
  13031. return this.stream.peekByte();
  13032. }
  13033. getNumber() {
  13034. let ch = this.currentChar;
  13035. let eNotation = false;
  13036. let divideBy = 0;
  13037. let sign = 0;
  13038. if (ch === 0x2d) {
  13039. sign = -1;
  13040. ch = this.nextChar();
  13041. if (ch === 0x2d) {
  13042. ch = this.nextChar();
  13043. }
  13044. } else if (ch === 0x2b) {
  13045. sign = 1;
  13046. ch = this.nextChar();
  13047. }
  13048. if (ch === 0x0a || ch === 0x0d) {
  13049. do {
  13050. ch = this.nextChar();
  13051. } while (ch === 0x0a || ch === 0x0d);
  13052. }
  13053. if (ch === 0x2e) {
  13054. divideBy = 10;
  13055. ch = this.nextChar();
  13056. }
  13057. if (ch < 0x30 || ch > 0x39) {
  13058. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  13059. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  13060. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  13061. return 0;
  13062. }
  13063. throw new _util.FormatError(msg);
  13064. }
  13065. sign = sign || 1;
  13066. let baseValue = ch - 0x30;
  13067. let powerValue = 0;
  13068. let powerValueSign = 1;
  13069. while ((ch = this.nextChar()) >= 0) {
  13070. if (ch >= 0x30 && ch <= 0x39) {
  13071. const currentDigit = ch - 0x30;
  13072. if (eNotation) {
  13073. powerValue = powerValue * 10 + currentDigit;
  13074. } else {
  13075. if (divideBy !== 0) {
  13076. divideBy *= 10;
  13077. }
  13078. baseValue = baseValue * 10 + currentDigit;
  13079. }
  13080. } else if (ch === 0x2e) {
  13081. if (divideBy === 0) {
  13082. divideBy = 1;
  13083. } else {
  13084. break;
  13085. }
  13086. } else if (ch === 0x2d) {
  13087. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  13088. } else if (ch === 0x45 || ch === 0x65) {
  13089. ch = this.peekChar();
  13090. if (ch === 0x2b || ch === 0x2d) {
  13091. powerValueSign = ch === 0x2d ? -1 : 1;
  13092. this.nextChar();
  13093. } else if (ch < 0x30 || ch > 0x39) {
  13094. break;
  13095. }
  13096. eNotation = true;
  13097. } else {
  13098. break;
  13099. }
  13100. }
  13101. if (divideBy !== 0) {
  13102. baseValue /= divideBy;
  13103. }
  13104. if (eNotation) {
  13105. baseValue *= 10 ** (powerValueSign * powerValue);
  13106. }
  13107. return sign * baseValue;
  13108. }
  13109. getString() {
  13110. let numParen = 1;
  13111. let done = false;
  13112. const strBuf = this.strBuf;
  13113. strBuf.length = 0;
  13114. let ch = this.nextChar();
  13115. while (true) {
  13116. let charBuffered = false;
  13117. switch (ch | 0) {
  13118. case -1:
  13119. (0, _util.warn)("Unterminated string");
  13120. done = true;
  13121. break;
  13122. case 0x28:
  13123. ++numParen;
  13124. strBuf.push("(");
  13125. break;
  13126. case 0x29:
  13127. if (--numParen === 0) {
  13128. this.nextChar();
  13129. done = true;
  13130. } else {
  13131. strBuf.push(")");
  13132. }
  13133. break;
  13134. case 0x5c:
  13135. ch = this.nextChar();
  13136. switch (ch) {
  13137. case -1:
  13138. (0, _util.warn)("Unterminated string");
  13139. done = true;
  13140. break;
  13141. case 0x6e:
  13142. strBuf.push("\n");
  13143. break;
  13144. case 0x72:
  13145. strBuf.push("\r");
  13146. break;
  13147. case 0x74:
  13148. strBuf.push("\t");
  13149. break;
  13150. case 0x62:
  13151. strBuf.push("\b");
  13152. break;
  13153. case 0x66:
  13154. strBuf.push("\f");
  13155. break;
  13156. case 0x5c:
  13157. case 0x28:
  13158. case 0x29:
  13159. strBuf.push(String.fromCharCode(ch));
  13160. break;
  13161. case 0x30:
  13162. case 0x31:
  13163. case 0x32:
  13164. case 0x33:
  13165. case 0x34:
  13166. case 0x35:
  13167. case 0x36:
  13168. case 0x37:
  13169. let x = ch & 0x0f;
  13170. ch = this.nextChar();
  13171. charBuffered = true;
  13172. if (ch >= 0x30 && ch <= 0x37) {
  13173. x = (x << 3) + (ch & 0x0f);
  13174. ch = this.nextChar();
  13175. if (ch >= 0x30 && ch <= 0x37) {
  13176. charBuffered = false;
  13177. x = (x << 3) + (ch & 0x0f);
  13178. }
  13179. }
  13180. strBuf.push(String.fromCharCode(x));
  13181. break;
  13182. case 0x0d:
  13183. if (this.peekChar() === 0x0a) {
  13184. this.nextChar();
  13185. }
  13186. break;
  13187. case 0x0a:
  13188. break;
  13189. default:
  13190. strBuf.push(String.fromCharCode(ch));
  13191. break;
  13192. }
  13193. break;
  13194. default:
  13195. strBuf.push(String.fromCharCode(ch));
  13196. break;
  13197. }
  13198. if (done) {
  13199. break;
  13200. }
  13201. if (!charBuffered) {
  13202. ch = this.nextChar();
  13203. }
  13204. }
  13205. return strBuf.join("");
  13206. }
  13207. getName() {
  13208. let ch, previousCh;
  13209. const strBuf = this.strBuf;
  13210. strBuf.length = 0;
  13211. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13212. if (ch === 0x23) {
  13213. ch = this.nextChar();
  13214. if (specialChars[ch]) {
  13215. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  13216. strBuf.push("#");
  13217. break;
  13218. }
  13219. const x = toHexDigit(ch);
  13220. if (x !== -1) {
  13221. previousCh = ch;
  13222. ch = this.nextChar();
  13223. const x2 = toHexDigit(ch);
  13224. if (x2 === -1) {
  13225. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  13226. strBuf.push("#", String.fromCharCode(previousCh));
  13227. if (specialChars[ch]) {
  13228. break;
  13229. }
  13230. strBuf.push(String.fromCharCode(ch));
  13231. continue;
  13232. }
  13233. strBuf.push(String.fromCharCode(x << 4 | x2));
  13234. } else {
  13235. strBuf.push("#", String.fromCharCode(ch));
  13236. }
  13237. } else {
  13238. strBuf.push(String.fromCharCode(ch));
  13239. }
  13240. }
  13241. if (strBuf.length > 127) {
  13242. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  13243. }
  13244. return _primitives.Name.get(strBuf.join(""));
  13245. }
  13246. _hexStringWarn(ch) {
  13247. const MAX_HEX_STRING_NUM_WARN = 5;
  13248. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  13249. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  13250. return;
  13251. }
  13252. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  13253. return;
  13254. }
  13255. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  13256. }
  13257. getHexString() {
  13258. const strBuf = this.strBuf;
  13259. strBuf.length = 0;
  13260. let ch = this.currentChar;
  13261. let isFirstHex = true;
  13262. let firstDigit, secondDigit;
  13263. this._hexStringNumWarn = 0;
  13264. while (true) {
  13265. if (ch < 0) {
  13266. (0, _util.warn)("Unterminated hex string");
  13267. break;
  13268. } else if (ch === 0x3e) {
  13269. this.nextChar();
  13270. break;
  13271. } else if (specialChars[ch] === 1) {
  13272. ch = this.nextChar();
  13273. continue;
  13274. } else {
  13275. if (isFirstHex) {
  13276. firstDigit = toHexDigit(ch);
  13277. if (firstDigit === -1) {
  13278. this._hexStringWarn(ch);
  13279. ch = this.nextChar();
  13280. continue;
  13281. }
  13282. } else {
  13283. secondDigit = toHexDigit(ch);
  13284. if (secondDigit === -1) {
  13285. this._hexStringWarn(ch);
  13286. ch = this.nextChar();
  13287. continue;
  13288. }
  13289. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  13290. }
  13291. isFirstHex = !isFirstHex;
  13292. ch = this.nextChar();
  13293. }
  13294. }
  13295. return strBuf.join("");
  13296. }
  13297. getObj() {
  13298. let comment = false;
  13299. let ch = this.currentChar;
  13300. while (true) {
  13301. if (ch < 0) {
  13302. return _primitives.EOF;
  13303. }
  13304. if (comment) {
  13305. if (ch === 0x0a || ch === 0x0d) {
  13306. comment = false;
  13307. }
  13308. } else if (ch === 0x25) {
  13309. comment = true;
  13310. } else if (specialChars[ch] !== 1) {
  13311. break;
  13312. }
  13313. ch = this.nextChar();
  13314. }
  13315. switch (ch | 0) {
  13316. case 0x30:
  13317. case 0x31:
  13318. case 0x32:
  13319. case 0x33:
  13320. case 0x34:
  13321. case 0x35:
  13322. case 0x36:
  13323. case 0x37:
  13324. case 0x38:
  13325. case 0x39:
  13326. case 0x2b:
  13327. case 0x2d:
  13328. case 0x2e:
  13329. return this.getNumber();
  13330. case 0x28:
  13331. return this.getString();
  13332. case 0x2f:
  13333. return this.getName();
  13334. case 0x5b:
  13335. this.nextChar();
  13336. return _primitives.Cmd.get("[");
  13337. case 0x5d:
  13338. this.nextChar();
  13339. return _primitives.Cmd.get("]");
  13340. case 0x3c:
  13341. ch = this.nextChar();
  13342. if (ch === 0x3c) {
  13343. this.nextChar();
  13344. return _primitives.Cmd.get("<<");
  13345. }
  13346. return this.getHexString();
  13347. case 0x3e:
  13348. ch = this.nextChar();
  13349. if (ch === 0x3e) {
  13350. this.nextChar();
  13351. return _primitives.Cmd.get(">>");
  13352. }
  13353. return _primitives.Cmd.get(">");
  13354. case 0x7b:
  13355. this.nextChar();
  13356. return _primitives.Cmd.get("{");
  13357. case 0x7d:
  13358. this.nextChar();
  13359. return _primitives.Cmd.get("}");
  13360. case 0x29:
  13361. this.nextChar();
  13362. throw new _util.FormatError(`Illegal character: ${ch}`);
  13363. }
  13364. let str = String.fromCharCode(ch);
  13365. if (ch < 0x20 || ch > 0x7f) {
  13366. const nextCh = this.peekChar();
  13367. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  13368. this.nextChar();
  13369. return _primitives.Cmd.get(str);
  13370. }
  13371. }
  13372. const knownCommands = this.knownCommands;
  13373. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13374. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13375. const possibleCommand = str + String.fromCharCode(ch);
  13376. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13377. break;
  13378. }
  13379. if (str.length === 128) {
  13380. throw new _util.FormatError(`Command token too long: ${str.length}`);
  13381. }
  13382. str = possibleCommand;
  13383. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13384. }
  13385. if (str === "true") {
  13386. return true;
  13387. }
  13388. if (str === "false") {
  13389. return false;
  13390. }
  13391. if (str === "null") {
  13392. return null;
  13393. }
  13394. if (str === "BI") {
  13395. this.beginInlineImagePos = this.stream.pos;
  13396. }
  13397. return _primitives.Cmd.get(str);
  13398. }
  13399. peekObj() {
  13400. const streamPos = this.stream.pos,
  13401. currentChar = this.currentChar,
  13402. beginInlineImagePos = this.beginInlineImagePos;
  13403. let nextObj;
  13404. try {
  13405. nextObj = this.getObj();
  13406. } catch (ex) {
  13407. if (ex instanceof _core_utils.MissingDataException) {
  13408. throw ex;
  13409. }
  13410. (0, _util.warn)(`peekObj: ${ex}`);
  13411. }
  13412. this.stream.pos = streamPos;
  13413. this.currentChar = currentChar;
  13414. this.beginInlineImagePos = beginInlineImagePos;
  13415. return nextObj;
  13416. }
  13417. skipToNextLine() {
  13418. let ch = this.currentChar;
  13419. while (ch >= 0) {
  13420. if (ch === 0x0d) {
  13421. ch = this.nextChar();
  13422. if (ch === 0x0a) {
  13423. this.nextChar();
  13424. }
  13425. break;
  13426. } else if (ch === 0x0a) {
  13427. this.nextChar();
  13428. break;
  13429. }
  13430. ch = this.nextChar();
  13431. }
  13432. }
  13433. }
  13434. exports.Lexer = Lexer;
  13435. class Linearization {
  13436. static create(stream) {
  13437. function getInt(linDict, name, allowZeroValue = false) {
  13438. const obj = linDict.get(name);
  13439. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13440. return obj;
  13441. }
  13442. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  13443. }
  13444. function getHints(linDict) {
  13445. const hints = linDict.get("H");
  13446. let hintsLength;
  13447. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13448. for (let index = 0; index < hintsLength; index++) {
  13449. const hint = hints[index];
  13450. if (!(Number.isInteger(hint) && hint > 0)) {
  13451. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  13452. }
  13453. }
  13454. return hints;
  13455. }
  13456. throw new Error("Hint array in the linearization dictionary is invalid.");
  13457. }
  13458. const parser = new Parser({
  13459. lexer: new Lexer(stream),
  13460. xref: null
  13461. });
  13462. const obj1 = parser.getObj();
  13463. const obj2 = parser.getObj();
  13464. const obj3 = parser.getObj();
  13465. const linDict = parser.getObj();
  13466. let obj, length;
  13467. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  13468. return null;
  13469. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  13470. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  13471. }
  13472. return {
  13473. length,
  13474. hints: getHints(linDict),
  13475. objectNumberFirst: getInt(linDict, "O"),
  13476. endFirst: getInt(linDict, "E"),
  13477. numPages: getInt(linDict, "N"),
  13478. mainXRefEntriesOffset: getInt(linDict, "T"),
  13479. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  13480. };
  13481. }
  13482. }
  13483. exports.Linearization = Linearization;
  13484. /***/ }),
  13485. /* 16 */
  13486. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13487. Object.defineProperty(exports, "__esModule", ({
  13488. value: true
  13489. }));
  13490. exports.Ascii85Stream = void 0;
  13491. var _decode_stream = __w_pdfjs_require__(17);
  13492. var _core_utils = __w_pdfjs_require__(4);
  13493. class Ascii85Stream extends _decode_stream.DecodeStream {
  13494. constructor(str, maybeLength) {
  13495. if (maybeLength) {
  13496. maybeLength *= 0.8;
  13497. }
  13498. super(maybeLength);
  13499. this.str = str;
  13500. this.dict = str.dict;
  13501. this.input = new Uint8Array(5);
  13502. }
  13503. readBlock() {
  13504. const TILDA_CHAR = 0x7e;
  13505. const Z_LOWER_CHAR = 0x7a;
  13506. const EOF = -1;
  13507. const str = this.str;
  13508. let c = str.getByte();
  13509. while ((0, _core_utils.isWhiteSpace)(c)) {
  13510. c = str.getByte();
  13511. }
  13512. if (c === EOF || c === TILDA_CHAR) {
  13513. this.eof = true;
  13514. return;
  13515. }
  13516. const bufferLength = this.bufferLength;
  13517. let buffer, i;
  13518. if (c === Z_LOWER_CHAR) {
  13519. buffer = this.ensureBuffer(bufferLength + 4);
  13520. for (i = 0; i < 4; ++i) {
  13521. buffer[bufferLength + i] = 0;
  13522. }
  13523. this.bufferLength += 4;
  13524. } else {
  13525. const input = this.input;
  13526. input[0] = c;
  13527. for (i = 1; i < 5; ++i) {
  13528. c = str.getByte();
  13529. while ((0, _core_utils.isWhiteSpace)(c)) {
  13530. c = str.getByte();
  13531. }
  13532. input[i] = c;
  13533. if (c === EOF || c === TILDA_CHAR) {
  13534. break;
  13535. }
  13536. }
  13537. buffer = this.ensureBuffer(bufferLength + i - 1);
  13538. this.bufferLength += i - 1;
  13539. if (i < 5) {
  13540. for (; i < 5; ++i) {
  13541. input[i] = 0x21 + 84;
  13542. }
  13543. this.eof = true;
  13544. }
  13545. let t = 0;
  13546. for (i = 0; i < 5; ++i) {
  13547. t = t * 85 + (input[i] - 0x21);
  13548. }
  13549. for (i = 3; i >= 0; --i) {
  13550. buffer[bufferLength + i] = t & 0xff;
  13551. t >>= 8;
  13552. }
  13553. }
  13554. }
  13555. }
  13556. exports.Ascii85Stream = Ascii85Stream;
  13557. /***/ }),
  13558. /* 17 */
  13559. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13560. Object.defineProperty(exports, "__esModule", ({
  13561. value: true
  13562. }));
  13563. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  13564. var _base_stream = __w_pdfjs_require__(5);
  13565. var _stream = __w_pdfjs_require__(8);
  13566. const emptyBuffer = new Uint8Array(0);
  13567. class DecodeStream extends _base_stream.BaseStream {
  13568. constructor(maybeMinBufferLength) {
  13569. super();
  13570. this._rawMinBufferLength = maybeMinBufferLength || 0;
  13571. this.pos = 0;
  13572. this.bufferLength = 0;
  13573. this.eof = false;
  13574. this.buffer = emptyBuffer;
  13575. this.minBufferLength = 512;
  13576. if (maybeMinBufferLength) {
  13577. while (this.minBufferLength < maybeMinBufferLength) {
  13578. this.minBufferLength *= 2;
  13579. }
  13580. }
  13581. }
  13582. get isEmpty() {
  13583. while (!this.eof && this.bufferLength === 0) {
  13584. this.readBlock();
  13585. }
  13586. return this.bufferLength === 0;
  13587. }
  13588. ensureBuffer(requested) {
  13589. const buffer = this.buffer;
  13590. if (requested <= buffer.byteLength) {
  13591. return buffer;
  13592. }
  13593. let size = this.minBufferLength;
  13594. while (size < requested) {
  13595. size *= 2;
  13596. }
  13597. const buffer2 = new Uint8Array(size);
  13598. buffer2.set(buffer);
  13599. return this.buffer = buffer2;
  13600. }
  13601. getByte() {
  13602. const pos = this.pos;
  13603. while (this.bufferLength <= pos) {
  13604. if (this.eof) {
  13605. return -1;
  13606. }
  13607. this.readBlock();
  13608. }
  13609. return this.buffer[this.pos++];
  13610. }
  13611. getBytes(length) {
  13612. const pos = this.pos;
  13613. let end;
  13614. if (length) {
  13615. this.ensureBuffer(pos + length);
  13616. end = pos + length;
  13617. while (!this.eof && this.bufferLength < end) {
  13618. this.readBlock();
  13619. }
  13620. const bufEnd = this.bufferLength;
  13621. if (end > bufEnd) {
  13622. end = bufEnd;
  13623. }
  13624. } else {
  13625. while (!this.eof) {
  13626. this.readBlock();
  13627. }
  13628. end = this.bufferLength;
  13629. }
  13630. this.pos = end;
  13631. return this.buffer.subarray(pos, end);
  13632. }
  13633. reset() {
  13634. this.pos = 0;
  13635. }
  13636. makeSubStream(start, length, dict = null) {
  13637. if (length === undefined) {
  13638. while (!this.eof) {
  13639. this.readBlock();
  13640. }
  13641. } else {
  13642. const end = start + length;
  13643. while (this.bufferLength <= end && !this.eof) {
  13644. this.readBlock();
  13645. }
  13646. }
  13647. return new _stream.Stream(this.buffer, start, length, dict);
  13648. }
  13649. getBaseStreams() {
  13650. return this.str ? this.str.getBaseStreams() : null;
  13651. }
  13652. }
  13653. exports.DecodeStream = DecodeStream;
  13654. class StreamsSequenceStream extends DecodeStream {
  13655. constructor(streams, onError = null) {
  13656. let maybeLength = 0;
  13657. for (const stream of streams) {
  13658. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  13659. }
  13660. super(maybeLength);
  13661. this.streams = streams;
  13662. this._onError = onError;
  13663. }
  13664. readBlock() {
  13665. const streams = this.streams;
  13666. if (streams.length === 0) {
  13667. this.eof = true;
  13668. return;
  13669. }
  13670. const stream = streams.shift();
  13671. let chunk;
  13672. try {
  13673. chunk = stream.getBytes();
  13674. } catch (reason) {
  13675. if (this._onError) {
  13676. this._onError(reason, stream.dict && stream.dict.objId);
  13677. return;
  13678. }
  13679. throw reason;
  13680. }
  13681. const bufferLength = this.bufferLength;
  13682. const newLength = bufferLength + chunk.length;
  13683. const buffer = this.ensureBuffer(newLength);
  13684. buffer.set(chunk, bufferLength);
  13685. this.bufferLength = newLength;
  13686. }
  13687. getBaseStreams() {
  13688. const baseStreamsBuf = [];
  13689. for (const stream of this.streams) {
  13690. const baseStreams = stream.getBaseStreams();
  13691. if (baseStreams) {
  13692. baseStreamsBuf.push(...baseStreams);
  13693. }
  13694. }
  13695. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  13696. }
  13697. }
  13698. exports.StreamsSequenceStream = StreamsSequenceStream;
  13699. /***/ }),
  13700. /* 18 */
  13701. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13702. Object.defineProperty(exports, "__esModule", ({
  13703. value: true
  13704. }));
  13705. exports.AsciiHexStream = void 0;
  13706. var _decode_stream = __w_pdfjs_require__(17);
  13707. class AsciiHexStream extends _decode_stream.DecodeStream {
  13708. constructor(str, maybeLength) {
  13709. if (maybeLength) {
  13710. maybeLength *= 0.5;
  13711. }
  13712. super(maybeLength);
  13713. this.str = str;
  13714. this.dict = str.dict;
  13715. this.firstDigit = -1;
  13716. }
  13717. readBlock() {
  13718. const UPSTREAM_BLOCK_SIZE = 8000;
  13719. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  13720. if (!bytes.length) {
  13721. this.eof = true;
  13722. return;
  13723. }
  13724. const maxDecodeLength = bytes.length + 1 >> 1;
  13725. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  13726. let bufferLength = this.bufferLength;
  13727. let firstDigit = this.firstDigit;
  13728. for (const ch of bytes) {
  13729. let digit;
  13730. if (ch >= 0x30 && ch <= 0x39) {
  13731. digit = ch & 0x0f;
  13732. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13733. digit = (ch & 0x0f) + 9;
  13734. } else if (ch === 0x3e) {
  13735. this.eof = true;
  13736. break;
  13737. } else {
  13738. continue;
  13739. }
  13740. if (firstDigit < 0) {
  13741. firstDigit = digit;
  13742. } else {
  13743. buffer[bufferLength++] = firstDigit << 4 | digit;
  13744. firstDigit = -1;
  13745. }
  13746. }
  13747. if (firstDigit >= 0 && this.eof) {
  13748. buffer[bufferLength++] = firstDigit << 4;
  13749. firstDigit = -1;
  13750. }
  13751. this.firstDigit = firstDigit;
  13752. this.bufferLength = bufferLength;
  13753. }
  13754. }
  13755. exports.AsciiHexStream = AsciiHexStream;
  13756. /***/ }),
  13757. /* 19 */
  13758. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13759. Object.defineProperty(exports, "__esModule", ({
  13760. value: true
  13761. }));
  13762. exports.CCITTFaxStream = void 0;
  13763. var _ccitt = __w_pdfjs_require__(20);
  13764. var _decode_stream = __w_pdfjs_require__(17);
  13765. var _primitives = __w_pdfjs_require__(3);
  13766. class CCITTFaxStream extends _decode_stream.DecodeStream {
  13767. constructor(str, maybeLength, params) {
  13768. super(maybeLength);
  13769. this.str = str;
  13770. this.dict = str.dict;
  13771. if (!(params instanceof _primitives.Dict)) {
  13772. params = _primitives.Dict.empty;
  13773. }
  13774. const source = {
  13775. next() {
  13776. return str.getByte();
  13777. }
  13778. };
  13779. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  13780. K: params.get("K"),
  13781. EndOfLine: params.get("EndOfLine"),
  13782. EncodedByteAlign: params.get("EncodedByteAlign"),
  13783. Columns: params.get("Columns"),
  13784. Rows: params.get("Rows"),
  13785. EndOfBlock: params.get("EndOfBlock"),
  13786. BlackIs1: params.get("BlackIs1")
  13787. });
  13788. }
  13789. readBlock() {
  13790. while (!this.eof) {
  13791. const c = this.ccittFaxDecoder.readNextChar();
  13792. if (c === -1) {
  13793. this.eof = true;
  13794. return;
  13795. }
  13796. this.ensureBuffer(this.bufferLength + 1);
  13797. this.buffer[this.bufferLength++] = c;
  13798. }
  13799. }
  13800. }
  13801. exports.CCITTFaxStream = CCITTFaxStream;
  13802. /***/ }),
  13803. /* 20 */
  13804. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13805. Object.defineProperty(exports, "__esModule", ({
  13806. value: true
  13807. }));
  13808. exports.CCITTFaxDecoder = void 0;
  13809. var _util = __w_pdfjs_require__(2);
  13810. const ccittEOL = -2;
  13811. const ccittEOF = -1;
  13812. const twoDimPass = 0;
  13813. const twoDimHoriz = 1;
  13814. const twoDimVert0 = 2;
  13815. const twoDimVertR1 = 3;
  13816. const twoDimVertL1 = 4;
  13817. const twoDimVertR2 = 5;
  13818. const twoDimVertL2 = 6;
  13819. const twoDimVertR3 = 7;
  13820. const twoDimVertL3 = 8;
  13821. 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]];
  13822. 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]];
  13823. 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]];
  13824. 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]];
  13825. 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]];
  13826. 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]];
  13827. class CCITTFaxDecoder {
  13828. constructor(source, options = {}) {
  13829. if (!source || typeof source.next !== "function") {
  13830. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  13831. }
  13832. this.source = source;
  13833. this.eof = false;
  13834. this.encoding = options.K || 0;
  13835. this.eoline = options.EndOfLine || false;
  13836. this.byteAlign = options.EncodedByteAlign || false;
  13837. this.columns = options.Columns || 1728;
  13838. this.rows = options.Rows || 0;
  13839. let eoblock = options.EndOfBlock;
  13840. if (eoblock === null || eoblock === undefined) {
  13841. eoblock = true;
  13842. }
  13843. this.eoblock = eoblock;
  13844. this.black = options.BlackIs1 || false;
  13845. this.codingLine = new Uint32Array(this.columns + 1);
  13846. this.refLine = new Uint32Array(this.columns + 2);
  13847. this.codingLine[0] = this.columns;
  13848. this.codingPos = 0;
  13849. this.row = 0;
  13850. this.nextLine2D = this.encoding < 0;
  13851. this.inputBits = 0;
  13852. this.inputBuf = 0;
  13853. this.outputBits = 0;
  13854. this.rowsDone = false;
  13855. let code1;
  13856. while ((code1 = this._lookBits(12)) === 0) {
  13857. this._eatBits(1);
  13858. }
  13859. if (code1 === 1) {
  13860. this._eatBits(12);
  13861. }
  13862. if (this.encoding > 0) {
  13863. this.nextLine2D = !this._lookBits(1);
  13864. this._eatBits(1);
  13865. }
  13866. }
  13867. readNextChar() {
  13868. if (this.eof) {
  13869. return -1;
  13870. }
  13871. const refLine = this.refLine;
  13872. const codingLine = this.codingLine;
  13873. const columns = this.columns;
  13874. let refPos, blackPixels, bits, i;
  13875. if (this.outputBits === 0) {
  13876. if (this.rowsDone) {
  13877. this.eof = true;
  13878. }
  13879. if (this.eof) {
  13880. return -1;
  13881. }
  13882. this.err = false;
  13883. let code1, code2, code3;
  13884. if (this.nextLine2D) {
  13885. for (i = 0; codingLine[i] < columns; ++i) {
  13886. refLine[i] = codingLine[i];
  13887. }
  13888. refLine[i++] = columns;
  13889. refLine[i] = columns;
  13890. codingLine[0] = 0;
  13891. this.codingPos = 0;
  13892. refPos = 0;
  13893. blackPixels = 0;
  13894. while (codingLine[this.codingPos] < columns) {
  13895. code1 = this._getTwoDimCode();
  13896. switch (code1) {
  13897. case twoDimPass:
  13898. this._addPixels(refLine[refPos + 1], blackPixels);
  13899. if (refLine[refPos + 1] < columns) {
  13900. refPos += 2;
  13901. }
  13902. break;
  13903. case twoDimHoriz:
  13904. code1 = code2 = 0;
  13905. if (blackPixels) {
  13906. do {
  13907. code1 += code3 = this._getBlackCode();
  13908. } while (code3 >= 64);
  13909. do {
  13910. code2 += code3 = this._getWhiteCode();
  13911. } while (code3 >= 64);
  13912. } else {
  13913. do {
  13914. code1 += code3 = this._getWhiteCode();
  13915. } while (code3 >= 64);
  13916. do {
  13917. code2 += code3 = this._getBlackCode();
  13918. } while (code3 >= 64);
  13919. }
  13920. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  13921. if (codingLine[this.codingPos] < columns) {
  13922. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  13923. }
  13924. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13925. refPos += 2;
  13926. }
  13927. break;
  13928. case twoDimVertR3:
  13929. this._addPixels(refLine[refPos] + 3, blackPixels);
  13930. blackPixels ^= 1;
  13931. if (codingLine[this.codingPos] < columns) {
  13932. ++refPos;
  13933. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13934. refPos += 2;
  13935. }
  13936. }
  13937. break;
  13938. case twoDimVertR2:
  13939. this._addPixels(refLine[refPos] + 2, blackPixels);
  13940. blackPixels ^= 1;
  13941. if (codingLine[this.codingPos] < columns) {
  13942. ++refPos;
  13943. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13944. refPos += 2;
  13945. }
  13946. }
  13947. break;
  13948. case twoDimVertR1:
  13949. this._addPixels(refLine[refPos] + 1, blackPixels);
  13950. blackPixels ^= 1;
  13951. if (codingLine[this.codingPos] < columns) {
  13952. ++refPos;
  13953. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13954. refPos += 2;
  13955. }
  13956. }
  13957. break;
  13958. case twoDimVert0:
  13959. this._addPixels(refLine[refPos], blackPixels);
  13960. blackPixels ^= 1;
  13961. if (codingLine[this.codingPos] < columns) {
  13962. ++refPos;
  13963. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13964. refPos += 2;
  13965. }
  13966. }
  13967. break;
  13968. case twoDimVertL3:
  13969. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  13970. blackPixels ^= 1;
  13971. if (codingLine[this.codingPos] < columns) {
  13972. if (refPos > 0) {
  13973. --refPos;
  13974. } else {
  13975. ++refPos;
  13976. }
  13977. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13978. refPos += 2;
  13979. }
  13980. }
  13981. break;
  13982. case twoDimVertL2:
  13983. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  13984. blackPixels ^= 1;
  13985. if (codingLine[this.codingPos] < columns) {
  13986. if (refPos > 0) {
  13987. --refPos;
  13988. } else {
  13989. ++refPos;
  13990. }
  13991. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13992. refPos += 2;
  13993. }
  13994. }
  13995. break;
  13996. case twoDimVertL1:
  13997. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  13998. blackPixels ^= 1;
  13999. if (codingLine[this.codingPos] < columns) {
  14000. if (refPos > 0) {
  14001. --refPos;
  14002. } else {
  14003. ++refPos;
  14004. }
  14005. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14006. refPos += 2;
  14007. }
  14008. }
  14009. break;
  14010. case ccittEOF:
  14011. this._addPixels(columns, 0);
  14012. this.eof = true;
  14013. break;
  14014. default:
  14015. (0, _util.info)("bad 2d code");
  14016. this._addPixels(columns, 0);
  14017. this.err = true;
  14018. }
  14019. }
  14020. } else {
  14021. codingLine[0] = 0;
  14022. this.codingPos = 0;
  14023. blackPixels = 0;
  14024. while (codingLine[this.codingPos] < columns) {
  14025. code1 = 0;
  14026. if (blackPixels) {
  14027. do {
  14028. code1 += code3 = this._getBlackCode();
  14029. } while (code3 >= 64);
  14030. } else {
  14031. do {
  14032. code1 += code3 = this._getWhiteCode();
  14033. } while (code3 >= 64);
  14034. }
  14035. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14036. blackPixels ^= 1;
  14037. }
  14038. }
  14039. let gotEOL = false;
  14040. if (this.byteAlign) {
  14041. this.inputBits &= ~7;
  14042. }
  14043. if (!this.eoblock && this.row === this.rows - 1) {
  14044. this.rowsDone = true;
  14045. } else {
  14046. code1 = this._lookBits(12);
  14047. if (this.eoline) {
  14048. while (code1 !== ccittEOF && code1 !== 1) {
  14049. this._eatBits(1);
  14050. code1 = this._lookBits(12);
  14051. }
  14052. } else {
  14053. while (code1 === 0) {
  14054. this._eatBits(1);
  14055. code1 = this._lookBits(12);
  14056. }
  14057. }
  14058. if (code1 === 1) {
  14059. this._eatBits(12);
  14060. gotEOL = true;
  14061. } else if (code1 === ccittEOF) {
  14062. this.eof = true;
  14063. }
  14064. }
  14065. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  14066. this.nextLine2D = !this._lookBits(1);
  14067. this._eatBits(1);
  14068. }
  14069. if (this.eoblock && gotEOL && this.byteAlign) {
  14070. code1 = this._lookBits(12);
  14071. if (code1 === 1) {
  14072. this._eatBits(12);
  14073. if (this.encoding > 0) {
  14074. this._lookBits(1);
  14075. this._eatBits(1);
  14076. }
  14077. if (this.encoding >= 0) {
  14078. for (i = 0; i < 4; ++i) {
  14079. code1 = this._lookBits(12);
  14080. if (code1 !== 1) {
  14081. (0, _util.info)("bad rtc code: " + code1);
  14082. }
  14083. this._eatBits(12);
  14084. if (this.encoding > 0) {
  14085. this._lookBits(1);
  14086. this._eatBits(1);
  14087. }
  14088. }
  14089. }
  14090. this.eof = true;
  14091. }
  14092. } else if (this.err && this.eoline) {
  14093. while (true) {
  14094. code1 = this._lookBits(13);
  14095. if (code1 === ccittEOF) {
  14096. this.eof = true;
  14097. return -1;
  14098. }
  14099. if (code1 >> 1 === 1) {
  14100. break;
  14101. }
  14102. this._eatBits(1);
  14103. }
  14104. this._eatBits(12);
  14105. if (this.encoding > 0) {
  14106. this._eatBits(1);
  14107. this.nextLine2D = !(code1 & 1);
  14108. }
  14109. }
  14110. if (codingLine[0] > 0) {
  14111. this.outputBits = codingLine[this.codingPos = 0];
  14112. } else {
  14113. this.outputBits = codingLine[this.codingPos = 1];
  14114. }
  14115. this.row++;
  14116. }
  14117. let c;
  14118. if (this.outputBits >= 8) {
  14119. c = this.codingPos & 1 ? 0 : 0xff;
  14120. this.outputBits -= 8;
  14121. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  14122. this.codingPos++;
  14123. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14124. }
  14125. } else {
  14126. bits = 8;
  14127. c = 0;
  14128. do {
  14129. if (typeof this.outputBits !== "number") {
  14130. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  14131. }
  14132. if (this.outputBits > bits) {
  14133. c <<= bits;
  14134. if (!(this.codingPos & 1)) {
  14135. c |= 0xff >> 8 - bits;
  14136. }
  14137. this.outputBits -= bits;
  14138. bits = 0;
  14139. } else {
  14140. c <<= this.outputBits;
  14141. if (!(this.codingPos & 1)) {
  14142. c |= 0xff >> 8 - this.outputBits;
  14143. }
  14144. bits -= this.outputBits;
  14145. this.outputBits = 0;
  14146. if (codingLine[this.codingPos] < columns) {
  14147. this.codingPos++;
  14148. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14149. } else if (bits > 0) {
  14150. c <<= bits;
  14151. bits = 0;
  14152. }
  14153. }
  14154. } while (bits);
  14155. }
  14156. if (this.black) {
  14157. c ^= 0xff;
  14158. }
  14159. return c;
  14160. }
  14161. _addPixels(a1, blackPixels) {
  14162. const codingLine = this.codingLine;
  14163. let codingPos = this.codingPos;
  14164. if (a1 > codingLine[codingPos]) {
  14165. if (a1 > this.columns) {
  14166. (0, _util.info)("row is wrong length");
  14167. this.err = true;
  14168. a1 = this.columns;
  14169. }
  14170. if (codingPos & 1 ^ blackPixels) {
  14171. ++codingPos;
  14172. }
  14173. codingLine[codingPos] = a1;
  14174. }
  14175. this.codingPos = codingPos;
  14176. }
  14177. _addPixelsNeg(a1, blackPixels) {
  14178. const codingLine = this.codingLine;
  14179. let codingPos = this.codingPos;
  14180. if (a1 > codingLine[codingPos]) {
  14181. if (a1 > this.columns) {
  14182. (0, _util.info)("row is wrong length");
  14183. this.err = true;
  14184. a1 = this.columns;
  14185. }
  14186. if (codingPos & 1 ^ blackPixels) {
  14187. ++codingPos;
  14188. }
  14189. codingLine[codingPos] = a1;
  14190. } else if (a1 < codingLine[codingPos]) {
  14191. if (a1 < 0) {
  14192. (0, _util.info)("invalid code");
  14193. this.err = true;
  14194. a1 = 0;
  14195. }
  14196. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  14197. --codingPos;
  14198. }
  14199. codingLine[codingPos] = a1;
  14200. }
  14201. this.codingPos = codingPos;
  14202. }
  14203. _findTableCode(start, end, table, limit) {
  14204. const limitValue = limit || 0;
  14205. for (let i = start; i <= end; ++i) {
  14206. let code = this._lookBits(i);
  14207. if (code === ccittEOF) {
  14208. return [true, 1, false];
  14209. }
  14210. if (i < end) {
  14211. code <<= end - i;
  14212. }
  14213. if (!limitValue || code >= limitValue) {
  14214. const p = table[code - limitValue];
  14215. if (p[0] === i) {
  14216. this._eatBits(i);
  14217. return [true, p[1], true];
  14218. }
  14219. }
  14220. }
  14221. return [false, 0, false];
  14222. }
  14223. _getTwoDimCode() {
  14224. let code = 0;
  14225. let p;
  14226. if (this.eoblock) {
  14227. code = this._lookBits(7);
  14228. p = twoDimTable[code];
  14229. if (p && p[0] > 0) {
  14230. this._eatBits(p[0]);
  14231. return p[1];
  14232. }
  14233. } else {
  14234. const result = this._findTableCode(1, 7, twoDimTable);
  14235. if (result[0] && result[2]) {
  14236. return result[1];
  14237. }
  14238. }
  14239. (0, _util.info)("Bad two dim code");
  14240. return ccittEOF;
  14241. }
  14242. _getWhiteCode() {
  14243. let code = 0;
  14244. let p;
  14245. if (this.eoblock) {
  14246. code = this._lookBits(12);
  14247. if (code === ccittEOF) {
  14248. return 1;
  14249. }
  14250. if (code >> 5 === 0) {
  14251. p = whiteTable1[code];
  14252. } else {
  14253. p = whiteTable2[code >> 3];
  14254. }
  14255. if (p[0] > 0) {
  14256. this._eatBits(p[0]);
  14257. return p[1];
  14258. }
  14259. } else {
  14260. let result = this._findTableCode(1, 9, whiteTable2);
  14261. if (result[0]) {
  14262. return result[1];
  14263. }
  14264. result = this._findTableCode(11, 12, whiteTable1);
  14265. if (result[0]) {
  14266. return result[1];
  14267. }
  14268. }
  14269. (0, _util.info)("bad white code");
  14270. this._eatBits(1);
  14271. return 1;
  14272. }
  14273. _getBlackCode() {
  14274. let code, p;
  14275. if (this.eoblock) {
  14276. code = this._lookBits(13);
  14277. if (code === ccittEOF) {
  14278. return 1;
  14279. }
  14280. if (code >> 7 === 0) {
  14281. p = blackTable1[code];
  14282. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  14283. p = blackTable2[(code >> 1) - 64];
  14284. } else {
  14285. p = blackTable3[code >> 7];
  14286. }
  14287. if (p[0] > 0) {
  14288. this._eatBits(p[0]);
  14289. return p[1];
  14290. }
  14291. } else {
  14292. let result = this._findTableCode(2, 6, blackTable3);
  14293. if (result[0]) {
  14294. return result[1];
  14295. }
  14296. result = this._findTableCode(7, 12, blackTable2, 64);
  14297. if (result[0]) {
  14298. return result[1];
  14299. }
  14300. result = this._findTableCode(10, 13, blackTable1);
  14301. if (result[0]) {
  14302. return result[1];
  14303. }
  14304. }
  14305. (0, _util.info)("bad black code");
  14306. this._eatBits(1);
  14307. return 1;
  14308. }
  14309. _lookBits(n) {
  14310. let c;
  14311. while (this.inputBits < n) {
  14312. if ((c = this.source.next()) === -1) {
  14313. if (this.inputBits === 0) {
  14314. return ccittEOF;
  14315. }
  14316. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  14317. }
  14318. this.inputBuf = this.inputBuf << 8 | c;
  14319. this.inputBits += 8;
  14320. }
  14321. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  14322. }
  14323. _eatBits(n) {
  14324. if ((this.inputBits -= n) < 0) {
  14325. this.inputBits = 0;
  14326. }
  14327. }
  14328. }
  14329. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  14330. /***/ }),
  14331. /* 21 */
  14332. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14333. Object.defineProperty(exports, "__esModule", ({
  14334. value: true
  14335. }));
  14336. exports.FlateStream = void 0;
  14337. var _decode_stream = __w_pdfjs_require__(17);
  14338. var _util = __w_pdfjs_require__(2);
  14339. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  14340. 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]);
  14341. 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]);
  14342. 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];
  14343. 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];
  14344. class FlateStream extends _decode_stream.DecodeStream {
  14345. constructor(str, maybeLength) {
  14346. super(maybeLength);
  14347. this.str = str;
  14348. this.dict = str.dict;
  14349. const cmf = str.getByte();
  14350. const flg = str.getByte();
  14351. if (cmf === -1 || flg === -1) {
  14352. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  14353. }
  14354. if ((cmf & 0x0f) !== 0x08) {
  14355. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  14356. }
  14357. if (((cmf << 8) + flg) % 31 !== 0) {
  14358. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  14359. }
  14360. if (flg & 0x20) {
  14361. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  14362. }
  14363. this.codeSize = 0;
  14364. this.codeBuf = 0;
  14365. }
  14366. getBits(bits) {
  14367. const str = this.str;
  14368. let codeSize = this.codeSize;
  14369. let codeBuf = this.codeBuf;
  14370. let b;
  14371. while (codeSize < bits) {
  14372. if ((b = str.getByte()) === -1) {
  14373. throw new _util.FormatError("Bad encoding in flate stream");
  14374. }
  14375. codeBuf |= b << codeSize;
  14376. codeSize += 8;
  14377. }
  14378. b = codeBuf & (1 << bits) - 1;
  14379. this.codeBuf = codeBuf >> bits;
  14380. this.codeSize = codeSize -= bits;
  14381. return b;
  14382. }
  14383. getCode(table) {
  14384. const str = this.str;
  14385. const codes = table[0];
  14386. const maxLen = table[1];
  14387. let codeSize = this.codeSize;
  14388. let codeBuf = this.codeBuf;
  14389. let b;
  14390. while (codeSize < maxLen) {
  14391. if ((b = str.getByte()) === -1) {
  14392. break;
  14393. }
  14394. codeBuf |= b << codeSize;
  14395. codeSize += 8;
  14396. }
  14397. const code = codes[codeBuf & (1 << maxLen) - 1];
  14398. const codeLen = code >> 16;
  14399. const codeVal = code & 0xffff;
  14400. if (codeLen < 1 || codeSize < codeLen) {
  14401. throw new _util.FormatError("Bad encoding in flate stream");
  14402. }
  14403. this.codeBuf = codeBuf >> codeLen;
  14404. this.codeSize = codeSize - codeLen;
  14405. return codeVal;
  14406. }
  14407. generateHuffmanTable(lengths) {
  14408. const n = lengths.length;
  14409. let maxLen = 0;
  14410. let i;
  14411. for (i = 0; i < n; ++i) {
  14412. if (lengths[i] > maxLen) {
  14413. maxLen = lengths[i];
  14414. }
  14415. }
  14416. const size = 1 << maxLen;
  14417. const codes = new Int32Array(size);
  14418. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  14419. for (let val = 0; val < n; ++val) {
  14420. if (lengths[val] === len) {
  14421. let code2 = 0;
  14422. let t = code;
  14423. for (i = 0; i < len; ++i) {
  14424. code2 = code2 << 1 | t & 1;
  14425. t >>= 1;
  14426. }
  14427. for (i = code2; i < size; i += skip) {
  14428. codes[i] = len << 16 | val;
  14429. }
  14430. ++code;
  14431. }
  14432. }
  14433. }
  14434. return [codes, maxLen];
  14435. }
  14436. readBlock() {
  14437. let buffer, len;
  14438. const str = this.str;
  14439. let hdr = this.getBits(3);
  14440. if (hdr & 1) {
  14441. this.eof = true;
  14442. }
  14443. hdr >>= 1;
  14444. if (hdr === 0) {
  14445. let b;
  14446. if ((b = str.getByte()) === -1) {
  14447. throw new _util.FormatError("Bad block header in flate stream");
  14448. }
  14449. let blockLen = b;
  14450. if ((b = str.getByte()) === -1) {
  14451. throw new _util.FormatError("Bad block header in flate stream");
  14452. }
  14453. blockLen |= b << 8;
  14454. if ((b = str.getByte()) === -1) {
  14455. throw new _util.FormatError("Bad block header in flate stream");
  14456. }
  14457. let check = b;
  14458. if ((b = str.getByte()) === -1) {
  14459. throw new _util.FormatError("Bad block header in flate stream");
  14460. }
  14461. check |= b << 8;
  14462. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  14463. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  14464. }
  14465. this.codeBuf = 0;
  14466. this.codeSize = 0;
  14467. const bufferLength = this.bufferLength,
  14468. end = bufferLength + blockLen;
  14469. buffer = this.ensureBuffer(end);
  14470. this.bufferLength = end;
  14471. if (blockLen === 0) {
  14472. if (str.peekByte() === -1) {
  14473. this.eof = true;
  14474. }
  14475. } else {
  14476. const block = str.getBytes(blockLen);
  14477. buffer.set(block, bufferLength);
  14478. if (block.length < blockLen) {
  14479. this.eof = true;
  14480. }
  14481. }
  14482. return;
  14483. }
  14484. let litCodeTable;
  14485. let distCodeTable;
  14486. if (hdr === 1) {
  14487. litCodeTable = fixedLitCodeTab;
  14488. distCodeTable = fixedDistCodeTab;
  14489. } else if (hdr === 2) {
  14490. const numLitCodes = this.getBits(5) + 257;
  14491. const numDistCodes = this.getBits(5) + 1;
  14492. const numCodeLenCodes = this.getBits(4) + 4;
  14493. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  14494. let i;
  14495. for (i = 0; i < numCodeLenCodes; ++i) {
  14496. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  14497. }
  14498. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  14499. len = 0;
  14500. i = 0;
  14501. const codes = numLitCodes + numDistCodes;
  14502. const codeLengths = new Uint8Array(codes);
  14503. let bitsLength, bitsOffset, what;
  14504. while (i < codes) {
  14505. const code = this.getCode(codeLenCodeTab);
  14506. if (code === 16) {
  14507. bitsLength = 2;
  14508. bitsOffset = 3;
  14509. what = len;
  14510. } else if (code === 17) {
  14511. bitsLength = 3;
  14512. bitsOffset = 3;
  14513. what = len = 0;
  14514. } else if (code === 18) {
  14515. bitsLength = 7;
  14516. bitsOffset = 11;
  14517. what = len = 0;
  14518. } else {
  14519. codeLengths[i++] = len = code;
  14520. continue;
  14521. }
  14522. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  14523. while (repeatLength-- > 0) {
  14524. codeLengths[i++] = what;
  14525. }
  14526. }
  14527. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  14528. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  14529. } else {
  14530. throw new _util.FormatError("Unknown block type in flate stream");
  14531. }
  14532. buffer = this.buffer;
  14533. let limit = buffer ? buffer.length : 0;
  14534. let pos = this.bufferLength;
  14535. while (true) {
  14536. let code1 = this.getCode(litCodeTable);
  14537. if (code1 < 256) {
  14538. if (pos + 1 >= limit) {
  14539. buffer = this.ensureBuffer(pos + 1);
  14540. limit = buffer.length;
  14541. }
  14542. buffer[pos++] = code1;
  14543. continue;
  14544. }
  14545. if (code1 === 256) {
  14546. this.bufferLength = pos;
  14547. return;
  14548. }
  14549. code1 -= 257;
  14550. code1 = lengthDecode[code1];
  14551. let code2 = code1 >> 16;
  14552. if (code2 > 0) {
  14553. code2 = this.getBits(code2);
  14554. }
  14555. len = (code1 & 0xffff) + code2;
  14556. code1 = this.getCode(distCodeTable);
  14557. code1 = distDecode[code1];
  14558. code2 = code1 >> 16;
  14559. if (code2 > 0) {
  14560. code2 = this.getBits(code2);
  14561. }
  14562. const dist = (code1 & 0xffff) + code2;
  14563. if (pos + len >= limit) {
  14564. buffer = this.ensureBuffer(pos + len);
  14565. limit = buffer.length;
  14566. }
  14567. for (let k = 0; k < len; ++k, ++pos) {
  14568. buffer[pos] = buffer[pos - dist];
  14569. }
  14570. }
  14571. }
  14572. }
  14573. exports.FlateStream = FlateStream;
  14574. /***/ }),
  14575. /* 22 */
  14576. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14577. Object.defineProperty(exports, "__esModule", ({
  14578. value: true
  14579. }));
  14580. exports.Jbig2Stream = void 0;
  14581. var _base_stream = __w_pdfjs_require__(5);
  14582. var _decode_stream = __w_pdfjs_require__(17);
  14583. var _primitives = __w_pdfjs_require__(3);
  14584. var _jbig = __w_pdfjs_require__(23);
  14585. var _util = __w_pdfjs_require__(2);
  14586. class Jbig2Stream extends _decode_stream.DecodeStream {
  14587. constructor(stream, maybeLength, params) {
  14588. super(maybeLength);
  14589. this.stream = stream;
  14590. this.dict = stream.dict;
  14591. this.maybeLength = maybeLength;
  14592. this.params = params;
  14593. }
  14594. get bytes() {
  14595. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  14596. }
  14597. ensureBuffer(requested) {}
  14598. readBlock() {
  14599. if (this.eof) {
  14600. return;
  14601. }
  14602. const jbig2Image = new _jbig.Jbig2Image();
  14603. const chunks = [];
  14604. if (this.params instanceof _primitives.Dict) {
  14605. const globalsStream = this.params.get("JBIG2Globals");
  14606. if (globalsStream instanceof _base_stream.BaseStream) {
  14607. const globals = globalsStream.getBytes();
  14608. chunks.push({
  14609. data: globals,
  14610. start: 0,
  14611. end: globals.length
  14612. });
  14613. }
  14614. }
  14615. chunks.push({
  14616. data: this.bytes,
  14617. start: 0,
  14618. end: this.bytes.length
  14619. });
  14620. const data = jbig2Image.parseChunks(chunks);
  14621. const dataLength = data.length;
  14622. for (let i = 0; i < dataLength; i++) {
  14623. data[i] ^= 0xff;
  14624. }
  14625. this.buffer = data;
  14626. this.bufferLength = dataLength;
  14627. this.eof = true;
  14628. }
  14629. }
  14630. exports.Jbig2Stream = Jbig2Stream;
  14631. /***/ }),
  14632. /* 23 */
  14633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14634. Object.defineProperty(exports, "__esModule", ({
  14635. value: true
  14636. }));
  14637. exports.Jbig2Image = void 0;
  14638. var _util = __w_pdfjs_require__(2);
  14639. var _core_utils = __w_pdfjs_require__(4);
  14640. var _arithmetic_decoder = __w_pdfjs_require__(24);
  14641. var _ccitt = __w_pdfjs_require__(20);
  14642. class Jbig2Error extends _util.BaseException {
  14643. constructor(msg) {
  14644. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  14645. }
  14646. }
  14647. class ContextCache {
  14648. getContexts(id) {
  14649. if (id in this) {
  14650. return this[id];
  14651. }
  14652. return this[id] = new Int8Array(1 << 16);
  14653. }
  14654. }
  14655. class DecodingContext {
  14656. constructor(data, start, end) {
  14657. this.data = data;
  14658. this.start = start;
  14659. this.end = end;
  14660. }
  14661. get decoder() {
  14662. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  14663. return (0, _util.shadow)(this, "decoder", decoder);
  14664. }
  14665. get contextCache() {
  14666. const cache = new ContextCache();
  14667. return (0, _util.shadow)(this, "contextCache", cache);
  14668. }
  14669. }
  14670. function decodeInteger(contextCache, procedure, decoder) {
  14671. const contexts = contextCache.getContexts(procedure);
  14672. let prev = 1;
  14673. function readBits(length) {
  14674. let v = 0;
  14675. for (let i = 0; i < length; i++) {
  14676. const bit = decoder.readBit(contexts, prev);
  14677. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  14678. v = v << 1 | bit;
  14679. }
  14680. return v >>> 0;
  14681. }
  14682. const sign = readBits(1);
  14683. 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);
  14684. if (sign === 0) {
  14685. return value;
  14686. } else if (value > 0) {
  14687. return -value;
  14688. }
  14689. return null;
  14690. }
  14691. function decodeIAID(contextCache, decoder, codeLength) {
  14692. const contexts = contextCache.getContexts("IAID");
  14693. let prev = 1;
  14694. for (let i = 0; i < codeLength; i++) {
  14695. const bit = decoder.readBit(contexts, prev);
  14696. prev = prev << 1 | bit;
  14697. }
  14698. if (codeLength < 31) {
  14699. return prev & (1 << codeLength) - 1;
  14700. }
  14701. return prev & 0x7fffffff;
  14702. }
  14703. 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"];
  14704. const CodingTemplates = [[{
  14705. x: -1,
  14706. y: -2
  14707. }, {
  14708. x: 0,
  14709. y: -2
  14710. }, {
  14711. x: 1,
  14712. y: -2
  14713. }, {
  14714. x: -2,
  14715. y: -1
  14716. }, {
  14717. x: -1,
  14718. y: -1
  14719. }, {
  14720. x: 0,
  14721. y: -1
  14722. }, {
  14723. x: 1,
  14724. y: -1
  14725. }, {
  14726. x: 2,
  14727. y: -1
  14728. }, {
  14729. x: -4,
  14730. y: 0
  14731. }, {
  14732. x: -3,
  14733. y: 0
  14734. }, {
  14735. x: -2,
  14736. y: 0
  14737. }, {
  14738. x: -1,
  14739. y: 0
  14740. }], [{
  14741. x: -1,
  14742. y: -2
  14743. }, {
  14744. x: 0,
  14745. y: -2
  14746. }, {
  14747. x: 1,
  14748. y: -2
  14749. }, {
  14750. x: 2,
  14751. y: -2
  14752. }, {
  14753. x: -2,
  14754. y: -1
  14755. }, {
  14756. x: -1,
  14757. y: -1
  14758. }, {
  14759. x: 0,
  14760. y: -1
  14761. }, {
  14762. x: 1,
  14763. y: -1
  14764. }, {
  14765. x: 2,
  14766. y: -1
  14767. }, {
  14768. x: -3,
  14769. y: 0
  14770. }, {
  14771. x: -2,
  14772. y: 0
  14773. }, {
  14774. x: -1,
  14775. y: 0
  14776. }], [{
  14777. x: -1,
  14778. y: -2
  14779. }, {
  14780. x: 0,
  14781. y: -2
  14782. }, {
  14783. x: 1,
  14784. y: -2
  14785. }, {
  14786. x: -2,
  14787. y: -1
  14788. }, {
  14789. x: -1,
  14790. y: -1
  14791. }, {
  14792. x: 0,
  14793. y: -1
  14794. }, {
  14795. x: 1,
  14796. y: -1
  14797. }, {
  14798. x: -2,
  14799. y: 0
  14800. }, {
  14801. x: -1,
  14802. y: 0
  14803. }], [{
  14804. x: -3,
  14805. y: -1
  14806. }, {
  14807. x: -2,
  14808. y: -1
  14809. }, {
  14810. x: -1,
  14811. y: -1
  14812. }, {
  14813. x: 0,
  14814. y: -1
  14815. }, {
  14816. x: 1,
  14817. y: -1
  14818. }, {
  14819. x: -4,
  14820. y: 0
  14821. }, {
  14822. x: -3,
  14823. y: 0
  14824. }, {
  14825. x: -2,
  14826. y: 0
  14827. }, {
  14828. x: -1,
  14829. y: 0
  14830. }]];
  14831. const RefinementTemplates = [{
  14832. coding: [{
  14833. x: 0,
  14834. y: -1
  14835. }, {
  14836. x: 1,
  14837. y: -1
  14838. }, {
  14839. x: -1,
  14840. y: 0
  14841. }],
  14842. reference: [{
  14843. x: 0,
  14844. y: -1
  14845. }, {
  14846. x: 1,
  14847. y: -1
  14848. }, {
  14849. x: -1,
  14850. y: 0
  14851. }, {
  14852. x: 0,
  14853. y: 0
  14854. }, {
  14855. x: 1,
  14856. y: 0
  14857. }, {
  14858. x: -1,
  14859. y: 1
  14860. }, {
  14861. x: 0,
  14862. y: 1
  14863. }, {
  14864. x: 1,
  14865. y: 1
  14866. }]
  14867. }, {
  14868. coding: [{
  14869. x: -1,
  14870. y: -1
  14871. }, {
  14872. x: 0,
  14873. y: -1
  14874. }, {
  14875. x: 1,
  14876. y: -1
  14877. }, {
  14878. x: -1,
  14879. y: 0
  14880. }],
  14881. reference: [{
  14882. x: 0,
  14883. y: -1
  14884. }, {
  14885. x: -1,
  14886. y: 0
  14887. }, {
  14888. x: 0,
  14889. y: 0
  14890. }, {
  14891. x: 1,
  14892. y: 0
  14893. }, {
  14894. x: 0,
  14895. y: 1
  14896. }, {
  14897. x: 1,
  14898. y: 1
  14899. }]
  14900. }];
  14901. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  14902. const RefinementReusedContexts = [0x0020, 0x0008];
  14903. function decodeBitmapTemplate0(width, height, decodingContext) {
  14904. const decoder = decodingContext.decoder;
  14905. const contexts = decodingContext.contextCache.getContexts("GB");
  14906. const bitmap = [];
  14907. let contextLabel, i, j, pixel, row, row1, row2;
  14908. const OLD_PIXEL_MASK = 0x7bf7;
  14909. for (i = 0; i < height; i++) {
  14910. row = bitmap[i] = new Uint8Array(width);
  14911. row1 = i < 1 ? row : bitmap[i - 1];
  14912. row2 = i < 2 ? row : bitmap[i - 2];
  14913. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  14914. for (j = 0; j < width; j++) {
  14915. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  14916. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  14917. }
  14918. }
  14919. return bitmap;
  14920. }
  14921. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  14922. if (mmr) {
  14923. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  14924. return decodeMMRBitmap(input, width, height, false);
  14925. }
  14926. 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) {
  14927. return decodeBitmapTemplate0(width, height, decodingContext);
  14928. }
  14929. const useskip = !!skip;
  14930. const template = CodingTemplates[templateIndex].concat(at);
  14931. template.sort(function (a, b) {
  14932. return a.y - b.y || a.x - b.x;
  14933. });
  14934. const templateLength = template.length;
  14935. const templateX = new Int8Array(templateLength);
  14936. const templateY = new Int8Array(templateLength);
  14937. const changingTemplateEntries = [];
  14938. let reuseMask = 0,
  14939. minX = 0,
  14940. maxX = 0,
  14941. minY = 0;
  14942. let c, k;
  14943. for (k = 0; k < templateLength; k++) {
  14944. templateX[k] = template[k].x;
  14945. templateY[k] = template[k].y;
  14946. minX = Math.min(minX, template[k].x);
  14947. maxX = Math.max(maxX, template[k].x);
  14948. minY = Math.min(minY, template[k].y);
  14949. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  14950. reuseMask |= 1 << templateLength - 1 - k;
  14951. } else {
  14952. changingTemplateEntries.push(k);
  14953. }
  14954. }
  14955. const changingEntriesLength = changingTemplateEntries.length;
  14956. const changingTemplateX = new Int8Array(changingEntriesLength);
  14957. const changingTemplateY = new Int8Array(changingEntriesLength);
  14958. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  14959. for (c = 0; c < changingEntriesLength; c++) {
  14960. k = changingTemplateEntries[c];
  14961. changingTemplateX[c] = template[k].x;
  14962. changingTemplateY[c] = template[k].y;
  14963. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  14964. }
  14965. const sbb_left = -minX;
  14966. const sbb_top = -minY;
  14967. const sbb_right = width - maxX;
  14968. const pseudoPixelContext = ReusedContexts[templateIndex];
  14969. let row = new Uint8Array(width);
  14970. const bitmap = [];
  14971. const decoder = decodingContext.decoder;
  14972. const contexts = decodingContext.contextCache.getContexts("GB");
  14973. let ltp = 0,
  14974. j,
  14975. i0,
  14976. j0,
  14977. contextLabel = 0,
  14978. bit,
  14979. shift;
  14980. for (let i = 0; i < height; i++) {
  14981. if (prediction) {
  14982. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  14983. ltp ^= sltp;
  14984. if (ltp) {
  14985. bitmap.push(row);
  14986. continue;
  14987. }
  14988. }
  14989. row = new Uint8Array(row);
  14990. bitmap.push(row);
  14991. for (j = 0; j < width; j++) {
  14992. if (useskip && skip[i][j]) {
  14993. row[j] = 0;
  14994. continue;
  14995. }
  14996. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  14997. contextLabel = contextLabel << 1 & reuseMask;
  14998. for (k = 0; k < changingEntriesLength; k++) {
  14999. i0 = i + changingTemplateY[k];
  15000. j0 = j + changingTemplateX[k];
  15001. bit = bitmap[i0][j0];
  15002. if (bit) {
  15003. bit = changingTemplateBit[k];
  15004. contextLabel |= bit;
  15005. }
  15006. }
  15007. } else {
  15008. contextLabel = 0;
  15009. shift = templateLength - 1;
  15010. for (k = 0; k < templateLength; k++, shift--) {
  15011. j0 = j + templateX[k];
  15012. if (j0 >= 0 && j0 < width) {
  15013. i0 = i + templateY[k];
  15014. if (i0 >= 0) {
  15015. bit = bitmap[i0][j0];
  15016. if (bit) {
  15017. contextLabel |= bit << shift;
  15018. }
  15019. }
  15020. }
  15021. }
  15022. }
  15023. const pixel = decoder.readBit(contexts, contextLabel);
  15024. row[j] = pixel;
  15025. }
  15026. }
  15027. return bitmap;
  15028. }
  15029. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  15030. let codingTemplate = RefinementTemplates[templateIndex].coding;
  15031. if (templateIndex === 0) {
  15032. codingTemplate = codingTemplate.concat([at[0]]);
  15033. }
  15034. const codingTemplateLength = codingTemplate.length;
  15035. const codingTemplateX = new Int32Array(codingTemplateLength);
  15036. const codingTemplateY = new Int32Array(codingTemplateLength);
  15037. let k;
  15038. for (k = 0; k < codingTemplateLength; k++) {
  15039. codingTemplateX[k] = codingTemplate[k].x;
  15040. codingTemplateY[k] = codingTemplate[k].y;
  15041. }
  15042. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  15043. if (templateIndex === 0) {
  15044. referenceTemplate = referenceTemplate.concat([at[1]]);
  15045. }
  15046. const referenceTemplateLength = referenceTemplate.length;
  15047. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  15048. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  15049. for (k = 0; k < referenceTemplateLength; k++) {
  15050. referenceTemplateX[k] = referenceTemplate[k].x;
  15051. referenceTemplateY[k] = referenceTemplate[k].y;
  15052. }
  15053. const referenceWidth = referenceBitmap[0].length;
  15054. const referenceHeight = referenceBitmap.length;
  15055. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  15056. const bitmap = [];
  15057. const decoder = decodingContext.decoder;
  15058. const contexts = decodingContext.contextCache.getContexts("GR");
  15059. let ltp = 0;
  15060. for (let i = 0; i < height; i++) {
  15061. if (prediction) {
  15062. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15063. ltp ^= sltp;
  15064. if (ltp) {
  15065. throw new Jbig2Error("prediction is not supported");
  15066. }
  15067. }
  15068. const row = new Uint8Array(width);
  15069. bitmap.push(row);
  15070. for (let j = 0; j < width; j++) {
  15071. let i0, j0;
  15072. let contextLabel = 0;
  15073. for (k = 0; k < codingTemplateLength; k++) {
  15074. i0 = i + codingTemplateY[k];
  15075. j0 = j + codingTemplateX[k];
  15076. if (i0 < 0 || j0 < 0 || j0 >= width) {
  15077. contextLabel <<= 1;
  15078. } else {
  15079. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  15080. }
  15081. }
  15082. for (k = 0; k < referenceTemplateLength; k++) {
  15083. i0 = i + referenceTemplateY[k] - offsetY;
  15084. j0 = j + referenceTemplateX[k] - offsetX;
  15085. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  15086. contextLabel <<= 1;
  15087. } else {
  15088. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  15089. }
  15090. }
  15091. const pixel = decoder.readBit(contexts, contextLabel);
  15092. row[j] = pixel;
  15093. }
  15094. }
  15095. return bitmap;
  15096. }
  15097. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  15098. if (huffman && refinement) {
  15099. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  15100. }
  15101. const newSymbols = [];
  15102. let currentHeight = 0;
  15103. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  15104. const decoder = decodingContext.decoder;
  15105. const contextCache = decodingContext.contextCache;
  15106. let tableB1, symbolWidths;
  15107. if (huffman) {
  15108. tableB1 = getStandardTable(1);
  15109. symbolWidths = [];
  15110. symbolCodeLength = Math.max(symbolCodeLength, 1);
  15111. }
  15112. while (newSymbols.length < numberOfNewSymbols) {
  15113. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  15114. currentHeight += deltaHeight;
  15115. let currentWidth = 0,
  15116. totalWidth = 0;
  15117. const firstSymbol = huffman ? symbolWidths.length : 0;
  15118. while (true) {
  15119. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  15120. if (deltaWidth === null) {
  15121. break;
  15122. }
  15123. currentWidth += deltaWidth;
  15124. totalWidth += currentWidth;
  15125. let bitmap;
  15126. if (refinement) {
  15127. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  15128. if (numberOfInstances > 1) {
  15129. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  15130. } else {
  15131. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  15132. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15133. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15134. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  15135. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  15136. }
  15137. newSymbols.push(bitmap);
  15138. } else if (huffman) {
  15139. symbolWidths.push(currentWidth);
  15140. } else {
  15141. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  15142. newSymbols.push(bitmap);
  15143. }
  15144. }
  15145. if (huffman && !refinement) {
  15146. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  15147. huffmanInput.byteAlign();
  15148. let collectiveBitmap;
  15149. if (bitmapSize === 0) {
  15150. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  15151. } else {
  15152. const originalEnd = huffmanInput.end;
  15153. const bitmapEnd = huffmanInput.position + bitmapSize;
  15154. huffmanInput.end = bitmapEnd;
  15155. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  15156. huffmanInput.end = originalEnd;
  15157. huffmanInput.position = bitmapEnd;
  15158. }
  15159. const numberOfSymbolsDecoded = symbolWidths.length;
  15160. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  15161. newSymbols.push(collectiveBitmap);
  15162. } else {
  15163. let i,
  15164. y,
  15165. xMin = 0,
  15166. xMax,
  15167. bitmapWidth,
  15168. symbolBitmap;
  15169. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  15170. bitmapWidth = symbolWidths[i];
  15171. xMax = xMin + bitmapWidth;
  15172. symbolBitmap = [];
  15173. for (y = 0; y < currentHeight; y++) {
  15174. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15175. }
  15176. newSymbols.push(symbolBitmap);
  15177. xMin = xMax;
  15178. }
  15179. }
  15180. }
  15181. }
  15182. const exportedSymbols = [],
  15183. flags = [];
  15184. let currentFlag = false,
  15185. i,
  15186. ii;
  15187. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  15188. while (flags.length < totalSymbolsLength) {
  15189. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  15190. while (runLength--) {
  15191. flags.push(currentFlag);
  15192. }
  15193. currentFlag = !currentFlag;
  15194. }
  15195. for (i = 0, ii = symbols.length; i < ii; i++) {
  15196. if (flags[i]) {
  15197. exportedSymbols.push(symbols[i]);
  15198. }
  15199. }
  15200. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  15201. if (flags[i]) {
  15202. exportedSymbols.push(newSymbols[j]);
  15203. }
  15204. }
  15205. return exportedSymbols;
  15206. }
  15207. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  15208. if (huffman && refinement) {
  15209. throw new Jbig2Error("refinement with Huffman is not supported");
  15210. }
  15211. const bitmap = [];
  15212. let i, row;
  15213. for (i = 0; i < height; i++) {
  15214. row = new Uint8Array(width);
  15215. if (defaultPixelValue) {
  15216. for (let j = 0; j < width; j++) {
  15217. row[j] = defaultPixelValue;
  15218. }
  15219. }
  15220. bitmap.push(row);
  15221. }
  15222. const decoder = decodingContext.decoder;
  15223. const contextCache = decodingContext.contextCache;
  15224. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  15225. let firstS = 0;
  15226. i = 0;
  15227. while (i < numberOfSymbolInstances) {
  15228. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  15229. stripT += deltaT;
  15230. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  15231. firstS += deltaFirstS;
  15232. let currentS = firstS;
  15233. do {
  15234. let currentT = 0;
  15235. if (stripSize > 1) {
  15236. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  15237. }
  15238. const t = stripSize * stripT + currentT;
  15239. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  15240. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  15241. let symbolBitmap = inputSymbols[symbolId];
  15242. let symbolWidth = symbolBitmap[0].length;
  15243. let symbolHeight = symbolBitmap.length;
  15244. if (applyRefinement) {
  15245. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  15246. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  15247. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15248. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15249. symbolWidth += rdw;
  15250. symbolHeight += rdh;
  15251. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  15252. }
  15253. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  15254. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  15255. let s2, t2, symbolRow;
  15256. if (transposed) {
  15257. for (s2 = 0; s2 < symbolHeight; s2++) {
  15258. row = bitmap[offsetS + s2];
  15259. if (!row) {
  15260. continue;
  15261. }
  15262. symbolRow = symbolBitmap[s2];
  15263. const maxWidth = Math.min(width - offsetT, symbolWidth);
  15264. switch (combinationOperator) {
  15265. case 0:
  15266. for (t2 = 0; t2 < maxWidth; t2++) {
  15267. row[offsetT + t2] |= symbolRow[t2];
  15268. }
  15269. break;
  15270. case 2:
  15271. for (t2 = 0; t2 < maxWidth; t2++) {
  15272. row[offsetT + t2] ^= symbolRow[t2];
  15273. }
  15274. break;
  15275. default:
  15276. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15277. }
  15278. }
  15279. currentS += symbolHeight - 1;
  15280. } else {
  15281. for (t2 = 0; t2 < symbolHeight; t2++) {
  15282. row = bitmap[offsetT + t2];
  15283. if (!row) {
  15284. continue;
  15285. }
  15286. symbolRow = symbolBitmap[t2];
  15287. switch (combinationOperator) {
  15288. case 0:
  15289. for (s2 = 0; s2 < symbolWidth; s2++) {
  15290. row[offsetS + s2] |= symbolRow[s2];
  15291. }
  15292. break;
  15293. case 2:
  15294. for (s2 = 0; s2 < symbolWidth; s2++) {
  15295. row[offsetS + s2] ^= symbolRow[s2];
  15296. }
  15297. break;
  15298. default:
  15299. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15300. }
  15301. }
  15302. currentS += symbolWidth - 1;
  15303. }
  15304. i++;
  15305. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  15306. if (deltaS === null) {
  15307. break;
  15308. }
  15309. currentS += deltaS + dsOffset;
  15310. } while (true);
  15311. }
  15312. return bitmap;
  15313. }
  15314. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  15315. const at = [];
  15316. if (!mmr) {
  15317. at.push({
  15318. x: -patternWidth,
  15319. y: 0
  15320. });
  15321. if (template === 0) {
  15322. at.push({
  15323. x: -3,
  15324. y: -1
  15325. }, {
  15326. x: 2,
  15327. y: -2
  15328. }, {
  15329. x: -2,
  15330. y: -2
  15331. });
  15332. }
  15333. }
  15334. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  15335. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  15336. const patterns = [];
  15337. for (let i = 0; i <= maxPatternIndex; i++) {
  15338. const patternBitmap = [];
  15339. const xMin = patternWidth * i;
  15340. const xMax = xMin + patternWidth;
  15341. for (let y = 0; y < patternHeight; y++) {
  15342. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15343. }
  15344. patterns.push(patternBitmap);
  15345. }
  15346. return patterns;
  15347. }
  15348. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  15349. const skip = null;
  15350. if (enableSkip) {
  15351. throw new Jbig2Error("skip is not supported");
  15352. }
  15353. if (combinationOperator !== 0) {
  15354. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  15355. }
  15356. const regionBitmap = [];
  15357. let i, j, row;
  15358. for (i = 0; i < regionHeight; i++) {
  15359. row = new Uint8Array(regionWidth);
  15360. if (defaultPixelValue) {
  15361. for (j = 0; j < regionWidth; j++) {
  15362. row[j] = defaultPixelValue;
  15363. }
  15364. }
  15365. regionBitmap.push(row);
  15366. }
  15367. const numberOfPatterns = patterns.length;
  15368. const pattern0 = patterns[0];
  15369. const patternWidth = pattern0[0].length,
  15370. patternHeight = pattern0.length;
  15371. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  15372. const at = [];
  15373. if (!mmr) {
  15374. at.push({
  15375. x: template <= 1 ? 3 : 2,
  15376. y: -1
  15377. });
  15378. if (template === 0) {
  15379. at.push({
  15380. x: -3,
  15381. y: -1
  15382. }, {
  15383. x: 2,
  15384. y: -2
  15385. }, {
  15386. x: -2,
  15387. y: -2
  15388. });
  15389. }
  15390. }
  15391. const grayScaleBitPlanes = [];
  15392. let mmrInput, bitmap;
  15393. if (mmr) {
  15394. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15395. }
  15396. for (i = bitsPerValue - 1; i >= 0; i--) {
  15397. if (mmr) {
  15398. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  15399. } else {
  15400. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  15401. }
  15402. grayScaleBitPlanes[i] = bitmap;
  15403. }
  15404. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  15405. for (mg = 0; mg < gridHeight; mg++) {
  15406. for (ng = 0; ng < gridWidth; ng++) {
  15407. bit = 0;
  15408. patternIndex = 0;
  15409. for (j = bitsPerValue - 1; j >= 0; j--) {
  15410. bit ^= grayScaleBitPlanes[j][mg][ng];
  15411. patternIndex |= bit << j;
  15412. }
  15413. patternBitmap = patterns[patternIndex];
  15414. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  15415. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  15416. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  15417. for (i = 0; i < patternHeight; i++) {
  15418. regionRow = regionBitmap[y + i];
  15419. patternRow = patternBitmap[i];
  15420. for (j = 0; j < patternWidth; j++) {
  15421. regionRow[x + j] |= patternRow[j];
  15422. }
  15423. }
  15424. } else {
  15425. let regionX, regionY;
  15426. for (i = 0; i < patternHeight; i++) {
  15427. regionY = y + i;
  15428. if (regionY < 0 || regionY >= regionHeight) {
  15429. continue;
  15430. }
  15431. regionRow = regionBitmap[regionY];
  15432. patternRow = patternBitmap[i];
  15433. for (j = 0; j < patternWidth; j++) {
  15434. regionX = x + j;
  15435. if (regionX >= 0 && regionX < regionWidth) {
  15436. regionRow[regionX] |= patternRow[j];
  15437. }
  15438. }
  15439. }
  15440. }
  15441. }
  15442. }
  15443. return regionBitmap;
  15444. }
  15445. function readSegmentHeader(data, start) {
  15446. const segmentHeader = {};
  15447. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  15448. const flags = data[start + 4];
  15449. const segmentType = flags & 0x3f;
  15450. if (!SegmentTypes[segmentType]) {
  15451. throw new Jbig2Error("invalid segment type: " + segmentType);
  15452. }
  15453. segmentHeader.type = segmentType;
  15454. segmentHeader.typeName = SegmentTypes[segmentType];
  15455. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  15456. const pageAssociationFieldSize = !!(flags & 0x40);
  15457. const referredFlags = data[start + 5];
  15458. let referredToCount = referredFlags >> 5 & 7;
  15459. const retainBits = [referredFlags & 31];
  15460. let position = start + 6;
  15461. if (referredFlags === 7) {
  15462. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  15463. position += 3;
  15464. let bytes = referredToCount + 7 >> 3;
  15465. retainBits[0] = data[position++];
  15466. while (--bytes > 0) {
  15467. retainBits.push(data[position++]);
  15468. }
  15469. } else if (referredFlags === 5 || referredFlags === 6) {
  15470. throw new Jbig2Error("invalid referred-to flags");
  15471. }
  15472. segmentHeader.retainBits = retainBits;
  15473. let referredToSegmentNumberSize = 4;
  15474. if (segmentHeader.number <= 256) {
  15475. referredToSegmentNumberSize = 1;
  15476. } else if (segmentHeader.number <= 65536) {
  15477. referredToSegmentNumberSize = 2;
  15478. }
  15479. const referredTo = [];
  15480. let i, ii;
  15481. for (i = 0; i < referredToCount; i++) {
  15482. let number;
  15483. if (referredToSegmentNumberSize === 1) {
  15484. number = data[position];
  15485. } else if (referredToSegmentNumberSize === 2) {
  15486. number = (0, _core_utils.readUint16)(data, position);
  15487. } else {
  15488. number = (0, _core_utils.readUint32)(data, position);
  15489. }
  15490. referredTo.push(number);
  15491. position += referredToSegmentNumberSize;
  15492. }
  15493. segmentHeader.referredTo = referredTo;
  15494. if (!pageAssociationFieldSize) {
  15495. segmentHeader.pageAssociation = data[position++];
  15496. } else {
  15497. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  15498. position += 4;
  15499. }
  15500. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  15501. position += 4;
  15502. if (segmentHeader.length === 0xffffffff) {
  15503. if (segmentType === 38) {
  15504. const genericRegionInfo = readRegionSegmentInformation(data, position);
  15505. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  15506. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  15507. const searchPatternLength = 6;
  15508. const searchPattern = new Uint8Array(searchPatternLength);
  15509. if (!genericRegionMmr) {
  15510. searchPattern[0] = 0xff;
  15511. searchPattern[1] = 0xac;
  15512. }
  15513. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  15514. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  15515. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  15516. searchPattern[5] = genericRegionInfo.height & 0xff;
  15517. for (i = position, ii = data.length; i < ii; i++) {
  15518. let j = 0;
  15519. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  15520. j++;
  15521. }
  15522. if (j === searchPatternLength) {
  15523. segmentHeader.length = i + searchPatternLength;
  15524. break;
  15525. }
  15526. }
  15527. if (segmentHeader.length === 0xffffffff) {
  15528. throw new Jbig2Error("segment end was not found");
  15529. }
  15530. } else {
  15531. throw new Jbig2Error("invalid unknown segment length");
  15532. }
  15533. }
  15534. segmentHeader.headerEnd = position;
  15535. return segmentHeader;
  15536. }
  15537. function readSegments(header, data, start, end) {
  15538. const segments = [];
  15539. let position = start;
  15540. while (position < end) {
  15541. const segmentHeader = readSegmentHeader(data, position);
  15542. position = segmentHeader.headerEnd;
  15543. const segment = {
  15544. header: segmentHeader,
  15545. data
  15546. };
  15547. if (!header.randomAccess) {
  15548. segment.start = position;
  15549. position += segmentHeader.length;
  15550. segment.end = position;
  15551. }
  15552. segments.push(segment);
  15553. if (segmentHeader.type === 51) {
  15554. break;
  15555. }
  15556. }
  15557. if (header.randomAccess) {
  15558. for (let i = 0, ii = segments.length; i < ii; i++) {
  15559. segments[i].start = position;
  15560. position += segments[i].header.length;
  15561. segments[i].end = position;
  15562. }
  15563. }
  15564. return segments;
  15565. }
  15566. function readRegionSegmentInformation(data, start) {
  15567. return {
  15568. width: (0, _core_utils.readUint32)(data, start),
  15569. height: (0, _core_utils.readUint32)(data, start + 4),
  15570. x: (0, _core_utils.readUint32)(data, start + 8),
  15571. y: (0, _core_utils.readUint32)(data, start + 12),
  15572. combinationOperator: data[start + 16] & 7
  15573. };
  15574. }
  15575. const RegionSegmentInformationFieldLength = 17;
  15576. function processSegment(segment, visitor) {
  15577. const header = segment.header;
  15578. const data = segment.data,
  15579. end = segment.end;
  15580. let position = segment.start;
  15581. let args, at, i, atLength;
  15582. switch (header.type) {
  15583. case 0:
  15584. const dictionary = {};
  15585. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  15586. dictionary.huffman = !!(dictionaryFlags & 1);
  15587. dictionary.refinement = !!(dictionaryFlags & 2);
  15588. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  15589. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  15590. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  15591. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  15592. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  15593. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  15594. dictionary.template = dictionaryFlags >> 10 & 3;
  15595. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  15596. position += 2;
  15597. if (!dictionary.huffman) {
  15598. atLength = dictionary.template === 0 ? 4 : 1;
  15599. at = [];
  15600. for (i = 0; i < atLength; i++) {
  15601. at.push({
  15602. x: (0, _core_utils.readInt8)(data, position),
  15603. y: (0, _core_utils.readInt8)(data, position + 1)
  15604. });
  15605. position += 2;
  15606. }
  15607. dictionary.at = at;
  15608. }
  15609. if (dictionary.refinement && !dictionary.refinementTemplate) {
  15610. at = [];
  15611. for (i = 0; i < 2; i++) {
  15612. at.push({
  15613. x: (0, _core_utils.readInt8)(data, position),
  15614. y: (0, _core_utils.readInt8)(data, position + 1)
  15615. });
  15616. position += 2;
  15617. }
  15618. dictionary.refinementAt = at;
  15619. }
  15620. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  15621. position += 4;
  15622. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  15623. position += 4;
  15624. args = [dictionary, header.number, header.referredTo, data, position, end];
  15625. break;
  15626. case 6:
  15627. case 7:
  15628. const textRegion = {};
  15629. textRegion.info = readRegionSegmentInformation(data, position);
  15630. position += RegionSegmentInformationFieldLength;
  15631. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  15632. position += 2;
  15633. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  15634. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  15635. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  15636. textRegion.stripSize = 1 << textRegion.logStripSize;
  15637. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  15638. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  15639. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  15640. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  15641. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  15642. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  15643. if (textRegion.huffman) {
  15644. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  15645. position += 2;
  15646. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  15647. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  15648. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  15649. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  15650. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  15651. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  15652. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  15653. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  15654. }
  15655. if (textRegion.refinement && !textRegion.refinementTemplate) {
  15656. at = [];
  15657. for (i = 0; i < 2; i++) {
  15658. at.push({
  15659. x: (0, _core_utils.readInt8)(data, position),
  15660. y: (0, _core_utils.readInt8)(data, position + 1)
  15661. });
  15662. position += 2;
  15663. }
  15664. textRegion.refinementAt = at;
  15665. }
  15666. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  15667. position += 4;
  15668. args = [textRegion, header.referredTo, data, position, end];
  15669. break;
  15670. case 16:
  15671. const patternDictionary = {};
  15672. const patternDictionaryFlags = data[position++];
  15673. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  15674. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  15675. patternDictionary.patternWidth = data[position++];
  15676. patternDictionary.patternHeight = data[position++];
  15677. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  15678. position += 4;
  15679. args = [patternDictionary, header.number, data, position, end];
  15680. break;
  15681. case 22:
  15682. case 23:
  15683. const halftoneRegion = {};
  15684. halftoneRegion.info = readRegionSegmentInformation(data, position);
  15685. position += RegionSegmentInformationFieldLength;
  15686. const halftoneRegionFlags = data[position++];
  15687. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  15688. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  15689. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  15690. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  15691. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  15692. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  15693. position += 4;
  15694. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  15695. position += 4;
  15696. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  15697. position += 4;
  15698. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  15699. position += 4;
  15700. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  15701. position += 2;
  15702. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  15703. position += 2;
  15704. args = [halftoneRegion, header.referredTo, data, position, end];
  15705. break;
  15706. case 38:
  15707. case 39:
  15708. const genericRegion = {};
  15709. genericRegion.info = readRegionSegmentInformation(data, position);
  15710. position += RegionSegmentInformationFieldLength;
  15711. const genericRegionSegmentFlags = data[position++];
  15712. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  15713. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  15714. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  15715. if (!genericRegion.mmr) {
  15716. atLength = genericRegion.template === 0 ? 4 : 1;
  15717. at = [];
  15718. for (i = 0; i < atLength; i++) {
  15719. at.push({
  15720. x: (0, _core_utils.readInt8)(data, position),
  15721. y: (0, _core_utils.readInt8)(data, position + 1)
  15722. });
  15723. position += 2;
  15724. }
  15725. genericRegion.at = at;
  15726. }
  15727. args = [genericRegion, data, position, end];
  15728. break;
  15729. case 48:
  15730. const pageInfo = {
  15731. width: (0, _core_utils.readUint32)(data, position),
  15732. height: (0, _core_utils.readUint32)(data, position + 4),
  15733. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  15734. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  15735. };
  15736. if (pageInfo.height === 0xffffffff) {
  15737. delete pageInfo.height;
  15738. }
  15739. const pageSegmentFlags = data[position + 16];
  15740. (0, _core_utils.readUint16)(data, position + 17);
  15741. pageInfo.lossless = !!(pageSegmentFlags & 1);
  15742. pageInfo.refinement = !!(pageSegmentFlags & 2);
  15743. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  15744. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  15745. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  15746. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  15747. args = [pageInfo];
  15748. break;
  15749. case 49:
  15750. break;
  15751. case 50:
  15752. break;
  15753. case 51:
  15754. break;
  15755. case 53:
  15756. args = [header.number, data, position, end];
  15757. break;
  15758. case 62:
  15759. break;
  15760. default:
  15761. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  15762. }
  15763. const callbackName = "on" + header.typeName;
  15764. if (callbackName in visitor) {
  15765. visitor[callbackName].apply(visitor, args);
  15766. }
  15767. }
  15768. function processSegments(segments, visitor) {
  15769. for (let i = 0, ii = segments.length; i < ii; i++) {
  15770. processSegment(segments[i], visitor);
  15771. }
  15772. }
  15773. function parseJbig2Chunks(chunks) {
  15774. const visitor = new SimpleSegmentVisitor();
  15775. for (let i = 0, ii = chunks.length; i < ii; i++) {
  15776. const chunk = chunks[i];
  15777. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  15778. processSegments(segments, visitor);
  15779. }
  15780. return visitor.buffer;
  15781. }
  15782. function parseJbig2(data) {
  15783. throw new Error("Not implemented: parseJbig2");
  15784. }
  15785. class SimpleSegmentVisitor {
  15786. onPageInformation(info) {
  15787. this.currentPageInfo = info;
  15788. const rowSize = info.width + 7 >> 3;
  15789. const buffer = new Uint8ClampedArray(rowSize * info.height);
  15790. if (info.defaultPixelValue) {
  15791. buffer.fill(0xff);
  15792. }
  15793. this.buffer = buffer;
  15794. }
  15795. drawBitmap(regionInfo, bitmap) {
  15796. const pageInfo = this.currentPageInfo;
  15797. const width = regionInfo.width,
  15798. height = regionInfo.height;
  15799. const rowSize = pageInfo.width + 7 >> 3;
  15800. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  15801. const buffer = this.buffer;
  15802. const mask0 = 128 >> (regionInfo.x & 7);
  15803. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  15804. let i, j, mask, offset;
  15805. switch (combinationOperator) {
  15806. case 0:
  15807. for (i = 0; i < height; i++) {
  15808. mask = mask0;
  15809. offset = offset0;
  15810. for (j = 0; j < width; j++) {
  15811. if (bitmap[i][j]) {
  15812. buffer[offset] |= mask;
  15813. }
  15814. mask >>= 1;
  15815. if (!mask) {
  15816. mask = 128;
  15817. offset++;
  15818. }
  15819. }
  15820. offset0 += rowSize;
  15821. }
  15822. break;
  15823. case 2:
  15824. for (i = 0; i < height; i++) {
  15825. mask = mask0;
  15826. offset = offset0;
  15827. for (j = 0; j < width; j++) {
  15828. if (bitmap[i][j]) {
  15829. buffer[offset] ^= mask;
  15830. }
  15831. mask >>= 1;
  15832. if (!mask) {
  15833. mask = 128;
  15834. offset++;
  15835. }
  15836. }
  15837. offset0 += rowSize;
  15838. }
  15839. break;
  15840. default:
  15841. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15842. }
  15843. }
  15844. onImmediateGenericRegion(region, data, start, end) {
  15845. const regionInfo = region.info;
  15846. const decodingContext = new DecodingContext(data, start, end);
  15847. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  15848. this.drawBitmap(regionInfo, bitmap);
  15849. }
  15850. onImmediateLosslessGenericRegion() {
  15851. this.onImmediateGenericRegion(...arguments);
  15852. }
  15853. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  15854. let huffmanTables, huffmanInput;
  15855. if (dictionary.huffman) {
  15856. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  15857. huffmanInput = new Reader(data, start, end);
  15858. }
  15859. let symbols = this.symbols;
  15860. if (!symbols) {
  15861. this.symbols = symbols = {};
  15862. }
  15863. const inputSymbols = [];
  15864. for (const referredSegment of referredSegments) {
  15865. const referredSymbols = symbols[referredSegment];
  15866. if (referredSymbols) {
  15867. inputSymbols.push(...referredSymbols);
  15868. }
  15869. }
  15870. const decodingContext = new DecodingContext(data, start, end);
  15871. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  15872. }
  15873. onImmediateTextRegion(region, referredSegments, data, start, end) {
  15874. const regionInfo = region.info;
  15875. let huffmanTables, huffmanInput;
  15876. const symbols = this.symbols;
  15877. const inputSymbols = [];
  15878. for (const referredSegment of referredSegments) {
  15879. const referredSymbols = symbols[referredSegment];
  15880. if (referredSymbols) {
  15881. inputSymbols.push(...referredSymbols);
  15882. }
  15883. }
  15884. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  15885. if (region.huffman) {
  15886. huffmanInput = new Reader(data, start, end);
  15887. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  15888. }
  15889. const decodingContext = new DecodingContext(data, start, end);
  15890. 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);
  15891. this.drawBitmap(regionInfo, bitmap);
  15892. }
  15893. onImmediateLosslessTextRegion() {
  15894. this.onImmediateTextRegion(...arguments);
  15895. }
  15896. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  15897. let patterns = this.patterns;
  15898. if (!patterns) {
  15899. this.patterns = patterns = {};
  15900. }
  15901. const decodingContext = new DecodingContext(data, start, end);
  15902. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  15903. }
  15904. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  15905. const patterns = this.patterns[referredSegments[0]];
  15906. const regionInfo = region.info;
  15907. const decodingContext = new DecodingContext(data, start, end);
  15908. 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);
  15909. this.drawBitmap(regionInfo, bitmap);
  15910. }
  15911. onImmediateLosslessHalftoneRegion() {
  15912. this.onImmediateHalftoneRegion(...arguments);
  15913. }
  15914. onTables(currentSegment, data, start, end) {
  15915. let customTables = this.customTables;
  15916. if (!customTables) {
  15917. this.customTables = customTables = {};
  15918. }
  15919. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  15920. }
  15921. }
  15922. class HuffmanLine {
  15923. constructor(lineData) {
  15924. if (lineData.length === 2) {
  15925. this.isOOB = true;
  15926. this.rangeLow = 0;
  15927. this.prefixLength = lineData[0];
  15928. this.rangeLength = 0;
  15929. this.prefixCode = lineData[1];
  15930. this.isLowerRange = false;
  15931. } else {
  15932. this.isOOB = false;
  15933. this.rangeLow = lineData[0];
  15934. this.prefixLength = lineData[1];
  15935. this.rangeLength = lineData[2];
  15936. this.prefixCode = lineData[3];
  15937. this.isLowerRange = lineData[4] === "lower";
  15938. }
  15939. }
  15940. }
  15941. class HuffmanTreeNode {
  15942. constructor(line) {
  15943. this.children = [];
  15944. if (line) {
  15945. this.isLeaf = true;
  15946. this.rangeLength = line.rangeLength;
  15947. this.rangeLow = line.rangeLow;
  15948. this.isLowerRange = line.isLowerRange;
  15949. this.isOOB = line.isOOB;
  15950. } else {
  15951. this.isLeaf = false;
  15952. }
  15953. }
  15954. buildTree(line, shift) {
  15955. const bit = line.prefixCode >> shift & 1;
  15956. if (shift <= 0) {
  15957. this.children[bit] = new HuffmanTreeNode(line);
  15958. } else {
  15959. let node = this.children[bit];
  15960. if (!node) {
  15961. this.children[bit] = node = new HuffmanTreeNode(null);
  15962. }
  15963. node.buildTree(line, shift - 1);
  15964. }
  15965. }
  15966. decodeNode(reader) {
  15967. if (this.isLeaf) {
  15968. if (this.isOOB) {
  15969. return null;
  15970. }
  15971. const htOffset = reader.readBits(this.rangeLength);
  15972. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  15973. }
  15974. const node = this.children[reader.readBit()];
  15975. if (!node) {
  15976. throw new Jbig2Error("invalid Huffman data");
  15977. }
  15978. return node.decodeNode(reader);
  15979. }
  15980. }
  15981. class HuffmanTable {
  15982. constructor(lines, prefixCodesDone) {
  15983. if (!prefixCodesDone) {
  15984. this.assignPrefixCodes(lines);
  15985. }
  15986. this.rootNode = new HuffmanTreeNode(null);
  15987. for (let i = 0, ii = lines.length; i < ii; i++) {
  15988. const line = lines[i];
  15989. if (line.prefixLength > 0) {
  15990. this.rootNode.buildTree(line, line.prefixLength - 1);
  15991. }
  15992. }
  15993. }
  15994. decode(reader) {
  15995. return this.rootNode.decodeNode(reader);
  15996. }
  15997. assignPrefixCodes(lines) {
  15998. const linesLength = lines.length;
  15999. let prefixLengthMax = 0;
  16000. for (let i = 0; i < linesLength; i++) {
  16001. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  16002. }
  16003. const histogram = new Uint32Array(prefixLengthMax + 1);
  16004. for (let i = 0; i < linesLength; i++) {
  16005. histogram[lines[i].prefixLength]++;
  16006. }
  16007. let currentLength = 1,
  16008. firstCode = 0,
  16009. currentCode,
  16010. currentTemp,
  16011. line;
  16012. histogram[0] = 0;
  16013. while (currentLength <= prefixLengthMax) {
  16014. firstCode = firstCode + histogram[currentLength - 1] << 1;
  16015. currentCode = firstCode;
  16016. currentTemp = 0;
  16017. while (currentTemp < linesLength) {
  16018. line = lines[currentTemp];
  16019. if (line.prefixLength === currentLength) {
  16020. line.prefixCode = currentCode;
  16021. currentCode++;
  16022. }
  16023. currentTemp++;
  16024. }
  16025. currentLength++;
  16026. }
  16027. }
  16028. }
  16029. function decodeTablesSegment(data, start, end) {
  16030. const flags = data[start];
  16031. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  16032. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  16033. const reader = new Reader(data, start + 9, end);
  16034. const prefixSizeBits = (flags >> 1 & 7) + 1;
  16035. const rangeSizeBits = (flags >> 4 & 7) + 1;
  16036. const lines = [];
  16037. let prefixLength,
  16038. rangeLength,
  16039. currentRangeLow = lowestValue;
  16040. do {
  16041. prefixLength = reader.readBits(prefixSizeBits);
  16042. rangeLength = reader.readBits(rangeSizeBits);
  16043. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  16044. currentRangeLow += 1 << rangeLength;
  16045. } while (currentRangeLow < highestValue);
  16046. prefixLength = reader.readBits(prefixSizeBits);
  16047. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  16048. prefixLength = reader.readBits(prefixSizeBits);
  16049. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  16050. if (flags & 1) {
  16051. prefixLength = reader.readBits(prefixSizeBits);
  16052. lines.push(new HuffmanLine([prefixLength, 0]));
  16053. }
  16054. return new HuffmanTable(lines, false);
  16055. }
  16056. const standardTablesCache = {};
  16057. function getStandardTable(number) {
  16058. let table = standardTablesCache[number];
  16059. if (table) {
  16060. return table;
  16061. }
  16062. let lines;
  16063. switch (number) {
  16064. case 1:
  16065. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  16066. break;
  16067. case 2:
  16068. 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]];
  16069. break;
  16070. case 3:
  16071. 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]];
  16072. break;
  16073. case 4:
  16074. 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]];
  16075. break;
  16076. case 5:
  16077. 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]];
  16078. break;
  16079. case 6:
  16080. 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]];
  16081. break;
  16082. case 7:
  16083. 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]];
  16084. break;
  16085. case 8:
  16086. 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]];
  16087. break;
  16088. case 9:
  16089. 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]];
  16090. break;
  16091. case 10:
  16092. 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]];
  16093. break;
  16094. case 11:
  16095. 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]];
  16096. break;
  16097. case 12:
  16098. 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]];
  16099. break;
  16100. case 13:
  16101. 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]];
  16102. break;
  16103. case 14:
  16104. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  16105. break;
  16106. case 15:
  16107. 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]];
  16108. break;
  16109. default:
  16110. throw new Jbig2Error(`standard table B.${number} does not exist`);
  16111. }
  16112. for (let i = 0, ii = lines.length; i < ii; i++) {
  16113. lines[i] = new HuffmanLine(lines[i]);
  16114. }
  16115. table = new HuffmanTable(lines, true);
  16116. standardTablesCache[number] = table;
  16117. return table;
  16118. }
  16119. class Reader {
  16120. constructor(data, start, end) {
  16121. this.data = data;
  16122. this.start = start;
  16123. this.end = end;
  16124. this.position = start;
  16125. this.shift = -1;
  16126. this.currentByte = 0;
  16127. }
  16128. readBit() {
  16129. if (this.shift < 0) {
  16130. if (this.position >= this.end) {
  16131. throw new Jbig2Error("end of data while reading bit");
  16132. }
  16133. this.currentByte = this.data[this.position++];
  16134. this.shift = 7;
  16135. }
  16136. const bit = this.currentByte >> this.shift & 1;
  16137. this.shift--;
  16138. return bit;
  16139. }
  16140. readBits(numBits) {
  16141. let result = 0,
  16142. i;
  16143. for (i = numBits - 1; i >= 0; i--) {
  16144. result |= this.readBit() << i;
  16145. }
  16146. return result;
  16147. }
  16148. byteAlign() {
  16149. this.shift = -1;
  16150. }
  16151. next() {
  16152. if (this.position >= this.end) {
  16153. return -1;
  16154. }
  16155. return this.data[this.position++];
  16156. }
  16157. }
  16158. function getCustomHuffmanTable(index, referredTo, customTables) {
  16159. let currentIndex = 0;
  16160. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  16161. const table = customTables[referredTo[i]];
  16162. if (table) {
  16163. if (index === currentIndex) {
  16164. return table;
  16165. }
  16166. currentIndex++;
  16167. }
  16168. }
  16169. throw new Jbig2Error("can't find custom Huffman table");
  16170. }
  16171. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  16172. const codes = [];
  16173. for (let i = 0; i <= 34; i++) {
  16174. const codeLength = reader.readBits(4);
  16175. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16176. }
  16177. const runCodesTable = new HuffmanTable(codes, false);
  16178. codes.length = 0;
  16179. for (let i = 0; i < numberOfSymbols;) {
  16180. const codeLength = runCodesTable.decode(reader);
  16181. if (codeLength >= 32) {
  16182. let repeatedLength, numberOfRepeats, j;
  16183. switch (codeLength) {
  16184. case 32:
  16185. if (i === 0) {
  16186. throw new Jbig2Error("no previous value in symbol ID table");
  16187. }
  16188. numberOfRepeats = reader.readBits(2) + 3;
  16189. repeatedLength = codes[i - 1].prefixLength;
  16190. break;
  16191. case 33:
  16192. numberOfRepeats = reader.readBits(3) + 3;
  16193. repeatedLength = 0;
  16194. break;
  16195. case 34:
  16196. numberOfRepeats = reader.readBits(7) + 11;
  16197. repeatedLength = 0;
  16198. break;
  16199. default:
  16200. throw new Jbig2Error("invalid code length in symbol ID table");
  16201. }
  16202. for (j = 0; j < numberOfRepeats; j++) {
  16203. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  16204. i++;
  16205. }
  16206. } else {
  16207. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16208. i++;
  16209. }
  16210. }
  16211. reader.byteAlign();
  16212. const symbolIDTable = new HuffmanTable(codes, false);
  16213. let customIndex = 0,
  16214. tableFirstS,
  16215. tableDeltaS,
  16216. tableDeltaT;
  16217. switch (textRegion.huffmanFS) {
  16218. case 0:
  16219. case 1:
  16220. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  16221. break;
  16222. case 3:
  16223. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16224. customIndex++;
  16225. break;
  16226. default:
  16227. throw new Jbig2Error("invalid Huffman FS selector");
  16228. }
  16229. switch (textRegion.huffmanDS) {
  16230. case 0:
  16231. case 1:
  16232. case 2:
  16233. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  16234. break;
  16235. case 3:
  16236. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16237. customIndex++;
  16238. break;
  16239. default:
  16240. throw new Jbig2Error("invalid Huffman DS selector");
  16241. }
  16242. switch (textRegion.huffmanDT) {
  16243. case 0:
  16244. case 1:
  16245. case 2:
  16246. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  16247. break;
  16248. case 3:
  16249. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16250. customIndex++;
  16251. break;
  16252. default:
  16253. throw new Jbig2Error("invalid Huffman DT selector");
  16254. }
  16255. if (textRegion.refinement) {
  16256. throw new Jbig2Error("refinement with Huffman is not supported");
  16257. }
  16258. return {
  16259. symbolIDTable,
  16260. tableFirstS,
  16261. tableDeltaS,
  16262. tableDeltaT
  16263. };
  16264. }
  16265. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  16266. let customIndex = 0,
  16267. tableDeltaHeight,
  16268. tableDeltaWidth;
  16269. switch (dictionary.huffmanDHSelector) {
  16270. case 0:
  16271. case 1:
  16272. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  16273. break;
  16274. case 3:
  16275. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16276. customIndex++;
  16277. break;
  16278. default:
  16279. throw new Jbig2Error("invalid Huffman DH selector");
  16280. }
  16281. switch (dictionary.huffmanDWSelector) {
  16282. case 0:
  16283. case 1:
  16284. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  16285. break;
  16286. case 3:
  16287. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16288. customIndex++;
  16289. break;
  16290. default:
  16291. throw new Jbig2Error("invalid Huffman DW selector");
  16292. }
  16293. let tableBitmapSize, tableAggregateInstances;
  16294. if (dictionary.bitmapSizeSelector) {
  16295. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16296. customIndex++;
  16297. } else {
  16298. tableBitmapSize = getStandardTable(1);
  16299. }
  16300. if (dictionary.aggregationInstancesSelector) {
  16301. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16302. } else {
  16303. tableAggregateInstances = getStandardTable(1);
  16304. }
  16305. return {
  16306. tableDeltaHeight,
  16307. tableDeltaWidth,
  16308. tableBitmapSize,
  16309. tableAggregateInstances
  16310. };
  16311. }
  16312. function readUncompressedBitmap(reader, width, height) {
  16313. const bitmap = [];
  16314. for (let y = 0; y < height; y++) {
  16315. const row = new Uint8Array(width);
  16316. bitmap.push(row);
  16317. for (let x = 0; x < width; x++) {
  16318. row[x] = reader.readBit();
  16319. }
  16320. reader.byteAlign();
  16321. }
  16322. return bitmap;
  16323. }
  16324. function decodeMMRBitmap(input, width, height, endOfBlock) {
  16325. const params = {
  16326. K: -1,
  16327. Columns: width,
  16328. Rows: height,
  16329. BlackIs1: true,
  16330. EndOfBlock: endOfBlock
  16331. };
  16332. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  16333. const bitmap = [];
  16334. let currentByte,
  16335. eof = false;
  16336. for (let y = 0; y < height; y++) {
  16337. const row = new Uint8Array(width);
  16338. bitmap.push(row);
  16339. let shift = -1;
  16340. for (let x = 0; x < width; x++) {
  16341. if (shift < 0) {
  16342. currentByte = decoder.readNextChar();
  16343. if (currentByte === -1) {
  16344. currentByte = 0;
  16345. eof = true;
  16346. }
  16347. shift = 7;
  16348. }
  16349. row[x] = currentByte >> shift & 1;
  16350. shift--;
  16351. }
  16352. }
  16353. if (endOfBlock && !eof) {
  16354. const lookForEOFLimit = 5;
  16355. for (let i = 0; i < lookForEOFLimit; i++) {
  16356. if (decoder.readNextChar() === -1) {
  16357. break;
  16358. }
  16359. }
  16360. }
  16361. return bitmap;
  16362. }
  16363. class Jbig2Image {
  16364. parseChunks(chunks) {
  16365. return parseJbig2Chunks(chunks);
  16366. }
  16367. parse(data) {
  16368. throw new Error("Not implemented: Jbig2Image.parse");
  16369. }
  16370. }
  16371. exports.Jbig2Image = Jbig2Image;
  16372. /***/ }),
  16373. /* 24 */
  16374. /***/ ((__unused_webpack_module, exports) => {
  16375. Object.defineProperty(exports, "__esModule", ({
  16376. value: true
  16377. }));
  16378. exports.ArithmeticDecoder = void 0;
  16379. const QeTable = [{
  16380. qe: 0x5601,
  16381. nmps: 1,
  16382. nlps: 1,
  16383. switchFlag: 1
  16384. }, {
  16385. qe: 0x3401,
  16386. nmps: 2,
  16387. nlps: 6,
  16388. switchFlag: 0
  16389. }, {
  16390. qe: 0x1801,
  16391. nmps: 3,
  16392. nlps: 9,
  16393. switchFlag: 0
  16394. }, {
  16395. qe: 0x0ac1,
  16396. nmps: 4,
  16397. nlps: 12,
  16398. switchFlag: 0
  16399. }, {
  16400. qe: 0x0521,
  16401. nmps: 5,
  16402. nlps: 29,
  16403. switchFlag: 0
  16404. }, {
  16405. qe: 0x0221,
  16406. nmps: 38,
  16407. nlps: 33,
  16408. switchFlag: 0
  16409. }, {
  16410. qe: 0x5601,
  16411. nmps: 7,
  16412. nlps: 6,
  16413. switchFlag: 1
  16414. }, {
  16415. qe: 0x5401,
  16416. nmps: 8,
  16417. nlps: 14,
  16418. switchFlag: 0
  16419. }, {
  16420. qe: 0x4801,
  16421. nmps: 9,
  16422. nlps: 14,
  16423. switchFlag: 0
  16424. }, {
  16425. qe: 0x3801,
  16426. nmps: 10,
  16427. nlps: 14,
  16428. switchFlag: 0
  16429. }, {
  16430. qe: 0x3001,
  16431. nmps: 11,
  16432. nlps: 17,
  16433. switchFlag: 0
  16434. }, {
  16435. qe: 0x2401,
  16436. nmps: 12,
  16437. nlps: 18,
  16438. switchFlag: 0
  16439. }, {
  16440. qe: 0x1c01,
  16441. nmps: 13,
  16442. nlps: 20,
  16443. switchFlag: 0
  16444. }, {
  16445. qe: 0x1601,
  16446. nmps: 29,
  16447. nlps: 21,
  16448. switchFlag: 0
  16449. }, {
  16450. qe: 0x5601,
  16451. nmps: 15,
  16452. nlps: 14,
  16453. switchFlag: 1
  16454. }, {
  16455. qe: 0x5401,
  16456. nmps: 16,
  16457. nlps: 14,
  16458. switchFlag: 0
  16459. }, {
  16460. qe: 0x5101,
  16461. nmps: 17,
  16462. nlps: 15,
  16463. switchFlag: 0
  16464. }, {
  16465. qe: 0x4801,
  16466. nmps: 18,
  16467. nlps: 16,
  16468. switchFlag: 0
  16469. }, {
  16470. qe: 0x3801,
  16471. nmps: 19,
  16472. nlps: 17,
  16473. switchFlag: 0
  16474. }, {
  16475. qe: 0x3401,
  16476. nmps: 20,
  16477. nlps: 18,
  16478. switchFlag: 0
  16479. }, {
  16480. qe: 0x3001,
  16481. nmps: 21,
  16482. nlps: 19,
  16483. switchFlag: 0
  16484. }, {
  16485. qe: 0x2801,
  16486. nmps: 22,
  16487. nlps: 19,
  16488. switchFlag: 0
  16489. }, {
  16490. qe: 0x2401,
  16491. nmps: 23,
  16492. nlps: 20,
  16493. switchFlag: 0
  16494. }, {
  16495. qe: 0x2201,
  16496. nmps: 24,
  16497. nlps: 21,
  16498. switchFlag: 0
  16499. }, {
  16500. qe: 0x1c01,
  16501. nmps: 25,
  16502. nlps: 22,
  16503. switchFlag: 0
  16504. }, {
  16505. qe: 0x1801,
  16506. nmps: 26,
  16507. nlps: 23,
  16508. switchFlag: 0
  16509. }, {
  16510. qe: 0x1601,
  16511. nmps: 27,
  16512. nlps: 24,
  16513. switchFlag: 0
  16514. }, {
  16515. qe: 0x1401,
  16516. nmps: 28,
  16517. nlps: 25,
  16518. switchFlag: 0
  16519. }, {
  16520. qe: 0x1201,
  16521. nmps: 29,
  16522. nlps: 26,
  16523. switchFlag: 0
  16524. }, {
  16525. qe: 0x1101,
  16526. nmps: 30,
  16527. nlps: 27,
  16528. switchFlag: 0
  16529. }, {
  16530. qe: 0x0ac1,
  16531. nmps: 31,
  16532. nlps: 28,
  16533. switchFlag: 0
  16534. }, {
  16535. qe: 0x09c1,
  16536. nmps: 32,
  16537. nlps: 29,
  16538. switchFlag: 0
  16539. }, {
  16540. qe: 0x08a1,
  16541. nmps: 33,
  16542. nlps: 30,
  16543. switchFlag: 0
  16544. }, {
  16545. qe: 0x0521,
  16546. nmps: 34,
  16547. nlps: 31,
  16548. switchFlag: 0
  16549. }, {
  16550. qe: 0x0441,
  16551. nmps: 35,
  16552. nlps: 32,
  16553. switchFlag: 0
  16554. }, {
  16555. qe: 0x02a1,
  16556. nmps: 36,
  16557. nlps: 33,
  16558. switchFlag: 0
  16559. }, {
  16560. qe: 0x0221,
  16561. nmps: 37,
  16562. nlps: 34,
  16563. switchFlag: 0
  16564. }, {
  16565. qe: 0x0141,
  16566. nmps: 38,
  16567. nlps: 35,
  16568. switchFlag: 0
  16569. }, {
  16570. qe: 0x0111,
  16571. nmps: 39,
  16572. nlps: 36,
  16573. switchFlag: 0
  16574. }, {
  16575. qe: 0x0085,
  16576. nmps: 40,
  16577. nlps: 37,
  16578. switchFlag: 0
  16579. }, {
  16580. qe: 0x0049,
  16581. nmps: 41,
  16582. nlps: 38,
  16583. switchFlag: 0
  16584. }, {
  16585. qe: 0x0025,
  16586. nmps: 42,
  16587. nlps: 39,
  16588. switchFlag: 0
  16589. }, {
  16590. qe: 0x0015,
  16591. nmps: 43,
  16592. nlps: 40,
  16593. switchFlag: 0
  16594. }, {
  16595. qe: 0x0009,
  16596. nmps: 44,
  16597. nlps: 41,
  16598. switchFlag: 0
  16599. }, {
  16600. qe: 0x0005,
  16601. nmps: 45,
  16602. nlps: 42,
  16603. switchFlag: 0
  16604. }, {
  16605. qe: 0x0001,
  16606. nmps: 45,
  16607. nlps: 43,
  16608. switchFlag: 0
  16609. }, {
  16610. qe: 0x5601,
  16611. nmps: 46,
  16612. nlps: 46,
  16613. switchFlag: 0
  16614. }];
  16615. class ArithmeticDecoder {
  16616. constructor(data, start, end) {
  16617. this.data = data;
  16618. this.bp = start;
  16619. this.dataEnd = end;
  16620. this.chigh = data[start];
  16621. this.clow = 0;
  16622. this.byteIn();
  16623. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  16624. this.clow = this.clow << 7 & 0xffff;
  16625. this.ct -= 7;
  16626. this.a = 0x8000;
  16627. }
  16628. byteIn() {
  16629. const data = this.data;
  16630. let bp = this.bp;
  16631. if (data[bp] === 0xff) {
  16632. if (data[bp + 1] > 0x8f) {
  16633. this.clow += 0xff00;
  16634. this.ct = 8;
  16635. } else {
  16636. bp++;
  16637. this.clow += data[bp] << 9;
  16638. this.ct = 7;
  16639. this.bp = bp;
  16640. }
  16641. } else {
  16642. bp++;
  16643. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  16644. this.ct = 8;
  16645. this.bp = bp;
  16646. }
  16647. if (this.clow > 0xffff) {
  16648. this.chigh += this.clow >> 16;
  16649. this.clow &= 0xffff;
  16650. }
  16651. }
  16652. readBit(contexts, pos) {
  16653. let cx_index = contexts[pos] >> 1,
  16654. cx_mps = contexts[pos] & 1;
  16655. const qeTableIcx = QeTable[cx_index];
  16656. const qeIcx = qeTableIcx.qe;
  16657. let d;
  16658. let a = this.a - qeIcx;
  16659. if (this.chigh < qeIcx) {
  16660. if (a < qeIcx) {
  16661. a = qeIcx;
  16662. d = cx_mps;
  16663. cx_index = qeTableIcx.nmps;
  16664. } else {
  16665. a = qeIcx;
  16666. d = 1 ^ cx_mps;
  16667. if (qeTableIcx.switchFlag === 1) {
  16668. cx_mps = d;
  16669. }
  16670. cx_index = qeTableIcx.nlps;
  16671. }
  16672. } else {
  16673. this.chigh -= qeIcx;
  16674. if ((a & 0x8000) !== 0) {
  16675. this.a = a;
  16676. return cx_mps;
  16677. }
  16678. if (a < qeIcx) {
  16679. d = 1 ^ cx_mps;
  16680. if (qeTableIcx.switchFlag === 1) {
  16681. cx_mps = d;
  16682. }
  16683. cx_index = qeTableIcx.nlps;
  16684. } else {
  16685. d = cx_mps;
  16686. cx_index = qeTableIcx.nmps;
  16687. }
  16688. }
  16689. do {
  16690. if (this.ct === 0) {
  16691. this.byteIn();
  16692. }
  16693. a <<= 1;
  16694. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  16695. this.clow = this.clow << 1 & 0xffff;
  16696. this.ct--;
  16697. } while ((a & 0x8000) === 0);
  16698. this.a = a;
  16699. contexts[pos] = cx_index << 1 | cx_mps;
  16700. return d;
  16701. }
  16702. }
  16703. exports.ArithmeticDecoder = ArithmeticDecoder;
  16704. /***/ }),
  16705. /* 25 */
  16706. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16707. Object.defineProperty(exports, "__esModule", ({
  16708. value: true
  16709. }));
  16710. exports.JpegStream = void 0;
  16711. var _decode_stream = __w_pdfjs_require__(17);
  16712. var _primitives = __w_pdfjs_require__(3);
  16713. var _jpg = __w_pdfjs_require__(26);
  16714. var _util = __w_pdfjs_require__(2);
  16715. class JpegStream extends _decode_stream.DecodeStream {
  16716. constructor(stream, maybeLength, params) {
  16717. let ch;
  16718. while ((ch = stream.getByte()) !== -1) {
  16719. if (ch === 0xff) {
  16720. stream.skip(-1);
  16721. break;
  16722. }
  16723. }
  16724. super(maybeLength);
  16725. this.stream = stream;
  16726. this.dict = stream.dict;
  16727. this.maybeLength = maybeLength;
  16728. this.params = params;
  16729. }
  16730. get bytes() {
  16731. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  16732. }
  16733. ensureBuffer(requested) {}
  16734. readBlock() {
  16735. if (this.eof) {
  16736. return;
  16737. }
  16738. const jpegOptions = {
  16739. decodeTransform: undefined,
  16740. colorTransform: undefined
  16741. };
  16742. const decodeArr = this.dict.getArray("D", "Decode");
  16743. if (this.forceRGB && Array.isArray(decodeArr)) {
  16744. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  16745. const decodeArrLength = decodeArr.length;
  16746. const transform = new Int32Array(decodeArrLength);
  16747. let transformNeeded = false;
  16748. const maxValue = (1 << bitsPerComponent) - 1;
  16749. for (let i = 0; i < decodeArrLength; i += 2) {
  16750. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  16751. transform[i + 1] = decodeArr[i] * maxValue | 0;
  16752. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  16753. transformNeeded = true;
  16754. }
  16755. }
  16756. if (transformNeeded) {
  16757. jpegOptions.decodeTransform = transform;
  16758. }
  16759. }
  16760. if (this.params instanceof _primitives.Dict) {
  16761. const colorTransform = this.params.get("ColorTransform");
  16762. if (Number.isInteger(colorTransform)) {
  16763. jpegOptions.colorTransform = colorTransform;
  16764. }
  16765. }
  16766. const jpegImage = new _jpg.JpegImage(jpegOptions);
  16767. jpegImage.parse(this.bytes);
  16768. const data = jpegImage.getData({
  16769. width: this.drawWidth,
  16770. height: this.drawHeight,
  16771. forceRGB: this.forceRGB,
  16772. isSourcePDF: true
  16773. });
  16774. this.buffer = data;
  16775. this.bufferLength = data.length;
  16776. this.eof = true;
  16777. }
  16778. }
  16779. exports.JpegStream = JpegStream;
  16780. /***/ }),
  16781. /* 26 */
  16782. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16783. Object.defineProperty(exports, "__esModule", ({
  16784. value: true
  16785. }));
  16786. exports.JpegImage = void 0;
  16787. var _util = __w_pdfjs_require__(2);
  16788. var _core_utils = __w_pdfjs_require__(4);
  16789. class JpegError extends _util.BaseException {
  16790. constructor(msg) {
  16791. super(`JPEG error: ${msg}`, "JpegError");
  16792. }
  16793. }
  16794. class DNLMarkerError extends _util.BaseException {
  16795. constructor(message, scanLines) {
  16796. super(message, "DNLMarkerError");
  16797. this.scanLines = scanLines;
  16798. }
  16799. }
  16800. class EOIMarkerError extends _util.BaseException {
  16801. constructor(msg) {
  16802. super(msg, "EOIMarkerError");
  16803. }
  16804. }
  16805. 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]);
  16806. const dctCos1 = 4017;
  16807. const dctSin1 = 799;
  16808. const dctCos3 = 3406;
  16809. const dctSin3 = 2276;
  16810. const dctCos6 = 1567;
  16811. const dctSin6 = 3784;
  16812. const dctSqrt2 = 5793;
  16813. const dctSqrt1d2 = 2896;
  16814. function buildHuffmanTable(codeLengths, values) {
  16815. let k = 0,
  16816. i,
  16817. j,
  16818. length = 16;
  16819. while (length > 0 && !codeLengths[length - 1]) {
  16820. length--;
  16821. }
  16822. const code = [{
  16823. children: [],
  16824. index: 0
  16825. }];
  16826. let p = code[0],
  16827. q;
  16828. for (i = 0; i < length; i++) {
  16829. for (j = 0; j < codeLengths[i]; j++) {
  16830. p = code.pop();
  16831. p.children[p.index] = values[k];
  16832. while (p.index > 0) {
  16833. p = code.pop();
  16834. }
  16835. p.index++;
  16836. code.push(p);
  16837. while (code.length <= i) {
  16838. code.push(q = {
  16839. children: [],
  16840. index: 0
  16841. });
  16842. p.children[p.index] = q.children;
  16843. p = q;
  16844. }
  16845. k++;
  16846. }
  16847. if (i + 1 < length) {
  16848. code.push(q = {
  16849. children: [],
  16850. index: 0
  16851. });
  16852. p.children[p.index] = q.children;
  16853. p = q;
  16854. }
  16855. }
  16856. return code[0].children;
  16857. }
  16858. function getBlockBufferOffset(component, row, col) {
  16859. return 64 * ((component.blocksPerLine + 1) * row + col);
  16860. }
  16861. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  16862. const mcusPerLine = frame.mcusPerLine;
  16863. const progressive = frame.progressive;
  16864. const startOffset = offset;
  16865. let bitsData = 0,
  16866. bitsCount = 0;
  16867. function readBit() {
  16868. if (bitsCount > 0) {
  16869. bitsCount--;
  16870. return bitsData >> bitsCount & 1;
  16871. }
  16872. bitsData = data[offset++];
  16873. if (bitsData === 0xff) {
  16874. const nextByte = data[offset++];
  16875. if (nextByte) {
  16876. if (nextByte === 0xdc && parseDNLMarker) {
  16877. offset += 2;
  16878. const scanLines = (0, _core_utils.readUint16)(data, offset);
  16879. offset += 2;
  16880. if (scanLines > 0 && scanLines !== frame.scanLines) {
  16881. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  16882. }
  16883. } else if (nextByte === 0xd9) {
  16884. if (parseDNLMarker) {
  16885. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  16886. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  16887. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  16888. }
  16889. }
  16890. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  16891. }
  16892. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  16893. }
  16894. }
  16895. bitsCount = 7;
  16896. return bitsData >>> 7;
  16897. }
  16898. function decodeHuffman(tree) {
  16899. let node = tree;
  16900. while (true) {
  16901. node = node[readBit()];
  16902. switch (typeof node) {
  16903. case "number":
  16904. return node;
  16905. case "object":
  16906. continue;
  16907. }
  16908. throw new JpegError("invalid huffman sequence");
  16909. }
  16910. }
  16911. function receive(length) {
  16912. let n = 0;
  16913. while (length > 0) {
  16914. n = n << 1 | readBit();
  16915. length--;
  16916. }
  16917. return n;
  16918. }
  16919. function receiveAndExtend(length) {
  16920. if (length === 1) {
  16921. return readBit() === 1 ? 1 : -1;
  16922. }
  16923. const n = receive(length);
  16924. if (n >= 1 << length - 1) {
  16925. return n;
  16926. }
  16927. return n + (-1 << length) + 1;
  16928. }
  16929. function decodeBaseline(component, blockOffset) {
  16930. const t = decodeHuffman(component.huffmanTableDC);
  16931. const diff = t === 0 ? 0 : receiveAndExtend(t);
  16932. component.blockData[blockOffset] = component.pred += diff;
  16933. let k = 1;
  16934. while (k < 64) {
  16935. const rs = decodeHuffman(component.huffmanTableAC);
  16936. const s = rs & 15,
  16937. r = rs >> 4;
  16938. if (s === 0) {
  16939. if (r < 15) {
  16940. break;
  16941. }
  16942. k += 16;
  16943. continue;
  16944. }
  16945. k += r;
  16946. const z = dctZigZag[k];
  16947. component.blockData[blockOffset + z] = receiveAndExtend(s);
  16948. k++;
  16949. }
  16950. }
  16951. function decodeDCFirst(component, blockOffset) {
  16952. const t = decodeHuffman(component.huffmanTableDC);
  16953. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  16954. component.blockData[blockOffset] = component.pred += diff;
  16955. }
  16956. function decodeDCSuccessive(component, blockOffset) {
  16957. component.blockData[blockOffset] |= readBit() << successive;
  16958. }
  16959. let eobrun = 0;
  16960. function decodeACFirst(component, blockOffset) {
  16961. if (eobrun > 0) {
  16962. eobrun--;
  16963. return;
  16964. }
  16965. let k = spectralStart;
  16966. const e = spectralEnd;
  16967. while (k <= e) {
  16968. const rs = decodeHuffman(component.huffmanTableAC);
  16969. const s = rs & 15,
  16970. r = rs >> 4;
  16971. if (s === 0) {
  16972. if (r < 15) {
  16973. eobrun = receive(r) + (1 << r) - 1;
  16974. break;
  16975. }
  16976. k += 16;
  16977. continue;
  16978. }
  16979. k += r;
  16980. const z = dctZigZag[k];
  16981. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  16982. k++;
  16983. }
  16984. }
  16985. let successiveACState = 0,
  16986. successiveACNextValue;
  16987. function decodeACSuccessive(component, blockOffset) {
  16988. let k = spectralStart;
  16989. const e = spectralEnd;
  16990. let r = 0;
  16991. let s;
  16992. let rs;
  16993. while (k <= e) {
  16994. const offsetZ = blockOffset + dctZigZag[k];
  16995. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  16996. switch (successiveACState) {
  16997. case 0:
  16998. rs = decodeHuffman(component.huffmanTableAC);
  16999. s = rs & 15;
  17000. r = rs >> 4;
  17001. if (s === 0) {
  17002. if (r < 15) {
  17003. eobrun = receive(r) + (1 << r);
  17004. successiveACState = 4;
  17005. } else {
  17006. r = 16;
  17007. successiveACState = 1;
  17008. }
  17009. } else {
  17010. if (s !== 1) {
  17011. throw new JpegError("invalid ACn encoding");
  17012. }
  17013. successiveACNextValue = receiveAndExtend(s);
  17014. successiveACState = r ? 2 : 3;
  17015. }
  17016. continue;
  17017. case 1:
  17018. case 2:
  17019. if (component.blockData[offsetZ]) {
  17020. component.blockData[offsetZ] += sign * (readBit() << successive);
  17021. } else {
  17022. r--;
  17023. if (r === 0) {
  17024. successiveACState = successiveACState === 2 ? 3 : 0;
  17025. }
  17026. }
  17027. break;
  17028. case 3:
  17029. if (component.blockData[offsetZ]) {
  17030. component.blockData[offsetZ] += sign * (readBit() << successive);
  17031. } else {
  17032. component.blockData[offsetZ] = successiveACNextValue << successive;
  17033. successiveACState = 0;
  17034. }
  17035. break;
  17036. case 4:
  17037. if (component.blockData[offsetZ]) {
  17038. component.blockData[offsetZ] += sign * (readBit() << successive);
  17039. }
  17040. break;
  17041. }
  17042. k++;
  17043. }
  17044. if (successiveACState === 4) {
  17045. eobrun--;
  17046. if (eobrun === 0) {
  17047. successiveACState = 0;
  17048. }
  17049. }
  17050. }
  17051. let blockRow = 0;
  17052. function decodeMcu(component, decode, mcu, row, col) {
  17053. const mcuRow = mcu / mcusPerLine | 0;
  17054. const mcuCol = mcu % mcusPerLine;
  17055. blockRow = mcuRow * component.v + row;
  17056. const blockCol = mcuCol * component.h + col;
  17057. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17058. decode(component, blockOffset);
  17059. }
  17060. function decodeBlock(component, decode, mcu) {
  17061. blockRow = mcu / component.blocksPerLine | 0;
  17062. const blockCol = mcu % component.blocksPerLine;
  17063. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17064. decode(component, blockOffset);
  17065. }
  17066. const componentsLength = components.length;
  17067. let component, i, j, k, n;
  17068. let decodeFn;
  17069. if (progressive) {
  17070. if (spectralStart === 0) {
  17071. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  17072. } else {
  17073. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  17074. }
  17075. } else {
  17076. decodeFn = decodeBaseline;
  17077. }
  17078. let mcu = 0,
  17079. fileMarker;
  17080. let mcuExpected;
  17081. if (componentsLength === 1) {
  17082. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  17083. } else {
  17084. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  17085. }
  17086. let h, v;
  17087. while (mcu <= mcuExpected) {
  17088. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  17089. if (mcuToRead > 0) {
  17090. for (i = 0; i < componentsLength; i++) {
  17091. components[i].pred = 0;
  17092. }
  17093. eobrun = 0;
  17094. if (componentsLength === 1) {
  17095. component = components[0];
  17096. for (n = 0; n < mcuToRead; n++) {
  17097. decodeBlock(component, decodeFn, mcu);
  17098. mcu++;
  17099. }
  17100. } else {
  17101. for (n = 0; n < mcuToRead; n++) {
  17102. for (i = 0; i < componentsLength; i++) {
  17103. component = components[i];
  17104. h = component.h;
  17105. v = component.v;
  17106. for (j = 0; j < v; j++) {
  17107. for (k = 0; k < h; k++) {
  17108. decodeMcu(component, decodeFn, mcu, j, k);
  17109. }
  17110. }
  17111. }
  17112. mcu++;
  17113. }
  17114. }
  17115. }
  17116. bitsCount = 0;
  17117. fileMarker = findNextFileMarker(data, offset);
  17118. if (!fileMarker) {
  17119. break;
  17120. }
  17121. if (fileMarker.invalid) {
  17122. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  17123. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  17124. offset = fileMarker.offset;
  17125. }
  17126. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  17127. offset += 2;
  17128. } else {
  17129. break;
  17130. }
  17131. }
  17132. return offset - startOffset;
  17133. }
  17134. function quantizeAndInverse(component, blockBufferOffset, p) {
  17135. const qt = component.quantizationTable,
  17136. blockData = component.blockData;
  17137. let v0, v1, v2, v3, v4, v5, v6, v7;
  17138. let p0, p1, p2, p3, p4, p5, p6, p7;
  17139. let t;
  17140. if (!qt) {
  17141. throw new JpegError("missing required Quantization Table.");
  17142. }
  17143. for (let row = 0; row < 64; row += 8) {
  17144. p0 = blockData[blockBufferOffset + row];
  17145. p1 = blockData[blockBufferOffset + row + 1];
  17146. p2 = blockData[blockBufferOffset + row + 2];
  17147. p3 = blockData[blockBufferOffset + row + 3];
  17148. p4 = blockData[blockBufferOffset + row + 4];
  17149. p5 = blockData[blockBufferOffset + row + 5];
  17150. p6 = blockData[blockBufferOffset + row + 6];
  17151. p7 = blockData[blockBufferOffset + row + 7];
  17152. p0 *= qt[row];
  17153. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17154. t = dctSqrt2 * p0 + 512 >> 10;
  17155. p[row] = t;
  17156. p[row + 1] = t;
  17157. p[row + 2] = t;
  17158. p[row + 3] = t;
  17159. p[row + 4] = t;
  17160. p[row + 5] = t;
  17161. p[row + 6] = t;
  17162. p[row + 7] = t;
  17163. continue;
  17164. }
  17165. p1 *= qt[row + 1];
  17166. p2 *= qt[row + 2];
  17167. p3 *= qt[row + 3];
  17168. p4 *= qt[row + 4];
  17169. p5 *= qt[row + 5];
  17170. p6 *= qt[row + 6];
  17171. p7 *= qt[row + 7];
  17172. v0 = dctSqrt2 * p0 + 128 >> 8;
  17173. v1 = dctSqrt2 * p4 + 128 >> 8;
  17174. v2 = p2;
  17175. v3 = p6;
  17176. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  17177. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  17178. v5 = p3 << 4;
  17179. v6 = p5 << 4;
  17180. v0 = v0 + v1 + 1 >> 1;
  17181. v1 = v0 - v1;
  17182. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  17183. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  17184. v3 = t;
  17185. v4 = v4 + v6 + 1 >> 1;
  17186. v6 = v4 - v6;
  17187. v7 = v7 + v5 + 1 >> 1;
  17188. v5 = v7 - v5;
  17189. v0 = v0 + v3 + 1 >> 1;
  17190. v3 = v0 - v3;
  17191. v1 = v1 + v2 + 1 >> 1;
  17192. v2 = v1 - v2;
  17193. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17194. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17195. v7 = t;
  17196. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17197. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17198. v6 = t;
  17199. p[row] = v0 + v7;
  17200. p[row + 7] = v0 - v7;
  17201. p[row + 1] = v1 + v6;
  17202. p[row + 6] = v1 - v6;
  17203. p[row + 2] = v2 + v5;
  17204. p[row + 5] = v2 - v5;
  17205. p[row + 3] = v3 + v4;
  17206. p[row + 4] = v3 - v4;
  17207. }
  17208. for (let col = 0; col < 8; ++col) {
  17209. p0 = p[col];
  17210. p1 = p[col + 8];
  17211. p2 = p[col + 16];
  17212. p3 = p[col + 24];
  17213. p4 = p[col + 32];
  17214. p5 = p[col + 40];
  17215. p6 = p[col + 48];
  17216. p7 = p[col + 56];
  17217. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17218. t = dctSqrt2 * p0 + 8192 >> 14;
  17219. if (t < -2040) {
  17220. t = 0;
  17221. } else if (t >= 2024) {
  17222. t = 255;
  17223. } else {
  17224. t = t + 2056 >> 4;
  17225. }
  17226. blockData[blockBufferOffset + col] = t;
  17227. blockData[blockBufferOffset + col + 8] = t;
  17228. blockData[blockBufferOffset + col + 16] = t;
  17229. blockData[blockBufferOffset + col + 24] = t;
  17230. blockData[blockBufferOffset + col + 32] = t;
  17231. blockData[blockBufferOffset + col + 40] = t;
  17232. blockData[blockBufferOffset + col + 48] = t;
  17233. blockData[blockBufferOffset + col + 56] = t;
  17234. continue;
  17235. }
  17236. v0 = dctSqrt2 * p0 + 2048 >> 12;
  17237. v1 = dctSqrt2 * p4 + 2048 >> 12;
  17238. v2 = p2;
  17239. v3 = p6;
  17240. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  17241. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  17242. v5 = p3;
  17243. v6 = p5;
  17244. v0 = (v0 + v1 + 1 >> 1) + 4112;
  17245. v1 = v0 - v1;
  17246. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  17247. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  17248. v3 = t;
  17249. v4 = v4 + v6 + 1 >> 1;
  17250. v6 = v4 - v6;
  17251. v7 = v7 + v5 + 1 >> 1;
  17252. v5 = v7 - v5;
  17253. v0 = v0 + v3 + 1 >> 1;
  17254. v3 = v0 - v3;
  17255. v1 = v1 + v2 + 1 >> 1;
  17256. v2 = v1 - v2;
  17257. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17258. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17259. v7 = t;
  17260. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17261. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17262. v6 = t;
  17263. p0 = v0 + v7;
  17264. p7 = v0 - v7;
  17265. p1 = v1 + v6;
  17266. p6 = v1 - v6;
  17267. p2 = v2 + v5;
  17268. p5 = v2 - v5;
  17269. p3 = v3 + v4;
  17270. p4 = v3 - v4;
  17271. if (p0 < 16) {
  17272. p0 = 0;
  17273. } else if (p0 >= 4080) {
  17274. p0 = 255;
  17275. } else {
  17276. p0 >>= 4;
  17277. }
  17278. if (p1 < 16) {
  17279. p1 = 0;
  17280. } else if (p1 >= 4080) {
  17281. p1 = 255;
  17282. } else {
  17283. p1 >>= 4;
  17284. }
  17285. if (p2 < 16) {
  17286. p2 = 0;
  17287. } else if (p2 >= 4080) {
  17288. p2 = 255;
  17289. } else {
  17290. p2 >>= 4;
  17291. }
  17292. if (p3 < 16) {
  17293. p3 = 0;
  17294. } else if (p3 >= 4080) {
  17295. p3 = 255;
  17296. } else {
  17297. p3 >>= 4;
  17298. }
  17299. if (p4 < 16) {
  17300. p4 = 0;
  17301. } else if (p4 >= 4080) {
  17302. p4 = 255;
  17303. } else {
  17304. p4 >>= 4;
  17305. }
  17306. if (p5 < 16) {
  17307. p5 = 0;
  17308. } else if (p5 >= 4080) {
  17309. p5 = 255;
  17310. } else {
  17311. p5 >>= 4;
  17312. }
  17313. if (p6 < 16) {
  17314. p6 = 0;
  17315. } else if (p6 >= 4080) {
  17316. p6 = 255;
  17317. } else {
  17318. p6 >>= 4;
  17319. }
  17320. if (p7 < 16) {
  17321. p7 = 0;
  17322. } else if (p7 >= 4080) {
  17323. p7 = 255;
  17324. } else {
  17325. p7 >>= 4;
  17326. }
  17327. blockData[blockBufferOffset + col] = p0;
  17328. blockData[blockBufferOffset + col + 8] = p1;
  17329. blockData[blockBufferOffset + col + 16] = p2;
  17330. blockData[blockBufferOffset + col + 24] = p3;
  17331. blockData[blockBufferOffset + col + 32] = p4;
  17332. blockData[blockBufferOffset + col + 40] = p5;
  17333. blockData[blockBufferOffset + col + 48] = p6;
  17334. blockData[blockBufferOffset + col + 56] = p7;
  17335. }
  17336. }
  17337. function buildComponentData(frame, component) {
  17338. const blocksPerLine = component.blocksPerLine;
  17339. const blocksPerColumn = component.blocksPerColumn;
  17340. const computationBuffer = new Int16Array(64);
  17341. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  17342. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  17343. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  17344. quantizeAndInverse(component, offset, computationBuffer);
  17345. }
  17346. }
  17347. return component.blockData;
  17348. }
  17349. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  17350. const maxPos = data.length - 1;
  17351. let newPos = startPos < currentPos ? startPos : currentPos;
  17352. if (currentPos >= maxPos) {
  17353. return null;
  17354. }
  17355. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  17356. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  17357. return {
  17358. invalid: null,
  17359. marker: currentMarker,
  17360. offset: currentPos
  17361. };
  17362. }
  17363. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  17364. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  17365. if (++newPos >= maxPos) {
  17366. return null;
  17367. }
  17368. newMarker = (0, _core_utils.readUint16)(data, newPos);
  17369. }
  17370. return {
  17371. invalid: currentMarker.toString(16),
  17372. marker: newMarker,
  17373. offset: newPos
  17374. };
  17375. }
  17376. class JpegImage {
  17377. constructor({
  17378. decodeTransform = null,
  17379. colorTransform = -1
  17380. } = {}) {
  17381. this._decodeTransform = decodeTransform;
  17382. this._colorTransform = colorTransform;
  17383. }
  17384. parse(data, {
  17385. dnlScanLines = null
  17386. } = {}) {
  17387. function readDataBlock() {
  17388. const length = (0, _core_utils.readUint16)(data, offset);
  17389. offset += 2;
  17390. let endOffset = offset + length - 2;
  17391. const fileMarker = findNextFileMarker(data, endOffset, offset);
  17392. if (fileMarker && fileMarker.invalid) {
  17393. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  17394. endOffset = fileMarker.offset;
  17395. }
  17396. const array = data.subarray(offset, endOffset);
  17397. offset += array.length;
  17398. return array;
  17399. }
  17400. function prepareComponents(frame) {
  17401. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  17402. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  17403. for (const component of frame.components) {
  17404. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  17405. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  17406. const blocksPerLineForMcu = mcusPerLine * component.h;
  17407. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  17408. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  17409. component.blockData = new Int16Array(blocksBufferSize);
  17410. component.blocksPerLine = blocksPerLine;
  17411. component.blocksPerColumn = blocksPerColumn;
  17412. }
  17413. frame.mcusPerLine = mcusPerLine;
  17414. frame.mcusPerColumn = mcusPerColumn;
  17415. }
  17416. let offset = 0;
  17417. let jfif = null;
  17418. let adobe = null;
  17419. let frame, resetInterval;
  17420. let numSOSMarkers = 0;
  17421. const quantizationTables = [];
  17422. const huffmanTablesAC = [],
  17423. huffmanTablesDC = [];
  17424. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  17425. offset += 2;
  17426. if (fileMarker !== 0xffd8) {
  17427. throw new JpegError("SOI not found");
  17428. }
  17429. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17430. offset += 2;
  17431. markerLoop: while (fileMarker !== 0xffd9) {
  17432. let i, j, l;
  17433. switch (fileMarker) {
  17434. case 0xffe0:
  17435. case 0xffe1:
  17436. case 0xffe2:
  17437. case 0xffe3:
  17438. case 0xffe4:
  17439. case 0xffe5:
  17440. case 0xffe6:
  17441. case 0xffe7:
  17442. case 0xffe8:
  17443. case 0xffe9:
  17444. case 0xffea:
  17445. case 0xffeb:
  17446. case 0xffec:
  17447. case 0xffed:
  17448. case 0xffee:
  17449. case 0xffef:
  17450. case 0xfffe:
  17451. const appData = readDataBlock();
  17452. if (fileMarker === 0xffe0) {
  17453. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  17454. jfif = {
  17455. version: {
  17456. major: appData[5],
  17457. minor: appData[6]
  17458. },
  17459. densityUnits: appData[7],
  17460. xDensity: appData[8] << 8 | appData[9],
  17461. yDensity: appData[10] << 8 | appData[11],
  17462. thumbWidth: appData[12],
  17463. thumbHeight: appData[13],
  17464. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  17465. };
  17466. }
  17467. }
  17468. if (fileMarker === 0xffee) {
  17469. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  17470. adobe = {
  17471. version: appData[5] << 8 | appData[6],
  17472. flags0: appData[7] << 8 | appData[8],
  17473. flags1: appData[9] << 8 | appData[10],
  17474. transformCode: appData[11]
  17475. };
  17476. }
  17477. }
  17478. break;
  17479. case 0xffdb:
  17480. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  17481. offset += 2;
  17482. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  17483. let z;
  17484. while (offset < quantizationTablesEnd) {
  17485. const quantizationTableSpec = data[offset++];
  17486. const tableData = new Uint16Array(64);
  17487. if (quantizationTableSpec >> 4 === 0) {
  17488. for (j = 0; j < 64; j++) {
  17489. z = dctZigZag[j];
  17490. tableData[z] = data[offset++];
  17491. }
  17492. } else if (quantizationTableSpec >> 4 === 1) {
  17493. for (j = 0; j < 64; j++) {
  17494. z = dctZigZag[j];
  17495. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  17496. offset += 2;
  17497. }
  17498. } else {
  17499. throw new JpegError("DQT - invalid table spec");
  17500. }
  17501. quantizationTables[quantizationTableSpec & 15] = tableData;
  17502. }
  17503. break;
  17504. case 0xffc0:
  17505. case 0xffc1:
  17506. case 0xffc2:
  17507. if (frame) {
  17508. throw new JpegError("Only single frame JPEGs supported");
  17509. }
  17510. offset += 2;
  17511. frame = {};
  17512. frame.extended = fileMarker === 0xffc1;
  17513. frame.progressive = fileMarker === 0xffc2;
  17514. frame.precision = data[offset++];
  17515. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  17516. offset += 2;
  17517. frame.scanLines = dnlScanLines || sofScanLines;
  17518. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  17519. offset += 2;
  17520. frame.components = [];
  17521. frame.componentIds = {};
  17522. const componentsCount = data[offset++];
  17523. let maxH = 0,
  17524. maxV = 0;
  17525. for (i = 0; i < componentsCount; i++) {
  17526. const componentId = data[offset];
  17527. const h = data[offset + 1] >> 4;
  17528. const v = data[offset + 1] & 15;
  17529. if (maxH < h) {
  17530. maxH = h;
  17531. }
  17532. if (maxV < v) {
  17533. maxV = v;
  17534. }
  17535. const qId = data[offset + 2];
  17536. l = frame.components.push({
  17537. h,
  17538. v,
  17539. quantizationId: qId,
  17540. quantizationTable: null
  17541. });
  17542. frame.componentIds[componentId] = l - 1;
  17543. offset += 3;
  17544. }
  17545. frame.maxH = maxH;
  17546. frame.maxV = maxV;
  17547. prepareComponents(frame);
  17548. break;
  17549. case 0xffc4:
  17550. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  17551. offset += 2;
  17552. for (i = 2; i < huffmanLength;) {
  17553. const huffmanTableSpec = data[offset++];
  17554. const codeLengths = new Uint8Array(16);
  17555. let codeLengthSum = 0;
  17556. for (j = 0; j < 16; j++, offset++) {
  17557. codeLengthSum += codeLengths[j] = data[offset];
  17558. }
  17559. const huffmanValues = new Uint8Array(codeLengthSum);
  17560. for (j = 0; j < codeLengthSum; j++, offset++) {
  17561. huffmanValues[j] = data[offset];
  17562. }
  17563. i += 17 + codeLengthSum;
  17564. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  17565. }
  17566. break;
  17567. case 0xffdd:
  17568. offset += 2;
  17569. resetInterval = (0, _core_utils.readUint16)(data, offset);
  17570. offset += 2;
  17571. break;
  17572. case 0xffda:
  17573. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  17574. offset += 2;
  17575. const selectorsCount = data[offset++],
  17576. components = [];
  17577. for (i = 0; i < selectorsCount; i++) {
  17578. const index = data[offset++];
  17579. const componentIndex = frame.componentIds[index];
  17580. const component = frame.components[componentIndex];
  17581. component.index = index;
  17582. const tableSpec = data[offset++];
  17583. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  17584. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  17585. components.push(component);
  17586. }
  17587. const spectralStart = data[offset++],
  17588. spectralEnd = data[offset++],
  17589. successiveApproximation = data[offset++];
  17590. try {
  17591. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  17592. offset += processed;
  17593. } catch (ex) {
  17594. if (ex instanceof DNLMarkerError) {
  17595. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  17596. return this.parse(data, {
  17597. dnlScanLines: ex.scanLines
  17598. });
  17599. } else if (ex instanceof EOIMarkerError) {
  17600. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  17601. break markerLoop;
  17602. }
  17603. throw ex;
  17604. }
  17605. break;
  17606. case 0xffdc:
  17607. offset += 4;
  17608. break;
  17609. case 0xffff:
  17610. if (data[offset] !== 0xff) {
  17611. offset--;
  17612. }
  17613. break;
  17614. default:
  17615. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  17616. if (nextFileMarker && nextFileMarker.invalid) {
  17617. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  17618. offset = nextFileMarker.offset;
  17619. break;
  17620. }
  17621. if (!nextFileMarker || offset >= data.length - 1) {
  17622. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  17623. break markerLoop;
  17624. }
  17625. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  17626. }
  17627. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17628. offset += 2;
  17629. }
  17630. this.width = frame.samplesPerLine;
  17631. this.height = frame.scanLines;
  17632. this.jfif = jfif;
  17633. this.adobe = adobe;
  17634. this.components = [];
  17635. for (const component of frame.components) {
  17636. const quantizationTable = quantizationTables[component.quantizationId];
  17637. if (quantizationTable) {
  17638. component.quantizationTable = quantizationTable;
  17639. }
  17640. this.components.push({
  17641. index: component.index,
  17642. output: buildComponentData(frame, component),
  17643. scaleX: component.h / frame.maxH,
  17644. scaleY: component.v / frame.maxV,
  17645. blocksPerLine: component.blocksPerLine,
  17646. blocksPerColumn: component.blocksPerColumn
  17647. });
  17648. }
  17649. this.numComponents = this.components.length;
  17650. return undefined;
  17651. }
  17652. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  17653. const scaleX = this.width / width,
  17654. scaleY = this.height / height;
  17655. let component, componentScaleX, componentScaleY, blocksPerScanline;
  17656. let x, y, i, j, k;
  17657. let index;
  17658. let offset = 0;
  17659. let output;
  17660. const numComponents = this.components.length;
  17661. const dataLength = width * height * numComponents;
  17662. const data = new Uint8ClampedArray(dataLength);
  17663. const xScaleBlockOffset = new Uint32Array(width);
  17664. const mask3LSB = 0xfffffff8;
  17665. let lastComponentScaleX;
  17666. for (i = 0; i < numComponents; i++) {
  17667. component = this.components[i];
  17668. componentScaleX = component.scaleX * scaleX;
  17669. componentScaleY = component.scaleY * scaleY;
  17670. offset = i;
  17671. output = component.output;
  17672. blocksPerScanline = component.blocksPerLine + 1 << 3;
  17673. if (componentScaleX !== lastComponentScaleX) {
  17674. for (x = 0; x < width; x++) {
  17675. j = 0 | x * componentScaleX;
  17676. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  17677. }
  17678. lastComponentScaleX = componentScaleX;
  17679. }
  17680. for (y = 0; y < height; y++) {
  17681. j = 0 | y * componentScaleY;
  17682. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  17683. for (x = 0; x < width; x++) {
  17684. data[offset] = output[index + xScaleBlockOffset[x]];
  17685. offset += numComponents;
  17686. }
  17687. }
  17688. }
  17689. let transform = this._decodeTransform;
  17690. if (!isSourcePDF && numComponents === 4 && !transform) {
  17691. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  17692. }
  17693. if (transform) {
  17694. for (i = 0; i < dataLength;) {
  17695. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  17696. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  17697. }
  17698. }
  17699. }
  17700. return data;
  17701. }
  17702. get _isColorConversionNeeded() {
  17703. if (this.adobe) {
  17704. return !!this.adobe.transformCode;
  17705. }
  17706. if (this.numComponents === 3) {
  17707. if (this._colorTransform === 0) {
  17708. return false;
  17709. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  17710. return false;
  17711. }
  17712. return true;
  17713. }
  17714. if (this._colorTransform === 1) {
  17715. return true;
  17716. }
  17717. return false;
  17718. }
  17719. _convertYccToRgb(data) {
  17720. let Y, Cb, Cr;
  17721. for (let i = 0, length = data.length; i < length; i += 3) {
  17722. Y = data[i];
  17723. Cb = data[i + 1];
  17724. Cr = data[i + 2];
  17725. data[i] = Y - 179.456 + 1.402 * Cr;
  17726. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  17727. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  17728. }
  17729. return data;
  17730. }
  17731. _convertYcckToRgb(data) {
  17732. let Y, Cb, Cr, k;
  17733. let offset = 0;
  17734. for (let i = 0, length = data.length; i < length; i += 4) {
  17735. Y = data[i];
  17736. Cb = data[i + 1];
  17737. Cr = data[i + 2];
  17738. k = data[i + 3];
  17739. 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);
  17740. 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);
  17741. 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);
  17742. }
  17743. return data.subarray(0, offset);
  17744. }
  17745. _convertYcckToCmyk(data) {
  17746. let Y, Cb, Cr;
  17747. for (let i = 0, length = data.length; i < length; i += 4) {
  17748. Y = data[i];
  17749. Cb = data[i + 1];
  17750. Cr = data[i + 2];
  17751. data[i] = 434.456 - Y - 1.402 * Cr;
  17752. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  17753. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  17754. }
  17755. return data;
  17756. }
  17757. _convertCmykToRgb(data) {
  17758. let c, m, y, k;
  17759. let offset = 0;
  17760. for (let i = 0, length = data.length; i < length; i += 4) {
  17761. c = data[i];
  17762. m = data[i + 1];
  17763. y = data[i + 2];
  17764. k = data[i + 3];
  17765. 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);
  17766. 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);
  17767. 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);
  17768. }
  17769. return data.subarray(0, offset);
  17770. }
  17771. getData({
  17772. width,
  17773. height,
  17774. forceRGB = false,
  17775. isSourcePDF = false
  17776. }) {
  17777. if (this.numComponents > 4) {
  17778. throw new JpegError("Unsupported color mode");
  17779. }
  17780. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  17781. if (this.numComponents === 1 && forceRGB) {
  17782. const rgbData = new Uint8ClampedArray(data.length * 3);
  17783. let offset = 0;
  17784. for (const grayColor of data) {
  17785. rgbData[offset++] = grayColor;
  17786. rgbData[offset++] = grayColor;
  17787. rgbData[offset++] = grayColor;
  17788. }
  17789. return rgbData;
  17790. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  17791. return this._convertYccToRgb(data);
  17792. } else if (this.numComponents === 4) {
  17793. if (this._isColorConversionNeeded) {
  17794. if (forceRGB) {
  17795. return this._convertYcckToRgb(data);
  17796. }
  17797. return this._convertYcckToCmyk(data);
  17798. } else if (forceRGB) {
  17799. return this._convertCmykToRgb(data);
  17800. }
  17801. }
  17802. return data;
  17803. }
  17804. }
  17805. exports.JpegImage = JpegImage;
  17806. /***/ }),
  17807. /* 27 */
  17808. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17809. Object.defineProperty(exports, "__esModule", ({
  17810. value: true
  17811. }));
  17812. exports.JpxStream = void 0;
  17813. var _decode_stream = __w_pdfjs_require__(17);
  17814. var _jpx = __w_pdfjs_require__(28);
  17815. var _util = __w_pdfjs_require__(2);
  17816. class JpxStream extends _decode_stream.DecodeStream {
  17817. constructor(stream, maybeLength, params) {
  17818. super(maybeLength);
  17819. this.stream = stream;
  17820. this.dict = stream.dict;
  17821. this.maybeLength = maybeLength;
  17822. this.params = params;
  17823. }
  17824. get bytes() {
  17825. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17826. }
  17827. ensureBuffer(requested) {}
  17828. readBlock() {
  17829. if (this.eof) {
  17830. return;
  17831. }
  17832. const jpxImage = new _jpx.JpxImage();
  17833. jpxImage.parse(this.bytes);
  17834. const width = jpxImage.width;
  17835. const height = jpxImage.height;
  17836. const componentsCount = jpxImage.componentsCount;
  17837. const tileCount = jpxImage.tiles.length;
  17838. if (tileCount === 1) {
  17839. this.buffer = jpxImage.tiles[0].items;
  17840. } else {
  17841. const data = new Uint8ClampedArray(width * height * componentsCount);
  17842. for (let k = 0; k < tileCount; k++) {
  17843. const tileComponents = jpxImage.tiles[k];
  17844. const tileWidth = tileComponents.width;
  17845. const tileHeight = tileComponents.height;
  17846. const tileLeft = tileComponents.left;
  17847. const tileTop = tileComponents.top;
  17848. const src = tileComponents.items;
  17849. let srcPosition = 0;
  17850. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  17851. const imgRowSize = width * componentsCount;
  17852. const tileRowSize = tileWidth * componentsCount;
  17853. for (let j = 0; j < tileHeight; j++) {
  17854. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  17855. data.set(rowBytes, dataPosition);
  17856. srcPosition += tileRowSize;
  17857. dataPosition += imgRowSize;
  17858. }
  17859. }
  17860. this.buffer = data;
  17861. }
  17862. this.bufferLength = this.buffer.length;
  17863. this.eof = true;
  17864. }
  17865. }
  17866. exports.JpxStream = JpxStream;
  17867. /***/ }),
  17868. /* 28 */
  17869. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17870. Object.defineProperty(exports, "__esModule", ({
  17871. value: true
  17872. }));
  17873. exports.JpxImage = void 0;
  17874. var _util = __w_pdfjs_require__(2);
  17875. var _core_utils = __w_pdfjs_require__(4);
  17876. var _arithmetic_decoder = __w_pdfjs_require__(24);
  17877. class JpxError extends _util.BaseException {
  17878. constructor(msg) {
  17879. super(`JPX error: ${msg}`, "JpxError");
  17880. }
  17881. }
  17882. const SubbandsGainLog2 = {
  17883. LL: 0,
  17884. LH: 1,
  17885. HL: 1,
  17886. HH: 2
  17887. };
  17888. class JpxImage {
  17889. constructor() {
  17890. this.failOnCorruptedImage = false;
  17891. }
  17892. parse(data) {
  17893. const head = (0, _core_utils.readUint16)(data, 0);
  17894. if (head === 0xff4f) {
  17895. this.parseCodestream(data, 0, data.length);
  17896. return;
  17897. }
  17898. const length = data.length;
  17899. let position = 0;
  17900. while (position < length) {
  17901. let headerSize = 8;
  17902. let lbox = (0, _core_utils.readUint32)(data, position);
  17903. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  17904. position += headerSize;
  17905. if (lbox === 1) {
  17906. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  17907. position += 8;
  17908. headerSize += 8;
  17909. }
  17910. if (lbox === 0) {
  17911. lbox = length - position + headerSize;
  17912. }
  17913. if (lbox < headerSize) {
  17914. throw new JpxError("Invalid box field size");
  17915. }
  17916. const dataLength = lbox - headerSize;
  17917. let jumpDataLength = true;
  17918. switch (tbox) {
  17919. case 0x6a703268:
  17920. jumpDataLength = false;
  17921. break;
  17922. case 0x636f6c72:
  17923. const method = data[position];
  17924. if (method === 1) {
  17925. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  17926. switch (colorspace) {
  17927. case 16:
  17928. case 17:
  17929. case 18:
  17930. break;
  17931. default:
  17932. (0, _util.warn)("Unknown colorspace " + colorspace);
  17933. break;
  17934. }
  17935. } else if (method === 2) {
  17936. (0, _util.info)("ICC profile not supported");
  17937. }
  17938. break;
  17939. case 0x6a703263:
  17940. this.parseCodestream(data, position, position + dataLength);
  17941. break;
  17942. case 0x6a502020:
  17943. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  17944. (0, _util.warn)("Invalid JP2 signature");
  17945. }
  17946. break;
  17947. case 0x6a501a1a:
  17948. case 0x66747970:
  17949. case 0x72726571:
  17950. case 0x72657320:
  17951. case 0x69686472:
  17952. break;
  17953. default:
  17954. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  17955. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  17956. break;
  17957. }
  17958. if (jumpDataLength) {
  17959. position += dataLength;
  17960. }
  17961. }
  17962. }
  17963. parseImageProperties(stream) {
  17964. let newByte = stream.getByte();
  17965. while (newByte >= 0) {
  17966. const oldByte = newByte;
  17967. newByte = stream.getByte();
  17968. const code = oldByte << 8 | newByte;
  17969. if (code === 0xff51) {
  17970. stream.skip(4);
  17971. const Xsiz = stream.getInt32() >>> 0;
  17972. const Ysiz = stream.getInt32() >>> 0;
  17973. const XOsiz = stream.getInt32() >>> 0;
  17974. const YOsiz = stream.getInt32() >>> 0;
  17975. stream.skip(16);
  17976. const Csiz = stream.getUint16();
  17977. this.width = Xsiz - XOsiz;
  17978. this.height = Ysiz - YOsiz;
  17979. this.componentsCount = Csiz;
  17980. this.bitsPerComponent = 8;
  17981. return;
  17982. }
  17983. }
  17984. throw new JpxError("No size marker found in JPX stream");
  17985. }
  17986. parseCodestream(data, start, end) {
  17987. const context = {};
  17988. let doNotRecover = false;
  17989. try {
  17990. let position = start;
  17991. while (position + 1 < end) {
  17992. const code = (0, _core_utils.readUint16)(data, position);
  17993. position += 2;
  17994. let length = 0,
  17995. j,
  17996. sqcd,
  17997. spqcds,
  17998. spqcdSize,
  17999. scalarExpounded,
  18000. tile;
  18001. switch (code) {
  18002. case 0xff4f:
  18003. context.mainHeader = true;
  18004. break;
  18005. case 0xffd9:
  18006. break;
  18007. case 0xff51:
  18008. length = (0, _core_utils.readUint16)(data, position);
  18009. const siz = {};
  18010. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  18011. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  18012. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  18013. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  18014. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  18015. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  18016. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  18017. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  18018. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  18019. siz.Csiz = componentsCount;
  18020. const components = [];
  18021. j = position + 38;
  18022. for (let i = 0; i < componentsCount; i++) {
  18023. const component = {
  18024. precision: (data[j] & 0x7f) + 1,
  18025. isSigned: !!(data[j] & 0x80),
  18026. XRsiz: data[j + 1],
  18027. YRsiz: data[j + 2]
  18028. };
  18029. j += 3;
  18030. calculateComponentDimensions(component, siz);
  18031. components.push(component);
  18032. }
  18033. context.SIZ = siz;
  18034. context.components = components;
  18035. calculateTileGrids(context, components);
  18036. context.QCC = [];
  18037. context.COC = [];
  18038. break;
  18039. case 0xff5c:
  18040. length = (0, _core_utils.readUint16)(data, position);
  18041. const qcd = {};
  18042. j = position + 2;
  18043. sqcd = data[j++];
  18044. switch (sqcd & 0x1f) {
  18045. case 0:
  18046. spqcdSize = 8;
  18047. scalarExpounded = true;
  18048. break;
  18049. case 1:
  18050. spqcdSize = 16;
  18051. scalarExpounded = false;
  18052. break;
  18053. case 2:
  18054. spqcdSize = 16;
  18055. scalarExpounded = true;
  18056. break;
  18057. default:
  18058. throw new Error("Invalid SQcd value " + sqcd);
  18059. }
  18060. qcd.noQuantization = spqcdSize === 8;
  18061. qcd.scalarExpounded = scalarExpounded;
  18062. qcd.guardBits = sqcd >> 5;
  18063. spqcds = [];
  18064. while (j < length + position) {
  18065. const spqcd = {};
  18066. if (spqcdSize === 8) {
  18067. spqcd.epsilon = data[j++] >> 3;
  18068. spqcd.mu = 0;
  18069. } else {
  18070. spqcd.epsilon = data[j] >> 3;
  18071. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18072. j += 2;
  18073. }
  18074. spqcds.push(spqcd);
  18075. }
  18076. qcd.SPqcds = spqcds;
  18077. if (context.mainHeader) {
  18078. context.QCD = qcd;
  18079. } else {
  18080. context.currentTile.QCD = qcd;
  18081. context.currentTile.QCC = [];
  18082. }
  18083. break;
  18084. case 0xff5d:
  18085. length = (0, _core_utils.readUint16)(data, position);
  18086. const qcc = {};
  18087. j = position + 2;
  18088. let cqcc;
  18089. if (context.SIZ.Csiz < 257) {
  18090. cqcc = data[j++];
  18091. } else {
  18092. cqcc = (0, _core_utils.readUint16)(data, j);
  18093. j += 2;
  18094. }
  18095. sqcd = data[j++];
  18096. switch (sqcd & 0x1f) {
  18097. case 0:
  18098. spqcdSize = 8;
  18099. scalarExpounded = true;
  18100. break;
  18101. case 1:
  18102. spqcdSize = 16;
  18103. scalarExpounded = false;
  18104. break;
  18105. case 2:
  18106. spqcdSize = 16;
  18107. scalarExpounded = true;
  18108. break;
  18109. default:
  18110. throw new Error("Invalid SQcd value " + sqcd);
  18111. }
  18112. qcc.noQuantization = spqcdSize === 8;
  18113. qcc.scalarExpounded = scalarExpounded;
  18114. qcc.guardBits = sqcd >> 5;
  18115. spqcds = [];
  18116. while (j < length + position) {
  18117. const spqcd = {};
  18118. if (spqcdSize === 8) {
  18119. spqcd.epsilon = data[j++] >> 3;
  18120. spqcd.mu = 0;
  18121. } else {
  18122. spqcd.epsilon = data[j] >> 3;
  18123. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18124. j += 2;
  18125. }
  18126. spqcds.push(spqcd);
  18127. }
  18128. qcc.SPqcds = spqcds;
  18129. if (context.mainHeader) {
  18130. context.QCC[cqcc] = qcc;
  18131. } else {
  18132. context.currentTile.QCC[cqcc] = qcc;
  18133. }
  18134. break;
  18135. case 0xff52:
  18136. length = (0, _core_utils.readUint16)(data, position);
  18137. const cod = {};
  18138. j = position + 2;
  18139. const scod = data[j++];
  18140. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18141. cod.sopMarkerUsed = !!(scod & 2);
  18142. cod.ephMarkerUsed = !!(scod & 4);
  18143. cod.progressionOrder = data[j++];
  18144. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  18145. j += 2;
  18146. cod.multipleComponentTransform = data[j++];
  18147. cod.decompositionLevelsCount = data[j++];
  18148. cod.xcb = (data[j++] & 0xf) + 2;
  18149. cod.ycb = (data[j++] & 0xf) + 2;
  18150. const blockStyle = data[j++];
  18151. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18152. cod.resetContextProbabilities = !!(blockStyle & 2);
  18153. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18154. cod.verticallyStripe = !!(blockStyle & 8);
  18155. cod.predictableTermination = !!(blockStyle & 16);
  18156. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18157. cod.reversibleTransformation = data[j++];
  18158. if (cod.entropyCoderWithCustomPrecincts) {
  18159. const precinctsSizes = [];
  18160. while (j < length + position) {
  18161. const precinctsSize = data[j++];
  18162. precinctsSizes.push({
  18163. PPx: precinctsSize & 0xf,
  18164. PPy: precinctsSize >> 4
  18165. });
  18166. }
  18167. cod.precinctsSizes = precinctsSizes;
  18168. }
  18169. const unsupported = [];
  18170. if (cod.selectiveArithmeticCodingBypass) {
  18171. unsupported.push("selectiveArithmeticCodingBypass");
  18172. }
  18173. if (cod.terminationOnEachCodingPass) {
  18174. unsupported.push("terminationOnEachCodingPass");
  18175. }
  18176. if (cod.verticallyStripe) {
  18177. unsupported.push("verticallyStripe");
  18178. }
  18179. if (cod.predictableTermination) {
  18180. unsupported.push("predictableTermination");
  18181. }
  18182. if (unsupported.length > 0) {
  18183. doNotRecover = true;
  18184. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  18185. }
  18186. if (context.mainHeader) {
  18187. context.COD = cod;
  18188. } else {
  18189. context.currentTile.COD = cod;
  18190. context.currentTile.COC = [];
  18191. }
  18192. break;
  18193. case 0xff90:
  18194. length = (0, _core_utils.readUint16)(data, position);
  18195. tile = {};
  18196. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  18197. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  18198. tile.dataEnd = tile.length + position - 2;
  18199. tile.partIndex = data[position + 8];
  18200. tile.partsCount = data[position + 9];
  18201. context.mainHeader = false;
  18202. if (tile.partIndex === 0) {
  18203. tile.COD = context.COD;
  18204. tile.COC = context.COC.slice(0);
  18205. tile.QCD = context.QCD;
  18206. tile.QCC = context.QCC.slice(0);
  18207. }
  18208. context.currentTile = tile;
  18209. break;
  18210. case 0xff93:
  18211. tile = context.currentTile;
  18212. if (tile.partIndex === 0) {
  18213. initializeTile(context, tile.index);
  18214. buildPackets(context);
  18215. }
  18216. length = tile.dataEnd - position;
  18217. parseTilePackets(context, data, position, length);
  18218. break;
  18219. case 0xff53:
  18220. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  18221. case 0xff55:
  18222. case 0xff57:
  18223. case 0xff58:
  18224. case 0xff64:
  18225. length = (0, _core_utils.readUint16)(data, position);
  18226. break;
  18227. default:
  18228. throw new Error("Unknown codestream code: " + code.toString(16));
  18229. }
  18230. position += length;
  18231. }
  18232. } catch (e) {
  18233. if (doNotRecover || this.failOnCorruptedImage) {
  18234. throw new JpxError(e.message);
  18235. } else {
  18236. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  18237. }
  18238. }
  18239. this.tiles = transformComponents(context);
  18240. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18241. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18242. this.componentsCount = context.SIZ.Csiz;
  18243. }
  18244. }
  18245. exports.JpxImage = JpxImage;
  18246. function calculateComponentDimensions(component, siz) {
  18247. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18248. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18249. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18250. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18251. component.width = component.x1 - component.x0;
  18252. component.height = component.y1 - component.y0;
  18253. }
  18254. function calculateTileGrids(context, components) {
  18255. const siz = context.SIZ;
  18256. const tiles = [];
  18257. let tile;
  18258. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18259. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18260. for (let q = 0; q < numYtiles; q++) {
  18261. for (let p = 0; p < numXtiles; p++) {
  18262. tile = {};
  18263. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18264. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18265. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18266. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18267. tile.width = tile.tx1 - tile.tx0;
  18268. tile.height = tile.ty1 - tile.ty0;
  18269. tile.components = [];
  18270. tiles.push(tile);
  18271. }
  18272. }
  18273. context.tiles = tiles;
  18274. const componentsCount = siz.Csiz;
  18275. for (let i = 0, ii = componentsCount; i < ii; i++) {
  18276. const component = components[i];
  18277. for (let j = 0, jj = tiles.length; j < jj; j++) {
  18278. const tileComponent = {};
  18279. tile = tiles[j];
  18280. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18281. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18282. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18283. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18284. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18285. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18286. tile.components[i] = tileComponent;
  18287. }
  18288. }
  18289. }
  18290. function getBlocksDimensions(context, component, r) {
  18291. const codOrCoc = component.codingStyleParameters;
  18292. const result = {};
  18293. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18294. result.PPx = 15;
  18295. result.PPy = 15;
  18296. } else {
  18297. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18298. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18299. }
  18300. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18301. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18302. return result;
  18303. }
  18304. function buildPrecincts(context, resolution, dimensions) {
  18305. const precinctWidth = 1 << dimensions.PPx;
  18306. const precinctHeight = 1 << dimensions.PPy;
  18307. const isZeroRes = resolution.resLevel === 0;
  18308. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18309. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18310. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18311. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18312. const numprecincts = numprecinctswide * numprecinctshigh;
  18313. resolution.precinctParameters = {
  18314. precinctWidth,
  18315. precinctHeight,
  18316. numprecinctswide,
  18317. numprecinctshigh,
  18318. numprecincts,
  18319. precinctWidthInSubband,
  18320. precinctHeightInSubband
  18321. };
  18322. }
  18323. function buildCodeblocks(context, subband, dimensions) {
  18324. const xcb_ = dimensions.xcb_;
  18325. const ycb_ = dimensions.ycb_;
  18326. const codeblockWidth = 1 << xcb_;
  18327. const codeblockHeight = 1 << ycb_;
  18328. const cbx0 = subband.tbx0 >> xcb_;
  18329. const cby0 = subband.tby0 >> ycb_;
  18330. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18331. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18332. const precinctParameters = subband.resolution.precinctParameters;
  18333. const codeblocks = [];
  18334. const precincts = [];
  18335. let i, j, codeblock, precinctNumber;
  18336. for (j = cby0; j < cby1; j++) {
  18337. for (i = cbx0; i < cbx1; i++) {
  18338. codeblock = {
  18339. cbx: i,
  18340. cby: j,
  18341. tbx0: codeblockWidth * i,
  18342. tby0: codeblockHeight * j,
  18343. tbx1: codeblockWidth * (i + 1),
  18344. tby1: codeblockHeight * (j + 1)
  18345. };
  18346. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18347. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18348. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18349. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18350. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18351. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18352. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18353. codeblock.precinctNumber = precinctNumber;
  18354. codeblock.subbandType = subband.type;
  18355. codeblock.Lblock = 3;
  18356. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18357. continue;
  18358. }
  18359. codeblocks.push(codeblock);
  18360. let precinct = precincts[precinctNumber];
  18361. if (precinct !== undefined) {
  18362. if (i < precinct.cbxMin) {
  18363. precinct.cbxMin = i;
  18364. } else if (i > precinct.cbxMax) {
  18365. precinct.cbxMax = i;
  18366. }
  18367. if (j < precinct.cbyMin) {
  18368. precinct.cbxMin = j;
  18369. } else if (j > precinct.cbyMax) {
  18370. precinct.cbyMax = j;
  18371. }
  18372. } else {
  18373. precincts[precinctNumber] = precinct = {
  18374. cbxMin: i,
  18375. cbyMin: j,
  18376. cbxMax: i,
  18377. cbyMax: j
  18378. };
  18379. }
  18380. codeblock.precinct = precinct;
  18381. }
  18382. }
  18383. subband.codeblockParameters = {
  18384. codeblockWidth: xcb_,
  18385. codeblockHeight: ycb_,
  18386. numcodeblockwide: cbx1 - cbx0 + 1,
  18387. numcodeblockhigh: cby1 - cby0 + 1
  18388. };
  18389. subband.codeblocks = codeblocks;
  18390. subband.precincts = precincts;
  18391. }
  18392. function createPacket(resolution, precinctNumber, layerNumber) {
  18393. const precinctCodeblocks = [];
  18394. const subbands = resolution.subbands;
  18395. for (let i = 0, ii = subbands.length; i < ii; i++) {
  18396. const subband = subbands[i];
  18397. const codeblocks = subband.codeblocks;
  18398. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  18399. const codeblock = codeblocks[j];
  18400. if (codeblock.precinctNumber !== precinctNumber) {
  18401. continue;
  18402. }
  18403. precinctCodeblocks.push(codeblock);
  18404. }
  18405. }
  18406. return {
  18407. layerNumber,
  18408. codeblocks: precinctCodeblocks
  18409. };
  18410. }
  18411. function LayerResolutionComponentPositionIterator(context) {
  18412. const siz = context.SIZ;
  18413. const tileIndex = context.currentTile.index;
  18414. const tile = context.tiles[tileIndex];
  18415. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18416. const componentsCount = siz.Csiz;
  18417. let maxDecompositionLevelsCount = 0;
  18418. for (let q = 0; q < componentsCount; q++) {
  18419. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18420. }
  18421. let l = 0,
  18422. r = 0,
  18423. i = 0,
  18424. k = 0;
  18425. this.nextPacket = function JpxImage_nextPacket() {
  18426. for (; l < layersCount; l++) {
  18427. for (; r <= maxDecompositionLevelsCount; r++) {
  18428. for (; i < componentsCount; i++) {
  18429. const component = tile.components[i];
  18430. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18431. continue;
  18432. }
  18433. const resolution = component.resolutions[r];
  18434. const numprecincts = resolution.precinctParameters.numprecincts;
  18435. for (; k < numprecincts;) {
  18436. const packet = createPacket(resolution, k, l);
  18437. k++;
  18438. return packet;
  18439. }
  18440. k = 0;
  18441. }
  18442. i = 0;
  18443. }
  18444. r = 0;
  18445. }
  18446. throw new JpxError("Out of packets");
  18447. };
  18448. }
  18449. function ResolutionLayerComponentPositionIterator(context) {
  18450. const siz = context.SIZ;
  18451. const tileIndex = context.currentTile.index;
  18452. const tile = context.tiles[tileIndex];
  18453. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18454. const componentsCount = siz.Csiz;
  18455. let maxDecompositionLevelsCount = 0;
  18456. for (let q = 0; q < componentsCount; q++) {
  18457. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18458. }
  18459. let r = 0,
  18460. l = 0,
  18461. i = 0,
  18462. k = 0;
  18463. this.nextPacket = function JpxImage_nextPacket() {
  18464. for (; r <= maxDecompositionLevelsCount; r++) {
  18465. for (; l < layersCount; l++) {
  18466. for (; i < componentsCount; i++) {
  18467. const component = tile.components[i];
  18468. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18469. continue;
  18470. }
  18471. const resolution = component.resolutions[r];
  18472. const numprecincts = resolution.precinctParameters.numprecincts;
  18473. for (; k < numprecincts;) {
  18474. const packet = createPacket(resolution, k, l);
  18475. k++;
  18476. return packet;
  18477. }
  18478. k = 0;
  18479. }
  18480. i = 0;
  18481. }
  18482. l = 0;
  18483. }
  18484. throw new JpxError("Out of packets");
  18485. };
  18486. }
  18487. function ResolutionPositionComponentLayerIterator(context) {
  18488. const siz = context.SIZ;
  18489. const tileIndex = context.currentTile.index;
  18490. const tile = context.tiles[tileIndex];
  18491. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18492. const componentsCount = siz.Csiz;
  18493. let l, r, c, p;
  18494. let maxDecompositionLevelsCount = 0;
  18495. for (c = 0; c < componentsCount; c++) {
  18496. const component = tile.components[c];
  18497. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18498. }
  18499. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18500. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18501. let maxNumPrecincts = 0;
  18502. for (c = 0; c < componentsCount; ++c) {
  18503. const resolutions = tile.components[c].resolutions;
  18504. if (r < resolutions.length) {
  18505. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18506. }
  18507. }
  18508. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18509. }
  18510. l = 0;
  18511. r = 0;
  18512. c = 0;
  18513. p = 0;
  18514. this.nextPacket = function JpxImage_nextPacket() {
  18515. for (; r <= maxDecompositionLevelsCount; r++) {
  18516. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18517. for (; c < componentsCount; c++) {
  18518. const component = tile.components[c];
  18519. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18520. continue;
  18521. }
  18522. const resolution = component.resolutions[r];
  18523. const numprecincts = resolution.precinctParameters.numprecincts;
  18524. if (p >= numprecincts) {
  18525. continue;
  18526. }
  18527. for (; l < layersCount;) {
  18528. const packet = createPacket(resolution, p, l);
  18529. l++;
  18530. return packet;
  18531. }
  18532. l = 0;
  18533. }
  18534. c = 0;
  18535. }
  18536. p = 0;
  18537. }
  18538. throw new JpxError("Out of packets");
  18539. };
  18540. }
  18541. function PositionComponentResolutionLayerIterator(context) {
  18542. const siz = context.SIZ;
  18543. const tileIndex = context.currentTile.index;
  18544. const tile = context.tiles[tileIndex];
  18545. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18546. const componentsCount = siz.Csiz;
  18547. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18548. const precinctsIterationSizes = precinctsSizes;
  18549. let l = 0,
  18550. r = 0,
  18551. c = 0,
  18552. px = 0,
  18553. py = 0;
  18554. this.nextPacket = function JpxImage_nextPacket() {
  18555. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18556. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18557. for (; c < componentsCount; c++) {
  18558. const component = tile.components[c];
  18559. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18560. for (; r <= decompositionLevelsCount; r++) {
  18561. const resolution = component.resolutions[r];
  18562. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18563. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18564. if (k === null) {
  18565. continue;
  18566. }
  18567. for (; l < layersCount;) {
  18568. const packet = createPacket(resolution, k, l);
  18569. l++;
  18570. return packet;
  18571. }
  18572. l = 0;
  18573. }
  18574. r = 0;
  18575. }
  18576. c = 0;
  18577. }
  18578. px = 0;
  18579. }
  18580. throw new JpxError("Out of packets");
  18581. };
  18582. }
  18583. function ComponentPositionResolutionLayerIterator(context) {
  18584. const siz = context.SIZ;
  18585. const tileIndex = context.currentTile.index;
  18586. const tile = context.tiles[tileIndex];
  18587. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18588. const componentsCount = siz.Csiz;
  18589. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18590. let l = 0,
  18591. r = 0,
  18592. c = 0,
  18593. px = 0,
  18594. py = 0;
  18595. this.nextPacket = function JpxImage_nextPacket() {
  18596. for (; c < componentsCount; ++c) {
  18597. const component = tile.components[c];
  18598. const precinctsIterationSizes = precinctsSizes.components[c];
  18599. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18600. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18601. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18602. for (; r <= decompositionLevelsCount; r++) {
  18603. const resolution = component.resolutions[r];
  18604. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18605. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18606. if (k === null) {
  18607. continue;
  18608. }
  18609. for (; l < layersCount;) {
  18610. const packet = createPacket(resolution, k, l);
  18611. l++;
  18612. return packet;
  18613. }
  18614. l = 0;
  18615. }
  18616. r = 0;
  18617. }
  18618. px = 0;
  18619. }
  18620. py = 0;
  18621. }
  18622. throw new JpxError("Out of packets");
  18623. };
  18624. }
  18625. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  18626. const posX = pxIndex * precinctIterationSizes.minWidth;
  18627. const posY = pyIndex * precinctIterationSizes.minHeight;
  18628. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  18629. return null;
  18630. }
  18631. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  18632. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  18633. }
  18634. function getPrecinctSizesInImageScale(tile) {
  18635. const componentsCount = tile.components.length;
  18636. let minWidth = Number.MAX_VALUE;
  18637. let minHeight = Number.MAX_VALUE;
  18638. let maxNumWide = 0;
  18639. let maxNumHigh = 0;
  18640. const sizePerComponent = new Array(componentsCount);
  18641. for (let c = 0; c < componentsCount; c++) {
  18642. const component = tile.components[c];
  18643. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18644. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  18645. let minWidthCurrentComponent = Number.MAX_VALUE;
  18646. let minHeightCurrentComponent = Number.MAX_VALUE;
  18647. let maxNumWideCurrentComponent = 0;
  18648. let maxNumHighCurrentComponent = 0;
  18649. let scale = 1;
  18650. for (let r = decompositionLevelsCount; r >= 0; --r) {
  18651. const resolution = component.resolutions[r];
  18652. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  18653. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  18654. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  18655. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  18656. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  18657. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  18658. sizePerResolution[r] = {
  18659. width: widthCurrentResolution,
  18660. height: heightCurrentResolution
  18661. };
  18662. scale <<= 1;
  18663. }
  18664. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  18665. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  18666. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  18667. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  18668. sizePerComponent[c] = {
  18669. resolutions: sizePerResolution,
  18670. minWidth: minWidthCurrentComponent,
  18671. minHeight: minHeightCurrentComponent,
  18672. maxNumWide: maxNumWideCurrentComponent,
  18673. maxNumHigh: maxNumHighCurrentComponent
  18674. };
  18675. }
  18676. return {
  18677. components: sizePerComponent,
  18678. minWidth,
  18679. minHeight,
  18680. maxNumWide,
  18681. maxNumHigh
  18682. };
  18683. }
  18684. function buildPackets(context) {
  18685. const siz = context.SIZ;
  18686. const tileIndex = context.currentTile.index;
  18687. const tile = context.tiles[tileIndex];
  18688. const componentsCount = siz.Csiz;
  18689. for (let c = 0; c < componentsCount; c++) {
  18690. const component = tile.components[c];
  18691. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18692. const resolutions = [];
  18693. const subbands = [];
  18694. for (let r = 0; r <= decompositionLevelsCount; r++) {
  18695. const blocksDimensions = getBlocksDimensions(context, component, r);
  18696. const resolution = {};
  18697. const scale = 1 << decompositionLevelsCount - r;
  18698. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  18699. resolution.try0 = Math.ceil(component.tcy0 / scale);
  18700. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  18701. resolution.try1 = Math.ceil(component.tcy1 / scale);
  18702. resolution.resLevel = r;
  18703. buildPrecincts(context, resolution, blocksDimensions);
  18704. resolutions.push(resolution);
  18705. let subband;
  18706. if (r === 0) {
  18707. subband = {};
  18708. subband.type = "LL";
  18709. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  18710. subband.tby0 = Math.ceil(component.tcy0 / scale);
  18711. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  18712. subband.tby1 = Math.ceil(component.tcy1 / scale);
  18713. subband.resolution = resolution;
  18714. buildCodeblocks(context, subband, blocksDimensions);
  18715. subbands.push(subband);
  18716. resolution.subbands = [subband];
  18717. } else {
  18718. const bscale = 1 << decompositionLevelsCount - r + 1;
  18719. const resolutionSubbands = [];
  18720. subband = {};
  18721. subband.type = "HL";
  18722. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18723. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  18724. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18725. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  18726. subband.resolution = resolution;
  18727. buildCodeblocks(context, subband, blocksDimensions);
  18728. subbands.push(subband);
  18729. resolutionSubbands.push(subband);
  18730. subband = {};
  18731. subband.type = "LH";
  18732. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  18733. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18734. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  18735. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18736. subband.resolution = resolution;
  18737. buildCodeblocks(context, subband, blocksDimensions);
  18738. subbands.push(subband);
  18739. resolutionSubbands.push(subband);
  18740. subband = {};
  18741. subband.type = "HH";
  18742. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18743. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18744. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18745. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18746. subband.resolution = resolution;
  18747. buildCodeblocks(context, subband, blocksDimensions);
  18748. subbands.push(subband);
  18749. resolutionSubbands.push(subband);
  18750. resolution.subbands = resolutionSubbands;
  18751. }
  18752. }
  18753. component.resolutions = resolutions;
  18754. component.subbands = subbands;
  18755. }
  18756. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  18757. switch (progressionOrder) {
  18758. case 0:
  18759. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  18760. break;
  18761. case 1:
  18762. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  18763. break;
  18764. case 2:
  18765. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  18766. break;
  18767. case 3:
  18768. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  18769. break;
  18770. case 4:
  18771. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  18772. break;
  18773. default:
  18774. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  18775. }
  18776. }
  18777. function parseTilePackets(context, data, offset, dataLength) {
  18778. let position = 0;
  18779. let buffer,
  18780. bufferSize = 0,
  18781. skipNextBit = false;
  18782. function readBits(count) {
  18783. while (bufferSize < count) {
  18784. const b = data[offset + position];
  18785. position++;
  18786. if (skipNextBit) {
  18787. buffer = buffer << 7 | b;
  18788. bufferSize += 7;
  18789. skipNextBit = false;
  18790. } else {
  18791. buffer = buffer << 8 | b;
  18792. bufferSize += 8;
  18793. }
  18794. if (b === 0xff) {
  18795. skipNextBit = true;
  18796. }
  18797. }
  18798. bufferSize -= count;
  18799. return buffer >>> bufferSize & (1 << count) - 1;
  18800. }
  18801. function skipMarkerIfEqual(value) {
  18802. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  18803. skipBytes(1);
  18804. return true;
  18805. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  18806. skipBytes(2);
  18807. return true;
  18808. }
  18809. return false;
  18810. }
  18811. function skipBytes(count) {
  18812. position += count;
  18813. }
  18814. function alignToByte() {
  18815. bufferSize = 0;
  18816. if (skipNextBit) {
  18817. position++;
  18818. skipNextBit = false;
  18819. }
  18820. }
  18821. function readCodingpasses() {
  18822. if (readBits(1) === 0) {
  18823. return 1;
  18824. }
  18825. if (readBits(1) === 0) {
  18826. return 2;
  18827. }
  18828. let value = readBits(2);
  18829. if (value < 3) {
  18830. return value + 3;
  18831. }
  18832. value = readBits(5);
  18833. if (value < 31) {
  18834. return value + 6;
  18835. }
  18836. value = readBits(7);
  18837. return value + 37;
  18838. }
  18839. const tileIndex = context.currentTile.index;
  18840. const tile = context.tiles[tileIndex];
  18841. const sopMarkerUsed = context.COD.sopMarkerUsed;
  18842. const ephMarkerUsed = context.COD.ephMarkerUsed;
  18843. const packetsIterator = tile.packetsIterator;
  18844. while (position < dataLength) {
  18845. alignToByte();
  18846. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  18847. skipBytes(4);
  18848. }
  18849. const packet = packetsIterator.nextPacket();
  18850. if (!readBits(1)) {
  18851. continue;
  18852. }
  18853. const layerNumber = packet.layerNumber,
  18854. queue = [];
  18855. let codeblock;
  18856. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  18857. codeblock = packet.codeblocks[i];
  18858. let precinct = codeblock.precinct;
  18859. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  18860. const codeblockRow = codeblock.cby - precinct.cbyMin;
  18861. let codeblockIncluded = false;
  18862. let firstTimeInclusion = false;
  18863. let valueReady, zeroBitPlanesTree;
  18864. if (codeblock.included !== undefined) {
  18865. codeblockIncluded = !!readBits(1);
  18866. } else {
  18867. precinct = codeblock.precinct;
  18868. let inclusionTree;
  18869. if (precinct.inclusionTree !== undefined) {
  18870. inclusionTree = precinct.inclusionTree;
  18871. } else {
  18872. const width = precinct.cbxMax - precinct.cbxMin + 1;
  18873. const height = precinct.cbyMax - precinct.cbyMin + 1;
  18874. inclusionTree = new InclusionTree(width, height, layerNumber);
  18875. zeroBitPlanesTree = new TagTree(width, height);
  18876. precinct.inclusionTree = inclusionTree;
  18877. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  18878. for (let l = 0; l < layerNumber; l++) {
  18879. if (readBits(1) !== 0) {
  18880. throw new JpxError("Invalid tag tree");
  18881. }
  18882. }
  18883. }
  18884. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  18885. while (true) {
  18886. if (readBits(1)) {
  18887. valueReady = !inclusionTree.nextLevel();
  18888. if (valueReady) {
  18889. codeblock.included = true;
  18890. codeblockIncluded = firstTimeInclusion = true;
  18891. break;
  18892. }
  18893. } else {
  18894. inclusionTree.incrementValue(layerNumber);
  18895. break;
  18896. }
  18897. }
  18898. }
  18899. }
  18900. if (!codeblockIncluded) {
  18901. continue;
  18902. }
  18903. if (firstTimeInclusion) {
  18904. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  18905. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  18906. while (true) {
  18907. if (readBits(1)) {
  18908. valueReady = !zeroBitPlanesTree.nextLevel();
  18909. if (valueReady) {
  18910. break;
  18911. }
  18912. } else {
  18913. zeroBitPlanesTree.incrementValue();
  18914. }
  18915. }
  18916. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  18917. }
  18918. const codingpasses = readCodingpasses();
  18919. while (readBits(1)) {
  18920. codeblock.Lblock++;
  18921. }
  18922. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  18923. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  18924. const codedDataLength = readBits(bits);
  18925. queue.push({
  18926. codeblock,
  18927. codingpasses,
  18928. dataLength: codedDataLength
  18929. });
  18930. }
  18931. alignToByte();
  18932. if (ephMarkerUsed) {
  18933. skipMarkerIfEqual(0x92);
  18934. }
  18935. while (queue.length > 0) {
  18936. const packetItem = queue.shift();
  18937. codeblock = packetItem.codeblock;
  18938. if (codeblock.data === undefined) {
  18939. codeblock.data = [];
  18940. }
  18941. codeblock.data.push({
  18942. data,
  18943. start: offset + position,
  18944. end: offset + position + packetItem.dataLength,
  18945. codingpasses: packetItem.codingpasses
  18946. });
  18947. position += packetItem.dataLength;
  18948. }
  18949. }
  18950. return position;
  18951. }
  18952. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  18953. const x0 = subband.tbx0;
  18954. const y0 = subband.tby0;
  18955. const width = subband.tbx1 - subband.tbx0;
  18956. const codeblocks = subband.codeblocks;
  18957. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  18958. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  18959. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  18960. const codeblock = codeblocks[i];
  18961. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  18962. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  18963. if (blockWidth === 0 || blockHeight === 0) {
  18964. continue;
  18965. }
  18966. if (codeblock.data === undefined) {
  18967. continue;
  18968. }
  18969. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  18970. let currentCodingpassType = 2;
  18971. const data = codeblock.data;
  18972. let totalLength = 0,
  18973. codingpasses = 0;
  18974. let j, jj, dataItem;
  18975. for (j = 0, jj = data.length; j < jj; j++) {
  18976. dataItem = data[j];
  18977. totalLength += dataItem.end - dataItem.start;
  18978. codingpasses += dataItem.codingpasses;
  18979. }
  18980. const encodedData = new Uint8Array(totalLength);
  18981. let position = 0;
  18982. for (j = 0, jj = data.length; j < jj; j++) {
  18983. dataItem = data[j];
  18984. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  18985. encodedData.set(chunk, position);
  18986. position += chunk.length;
  18987. }
  18988. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  18989. bitModel.setDecoder(decoder);
  18990. for (j = 0; j < codingpasses; j++) {
  18991. switch (currentCodingpassType) {
  18992. case 0:
  18993. bitModel.runSignificancePropagationPass();
  18994. break;
  18995. case 1:
  18996. bitModel.runMagnitudeRefinementPass();
  18997. break;
  18998. case 2:
  18999. bitModel.runCleanupPass();
  19000. if (segmentationSymbolUsed) {
  19001. bitModel.checkSegmentationSymbol();
  19002. }
  19003. break;
  19004. }
  19005. if (resetContextProbabilities) {
  19006. bitModel.reset();
  19007. }
  19008. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19009. }
  19010. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19011. const sign = bitModel.coefficentsSign;
  19012. const magnitude = bitModel.coefficentsMagnitude;
  19013. const bitsDecoded = bitModel.bitsDecoded;
  19014. const magnitudeCorrection = reversible ? 0 : 0.5;
  19015. let k, n, nb;
  19016. position = 0;
  19017. const interleave = subband.type !== "LL";
  19018. for (j = 0; j < blockHeight; j++) {
  19019. const row = offset / width | 0;
  19020. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19021. for (k = 0; k < blockWidth; k++) {
  19022. n = magnitude[position];
  19023. if (n !== 0) {
  19024. n = (n + magnitudeCorrection) * delta;
  19025. if (sign[position] !== 0) {
  19026. n = -n;
  19027. }
  19028. nb = bitsDecoded[position];
  19029. const pos = interleave ? levelOffset + (offset << 1) : offset;
  19030. if (reversible && nb >= mb) {
  19031. coefficients[pos] = n;
  19032. } else {
  19033. coefficients[pos] = n * (1 << mb - nb);
  19034. }
  19035. }
  19036. offset++;
  19037. position++;
  19038. }
  19039. offset += width - blockWidth;
  19040. }
  19041. }
  19042. }
  19043. function transformTile(context, tile, c) {
  19044. const component = tile.components[c];
  19045. const codingStyleParameters = component.codingStyleParameters;
  19046. const quantizationParameters = component.quantizationParameters;
  19047. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19048. const spqcds = quantizationParameters.SPqcds;
  19049. const scalarExpounded = quantizationParameters.scalarExpounded;
  19050. const guardBits = quantizationParameters.guardBits;
  19051. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19052. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  19053. const precision = context.components[c].precision;
  19054. const reversible = codingStyleParameters.reversibleTransformation;
  19055. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19056. const subbandCoefficients = [];
  19057. let b = 0;
  19058. for (let i = 0; i <= decompositionLevelsCount; i++) {
  19059. const resolution = component.resolutions[i];
  19060. const width = resolution.trx1 - resolution.trx0;
  19061. const height = resolution.try1 - resolution.try0;
  19062. const coefficients = new Float32Array(width * height);
  19063. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19064. let mu, epsilon;
  19065. if (!scalarExpounded) {
  19066. mu = spqcds[0].mu;
  19067. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19068. } else {
  19069. mu = spqcds[b].mu;
  19070. epsilon = spqcds[b].epsilon;
  19071. b++;
  19072. }
  19073. const subband = resolution.subbands[j];
  19074. const gainLog2 = SubbandsGainLog2[subband.type];
  19075. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19076. const mb = guardBits + epsilon - 1;
  19077. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  19078. }
  19079. subbandCoefficients.push({
  19080. width,
  19081. height,
  19082. items: coefficients
  19083. });
  19084. }
  19085. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19086. return {
  19087. left: component.tcx0,
  19088. top: component.tcy0,
  19089. width: result.width,
  19090. height: result.height,
  19091. items: result.items
  19092. };
  19093. }
  19094. function transformComponents(context) {
  19095. const siz = context.SIZ;
  19096. const components = context.components;
  19097. const componentsCount = siz.Csiz;
  19098. const resultImages = [];
  19099. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  19100. const tile = context.tiles[i];
  19101. const transformedTiles = [];
  19102. for (let c = 0; c < componentsCount; c++) {
  19103. transformedTiles[c] = transformTile(context, tile, c);
  19104. }
  19105. const tile0 = transformedTiles[0];
  19106. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  19107. const result = {
  19108. left: tile0.left,
  19109. top: tile0.top,
  19110. width: tile0.width,
  19111. height: tile0.height,
  19112. items: out
  19113. };
  19114. let shift, offset;
  19115. let pos = 0,
  19116. j,
  19117. jj,
  19118. y0,
  19119. y1,
  19120. y2;
  19121. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19122. const fourComponents = componentsCount === 4;
  19123. const y0items = transformedTiles[0].items;
  19124. const y1items = transformedTiles[1].items;
  19125. const y2items = transformedTiles[2].items;
  19126. const y3items = fourComponents ? transformedTiles[3].items : null;
  19127. shift = components[0].precision - 8;
  19128. offset = (128 << shift) + 0.5;
  19129. const component0 = tile.components[0];
  19130. const alpha01 = componentsCount - 3;
  19131. jj = y0items.length;
  19132. if (!component0.codingStyleParameters.reversibleTransformation) {
  19133. for (j = 0; j < jj; j++, pos += alpha01) {
  19134. y0 = y0items[j] + offset;
  19135. y1 = y1items[j];
  19136. y2 = y2items[j];
  19137. out[pos++] = y0 + 1.402 * y2 >> shift;
  19138. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  19139. out[pos++] = y0 + 1.772 * y1 >> shift;
  19140. }
  19141. } else {
  19142. for (j = 0; j < jj; j++, pos += alpha01) {
  19143. y0 = y0items[j] + offset;
  19144. y1 = y1items[j];
  19145. y2 = y2items[j];
  19146. const g = y0 - (y2 + y1 >> 2);
  19147. out[pos++] = g + y2 >> shift;
  19148. out[pos++] = g >> shift;
  19149. out[pos++] = g + y1 >> shift;
  19150. }
  19151. }
  19152. if (fourComponents) {
  19153. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19154. out[pos] = y3items[j] + offset >> shift;
  19155. }
  19156. }
  19157. } else {
  19158. for (let c = 0; c < componentsCount; c++) {
  19159. const items = transformedTiles[c].items;
  19160. shift = components[c].precision - 8;
  19161. offset = (128 << shift) + 0.5;
  19162. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19163. out[pos] = items[j] + offset >> shift;
  19164. pos += componentsCount;
  19165. }
  19166. }
  19167. }
  19168. resultImages.push(result);
  19169. }
  19170. return resultImages;
  19171. }
  19172. function initializeTile(context, tileIndex) {
  19173. const siz = context.SIZ;
  19174. const componentsCount = siz.Csiz;
  19175. const tile = context.tiles[tileIndex];
  19176. for (let c = 0; c < componentsCount; c++) {
  19177. const component = tile.components[c];
  19178. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19179. component.quantizationParameters = qcdOrQcc;
  19180. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19181. component.codingStyleParameters = codOrCoc;
  19182. }
  19183. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19184. }
  19185. class TagTree {
  19186. constructor(width, height) {
  19187. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19188. this.levels = [];
  19189. for (let i = 0; i < levelsLength; i++) {
  19190. const level = {
  19191. width,
  19192. height,
  19193. items: []
  19194. };
  19195. this.levels.push(level);
  19196. width = Math.ceil(width / 2);
  19197. height = Math.ceil(height / 2);
  19198. }
  19199. }
  19200. reset(i, j) {
  19201. let currentLevel = 0,
  19202. value = 0,
  19203. level;
  19204. while (currentLevel < this.levels.length) {
  19205. level = this.levels[currentLevel];
  19206. const index = i + j * level.width;
  19207. if (level.items[index] !== undefined) {
  19208. value = level.items[index];
  19209. break;
  19210. }
  19211. level.index = index;
  19212. i >>= 1;
  19213. j >>= 1;
  19214. currentLevel++;
  19215. }
  19216. currentLevel--;
  19217. level = this.levels[currentLevel];
  19218. level.items[level.index] = value;
  19219. this.currentLevel = currentLevel;
  19220. delete this.value;
  19221. }
  19222. incrementValue() {
  19223. const level = this.levels[this.currentLevel];
  19224. level.items[level.index]++;
  19225. }
  19226. nextLevel() {
  19227. let currentLevel = this.currentLevel;
  19228. let level = this.levels[currentLevel];
  19229. const value = level.items[level.index];
  19230. currentLevel--;
  19231. if (currentLevel < 0) {
  19232. this.value = value;
  19233. return false;
  19234. }
  19235. this.currentLevel = currentLevel;
  19236. level = this.levels[currentLevel];
  19237. level.items[level.index] = value;
  19238. return true;
  19239. }
  19240. }
  19241. class InclusionTree {
  19242. constructor(width, height, defaultValue) {
  19243. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19244. this.levels = [];
  19245. for (let i = 0; i < levelsLength; i++) {
  19246. const items = new Uint8Array(width * height);
  19247. for (let j = 0, jj = items.length; j < jj; j++) {
  19248. items[j] = defaultValue;
  19249. }
  19250. const level = {
  19251. width,
  19252. height,
  19253. items
  19254. };
  19255. this.levels.push(level);
  19256. width = Math.ceil(width / 2);
  19257. height = Math.ceil(height / 2);
  19258. }
  19259. }
  19260. reset(i, j, stopValue) {
  19261. let currentLevel = 0;
  19262. while (currentLevel < this.levels.length) {
  19263. const level = this.levels[currentLevel];
  19264. const index = i + j * level.width;
  19265. level.index = index;
  19266. const value = level.items[index];
  19267. if (value === 0xff) {
  19268. break;
  19269. }
  19270. if (value > stopValue) {
  19271. this.currentLevel = currentLevel;
  19272. this.propagateValues();
  19273. return false;
  19274. }
  19275. i >>= 1;
  19276. j >>= 1;
  19277. currentLevel++;
  19278. }
  19279. this.currentLevel = currentLevel - 1;
  19280. return true;
  19281. }
  19282. incrementValue(stopValue) {
  19283. const level = this.levels[this.currentLevel];
  19284. level.items[level.index] = stopValue + 1;
  19285. this.propagateValues();
  19286. }
  19287. propagateValues() {
  19288. let levelIndex = this.currentLevel;
  19289. let level = this.levels[levelIndex];
  19290. const currentValue = level.items[level.index];
  19291. while (--levelIndex >= 0) {
  19292. level = this.levels[levelIndex];
  19293. level.items[level.index] = currentValue;
  19294. }
  19295. }
  19296. nextLevel() {
  19297. let currentLevel = this.currentLevel;
  19298. let level = this.levels[currentLevel];
  19299. const value = level.items[level.index];
  19300. level.items[level.index] = 0xff;
  19301. currentLevel--;
  19302. if (currentLevel < 0) {
  19303. return false;
  19304. }
  19305. this.currentLevel = currentLevel;
  19306. level = this.levels[currentLevel];
  19307. level.items[level.index] = value;
  19308. return true;
  19309. }
  19310. }
  19311. const BitModel = function BitModelClosure() {
  19312. const UNIFORM_CONTEXT = 17;
  19313. const RUNLENGTH_CONTEXT = 18;
  19314. 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]);
  19315. 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]);
  19316. 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]);
  19317. class BitModel {
  19318. constructor(width, height, subband, zeroBitPlanes, mb) {
  19319. this.width = width;
  19320. this.height = height;
  19321. let contextLabelTable;
  19322. if (subband === "HH") {
  19323. contextLabelTable = HHContextLabel;
  19324. } else if (subband === "HL") {
  19325. contextLabelTable = HLContextLabel;
  19326. } else {
  19327. contextLabelTable = LLAndLHContextsLabel;
  19328. }
  19329. this.contextLabelTable = contextLabelTable;
  19330. const coefficientCount = width * height;
  19331. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19332. this.coefficentsSign = new Uint8Array(coefficientCount);
  19333. let coefficentsMagnitude;
  19334. if (mb > 14) {
  19335. coefficentsMagnitude = new Uint32Array(coefficientCount);
  19336. } else if (mb > 6) {
  19337. coefficentsMagnitude = new Uint16Array(coefficientCount);
  19338. } else {
  19339. coefficentsMagnitude = new Uint8Array(coefficientCount);
  19340. }
  19341. this.coefficentsMagnitude = coefficentsMagnitude;
  19342. this.processingFlags = new Uint8Array(coefficientCount);
  19343. const bitsDecoded = new Uint8Array(coefficientCount);
  19344. if (zeroBitPlanes !== 0) {
  19345. for (let i = 0; i < coefficientCount; i++) {
  19346. bitsDecoded[i] = zeroBitPlanes;
  19347. }
  19348. }
  19349. this.bitsDecoded = bitsDecoded;
  19350. this.reset();
  19351. }
  19352. setDecoder(decoder) {
  19353. this.decoder = decoder;
  19354. }
  19355. reset() {
  19356. this.contexts = new Int8Array(19);
  19357. this.contexts[0] = 4 << 1 | 0;
  19358. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19359. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19360. }
  19361. setNeighborsSignificance(row, column, index) {
  19362. const neighborsSignificance = this.neighborsSignificance;
  19363. const width = this.width,
  19364. height = this.height;
  19365. const left = column > 0;
  19366. const right = column + 1 < width;
  19367. let i;
  19368. if (row > 0) {
  19369. i = index - width;
  19370. if (left) {
  19371. neighborsSignificance[i - 1] += 0x10;
  19372. }
  19373. if (right) {
  19374. neighborsSignificance[i + 1] += 0x10;
  19375. }
  19376. neighborsSignificance[i] += 0x04;
  19377. }
  19378. if (row + 1 < height) {
  19379. i = index + width;
  19380. if (left) {
  19381. neighborsSignificance[i - 1] += 0x10;
  19382. }
  19383. if (right) {
  19384. neighborsSignificance[i + 1] += 0x10;
  19385. }
  19386. neighborsSignificance[i] += 0x04;
  19387. }
  19388. if (left) {
  19389. neighborsSignificance[index - 1] += 0x01;
  19390. }
  19391. if (right) {
  19392. neighborsSignificance[index + 1] += 0x01;
  19393. }
  19394. neighborsSignificance[index] |= 0x80;
  19395. }
  19396. runSignificancePropagationPass() {
  19397. const decoder = this.decoder;
  19398. const width = this.width,
  19399. height = this.height;
  19400. const coefficentsMagnitude = this.coefficentsMagnitude;
  19401. const coefficentsSign = this.coefficentsSign;
  19402. const neighborsSignificance = this.neighborsSignificance;
  19403. const processingFlags = this.processingFlags;
  19404. const contexts = this.contexts;
  19405. const labels = this.contextLabelTable;
  19406. const bitsDecoded = this.bitsDecoded;
  19407. const processedInverseMask = ~1;
  19408. const processedMask = 1;
  19409. const firstMagnitudeBitMask = 2;
  19410. for (let i0 = 0; i0 < height; i0 += 4) {
  19411. for (let j = 0; j < width; j++) {
  19412. let index = i0 * width + j;
  19413. for (let i1 = 0; i1 < 4; i1++, index += width) {
  19414. const i = i0 + i1;
  19415. if (i >= height) {
  19416. break;
  19417. }
  19418. processingFlags[index] &= processedInverseMask;
  19419. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19420. continue;
  19421. }
  19422. const contextLabel = labels[neighborsSignificance[index]];
  19423. const decision = decoder.readBit(contexts, contextLabel);
  19424. if (decision) {
  19425. const sign = this.decodeSignBit(i, j, index);
  19426. coefficentsSign[index] = sign;
  19427. coefficentsMagnitude[index] = 1;
  19428. this.setNeighborsSignificance(i, j, index);
  19429. processingFlags[index] |= firstMagnitudeBitMask;
  19430. }
  19431. bitsDecoded[index]++;
  19432. processingFlags[index] |= processedMask;
  19433. }
  19434. }
  19435. }
  19436. }
  19437. decodeSignBit(row, column, index) {
  19438. const width = this.width,
  19439. height = this.height;
  19440. const coefficentsMagnitude = this.coefficentsMagnitude;
  19441. const coefficentsSign = this.coefficentsSign;
  19442. let contribution, sign0, sign1, significance1;
  19443. let contextLabel, decoded;
  19444. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19445. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19446. sign1 = coefficentsSign[index + 1];
  19447. if (significance1) {
  19448. sign0 = coefficentsSign[index - 1];
  19449. contribution = 1 - sign1 - sign0;
  19450. } else {
  19451. contribution = 1 - sign1 - sign1;
  19452. }
  19453. } else if (significance1) {
  19454. sign0 = coefficentsSign[index - 1];
  19455. contribution = 1 - sign0 - sign0;
  19456. } else {
  19457. contribution = 0;
  19458. }
  19459. const horizontalContribution = 3 * contribution;
  19460. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19461. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19462. sign1 = coefficentsSign[index + width];
  19463. if (significance1) {
  19464. sign0 = coefficentsSign[index - width];
  19465. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19466. } else {
  19467. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19468. }
  19469. } else if (significance1) {
  19470. sign0 = coefficentsSign[index - width];
  19471. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19472. } else {
  19473. contribution = horizontalContribution;
  19474. }
  19475. if (contribution >= 0) {
  19476. contextLabel = 9 + contribution;
  19477. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19478. } else {
  19479. contextLabel = 9 - contribution;
  19480. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19481. }
  19482. return decoded;
  19483. }
  19484. runMagnitudeRefinementPass() {
  19485. const decoder = this.decoder;
  19486. const width = this.width,
  19487. height = this.height;
  19488. const coefficentsMagnitude = this.coefficentsMagnitude;
  19489. const neighborsSignificance = this.neighborsSignificance;
  19490. const contexts = this.contexts;
  19491. const bitsDecoded = this.bitsDecoded;
  19492. const processingFlags = this.processingFlags;
  19493. const processedMask = 1;
  19494. const firstMagnitudeBitMask = 2;
  19495. const length = width * height;
  19496. const width4 = width * 4;
  19497. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19498. indexNext = Math.min(length, index0 + width4);
  19499. for (let j = 0; j < width; j++) {
  19500. for (let index = index0 + j; index < indexNext; index += width) {
  19501. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19502. continue;
  19503. }
  19504. let contextLabel = 16;
  19505. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19506. processingFlags[index] ^= firstMagnitudeBitMask;
  19507. const significance = neighborsSignificance[index] & 127;
  19508. contextLabel = significance === 0 ? 15 : 14;
  19509. }
  19510. const bit = decoder.readBit(contexts, contextLabel);
  19511. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19512. bitsDecoded[index]++;
  19513. processingFlags[index] |= processedMask;
  19514. }
  19515. }
  19516. }
  19517. }
  19518. runCleanupPass() {
  19519. const decoder = this.decoder;
  19520. const width = this.width,
  19521. height = this.height;
  19522. const neighborsSignificance = this.neighborsSignificance;
  19523. const coefficentsMagnitude = this.coefficentsMagnitude;
  19524. const coefficentsSign = this.coefficentsSign;
  19525. const contexts = this.contexts;
  19526. const labels = this.contextLabelTable;
  19527. const bitsDecoded = this.bitsDecoded;
  19528. const processingFlags = this.processingFlags;
  19529. const processedMask = 1;
  19530. const firstMagnitudeBitMask = 2;
  19531. const oneRowDown = width;
  19532. const twoRowsDown = width * 2;
  19533. const threeRowsDown = width * 3;
  19534. let iNext;
  19535. for (let i0 = 0; i0 < height; i0 = iNext) {
  19536. iNext = Math.min(i0 + 4, height);
  19537. const indexBase = i0 * width;
  19538. const checkAllEmpty = i0 + 3 < height;
  19539. for (let j = 0; j < width; j++) {
  19540. const index0 = indexBase + j;
  19541. 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;
  19542. let i1 = 0,
  19543. index = index0;
  19544. let i = i0,
  19545. sign;
  19546. if (allEmpty) {
  19547. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19548. if (!hasSignificantCoefficent) {
  19549. bitsDecoded[index0]++;
  19550. bitsDecoded[index0 + oneRowDown]++;
  19551. bitsDecoded[index0 + twoRowsDown]++;
  19552. bitsDecoded[index0 + threeRowsDown]++;
  19553. continue;
  19554. }
  19555. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19556. if (i1 !== 0) {
  19557. i = i0 + i1;
  19558. index += i1 * width;
  19559. }
  19560. sign = this.decodeSignBit(i, j, index);
  19561. coefficentsSign[index] = sign;
  19562. coefficentsMagnitude[index] = 1;
  19563. this.setNeighborsSignificance(i, j, index);
  19564. processingFlags[index] |= firstMagnitudeBitMask;
  19565. index = index0;
  19566. for (let i2 = i0; i2 <= i; i2++, index += width) {
  19567. bitsDecoded[index]++;
  19568. }
  19569. i1++;
  19570. }
  19571. for (i = i0 + i1; i < iNext; i++, index += width) {
  19572. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19573. continue;
  19574. }
  19575. const contextLabel = labels[neighborsSignificance[index]];
  19576. const decision = decoder.readBit(contexts, contextLabel);
  19577. if (decision === 1) {
  19578. sign = this.decodeSignBit(i, j, index);
  19579. coefficentsSign[index] = sign;
  19580. coefficentsMagnitude[index] = 1;
  19581. this.setNeighborsSignificance(i, j, index);
  19582. processingFlags[index] |= firstMagnitudeBitMask;
  19583. }
  19584. bitsDecoded[index]++;
  19585. }
  19586. }
  19587. }
  19588. }
  19589. checkSegmentationSymbol() {
  19590. const decoder = this.decoder;
  19591. const contexts = this.contexts;
  19592. 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);
  19593. if (symbol !== 0xa) {
  19594. throw new JpxError("Invalid segmentation symbol");
  19595. }
  19596. }
  19597. }
  19598. return BitModel;
  19599. }();
  19600. class Transform {
  19601. constructor() {
  19602. if (this.constructor === Transform) {
  19603. (0, _util.unreachable)("Cannot initialize Transform.");
  19604. }
  19605. }
  19606. calculate(subbands, u0, v0) {
  19607. let ll = subbands[0];
  19608. for (let i = 1, ii = subbands.length; i < ii; i++) {
  19609. ll = this.iterate(ll, subbands[i], u0, v0);
  19610. }
  19611. return ll;
  19612. }
  19613. extend(buffer, offset, size) {
  19614. let i1 = offset - 1,
  19615. j1 = offset + 1;
  19616. let i2 = offset + size - 2,
  19617. j2 = offset + size;
  19618. buffer[i1--] = buffer[j1++];
  19619. buffer[j2++] = buffer[i2--];
  19620. buffer[i1--] = buffer[j1++];
  19621. buffer[j2++] = buffer[i2--];
  19622. buffer[i1--] = buffer[j1++];
  19623. buffer[j2++] = buffer[i2--];
  19624. buffer[i1] = buffer[j1];
  19625. buffer[j2] = buffer[i2];
  19626. }
  19627. filter(x, offset, length) {
  19628. (0, _util.unreachable)("Abstract method `filter` called");
  19629. }
  19630. iterate(ll, hl_lh_hh, u0, v0) {
  19631. const llWidth = ll.width,
  19632. llHeight = ll.height;
  19633. let llItems = ll.items;
  19634. const width = hl_lh_hh.width;
  19635. const height = hl_lh_hh.height;
  19636. const items = hl_lh_hh.items;
  19637. let i, j, k, l, u, v;
  19638. for (k = 0, i = 0; i < llHeight; i++) {
  19639. l = i * 2 * width;
  19640. for (j = 0; j < llWidth; j++, k++, l += 2) {
  19641. items[l] = llItems[k];
  19642. }
  19643. }
  19644. llItems = ll.items = null;
  19645. const bufferPadding = 4;
  19646. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  19647. if (width === 1) {
  19648. if ((u0 & 1) !== 0) {
  19649. for (v = 0, k = 0; v < height; v++, k += width) {
  19650. items[k] *= 0.5;
  19651. }
  19652. }
  19653. } else {
  19654. for (v = 0, k = 0; v < height; v++, k += width) {
  19655. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  19656. this.extend(rowBuffer, bufferPadding, width);
  19657. this.filter(rowBuffer, bufferPadding, width);
  19658. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  19659. }
  19660. }
  19661. let numBuffers = 16;
  19662. const colBuffers = [];
  19663. for (i = 0; i < numBuffers; i++) {
  19664. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  19665. }
  19666. let b,
  19667. currentBuffer = 0;
  19668. ll = bufferPadding + height;
  19669. if (height === 1) {
  19670. if ((v0 & 1) !== 0) {
  19671. for (u = 0; u < width; u++) {
  19672. items[u] *= 0.5;
  19673. }
  19674. }
  19675. } else {
  19676. for (u = 0; u < width; u++) {
  19677. if (currentBuffer === 0) {
  19678. numBuffers = Math.min(width - u, numBuffers);
  19679. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  19680. for (b = 0; b < numBuffers; b++) {
  19681. colBuffers[b][l] = items[k + b];
  19682. }
  19683. }
  19684. currentBuffer = numBuffers;
  19685. }
  19686. currentBuffer--;
  19687. const buffer = colBuffers[currentBuffer];
  19688. this.extend(buffer, bufferPadding, height);
  19689. this.filter(buffer, bufferPadding, height);
  19690. if (currentBuffer === 0) {
  19691. k = u - numBuffers + 1;
  19692. for (l = bufferPadding; l < ll; k += width, l++) {
  19693. for (b = 0; b < numBuffers; b++) {
  19694. items[k + b] = colBuffers[b][l];
  19695. }
  19696. }
  19697. }
  19698. }
  19699. }
  19700. return {
  19701. width,
  19702. height,
  19703. items
  19704. };
  19705. }
  19706. }
  19707. class IrreversibleTransform extends Transform {
  19708. filter(x, offset, length) {
  19709. const len = length >> 1;
  19710. offset |= 0;
  19711. let j, n, current, next;
  19712. const alpha = -1.586134342059924;
  19713. const beta = -0.052980118572961;
  19714. const gamma = 0.882911075530934;
  19715. const delta = 0.443506852043971;
  19716. const K = 1.230174104914001;
  19717. const K_ = 1 / K;
  19718. j = offset - 3;
  19719. for (n = len + 4; n--; j += 2) {
  19720. x[j] *= K_;
  19721. }
  19722. j = offset - 2;
  19723. current = delta * x[j - 1];
  19724. for (n = len + 3; n--; j += 2) {
  19725. next = delta * x[j + 1];
  19726. x[j] = K * x[j] - current - next;
  19727. if (n--) {
  19728. j += 2;
  19729. current = delta * x[j + 1];
  19730. x[j] = K * x[j] - current - next;
  19731. } else {
  19732. break;
  19733. }
  19734. }
  19735. j = offset - 1;
  19736. current = gamma * x[j - 1];
  19737. for (n = len + 2; n--; j += 2) {
  19738. next = gamma * x[j + 1];
  19739. x[j] -= current + next;
  19740. if (n--) {
  19741. j += 2;
  19742. current = gamma * x[j + 1];
  19743. x[j] -= current + next;
  19744. } else {
  19745. break;
  19746. }
  19747. }
  19748. j = offset;
  19749. current = beta * x[j - 1];
  19750. for (n = len + 1; n--; j += 2) {
  19751. next = beta * x[j + 1];
  19752. x[j] -= current + next;
  19753. if (n--) {
  19754. j += 2;
  19755. current = beta * x[j + 1];
  19756. x[j] -= current + next;
  19757. } else {
  19758. break;
  19759. }
  19760. }
  19761. if (len !== 0) {
  19762. j = offset + 1;
  19763. current = alpha * x[j - 1];
  19764. for (n = len; n--; j += 2) {
  19765. next = alpha * x[j + 1];
  19766. x[j] -= current + next;
  19767. if (n--) {
  19768. j += 2;
  19769. current = alpha * x[j + 1];
  19770. x[j] -= current + next;
  19771. } else {
  19772. break;
  19773. }
  19774. }
  19775. }
  19776. }
  19777. }
  19778. class ReversibleTransform extends Transform {
  19779. filter(x, offset, length) {
  19780. const len = length >> 1;
  19781. offset |= 0;
  19782. let j, n;
  19783. for (j = offset, n = len + 1; n--; j += 2) {
  19784. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  19785. }
  19786. for (j = offset + 1, n = len; n--; j += 2) {
  19787. x[j] += x[j - 1] + x[j + 1] >> 1;
  19788. }
  19789. }
  19790. }
  19791. /***/ }),
  19792. /* 29 */
  19793. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19794. Object.defineProperty(exports, "__esModule", ({
  19795. value: true
  19796. }));
  19797. exports.LZWStream = void 0;
  19798. var _decode_stream = __w_pdfjs_require__(17);
  19799. class LZWStream extends _decode_stream.DecodeStream {
  19800. constructor(str, maybeLength, earlyChange) {
  19801. super(maybeLength);
  19802. this.str = str;
  19803. this.dict = str.dict;
  19804. this.cachedData = 0;
  19805. this.bitsCached = 0;
  19806. const maxLzwDictionarySize = 4096;
  19807. const lzwState = {
  19808. earlyChange,
  19809. codeLength: 9,
  19810. nextCode: 258,
  19811. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  19812. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  19813. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  19814. currentSequence: new Uint8Array(maxLzwDictionarySize),
  19815. currentSequenceLength: 0
  19816. };
  19817. for (let i = 0; i < 256; ++i) {
  19818. lzwState.dictionaryValues[i] = i;
  19819. lzwState.dictionaryLengths[i] = 1;
  19820. }
  19821. this.lzwState = lzwState;
  19822. }
  19823. readBits(n) {
  19824. let bitsCached = this.bitsCached;
  19825. let cachedData = this.cachedData;
  19826. while (bitsCached < n) {
  19827. const c = this.str.getByte();
  19828. if (c === -1) {
  19829. this.eof = true;
  19830. return null;
  19831. }
  19832. cachedData = cachedData << 8 | c;
  19833. bitsCached += 8;
  19834. }
  19835. this.bitsCached = bitsCached -= n;
  19836. this.cachedData = cachedData;
  19837. this.lastCode = null;
  19838. return cachedData >>> bitsCached & (1 << n) - 1;
  19839. }
  19840. readBlock() {
  19841. const blockSize = 512,
  19842. decodedSizeDelta = blockSize;
  19843. let estimatedDecodedSize = blockSize * 2;
  19844. let i, j, q;
  19845. const lzwState = this.lzwState;
  19846. if (!lzwState) {
  19847. return;
  19848. }
  19849. const earlyChange = lzwState.earlyChange;
  19850. let nextCode = lzwState.nextCode;
  19851. const dictionaryValues = lzwState.dictionaryValues;
  19852. const dictionaryLengths = lzwState.dictionaryLengths;
  19853. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  19854. let codeLength = lzwState.codeLength;
  19855. let prevCode = lzwState.prevCode;
  19856. const currentSequence = lzwState.currentSequence;
  19857. let currentSequenceLength = lzwState.currentSequenceLength;
  19858. let decodedLength = 0;
  19859. let currentBufferLength = this.bufferLength;
  19860. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  19861. for (i = 0; i < blockSize; i++) {
  19862. const code = this.readBits(codeLength);
  19863. const hasPrev = currentSequenceLength > 0;
  19864. if (code < 256) {
  19865. currentSequence[0] = code;
  19866. currentSequenceLength = 1;
  19867. } else if (code >= 258) {
  19868. if (code < nextCode) {
  19869. currentSequenceLength = dictionaryLengths[code];
  19870. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  19871. currentSequence[j] = dictionaryValues[q];
  19872. q = dictionaryPrevCodes[q];
  19873. }
  19874. } else {
  19875. currentSequence[currentSequenceLength++] = currentSequence[0];
  19876. }
  19877. } else if (code === 256) {
  19878. codeLength = 9;
  19879. nextCode = 258;
  19880. currentSequenceLength = 0;
  19881. continue;
  19882. } else {
  19883. this.eof = true;
  19884. delete this.lzwState;
  19885. break;
  19886. }
  19887. if (hasPrev) {
  19888. dictionaryPrevCodes[nextCode] = prevCode;
  19889. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  19890. dictionaryValues[nextCode] = currentSequence[0];
  19891. nextCode++;
  19892. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  19893. }
  19894. prevCode = code;
  19895. decodedLength += currentSequenceLength;
  19896. if (estimatedDecodedSize < decodedLength) {
  19897. do {
  19898. estimatedDecodedSize += decodedSizeDelta;
  19899. } while (estimatedDecodedSize < decodedLength);
  19900. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  19901. }
  19902. for (j = 0; j < currentSequenceLength; j++) {
  19903. buffer[currentBufferLength++] = currentSequence[j];
  19904. }
  19905. }
  19906. lzwState.nextCode = nextCode;
  19907. lzwState.codeLength = codeLength;
  19908. lzwState.prevCode = prevCode;
  19909. lzwState.currentSequenceLength = currentSequenceLength;
  19910. this.bufferLength = currentBufferLength;
  19911. }
  19912. }
  19913. exports.LZWStream = LZWStream;
  19914. /***/ }),
  19915. /* 30 */
  19916. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19917. Object.defineProperty(exports, "__esModule", ({
  19918. value: true
  19919. }));
  19920. exports.PredictorStream = void 0;
  19921. var _decode_stream = __w_pdfjs_require__(17);
  19922. var _primitives = __w_pdfjs_require__(3);
  19923. var _util = __w_pdfjs_require__(2);
  19924. class PredictorStream extends _decode_stream.DecodeStream {
  19925. constructor(str, maybeLength, params) {
  19926. super(maybeLength);
  19927. if (!(params instanceof _primitives.Dict)) {
  19928. return str;
  19929. }
  19930. const predictor = this.predictor = params.get("Predictor") || 1;
  19931. if (predictor <= 1) {
  19932. return str;
  19933. }
  19934. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  19935. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  19936. }
  19937. if (predictor === 2) {
  19938. this.readBlock = this.readBlockTiff;
  19939. } else {
  19940. this.readBlock = this.readBlockPng;
  19941. }
  19942. this.str = str;
  19943. this.dict = str.dict;
  19944. const colors = this.colors = params.get("Colors") || 1;
  19945. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  19946. const columns = this.columns = params.get("Columns") || 1;
  19947. this.pixBytes = colors * bits + 7 >> 3;
  19948. this.rowBytes = columns * colors * bits + 7 >> 3;
  19949. return this;
  19950. }
  19951. readBlockTiff() {
  19952. const rowBytes = this.rowBytes;
  19953. const bufferLength = this.bufferLength;
  19954. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  19955. const bits = this.bits;
  19956. const colors = this.colors;
  19957. const rawBytes = this.str.getBytes(rowBytes);
  19958. this.eof = !rawBytes.length;
  19959. if (this.eof) {
  19960. return;
  19961. }
  19962. let inbuf = 0,
  19963. outbuf = 0;
  19964. let inbits = 0,
  19965. outbits = 0;
  19966. let pos = bufferLength;
  19967. let i;
  19968. if (bits === 1 && colors === 1) {
  19969. for (i = 0; i < rowBytes; ++i) {
  19970. let c = rawBytes[i] ^ inbuf;
  19971. c ^= c >> 1;
  19972. c ^= c >> 2;
  19973. c ^= c >> 4;
  19974. inbuf = (c & 1) << 7;
  19975. buffer[pos++] = c;
  19976. }
  19977. } else if (bits === 8) {
  19978. for (i = 0; i < colors; ++i) {
  19979. buffer[pos++] = rawBytes[i];
  19980. }
  19981. for (; i < rowBytes; ++i) {
  19982. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  19983. pos++;
  19984. }
  19985. } else if (bits === 16) {
  19986. const bytesPerPixel = colors * 2;
  19987. for (i = 0; i < bytesPerPixel; ++i) {
  19988. buffer[pos++] = rawBytes[i];
  19989. }
  19990. for (; i < rowBytes; i += 2) {
  19991. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  19992. buffer[pos++] = sum >> 8 & 0xff;
  19993. buffer[pos++] = sum & 0xff;
  19994. }
  19995. } else {
  19996. const compArray = new Uint8Array(colors + 1);
  19997. const bitMask = (1 << bits) - 1;
  19998. let j = 0,
  19999. k = bufferLength;
  20000. const columns = this.columns;
  20001. for (i = 0; i < columns; ++i) {
  20002. for (let kk = 0; kk < colors; ++kk) {
  20003. if (inbits < bits) {
  20004. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  20005. inbits += 8;
  20006. }
  20007. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  20008. inbits -= bits;
  20009. outbuf = outbuf << bits | compArray[kk];
  20010. outbits += bits;
  20011. if (outbits >= 8) {
  20012. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  20013. outbits -= 8;
  20014. }
  20015. }
  20016. }
  20017. if (outbits > 0) {
  20018. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  20019. }
  20020. }
  20021. this.bufferLength += rowBytes;
  20022. }
  20023. readBlockPng() {
  20024. const rowBytes = this.rowBytes;
  20025. const pixBytes = this.pixBytes;
  20026. const predictor = this.str.getByte();
  20027. const rawBytes = this.str.getBytes(rowBytes);
  20028. this.eof = !rawBytes.length;
  20029. if (this.eof) {
  20030. return;
  20031. }
  20032. const bufferLength = this.bufferLength;
  20033. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20034. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  20035. if (prevRow.length === 0) {
  20036. prevRow = new Uint8Array(rowBytes);
  20037. }
  20038. let i,
  20039. j = bufferLength,
  20040. up,
  20041. c;
  20042. switch (predictor) {
  20043. case 0:
  20044. for (i = 0; i < rowBytes; ++i) {
  20045. buffer[j++] = rawBytes[i];
  20046. }
  20047. break;
  20048. case 1:
  20049. for (i = 0; i < pixBytes; ++i) {
  20050. buffer[j++] = rawBytes[i];
  20051. }
  20052. for (; i < rowBytes; ++i) {
  20053. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  20054. j++;
  20055. }
  20056. break;
  20057. case 2:
  20058. for (i = 0; i < rowBytes; ++i) {
  20059. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  20060. }
  20061. break;
  20062. case 3:
  20063. for (i = 0; i < pixBytes; ++i) {
  20064. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  20065. }
  20066. for (; i < rowBytes; ++i) {
  20067. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  20068. j++;
  20069. }
  20070. break;
  20071. case 4:
  20072. for (i = 0; i < pixBytes; ++i) {
  20073. up = prevRow[i];
  20074. c = rawBytes[i];
  20075. buffer[j++] = up + c;
  20076. }
  20077. for (; i < rowBytes; ++i) {
  20078. up = prevRow[i];
  20079. const upLeft = prevRow[i - pixBytes];
  20080. const left = buffer[j - pixBytes];
  20081. const p = left + up - upLeft;
  20082. let pa = p - left;
  20083. if (pa < 0) {
  20084. pa = -pa;
  20085. }
  20086. let pb = p - up;
  20087. if (pb < 0) {
  20088. pb = -pb;
  20089. }
  20090. let pc = p - upLeft;
  20091. if (pc < 0) {
  20092. pc = -pc;
  20093. }
  20094. c = rawBytes[i];
  20095. if (pa <= pb && pa <= pc) {
  20096. buffer[j++] = left + c;
  20097. } else if (pb <= pc) {
  20098. buffer[j++] = up + c;
  20099. } else {
  20100. buffer[j++] = upLeft + c;
  20101. }
  20102. }
  20103. break;
  20104. default:
  20105. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20106. }
  20107. this.bufferLength += rowBytes;
  20108. }
  20109. }
  20110. exports.PredictorStream = PredictorStream;
  20111. /***/ }),
  20112. /* 31 */
  20113. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20114. Object.defineProperty(exports, "__esModule", ({
  20115. value: true
  20116. }));
  20117. exports.RunLengthStream = void 0;
  20118. var _decode_stream = __w_pdfjs_require__(17);
  20119. class RunLengthStream extends _decode_stream.DecodeStream {
  20120. constructor(str, maybeLength) {
  20121. super(maybeLength);
  20122. this.str = str;
  20123. this.dict = str.dict;
  20124. }
  20125. readBlock() {
  20126. const repeatHeader = this.str.getBytes(2);
  20127. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  20128. this.eof = true;
  20129. return;
  20130. }
  20131. let buffer;
  20132. let bufferLength = this.bufferLength;
  20133. let n = repeatHeader[0];
  20134. if (n < 128) {
  20135. buffer = this.ensureBuffer(bufferLength + n + 1);
  20136. buffer[bufferLength++] = repeatHeader[1];
  20137. if (n > 0) {
  20138. const source = this.str.getBytes(n);
  20139. buffer.set(source, bufferLength);
  20140. bufferLength += n;
  20141. }
  20142. } else {
  20143. n = 257 - n;
  20144. const b = repeatHeader[1];
  20145. buffer = this.ensureBuffer(bufferLength + n + 1);
  20146. for (let i = 0; i < n; i++) {
  20147. buffer[bufferLength++] = b;
  20148. }
  20149. }
  20150. this.bufferLength = bufferLength;
  20151. }
  20152. }
  20153. exports.RunLengthStream = RunLengthStream;
  20154. /***/ }),
  20155. /* 32 */
  20156. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20157. Object.defineProperty(exports, "__esModule", ({
  20158. value: true
  20159. }));
  20160. exports.Font = exports.ErrorFont = void 0;
  20161. var _util = __w_pdfjs_require__(2);
  20162. var _cff_parser = __w_pdfjs_require__(33);
  20163. var _fonts_utils = __w_pdfjs_require__(36);
  20164. var _unicode = __w_pdfjs_require__(38);
  20165. var _glyphlist = __w_pdfjs_require__(37);
  20166. var _encodings = __w_pdfjs_require__(35);
  20167. var _standard_fonts = __w_pdfjs_require__(39);
  20168. var _to_unicode_map = __w_pdfjs_require__(40);
  20169. var _cff_font = __w_pdfjs_require__(41);
  20170. var _font_renderer = __w_pdfjs_require__(42);
  20171. var _metrics = __w_pdfjs_require__(43);
  20172. var _glyf = __w_pdfjs_require__(44);
  20173. var _cmap = __w_pdfjs_require__(14);
  20174. var _opentype_file_builder = __w_pdfjs_require__(45);
  20175. var _core_utils = __w_pdfjs_require__(4);
  20176. var _stream = __w_pdfjs_require__(8);
  20177. var _type1_font = __w_pdfjs_require__(46);
  20178. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20179. const PDF_GLYPH_SPACE_UNITS = 1000;
  20180. 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"];
  20181. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20182. function adjustWidths(properties) {
  20183. if (!properties.fontMatrix) {
  20184. return;
  20185. }
  20186. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20187. return;
  20188. }
  20189. const scale = 0.001 / properties.fontMatrix[0];
  20190. const glyphsWidths = properties.widths;
  20191. for (const glyph in glyphsWidths) {
  20192. glyphsWidths[glyph] *= scale;
  20193. }
  20194. properties.defaultWidth *= scale;
  20195. }
  20196. function adjustToUnicode(properties, builtInEncoding) {
  20197. if (properties.isInternalFont) {
  20198. return;
  20199. }
  20200. if (properties.hasIncludedToUnicodeMap) {
  20201. return;
  20202. }
  20203. if (builtInEncoding === properties.defaultEncoding) {
  20204. return;
  20205. }
  20206. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20207. return;
  20208. }
  20209. const toUnicode = [],
  20210. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20211. for (const charCode in builtInEncoding) {
  20212. if (properties.hasEncoding) {
  20213. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  20214. continue;
  20215. }
  20216. }
  20217. const glyphName = builtInEncoding[charCode];
  20218. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20219. if (unicode !== -1) {
  20220. toUnicode[charCode] = String.fromCharCode(unicode);
  20221. }
  20222. }
  20223. if (toUnicode.length > 0) {
  20224. properties.toUnicode.amend(toUnicode);
  20225. }
  20226. }
  20227. function amendFallbackToUnicode(properties) {
  20228. if (!properties.fallbackToUnicode) {
  20229. return;
  20230. }
  20231. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20232. return;
  20233. }
  20234. const toUnicode = [];
  20235. for (const charCode in properties.fallbackToUnicode) {
  20236. if (properties.toUnicode.has(charCode)) {
  20237. continue;
  20238. }
  20239. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  20240. }
  20241. if (toUnicode.length > 0) {
  20242. properties.toUnicode.amend(toUnicode);
  20243. }
  20244. }
  20245. class Glyph {
  20246. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20247. this.originalCharCode = originalCharCode;
  20248. this.fontChar = fontChar;
  20249. this.unicode = unicode;
  20250. this.accent = accent;
  20251. this.width = width;
  20252. this.vmetric = vmetric;
  20253. this.operatorListId = operatorListId;
  20254. this.isSpace = isSpace;
  20255. this.isInFont = isInFont;
  20256. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  20257. this.isWhitespace = category.isWhitespace;
  20258. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  20259. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  20260. }
  20261. }
  20262. function int16(b0, b1) {
  20263. return (b0 << 8) + b1;
  20264. }
  20265. function writeSignedInt16(bytes, index, value) {
  20266. bytes[index + 1] = value;
  20267. bytes[index] = value >>> 8;
  20268. }
  20269. function signedInt16(b0, b1) {
  20270. const value = (b0 << 8) + b1;
  20271. return value & 1 << 15 ? value - 0x10000 : value;
  20272. }
  20273. function int32(b0, b1, b2, b3) {
  20274. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20275. }
  20276. function string16(value) {
  20277. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20278. }
  20279. function safeString16(value) {
  20280. if (value > 0x7fff) {
  20281. value = 0x7fff;
  20282. } else if (value < -0x8000) {
  20283. value = -0x8000;
  20284. }
  20285. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20286. }
  20287. function isTrueTypeFile(file) {
  20288. const header = file.peekBytes(4);
  20289. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20290. }
  20291. function isTrueTypeCollectionFile(file) {
  20292. const header = file.peekBytes(4);
  20293. return (0, _util.bytesToString)(header) === "ttcf";
  20294. }
  20295. function isOpenTypeFile(file) {
  20296. const header = file.peekBytes(4);
  20297. return (0, _util.bytesToString)(header) === "OTTO";
  20298. }
  20299. function isType1File(file) {
  20300. const header = file.peekBytes(2);
  20301. if (header[0] === 0x25 && header[1] === 0x21) {
  20302. return true;
  20303. }
  20304. if (header[0] === 0x80 && header[1] === 0x01) {
  20305. return true;
  20306. }
  20307. return false;
  20308. }
  20309. function isCFFFile(file) {
  20310. const header = file.peekBytes(4);
  20311. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20312. return true;
  20313. }
  20314. return false;
  20315. }
  20316. function getFontFileType(file, {
  20317. type,
  20318. subtype,
  20319. composite
  20320. }) {
  20321. let fileType, fileSubtype;
  20322. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20323. if (composite) {
  20324. fileType = "CIDFontType2";
  20325. } else {
  20326. fileType = "TrueType";
  20327. }
  20328. } else if (isOpenTypeFile(file)) {
  20329. if (composite) {
  20330. fileType = "CIDFontType2";
  20331. } else {
  20332. fileType = "OpenType";
  20333. }
  20334. } else if (isType1File(file)) {
  20335. if (composite) {
  20336. fileType = "CIDFontType0";
  20337. } else {
  20338. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20339. }
  20340. } else if (isCFFFile(file)) {
  20341. if (composite) {
  20342. fileType = "CIDFontType0";
  20343. fileSubtype = "CIDFontType0C";
  20344. } else {
  20345. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20346. fileSubtype = "Type1C";
  20347. }
  20348. } else {
  20349. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20350. fileType = type;
  20351. fileSubtype = subtype;
  20352. }
  20353. return [fileType, fileSubtype];
  20354. }
  20355. function applyStandardFontGlyphMap(map, glyphMap) {
  20356. for (const charCode in glyphMap) {
  20357. map[+charCode] = glyphMap[charCode];
  20358. }
  20359. }
  20360. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20361. const toFontChar = [];
  20362. let unicode;
  20363. for (let i = 0, ii = encoding.length; i < ii; i++) {
  20364. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20365. if (unicode !== -1) {
  20366. toFontChar[i] = unicode;
  20367. }
  20368. }
  20369. for (const charCode in differences) {
  20370. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20371. if (unicode !== -1) {
  20372. toFontChar[+charCode] = unicode;
  20373. }
  20374. }
  20375. return toFontChar;
  20376. }
  20377. function convertCidString(charCode, cid, shouldThrow = false) {
  20378. switch (cid.length) {
  20379. case 1:
  20380. return cid.charCodeAt(0);
  20381. case 2:
  20382. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  20383. }
  20384. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  20385. if (shouldThrow) {
  20386. throw new _util.FormatError(msg);
  20387. }
  20388. (0, _util.warn)(msg);
  20389. return cid;
  20390. }
  20391. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  20392. const newMap = Object.create(null);
  20393. const toUnicodeExtraMap = new Map();
  20394. const toFontChar = [];
  20395. const usedGlyphIds = new Set();
  20396. let privateUseAreaIndex = 0;
  20397. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20398. let nextAvailableFontCharCode = privateUseOffetStart;
  20399. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20400. for (let originalCharCode in charCodeToGlyphId) {
  20401. originalCharCode |= 0;
  20402. let glyphId = charCodeToGlyphId[originalCharCode];
  20403. if (!hasGlyph(glyphId)) {
  20404. continue;
  20405. }
  20406. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20407. privateUseAreaIndex++;
  20408. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20409. (0, _util.warn)("Ran out of space in font private use area.");
  20410. break;
  20411. }
  20412. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20413. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20414. }
  20415. const fontCharCode = nextAvailableFontCharCode++;
  20416. if (glyphId === 0) {
  20417. glyphId = newGlyphZeroId;
  20418. }
  20419. let unicode = toUnicode.get(originalCharCode);
  20420. if (typeof unicode === "string") {
  20421. unicode = unicode.codePointAt(0);
  20422. }
  20423. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  20424. toUnicodeExtraMap.set(unicode, glyphId);
  20425. usedGlyphIds.add(glyphId);
  20426. }
  20427. newMap[fontCharCode] = glyphId;
  20428. toFontChar[originalCharCode] = fontCharCode;
  20429. }
  20430. return {
  20431. toFontChar,
  20432. charCodeToGlyphId: newMap,
  20433. toUnicodeExtraMap,
  20434. nextAvailableFontCharCode
  20435. };
  20436. }
  20437. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  20438. const codes = [];
  20439. for (const charCode in glyphs) {
  20440. if (glyphs[charCode] >= numGlyphs) {
  20441. continue;
  20442. }
  20443. codes.push({
  20444. fontCharCode: charCode | 0,
  20445. glyphId: glyphs[charCode]
  20446. });
  20447. }
  20448. if (toUnicodeExtraMap) {
  20449. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  20450. if (glyphId >= numGlyphs) {
  20451. continue;
  20452. }
  20453. codes.push({
  20454. fontCharCode: unicode,
  20455. glyphId
  20456. });
  20457. }
  20458. }
  20459. if (codes.length === 0) {
  20460. codes.push({
  20461. fontCharCode: 0,
  20462. glyphId: 0
  20463. });
  20464. }
  20465. codes.sort(function fontGetRangesSort(a, b) {
  20466. return a.fontCharCode - b.fontCharCode;
  20467. });
  20468. const ranges = [];
  20469. const length = codes.length;
  20470. for (let n = 0; n < length;) {
  20471. const start = codes[n].fontCharCode;
  20472. const codeIndices = [codes[n].glyphId];
  20473. ++n;
  20474. let end = start;
  20475. while (n < length && end + 1 === codes[n].fontCharCode) {
  20476. codeIndices.push(codes[n].glyphId);
  20477. ++end;
  20478. ++n;
  20479. if (end === 0xffff) {
  20480. break;
  20481. }
  20482. }
  20483. ranges.push([start, end, codeIndices]);
  20484. }
  20485. return ranges;
  20486. }
  20487. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  20488. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  20489. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  20490. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20491. let i, ii, j, jj;
  20492. for (i = ranges.length - 1; i >= 0; --i) {
  20493. if (ranges[i][0] <= 0xffff) {
  20494. break;
  20495. }
  20496. }
  20497. const bmpLength = i + 1;
  20498. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20499. ranges[i][1] = 0xfffe;
  20500. }
  20501. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20502. const segCount = bmpLength + trailingRangesCount;
  20503. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20504. let startCount = "";
  20505. let endCount = "";
  20506. let idDeltas = "";
  20507. let idRangeOffsets = "";
  20508. let glyphsIds = "";
  20509. let bias = 0;
  20510. let range, start, end, codes;
  20511. for (i = 0, ii = bmpLength; i < ii; i++) {
  20512. range = ranges[i];
  20513. start = range[0];
  20514. end = range[1];
  20515. startCount += string16(start);
  20516. endCount += string16(end);
  20517. codes = range[2];
  20518. let contiguous = true;
  20519. for (j = 1, jj = codes.length; j < jj; ++j) {
  20520. if (codes[j] !== codes[j - 1] + 1) {
  20521. contiguous = false;
  20522. break;
  20523. }
  20524. }
  20525. if (!contiguous) {
  20526. const offset = (segCount - i) * 2 + bias * 2;
  20527. bias += end - start + 1;
  20528. idDeltas += string16(0);
  20529. idRangeOffsets += string16(offset);
  20530. for (j = 0, jj = codes.length; j < jj; ++j) {
  20531. glyphsIds += string16(codes[j]);
  20532. }
  20533. } else {
  20534. const startCode = codes[0];
  20535. idDeltas += string16(startCode - start & 0xffff);
  20536. idRangeOffsets += string16(0);
  20537. }
  20538. }
  20539. if (trailingRangesCount > 0) {
  20540. endCount += "\xFF\xFF";
  20541. startCount += "\xFF\xFF";
  20542. idDeltas += "\x00\x01";
  20543. idRangeOffsets += "\x00\x00";
  20544. }
  20545. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20546. let format31012 = "";
  20547. let header31012 = "";
  20548. if (numTables > 1) {
  20549. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20550. format31012 = "";
  20551. for (i = 0, ii = ranges.length; i < ii; i++) {
  20552. range = ranges[i];
  20553. start = range[0];
  20554. codes = range[2];
  20555. let code = codes[0];
  20556. for (j = 1, jj = codes.length; j < jj; ++j) {
  20557. if (codes[j] !== codes[j - 1] + 1) {
  20558. end = range[0] + j - 1;
  20559. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20560. start = end + 1;
  20561. code = codes[j];
  20562. }
  20563. }
  20564. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20565. }
  20566. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20567. }
  20568. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20569. }
  20570. function validateOS2Table(os2, file) {
  20571. file.pos = (file.start || 0) + os2.offset;
  20572. const version = file.getUint16();
  20573. file.skip(60);
  20574. const selection = file.getUint16();
  20575. if (version < 4 && selection & 0x0300) {
  20576. return false;
  20577. }
  20578. const firstChar = file.getUint16();
  20579. const lastChar = file.getUint16();
  20580. if (firstChar > lastChar) {
  20581. return false;
  20582. }
  20583. file.skip(6);
  20584. const usWinAscent = file.getUint16();
  20585. if (usWinAscent === 0) {
  20586. return false;
  20587. }
  20588. os2.data[8] = os2.data[9] = 0;
  20589. return true;
  20590. }
  20591. function createOS2Table(properties, charstrings, override) {
  20592. override = override || {
  20593. unitsPerEm: 0,
  20594. yMax: 0,
  20595. yMin: 0,
  20596. ascent: 0,
  20597. descent: 0
  20598. };
  20599. let ulUnicodeRange1 = 0;
  20600. let ulUnicodeRange2 = 0;
  20601. let ulUnicodeRange3 = 0;
  20602. let ulUnicodeRange4 = 0;
  20603. let firstCharIndex = null;
  20604. let lastCharIndex = 0;
  20605. if (charstrings) {
  20606. for (let code in charstrings) {
  20607. code |= 0;
  20608. if (firstCharIndex > code || !firstCharIndex) {
  20609. firstCharIndex = code;
  20610. }
  20611. if (lastCharIndex < code) {
  20612. lastCharIndex = code;
  20613. }
  20614. const position = (0, _unicode.getUnicodeRangeFor)(code);
  20615. if (position < 32) {
  20616. ulUnicodeRange1 |= 1 << position;
  20617. } else if (position < 64) {
  20618. ulUnicodeRange2 |= 1 << position - 32;
  20619. } else if (position < 96) {
  20620. ulUnicodeRange3 |= 1 << position - 64;
  20621. } else if (position < 123) {
  20622. ulUnicodeRange4 |= 1 << position - 96;
  20623. } else {
  20624. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  20625. }
  20626. }
  20627. if (lastCharIndex > 0xffff) {
  20628. lastCharIndex = 0xffff;
  20629. }
  20630. } else {
  20631. firstCharIndex = 0;
  20632. lastCharIndex = 255;
  20633. }
  20634. const bbox = properties.bbox || [0, 0, 0, 0];
  20635. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20636. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  20637. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  20638. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  20639. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  20640. typoDescent = -typoDescent;
  20641. }
  20642. const winAscent = override.yMax || typoAscent;
  20643. const winDescent = -override.yMin || -typoDescent;
  20644. 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";
  20645. }
  20646. function createPostTable(properties) {
  20647. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  20648. 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";
  20649. }
  20650. function createPostscriptName(name) {
  20651. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  20652. }
  20653. function createNameTable(name, proto) {
  20654. if (!proto) {
  20655. proto = [[], []];
  20656. }
  20657. 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"];
  20658. const stringsUnicode = [];
  20659. let i, ii, j, jj, str;
  20660. for (i = 0, ii = strings.length; i < ii; i++) {
  20661. str = proto[1][i] || strings[i];
  20662. const strBufUnicode = [];
  20663. for (j = 0, jj = str.length; j < jj; j++) {
  20664. strBufUnicode.push(string16(str.charCodeAt(j)));
  20665. }
  20666. stringsUnicode.push(strBufUnicode.join(""));
  20667. }
  20668. const names = [strings, stringsUnicode];
  20669. const platforms = ["\x00\x01", "\x00\x03"];
  20670. const encodings = ["\x00\x00", "\x00\x01"];
  20671. const languages = ["\x00\x00", "\x04\x09"];
  20672. const namesRecordCount = strings.length * platforms.length;
  20673. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  20674. let strOffset = 0;
  20675. for (i = 0, ii = platforms.length; i < ii; i++) {
  20676. const strs = names[i];
  20677. for (j = 0, jj = strs.length; j < jj; j++) {
  20678. str = strs[j];
  20679. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  20680. nameTable += nameRecord;
  20681. strOffset += str.length;
  20682. }
  20683. }
  20684. nameTable += strings.join("") + stringsUnicode.join("");
  20685. return nameTable;
  20686. }
  20687. class Font {
  20688. constructor(name, file, properties) {
  20689. this.name = name;
  20690. this.psName = null;
  20691. this.mimetype = null;
  20692. this.disableFontFace = false;
  20693. this.loadedName = properties.loadedName;
  20694. this.isType3Font = properties.isType3Font;
  20695. this.missingFile = false;
  20696. this.cssFontInfo = properties.cssFontInfo;
  20697. this._charsCache = Object.create(null);
  20698. this._glyphCache = Object.create(null);
  20699. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  20700. if (!isSerifFont && !properties.isSimulatedFlags) {
  20701. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  20702. serifFonts = (0, _standard_fonts.getSerifFonts)();
  20703. for (const namePart of baseName.split("+")) {
  20704. if (serifFonts[namePart]) {
  20705. isSerifFont = true;
  20706. break;
  20707. }
  20708. }
  20709. }
  20710. this.isSerifFont = isSerifFont;
  20711. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  20712. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  20713. let type = properties.type;
  20714. let subtype = properties.subtype;
  20715. this.type = type;
  20716. this.subtype = subtype;
  20717. let fallbackName = "sans-serif";
  20718. if (this.isMonospace) {
  20719. fallbackName = "monospace";
  20720. } else if (this.isSerifFont) {
  20721. fallbackName = "serif";
  20722. }
  20723. this.fallbackName = fallbackName;
  20724. this.differences = properties.differences;
  20725. this.widths = properties.widths;
  20726. this.defaultWidth = properties.defaultWidth;
  20727. this.composite = properties.composite;
  20728. this.cMap = properties.cMap;
  20729. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  20730. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  20731. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  20732. this.lineHeight = this.ascent - this.descent;
  20733. this.fontMatrix = properties.fontMatrix;
  20734. this.bbox = properties.bbox;
  20735. this.defaultEncoding = properties.defaultEncoding;
  20736. this.toUnicode = properties.toUnicode;
  20737. this.toFontChar = [];
  20738. if (properties.type === "Type3") {
  20739. for (let charCode = 0; charCode < 256; charCode++) {
  20740. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  20741. }
  20742. this.fontType = _util.FontType.TYPE3;
  20743. return;
  20744. }
  20745. this.cidEncoding = properties.cidEncoding || "";
  20746. this.vertical = !!properties.vertical;
  20747. if (this.vertical) {
  20748. this.vmetrics = properties.vmetrics;
  20749. this.defaultVMetrics = properties.defaultVMetrics;
  20750. }
  20751. if (!file || file.isEmpty) {
  20752. if (file) {
  20753. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  20754. }
  20755. this.fallbackToSystemFont(properties);
  20756. return;
  20757. }
  20758. [type, subtype] = getFontFileType(file, properties);
  20759. if (type !== this.type || subtype !== this.subtype) {
  20760. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  20761. }
  20762. let data;
  20763. try {
  20764. switch (type) {
  20765. case "MMType1":
  20766. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  20767. case "Type1":
  20768. case "CIDFontType0":
  20769. this.mimetype = "font/opentype";
  20770. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  20771. adjustWidths(properties);
  20772. data = this.convert(name, cff, properties);
  20773. break;
  20774. case "OpenType":
  20775. case "TrueType":
  20776. case "CIDFontType2":
  20777. this.mimetype = "font/opentype";
  20778. data = this.checkAndRepair(name, file, properties);
  20779. if (this.isOpenType) {
  20780. adjustWidths(properties);
  20781. type = "OpenType";
  20782. }
  20783. break;
  20784. default:
  20785. throw new _util.FormatError(`Font ${type} is not supported`);
  20786. }
  20787. } catch (e) {
  20788. (0, _util.warn)(e);
  20789. this.fallbackToSystemFont(properties);
  20790. return;
  20791. }
  20792. amendFallbackToUnicode(properties);
  20793. this.data = data;
  20794. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  20795. this.fontMatrix = properties.fontMatrix;
  20796. this.widths = properties.widths;
  20797. this.defaultWidth = properties.defaultWidth;
  20798. this.toUnicode = properties.toUnicode;
  20799. this.seacMap = properties.seacMap;
  20800. }
  20801. get renderer() {
  20802. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  20803. return (0, _util.shadow)(this, "renderer", renderer);
  20804. }
  20805. exportData(extraProperties = false) {
  20806. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  20807. const data = Object.create(null);
  20808. let property, value;
  20809. for (property of exportDataProperties) {
  20810. value = this[property];
  20811. if (value !== undefined) {
  20812. data[property] = value;
  20813. }
  20814. }
  20815. return data;
  20816. }
  20817. fallbackToSystemFont(properties) {
  20818. this.missingFile = true;
  20819. const name = this.name;
  20820. const type = this.type;
  20821. const subtype = this.subtype;
  20822. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  20823. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  20824. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  20825. const isStandardFont = !!stdFontMap[fontName];
  20826. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  20827. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  20828. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  20829. const metrics = fontBasicMetricsMap[fontName];
  20830. if (metrics) {
  20831. if (isNaN(this.ascent)) {
  20832. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  20833. }
  20834. if (isNaN(this.descent)) {
  20835. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  20836. }
  20837. if (isNaN(this.capHeight)) {
  20838. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  20839. }
  20840. }
  20841. this.bold = /bold/gi.test(fontName);
  20842. this.italic = /oblique|italic/gi.test(fontName);
  20843. this.black = /Black/g.test(name);
  20844. const isNarrow = /Narrow/g.test(name);
  20845. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  20846. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  20847. const cidToGidMap = properties.cidToGidMap;
  20848. const map = [];
  20849. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  20850. if (/Arial-?Black/i.test(name)) {
  20851. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  20852. } else if (/Calibri/i.test(name)) {
  20853. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  20854. }
  20855. if (cidToGidMap) {
  20856. for (const charCode in map) {
  20857. const cid = map[charCode];
  20858. if (cidToGidMap[cid] !== undefined) {
  20859. map[+charCode] = cidToGidMap[cid];
  20860. }
  20861. }
  20862. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20863. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20864. const cid = map[charCode];
  20865. if (cidToGidMap[cid] === undefined) {
  20866. map[+charCode] = unicodeCharCode;
  20867. }
  20868. });
  20869. }
  20870. }
  20871. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  20872. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20873. map[+charCode] = unicodeCharCode;
  20874. });
  20875. }
  20876. this.toFontChar = map;
  20877. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  20878. } else if (/Symbol/i.test(fontName)) {
  20879. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20880. } else if (/Dingbats/i.test(fontName)) {
  20881. if (/Wingdings/i.test(name)) {
  20882. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  20883. }
  20884. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  20885. } else if (isStandardFont) {
  20886. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20887. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  20888. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20889. map[+charCode] = unicodeCharCode;
  20890. });
  20891. }
  20892. this.toFontChar = map;
  20893. } else {
  20894. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20895. const map = [];
  20896. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  20897. if (!this.composite) {
  20898. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  20899. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20900. if (unicode !== -1) {
  20901. unicodeCharCode = unicode;
  20902. }
  20903. }
  20904. map[+charCode] = unicodeCharCode;
  20905. });
  20906. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20907. if (/Verdana/i.test(name)) {
  20908. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  20909. }
  20910. }
  20911. this.toFontChar = map;
  20912. }
  20913. amendFallbackToUnicode(properties);
  20914. this.loadedName = fontName.split("-")[0];
  20915. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  20916. }
  20917. checkAndRepair(name, font, properties) {
  20918. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  20919. function readTables(file, numTables) {
  20920. const tables = Object.create(null);
  20921. tables["OS/2"] = null;
  20922. tables.cmap = null;
  20923. tables.head = null;
  20924. tables.hhea = null;
  20925. tables.hmtx = null;
  20926. tables.maxp = null;
  20927. tables.name = null;
  20928. tables.post = null;
  20929. for (let i = 0; i < numTables; i++) {
  20930. const table = readTableEntry(file);
  20931. if (!VALID_TABLES.includes(table.tag)) {
  20932. continue;
  20933. }
  20934. if (table.length === 0) {
  20935. continue;
  20936. }
  20937. tables[table.tag] = table;
  20938. }
  20939. return tables;
  20940. }
  20941. function readTableEntry(file) {
  20942. const tag = file.getString(4);
  20943. const checksum = file.getInt32() >>> 0;
  20944. const offset = file.getInt32() >>> 0;
  20945. const length = file.getInt32() >>> 0;
  20946. const previousPosition = file.pos;
  20947. file.pos = file.start || 0;
  20948. file.skip(offset);
  20949. const data = file.getBytes(length);
  20950. file.pos = previousPosition;
  20951. if (tag === "head") {
  20952. data[8] = data[9] = data[10] = data[11] = 0;
  20953. data[17] |= 0x20;
  20954. }
  20955. return {
  20956. tag,
  20957. checksum,
  20958. length,
  20959. offset,
  20960. data
  20961. };
  20962. }
  20963. function readOpenTypeHeader(ttf) {
  20964. return {
  20965. version: ttf.getString(4),
  20966. numTables: ttf.getUint16(),
  20967. searchRange: ttf.getUint16(),
  20968. entrySelector: ttf.getUint16(),
  20969. rangeShift: ttf.getUint16()
  20970. };
  20971. }
  20972. function readTrueTypeCollectionHeader(ttc) {
  20973. const ttcTag = ttc.getString(4);
  20974. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  20975. const majorVersion = ttc.getUint16();
  20976. const minorVersion = ttc.getUint16();
  20977. const numFonts = ttc.getInt32() >>> 0;
  20978. const offsetTable = [];
  20979. for (let i = 0; i < numFonts; i++) {
  20980. offsetTable.push(ttc.getInt32() >>> 0);
  20981. }
  20982. const header = {
  20983. ttcTag,
  20984. majorVersion,
  20985. minorVersion,
  20986. numFonts,
  20987. offsetTable
  20988. };
  20989. switch (majorVersion) {
  20990. case 1:
  20991. return header;
  20992. case 2:
  20993. header.dsigTag = ttc.getInt32() >>> 0;
  20994. header.dsigLength = ttc.getInt32() >>> 0;
  20995. header.dsigOffset = ttc.getInt32() >>> 0;
  20996. return header;
  20997. }
  20998. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  20999. }
  21000. function readTrueTypeCollectionData(ttc, fontName) {
  21001. const {
  21002. numFonts,
  21003. offsetTable
  21004. } = readTrueTypeCollectionHeader(ttc);
  21005. const fontNameParts = fontName.split("+");
  21006. let fallbackData;
  21007. for (let i = 0; i < numFonts; i++) {
  21008. ttc.pos = (ttc.start || 0) + offsetTable[i];
  21009. const potentialHeader = readOpenTypeHeader(ttc);
  21010. const potentialTables = readTables(ttc, potentialHeader.numTables);
  21011. if (!potentialTables.name) {
  21012. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  21013. }
  21014. const nameTable = readNameTable(potentialTables.name);
  21015. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  21016. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  21017. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  21018. if (!nameEntry) {
  21019. continue;
  21020. }
  21021. if (nameEntry === fontName) {
  21022. return {
  21023. header: potentialHeader,
  21024. tables: potentialTables
  21025. };
  21026. }
  21027. if (fontNameParts.length < 2) {
  21028. continue;
  21029. }
  21030. for (const part of fontNameParts) {
  21031. if (nameEntry === part) {
  21032. fallbackData = {
  21033. name: part,
  21034. header: potentialHeader,
  21035. tables: potentialTables
  21036. };
  21037. }
  21038. }
  21039. }
  21040. }
  21041. }
  21042. if (fallbackData) {
  21043. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  21044. return {
  21045. header: fallbackData.header,
  21046. tables: fallbackData.tables
  21047. };
  21048. }
  21049. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  21050. }
  21051. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  21052. if (!cmap) {
  21053. (0, _util.warn)("No cmap table available.");
  21054. return {
  21055. platformId: -1,
  21056. encodingId: -1,
  21057. mappings: [],
  21058. hasShortCmap: false
  21059. };
  21060. }
  21061. let segment;
  21062. let start = (file.start || 0) + cmap.offset;
  21063. file.pos = start;
  21064. file.skip(2);
  21065. const numTables = file.getUint16();
  21066. let potentialTable;
  21067. let canBreak = false;
  21068. for (let i = 0; i < numTables; i++) {
  21069. const platformId = file.getUint16();
  21070. const encodingId = file.getUint16();
  21071. const offset = file.getInt32() >>> 0;
  21072. let useTable = false;
  21073. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21074. continue;
  21075. }
  21076. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  21077. useTable = true;
  21078. } else if (platformId === 1 && encodingId === 0) {
  21079. useTable = true;
  21080. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21081. useTable = true;
  21082. if (!isSymbolicFont) {
  21083. canBreak = true;
  21084. }
  21085. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21086. useTable = true;
  21087. let correctlySorted = true;
  21088. if (i < numTables - 1) {
  21089. const nextBytes = file.peekBytes(2),
  21090. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  21091. if (nextPlatformId < platformId) {
  21092. correctlySorted = false;
  21093. }
  21094. }
  21095. if (correctlySorted) {
  21096. canBreak = true;
  21097. }
  21098. }
  21099. if (useTable) {
  21100. potentialTable = {
  21101. platformId,
  21102. encodingId,
  21103. offset
  21104. };
  21105. }
  21106. if (canBreak) {
  21107. break;
  21108. }
  21109. }
  21110. if (potentialTable) {
  21111. file.pos = start + potentialTable.offset;
  21112. }
  21113. if (!potentialTable || file.peekByte() === -1) {
  21114. (0, _util.warn)("Could not find a preferred cmap table.");
  21115. return {
  21116. platformId: -1,
  21117. encodingId: -1,
  21118. mappings: [],
  21119. hasShortCmap: false
  21120. };
  21121. }
  21122. const format = file.getUint16();
  21123. let hasShortCmap = false;
  21124. const mappings = [];
  21125. let j, glyphId;
  21126. if (format === 0) {
  21127. file.skip(2 + 2);
  21128. for (j = 0; j < 256; j++) {
  21129. const index = file.getByte();
  21130. if (!index) {
  21131. continue;
  21132. }
  21133. mappings.push({
  21134. charCode: j,
  21135. glyphId: index
  21136. });
  21137. }
  21138. hasShortCmap = true;
  21139. } else if (format === 2) {
  21140. file.skip(2 + 2);
  21141. const subHeaderKeys = [];
  21142. let maxSubHeaderKey = 0;
  21143. for (let i = 0; i < 256; i++) {
  21144. const subHeaderKey = file.getUint16() >> 3;
  21145. subHeaderKeys.push(subHeaderKey);
  21146. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  21147. }
  21148. const subHeaders = [];
  21149. for (let i = 0; i <= maxSubHeaderKey; i++) {
  21150. subHeaders.push({
  21151. firstCode: file.getUint16(),
  21152. entryCount: file.getUint16(),
  21153. idDelta: signedInt16(file.getByte(), file.getByte()),
  21154. idRangePos: file.pos + file.getUint16()
  21155. });
  21156. }
  21157. for (let i = 0; i < 256; i++) {
  21158. if (subHeaderKeys[i] === 0) {
  21159. file.pos = subHeaders[0].idRangePos + 2 * i;
  21160. glyphId = file.getUint16();
  21161. mappings.push({
  21162. charCode: i,
  21163. glyphId
  21164. });
  21165. } else {
  21166. const s = subHeaders[subHeaderKeys[i]];
  21167. for (j = 0; j < s.entryCount; j++) {
  21168. const charCode = (i << 8) + j + s.firstCode;
  21169. file.pos = s.idRangePos + 2 * j;
  21170. glyphId = file.getUint16();
  21171. if (glyphId !== 0) {
  21172. glyphId = (glyphId + s.idDelta) % 65536;
  21173. }
  21174. mappings.push({
  21175. charCode,
  21176. glyphId
  21177. });
  21178. }
  21179. }
  21180. }
  21181. } else if (format === 4) {
  21182. file.skip(2 + 2);
  21183. const segCount = file.getUint16() >> 1;
  21184. file.skip(6);
  21185. const segments = [];
  21186. let segIndex;
  21187. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21188. segments.push({
  21189. end: file.getUint16()
  21190. });
  21191. }
  21192. file.skip(2);
  21193. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21194. segments[segIndex].start = file.getUint16();
  21195. }
  21196. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21197. segments[segIndex].delta = file.getUint16();
  21198. }
  21199. let offsetsCount = 0,
  21200. offsetIndex;
  21201. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21202. segment = segments[segIndex];
  21203. const rangeOffset = file.getUint16();
  21204. if (!rangeOffset) {
  21205. segment.offsetIndex = -1;
  21206. continue;
  21207. }
  21208. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21209. segment.offsetIndex = offsetIndex;
  21210. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21211. }
  21212. const offsets = [];
  21213. for (j = 0; j < offsetsCount; j++) {
  21214. offsets.push(file.getUint16());
  21215. }
  21216. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21217. segment = segments[segIndex];
  21218. start = segment.start;
  21219. const end = segment.end;
  21220. const delta = segment.delta;
  21221. offsetIndex = segment.offsetIndex;
  21222. for (j = start; j <= end; j++) {
  21223. if (j === 0xffff) {
  21224. continue;
  21225. }
  21226. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21227. glyphId = glyphId + delta & 0xffff;
  21228. mappings.push({
  21229. charCode: j,
  21230. glyphId
  21231. });
  21232. }
  21233. }
  21234. } else if (format === 6) {
  21235. file.skip(2 + 2);
  21236. const firstCode = file.getUint16();
  21237. const entryCount = file.getUint16();
  21238. for (j = 0; j < entryCount; j++) {
  21239. glyphId = file.getUint16();
  21240. const charCode = firstCode + j;
  21241. mappings.push({
  21242. charCode,
  21243. glyphId
  21244. });
  21245. }
  21246. } else if (format === 12) {
  21247. file.skip(2 + 4 + 4);
  21248. const nGroups = file.getInt32() >>> 0;
  21249. for (j = 0; j < nGroups; j++) {
  21250. const startCharCode = file.getInt32() >>> 0;
  21251. const endCharCode = file.getInt32() >>> 0;
  21252. let glyphCode = file.getInt32() >>> 0;
  21253. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  21254. mappings.push({
  21255. charCode,
  21256. glyphId: glyphCode++
  21257. });
  21258. }
  21259. }
  21260. } else {
  21261. (0, _util.warn)("cmap table has unsupported format: " + format);
  21262. return {
  21263. platformId: -1,
  21264. encodingId: -1,
  21265. mappings: [],
  21266. hasShortCmap: false
  21267. };
  21268. }
  21269. mappings.sort(function (a, b) {
  21270. return a.charCode - b.charCode;
  21271. });
  21272. for (let i = 1; i < mappings.length; i++) {
  21273. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21274. mappings.splice(i, 1);
  21275. i--;
  21276. }
  21277. }
  21278. return {
  21279. platformId: potentialTable.platformId,
  21280. encodingId: potentialTable.encodingId,
  21281. mappings,
  21282. hasShortCmap
  21283. };
  21284. }
  21285. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  21286. if (!header) {
  21287. if (metrics) {
  21288. metrics.data = null;
  21289. }
  21290. return;
  21291. }
  21292. file.pos = (file.start || 0) + header.offset;
  21293. file.pos += 4;
  21294. file.pos += 2;
  21295. file.pos += 2;
  21296. file.pos += 2;
  21297. file.pos += 2;
  21298. file.pos += 2;
  21299. file.pos += 2;
  21300. file.pos += 2;
  21301. file.pos += 2;
  21302. file.pos += 2;
  21303. const caretOffset = file.getUint16();
  21304. file.pos += 8;
  21305. file.pos += 2;
  21306. let numOfMetrics = file.getUint16();
  21307. if (caretOffset !== 0) {
  21308. const macStyle = int16(headTable.data[44], headTable.data[45]);
  21309. if (!(macStyle & 2)) {
  21310. header.data[22] = 0;
  21311. header.data[23] = 0;
  21312. }
  21313. }
  21314. if (numOfMetrics > numGlyphs) {
  21315. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  21316. numOfMetrics = numGlyphs;
  21317. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21318. header.data[35] = numOfMetrics & 0x00ff;
  21319. }
  21320. const numOfSidebearings = numGlyphs - numOfMetrics;
  21321. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21322. if (numMissing > 0) {
  21323. const entries = new Uint8Array(metrics.length + numMissing * 2);
  21324. entries.set(metrics.data);
  21325. if (dupFirstEntry) {
  21326. entries[metrics.length] = metrics.data[2];
  21327. entries[metrics.length + 1] = metrics.data[3];
  21328. }
  21329. metrics.data = entries;
  21330. }
  21331. }
  21332. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21333. const glyphProfile = {
  21334. length: 0,
  21335. sizeOfInstructions: 0
  21336. };
  21337. if (sourceEnd - sourceStart <= 12) {
  21338. return glyphProfile;
  21339. }
  21340. const glyf = source.subarray(sourceStart, sourceEnd);
  21341. let contoursCount = signedInt16(glyf[0], glyf[1]);
  21342. if (contoursCount < 0) {
  21343. contoursCount = -1;
  21344. writeSignedInt16(glyf, 0, contoursCount);
  21345. dest.set(glyf, destStart);
  21346. glyphProfile.length = glyf.length;
  21347. return glyphProfile;
  21348. }
  21349. let i,
  21350. j = 10,
  21351. flagsCount = 0;
  21352. for (i = 0; i < contoursCount; i++) {
  21353. const endPoint = glyf[j] << 8 | glyf[j + 1];
  21354. flagsCount = endPoint + 1;
  21355. j += 2;
  21356. }
  21357. const instructionsStart = j;
  21358. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21359. glyphProfile.sizeOfInstructions = instructionsLength;
  21360. j += 2 + instructionsLength;
  21361. const instructionsEnd = j;
  21362. let coordinatesLength = 0;
  21363. for (i = 0; i < flagsCount; i++) {
  21364. const flag = glyf[j++];
  21365. if (flag & 0xc0) {
  21366. glyf[j - 1] = flag & 0x3f;
  21367. }
  21368. let xLength = 2;
  21369. if (flag & 2) {
  21370. xLength = 1;
  21371. } else if (flag & 16) {
  21372. xLength = 0;
  21373. }
  21374. let yLength = 2;
  21375. if (flag & 4) {
  21376. yLength = 1;
  21377. } else if (flag & 32) {
  21378. yLength = 0;
  21379. }
  21380. const xyLength = xLength + yLength;
  21381. coordinatesLength += xyLength;
  21382. if (flag & 8) {
  21383. const repeat = glyf[j++];
  21384. i += repeat;
  21385. coordinatesLength += repeat * xyLength;
  21386. }
  21387. }
  21388. if (coordinatesLength === 0) {
  21389. return glyphProfile;
  21390. }
  21391. let glyphDataLength = j + coordinatesLength;
  21392. if (glyphDataLength > glyf.length) {
  21393. return glyphProfile;
  21394. }
  21395. if (!hintsValid && instructionsLength > 0) {
  21396. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21397. dest.set([0, 0], destStart + instructionsStart);
  21398. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21399. glyphDataLength -= instructionsLength;
  21400. if (glyf.length - glyphDataLength > 3) {
  21401. glyphDataLength = glyphDataLength + 3 & ~3;
  21402. }
  21403. glyphProfile.length = glyphDataLength;
  21404. return glyphProfile;
  21405. }
  21406. if (glyf.length - glyphDataLength > 3) {
  21407. glyphDataLength = glyphDataLength + 3 & ~3;
  21408. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21409. glyphProfile.length = glyphDataLength;
  21410. return glyphProfile;
  21411. }
  21412. dest.set(glyf, destStart);
  21413. glyphProfile.length = glyf.length;
  21414. return glyphProfile;
  21415. }
  21416. function sanitizeHead(head, numGlyphs, locaLength) {
  21417. const data = head.data;
  21418. const version = int32(data[0], data[1], data[2], data[3]);
  21419. if (version >> 16 !== 1) {
  21420. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21421. data[0] = 0;
  21422. data[1] = 1;
  21423. data[2] = 0;
  21424. data[3] = 0;
  21425. }
  21426. const indexToLocFormat = int16(data[50], data[51]);
  21427. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21428. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21429. const numGlyphsPlusOne = numGlyphs + 1;
  21430. if (locaLength === numGlyphsPlusOne << 1) {
  21431. data[50] = 0;
  21432. data[51] = 0;
  21433. } else if (locaLength === numGlyphsPlusOne << 2) {
  21434. data[50] = 0;
  21435. data[51] = 1;
  21436. } else {
  21437. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21438. }
  21439. }
  21440. }
  21441. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21442. let itemSize, itemDecode, itemEncode;
  21443. if (isGlyphLocationsLong) {
  21444. itemSize = 4;
  21445. itemDecode = function fontItemDecodeLong(data, offset) {
  21446. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21447. };
  21448. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21449. data[offset] = value >>> 24 & 0xff;
  21450. data[offset + 1] = value >> 16 & 0xff;
  21451. data[offset + 2] = value >> 8 & 0xff;
  21452. data[offset + 3] = value & 0xff;
  21453. };
  21454. } else {
  21455. itemSize = 2;
  21456. itemDecode = function fontItemDecode(data, offset) {
  21457. return data[offset] << 9 | data[offset + 1] << 1;
  21458. };
  21459. itemEncode = function fontItemEncode(data, offset, value) {
  21460. data[offset] = value >> 9 & 0xff;
  21461. data[offset + 1] = value >> 1 & 0xff;
  21462. };
  21463. }
  21464. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21465. const locaDataSize = itemSize * (1 + numGlyphsOut);
  21466. const locaData = new Uint8Array(locaDataSize);
  21467. locaData.set(loca.data.subarray(0, locaDataSize));
  21468. loca.data = locaData;
  21469. const oldGlyfData = glyf.data;
  21470. const oldGlyfDataLength = oldGlyfData.length;
  21471. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  21472. let i, j;
  21473. const locaEntries = [];
  21474. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  21475. let offset = itemDecode(locaData, j);
  21476. if (offset > oldGlyfDataLength) {
  21477. offset = oldGlyfDataLength;
  21478. }
  21479. locaEntries.push({
  21480. index: i,
  21481. offset,
  21482. endOffset: 0
  21483. });
  21484. }
  21485. locaEntries.sort((a, b) => {
  21486. return a.offset - b.offset;
  21487. });
  21488. for (i = 0; i < numGlyphs; i++) {
  21489. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  21490. }
  21491. locaEntries.sort((a, b) => {
  21492. return a.index - b.index;
  21493. });
  21494. for (i = 0; i < numGlyphs; i++) {
  21495. const {
  21496. offset,
  21497. endOffset
  21498. } = locaEntries[i];
  21499. if (offset !== 0 || endOffset !== 0) {
  21500. break;
  21501. }
  21502. const nextOffset = locaEntries[i + 1].offset;
  21503. if (nextOffset === 0) {
  21504. continue;
  21505. }
  21506. locaEntries[i].endOffset = nextOffset;
  21507. break;
  21508. }
  21509. const missingGlyphs = Object.create(null);
  21510. let writeOffset = 0;
  21511. itemEncode(locaData, 0, writeOffset);
  21512. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21513. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  21514. const newLength = glyphProfile.length;
  21515. if (newLength === 0) {
  21516. missingGlyphs[i] = true;
  21517. }
  21518. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21519. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21520. }
  21521. writeOffset += newLength;
  21522. itemEncode(locaData, j, writeOffset);
  21523. }
  21524. if (writeOffset === 0) {
  21525. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21526. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21527. itemEncode(locaData, j, simpleGlyph.length);
  21528. }
  21529. glyf.data = simpleGlyph;
  21530. } else if (dupFirstEntry) {
  21531. const firstEntryLength = itemDecode(locaData, itemSize);
  21532. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21533. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21534. } else {
  21535. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21536. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21537. }
  21538. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21539. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21540. } else {
  21541. glyf.data = newGlyfData.subarray(0, writeOffset);
  21542. }
  21543. return {
  21544. missingGlyphs,
  21545. maxSizeOfInstructions
  21546. };
  21547. }
  21548. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21549. const start = (font.start || 0) + post.offset;
  21550. font.pos = start;
  21551. const length = post.length,
  21552. end = start + length;
  21553. const version = font.getInt32();
  21554. font.skip(28);
  21555. let glyphNames;
  21556. let valid = true;
  21557. let i;
  21558. switch (version) {
  21559. case 0x00010000:
  21560. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  21561. break;
  21562. case 0x00020000:
  21563. const numGlyphs = font.getUint16();
  21564. if (numGlyphs !== maxpNumGlyphs) {
  21565. valid = false;
  21566. break;
  21567. }
  21568. const glyphNameIndexes = [];
  21569. for (i = 0; i < numGlyphs; ++i) {
  21570. const index = font.getUint16();
  21571. if (index >= 32768) {
  21572. valid = false;
  21573. break;
  21574. }
  21575. glyphNameIndexes.push(index);
  21576. }
  21577. if (!valid) {
  21578. break;
  21579. }
  21580. const customNames = [],
  21581. strBuf = [];
  21582. while (font.pos < end) {
  21583. const stringLength = font.getByte();
  21584. strBuf.length = stringLength;
  21585. for (i = 0; i < stringLength; ++i) {
  21586. strBuf[i] = String.fromCharCode(font.getByte());
  21587. }
  21588. customNames.push(strBuf.join(""));
  21589. }
  21590. glyphNames = [];
  21591. for (i = 0; i < numGlyphs; ++i) {
  21592. const j = glyphNameIndexes[i];
  21593. if (j < 258) {
  21594. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  21595. continue;
  21596. }
  21597. glyphNames.push(customNames[j - 258]);
  21598. }
  21599. break;
  21600. case 0x00030000:
  21601. break;
  21602. default:
  21603. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21604. valid = false;
  21605. if (propertiesObj.defaultEncoding) {
  21606. glyphNames = propertiesObj.defaultEncoding;
  21607. }
  21608. break;
  21609. }
  21610. propertiesObj.glyphNames = glyphNames;
  21611. return valid;
  21612. }
  21613. function readNameTable(nameTable) {
  21614. const start = (font.start || 0) + nameTable.offset;
  21615. font.pos = start;
  21616. const names = [[], []];
  21617. const length = nameTable.length,
  21618. end = start + length;
  21619. const format = font.getUint16();
  21620. const FORMAT_0_HEADER_LENGTH = 6;
  21621. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  21622. return names;
  21623. }
  21624. const numRecords = font.getUint16();
  21625. const stringsStart = font.getUint16();
  21626. const records = [];
  21627. const NAME_RECORD_LENGTH = 12;
  21628. let i, ii;
  21629. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  21630. const r = {
  21631. platform: font.getUint16(),
  21632. encoding: font.getUint16(),
  21633. language: font.getUint16(),
  21634. name: font.getUint16(),
  21635. length: font.getUint16(),
  21636. offset: font.getUint16()
  21637. };
  21638. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  21639. records.push(r);
  21640. }
  21641. }
  21642. for (i = 0, ii = records.length; i < ii; i++) {
  21643. const record = records[i];
  21644. if (record.length <= 0) {
  21645. continue;
  21646. }
  21647. const pos = start + stringsStart + record.offset;
  21648. if (pos + record.length > end) {
  21649. continue;
  21650. }
  21651. font.pos = pos;
  21652. const nameIndex = record.name;
  21653. if (record.encoding) {
  21654. let str = "";
  21655. for (let j = 0, jj = record.length; j < jj; j += 2) {
  21656. str += String.fromCharCode(font.getUint16());
  21657. }
  21658. names[1][nameIndex] = str;
  21659. } else {
  21660. names[0][nameIndex] = font.getString(record.length);
  21661. }
  21662. }
  21663. return names;
  21664. }
  21665. 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];
  21666. function sanitizeTTProgram(table, ttContext) {
  21667. let data = table.data;
  21668. let i = 0,
  21669. j,
  21670. n,
  21671. b,
  21672. funcId,
  21673. pc,
  21674. lastEndf = 0,
  21675. lastDeff = 0;
  21676. const stack = [];
  21677. const callstack = [];
  21678. const functionsCalled = [];
  21679. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  21680. let inFDEF = false,
  21681. ifLevel = 0,
  21682. inELSE = 0;
  21683. for (let ii = data.length; i < ii;) {
  21684. const op = data[i++];
  21685. if (op === 0x40) {
  21686. n = data[i++];
  21687. if (inFDEF || inELSE) {
  21688. i += n;
  21689. } else {
  21690. for (j = 0; j < n; j++) {
  21691. stack.push(data[i++]);
  21692. }
  21693. }
  21694. } else if (op === 0x41) {
  21695. n = data[i++];
  21696. if (inFDEF || inELSE) {
  21697. i += n * 2;
  21698. } else {
  21699. for (j = 0; j < n; j++) {
  21700. b = data[i++];
  21701. stack.push(b << 8 | data[i++]);
  21702. }
  21703. }
  21704. } else if ((op & 0xf8) === 0xb0) {
  21705. n = op - 0xb0 + 1;
  21706. if (inFDEF || inELSE) {
  21707. i += n;
  21708. } else {
  21709. for (j = 0; j < n; j++) {
  21710. stack.push(data[i++]);
  21711. }
  21712. }
  21713. } else if ((op & 0xf8) === 0xb8) {
  21714. n = op - 0xb8 + 1;
  21715. if (inFDEF || inELSE) {
  21716. i += n * 2;
  21717. } else {
  21718. for (j = 0; j < n; j++) {
  21719. b = data[i++];
  21720. stack.push(b << 8 | data[i++]);
  21721. }
  21722. }
  21723. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  21724. if (!inFDEF && !inELSE) {
  21725. funcId = stack.at(-1);
  21726. if (isNaN(funcId)) {
  21727. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  21728. } else {
  21729. ttContext.functionsUsed[funcId] = true;
  21730. if (funcId in ttContext.functionsStackDeltas) {
  21731. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  21732. if (newStackLength < 0) {
  21733. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  21734. ttContext.hintsValid = false;
  21735. return;
  21736. }
  21737. stack.length = newStackLength;
  21738. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  21739. callstack.push({
  21740. data,
  21741. i,
  21742. stackTop: stack.length - 1
  21743. });
  21744. functionsCalled.push(funcId);
  21745. pc = ttContext.functionsDefined[funcId];
  21746. if (!pc) {
  21747. (0, _util.warn)("TT: CALL non-existent function");
  21748. ttContext.hintsValid = false;
  21749. return;
  21750. }
  21751. data = pc.data;
  21752. i = pc.i;
  21753. }
  21754. }
  21755. }
  21756. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  21757. if (inFDEF || inELSE) {
  21758. (0, _util.warn)("TT: nested FDEFs not allowed");
  21759. tooComplexToFollowFunctions = true;
  21760. }
  21761. inFDEF = true;
  21762. lastDeff = i;
  21763. funcId = stack.pop();
  21764. ttContext.functionsDefined[funcId] = {
  21765. data,
  21766. i
  21767. };
  21768. } else if (op === 0x2d) {
  21769. if (inFDEF) {
  21770. inFDEF = false;
  21771. lastEndf = i;
  21772. } else {
  21773. pc = callstack.pop();
  21774. if (!pc) {
  21775. (0, _util.warn)("TT: ENDF bad stack");
  21776. ttContext.hintsValid = false;
  21777. return;
  21778. }
  21779. funcId = functionsCalled.pop();
  21780. data = pc.data;
  21781. i = pc.i;
  21782. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  21783. }
  21784. } else if (op === 0x89) {
  21785. if (inFDEF || inELSE) {
  21786. (0, _util.warn)("TT: nested IDEFs not allowed");
  21787. tooComplexToFollowFunctions = true;
  21788. }
  21789. inFDEF = true;
  21790. lastDeff = i;
  21791. } else if (op === 0x58) {
  21792. ++ifLevel;
  21793. } else if (op === 0x1b) {
  21794. inELSE = ifLevel;
  21795. } else if (op === 0x59) {
  21796. if (inELSE === ifLevel) {
  21797. inELSE = 0;
  21798. }
  21799. --ifLevel;
  21800. } else if (op === 0x1c) {
  21801. if (!inFDEF && !inELSE) {
  21802. const offset = stack.at(-1);
  21803. if (offset > 0) {
  21804. i += offset - 1;
  21805. }
  21806. }
  21807. }
  21808. if (!inFDEF && !inELSE) {
  21809. let stackDelta = 0;
  21810. if (op <= 0x8e) {
  21811. stackDelta = TTOpsStackDeltas[op];
  21812. } else if (op >= 0xc0 && op <= 0xdf) {
  21813. stackDelta = -1;
  21814. } else if (op >= 0xe0) {
  21815. stackDelta = -2;
  21816. }
  21817. if (op >= 0x71 && op <= 0x75) {
  21818. n = stack.pop();
  21819. if (!isNaN(n)) {
  21820. stackDelta = -n * 2;
  21821. }
  21822. }
  21823. while (stackDelta < 0 && stack.length > 0) {
  21824. stack.pop();
  21825. stackDelta++;
  21826. }
  21827. while (stackDelta > 0) {
  21828. stack.push(NaN);
  21829. stackDelta--;
  21830. }
  21831. }
  21832. }
  21833. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  21834. const content = [data];
  21835. if (i > data.length) {
  21836. content.push(new Uint8Array(i - data.length));
  21837. }
  21838. if (lastDeff > lastEndf) {
  21839. (0, _util.warn)("TT: complementing a missing function tail");
  21840. content.push(new Uint8Array([0x22, 0x2d]));
  21841. }
  21842. foldTTTable(table, content);
  21843. }
  21844. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  21845. if (ttContext.tooComplexToFollowFunctions) {
  21846. return;
  21847. }
  21848. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  21849. (0, _util.warn)("TT: more functions defined than expected");
  21850. ttContext.hintsValid = false;
  21851. return;
  21852. }
  21853. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  21854. if (j > maxFunctionDefs) {
  21855. (0, _util.warn)("TT: invalid function id: " + j);
  21856. ttContext.hintsValid = false;
  21857. return;
  21858. }
  21859. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  21860. (0, _util.warn)("TT: undefined function: " + j);
  21861. ttContext.hintsValid = false;
  21862. return;
  21863. }
  21864. }
  21865. }
  21866. function foldTTTable(table, content) {
  21867. if (content.length > 1) {
  21868. let newLength = 0;
  21869. let j, jj;
  21870. for (j = 0, jj = content.length; j < jj; j++) {
  21871. newLength += content[j].length;
  21872. }
  21873. newLength = newLength + 3 & ~3;
  21874. const result = new Uint8Array(newLength);
  21875. let pos = 0;
  21876. for (j = 0, jj = content.length; j < jj; j++) {
  21877. result.set(content[j], pos);
  21878. pos += content[j].length;
  21879. }
  21880. table.data = result;
  21881. table.length = newLength;
  21882. }
  21883. }
  21884. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  21885. const ttContext = {
  21886. functionsDefined: [],
  21887. functionsUsed: [],
  21888. functionsStackDeltas: [],
  21889. tooComplexToFollowFunctions: false,
  21890. hintsValid: true
  21891. };
  21892. if (fpgm) {
  21893. sanitizeTTProgram(fpgm, ttContext);
  21894. }
  21895. if (prep) {
  21896. sanitizeTTProgram(prep, ttContext);
  21897. }
  21898. if (fpgm) {
  21899. checkInvalidFunctions(ttContext, maxFunctionDefs);
  21900. }
  21901. if (cvt && cvt.length & 1) {
  21902. const cvtData = new Uint8Array(cvt.length + 1);
  21903. cvtData.set(cvt.data);
  21904. cvt.data = cvtData;
  21905. }
  21906. return ttContext.hintsValid;
  21907. }
  21908. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  21909. let header, tables;
  21910. if (isTrueTypeCollectionFile(font)) {
  21911. const ttcData = readTrueTypeCollectionData(font, this.name);
  21912. header = ttcData.header;
  21913. tables = ttcData.tables;
  21914. } else {
  21915. header = readOpenTypeHeader(font);
  21916. tables = readTables(font, header.numTables);
  21917. }
  21918. let cff, cffFile;
  21919. const isTrueType = !tables["CFF "];
  21920. if (!isTrueType) {
  21921. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  21922. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  21923. cffFile = new _stream.Stream(tables["CFF "].data);
  21924. cff = new _cff_font.CFFFont(cffFile, properties);
  21925. adjustWidths(properties);
  21926. return this.convert(name, cff, properties);
  21927. }
  21928. delete tables.glyf;
  21929. delete tables.loca;
  21930. delete tables.fpgm;
  21931. delete tables.prep;
  21932. delete tables["cvt "];
  21933. this.isOpenType = true;
  21934. } else {
  21935. if (!tables.loca) {
  21936. throw new _util.FormatError('Required "loca" table is not found');
  21937. }
  21938. if (!tables.glyf) {
  21939. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  21940. tables.glyf = {
  21941. tag: "glyf",
  21942. data: new Uint8Array(0)
  21943. };
  21944. }
  21945. this.isOpenType = false;
  21946. }
  21947. if (!tables.maxp) {
  21948. throw new _util.FormatError('Required "maxp" table is not found');
  21949. }
  21950. font.pos = (font.start || 0) + tables.maxp.offset;
  21951. const version = font.getInt32();
  21952. const numGlyphs = font.getUint16();
  21953. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  21954. const {
  21955. scaleFactors
  21956. } = properties;
  21957. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  21958. const glyphs = new _glyf.GlyfTable({
  21959. glyfTable: tables.glyf.data,
  21960. isGlyphLocationsLong,
  21961. locaTable: tables.loca.data,
  21962. numGlyphs
  21963. });
  21964. glyphs.scale(scaleFactors);
  21965. const {
  21966. glyf,
  21967. loca,
  21968. isLocationLong
  21969. } = glyphs.write();
  21970. tables.glyf.data = glyf;
  21971. tables.loca.data = loca;
  21972. if (isLocationLong !== !!isGlyphLocationsLong) {
  21973. tables.head.data[50] = 0;
  21974. tables.head.data[51] = isLocationLong ? 1 : 0;
  21975. }
  21976. const metrics = tables.hmtx.data;
  21977. for (let i = 0; i < numGlyphs; i++) {
  21978. const j = 4 * i;
  21979. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  21980. metrics[j] = advanceWidth >> 8 & 0xff;
  21981. metrics[j + 1] = advanceWidth & 0xff;
  21982. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  21983. writeSignedInt16(metrics, j + 2, lsb);
  21984. }
  21985. }
  21986. let numGlyphsOut = numGlyphs + 1;
  21987. let dupFirstEntry = true;
  21988. if (numGlyphsOut > 0xffff) {
  21989. dupFirstEntry = false;
  21990. numGlyphsOut = numGlyphs;
  21991. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  21992. }
  21993. let maxFunctionDefs = 0;
  21994. let maxSizeOfInstructions = 0;
  21995. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  21996. font.pos += 8;
  21997. const maxZones = font.getUint16();
  21998. if (maxZones > 2) {
  21999. tables.maxp.data[14] = 0;
  22000. tables.maxp.data[15] = 2;
  22001. }
  22002. font.pos += 4;
  22003. maxFunctionDefs = font.getUint16();
  22004. font.pos += 4;
  22005. maxSizeOfInstructions = font.getUint16();
  22006. }
  22007. tables.maxp.data[4] = numGlyphsOut >> 8;
  22008. tables.maxp.data[5] = numGlyphsOut & 255;
  22009. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  22010. if (!hintsValid) {
  22011. delete tables.fpgm;
  22012. delete tables.prep;
  22013. delete tables["cvt "];
  22014. }
  22015. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  22016. if (!tables.head) {
  22017. throw new _util.FormatError('Required "head" table is not found');
  22018. }
  22019. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  22020. let missingGlyphs = Object.create(null);
  22021. if (isTrueType) {
  22022. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22023. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  22024. missingGlyphs = glyphsInfo.missingGlyphs;
  22025. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22026. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  22027. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  22028. }
  22029. }
  22030. if (!tables.hhea) {
  22031. throw new _util.FormatError('Required "hhea" table is not found');
  22032. }
  22033. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  22034. tables.hhea.data[10] = 0xff;
  22035. tables.hhea.data[11] = 0xff;
  22036. }
  22037. const metricsOverride = {
  22038. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  22039. yMax: int16(tables.head.data[42], tables.head.data[43]),
  22040. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  22041. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  22042. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  22043. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  22044. };
  22045. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  22046. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  22047. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  22048. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  22049. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  22050. this.lineGap = this.cssFontInfo.metrics.lineGap;
  22051. } else {
  22052. this.lineHeight = this.ascent - this.descent + this.lineGap;
  22053. }
  22054. if (tables.post) {
  22055. readPostScriptTable(tables.post, properties, numGlyphs);
  22056. }
  22057. tables.post = {
  22058. tag: "post",
  22059. data: createPostTable(properties)
  22060. };
  22061. const charCodeToGlyphId = [];
  22062. function hasGlyph(glyphId) {
  22063. return !missingGlyphs[glyphId];
  22064. }
  22065. if (properties.composite) {
  22066. const cidToGidMap = properties.cidToGidMap || [];
  22067. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  22068. properties.cMap.forEach(function (charCode, cid) {
  22069. if (typeof cid === "string") {
  22070. cid = convertCidString(charCode, cid, true);
  22071. }
  22072. if (cid > 0xffff) {
  22073. throw new _util.FormatError("Max size of CID is 65,535");
  22074. }
  22075. let glyphId = -1;
  22076. if (isCidToGidMapEmpty) {
  22077. glyphId = cid;
  22078. } else if (cidToGidMap[cid] !== undefined) {
  22079. glyphId = cidToGidMap[cid];
  22080. }
  22081. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  22082. charCodeToGlyphId[charCode] = glyphId;
  22083. }
  22084. });
  22085. } else {
  22086. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  22087. const cmapPlatformId = cmapTable.platformId;
  22088. const cmapEncodingId = cmapTable.encodingId;
  22089. const cmapMappings = cmapTable.mappings;
  22090. let baseEncoding = [],
  22091. forcePostTable = false;
  22092. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  22093. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22094. }
  22095. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  22096. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22097. for (let charCode = 0; charCode < 256; charCode++) {
  22098. let glyphName;
  22099. if (this.differences[charCode] !== undefined) {
  22100. glyphName = this.differences[charCode];
  22101. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  22102. glyphName = baseEncoding[charCode];
  22103. } else {
  22104. glyphName = _encodings.StandardEncoding[charCode];
  22105. }
  22106. if (!glyphName) {
  22107. continue;
  22108. }
  22109. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  22110. let unicodeOrCharCode;
  22111. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  22112. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  22113. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  22114. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  22115. }
  22116. if (unicodeOrCharCode === undefined) {
  22117. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  22118. const unicode = this.toUnicode.get(charCode);
  22119. if (unicode) {
  22120. unicodeOrCharCode = unicode.codePointAt(0);
  22121. }
  22122. }
  22123. if (unicodeOrCharCode === undefined) {
  22124. continue;
  22125. }
  22126. }
  22127. for (const mapping of cmapMappings) {
  22128. if (mapping.charCode !== unicodeOrCharCode) {
  22129. continue;
  22130. }
  22131. charCodeToGlyphId[charCode] = mapping.glyphId;
  22132. break;
  22133. }
  22134. }
  22135. } else if (cmapPlatformId === 0) {
  22136. for (const mapping of cmapMappings) {
  22137. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  22138. }
  22139. forcePostTable = true;
  22140. } else {
  22141. for (const mapping of cmapMappings) {
  22142. let charCode = mapping.charCode;
  22143. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  22144. charCode &= 0xff;
  22145. }
  22146. charCodeToGlyphId[charCode] = mapping.glyphId;
  22147. }
  22148. }
  22149. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  22150. for (let i = 0; i < 256; ++i) {
  22151. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  22152. continue;
  22153. }
  22154. const glyphName = this.differences[i] || baseEncoding[i];
  22155. if (!glyphName) {
  22156. continue;
  22157. }
  22158. const glyphId = properties.glyphNames.indexOf(glyphName);
  22159. if (glyphId > 0 && hasGlyph(glyphId)) {
  22160. charCodeToGlyphId[i] = glyphId;
  22161. }
  22162. }
  22163. }
  22164. }
  22165. if (charCodeToGlyphId.length === 0) {
  22166. charCodeToGlyphId[0] = 0;
  22167. }
  22168. let glyphZeroId = numGlyphsOut - 1;
  22169. if (!dupFirstEntry) {
  22170. glyphZeroId = 0;
  22171. }
  22172. if (!properties.cssFontInfo) {
  22173. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  22174. this.toFontChar = newMapping.toFontChar;
  22175. tables.cmap = {
  22176. tag: "cmap",
  22177. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  22178. };
  22179. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  22180. tables["OS/2"] = {
  22181. tag: "OS/2",
  22182. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  22183. };
  22184. }
  22185. }
  22186. if (!isTrueType) {
  22187. try {
  22188. cffFile = new _stream.Stream(tables["CFF "].data);
  22189. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  22190. cff = parser.parse();
  22191. cff.duplicateFirstGlyph();
  22192. const compiler = new _cff_parser.CFFCompiler(cff);
  22193. tables["CFF "].data = compiler.compile();
  22194. } catch (e) {
  22195. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22196. }
  22197. }
  22198. if (!tables.name) {
  22199. tables.name = {
  22200. tag: "name",
  22201. data: createNameTable(this.name)
  22202. };
  22203. } else {
  22204. const namePrototype = readNameTable(tables.name);
  22205. tables.name.data = createNameTable(name, namePrototype);
  22206. this.psName = namePrototype[0][6] || null;
  22207. }
  22208. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  22209. for (const tableTag in tables) {
  22210. builder.addTable(tableTag, tables[tableTag].data);
  22211. }
  22212. return builder.toArray();
  22213. }
  22214. convert(fontName, font, properties) {
  22215. properties.fixedPitch = false;
  22216. if (properties.builtInEncoding) {
  22217. adjustToUnicode(properties, properties.builtInEncoding);
  22218. }
  22219. let glyphZeroId = 1;
  22220. if (font instanceof _cff_font.CFFFont) {
  22221. glyphZeroId = font.numGlyphs - 1;
  22222. }
  22223. const mapping = font.getGlyphMapping(properties);
  22224. let newMapping = null;
  22225. let newCharCodeToGlyphId = mapping;
  22226. let toUnicodeExtraMap = null;
  22227. if (!properties.cssFontInfo) {
  22228. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  22229. this.toFontChar = newMapping.toFontChar;
  22230. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  22231. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  22232. }
  22233. const numGlyphs = font.numGlyphs;
  22234. function getCharCodes(charCodeToGlyphId, glyphId) {
  22235. let charCodes = null;
  22236. for (const charCode in charCodeToGlyphId) {
  22237. if (glyphId === charCodeToGlyphId[charCode]) {
  22238. if (!charCodes) {
  22239. charCodes = [];
  22240. }
  22241. charCodes.push(charCode | 0);
  22242. }
  22243. }
  22244. return charCodes;
  22245. }
  22246. function createCharCode(charCodeToGlyphId, glyphId) {
  22247. for (const charCode in charCodeToGlyphId) {
  22248. if (glyphId === charCodeToGlyphId[charCode]) {
  22249. return charCode | 0;
  22250. }
  22251. }
  22252. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22253. return newMapping.nextAvailableFontCharCode++;
  22254. }
  22255. const seacs = font.seacs;
  22256. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22257. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22258. const charset = font.getCharset();
  22259. const seacMap = Object.create(null);
  22260. for (let glyphId in seacs) {
  22261. glyphId |= 0;
  22262. const seac = seacs[glyphId];
  22263. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22264. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22265. const baseGlyphId = charset.indexOf(baseGlyphName);
  22266. const accentGlyphId = charset.indexOf(accentGlyphName);
  22267. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22268. continue;
  22269. }
  22270. const accentOffset = {
  22271. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22272. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22273. };
  22274. const charCodes = getCharCodes(mapping, glyphId);
  22275. if (!charCodes) {
  22276. continue;
  22277. }
  22278. for (const charCode of charCodes) {
  22279. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22280. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22281. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22282. seacMap[charCode] = {
  22283. baseFontCharCode,
  22284. accentFontCharCode,
  22285. accentOffset
  22286. };
  22287. }
  22288. }
  22289. properties.seacMap = seacMap;
  22290. }
  22291. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22292. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22293. builder.addTable("CFF ", font.data);
  22294. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  22295. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  22296. 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");
  22297. 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));
  22298. builder.addTable("hmtx", function fontFieldsHmtx() {
  22299. const charstrings = font.charstrings;
  22300. const cffWidths = font.cff ? font.cff.widths : null;
  22301. let hmtx = "\x00\x00\x00\x00";
  22302. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22303. let width = 0;
  22304. if (charstrings) {
  22305. const charstring = charstrings[i - 1];
  22306. width = "width" in charstring ? charstring.width : 0;
  22307. } else if (cffWidths) {
  22308. width = Math.ceil(cffWidths[i] || 0);
  22309. }
  22310. hmtx += string16(width) + string16(0);
  22311. }
  22312. return hmtx;
  22313. }());
  22314. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22315. builder.addTable("name", createNameTable(fontName));
  22316. builder.addTable("post", createPostTable(properties));
  22317. return builder.toArray();
  22318. }
  22319. get spaceWidth() {
  22320. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22321. let width;
  22322. for (const glyphName of possibleSpaceReplacements) {
  22323. if (glyphName in this.widths) {
  22324. width = this.widths[glyphName];
  22325. break;
  22326. }
  22327. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22328. const glyphUnicode = glyphsUnicodeMap[glyphName];
  22329. let charcode = 0;
  22330. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22331. charcode = this.cMap.lookup(glyphUnicode);
  22332. if (typeof charcode === "string") {
  22333. charcode = convertCidString(glyphUnicode, charcode);
  22334. }
  22335. }
  22336. if (!charcode && this.toUnicode) {
  22337. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22338. }
  22339. if (charcode <= 0) {
  22340. charcode = glyphUnicode;
  22341. }
  22342. width = this.widths[charcode];
  22343. if (width) {
  22344. break;
  22345. }
  22346. }
  22347. width = width || this.defaultWidth;
  22348. return (0, _util.shadow)(this, "spaceWidth", width);
  22349. }
  22350. _charToGlyph(charcode, isSpace = false) {
  22351. let glyph = this._glyphCache[charcode];
  22352. if (glyph && glyph.isSpace === isSpace) {
  22353. return glyph;
  22354. }
  22355. let fontCharCode, width, operatorListId;
  22356. let widthCode = charcode;
  22357. if (this.cMap && this.cMap.contains(charcode)) {
  22358. widthCode = this.cMap.lookup(charcode);
  22359. if (typeof widthCode === "string") {
  22360. widthCode = convertCidString(charcode, widthCode);
  22361. }
  22362. }
  22363. width = this.widths[widthCode];
  22364. if (typeof width !== "number") {
  22365. width = this.defaultWidth;
  22366. }
  22367. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  22368. let unicode = this.toUnicode.get(charcode) || charcode;
  22369. if (typeof unicode === "number") {
  22370. unicode = String.fromCharCode(unicode);
  22371. }
  22372. let isInFont = this.toFontChar[charcode] !== undefined;
  22373. fontCharCode = this.toFontChar[charcode] || charcode;
  22374. if (this.missingFile) {
  22375. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22376. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22377. fontCharCode = 0x20;
  22378. }
  22379. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22380. }
  22381. if (this.isType3Font) {
  22382. operatorListId = fontCharCode;
  22383. }
  22384. let accent = null;
  22385. if (this.seacMap && this.seacMap[charcode]) {
  22386. isInFont = true;
  22387. const seac = this.seacMap[charcode];
  22388. fontCharCode = seac.baseFontCharCode;
  22389. accent = {
  22390. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22391. offset: seac.accentOffset
  22392. };
  22393. }
  22394. let fontChar = "";
  22395. if (typeof fontCharCode === "number") {
  22396. if (fontCharCode <= 0x10ffff) {
  22397. fontChar = String.fromCodePoint(fontCharCode);
  22398. } else {
  22399. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22400. }
  22401. }
  22402. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22403. return this._glyphCache[charcode] = glyph;
  22404. }
  22405. charsToGlyphs(chars) {
  22406. let glyphs = this._charsCache[chars];
  22407. if (glyphs) {
  22408. return glyphs;
  22409. }
  22410. glyphs = [];
  22411. if (this.cMap) {
  22412. const c = Object.create(null),
  22413. ii = chars.length;
  22414. let i = 0;
  22415. while (i < ii) {
  22416. this.cMap.readCharCode(chars, i, c);
  22417. const {
  22418. charcode,
  22419. length
  22420. } = c;
  22421. i += length;
  22422. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  22423. glyphs.push(glyph);
  22424. }
  22425. } else {
  22426. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22427. const charcode = chars.charCodeAt(i);
  22428. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  22429. glyphs.push(glyph);
  22430. }
  22431. }
  22432. return this._charsCache[chars] = glyphs;
  22433. }
  22434. getCharPositions(chars) {
  22435. const positions = [];
  22436. if (this.cMap) {
  22437. const c = Object.create(null);
  22438. let i = 0;
  22439. while (i < chars.length) {
  22440. this.cMap.readCharCode(chars, i, c);
  22441. const length = c.length;
  22442. positions.push([i, i + length]);
  22443. i += length;
  22444. }
  22445. } else {
  22446. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22447. positions.push([i, i + 1]);
  22448. }
  22449. }
  22450. return positions;
  22451. }
  22452. get glyphCacheValues() {
  22453. return Object.values(this._glyphCache);
  22454. }
  22455. encodeString(str) {
  22456. const buffers = [];
  22457. const currentBuf = [];
  22458. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  22459. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  22460. for (let i = 0, ii = str.length; i < ii; i++) {
  22461. const unicode = str.codePointAt(i);
  22462. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  22463. i++;
  22464. }
  22465. if (this.toUnicode) {
  22466. const charCode = getCharCode(unicode);
  22467. if (charCode !== -1) {
  22468. if (hasCurrentBufErrors()) {
  22469. buffers.push(currentBuf.join(""));
  22470. currentBuf.length = 0;
  22471. }
  22472. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  22473. for (let j = charCodeLength - 1; j >= 0; j--) {
  22474. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  22475. }
  22476. continue;
  22477. }
  22478. }
  22479. if (!hasCurrentBufErrors()) {
  22480. buffers.push(currentBuf.join(""));
  22481. currentBuf.length = 0;
  22482. }
  22483. currentBuf.push(String.fromCodePoint(unicode));
  22484. }
  22485. buffers.push(currentBuf.join(""));
  22486. return buffers;
  22487. }
  22488. }
  22489. exports.Font = Font;
  22490. class ErrorFont {
  22491. constructor(error) {
  22492. this.error = error;
  22493. this.loadedName = "g_font_error";
  22494. this.missingFile = true;
  22495. }
  22496. charsToGlyphs() {
  22497. return [];
  22498. }
  22499. encodeString(chars) {
  22500. return [chars];
  22501. }
  22502. exportData(extraProperties = false) {
  22503. return {
  22504. error: this.error
  22505. };
  22506. }
  22507. }
  22508. exports.ErrorFont = ErrorFont;
  22509. /***/ }),
  22510. /* 33 */
  22511. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22512. Object.defineProperty(exports, "__esModule", ({
  22513. value: true
  22514. }));
  22515. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  22516. var _util = __w_pdfjs_require__(2);
  22517. var _charsets = __w_pdfjs_require__(34);
  22518. var _encodings = __w_pdfjs_require__(35);
  22519. const MAX_SUBR_NESTING = 10;
  22520. 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"];
  22521. exports.CFFStandardStrings = CFFStandardStrings;
  22522. const NUM_STANDARD_CFF_STRINGS = 391;
  22523. const CharstringValidationData = [null, {
  22524. id: "hstem",
  22525. min: 2,
  22526. stackClearing: true,
  22527. stem: true
  22528. }, null, {
  22529. id: "vstem",
  22530. min: 2,
  22531. stackClearing: true,
  22532. stem: true
  22533. }, {
  22534. id: "vmoveto",
  22535. min: 1,
  22536. stackClearing: true
  22537. }, {
  22538. id: "rlineto",
  22539. min: 2,
  22540. resetStack: true
  22541. }, {
  22542. id: "hlineto",
  22543. min: 1,
  22544. resetStack: true
  22545. }, {
  22546. id: "vlineto",
  22547. min: 1,
  22548. resetStack: true
  22549. }, {
  22550. id: "rrcurveto",
  22551. min: 6,
  22552. resetStack: true
  22553. }, null, {
  22554. id: "callsubr",
  22555. min: 1,
  22556. undefStack: true
  22557. }, {
  22558. id: "return",
  22559. min: 0,
  22560. undefStack: true
  22561. }, null, null, {
  22562. id: "endchar",
  22563. min: 0,
  22564. stackClearing: true
  22565. }, null, null, null, {
  22566. id: "hstemhm",
  22567. min: 2,
  22568. stackClearing: true,
  22569. stem: true
  22570. }, {
  22571. id: "hintmask",
  22572. min: 0,
  22573. stackClearing: true
  22574. }, {
  22575. id: "cntrmask",
  22576. min: 0,
  22577. stackClearing: true
  22578. }, {
  22579. id: "rmoveto",
  22580. min: 2,
  22581. stackClearing: true
  22582. }, {
  22583. id: "hmoveto",
  22584. min: 1,
  22585. stackClearing: true
  22586. }, {
  22587. id: "vstemhm",
  22588. min: 2,
  22589. stackClearing: true,
  22590. stem: true
  22591. }, {
  22592. id: "rcurveline",
  22593. min: 8,
  22594. resetStack: true
  22595. }, {
  22596. id: "rlinecurve",
  22597. min: 8,
  22598. resetStack: true
  22599. }, {
  22600. id: "vvcurveto",
  22601. min: 4,
  22602. resetStack: true
  22603. }, {
  22604. id: "hhcurveto",
  22605. min: 4,
  22606. resetStack: true
  22607. }, null, {
  22608. id: "callgsubr",
  22609. min: 1,
  22610. undefStack: true
  22611. }, {
  22612. id: "vhcurveto",
  22613. min: 4,
  22614. resetStack: true
  22615. }, {
  22616. id: "hvcurveto",
  22617. min: 4,
  22618. resetStack: true
  22619. }];
  22620. const CharstringValidationData12 = [null, null, null, {
  22621. id: "and",
  22622. min: 2,
  22623. stackDelta: -1
  22624. }, {
  22625. id: "or",
  22626. min: 2,
  22627. stackDelta: -1
  22628. }, {
  22629. id: "not",
  22630. min: 1,
  22631. stackDelta: 0
  22632. }, null, null, null, {
  22633. id: "abs",
  22634. min: 1,
  22635. stackDelta: 0
  22636. }, {
  22637. id: "add",
  22638. min: 2,
  22639. stackDelta: -1,
  22640. stackFn(stack, index) {
  22641. stack[index - 2] = stack[index - 2] + stack[index - 1];
  22642. }
  22643. }, {
  22644. id: "sub",
  22645. min: 2,
  22646. stackDelta: -1,
  22647. stackFn(stack, index) {
  22648. stack[index - 2] = stack[index - 2] - stack[index - 1];
  22649. }
  22650. }, {
  22651. id: "div",
  22652. min: 2,
  22653. stackDelta: -1,
  22654. stackFn(stack, index) {
  22655. stack[index - 2] = stack[index - 2] / stack[index - 1];
  22656. }
  22657. }, null, {
  22658. id: "neg",
  22659. min: 1,
  22660. stackDelta: 0,
  22661. stackFn(stack, index) {
  22662. stack[index - 1] = -stack[index - 1];
  22663. }
  22664. }, {
  22665. id: "eq",
  22666. min: 2,
  22667. stackDelta: -1
  22668. }, null, null, {
  22669. id: "drop",
  22670. min: 1,
  22671. stackDelta: -1
  22672. }, null, {
  22673. id: "put",
  22674. min: 2,
  22675. stackDelta: -2
  22676. }, {
  22677. id: "get",
  22678. min: 1,
  22679. stackDelta: 0
  22680. }, {
  22681. id: "ifelse",
  22682. min: 4,
  22683. stackDelta: -3
  22684. }, {
  22685. id: "random",
  22686. min: 0,
  22687. stackDelta: 1
  22688. }, {
  22689. id: "mul",
  22690. min: 2,
  22691. stackDelta: -1,
  22692. stackFn(stack, index) {
  22693. stack[index - 2] = stack[index - 2] * stack[index - 1];
  22694. }
  22695. }, null, {
  22696. id: "sqrt",
  22697. min: 1,
  22698. stackDelta: 0
  22699. }, {
  22700. id: "dup",
  22701. min: 1,
  22702. stackDelta: 1
  22703. }, {
  22704. id: "exch",
  22705. min: 2,
  22706. stackDelta: 0
  22707. }, {
  22708. id: "index",
  22709. min: 2,
  22710. stackDelta: 0
  22711. }, {
  22712. id: "roll",
  22713. min: 3,
  22714. stackDelta: -2
  22715. }, null, null, null, {
  22716. id: "hflex",
  22717. min: 7,
  22718. resetStack: true
  22719. }, {
  22720. id: "flex",
  22721. min: 13,
  22722. resetStack: true
  22723. }, {
  22724. id: "hflex1",
  22725. min: 9,
  22726. resetStack: true
  22727. }, {
  22728. id: "flex1",
  22729. min: 11,
  22730. resetStack: true
  22731. }];
  22732. class CFFParser {
  22733. constructor(file, properties, seacAnalysisEnabled) {
  22734. this.bytes = file.getBytes();
  22735. this.properties = properties;
  22736. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22737. }
  22738. parse() {
  22739. const properties = this.properties;
  22740. const cff = new CFF();
  22741. this.cff = cff;
  22742. const header = this.parseHeader();
  22743. const nameIndex = this.parseIndex(header.endPos);
  22744. const topDictIndex = this.parseIndex(nameIndex.endPos);
  22745. const stringIndex = this.parseIndex(topDictIndex.endPos);
  22746. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  22747. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  22748. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  22749. cff.header = header.obj;
  22750. cff.names = this.parseNameIndex(nameIndex.obj);
  22751. cff.strings = this.parseStringIndex(stringIndex.obj);
  22752. cff.topDict = topDict;
  22753. cff.globalSubrIndex = globalSubrIndex.obj;
  22754. this.parsePrivateDict(cff.topDict);
  22755. cff.isCIDFont = topDict.hasName("ROS");
  22756. const charStringOffset = topDict.getByName("CharStrings");
  22757. const charStringIndex = this.parseIndex(charStringOffset).obj;
  22758. const fontMatrix = topDict.getByName("FontMatrix");
  22759. if (fontMatrix) {
  22760. properties.fontMatrix = fontMatrix;
  22761. }
  22762. const fontBBox = topDict.getByName("FontBBox");
  22763. if (fontBBox) {
  22764. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22765. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22766. properties.ascentScaled = true;
  22767. }
  22768. let charset, encoding;
  22769. if (cff.isCIDFont) {
  22770. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  22771. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  22772. const dictRaw = fdArrayIndex.get(i);
  22773. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  22774. this.parsePrivateDict(fontDict);
  22775. cff.fdArray.push(fontDict);
  22776. }
  22777. encoding = null;
  22778. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  22779. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  22780. } else {
  22781. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  22782. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  22783. }
  22784. cff.charset = charset;
  22785. cff.encoding = encoding;
  22786. const charStringsAndSeacs = this.parseCharStrings({
  22787. charStrings: charStringIndex,
  22788. localSubrIndex: topDict.privateDict.subrsIndex,
  22789. globalSubrIndex: globalSubrIndex.obj,
  22790. fdSelect: cff.fdSelect,
  22791. fdArray: cff.fdArray,
  22792. privateDict: topDict.privateDict
  22793. });
  22794. cff.charStrings = charStringsAndSeacs.charStrings;
  22795. cff.seacs = charStringsAndSeacs.seacs;
  22796. cff.widths = charStringsAndSeacs.widths;
  22797. return cff;
  22798. }
  22799. parseHeader() {
  22800. let bytes = this.bytes;
  22801. const bytesLength = bytes.length;
  22802. let offset = 0;
  22803. while (offset < bytesLength && bytes[offset] !== 1) {
  22804. ++offset;
  22805. }
  22806. if (offset >= bytesLength) {
  22807. throw new _util.FormatError("Invalid CFF header");
  22808. }
  22809. if (offset !== 0) {
  22810. (0, _util.info)("cff data is shifted");
  22811. bytes = bytes.subarray(offset);
  22812. this.bytes = bytes;
  22813. }
  22814. const major = bytes[0];
  22815. const minor = bytes[1];
  22816. const hdrSize = bytes[2];
  22817. const offSize = bytes[3];
  22818. const header = new CFFHeader(major, minor, hdrSize, offSize);
  22819. return {
  22820. obj: header,
  22821. endPos: hdrSize
  22822. };
  22823. }
  22824. parseDict(dict) {
  22825. let pos = 0;
  22826. function parseOperand() {
  22827. let value = dict[pos++];
  22828. if (value === 30) {
  22829. return parseFloatOperand();
  22830. } else if (value === 28) {
  22831. value = dict[pos++];
  22832. value = (value << 24 | dict[pos++] << 16) >> 16;
  22833. return value;
  22834. } else if (value === 29) {
  22835. value = dict[pos++];
  22836. value = value << 8 | dict[pos++];
  22837. value = value << 8 | dict[pos++];
  22838. value = value << 8 | dict[pos++];
  22839. return value;
  22840. } else if (value >= 32 && value <= 246) {
  22841. return value - 139;
  22842. } else if (value >= 247 && value <= 250) {
  22843. return (value - 247) * 256 + dict[pos++] + 108;
  22844. } else if (value >= 251 && value <= 254) {
  22845. return -((value - 251) * 256) - dict[pos++] - 108;
  22846. }
  22847. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  22848. return NaN;
  22849. }
  22850. function parseFloatOperand() {
  22851. let str = "";
  22852. const eof = 15;
  22853. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  22854. const length = dict.length;
  22855. while (pos < length) {
  22856. const b = dict[pos++];
  22857. const b1 = b >> 4;
  22858. const b2 = b & 15;
  22859. if (b1 === eof) {
  22860. break;
  22861. }
  22862. str += lookup[b1];
  22863. if (b2 === eof) {
  22864. break;
  22865. }
  22866. str += lookup[b2];
  22867. }
  22868. return parseFloat(str);
  22869. }
  22870. let operands = [];
  22871. const entries = [];
  22872. pos = 0;
  22873. const end = dict.length;
  22874. while (pos < end) {
  22875. let b = dict[pos];
  22876. if (b <= 21) {
  22877. if (b === 12) {
  22878. b = b << 8 | dict[++pos];
  22879. }
  22880. entries.push([b, operands]);
  22881. operands = [];
  22882. ++pos;
  22883. } else {
  22884. operands.push(parseOperand());
  22885. }
  22886. }
  22887. return entries;
  22888. }
  22889. parseIndex(pos) {
  22890. const cffIndex = new CFFIndex();
  22891. const bytes = this.bytes;
  22892. const count = bytes[pos++] << 8 | bytes[pos++];
  22893. const offsets = [];
  22894. let end = pos;
  22895. let i, ii;
  22896. if (count !== 0) {
  22897. const offsetSize = bytes[pos++];
  22898. const startPos = pos + (count + 1) * offsetSize - 1;
  22899. for (i = 0, ii = count + 1; i < ii; ++i) {
  22900. let offset = 0;
  22901. for (let j = 0; j < offsetSize; ++j) {
  22902. offset <<= 8;
  22903. offset += bytes[pos++];
  22904. }
  22905. offsets.push(startPos + offset);
  22906. }
  22907. end = offsets[count];
  22908. }
  22909. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  22910. const offsetStart = offsets[i];
  22911. const offsetEnd = offsets[i + 1];
  22912. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  22913. }
  22914. return {
  22915. obj: cffIndex,
  22916. endPos: end
  22917. };
  22918. }
  22919. parseNameIndex(index) {
  22920. const names = [];
  22921. for (let i = 0, ii = index.count; i < ii; ++i) {
  22922. const name = index.get(i);
  22923. names.push((0, _util.bytesToString)(name));
  22924. }
  22925. return names;
  22926. }
  22927. parseStringIndex(index) {
  22928. const strings = new CFFStrings();
  22929. for (let i = 0, ii = index.count; i < ii; ++i) {
  22930. const data = index.get(i);
  22931. strings.add((0, _util.bytesToString)(data));
  22932. }
  22933. return strings;
  22934. }
  22935. createDict(Type, dict, strings) {
  22936. const cffDict = new Type(strings);
  22937. for (const [key, value] of dict) {
  22938. cffDict.setByKey(key, value);
  22939. }
  22940. return cffDict;
  22941. }
  22942. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  22943. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  22944. return false;
  22945. }
  22946. let stackSize = state.stackSize;
  22947. const stack = state.stack;
  22948. const length = data.length;
  22949. for (let j = 0; j < length;) {
  22950. const value = data[j++];
  22951. let validationCommand = null;
  22952. if (value === 12) {
  22953. const q = data[j++];
  22954. if (q === 0) {
  22955. data[j - 2] = 139;
  22956. data[j - 1] = 22;
  22957. stackSize = 0;
  22958. } else {
  22959. validationCommand = CharstringValidationData12[q];
  22960. }
  22961. } else if (value === 28) {
  22962. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  22963. j += 2;
  22964. stackSize++;
  22965. } else if (value === 14) {
  22966. if (stackSize >= 4) {
  22967. stackSize -= 4;
  22968. if (this.seacAnalysisEnabled) {
  22969. state.seac = stack.slice(stackSize, stackSize + 4);
  22970. return false;
  22971. }
  22972. }
  22973. validationCommand = CharstringValidationData[value];
  22974. } else if (value >= 32 && value <= 246) {
  22975. stack[stackSize] = value - 139;
  22976. stackSize++;
  22977. } else if (value >= 247 && value <= 254) {
  22978. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  22979. j++;
  22980. stackSize++;
  22981. } else if (value === 255) {
  22982. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  22983. j += 4;
  22984. stackSize++;
  22985. } else if (value === 19 || value === 20) {
  22986. state.hints += stackSize >> 1;
  22987. j += state.hints + 7 >> 3;
  22988. stackSize %= 2;
  22989. validationCommand = CharstringValidationData[value];
  22990. } else if (value === 10 || value === 29) {
  22991. let subrsIndex;
  22992. if (value === 10) {
  22993. subrsIndex = localSubrIndex;
  22994. } else {
  22995. subrsIndex = globalSubrIndex;
  22996. }
  22997. if (!subrsIndex) {
  22998. validationCommand = CharstringValidationData[value];
  22999. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23000. return false;
  23001. }
  23002. let bias = 32768;
  23003. if (subrsIndex.count < 1240) {
  23004. bias = 107;
  23005. } else if (subrsIndex.count < 33900) {
  23006. bias = 1131;
  23007. }
  23008. const subrNumber = stack[--stackSize] + bias;
  23009. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23010. validationCommand = CharstringValidationData[value];
  23011. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23012. return false;
  23013. }
  23014. state.stackSize = stackSize;
  23015. state.callDepth++;
  23016. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23017. if (!valid) {
  23018. return false;
  23019. }
  23020. state.callDepth--;
  23021. stackSize = state.stackSize;
  23022. continue;
  23023. } else if (value === 11) {
  23024. state.stackSize = stackSize;
  23025. return true;
  23026. } else if (value === 0 && j === data.length) {
  23027. data[j - 1] = 14;
  23028. validationCommand = CharstringValidationData[14];
  23029. } else {
  23030. validationCommand = CharstringValidationData[value];
  23031. }
  23032. if (validationCommand) {
  23033. if (validationCommand.stem) {
  23034. state.hints += stackSize >> 1;
  23035. if (value === 3 || value === 23) {
  23036. state.hasVStems = true;
  23037. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23038. (0, _util.warn)("CFF stem hints are in wrong order");
  23039. data[j - 1] = value === 1 ? 3 : 23;
  23040. }
  23041. }
  23042. if ("min" in validationCommand) {
  23043. if (!state.undefStack && stackSize < validationCommand.min) {
  23044. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23045. if (stackSize === 0) {
  23046. data[j - 1] = 14;
  23047. return true;
  23048. }
  23049. return false;
  23050. }
  23051. }
  23052. if (state.firstStackClearing && validationCommand.stackClearing) {
  23053. state.firstStackClearing = false;
  23054. stackSize -= validationCommand.min;
  23055. if (stackSize >= 2 && validationCommand.stem) {
  23056. stackSize %= 2;
  23057. } else if (stackSize > 1) {
  23058. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23059. }
  23060. if (stackSize > 0) {
  23061. state.width = stack[stackSize - 1];
  23062. }
  23063. }
  23064. if ("stackDelta" in validationCommand) {
  23065. if ("stackFn" in validationCommand) {
  23066. validationCommand.stackFn(stack, stackSize);
  23067. }
  23068. stackSize += validationCommand.stackDelta;
  23069. } else if (validationCommand.stackClearing) {
  23070. stackSize = 0;
  23071. } else if (validationCommand.resetStack) {
  23072. stackSize = 0;
  23073. state.undefStack = false;
  23074. } else if (validationCommand.undefStack) {
  23075. stackSize = 0;
  23076. state.undefStack = true;
  23077. state.firstStackClearing = false;
  23078. }
  23079. }
  23080. }
  23081. state.stackSize = stackSize;
  23082. return true;
  23083. }
  23084. parseCharStrings({
  23085. charStrings,
  23086. localSubrIndex,
  23087. globalSubrIndex,
  23088. fdSelect,
  23089. fdArray,
  23090. privateDict
  23091. }) {
  23092. const seacs = [];
  23093. const widths = [];
  23094. const count = charStrings.count;
  23095. for (let i = 0; i < count; i++) {
  23096. const charstring = charStrings.get(i);
  23097. const state = {
  23098. callDepth: 0,
  23099. stackSize: 0,
  23100. stack: [],
  23101. undefStack: true,
  23102. hints: 0,
  23103. firstStackClearing: true,
  23104. seac: null,
  23105. width: null,
  23106. hasVStems: false
  23107. };
  23108. let valid = true;
  23109. let localSubrToUse = null;
  23110. let privateDictToUse = privateDict;
  23111. if (fdSelect && fdArray.length) {
  23112. const fdIndex = fdSelect.getFDIndex(i);
  23113. if (fdIndex === -1) {
  23114. (0, _util.warn)("Glyph index is not in fd select.");
  23115. valid = false;
  23116. }
  23117. if (fdIndex >= fdArray.length) {
  23118. (0, _util.warn)("Invalid fd index for glyph index.");
  23119. valid = false;
  23120. }
  23121. if (valid) {
  23122. privateDictToUse = fdArray[fdIndex].privateDict;
  23123. localSubrToUse = privateDictToUse.subrsIndex;
  23124. }
  23125. } else if (localSubrIndex) {
  23126. localSubrToUse = localSubrIndex;
  23127. }
  23128. if (valid) {
  23129. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23130. }
  23131. if (state.width !== null) {
  23132. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23133. widths[i] = nominalWidth + state.width;
  23134. } else {
  23135. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23136. widths[i] = defaultWidth;
  23137. }
  23138. if (state.seac !== null) {
  23139. seacs[i] = state.seac;
  23140. }
  23141. if (!valid) {
  23142. charStrings.set(i, new Uint8Array([14]));
  23143. }
  23144. }
  23145. return {
  23146. charStrings,
  23147. seacs,
  23148. widths
  23149. };
  23150. }
  23151. emptyPrivateDictionary(parentDict) {
  23152. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23153. parentDict.setByKey(18, [0, 0]);
  23154. parentDict.privateDict = privateDict;
  23155. }
  23156. parsePrivateDict(parentDict) {
  23157. if (!parentDict.hasName("Private")) {
  23158. this.emptyPrivateDictionary(parentDict);
  23159. return;
  23160. }
  23161. const privateOffset = parentDict.getByName("Private");
  23162. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23163. parentDict.removeByName("Private");
  23164. return;
  23165. }
  23166. const size = privateOffset[0];
  23167. const offset = privateOffset[1];
  23168. if (size === 0 || offset >= this.bytes.length) {
  23169. this.emptyPrivateDictionary(parentDict);
  23170. return;
  23171. }
  23172. const privateDictEnd = offset + size;
  23173. const dictData = this.bytes.subarray(offset, privateDictEnd);
  23174. const dict = this.parseDict(dictData);
  23175. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23176. parentDict.privateDict = privateDict;
  23177. if (!privateDict.getByName("Subrs")) {
  23178. return;
  23179. }
  23180. const subrsOffset = privateDict.getByName("Subrs");
  23181. const relativeOffset = offset + subrsOffset;
  23182. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23183. this.emptyPrivateDictionary(parentDict);
  23184. return;
  23185. }
  23186. const subrsIndex = this.parseIndex(relativeOffset);
  23187. privateDict.subrsIndex = subrsIndex.obj;
  23188. }
  23189. parseCharsets(pos, length, strings, cid) {
  23190. if (pos === 0) {
  23191. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23192. } else if (pos === 1) {
  23193. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23194. } else if (pos === 2) {
  23195. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23196. }
  23197. const bytes = this.bytes;
  23198. const start = pos;
  23199. const format = bytes[pos++];
  23200. const charset = [cid ? 0 : ".notdef"];
  23201. let id, count, i;
  23202. length -= 1;
  23203. switch (format) {
  23204. case 0:
  23205. for (i = 0; i < length; i++) {
  23206. id = bytes[pos++] << 8 | bytes[pos++];
  23207. charset.push(cid ? id : strings.get(id));
  23208. }
  23209. break;
  23210. case 1:
  23211. while (charset.length <= length) {
  23212. id = bytes[pos++] << 8 | bytes[pos++];
  23213. count = bytes[pos++];
  23214. for (i = 0; i <= count; i++) {
  23215. charset.push(cid ? id++ : strings.get(id++));
  23216. }
  23217. }
  23218. break;
  23219. case 2:
  23220. while (charset.length <= length) {
  23221. id = bytes[pos++] << 8 | bytes[pos++];
  23222. count = bytes[pos++] << 8 | bytes[pos++];
  23223. for (i = 0; i <= count; i++) {
  23224. charset.push(cid ? id++ : strings.get(id++));
  23225. }
  23226. }
  23227. break;
  23228. default:
  23229. throw new _util.FormatError("Unknown charset format");
  23230. }
  23231. const end = pos;
  23232. const raw = bytes.subarray(start, end);
  23233. return new CFFCharset(false, format, charset, raw);
  23234. }
  23235. parseEncoding(pos, properties, strings, charset) {
  23236. const encoding = Object.create(null);
  23237. const bytes = this.bytes;
  23238. let predefined = false;
  23239. let format, i, ii;
  23240. let raw = null;
  23241. function readSupplement() {
  23242. const supplementsCount = bytes[pos++];
  23243. for (i = 0; i < supplementsCount; i++) {
  23244. const code = bytes[pos++];
  23245. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23246. encoding[code] = charset.indexOf(strings.get(sid));
  23247. }
  23248. }
  23249. if (pos === 0 || pos === 1) {
  23250. predefined = true;
  23251. format = pos;
  23252. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23253. for (i = 0, ii = charset.length; i < ii; i++) {
  23254. const index = baseEncoding.indexOf(charset[i]);
  23255. if (index !== -1) {
  23256. encoding[index] = i;
  23257. }
  23258. }
  23259. } else {
  23260. const dataStart = pos;
  23261. format = bytes[pos++];
  23262. switch (format & 0x7f) {
  23263. case 0:
  23264. const glyphsCount = bytes[pos++];
  23265. for (i = 1; i <= glyphsCount; i++) {
  23266. encoding[bytes[pos++]] = i;
  23267. }
  23268. break;
  23269. case 1:
  23270. const rangesCount = bytes[pos++];
  23271. let gid = 1;
  23272. for (i = 0; i < rangesCount; i++) {
  23273. const start = bytes[pos++];
  23274. const left = bytes[pos++];
  23275. for (let j = start; j <= start + left; j++) {
  23276. encoding[j] = gid++;
  23277. }
  23278. }
  23279. break;
  23280. default:
  23281. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23282. }
  23283. const dataEnd = pos;
  23284. if (format & 0x80) {
  23285. bytes[dataStart] &= 0x7f;
  23286. readSupplement();
  23287. }
  23288. raw = bytes.subarray(dataStart, dataEnd);
  23289. }
  23290. format &= 0x7f;
  23291. return new CFFEncoding(predefined, format, encoding, raw);
  23292. }
  23293. parseFDSelect(pos, length) {
  23294. const bytes = this.bytes;
  23295. const format = bytes[pos++];
  23296. const fdSelect = [];
  23297. let i;
  23298. switch (format) {
  23299. case 0:
  23300. for (i = 0; i < length; ++i) {
  23301. const id = bytes[pos++];
  23302. fdSelect.push(id);
  23303. }
  23304. break;
  23305. case 3:
  23306. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23307. for (i = 0; i < rangesCount; ++i) {
  23308. let first = bytes[pos++] << 8 | bytes[pos++];
  23309. if (i === 0 && first !== 0) {
  23310. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23311. first = 0;
  23312. }
  23313. const fdIndex = bytes[pos++];
  23314. const next = bytes[pos] << 8 | bytes[pos + 1];
  23315. for (let j = first; j < next; ++j) {
  23316. fdSelect.push(fdIndex);
  23317. }
  23318. }
  23319. pos += 2;
  23320. break;
  23321. default:
  23322. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23323. }
  23324. if (fdSelect.length !== length) {
  23325. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23326. }
  23327. return new CFFFDSelect(format, fdSelect);
  23328. }
  23329. }
  23330. exports.CFFParser = CFFParser;
  23331. class CFF {
  23332. constructor() {
  23333. this.header = null;
  23334. this.names = [];
  23335. this.topDict = null;
  23336. this.strings = new CFFStrings();
  23337. this.globalSubrIndex = null;
  23338. this.encoding = null;
  23339. this.charset = null;
  23340. this.charStrings = null;
  23341. this.fdArray = [];
  23342. this.fdSelect = null;
  23343. this.isCIDFont = false;
  23344. }
  23345. duplicateFirstGlyph() {
  23346. if (this.charStrings.count >= 65535) {
  23347. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23348. return;
  23349. }
  23350. const glyphZero = this.charStrings.get(0);
  23351. this.charStrings.add(glyphZero);
  23352. if (this.isCIDFont) {
  23353. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23354. }
  23355. }
  23356. hasGlyphId(id) {
  23357. if (id < 0 || id >= this.charStrings.count) {
  23358. return false;
  23359. }
  23360. const glyph = this.charStrings.get(id);
  23361. return glyph.length > 0;
  23362. }
  23363. }
  23364. exports.CFF = CFF;
  23365. class CFFHeader {
  23366. constructor(major, minor, hdrSize, offSize) {
  23367. this.major = major;
  23368. this.minor = minor;
  23369. this.hdrSize = hdrSize;
  23370. this.offSize = offSize;
  23371. }
  23372. }
  23373. exports.CFFHeader = CFFHeader;
  23374. class CFFStrings {
  23375. constructor() {
  23376. this.strings = [];
  23377. }
  23378. get(index) {
  23379. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23380. return CFFStandardStrings[index];
  23381. }
  23382. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23383. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23384. }
  23385. return CFFStandardStrings[0];
  23386. }
  23387. getSID(str) {
  23388. let index = CFFStandardStrings.indexOf(str);
  23389. if (index !== -1) {
  23390. return index;
  23391. }
  23392. index = this.strings.indexOf(str);
  23393. if (index !== -1) {
  23394. return index + NUM_STANDARD_CFF_STRINGS;
  23395. }
  23396. return -1;
  23397. }
  23398. add(value) {
  23399. this.strings.push(value);
  23400. }
  23401. get count() {
  23402. return this.strings.length;
  23403. }
  23404. }
  23405. exports.CFFStrings = CFFStrings;
  23406. class CFFIndex {
  23407. constructor() {
  23408. this.objects = [];
  23409. this.length = 0;
  23410. }
  23411. add(data) {
  23412. this.length += data.length;
  23413. this.objects.push(data);
  23414. }
  23415. set(index, data) {
  23416. this.length += data.length - this.objects[index].length;
  23417. this.objects[index] = data;
  23418. }
  23419. get(index) {
  23420. return this.objects[index];
  23421. }
  23422. get count() {
  23423. return this.objects.length;
  23424. }
  23425. }
  23426. exports.CFFIndex = CFFIndex;
  23427. class CFFDict {
  23428. constructor(tables, strings) {
  23429. this.keyToNameMap = tables.keyToNameMap;
  23430. this.nameToKeyMap = tables.nameToKeyMap;
  23431. this.defaults = tables.defaults;
  23432. this.types = tables.types;
  23433. this.opcodes = tables.opcodes;
  23434. this.order = tables.order;
  23435. this.strings = strings;
  23436. this.values = Object.create(null);
  23437. }
  23438. setByKey(key, value) {
  23439. if (!(key in this.keyToNameMap)) {
  23440. return false;
  23441. }
  23442. if (value.length === 0) {
  23443. return true;
  23444. }
  23445. for (const val of value) {
  23446. if (isNaN(val)) {
  23447. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  23448. return true;
  23449. }
  23450. }
  23451. const type = this.types[key];
  23452. if (type === "num" || type === "sid" || type === "offset") {
  23453. value = value[0];
  23454. }
  23455. this.values[key] = value;
  23456. return true;
  23457. }
  23458. setByName(name, value) {
  23459. if (!(name in this.nameToKeyMap)) {
  23460. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23461. }
  23462. this.values[this.nameToKeyMap[name]] = value;
  23463. }
  23464. hasName(name) {
  23465. return this.nameToKeyMap[name] in this.values;
  23466. }
  23467. getByName(name) {
  23468. if (!(name in this.nameToKeyMap)) {
  23469. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23470. }
  23471. const key = this.nameToKeyMap[name];
  23472. if (!(key in this.values)) {
  23473. return this.defaults[key];
  23474. }
  23475. return this.values[key];
  23476. }
  23477. removeByName(name) {
  23478. delete this.values[this.nameToKeyMap[name]];
  23479. }
  23480. static createTables(layout) {
  23481. const tables = {
  23482. keyToNameMap: {},
  23483. nameToKeyMap: {},
  23484. defaults: {},
  23485. types: {},
  23486. opcodes: {},
  23487. order: []
  23488. };
  23489. for (const entry of layout) {
  23490. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23491. tables.keyToNameMap[key] = entry[1];
  23492. tables.nameToKeyMap[entry[1]] = key;
  23493. tables.types[key] = entry[2];
  23494. tables.defaults[key] = entry[3];
  23495. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23496. tables.order.push(key);
  23497. }
  23498. return tables;
  23499. }
  23500. }
  23501. const CFFTopDictLayout = [[[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]];
  23502. class CFFTopDict extends CFFDict {
  23503. static get tables() {
  23504. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  23505. }
  23506. constructor(strings) {
  23507. super(CFFTopDict.tables, strings);
  23508. this.privateDict = null;
  23509. }
  23510. }
  23511. exports.CFFTopDict = CFFTopDict;
  23512. const CFFPrivateDictLayout = [[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]];
  23513. class CFFPrivateDict extends CFFDict {
  23514. static get tables() {
  23515. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  23516. }
  23517. constructor(strings) {
  23518. super(CFFPrivateDict.tables, strings);
  23519. this.subrsIndex = null;
  23520. }
  23521. }
  23522. exports.CFFPrivateDict = CFFPrivateDict;
  23523. const CFFCharsetPredefinedTypes = {
  23524. ISO_ADOBE: 0,
  23525. EXPERT: 1,
  23526. EXPERT_SUBSET: 2
  23527. };
  23528. class CFFCharset {
  23529. constructor(predefined, format, charset, raw) {
  23530. this.predefined = predefined;
  23531. this.format = format;
  23532. this.charset = charset;
  23533. this.raw = raw;
  23534. }
  23535. }
  23536. exports.CFFCharset = CFFCharset;
  23537. class CFFEncoding {
  23538. constructor(predefined, format, encoding, raw) {
  23539. this.predefined = predefined;
  23540. this.format = format;
  23541. this.encoding = encoding;
  23542. this.raw = raw;
  23543. }
  23544. }
  23545. class CFFFDSelect {
  23546. constructor(format, fdSelect) {
  23547. this.format = format;
  23548. this.fdSelect = fdSelect;
  23549. }
  23550. getFDIndex(glyphIndex) {
  23551. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23552. return -1;
  23553. }
  23554. return this.fdSelect[glyphIndex];
  23555. }
  23556. }
  23557. exports.CFFFDSelect = CFFFDSelect;
  23558. class CFFOffsetTracker {
  23559. constructor() {
  23560. this.offsets = Object.create(null);
  23561. }
  23562. isTracking(key) {
  23563. return key in this.offsets;
  23564. }
  23565. track(key, location) {
  23566. if (key in this.offsets) {
  23567. throw new _util.FormatError(`Already tracking location of ${key}`);
  23568. }
  23569. this.offsets[key] = location;
  23570. }
  23571. offset(value) {
  23572. for (const key in this.offsets) {
  23573. this.offsets[key] += value;
  23574. }
  23575. }
  23576. setEntryLocation(key, values, output) {
  23577. if (!(key in this.offsets)) {
  23578. throw new _util.FormatError(`Not tracking location of ${key}`);
  23579. }
  23580. const data = output.data;
  23581. const dataOffset = this.offsets[key];
  23582. const size = 5;
  23583. for (let i = 0, ii = values.length; i < ii; ++i) {
  23584. const offset0 = i * size + dataOffset;
  23585. const offset1 = offset0 + 1;
  23586. const offset2 = offset0 + 2;
  23587. const offset3 = offset0 + 3;
  23588. const offset4 = offset0 + 4;
  23589. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23590. throw new _util.FormatError("writing to an offset that is not empty");
  23591. }
  23592. const value = values[i];
  23593. data[offset0] = 0x1d;
  23594. data[offset1] = value >> 24 & 0xff;
  23595. data[offset2] = value >> 16 & 0xff;
  23596. data[offset3] = value >> 8 & 0xff;
  23597. data[offset4] = value & 0xff;
  23598. }
  23599. }
  23600. }
  23601. class CFFCompiler {
  23602. constructor(cff) {
  23603. this.cff = cff;
  23604. }
  23605. compile() {
  23606. const cff = this.cff;
  23607. const output = {
  23608. data: [],
  23609. length: 0,
  23610. add(data) {
  23611. this.data = this.data.concat(data);
  23612. this.length = this.data.length;
  23613. }
  23614. };
  23615. const header = this.compileHeader(cff.header);
  23616. output.add(header);
  23617. const nameIndex = this.compileNameIndex(cff.names);
  23618. output.add(nameIndex);
  23619. if (cff.isCIDFont) {
  23620. if (cff.topDict.hasName("FontMatrix")) {
  23621. const base = cff.topDict.getByName("FontMatrix");
  23622. cff.topDict.removeByName("FontMatrix");
  23623. for (const subDict of cff.fdArray) {
  23624. let matrix = base.slice(0);
  23625. if (subDict.hasName("FontMatrix")) {
  23626. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  23627. }
  23628. subDict.setByName("FontMatrix", matrix);
  23629. }
  23630. }
  23631. }
  23632. const xuid = cff.topDict.getByName("XUID");
  23633. if (xuid && xuid.length > 16) {
  23634. cff.topDict.removeByName("XUID");
  23635. }
  23636. cff.topDict.setByName("charset", 0);
  23637. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  23638. output.add(compiled.output);
  23639. const topDictTracker = compiled.trackers[0];
  23640. const stringIndex = this.compileStringIndex(cff.strings.strings);
  23641. output.add(stringIndex);
  23642. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  23643. output.add(globalSubrIndex);
  23644. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  23645. if (cff.encoding.predefined) {
  23646. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  23647. } else {
  23648. const encoding = this.compileEncoding(cff.encoding);
  23649. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  23650. output.add(encoding);
  23651. }
  23652. }
  23653. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  23654. topDictTracker.setEntryLocation("charset", [output.length], output);
  23655. output.add(charset);
  23656. const charStrings = this.compileCharStrings(cff.charStrings);
  23657. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  23658. output.add(charStrings);
  23659. if (cff.isCIDFont) {
  23660. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  23661. const fdSelect = this.compileFDSelect(cff.fdSelect);
  23662. output.add(fdSelect);
  23663. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  23664. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  23665. output.add(compiled.output);
  23666. const fontDictTrackers = compiled.trackers;
  23667. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  23668. }
  23669. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  23670. output.add([0]);
  23671. return output.data;
  23672. }
  23673. encodeNumber(value) {
  23674. if (Number.isInteger(value)) {
  23675. return this.encodeInteger(value);
  23676. }
  23677. return this.encodeFloat(value);
  23678. }
  23679. static get EncodeFloatRegExp() {
  23680. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  23681. }
  23682. encodeFloat(num) {
  23683. let value = num.toString();
  23684. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  23685. if (m) {
  23686. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  23687. value = (Math.round(num * epsilon) / epsilon).toString();
  23688. }
  23689. let nibbles = "";
  23690. let i, ii;
  23691. for (i = 0, ii = value.length; i < ii; ++i) {
  23692. const a = value[i];
  23693. if (a === "e") {
  23694. nibbles += value[++i] === "-" ? "c" : "b";
  23695. } else if (a === ".") {
  23696. nibbles += "a";
  23697. } else if (a === "-") {
  23698. nibbles += "e";
  23699. } else {
  23700. nibbles += a;
  23701. }
  23702. }
  23703. nibbles += nibbles.length & 1 ? "f" : "ff";
  23704. const out = [30];
  23705. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  23706. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  23707. }
  23708. return out;
  23709. }
  23710. encodeInteger(value) {
  23711. let code;
  23712. if (value >= -107 && value <= 107) {
  23713. code = [value + 139];
  23714. } else if (value >= 108 && value <= 1131) {
  23715. value -= 108;
  23716. code = [(value >> 8) + 247, value & 0xff];
  23717. } else if (value >= -1131 && value <= -108) {
  23718. value = -value - 108;
  23719. code = [(value >> 8) + 251, value & 0xff];
  23720. } else if (value >= -32768 && value <= 32767) {
  23721. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  23722. } else {
  23723. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  23724. }
  23725. return code;
  23726. }
  23727. compileHeader(header) {
  23728. return [header.major, header.minor, 4, header.offSize];
  23729. }
  23730. compileNameIndex(names) {
  23731. const nameIndex = new CFFIndex();
  23732. for (const name of names) {
  23733. const length = Math.min(name.length, 127);
  23734. let sanitizedName = new Array(length);
  23735. for (let j = 0; j < length; j++) {
  23736. let char = name[j];
  23737. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  23738. char = "_";
  23739. }
  23740. sanitizedName[j] = char;
  23741. }
  23742. sanitizedName = sanitizedName.join("");
  23743. if (sanitizedName === "") {
  23744. sanitizedName = "Bad_Font_Name";
  23745. }
  23746. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  23747. }
  23748. return this.compileIndex(nameIndex);
  23749. }
  23750. compileTopDicts(dicts, length, removeCidKeys) {
  23751. const fontDictTrackers = [];
  23752. let fdArrayIndex = new CFFIndex();
  23753. for (const fontDict of dicts) {
  23754. if (removeCidKeys) {
  23755. fontDict.removeByName("CIDFontVersion");
  23756. fontDict.removeByName("CIDFontRevision");
  23757. fontDict.removeByName("CIDFontType");
  23758. fontDict.removeByName("CIDCount");
  23759. fontDict.removeByName("UIDBase");
  23760. }
  23761. const fontDictTracker = new CFFOffsetTracker();
  23762. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  23763. fontDictTrackers.push(fontDictTracker);
  23764. fdArrayIndex.add(fontDictData);
  23765. fontDictTracker.offset(length);
  23766. }
  23767. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  23768. return {
  23769. trackers: fontDictTrackers,
  23770. output: fdArrayIndex
  23771. };
  23772. }
  23773. compilePrivateDicts(dicts, trackers, output) {
  23774. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  23775. const fontDict = dicts[i];
  23776. const privateDict = fontDict.privateDict;
  23777. if (!privateDict || !fontDict.hasName("Private")) {
  23778. throw new _util.FormatError("There must be a private dictionary.");
  23779. }
  23780. const privateDictTracker = new CFFOffsetTracker();
  23781. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  23782. let outputLength = output.length;
  23783. privateDictTracker.offset(outputLength);
  23784. if (!privateDictData.length) {
  23785. outputLength = 0;
  23786. }
  23787. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  23788. output.add(privateDictData);
  23789. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  23790. const subrs = this.compileIndex(privateDict.subrsIndex);
  23791. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  23792. output.add(subrs);
  23793. }
  23794. }
  23795. }
  23796. compileDict(dict, offsetTracker) {
  23797. const out = [];
  23798. for (const key of dict.order) {
  23799. if (!(key in dict.values)) {
  23800. continue;
  23801. }
  23802. let values = dict.values[key];
  23803. let types = dict.types[key];
  23804. if (!Array.isArray(types)) {
  23805. types = [types];
  23806. }
  23807. if (!Array.isArray(values)) {
  23808. values = [values];
  23809. }
  23810. if (values.length === 0) {
  23811. continue;
  23812. }
  23813. for (let j = 0, jj = types.length; j < jj; ++j) {
  23814. const type = types[j];
  23815. const value = values[j];
  23816. switch (type) {
  23817. case "num":
  23818. case "sid":
  23819. out.push(...this.encodeNumber(value));
  23820. break;
  23821. case "offset":
  23822. const name = dict.keyToNameMap[key];
  23823. if (!offsetTracker.isTracking(name)) {
  23824. offsetTracker.track(name, out.length);
  23825. }
  23826. out.push(0x1d, 0, 0, 0, 0);
  23827. break;
  23828. case "array":
  23829. case "delta":
  23830. out.push(...this.encodeNumber(value));
  23831. for (let k = 1, kk = values.length; k < kk; ++k) {
  23832. out.push(...this.encodeNumber(values[k]));
  23833. }
  23834. break;
  23835. default:
  23836. throw new _util.FormatError(`Unknown data type of ${type}`);
  23837. }
  23838. }
  23839. out.push(...dict.opcodes[key]);
  23840. }
  23841. return out;
  23842. }
  23843. compileStringIndex(strings) {
  23844. const stringIndex = new CFFIndex();
  23845. for (const string of strings) {
  23846. stringIndex.add((0, _util.stringToBytes)(string));
  23847. }
  23848. return this.compileIndex(stringIndex);
  23849. }
  23850. compileGlobalSubrIndex() {
  23851. const globalSubrIndex = this.cff.globalSubrIndex;
  23852. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  23853. }
  23854. compileCharStrings(charStrings) {
  23855. const charStringsIndex = new CFFIndex();
  23856. for (let i = 0; i < charStrings.count; i++) {
  23857. const glyph = charStrings.get(i);
  23858. if (glyph.length === 0) {
  23859. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  23860. continue;
  23861. }
  23862. charStringsIndex.add(glyph);
  23863. }
  23864. return this.compileIndex(charStringsIndex);
  23865. }
  23866. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  23867. let out;
  23868. const numGlyphsLessNotDef = numGlyphs - 1;
  23869. if (isCIDFont) {
  23870. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  23871. } else {
  23872. const length = 1 + numGlyphsLessNotDef * 2;
  23873. out = new Uint8Array(length);
  23874. out[0] = 0;
  23875. let charsetIndex = 0;
  23876. const numCharsets = charset.charset.length;
  23877. let warned = false;
  23878. for (let i = 1; i < out.length; i += 2) {
  23879. let sid = 0;
  23880. if (charsetIndex < numCharsets) {
  23881. const name = charset.charset[charsetIndex++];
  23882. sid = strings.getSID(name);
  23883. if (sid === -1) {
  23884. sid = 0;
  23885. if (!warned) {
  23886. warned = true;
  23887. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  23888. }
  23889. }
  23890. }
  23891. out[i] = sid >> 8 & 0xff;
  23892. out[i + 1] = sid & 0xff;
  23893. }
  23894. }
  23895. return this.compileTypedArray(out);
  23896. }
  23897. compileEncoding(encoding) {
  23898. return this.compileTypedArray(encoding.raw);
  23899. }
  23900. compileFDSelect(fdSelect) {
  23901. const format = fdSelect.format;
  23902. let out, i;
  23903. switch (format) {
  23904. case 0:
  23905. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  23906. out[0] = format;
  23907. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  23908. out[i + 1] = fdSelect.fdSelect[i];
  23909. }
  23910. break;
  23911. case 3:
  23912. const start = 0;
  23913. let lastFD = fdSelect.fdSelect[0];
  23914. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  23915. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  23916. const currentFD = fdSelect.fdSelect[i];
  23917. if (currentFD !== lastFD) {
  23918. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  23919. lastFD = currentFD;
  23920. }
  23921. }
  23922. const numRanges = (ranges.length - 3) / 3;
  23923. ranges[1] = numRanges >> 8 & 0xff;
  23924. ranges[2] = numRanges & 0xff;
  23925. ranges.push(i >> 8 & 0xff, i & 0xff);
  23926. out = new Uint8Array(ranges);
  23927. break;
  23928. }
  23929. return this.compileTypedArray(out);
  23930. }
  23931. compileTypedArray(data) {
  23932. const out = [];
  23933. for (let i = 0, ii = data.length; i < ii; ++i) {
  23934. out[i] = data[i];
  23935. }
  23936. return out;
  23937. }
  23938. compileIndex(index, trackers = []) {
  23939. const objects = index.objects;
  23940. const count = objects.length;
  23941. if (count === 0) {
  23942. return [0, 0];
  23943. }
  23944. const data = [count >> 8 & 0xff, count & 0xff];
  23945. let lastOffset = 1,
  23946. i;
  23947. for (i = 0; i < count; ++i) {
  23948. lastOffset += objects[i].length;
  23949. }
  23950. let offsetSize;
  23951. if (lastOffset < 0x100) {
  23952. offsetSize = 1;
  23953. } else if (lastOffset < 0x10000) {
  23954. offsetSize = 2;
  23955. } else if (lastOffset < 0x1000000) {
  23956. offsetSize = 3;
  23957. } else {
  23958. offsetSize = 4;
  23959. }
  23960. data.push(offsetSize);
  23961. let relativeOffset = 1;
  23962. for (i = 0; i < count + 1; i++) {
  23963. if (offsetSize === 1) {
  23964. data.push(relativeOffset & 0xff);
  23965. } else if (offsetSize === 2) {
  23966. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23967. } else if (offsetSize === 3) {
  23968. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23969. } else {
  23970. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23971. }
  23972. if (objects[i]) {
  23973. relativeOffset += objects[i].length;
  23974. }
  23975. }
  23976. for (i = 0; i < count; i++) {
  23977. if (trackers[i]) {
  23978. trackers[i].offset(data.length);
  23979. }
  23980. data.push(...objects[i]);
  23981. }
  23982. return data;
  23983. }
  23984. }
  23985. exports.CFFCompiler = CFFCompiler;
  23986. /***/ }),
  23987. /* 34 */
  23988. /***/ ((__unused_webpack_module, exports) => {
  23989. Object.defineProperty(exports, "__esModule", ({
  23990. value: true
  23991. }));
  23992. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  23993. 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"];
  23994. exports.ISOAdobeCharset = ISOAdobeCharset;
  23995. 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"];
  23996. exports.ExpertCharset = ExpertCharset;
  23997. 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"];
  23998. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  23999. /***/ }),
  24000. /* 35 */
  24001. /***/ ((__unused_webpack_module, exports) => {
  24002. Object.defineProperty(exports, "__esModule", ({
  24003. value: true
  24004. }));
  24005. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  24006. exports.getEncoding = getEncoding;
  24007. 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"];
  24008. exports.ExpertEncoding = ExpertEncoding;
  24009. 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", "", "", "", ""];
  24010. 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"];
  24011. exports.MacRomanEncoding = MacRomanEncoding;
  24012. 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", "", "", "", ""];
  24013. exports.StandardEncoding = StandardEncoding;
  24014. 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"];
  24015. exports.WinAnsiEncoding = WinAnsiEncoding;
  24016. 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", ""];
  24017. exports.SymbolSetEncoding = SymbolSetEncoding;
  24018. 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", ""];
  24019. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24020. function getEncoding(encodingName) {
  24021. switch (encodingName) {
  24022. case "WinAnsiEncoding":
  24023. return WinAnsiEncoding;
  24024. case "StandardEncoding":
  24025. return StandardEncoding;
  24026. case "MacRomanEncoding":
  24027. return MacRomanEncoding;
  24028. case "SymbolSetEncoding":
  24029. return SymbolSetEncoding;
  24030. case "ZapfDingbatsEncoding":
  24031. return ZapfDingbatsEncoding;
  24032. case "ExpertEncoding":
  24033. return ExpertEncoding;
  24034. case "MacExpertEncoding":
  24035. return MacExpertEncoding;
  24036. default:
  24037. return null;
  24038. }
  24039. }
  24040. /***/ }),
  24041. /* 36 */
  24042. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24043. Object.defineProperty(exports, "__esModule", ({
  24044. value: true
  24045. }));
  24046. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  24047. exports.getFontType = getFontType;
  24048. exports.normalizeFontName = normalizeFontName;
  24049. exports.recoverGlyphName = recoverGlyphName;
  24050. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  24051. var _util = __w_pdfjs_require__(2);
  24052. var _encodings = __w_pdfjs_require__(35);
  24053. var _glyphlist = __w_pdfjs_require__(37);
  24054. var _unicode = __w_pdfjs_require__(38);
  24055. const SEAC_ANALYSIS_ENABLED = true;
  24056. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  24057. const FontFlags = {
  24058. FixedPitch: 1,
  24059. Serif: 2,
  24060. Symbolic: 4,
  24061. Script: 8,
  24062. Nonsymbolic: 32,
  24063. Italic: 64,
  24064. AllCap: 65536,
  24065. SmallCap: 131072,
  24066. ForceBold: 262144
  24067. };
  24068. exports.FontFlags = FontFlags;
  24069. 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"];
  24070. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  24071. function getFontType(type, subtype, isStandardFont = false) {
  24072. switch (type) {
  24073. case "Type1":
  24074. if (isStandardFont) {
  24075. return _util.FontType.TYPE1STANDARD;
  24076. }
  24077. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  24078. case "CIDFontType0":
  24079. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  24080. case "OpenType":
  24081. return _util.FontType.OPENTYPE;
  24082. case "TrueType":
  24083. return _util.FontType.TRUETYPE;
  24084. case "CIDFontType2":
  24085. return _util.FontType.CIDFONTTYPE2;
  24086. case "MMType1":
  24087. return _util.FontType.MMTYPE1;
  24088. case "Type0":
  24089. return _util.FontType.TYPE0;
  24090. default:
  24091. return _util.FontType.UNKNOWN;
  24092. }
  24093. }
  24094. function recoverGlyphName(name, glyphsUnicodeMap) {
  24095. if (glyphsUnicodeMap[name] !== undefined) {
  24096. return name;
  24097. }
  24098. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  24099. if (unicode !== -1) {
  24100. for (const key in glyphsUnicodeMap) {
  24101. if (glyphsUnicodeMap[key] === unicode) {
  24102. return key;
  24103. }
  24104. }
  24105. }
  24106. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  24107. return name;
  24108. }
  24109. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24110. const charCodeToGlyphId = Object.create(null);
  24111. let glyphId, charCode, baseEncoding;
  24112. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24113. if (properties.isInternalFont) {
  24114. baseEncoding = builtInEncoding;
  24115. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24116. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24117. if (glyphId >= 0) {
  24118. charCodeToGlyphId[charCode] = glyphId;
  24119. } else {
  24120. charCodeToGlyphId[charCode] = 0;
  24121. }
  24122. }
  24123. } else if (properties.baseEncodingName) {
  24124. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24125. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24126. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24127. if (glyphId >= 0) {
  24128. charCodeToGlyphId[charCode] = glyphId;
  24129. } else {
  24130. charCodeToGlyphId[charCode] = 0;
  24131. }
  24132. }
  24133. } else if (isSymbolicFont) {
  24134. for (charCode in builtInEncoding) {
  24135. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24136. }
  24137. } else {
  24138. baseEncoding = _encodings.StandardEncoding;
  24139. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24140. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24141. if (glyphId >= 0) {
  24142. charCodeToGlyphId[charCode] = glyphId;
  24143. } else {
  24144. charCodeToGlyphId[charCode] = 0;
  24145. }
  24146. }
  24147. }
  24148. const differences = properties.differences;
  24149. let glyphsUnicodeMap;
  24150. if (differences) {
  24151. for (charCode in differences) {
  24152. const glyphName = differences[charCode];
  24153. glyphId = glyphNames.indexOf(glyphName);
  24154. if (glyphId === -1) {
  24155. if (!glyphsUnicodeMap) {
  24156. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24157. }
  24158. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24159. if (standardGlyphName !== glyphName) {
  24160. glyphId = glyphNames.indexOf(standardGlyphName);
  24161. }
  24162. }
  24163. if (glyphId >= 0) {
  24164. charCodeToGlyphId[charCode] = glyphId;
  24165. } else {
  24166. charCodeToGlyphId[charCode] = 0;
  24167. }
  24168. }
  24169. }
  24170. return charCodeToGlyphId;
  24171. }
  24172. function normalizeFontName(name) {
  24173. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  24174. }
  24175. /***/ }),
  24176. /* 37 */
  24177. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  24178. __w_pdfjs_require__.r(__webpack_exports__);
  24179. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  24180. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  24181. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  24182. /* harmony export */ });
  24183. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  24184. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  24185. return [
  24186. "A",
  24187. 0x0041,
  24188. "AE",
  24189. 0x00c6,
  24190. "AEacute",
  24191. 0x01fc,
  24192. "AEmacron",
  24193. 0x01e2,
  24194. "AEsmall",
  24195. 0xf7e6,
  24196. "Aacute",
  24197. 0x00c1,
  24198. "Aacutesmall",
  24199. 0xf7e1,
  24200. "Abreve",
  24201. 0x0102,
  24202. "Abreveacute",
  24203. 0x1eae,
  24204. "Abrevecyrillic",
  24205. 0x04d0,
  24206. "Abrevedotbelow",
  24207. 0x1eb6,
  24208. "Abrevegrave",
  24209. 0x1eb0,
  24210. "Abrevehookabove",
  24211. 0x1eb2,
  24212. "Abrevetilde",
  24213. 0x1eb4,
  24214. "Acaron",
  24215. 0x01cd,
  24216. "Acircle",
  24217. 0x24b6,
  24218. "Acircumflex",
  24219. 0x00c2,
  24220. "Acircumflexacute",
  24221. 0x1ea4,
  24222. "Acircumflexdotbelow",
  24223. 0x1eac,
  24224. "Acircumflexgrave",
  24225. 0x1ea6,
  24226. "Acircumflexhookabove",
  24227. 0x1ea8,
  24228. "Acircumflexsmall",
  24229. 0xf7e2,
  24230. "Acircumflextilde",
  24231. 0x1eaa,
  24232. "Acute",
  24233. 0xf6c9,
  24234. "Acutesmall",
  24235. 0xf7b4,
  24236. "Acyrillic",
  24237. 0x0410,
  24238. "Adblgrave",
  24239. 0x0200,
  24240. "Adieresis",
  24241. 0x00c4,
  24242. "Adieresiscyrillic",
  24243. 0x04d2,
  24244. "Adieresismacron",
  24245. 0x01de,
  24246. "Adieresissmall",
  24247. 0xf7e4,
  24248. "Adotbelow",
  24249. 0x1ea0,
  24250. "Adotmacron",
  24251. 0x01e0,
  24252. "Agrave",
  24253. 0x00c0,
  24254. "Agravesmall",
  24255. 0xf7e0,
  24256. "Ahookabove",
  24257. 0x1ea2,
  24258. "Aiecyrillic",
  24259. 0x04d4,
  24260. "Ainvertedbreve",
  24261. 0x0202,
  24262. "Alpha",
  24263. 0x0391,
  24264. "Alphatonos",
  24265. 0x0386,
  24266. "Amacron",
  24267. 0x0100,
  24268. "Amonospace",
  24269. 0xff21,
  24270. "Aogonek",
  24271. 0x0104,
  24272. "Aring",
  24273. 0x00c5,
  24274. "Aringacute",
  24275. 0x01fa,
  24276. "Aringbelow",
  24277. 0x1e00,
  24278. "Aringsmall",
  24279. 0xf7e5,
  24280. "Asmall",
  24281. 0xf761,
  24282. "Atilde",
  24283. 0x00c3,
  24284. "Atildesmall",
  24285. 0xf7e3,
  24286. "Aybarmenian",
  24287. 0x0531,
  24288. "B",
  24289. 0x0042,
  24290. "Bcircle",
  24291. 0x24b7,
  24292. "Bdotaccent",
  24293. 0x1e02,
  24294. "Bdotbelow",
  24295. 0x1e04,
  24296. "Becyrillic",
  24297. 0x0411,
  24298. "Benarmenian",
  24299. 0x0532,
  24300. "Beta",
  24301. 0x0392,
  24302. "Bhook",
  24303. 0x0181,
  24304. "Blinebelow",
  24305. 0x1e06,
  24306. "Bmonospace",
  24307. 0xff22,
  24308. "Brevesmall",
  24309. 0xf6f4,
  24310. "Bsmall",
  24311. 0xf762,
  24312. "Btopbar",
  24313. 0x0182,
  24314. "C",
  24315. 0x0043,
  24316. "Caarmenian",
  24317. 0x053e,
  24318. "Cacute",
  24319. 0x0106,
  24320. "Caron",
  24321. 0xf6ca,
  24322. "Caronsmall",
  24323. 0xf6f5,
  24324. "Ccaron",
  24325. 0x010c,
  24326. "Ccedilla",
  24327. 0x00c7,
  24328. "Ccedillaacute",
  24329. 0x1e08,
  24330. "Ccedillasmall",
  24331. 0xf7e7,
  24332. "Ccircle",
  24333. 0x24b8,
  24334. "Ccircumflex",
  24335. 0x0108,
  24336. "Cdot",
  24337. 0x010a,
  24338. "Cdotaccent",
  24339. 0x010a,
  24340. "Cedillasmall",
  24341. 0xf7b8,
  24342. "Chaarmenian",
  24343. 0x0549,
  24344. "Cheabkhasiancyrillic",
  24345. 0x04bc,
  24346. "Checyrillic",
  24347. 0x0427,
  24348. "Chedescenderabkhasiancyrillic",
  24349. 0x04be,
  24350. "Chedescendercyrillic",
  24351. 0x04b6,
  24352. "Chedieresiscyrillic",
  24353. 0x04f4,
  24354. "Cheharmenian",
  24355. 0x0543,
  24356. "Chekhakassiancyrillic",
  24357. 0x04cb,
  24358. "Cheverticalstrokecyrillic",
  24359. 0x04b8,
  24360. "Chi",
  24361. 0x03a7,
  24362. "Chook",
  24363. 0x0187,
  24364. "Circumflexsmall",
  24365. 0xf6f6,
  24366. "Cmonospace",
  24367. 0xff23,
  24368. "Coarmenian",
  24369. 0x0551,
  24370. "Csmall",
  24371. 0xf763,
  24372. "D",
  24373. 0x0044,
  24374. "DZ",
  24375. 0x01f1,
  24376. "DZcaron",
  24377. 0x01c4,
  24378. "Daarmenian",
  24379. 0x0534,
  24380. "Dafrican",
  24381. 0x0189,
  24382. "Dcaron",
  24383. 0x010e,
  24384. "Dcedilla",
  24385. 0x1e10,
  24386. "Dcircle",
  24387. 0x24b9,
  24388. "Dcircumflexbelow",
  24389. 0x1e12,
  24390. "Dcroat",
  24391. 0x0110,
  24392. "Ddotaccent",
  24393. 0x1e0a,
  24394. "Ddotbelow",
  24395. 0x1e0c,
  24396. "Decyrillic",
  24397. 0x0414,
  24398. "Deicoptic",
  24399. 0x03ee,
  24400. "Delta",
  24401. 0x2206,
  24402. "Deltagreek",
  24403. 0x0394,
  24404. "Dhook",
  24405. 0x018a,
  24406. "Dieresis",
  24407. 0xf6cb,
  24408. "DieresisAcute",
  24409. 0xf6cc,
  24410. "DieresisGrave",
  24411. 0xf6cd,
  24412. "Dieresissmall",
  24413. 0xf7a8,
  24414. "Digammagreek",
  24415. 0x03dc,
  24416. "Djecyrillic",
  24417. 0x0402,
  24418. "Dlinebelow",
  24419. 0x1e0e,
  24420. "Dmonospace",
  24421. 0xff24,
  24422. "Dotaccentsmall",
  24423. 0xf6f7,
  24424. "Dslash",
  24425. 0x0110,
  24426. "Dsmall",
  24427. 0xf764,
  24428. "Dtopbar",
  24429. 0x018b,
  24430. "Dz",
  24431. 0x01f2,
  24432. "Dzcaron",
  24433. 0x01c5,
  24434. "Dzeabkhasiancyrillic",
  24435. 0x04e0,
  24436. "Dzecyrillic",
  24437. 0x0405,
  24438. "Dzhecyrillic",
  24439. 0x040f,
  24440. "E",
  24441. 0x0045,
  24442. "Eacute",
  24443. 0x00c9,
  24444. "Eacutesmall",
  24445. 0xf7e9,
  24446. "Ebreve",
  24447. 0x0114,
  24448. "Ecaron",
  24449. 0x011a,
  24450. "Ecedillabreve",
  24451. 0x1e1c,
  24452. "Echarmenian",
  24453. 0x0535,
  24454. "Ecircle",
  24455. 0x24ba,
  24456. "Ecircumflex",
  24457. 0x00ca,
  24458. "Ecircumflexacute",
  24459. 0x1ebe,
  24460. "Ecircumflexbelow",
  24461. 0x1e18,
  24462. "Ecircumflexdotbelow",
  24463. 0x1ec6,
  24464. "Ecircumflexgrave",
  24465. 0x1ec0,
  24466. "Ecircumflexhookabove",
  24467. 0x1ec2,
  24468. "Ecircumflexsmall",
  24469. 0xf7ea,
  24470. "Ecircumflextilde",
  24471. 0x1ec4,
  24472. "Ecyrillic",
  24473. 0x0404,
  24474. "Edblgrave",
  24475. 0x0204,
  24476. "Edieresis",
  24477. 0x00cb,
  24478. "Edieresissmall",
  24479. 0xf7eb,
  24480. "Edot",
  24481. 0x0116,
  24482. "Edotaccent",
  24483. 0x0116,
  24484. "Edotbelow",
  24485. 0x1eb8,
  24486. "Efcyrillic",
  24487. 0x0424,
  24488. "Egrave",
  24489. 0x00c8,
  24490. "Egravesmall",
  24491. 0xf7e8,
  24492. "Eharmenian",
  24493. 0x0537,
  24494. "Ehookabove",
  24495. 0x1eba,
  24496. "Eightroman",
  24497. 0x2167,
  24498. "Einvertedbreve",
  24499. 0x0206,
  24500. "Eiotifiedcyrillic",
  24501. 0x0464,
  24502. "Elcyrillic",
  24503. 0x041b,
  24504. "Elevenroman",
  24505. 0x216a,
  24506. "Emacron",
  24507. 0x0112,
  24508. "Emacronacute",
  24509. 0x1e16,
  24510. "Emacrongrave",
  24511. 0x1e14,
  24512. "Emcyrillic",
  24513. 0x041c,
  24514. "Emonospace",
  24515. 0xff25,
  24516. "Encyrillic",
  24517. 0x041d,
  24518. "Endescendercyrillic",
  24519. 0x04a2,
  24520. "Eng",
  24521. 0x014a,
  24522. "Enghecyrillic",
  24523. 0x04a4,
  24524. "Enhookcyrillic",
  24525. 0x04c7,
  24526. "Eogonek",
  24527. 0x0118,
  24528. "Eopen",
  24529. 0x0190,
  24530. "Epsilon",
  24531. 0x0395,
  24532. "Epsilontonos",
  24533. 0x0388,
  24534. "Ercyrillic",
  24535. 0x0420,
  24536. "Ereversed",
  24537. 0x018e,
  24538. "Ereversedcyrillic",
  24539. 0x042d,
  24540. "Escyrillic",
  24541. 0x0421,
  24542. "Esdescendercyrillic",
  24543. 0x04aa,
  24544. "Esh",
  24545. 0x01a9,
  24546. "Esmall",
  24547. 0xf765,
  24548. "Eta",
  24549. 0x0397,
  24550. "Etarmenian",
  24551. 0x0538,
  24552. "Etatonos",
  24553. 0x0389,
  24554. "Eth",
  24555. 0x00d0,
  24556. "Ethsmall",
  24557. 0xf7f0,
  24558. "Etilde",
  24559. 0x1ebc,
  24560. "Etildebelow",
  24561. 0x1e1a,
  24562. "Euro",
  24563. 0x20ac,
  24564. "Ezh",
  24565. 0x01b7,
  24566. "Ezhcaron",
  24567. 0x01ee,
  24568. "Ezhreversed",
  24569. 0x01b8,
  24570. "F",
  24571. 0x0046,
  24572. "Fcircle",
  24573. 0x24bb,
  24574. "Fdotaccent",
  24575. 0x1e1e,
  24576. "Feharmenian",
  24577. 0x0556,
  24578. "Feicoptic",
  24579. 0x03e4,
  24580. "Fhook",
  24581. 0x0191,
  24582. "Fitacyrillic",
  24583. 0x0472,
  24584. "Fiveroman",
  24585. 0x2164,
  24586. "Fmonospace",
  24587. 0xff26,
  24588. "Fourroman",
  24589. 0x2163,
  24590. "Fsmall",
  24591. 0xf766,
  24592. "G",
  24593. 0x0047,
  24594. "GBsquare",
  24595. 0x3387,
  24596. "Gacute",
  24597. 0x01f4,
  24598. "Gamma",
  24599. 0x0393,
  24600. "Gammaafrican",
  24601. 0x0194,
  24602. "Gangiacoptic",
  24603. 0x03ea,
  24604. "Gbreve",
  24605. 0x011e,
  24606. "Gcaron",
  24607. 0x01e6,
  24608. "Gcedilla",
  24609. 0x0122,
  24610. "Gcircle",
  24611. 0x24bc,
  24612. "Gcircumflex",
  24613. 0x011c,
  24614. "Gcommaaccent",
  24615. 0x0122,
  24616. "Gdot",
  24617. 0x0120,
  24618. "Gdotaccent",
  24619. 0x0120,
  24620. "Gecyrillic",
  24621. 0x0413,
  24622. "Ghadarmenian",
  24623. 0x0542,
  24624. "Ghemiddlehookcyrillic",
  24625. 0x0494,
  24626. "Ghestrokecyrillic",
  24627. 0x0492,
  24628. "Gheupturncyrillic",
  24629. 0x0490,
  24630. "Ghook",
  24631. 0x0193,
  24632. "Gimarmenian",
  24633. 0x0533,
  24634. "Gjecyrillic",
  24635. 0x0403,
  24636. "Gmacron",
  24637. 0x1e20,
  24638. "Gmonospace",
  24639. 0xff27,
  24640. "Grave",
  24641. 0xf6ce,
  24642. "Gravesmall",
  24643. 0xf760,
  24644. "Gsmall",
  24645. 0xf767,
  24646. "Gsmallhook",
  24647. 0x029b,
  24648. "Gstroke",
  24649. 0x01e4,
  24650. "H",
  24651. 0x0048,
  24652. "H18533",
  24653. 0x25cf,
  24654. "H18543",
  24655. 0x25aa,
  24656. "H18551",
  24657. 0x25ab,
  24658. "H22073",
  24659. 0x25a1,
  24660. "HPsquare",
  24661. 0x33cb,
  24662. "Haabkhasiancyrillic",
  24663. 0x04a8,
  24664. "Hadescendercyrillic",
  24665. 0x04b2,
  24666. "Hardsigncyrillic",
  24667. 0x042a,
  24668. "Hbar",
  24669. 0x0126,
  24670. "Hbrevebelow",
  24671. 0x1e2a,
  24672. "Hcedilla",
  24673. 0x1e28,
  24674. "Hcircle",
  24675. 0x24bd,
  24676. "Hcircumflex",
  24677. 0x0124,
  24678. "Hdieresis",
  24679. 0x1e26,
  24680. "Hdotaccent",
  24681. 0x1e22,
  24682. "Hdotbelow",
  24683. 0x1e24,
  24684. "Hmonospace",
  24685. 0xff28,
  24686. "Hoarmenian",
  24687. 0x0540,
  24688. "Horicoptic",
  24689. 0x03e8,
  24690. "Hsmall",
  24691. 0xf768,
  24692. "Hungarumlaut",
  24693. 0xf6cf,
  24694. "Hungarumlautsmall",
  24695. 0xf6f8,
  24696. "Hzsquare",
  24697. 0x3390,
  24698. "I",
  24699. 0x0049,
  24700. "IAcyrillic",
  24701. 0x042f,
  24702. "IJ",
  24703. 0x0132,
  24704. "IUcyrillic",
  24705. 0x042e,
  24706. "Iacute",
  24707. 0x00cd,
  24708. "Iacutesmall",
  24709. 0xf7ed,
  24710. "Ibreve",
  24711. 0x012c,
  24712. "Icaron",
  24713. 0x01cf,
  24714. "Icircle",
  24715. 0x24be,
  24716. "Icircumflex",
  24717. 0x00ce,
  24718. "Icircumflexsmall",
  24719. 0xf7ee,
  24720. "Icyrillic",
  24721. 0x0406,
  24722. "Idblgrave",
  24723. 0x0208,
  24724. "Idieresis",
  24725. 0x00cf,
  24726. "Idieresisacute",
  24727. 0x1e2e,
  24728. "Idieresiscyrillic",
  24729. 0x04e4,
  24730. "Idieresissmall",
  24731. 0xf7ef,
  24732. "Idot",
  24733. 0x0130,
  24734. "Idotaccent",
  24735. 0x0130,
  24736. "Idotbelow",
  24737. 0x1eca,
  24738. "Iebrevecyrillic",
  24739. 0x04d6,
  24740. "Iecyrillic",
  24741. 0x0415,
  24742. "Ifraktur",
  24743. 0x2111,
  24744. "Igrave",
  24745. 0x00cc,
  24746. "Igravesmall",
  24747. 0xf7ec,
  24748. "Ihookabove",
  24749. 0x1ec8,
  24750. "Iicyrillic",
  24751. 0x0418,
  24752. "Iinvertedbreve",
  24753. 0x020a,
  24754. "Iishortcyrillic",
  24755. 0x0419,
  24756. "Imacron",
  24757. 0x012a,
  24758. "Imacroncyrillic",
  24759. 0x04e2,
  24760. "Imonospace",
  24761. 0xff29,
  24762. "Iniarmenian",
  24763. 0x053b,
  24764. "Iocyrillic",
  24765. 0x0401,
  24766. "Iogonek",
  24767. 0x012e,
  24768. "Iota",
  24769. 0x0399,
  24770. "Iotaafrican",
  24771. 0x0196,
  24772. "Iotadieresis",
  24773. 0x03aa,
  24774. "Iotatonos",
  24775. 0x038a,
  24776. "Ismall",
  24777. 0xf769,
  24778. "Istroke",
  24779. 0x0197,
  24780. "Itilde",
  24781. 0x0128,
  24782. "Itildebelow",
  24783. 0x1e2c,
  24784. "Izhitsacyrillic",
  24785. 0x0474,
  24786. "Izhitsadblgravecyrillic",
  24787. 0x0476,
  24788. "J",
  24789. 0x004a,
  24790. "Jaarmenian",
  24791. 0x0541,
  24792. "Jcircle",
  24793. 0x24bf,
  24794. "Jcircumflex",
  24795. 0x0134,
  24796. "Jecyrillic",
  24797. 0x0408,
  24798. "Jheharmenian",
  24799. 0x054b,
  24800. "Jmonospace",
  24801. 0xff2a,
  24802. "Jsmall",
  24803. 0xf76a,
  24804. "K",
  24805. 0x004b,
  24806. "KBsquare",
  24807. 0x3385,
  24808. "KKsquare",
  24809. 0x33cd,
  24810. "Kabashkircyrillic",
  24811. 0x04a0,
  24812. "Kacute",
  24813. 0x1e30,
  24814. "Kacyrillic",
  24815. 0x041a,
  24816. "Kadescendercyrillic",
  24817. 0x049a,
  24818. "Kahookcyrillic",
  24819. 0x04c3,
  24820. "Kappa",
  24821. 0x039a,
  24822. "Kastrokecyrillic",
  24823. 0x049e,
  24824. "Kaverticalstrokecyrillic",
  24825. 0x049c,
  24826. "Kcaron",
  24827. 0x01e8,
  24828. "Kcedilla",
  24829. 0x0136,
  24830. "Kcircle",
  24831. 0x24c0,
  24832. "Kcommaaccent",
  24833. 0x0136,
  24834. "Kdotbelow",
  24835. 0x1e32,
  24836. "Keharmenian",
  24837. 0x0554,
  24838. "Kenarmenian",
  24839. 0x053f,
  24840. "Khacyrillic",
  24841. 0x0425,
  24842. "Kheicoptic",
  24843. 0x03e6,
  24844. "Khook",
  24845. 0x0198,
  24846. "Kjecyrillic",
  24847. 0x040c,
  24848. "Klinebelow",
  24849. 0x1e34,
  24850. "Kmonospace",
  24851. 0xff2b,
  24852. "Koppacyrillic",
  24853. 0x0480,
  24854. "Koppagreek",
  24855. 0x03de,
  24856. "Ksicyrillic",
  24857. 0x046e,
  24858. "Ksmall",
  24859. 0xf76b,
  24860. "L",
  24861. 0x004c,
  24862. "LJ",
  24863. 0x01c7,
  24864. "LL",
  24865. 0xf6bf,
  24866. "Lacute",
  24867. 0x0139,
  24868. "Lambda",
  24869. 0x039b,
  24870. "Lcaron",
  24871. 0x013d,
  24872. "Lcedilla",
  24873. 0x013b,
  24874. "Lcircle",
  24875. 0x24c1,
  24876. "Lcircumflexbelow",
  24877. 0x1e3c,
  24878. "Lcommaaccent",
  24879. 0x013b,
  24880. "Ldot",
  24881. 0x013f,
  24882. "Ldotaccent",
  24883. 0x013f,
  24884. "Ldotbelow",
  24885. 0x1e36,
  24886. "Ldotbelowmacron",
  24887. 0x1e38,
  24888. "Liwnarmenian",
  24889. 0x053c,
  24890. "Lj",
  24891. 0x01c8,
  24892. "Ljecyrillic",
  24893. 0x0409,
  24894. "Llinebelow",
  24895. 0x1e3a,
  24896. "Lmonospace",
  24897. 0xff2c,
  24898. "Lslash",
  24899. 0x0141,
  24900. "Lslashsmall",
  24901. 0xf6f9,
  24902. "Lsmall",
  24903. 0xf76c,
  24904. "M",
  24905. 0x004d,
  24906. "MBsquare",
  24907. 0x3386,
  24908. "Macron",
  24909. 0xf6d0,
  24910. "Macronsmall",
  24911. 0xf7af,
  24912. "Macute",
  24913. 0x1e3e,
  24914. "Mcircle",
  24915. 0x24c2,
  24916. "Mdotaccent",
  24917. 0x1e40,
  24918. "Mdotbelow",
  24919. 0x1e42,
  24920. "Menarmenian",
  24921. 0x0544,
  24922. "Mmonospace",
  24923. 0xff2d,
  24924. "Msmall",
  24925. 0xf76d,
  24926. "Mturned",
  24927. 0x019c,
  24928. "Mu",
  24929. 0x039c,
  24930. "N",
  24931. 0x004e,
  24932. "NJ",
  24933. 0x01ca,
  24934. "Nacute",
  24935. 0x0143,
  24936. "Ncaron",
  24937. 0x0147,
  24938. "Ncedilla",
  24939. 0x0145,
  24940. "Ncircle",
  24941. 0x24c3,
  24942. "Ncircumflexbelow",
  24943. 0x1e4a,
  24944. "Ncommaaccent",
  24945. 0x0145,
  24946. "Ndotaccent",
  24947. 0x1e44,
  24948. "Ndotbelow",
  24949. 0x1e46,
  24950. "Nhookleft",
  24951. 0x019d,
  24952. "Nineroman",
  24953. 0x2168,
  24954. "Nj",
  24955. 0x01cb,
  24956. "Njecyrillic",
  24957. 0x040a,
  24958. "Nlinebelow",
  24959. 0x1e48,
  24960. "Nmonospace",
  24961. 0xff2e,
  24962. "Nowarmenian",
  24963. 0x0546,
  24964. "Nsmall",
  24965. 0xf76e,
  24966. "Ntilde",
  24967. 0x00d1,
  24968. "Ntildesmall",
  24969. 0xf7f1,
  24970. "Nu",
  24971. 0x039d,
  24972. "O",
  24973. 0x004f,
  24974. "OE",
  24975. 0x0152,
  24976. "OEsmall",
  24977. 0xf6fa,
  24978. "Oacute",
  24979. 0x00d3,
  24980. "Oacutesmall",
  24981. 0xf7f3,
  24982. "Obarredcyrillic",
  24983. 0x04e8,
  24984. "Obarreddieresiscyrillic",
  24985. 0x04ea,
  24986. "Obreve",
  24987. 0x014e,
  24988. "Ocaron",
  24989. 0x01d1,
  24990. "Ocenteredtilde",
  24991. 0x019f,
  24992. "Ocircle",
  24993. 0x24c4,
  24994. "Ocircumflex",
  24995. 0x00d4,
  24996. "Ocircumflexacute",
  24997. 0x1ed0,
  24998. "Ocircumflexdotbelow",
  24999. 0x1ed8,
  25000. "Ocircumflexgrave",
  25001. 0x1ed2,
  25002. "Ocircumflexhookabove",
  25003. 0x1ed4,
  25004. "Ocircumflexsmall",
  25005. 0xf7f4,
  25006. "Ocircumflextilde",
  25007. 0x1ed6,
  25008. "Ocyrillic",
  25009. 0x041e,
  25010. "Odblacute",
  25011. 0x0150,
  25012. "Odblgrave",
  25013. 0x020c,
  25014. "Odieresis",
  25015. 0x00d6,
  25016. "Odieresiscyrillic",
  25017. 0x04e6,
  25018. "Odieresissmall",
  25019. 0xf7f6,
  25020. "Odotbelow",
  25021. 0x1ecc,
  25022. "Ogoneksmall",
  25023. 0xf6fb,
  25024. "Ograve",
  25025. 0x00d2,
  25026. "Ogravesmall",
  25027. 0xf7f2,
  25028. "Oharmenian",
  25029. 0x0555,
  25030. "Ohm",
  25031. 0x2126,
  25032. "Ohookabove",
  25033. 0x1ece,
  25034. "Ohorn",
  25035. 0x01a0,
  25036. "Ohornacute",
  25037. 0x1eda,
  25038. "Ohorndotbelow",
  25039. 0x1ee2,
  25040. "Ohorngrave",
  25041. 0x1edc,
  25042. "Ohornhookabove",
  25043. 0x1ede,
  25044. "Ohorntilde",
  25045. 0x1ee0,
  25046. "Ohungarumlaut",
  25047. 0x0150,
  25048. "Oi",
  25049. 0x01a2,
  25050. "Oinvertedbreve",
  25051. 0x020e,
  25052. "Omacron",
  25053. 0x014c,
  25054. "Omacronacute",
  25055. 0x1e52,
  25056. "Omacrongrave",
  25057. 0x1e50,
  25058. "Omega",
  25059. 0x2126,
  25060. "Omegacyrillic",
  25061. 0x0460,
  25062. "Omegagreek",
  25063. 0x03a9,
  25064. "Omegaroundcyrillic",
  25065. 0x047a,
  25066. "Omegatitlocyrillic",
  25067. 0x047c,
  25068. "Omegatonos",
  25069. 0x038f,
  25070. "Omicron",
  25071. 0x039f,
  25072. "Omicrontonos",
  25073. 0x038c,
  25074. "Omonospace",
  25075. 0xff2f,
  25076. "Oneroman",
  25077. 0x2160,
  25078. "Oogonek",
  25079. 0x01ea,
  25080. "Oogonekmacron",
  25081. 0x01ec,
  25082. "Oopen",
  25083. 0x0186,
  25084. "Oslash",
  25085. 0x00d8,
  25086. "Oslashacute",
  25087. 0x01fe,
  25088. "Oslashsmall",
  25089. 0xf7f8,
  25090. "Osmall",
  25091. 0xf76f,
  25092. "Ostrokeacute",
  25093. 0x01fe,
  25094. "Otcyrillic",
  25095. 0x047e,
  25096. "Otilde",
  25097. 0x00d5,
  25098. "Otildeacute",
  25099. 0x1e4c,
  25100. "Otildedieresis",
  25101. 0x1e4e,
  25102. "Otildesmall",
  25103. 0xf7f5,
  25104. "P",
  25105. 0x0050,
  25106. "Pacute",
  25107. 0x1e54,
  25108. "Pcircle",
  25109. 0x24c5,
  25110. "Pdotaccent",
  25111. 0x1e56,
  25112. "Pecyrillic",
  25113. 0x041f,
  25114. "Peharmenian",
  25115. 0x054a,
  25116. "Pemiddlehookcyrillic",
  25117. 0x04a6,
  25118. "Phi",
  25119. 0x03a6,
  25120. "Phook",
  25121. 0x01a4,
  25122. "Pi",
  25123. 0x03a0,
  25124. "Piwrarmenian",
  25125. 0x0553,
  25126. "Pmonospace",
  25127. 0xff30,
  25128. "Psi",
  25129. 0x03a8,
  25130. "Psicyrillic",
  25131. 0x0470,
  25132. "Psmall",
  25133. 0xf770,
  25134. "Q",
  25135. 0x0051,
  25136. "Qcircle",
  25137. 0x24c6,
  25138. "Qmonospace",
  25139. 0xff31,
  25140. "Qsmall",
  25141. 0xf771,
  25142. "R",
  25143. 0x0052,
  25144. "Raarmenian",
  25145. 0x054c,
  25146. "Racute",
  25147. 0x0154,
  25148. "Rcaron",
  25149. 0x0158,
  25150. "Rcedilla",
  25151. 0x0156,
  25152. "Rcircle",
  25153. 0x24c7,
  25154. "Rcommaaccent",
  25155. 0x0156,
  25156. "Rdblgrave",
  25157. 0x0210,
  25158. "Rdotaccent",
  25159. 0x1e58,
  25160. "Rdotbelow",
  25161. 0x1e5a,
  25162. "Rdotbelowmacron",
  25163. 0x1e5c,
  25164. "Reharmenian",
  25165. 0x0550,
  25166. "Rfraktur",
  25167. 0x211c,
  25168. "Rho",
  25169. 0x03a1,
  25170. "Ringsmall",
  25171. 0xf6fc,
  25172. "Rinvertedbreve",
  25173. 0x0212,
  25174. "Rlinebelow",
  25175. 0x1e5e,
  25176. "Rmonospace",
  25177. 0xff32,
  25178. "Rsmall",
  25179. 0xf772,
  25180. "Rsmallinverted",
  25181. 0x0281,
  25182. "Rsmallinvertedsuperior",
  25183. 0x02b6,
  25184. "S",
  25185. 0x0053,
  25186. "SF010000",
  25187. 0x250c,
  25188. "SF020000",
  25189. 0x2514,
  25190. "SF030000",
  25191. 0x2510,
  25192. "SF040000",
  25193. 0x2518,
  25194. "SF050000",
  25195. 0x253c,
  25196. "SF060000",
  25197. 0x252c,
  25198. "SF070000",
  25199. 0x2534,
  25200. "SF080000",
  25201. 0x251c,
  25202. "SF090000",
  25203. 0x2524,
  25204. "SF100000",
  25205. 0x2500,
  25206. "SF110000",
  25207. 0x2502,
  25208. "SF190000",
  25209. 0x2561,
  25210. "SF200000",
  25211. 0x2562,
  25212. "SF210000",
  25213. 0x2556,
  25214. "SF220000",
  25215. 0x2555,
  25216. "SF230000",
  25217. 0x2563,
  25218. "SF240000",
  25219. 0x2551,
  25220. "SF250000",
  25221. 0x2557,
  25222. "SF260000",
  25223. 0x255d,
  25224. "SF270000",
  25225. 0x255c,
  25226. "SF280000",
  25227. 0x255b,
  25228. "SF360000",
  25229. 0x255e,
  25230. "SF370000",
  25231. 0x255f,
  25232. "SF380000",
  25233. 0x255a,
  25234. "SF390000",
  25235. 0x2554,
  25236. "SF400000",
  25237. 0x2569,
  25238. "SF410000",
  25239. 0x2566,
  25240. "SF420000",
  25241. 0x2560,
  25242. "SF430000",
  25243. 0x2550,
  25244. "SF440000",
  25245. 0x256c,
  25246. "SF450000",
  25247. 0x2567,
  25248. "SF460000",
  25249. 0x2568,
  25250. "SF470000",
  25251. 0x2564,
  25252. "SF480000",
  25253. 0x2565,
  25254. "SF490000",
  25255. 0x2559,
  25256. "SF500000",
  25257. 0x2558,
  25258. "SF510000",
  25259. 0x2552,
  25260. "SF520000",
  25261. 0x2553,
  25262. "SF530000",
  25263. 0x256b,
  25264. "SF540000",
  25265. 0x256a,
  25266. "Sacute",
  25267. 0x015a,
  25268. "Sacutedotaccent",
  25269. 0x1e64,
  25270. "Sampigreek",
  25271. 0x03e0,
  25272. "Scaron",
  25273. 0x0160,
  25274. "Scarondotaccent",
  25275. 0x1e66,
  25276. "Scaronsmall",
  25277. 0xf6fd,
  25278. "Scedilla",
  25279. 0x015e,
  25280. "Schwa",
  25281. 0x018f,
  25282. "Schwacyrillic",
  25283. 0x04d8,
  25284. "Schwadieresiscyrillic",
  25285. 0x04da,
  25286. "Scircle",
  25287. 0x24c8,
  25288. "Scircumflex",
  25289. 0x015c,
  25290. "Scommaaccent",
  25291. 0x0218,
  25292. "Sdotaccent",
  25293. 0x1e60,
  25294. "Sdotbelow",
  25295. 0x1e62,
  25296. "Sdotbelowdotaccent",
  25297. 0x1e68,
  25298. "Seharmenian",
  25299. 0x054d,
  25300. "Sevenroman",
  25301. 0x2166,
  25302. "Shaarmenian",
  25303. 0x0547,
  25304. "Shacyrillic",
  25305. 0x0428,
  25306. "Shchacyrillic",
  25307. 0x0429,
  25308. "Sheicoptic",
  25309. 0x03e2,
  25310. "Shhacyrillic",
  25311. 0x04ba,
  25312. "Shimacoptic",
  25313. 0x03ec,
  25314. "Sigma",
  25315. 0x03a3,
  25316. "Sixroman",
  25317. 0x2165,
  25318. "Smonospace",
  25319. 0xff33,
  25320. "Softsigncyrillic",
  25321. 0x042c,
  25322. "Ssmall",
  25323. 0xf773,
  25324. "Stigmagreek",
  25325. 0x03da,
  25326. "T",
  25327. 0x0054,
  25328. "Tau",
  25329. 0x03a4,
  25330. "Tbar",
  25331. 0x0166,
  25332. "Tcaron",
  25333. 0x0164,
  25334. "Tcedilla",
  25335. 0x0162,
  25336. "Tcircle",
  25337. 0x24c9,
  25338. "Tcircumflexbelow",
  25339. 0x1e70,
  25340. "Tcommaaccent",
  25341. 0x0162,
  25342. "Tdotaccent",
  25343. 0x1e6a,
  25344. "Tdotbelow",
  25345. 0x1e6c,
  25346. "Tecyrillic",
  25347. 0x0422,
  25348. "Tedescendercyrillic",
  25349. 0x04ac,
  25350. "Tenroman",
  25351. 0x2169,
  25352. "Tetsecyrillic",
  25353. 0x04b4,
  25354. "Theta",
  25355. 0x0398,
  25356. "Thook",
  25357. 0x01ac,
  25358. "Thorn",
  25359. 0x00de,
  25360. "Thornsmall",
  25361. 0xf7fe,
  25362. "Threeroman",
  25363. 0x2162,
  25364. "Tildesmall",
  25365. 0xf6fe,
  25366. "Tiwnarmenian",
  25367. 0x054f,
  25368. "Tlinebelow",
  25369. 0x1e6e,
  25370. "Tmonospace",
  25371. 0xff34,
  25372. "Toarmenian",
  25373. 0x0539,
  25374. "Tonefive",
  25375. 0x01bc,
  25376. "Tonesix",
  25377. 0x0184,
  25378. "Tonetwo",
  25379. 0x01a7,
  25380. "Tretroflexhook",
  25381. 0x01ae,
  25382. "Tsecyrillic",
  25383. 0x0426,
  25384. "Tshecyrillic",
  25385. 0x040b,
  25386. "Tsmall",
  25387. 0xf774,
  25388. "Twelveroman",
  25389. 0x216b,
  25390. "Tworoman",
  25391. 0x2161,
  25392. "U",
  25393. 0x0055,
  25394. "Uacute",
  25395. 0x00da,
  25396. "Uacutesmall",
  25397. 0xf7fa,
  25398. "Ubreve",
  25399. 0x016c,
  25400. "Ucaron",
  25401. 0x01d3,
  25402. "Ucircle",
  25403. 0x24ca,
  25404. "Ucircumflex",
  25405. 0x00db,
  25406. "Ucircumflexbelow",
  25407. 0x1e76,
  25408. "Ucircumflexsmall",
  25409. 0xf7fb,
  25410. "Ucyrillic",
  25411. 0x0423,
  25412. "Udblacute",
  25413. 0x0170,
  25414. "Udblgrave",
  25415. 0x0214,
  25416. "Udieresis",
  25417. 0x00dc,
  25418. "Udieresisacute",
  25419. 0x01d7,
  25420. "Udieresisbelow",
  25421. 0x1e72,
  25422. "Udieresiscaron",
  25423. 0x01d9,
  25424. "Udieresiscyrillic",
  25425. 0x04f0,
  25426. "Udieresisgrave",
  25427. 0x01db,
  25428. "Udieresismacron",
  25429. 0x01d5,
  25430. "Udieresissmall",
  25431. 0xf7fc,
  25432. "Udotbelow",
  25433. 0x1ee4,
  25434. "Ugrave",
  25435. 0x00d9,
  25436. "Ugravesmall",
  25437. 0xf7f9,
  25438. "Uhookabove",
  25439. 0x1ee6,
  25440. "Uhorn",
  25441. 0x01af,
  25442. "Uhornacute",
  25443. 0x1ee8,
  25444. "Uhorndotbelow",
  25445. 0x1ef0,
  25446. "Uhorngrave",
  25447. 0x1eea,
  25448. "Uhornhookabove",
  25449. 0x1eec,
  25450. "Uhorntilde",
  25451. 0x1eee,
  25452. "Uhungarumlaut",
  25453. 0x0170,
  25454. "Uhungarumlautcyrillic",
  25455. 0x04f2,
  25456. "Uinvertedbreve",
  25457. 0x0216,
  25458. "Ukcyrillic",
  25459. 0x0478,
  25460. "Umacron",
  25461. 0x016a,
  25462. "Umacroncyrillic",
  25463. 0x04ee,
  25464. "Umacrondieresis",
  25465. 0x1e7a,
  25466. "Umonospace",
  25467. 0xff35,
  25468. "Uogonek",
  25469. 0x0172,
  25470. "Upsilon",
  25471. 0x03a5,
  25472. "Upsilon1",
  25473. 0x03d2,
  25474. "Upsilonacutehooksymbolgreek",
  25475. 0x03d3,
  25476. "Upsilonafrican",
  25477. 0x01b1,
  25478. "Upsilondieresis",
  25479. 0x03ab,
  25480. "Upsilondieresishooksymbolgreek",
  25481. 0x03d4,
  25482. "Upsilonhooksymbol",
  25483. 0x03d2,
  25484. "Upsilontonos",
  25485. 0x038e,
  25486. "Uring",
  25487. 0x016e,
  25488. "Ushortcyrillic",
  25489. 0x040e,
  25490. "Usmall",
  25491. 0xf775,
  25492. "Ustraightcyrillic",
  25493. 0x04ae,
  25494. "Ustraightstrokecyrillic",
  25495. 0x04b0,
  25496. "Utilde",
  25497. 0x0168,
  25498. "Utildeacute",
  25499. 0x1e78,
  25500. "Utildebelow",
  25501. 0x1e74,
  25502. "V",
  25503. 0x0056,
  25504. "Vcircle",
  25505. 0x24cb,
  25506. "Vdotbelow",
  25507. 0x1e7e,
  25508. "Vecyrillic",
  25509. 0x0412,
  25510. "Vewarmenian",
  25511. 0x054e,
  25512. "Vhook",
  25513. 0x01b2,
  25514. "Vmonospace",
  25515. 0xff36,
  25516. "Voarmenian",
  25517. 0x0548,
  25518. "Vsmall",
  25519. 0xf776,
  25520. "Vtilde",
  25521. 0x1e7c,
  25522. "W",
  25523. 0x0057,
  25524. "Wacute",
  25525. 0x1e82,
  25526. "Wcircle",
  25527. 0x24cc,
  25528. "Wcircumflex",
  25529. 0x0174,
  25530. "Wdieresis",
  25531. 0x1e84,
  25532. "Wdotaccent",
  25533. 0x1e86,
  25534. "Wdotbelow",
  25535. 0x1e88,
  25536. "Wgrave",
  25537. 0x1e80,
  25538. "Wmonospace",
  25539. 0xff37,
  25540. "Wsmall",
  25541. 0xf777,
  25542. "X",
  25543. 0x0058,
  25544. "Xcircle",
  25545. 0x24cd,
  25546. "Xdieresis",
  25547. 0x1e8c,
  25548. "Xdotaccent",
  25549. 0x1e8a,
  25550. "Xeharmenian",
  25551. 0x053d,
  25552. "Xi",
  25553. 0x039e,
  25554. "Xmonospace",
  25555. 0xff38,
  25556. "Xsmall",
  25557. 0xf778,
  25558. "Y",
  25559. 0x0059,
  25560. "Yacute",
  25561. 0x00dd,
  25562. "Yacutesmall",
  25563. 0xf7fd,
  25564. "Yatcyrillic",
  25565. 0x0462,
  25566. "Ycircle",
  25567. 0x24ce,
  25568. "Ycircumflex",
  25569. 0x0176,
  25570. "Ydieresis",
  25571. 0x0178,
  25572. "Ydieresissmall",
  25573. 0xf7ff,
  25574. "Ydotaccent",
  25575. 0x1e8e,
  25576. "Ydotbelow",
  25577. 0x1ef4,
  25578. "Yericyrillic",
  25579. 0x042b,
  25580. "Yerudieresiscyrillic",
  25581. 0x04f8,
  25582. "Ygrave",
  25583. 0x1ef2,
  25584. "Yhook",
  25585. 0x01b3,
  25586. "Yhookabove",
  25587. 0x1ef6,
  25588. "Yiarmenian",
  25589. 0x0545,
  25590. "Yicyrillic",
  25591. 0x0407,
  25592. "Yiwnarmenian",
  25593. 0x0552,
  25594. "Ymonospace",
  25595. 0xff39,
  25596. "Ysmall",
  25597. 0xf779,
  25598. "Ytilde",
  25599. 0x1ef8,
  25600. "Yusbigcyrillic",
  25601. 0x046a,
  25602. "Yusbigiotifiedcyrillic",
  25603. 0x046c,
  25604. "Yuslittlecyrillic",
  25605. 0x0466,
  25606. "Yuslittleiotifiedcyrillic",
  25607. 0x0468,
  25608. "Z",
  25609. 0x005a,
  25610. "Zaarmenian",
  25611. 0x0536,
  25612. "Zacute",
  25613. 0x0179,
  25614. "Zcaron",
  25615. 0x017d,
  25616. "Zcaronsmall",
  25617. 0xf6ff,
  25618. "Zcircle",
  25619. 0x24cf,
  25620. "Zcircumflex",
  25621. 0x1e90,
  25622. "Zdot",
  25623. 0x017b,
  25624. "Zdotaccent",
  25625. 0x017b,
  25626. "Zdotbelow",
  25627. 0x1e92,
  25628. "Zecyrillic",
  25629. 0x0417,
  25630. "Zedescendercyrillic",
  25631. 0x0498,
  25632. "Zedieresiscyrillic",
  25633. 0x04de,
  25634. "Zeta",
  25635. 0x0396,
  25636. "Zhearmenian",
  25637. 0x053a,
  25638. "Zhebrevecyrillic",
  25639. 0x04c1,
  25640. "Zhecyrillic",
  25641. 0x0416,
  25642. "Zhedescendercyrillic",
  25643. 0x0496,
  25644. "Zhedieresiscyrillic",
  25645. 0x04dc,
  25646. "Zlinebelow",
  25647. 0x1e94,
  25648. "Zmonospace",
  25649. 0xff3a,
  25650. "Zsmall",
  25651. 0xf77a,
  25652. "Zstroke",
  25653. 0x01b5,
  25654. "a",
  25655. 0x0061,
  25656. "aabengali",
  25657. 0x0986,
  25658. "aacute",
  25659. 0x00e1,
  25660. "aadeva",
  25661. 0x0906,
  25662. "aagujarati",
  25663. 0x0a86,
  25664. "aagurmukhi",
  25665. 0x0a06,
  25666. "aamatragurmukhi",
  25667. 0x0a3e,
  25668. "aarusquare",
  25669. 0x3303,
  25670. "aavowelsignbengali",
  25671. 0x09be,
  25672. "aavowelsigndeva",
  25673. 0x093e,
  25674. "aavowelsigngujarati",
  25675. 0x0abe,
  25676. "abbreviationmarkarmenian",
  25677. 0x055f,
  25678. "abbreviationsigndeva",
  25679. 0x0970,
  25680. "abengali",
  25681. 0x0985,
  25682. "abopomofo",
  25683. 0x311a,
  25684. "abreve",
  25685. 0x0103,
  25686. "abreveacute",
  25687. 0x1eaf,
  25688. "abrevecyrillic",
  25689. 0x04d1,
  25690. "abrevedotbelow",
  25691. 0x1eb7,
  25692. "abrevegrave",
  25693. 0x1eb1,
  25694. "abrevehookabove",
  25695. 0x1eb3,
  25696. "abrevetilde",
  25697. 0x1eb5,
  25698. "acaron",
  25699. 0x01ce,
  25700. "acircle",
  25701. 0x24d0,
  25702. "acircumflex",
  25703. 0x00e2,
  25704. "acircumflexacute",
  25705. 0x1ea5,
  25706. "acircumflexdotbelow",
  25707. 0x1ead,
  25708. "acircumflexgrave",
  25709. 0x1ea7,
  25710. "acircumflexhookabove",
  25711. 0x1ea9,
  25712. "acircumflextilde",
  25713. 0x1eab,
  25714. "acute",
  25715. 0x00b4,
  25716. "acutebelowcmb",
  25717. 0x0317,
  25718. "acutecmb",
  25719. 0x0301,
  25720. "acutecomb",
  25721. 0x0301,
  25722. "acutedeva",
  25723. 0x0954,
  25724. "acutelowmod",
  25725. 0x02cf,
  25726. "acutetonecmb",
  25727. 0x0341,
  25728. "acyrillic",
  25729. 0x0430,
  25730. "adblgrave",
  25731. 0x0201,
  25732. "addakgurmukhi",
  25733. 0x0a71,
  25734. "adeva",
  25735. 0x0905,
  25736. "adieresis",
  25737. 0x00e4,
  25738. "adieresiscyrillic",
  25739. 0x04d3,
  25740. "adieresismacron",
  25741. 0x01df,
  25742. "adotbelow",
  25743. 0x1ea1,
  25744. "adotmacron",
  25745. 0x01e1,
  25746. "ae",
  25747. 0x00e6,
  25748. "aeacute",
  25749. 0x01fd,
  25750. "aekorean",
  25751. 0x3150,
  25752. "aemacron",
  25753. 0x01e3,
  25754. "afii00208",
  25755. 0x2015,
  25756. "afii08941",
  25757. 0x20a4,
  25758. "afii10017",
  25759. 0x0410,
  25760. "afii10018",
  25761. 0x0411,
  25762. "afii10019",
  25763. 0x0412,
  25764. "afii10020",
  25765. 0x0413,
  25766. "afii10021",
  25767. 0x0414,
  25768. "afii10022",
  25769. 0x0415,
  25770. "afii10023",
  25771. 0x0401,
  25772. "afii10024",
  25773. 0x0416,
  25774. "afii10025",
  25775. 0x0417,
  25776. "afii10026",
  25777. 0x0418,
  25778. "afii10027",
  25779. 0x0419,
  25780. "afii10028",
  25781. 0x041a,
  25782. "afii10029",
  25783. 0x041b,
  25784. "afii10030",
  25785. 0x041c,
  25786. "afii10031",
  25787. 0x041d,
  25788. "afii10032",
  25789. 0x041e,
  25790. "afii10033",
  25791. 0x041f,
  25792. "afii10034",
  25793. 0x0420,
  25794. "afii10035",
  25795. 0x0421,
  25796. "afii10036",
  25797. 0x0422,
  25798. "afii10037",
  25799. 0x0423,
  25800. "afii10038",
  25801. 0x0424,
  25802. "afii10039",
  25803. 0x0425,
  25804. "afii10040",
  25805. 0x0426,
  25806. "afii10041",
  25807. 0x0427,
  25808. "afii10042",
  25809. 0x0428,
  25810. "afii10043",
  25811. 0x0429,
  25812. "afii10044",
  25813. 0x042a,
  25814. "afii10045",
  25815. 0x042b,
  25816. "afii10046",
  25817. 0x042c,
  25818. "afii10047",
  25819. 0x042d,
  25820. "afii10048",
  25821. 0x042e,
  25822. "afii10049",
  25823. 0x042f,
  25824. "afii10050",
  25825. 0x0490,
  25826. "afii10051",
  25827. 0x0402,
  25828. "afii10052",
  25829. 0x0403,
  25830. "afii10053",
  25831. 0x0404,
  25832. "afii10054",
  25833. 0x0405,
  25834. "afii10055",
  25835. 0x0406,
  25836. "afii10056",
  25837. 0x0407,
  25838. "afii10057",
  25839. 0x0408,
  25840. "afii10058",
  25841. 0x0409,
  25842. "afii10059",
  25843. 0x040a,
  25844. "afii10060",
  25845. 0x040b,
  25846. "afii10061",
  25847. 0x040c,
  25848. "afii10062",
  25849. 0x040e,
  25850. "afii10063",
  25851. 0xf6c4,
  25852. "afii10064",
  25853. 0xf6c5,
  25854. "afii10065",
  25855. 0x0430,
  25856. "afii10066",
  25857. 0x0431,
  25858. "afii10067",
  25859. 0x0432,
  25860. "afii10068",
  25861. 0x0433,
  25862. "afii10069",
  25863. 0x0434,
  25864. "afii10070",
  25865. 0x0435,
  25866. "afii10071",
  25867. 0x0451,
  25868. "afii10072",
  25869. 0x0436,
  25870. "afii10073",
  25871. 0x0437,
  25872. "afii10074",
  25873. 0x0438,
  25874. "afii10075",
  25875. 0x0439,
  25876. "afii10076",
  25877. 0x043a,
  25878. "afii10077",
  25879. 0x043b,
  25880. "afii10078",
  25881. 0x043c,
  25882. "afii10079",
  25883. 0x043d,
  25884. "afii10080",
  25885. 0x043e,
  25886. "afii10081",
  25887. 0x043f,
  25888. "afii10082",
  25889. 0x0440,
  25890. "afii10083",
  25891. 0x0441,
  25892. "afii10084",
  25893. 0x0442,
  25894. "afii10085",
  25895. 0x0443,
  25896. "afii10086",
  25897. 0x0444,
  25898. "afii10087",
  25899. 0x0445,
  25900. "afii10088",
  25901. 0x0446,
  25902. "afii10089",
  25903. 0x0447,
  25904. "afii10090",
  25905. 0x0448,
  25906. "afii10091",
  25907. 0x0449,
  25908. "afii10092",
  25909. 0x044a,
  25910. "afii10093",
  25911. 0x044b,
  25912. "afii10094",
  25913. 0x044c,
  25914. "afii10095",
  25915. 0x044d,
  25916. "afii10096",
  25917. 0x044e,
  25918. "afii10097",
  25919. 0x044f,
  25920. "afii10098",
  25921. 0x0491,
  25922. "afii10099",
  25923. 0x0452,
  25924. "afii10100",
  25925. 0x0453,
  25926. "afii10101",
  25927. 0x0454,
  25928. "afii10102",
  25929. 0x0455,
  25930. "afii10103",
  25931. 0x0456,
  25932. "afii10104",
  25933. 0x0457,
  25934. "afii10105",
  25935. 0x0458,
  25936. "afii10106",
  25937. 0x0459,
  25938. "afii10107",
  25939. 0x045a,
  25940. "afii10108",
  25941. 0x045b,
  25942. "afii10109",
  25943. 0x045c,
  25944. "afii10110",
  25945. 0x045e,
  25946. "afii10145",
  25947. 0x040f,
  25948. "afii10146",
  25949. 0x0462,
  25950. "afii10147",
  25951. 0x0472,
  25952. "afii10148",
  25953. 0x0474,
  25954. "afii10192",
  25955. 0xf6c6,
  25956. "afii10193",
  25957. 0x045f,
  25958. "afii10194",
  25959. 0x0463,
  25960. "afii10195",
  25961. 0x0473,
  25962. "afii10196",
  25963. 0x0475,
  25964. "afii10831",
  25965. 0xf6c7,
  25966. "afii10832",
  25967. 0xf6c8,
  25968. "afii10846",
  25969. 0x04d9,
  25970. "afii299",
  25971. 0x200e,
  25972. "afii300",
  25973. 0x200f,
  25974. "afii301",
  25975. 0x200d,
  25976. "afii57381",
  25977. 0x066a,
  25978. "afii57388",
  25979. 0x060c,
  25980. "afii57392",
  25981. 0x0660,
  25982. "afii57393",
  25983. 0x0661,
  25984. "afii57394",
  25985. 0x0662,
  25986. "afii57395",
  25987. 0x0663,
  25988. "afii57396",
  25989. 0x0664,
  25990. "afii57397",
  25991. 0x0665,
  25992. "afii57398",
  25993. 0x0666,
  25994. "afii57399",
  25995. 0x0667,
  25996. "afii57400",
  25997. 0x0668,
  25998. "afii57401",
  25999. 0x0669,
  26000. "afii57403",
  26001. 0x061b,
  26002. "afii57407",
  26003. 0x061f,
  26004. "afii57409",
  26005. 0x0621,
  26006. "afii57410",
  26007. 0x0622,
  26008. "afii57411",
  26009. 0x0623,
  26010. "afii57412",
  26011. 0x0624,
  26012. "afii57413",
  26013. 0x0625,
  26014. "afii57414",
  26015. 0x0626,
  26016. "afii57415",
  26017. 0x0627,
  26018. "afii57416",
  26019. 0x0628,
  26020. "afii57417",
  26021. 0x0629,
  26022. "afii57418",
  26023. 0x062a,
  26024. "afii57419",
  26025. 0x062b,
  26026. "afii57420",
  26027. 0x062c,
  26028. "afii57421",
  26029. 0x062d,
  26030. "afii57422",
  26031. 0x062e,
  26032. "afii57423",
  26033. 0x062f,
  26034. "afii57424",
  26035. 0x0630,
  26036. "afii57425",
  26037. 0x0631,
  26038. "afii57426",
  26039. 0x0632,
  26040. "afii57427",
  26041. 0x0633,
  26042. "afii57428",
  26043. 0x0634,
  26044. "afii57429",
  26045. 0x0635,
  26046. "afii57430",
  26047. 0x0636,
  26048. "afii57431",
  26049. 0x0637,
  26050. "afii57432",
  26051. 0x0638,
  26052. "afii57433",
  26053. 0x0639,
  26054. "afii57434",
  26055. 0x063a,
  26056. "afii57440",
  26057. 0x0640,
  26058. "afii57441",
  26059. 0x0641,
  26060. "afii57442",
  26061. 0x0642,
  26062. "afii57443",
  26063. 0x0643,
  26064. "afii57444",
  26065. 0x0644,
  26066. "afii57445",
  26067. 0x0645,
  26068. "afii57446",
  26069. 0x0646,
  26070. "afii57448",
  26071. 0x0648,
  26072. "afii57449",
  26073. 0x0649,
  26074. "afii57450",
  26075. 0x064a,
  26076. "afii57451",
  26077. 0x064b,
  26078. "afii57452",
  26079. 0x064c,
  26080. "afii57453",
  26081. 0x064d,
  26082. "afii57454",
  26083. 0x064e,
  26084. "afii57455",
  26085. 0x064f,
  26086. "afii57456",
  26087. 0x0650,
  26088. "afii57457",
  26089. 0x0651,
  26090. "afii57458",
  26091. 0x0652,
  26092. "afii57470",
  26093. 0x0647,
  26094. "afii57505",
  26095. 0x06a4,
  26096. "afii57506",
  26097. 0x067e,
  26098. "afii57507",
  26099. 0x0686,
  26100. "afii57508",
  26101. 0x0698,
  26102. "afii57509",
  26103. 0x06af,
  26104. "afii57511",
  26105. 0x0679,
  26106. "afii57512",
  26107. 0x0688,
  26108. "afii57513",
  26109. 0x0691,
  26110. "afii57514",
  26111. 0x06ba,
  26112. "afii57519",
  26113. 0x06d2,
  26114. "afii57534",
  26115. 0x06d5,
  26116. "afii57636",
  26117. 0x20aa,
  26118. "afii57645",
  26119. 0x05be,
  26120. "afii57658",
  26121. 0x05c3,
  26122. "afii57664",
  26123. 0x05d0,
  26124. "afii57665",
  26125. 0x05d1,
  26126. "afii57666",
  26127. 0x05d2,
  26128. "afii57667",
  26129. 0x05d3,
  26130. "afii57668",
  26131. 0x05d4,
  26132. "afii57669",
  26133. 0x05d5,
  26134. "afii57670",
  26135. 0x05d6,
  26136. "afii57671",
  26137. 0x05d7,
  26138. "afii57672",
  26139. 0x05d8,
  26140. "afii57673",
  26141. 0x05d9,
  26142. "afii57674",
  26143. 0x05da,
  26144. "afii57675",
  26145. 0x05db,
  26146. "afii57676",
  26147. 0x05dc,
  26148. "afii57677",
  26149. 0x05dd,
  26150. "afii57678",
  26151. 0x05de,
  26152. "afii57679",
  26153. 0x05df,
  26154. "afii57680",
  26155. 0x05e0,
  26156. "afii57681",
  26157. 0x05e1,
  26158. "afii57682",
  26159. 0x05e2,
  26160. "afii57683",
  26161. 0x05e3,
  26162. "afii57684",
  26163. 0x05e4,
  26164. "afii57685",
  26165. 0x05e5,
  26166. "afii57686",
  26167. 0x05e6,
  26168. "afii57687",
  26169. 0x05e7,
  26170. "afii57688",
  26171. 0x05e8,
  26172. "afii57689",
  26173. 0x05e9,
  26174. "afii57690",
  26175. 0x05ea,
  26176. "afii57694",
  26177. 0xfb2a,
  26178. "afii57695",
  26179. 0xfb2b,
  26180. "afii57700",
  26181. 0xfb4b,
  26182. "afii57705",
  26183. 0xfb1f,
  26184. "afii57716",
  26185. 0x05f0,
  26186. "afii57717",
  26187. 0x05f1,
  26188. "afii57718",
  26189. 0x05f2,
  26190. "afii57723",
  26191. 0xfb35,
  26192. "afii57793",
  26193. 0x05b4,
  26194. "afii57794",
  26195. 0x05b5,
  26196. "afii57795",
  26197. 0x05b6,
  26198. "afii57796",
  26199. 0x05bb,
  26200. "afii57797",
  26201. 0x05b8,
  26202. "afii57798",
  26203. 0x05b7,
  26204. "afii57799",
  26205. 0x05b0,
  26206. "afii57800",
  26207. 0x05b2,
  26208. "afii57801",
  26209. 0x05b1,
  26210. "afii57802",
  26211. 0x05b3,
  26212. "afii57803",
  26213. 0x05c2,
  26214. "afii57804",
  26215. 0x05c1,
  26216. "afii57806",
  26217. 0x05b9,
  26218. "afii57807",
  26219. 0x05bc,
  26220. "afii57839",
  26221. 0x05bd,
  26222. "afii57841",
  26223. 0x05bf,
  26224. "afii57842",
  26225. 0x05c0,
  26226. "afii57929",
  26227. 0x02bc,
  26228. "afii61248",
  26229. 0x2105,
  26230. "afii61289",
  26231. 0x2113,
  26232. "afii61352",
  26233. 0x2116,
  26234. "afii61573",
  26235. 0x202c,
  26236. "afii61574",
  26237. 0x202d,
  26238. "afii61575",
  26239. 0x202e,
  26240. "afii61664",
  26241. 0x200c,
  26242. "afii63167",
  26243. 0x066d,
  26244. "afii64937",
  26245. 0x02bd,
  26246. "agrave",
  26247. 0x00e0,
  26248. "agujarati",
  26249. 0x0a85,
  26250. "agurmukhi",
  26251. 0x0a05,
  26252. "ahiragana",
  26253. 0x3042,
  26254. "ahookabove",
  26255. 0x1ea3,
  26256. "aibengali",
  26257. 0x0990,
  26258. "aibopomofo",
  26259. 0x311e,
  26260. "aideva",
  26261. 0x0910,
  26262. "aiecyrillic",
  26263. 0x04d5,
  26264. "aigujarati",
  26265. 0x0a90,
  26266. "aigurmukhi",
  26267. 0x0a10,
  26268. "aimatragurmukhi",
  26269. 0x0a48,
  26270. "ainarabic",
  26271. 0x0639,
  26272. "ainfinalarabic",
  26273. 0xfeca,
  26274. "aininitialarabic",
  26275. 0xfecb,
  26276. "ainmedialarabic",
  26277. 0xfecc,
  26278. "ainvertedbreve",
  26279. 0x0203,
  26280. "aivowelsignbengali",
  26281. 0x09c8,
  26282. "aivowelsigndeva",
  26283. 0x0948,
  26284. "aivowelsigngujarati",
  26285. 0x0ac8,
  26286. "akatakana",
  26287. 0x30a2,
  26288. "akatakanahalfwidth",
  26289. 0xff71,
  26290. "akorean",
  26291. 0x314f,
  26292. "alef",
  26293. 0x05d0,
  26294. "alefarabic",
  26295. 0x0627,
  26296. "alefdageshhebrew",
  26297. 0xfb30,
  26298. "aleffinalarabic",
  26299. 0xfe8e,
  26300. "alefhamzaabovearabic",
  26301. 0x0623,
  26302. "alefhamzaabovefinalarabic",
  26303. 0xfe84,
  26304. "alefhamzabelowarabic",
  26305. 0x0625,
  26306. "alefhamzabelowfinalarabic",
  26307. 0xfe88,
  26308. "alefhebrew",
  26309. 0x05d0,
  26310. "aleflamedhebrew",
  26311. 0xfb4f,
  26312. "alefmaddaabovearabic",
  26313. 0x0622,
  26314. "alefmaddaabovefinalarabic",
  26315. 0xfe82,
  26316. "alefmaksuraarabic",
  26317. 0x0649,
  26318. "alefmaksurafinalarabic",
  26319. 0xfef0,
  26320. "alefmaksurainitialarabic",
  26321. 0xfef3,
  26322. "alefmaksuramedialarabic",
  26323. 0xfef4,
  26324. "alefpatahhebrew",
  26325. 0xfb2e,
  26326. "alefqamatshebrew",
  26327. 0xfb2f,
  26328. "aleph",
  26329. 0x2135,
  26330. "allequal",
  26331. 0x224c,
  26332. "alpha",
  26333. 0x03b1,
  26334. "alphatonos",
  26335. 0x03ac,
  26336. "amacron",
  26337. 0x0101,
  26338. "amonospace",
  26339. 0xff41,
  26340. "ampersand",
  26341. 0x0026,
  26342. "ampersandmonospace",
  26343. 0xff06,
  26344. "ampersandsmall",
  26345. 0xf726,
  26346. "amsquare",
  26347. 0x33c2,
  26348. "anbopomofo",
  26349. 0x3122,
  26350. "angbopomofo",
  26351. 0x3124,
  26352. "angbracketleft",
  26353. 0x3008,
  26354. "angbracketright",
  26355. 0x3009,
  26356. "angkhankhuthai",
  26357. 0x0e5a,
  26358. "angle",
  26359. 0x2220,
  26360. "anglebracketleft",
  26361. 0x3008,
  26362. "anglebracketleftvertical",
  26363. 0xfe3f,
  26364. "anglebracketright",
  26365. 0x3009,
  26366. "anglebracketrightvertical",
  26367. 0xfe40,
  26368. "angleleft",
  26369. 0x2329,
  26370. "angleright",
  26371. 0x232a,
  26372. "angstrom",
  26373. 0x212b,
  26374. "anoteleia",
  26375. 0x0387,
  26376. "anudattadeva",
  26377. 0x0952,
  26378. "anusvarabengali",
  26379. 0x0982,
  26380. "anusvaradeva",
  26381. 0x0902,
  26382. "anusvaragujarati",
  26383. 0x0a82,
  26384. "aogonek",
  26385. 0x0105,
  26386. "apaatosquare",
  26387. 0x3300,
  26388. "aparen",
  26389. 0x249c,
  26390. "apostrophearmenian",
  26391. 0x055a,
  26392. "apostrophemod",
  26393. 0x02bc,
  26394. "apple",
  26395. 0xf8ff,
  26396. "approaches",
  26397. 0x2250,
  26398. "approxequal",
  26399. 0x2248,
  26400. "approxequalorimage",
  26401. 0x2252,
  26402. "approximatelyequal",
  26403. 0x2245,
  26404. "araeaekorean",
  26405. 0x318e,
  26406. "araeakorean",
  26407. 0x318d,
  26408. "arc",
  26409. 0x2312,
  26410. "arighthalfring",
  26411. 0x1e9a,
  26412. "aring",
  26413. 0x00e5,
  26414. "aringacute",
  26415. 0x01fb,
  26416. "aringbelow",
  26417. 0x1e01,
  26418. "arrowboth",
  26419. 0x2194,
  26420. "arrowdashdown",
  26421. 0x21e3,
  26422. "arrowdashleft",
  26423. 0x21e0,
  26424. "arrowdashright",
  26425. 0x21e2,
  26426. "arrowdashup",
  26427. 0x21e1,
  26428. "arrowdblboth",
  26429. 0x21d4,
  26430. "arrowdbldown",
  26431. 0x21d3,
  26432. "arrowdblleft",
  26433. 0x21d0,
  26434. "arrowdblright",
  26435. 0x21d2,
  26436. "arrowdblup",
  26437. 0x21d1,
  26438. "arrowdown",
  26439. 0x2193,
  26440. "arrowdownleft",
  26441. 0x2199,
  26442. "arrowdownright",
  26443. 0x2198,
  26444. "arrowdownwhite",
  26445. 0x21e9,
  26446. "arrowheaddownmod",
  26447. 0x02c5,
  26448. "arrowheadleftmod",
  26449. 0x02c2,
  26450. "arrowheadrightmod",
  26451. 0x02c3,
  26452. "arrowheadupmod",
  26453. 0x02c4,
  26454. "arrowhorizex",
  26455. 0xf8e7,
  26456. "arrowleft",
  26457. 0x2190,
  26458. "arrowleftdbl",
  26459. 0x21d0,
  26460. "arrowleftdblstroke",
  26461. 0x21cd,
  26462. "arrowleftoverright",
  26463. 0x21c6,
  26464. "arrowleftwhite",
  26465. 0x21e6,
  26466. "arrowright",
  26467. 0x2192,
  26468. "arrowrightdblstroke",
  26469. 0x21cf,
  26470. "arrowrightheavy",
  26471. 0x279e,
  26472. "arrowrightoverleft",
  26473. 0x21c4,
  26474. "arrowrightwhite",
  26475. 0x21e8,
  26476. "arrowtableft",
  26477. 0x21e4,
  26478. "arrowtabright",
  26479. 0x21e5,
  26480. "arrowup",
  26481. 0x2191,
  26482. "arrowupdn",
  26483. 0x2195,
  26484. "arrowupdnbse",
  26485. 0x21a8,
  26486. "arrowupdownbase",
  26487. 0x21a8,
  26488. "arrowupleft",
  26489. 0x2196,
  26490. "arrowupleftofdown",
  26491. 0x21c5,
  26492. "arrowupright",
  26493. 0x2197,
  26494. "arrowupwhite",
  26495. 0x21e7,
  26496. "arrowvertex",
  26497. 0xf8e6,
  26498. "asciicircum",
  26499. 0x005e,
  26500. "asciicircummonospace",
  26501. 0xff3e,
  26502. "asciitilde",
  26503. 0x007e,
  26504. "asciitildemonospace",
  26505. 0xff5e,
  26506. "ascript",
  26507. 0x0251,
  26508. "ascriptturned",
  26509. 0x0252,
  26510. "asmallhiragana",
  26511. 0x3041,
  26512. "asmallkatakana",
  26513. 0x30a1,
  26514. "asmallkatakanahalfwidth",
  26515. 0xff67,
  26516. "asterisk",
  26517. 0x002a,
  26518. "asteriskaltonearabic",
  26519. 0x066d,
  26520. "asteriskarabic",
  26521. 0x066d,
  26522. "asteriskmath",
  26523. 0x2217,
  26524. "asteriskmonospace",
  26525. 0xff0a,
  26526. "asterisksmall",
  26527. 0xfe61,
  26528. "asterism",
  26529. 0x2042,
  26530. "asuperior",
  26531. 0xf6e9,
  26532. "asymptoticallyequal",
  26533. 0x2243,
  26534. "at",
  26535. 0x0040,
  26536. "atilde",
  26537. 0x00e3,
  26538. "atmonospace",
  26539. 0xff20,
  26540. "atsmall",
  26541. 0xfe6b,
  26542. "aturned",
  26543. 0x0250,
  26544. "aubengali",
  26545. 0x0994,
  26546. "aubopomofo",
  26547. 0x3120,
  26548. "audeva",
  26549. 0x0914,
  26550. "augujarati",
  26551. 0x0a94,
  26552. "augurmukhi",
  26553. 0x0a14,
  26554. "aulengthmarkbengali",
  26555. 0x09d7,
  26556. "aumatragurmukhi",
  26557. 0x0a4c,
  26558. "auvowelsignbengali",
  26559. 0x09cc,
  26560. "auvowelsigndeva",
  26561. 0x094c,
  26562. "auvowelsigngujarati",
  26563. 0x0acc,
  26564. "avagrahadeva",
  26565. 0x093d,
  26566. "aybarmenian",
  26567. 0x0561,
  26568. "ayin",
  26569. 0x05e2,
  26570. "ayinaltonehebrew",
  26571. 0xfb20,
  26572. "ayinhebrew",
  26573. 0x05e2,
  26574. "b",
  26575. 0x0062,
  26576. "babengali",
  26577. 0x09ac,
  26578. "backslash",
  26579. 0x005c,
  26580. "backslashmonospace",
  26581. 0xff3c,
  26582. "badeva",
  26583. 0x092c,
  26584. "bagujarati",
  26585. 0x0aac,
  26586. "bagurmukhi",
  26587. 0x0a2c,
  26588. "bahiragana",
  26589. 0x3070,
  26590. "bahtthai",
  26591. 0x0e3f,
  26592. "bakatakana",
  26593. 0x30d0,
  26594. "bar",
  26595. 0x007c,
  26596. "barmonospace",
  26597. 0xff5c,
  26598. "bbopomofo",
  26599. 0x3105,
  26600. "bcircle",
  26601. 0x24d1,
  26602. "bdotaccent",
  26603. 0x1e03,
  26604. "bdotbelow",
  26605. 0x1e05,
  26606. "beamedsixteenthnotes",
  26607. 0x266c,
  26608. "because",
  26609. 0x2235,
  26610. "becyrillic",
  26611. 0x0431,
  26612. "beharabic",
  26613. 0x0628,
  26614. "behfinalarabic",
  26615. 0xfe90,
  26616. "behinitialarabic",
  26617. 0xfe91,
  26618. "behiragana",
  26619. 0x3079,
  26620. "behmedialarabic",
  26621. 0xfe92,
  26622. "behmeeminitialarabic",
  26623. 0xfc9f,
  26624. "behmeemisolatedarabic",
  26625. 0xfc08,
  26626. "behnoonfinalarabic",
  26627. 0xfc6d,
  26628. "bekatakana",
  26629. 0x30d9,
  26630. "benarmenian",
  26631. 0x0562,
  26632. "bet",
  26633. 0x05d1,
  26634. "beta",
  26635. 0x03b2,
  26636. "betasymbolgreek",
  26637. 0x03d0,
  26638. "betdagesh",
  26639. 0xfb31,
  26640. "betdageshhebrew",
  26641. 0xfb31,
  26642. "bethebrew",
  26643. 0x05d1,
  26644. "betrafehebrew",
  26645. 0xfb4c,
  26646. "bhabengali",
  26647. 0x09ad,
  26648. "bhadeva",
  26649. 0x092d,
  26650. "bhagujarati",
  26651. 0x0aad,
  26652. "bhagurmukhi",
  26653. 0x0a2d,
  26654. "bhook",
  26655. 0x0253,
  26656. "bihiragana",
  26657. 0x3073,
  26658. "bikatakana",
  26659. 0x30d3,
  26660. "bilabialclick",
  26661. 0x0298,
  26662. "bindigurmukhi",
  26663. 0x0a02,
  26664. "birusquare",
  26665. 0x3331,
  26666. "blackcircle",
  26667. 0x25cf,
  26668. "blackdiamond",
  26669. 0x25c6,
  26670. "blackdownpointingtriangle",
  26671. 0x25bc,
  26672. "blackleftpointingpointer",
  26673. 0x25c4,
  26674. "blackleftpointingtriangle",
  26675. 0x25c0,
  26676. "blacklenticularbracketleft",
  26677. 0x3010,
  26678. "blacklenticularbracketleftvertical",
  26679. 0xfe3b,
  26680. "blacklenticularbracketright",
  26681. 0x3011,
  26682. "blacklenticularbracketrightvertical",
  26683. 0xfe3c,
  26684. "blacklowerlefttriangle",
  26685. 0x25e3,
  26686. "blacklowerrighttriangle",
  26687. 0x25e2,
  26688. "blackrectangle",
  26689. 0x25ac,
  26690. "blackrightpointingpointer",
  26691. 0x25ba,
  26692. "blackrightpointingtriangle",
  26693. 0x25b6,
  26694. "blacksmallsquare",
  26695. 0x25aa,
  26696. "blacksmilingface",
  26697. 0x263b,
  26698. "blacksquare",
  26699. 0x25a0,
  26700. "blackstar",
  26701. 0x2605,
  26702. "blackupperlefttriangle",
  26703. 0x25e4,
  26704. "blackupperrighttriangle",
  26705. 0x25e5,
  26706. "blackuppointingsmalltriangle",
  26707. 0x25b4,
  26708. "blackuppointingtriangle",
  26709. 0x25b2,
  26710. "blank",
  26711. 0x2423,
  26712. "blinebelow",
  26713. 0x1e07,
  26714. "block",
  26715. 0x2588,
  26716. "bmonospace",
  26717. 0xff42,
  26718. "bobaimaithai",
  26719. 0x0e1a,
  26720. "bohiragana",
  26721. 0x307c,
  26722. "bokatakana",
  26723. 0x30dc,
  26724. "bparen",
  26725. 0x249d,
  26726. "bqsquare",
  26727. 0x33c3,
  26728. "braceex",
  26729. 0xf8f4,
  26730. "braceleft",
  26731. 0x007b,
  26732. "braceleftbt",
  26733. 0xf8f3,
  26734. "braceleftmid",
  26735. 0xf8f2,
  26736. "braceleftmonospace",
  26737. 0xff5b,
  26738. "braceleftsmall",
  26739. 0xfe5b,
  26740. "bracelefttp",
  26741. 0xf8f1,
  26742. "braceleftvertical",
  26743. 0xfe37,
  26744. "braceright",
  26745. 0x007d,
  26746. "bracerightbt",
  26747. 0xf8fe,
  26748. "bracerightmid",
  26749. 0xf8fd,
  26750. "bracerightmonospace",
  26751. 0xff5d,
  26752. "bracerightsmall",
  26753. 0xfe5c,
  26754. "bracerighttp",
  26755. 0xf8fc,
  26756. "bracerightvertical",
  26757. 0xfe38,
  26758. "bracketleft",
  26759. 0x005b,
  26760. "bracketleftbt",
  26761. 0xf8f0,
  26762. "bracketleftex",
  26763. 0xf8ef,
  26764. "bracketleftmonospace",
  26765. 0xff3b,
  26766. "bracketlefttp",
  26767. 0xf8ee,
  26768. "bracketright",
  26769. 0x005d,
  26770. "bracketrightbt",
  26771. 0xf8fb,
  26772. "bracketrightex",
  26773. 0xf8fa,
  26774. "bracketrightmonospace",
  26775. 0xff3d,
  26776. "bracketrighttp",
  26777. 0xf8f9,
  26778. "breve",
  26779. 0x02d8,
  26780. "brevebelowcmb",
  26781. 0x032e,
  26782. "brevecmb",
  26783. 0x0306,
  26784. "breveinvertedbelowcmb",
  26785. 0x032f,
  26786. "breveinvertedcmb",
  26787. 0x0311,
  26788. "breveinverteddoublecmb",
  26789. 0x0361,
  26790. "bridgebelowcmb",
  26791. 0x032a,
  26792. "bridgeinvertedbelowcmb",
  26793. 0x033a,
  26794. "brokenbar",
  26795. 0x00a6,
  26796. "bstroke",
  26797. 0x0180,
  26798. "bsuperior",
  26799. 0xf6ea,
  26800. "btopbar",
  26801. 0x0183,
  26802. "buhiragana",
  26803. 0x3076,
  26804. "bukatakana",
  26805. 0x30d6,
  26806. "bullet",
  26807. 0x2022,
  26808. "bulletinverse",
  26809. 0x25d8,
  26810. "bulletoperator",
  26811. 0x2219,
  26812. "bullseye",
  26813. 0x25ce,
  26814. "c",
  26815. 0x0063,
  26816. "caarmenian",
  26817. 0x056e,
  26818. "cabengali",
  26819. 0x099a,
  26820. "cacute",
  26821. 0x0107,
  26822. "cadeva",
  26823. 0x091a,
  26824. "cagujarati",
  26825. 0x0a9a,
  26826. "cagurmukhi",
  26827. 0x0a1a,
  26828. "calsquare",
  26829. 0x3388,
  26830. "candrabindubengali",
  26831. 0x0981,
  26832. "candrabinducmb",
  26833. 0x0310,
  26834. "candrabindudeva",
  26835. 0x0901,
  26836. "candrabindugujarati",
  26837. 0x0a81,
  26838. "capslock",
  26839. 0x21ea,
  26840. "careof",
  26841. 0x2105,
  26842. "caron",
  26843. 0x02c7,
  26844. "caronbelowcmb",
  26845. 0x032c,
  26846. "caroncmb",
  26847. 0x030c,
  26848. "carriagereturn",
  26849. 0x21b5,
  26850. "cbopomofo",
  26851. 0x3118,
  26852. "ccaron",
  26853. 0x010d,
  26854. "ccedilla",
  26855. 0x00e7,
  26856. "ccedillaacute",
  26857. 0x1e09,
  26858. "ccircle",
  26859. 0x24d2,
  26860. "ccircumflex",
  26861. 0x0109,
  26862. "ccurl",
  26863. 0x0255,
  26864. "cdot",
  26865. 0x010b,
  26866. "cdotaccent",
  26867. 0x010b,
  26868. "cdsquare",
  26869. 0x33c5,
  26870. "cedilla",
  26871. 0x00b8,
  26872. "cedillacmb",
  26873. 0x0327,
  26874. "cent",
  26875. 0x00a2,
  26876. "centigrade",
  26877. 0x2103,
  26878. "centinferior",
  26879. 0xf6df,
  26880. "centmonospace",
  26881. 0xffe0,
  26882. "centoldstyle",
  26883. 0xf7a2,
  26884. "centsuperior",
  26885. 0xf6e0,
  26886. "chaarmenian",
  26887. 0x0579,
  26888. "chabengali",
  26889. 0x099b,
  26890. "chadeva",
  26891. 0x091b,
  26892. "chagujarati",
  26893. 0x0a9b,
  26894. "chagurmukhi",
  26895. 0x0a1b,
  26896. "chbopomofo",
  26897. 0x3114,
  26898. "cheabkhasiancyrillic",
  26899. 0x04bd,
  26900. "checkmark",
  26901. 0x2713,
  26902. "checyrillic",
  26903. 0x0447,
  26904. "chedescenderabkhasiancyrillic",
  26905. 0x04bf,
  26906. "chedescendercyrillic",
  26907. 0x04b7,
  26908. "chedieresiscyrillic",
  26909. 0x04f5,
  26910. "cheharmenian",
  26911. 0x0573,
  26912. "chekhakassiancyrillic",
  26913. 0x04cc,
  26914. "cheverticalstrokecyrillic",
  26915. 0x04b9,
  26916. "chi",
  26917. 0x03c7,
  26918. "chieuchacirclekorean",
  26919. 0x3277,
  26920. "chieuchaparenkorean",
  26921. 0x3217,
  26922. "chieuchcirclekorean",
  26923. 0x3269,
  26924. "chieuchkorean",
  26925. 0x314a,
  26926. "chieuchparenkorean",
  26927. 0x3209,
  26928. "chochangthai",
  26929. 0x0e0a,
  26930. "chochanthai",
  26931. 0x0e08,
  26932. "chochingthai",
  26933. 0x0e09,
  26934. "chochoethai",
  26935. 0x0e0c,
  26936. "chook",
  26937. 0x0188,
  26938. "cieucacirclekorean",
  26939. 0x3276,
  26940. "cieucaparenkorean",
  26941. 0x3216,
  26942. "cieuccirclekorean",
  26943. 0x3268,
  26944. "cieuckorean",
  26945. 0x3148,
  26946. "cieucparenkorean",
  26947. 0x3208,
  26948. "cieucuparenkorean",
  26949. 0x321c,
  26950. "circle",
  26951. 0x25cb,
  26952. "circlecopyrt",
  26953. 0x00a9,
  26954. "circlemultiply",
  26955. 0x2297,
  26956. "circleot",
  26957. 0x2299,
  26958. "circleplus",
  26959. 0x2295,
  26960. "circlepostalmark",
  26961. 0x3036,
  26962. "circlewithlefthalfblack",
  26963. 0x25d0,
  26964. "circlewithrighthalfblack",
  26965. 0x25d1,
  26966. "circumflex",
  26967. 0x02c6,
  26968. "circumflexbelowcmb",
  26969. 0x032d,
  26970. "circumflexcmb",
  26971. 0x0302,
  26972. "clear",
  26973. 0x2327,
  26974. "clickalveolar",
  26975. 0x01c2,
  26976. "clickdental",
  26977. 0x01c0,
  26978. "clicklateral",
  26979. 0x01c1,
  26980. "clickretroflex",
  26981. 0x01c3,
  26982. "club",
  26983. 0x2663,
  26984. "clubsuitblack",
  26985. 0x2663,
  26986. "clubsuitwhite",
  26987. 0x2667,
  26988. "cmcubedsquare",
  26989. 0x33a4,
  26990. "cmonospace",
  26991. 0xff43,
  26992. "cmsquaredsquare",
  26993. 0x33a0,
  26994. "coarmenian",
  26995. 0x0581,
  26996. "colon",
  26997. 0x003a,
  26998. "colonmonetary",
  26999. 0x20a1,
  27000. "colonmonospace",
  27001. 0xff1a,
  27002. "colonsign",
  27003. 0x20a1,
  27004. "colonsmall",
  27005. 0xfe55,
  27006. "colontriangularhalfmod",
  27007. 0x02d1,
  27008. "colontriangularmod",
  27009. 0x02d0,
  27010. "comma",
  27011. 0x002c,
  27012. "commaabovecmb",
  27013. 0x0313,
  27014. "commaaboverightcmb",
  27015. 0x0315,
  27016. "commaaccent",
  27017. 0xf6c3,
  27018. "commaarabic",
  27019. 0x060c,
  27020. "commaarmenian",
  27021. 0x055d,
  27022. "commainferior",
  27023. 0xf6e1,
  27024. "commamonospace",
  27025. 0xff0c,
  27026. "commareversedabovecmb",
  27027. 0x0314,
  27028. "commareversedmod",
  27029. 0x02bd,
  27030. "commasmall",
  27031. 0xfe50,
  27032. "commasuperior",
  27033. 0xf6e2,
  27034. "commaturnedabovecmb",
  27035. 0x0312,
  27036. "commaturnedmod",
  27037. 0x02bb,
  27038. "compass",
  27039. 0x263c,
  27040. "congruent",
  27041. 0x2245,
  27042. "contourintegral",
  27043. 0x222e,
  27044. "control",
  27045. 0x2303,
  27046. "controlACK",
  27047. 0x0006,
  27048. "controlBEL",
  27049. 0x0007,
  27050. "controlBS",
  27051. 0x0008,
  27052. "controlCAN",
  27053. 0x0018,
  27054. "controlCR",
  27055. 0x000d,
  27056. "controlDC1",
  27057. 0x0011,
  27058. "controlDC2",
  27059. 0x0012,
  27060. "controlDC3",
  27061. 0x0013,
  27062. "controlDC4",
  27063. 0x0014,
  27064. "controlDEL",
  27065. 0x007f,
  27066. "controlDLE",
  27067. 0x0010,
  27068. "controlEM",
  27069. 0x0019,
  27070. "controlENQ",
  27071. 0x0005,
  27072. "controlEOT",
  27073. 0x0004,
  27074. "controlESC",
  27075. 0x001b,
  27076. "controlETB",
  27077. 0x0017,
  27078. "controlETX",
  27079. 0x0003,
  27080. "controlFF",
  27081. 0x000c,
  27082. "controlFS",
  27083. 0x001c,
  27084. "controlGS",
  27085. 0x001d,
  27086. "controlHT",
  27087. 0x0009,
  27088. "controlLF",
  27089. 0x000a,
  27090. "controlNAK",
  27091. 0x0015,
  27092. "controlNULL",
  27093. 0x0000,
  27094. "controlRS",
  27095. 0x001e,
  27096. "controlSI",
  27097. 0x000f,
  27098. "controlSO",
  27099. 0x000e,
  27100. "controlSOT",
  27101. 0x0002,
  27102. "controlSTX",
  27103. 0x0001,
  27104. "controlSUB",
  27105. 0x001a,
  27106. "controlSYN",
  27107. 0x0016,
  27108. "controlUS",
  27109. 0x001f,
  27110. "controlVT",
  27111. 0x000b,
  27112. "copyright",
  27113. 0x00a9,
  27114. "copyrightsans",
  27115. 0xf8e9,
  27116. "copyrightserif",
  27117. 0xf6d9,
  27118. "cornerbracketleft",
  27119. 0x300c,
  27120. "cornerbracketlefthalfwidth",
  27121. 0xff62,
  27122. "cornerbracketleftvertical",
  27123. 0xfe41,
  27124. "cornerbracketright",
  27125. 0x300d,
  27126. "cornerbracketrighthalfwidth",
  27127. 0xff63,
  27128. "cornerbracketrightvertical",
  27129. 0xfe42,
  27130. "corporationsquare",
  27131. 0x337f,
  27132. "cosquare",
  27133. 0x33c7,
  27134. "coverkgsquare",
  27135. 0x33c6,
  27136. "cparen",
  27137. 0x249e,
  27138. "cruzeiro",
  27139. 0x20a2,
  27140. "cstretched",
  27141. 0x0297,
  27142. "curlyand",
  27143. 0x22cf,
  27144. "curlyor",
  27145. 0x22ce,
  27146. "currency",
  27147. 0x00a4,
  27148. "cyrBreve",
  27149. 0xf6d1,
  27150. "cyrFlex",
  27151. 0xf6d2,
  27152. "cyrbreve",
  27153. 0xf6d4,
  27154. "cyrflex",
  27155. 0xf6d5,
  27156. "d",
  27157. 0x0064,
  27158. "daarmenian",
  27159. 0x0564,
  27160. "dabengali",
  27161. 0x09a6,
  27162. "dadarabic",
  27163. 0x0636,
  27164. "dadeva",
  27165. 0x0926,
  27166. "dadfinalarabic",
  27167. 0xfebe,
  27168. "dadinitialarabic",
  27169. 0xfebf,
  27170. "dadmedialarabic",
  27171. 0xfec0,
  27172. "dagesh",
  27173. 0x05bc,
  27174. "dageshhebrew",
  27175. 0x05bc,
  27176. "dagger",
  27177. 0x2020,
  27178. "daggerdbl",
  27179. 0x2021,
  27180. "dagujarati",
  27181. 0x0aa6,
  27182. "dagurmukhi",
  27183. 0x0a26,
  27184. "dahiragana",
  27185. 0x3060,
  27186. "dakatakana",
  27187. 0x30c0,
  27188. "dalarabic",
  27189. 0x062f,
  27190. "dalet",
  27191. 0x05d3,
  27192. "daletdagesh",
  27193. 0xfb33,
  27194. "daletdageshhebrew",
  27195. 0xfb33,
  27196. "dalethebrew",
  27197. 0x05d3,
  27198. "dalfinalarabic",
  27199. 0xfeaa,
  27200. "dammaarabic",
  27201. 0x064f,
  27202. "dammalowarabic",
  27203. 0x064f,
  27204. "dammatanaltonearabic",
  27205. 0x064c,
  27206. "dammatanarabic",
  27207. 0x064c,
  27208. "danda",
  27209. 0x0964,
  27210. "dargahebrew",
  27211. 0x05a7,
  27212. "dargalefthebrew",
  27213. 0x05a7,
  27214. "dasiapneumatacyrilliccmb",
  27215. 0x0485,
  27216. "dblGrave",
  27217. 0xf6d3,
  27218. "dblanglebracketleft",
  27219. 0x300a,
  27220. "dblanglebracketleftvertical",
  27221. 0xfe3d,
  27222. "dblanglebracketright",
  27223. 0x300b,
  27224. "dblanglebracketrightvertical",
  27225. 0xfe3e,
  27226. "dblarchinvertedbelowcmb",
  27227. 0x032b,
  27228. "dblarrowleft",
  27229. 0x21d4,
  27230. "dblarrowright",
  27231. 0x21d2,
  27232. "dbldanda",
  27233. 0x0965,
  27234. "dblgrave",
  27235. 0xf6d6,
  27236. "dblgravecmb",
  27237. 0x030f,
  27238. "dblintegral",
  27239. 0x222c,
  27240. "dbllowline",
  27241. 0x2017,
  27242. "dbllowlinecmb",
  27243. 0x0333,
  27244. "dbloverlinecmb",
  27245. 0x033f,
  27246. "dblprimemod",
  27247. 0x02ba,
  27248. "dblverticalbar",
  27249. 0x2016,
  27250. "dblverticallineabovecmb",
  27251. 0x030e,
  27252. "dbopomofo",
  27253. 0x3109,
  27254. "dbsquare",
  27255. 0x33c8,
  27256. "dcaron",
  27257. 0x010f,
  27258. "dcedilla",
  27259. 0x1e11,
  27260. "dcircle",
  27261. 0x24d3,
  27262. "dcircumflexbelow",
  27263. 0x1e13,
  27264. "dcroat",
  27265. 0x0111,
  27266. "ddabengali",
  27267. 0x09a1,
  27268. "ddadeva",
  27269. 0x0921,
  27270. "ddagujarati",
  27271. 0x0aa1,
  27272. "ddagurmukhi",
  27273. 0x0a21,
  27274. "ddalarabic",
  27275. 0x0688,
  27276. "ddalfinalarabic",
  27277. 0xfb89,
  27278. "dddhadeva",
  27279. 0x095c,
  27280. "ddhabengali",
  27281. 0x09a2,
  27282. "ddhadeva",
  27283. 0x0922,
  27284. "ddhagujarati",
  27285. 0x0aa2,
  27286. "ddhagurmukhi",
  27287. 0x0a22,
  27288. "ddotaccent",
  27289. 0x1e0b,
  27290. "ddotbelow",
  27291. 0x1e0d,
  27292. "decimalseparatorarabic",
  27293. 0x066b,
  27294. "decimalseparatorpersian",
  27295. 0x066b,
  27296. "decyrillic",
  27297. 0x0434,
  27298. "degree",
  27299. 0x00b0,
  27300. "dehihebrew",
  27301. 0x05ad,
  27302. "dehiragana",
  27303. 0x3067,
  27304. "deicoptic",
  27305. 0x03ef,
  27306. "dekatakana",
  27307. 0x30c7,
  27308. "deleteleft",
  27309. 0x232b,
  27310. "deleteright",
  27311. 0x2326,
  27312. "delta",
  27313. 0x03b4,
  27314. "deltaturned",
  27315. 0x018d,
  27316. "denominatorminusonenumeratorbengali",
  27317. 0x09f8,
  27318. "dezh",
  27319. 0x02a4,
  27320. "dhabengali",
  27321. 0x09a7,
  27322. "dhadeva",
  27323. 0x0927,
  27324. "dhagujarati",
  27325. 0x0aa7,
  27326. "dhagurmukhi",
  27327. 0x0a27,
  27328. "dhook",
  27329. 0x0257,
  27330. "dialytikatonos",
  27331. 0x0385,
  27332. "dialytikatonoscmb",
  27333. 0x0344,
  27334. "diamond",
  27335. 0x2666,
  27336. "diamondsuitwhite",
  27337. 0x2662,
  27338. "dieresis",
  27339. 0x00a8,
  27340. "dieresisacute",
  27341. 0xf6d7,
  27342. "dieresisbelowcmb",
  27343. 0x0324,
  27344. "dieresiscmb",
  27345. 0x0308,
  27346. "dieresisgrave",
  27347. 0xf6d8,
  27348. "dieresistonos",
  27349. 0x0385,
  27350. "dihiragana",
  27351. 0x3062,
  27352. "dikatakana",
  27353. 0x30c2,
  27354. "dittomark",
  27355. 0x3003,
  27356. "divide",
  27357. 0x00f7,
  27358. "divides",
  27359. 0x2223,
  27360. "divisionslash",
  27361. 0x2215,
  27362. "djecyrillic",
  27363. 0x0452,
  27364. "dkshade",
  27365. 0x2593,
  27366. "dlinebelow",
  27367. 0x1e0f,
  27368. "dlsquare",
  27369. 0x3397,
  27370. "dmacron",
  27371. 0x0111,
  27372. "dmonospace",
  27373. 0xff44,
  27374. "dnblock",
  27375. 0x2584,
  27376. "dochadathai",
  27377. 0x0e0e,
  27378. "dodekthai",
  27379. 0x0e14,
  27380. "dohiragana",
  27381. 0x3069,
  27382. "dokatakana",
  27383. 0x30c9,
  27384. "dollar",
  27385. 0x0024,
  27386. "dollarinferior",
  27387. 0xf6e3,
  27388. "dollarmonospace",
  27389. 0xff04,
  27390. "dollaroldstyle",
  27391. 0xf724,
  27392. "dollarsmall",
  27393. 0xfe69,
  27394. "dollarsuperior",
  27395. 0xf6e4,
  27396. "dong",
  27397. 0x20ab,
  27398. "dorusquare",
  27399. 0x3326,
  27400. "dotaccent",
  27401. 0x02d9,
  27402. "dotaccentcmb",
  27403. 0x0307,
  27404. "dotbelowcmb",
  27405. 0x0323,
  27406. "dotbelowcomb",
  27407. 0x0323,
  27408. "dotkatakana",
  27409. 0x30fb,
  27410. "dotlessi",
  27411. 0x0131,
  27412. "dotlessj",
  27413. 0xf6be,
  27414. "dotlessjstrokehook",
  27415. 0x0284,
  27416. "dotmath",
  27417. 0x22c5,
  27418. "dottedcircle",
  27419. 0x25cc,
  27420. "doubleyodpatah",
  27421. 0xfb1f,
  27422. "doubleyodpatahhebrew",
  27423. 0xfb1f,
  27424. "downtackbelowcmb",
  27425. 0x031e,
  27426. "downtackmod",
  27427. 0x02d5,
  27428. "dparen",
  27429. 0x249f,
  27430. "dsuperior",
  27431. 0xf6eb,
  27432. "dtail",
  27433. 0x0256,
  27434. "dtopbar",
  27435. 0x018c,
  27436. "duhiragana",
  27437. 0x3065,
  27438. "dukatakana",
  27439. 0x30c5,
  27440. "dz",
  27441. 0x01f3,
  27442. "dzaltone",
  27443. 0x02a3,
  27444. "dzcaron",
  27445. 0x01c6,
  27446. "dzcurl",
  27447. 0x02a5,
  27448. "dzeabkhasiancyrillic",
  27449. 0x04e1,
  27450. "dzecyrillic",
  27451. 0x0455,
  27452. "dzhecyrillic",
  27453. 0x045f,
  27454. "e",
  27455. 0x0065,
  27456. "eacute",
  27457. 0x00e9,
  27458. "earth",
  27459. 0x2641,
  27460. "ebengali",
  27461. 0x098f,
  27462. "ebopomofo",
  27463. 0x311c,
  27464. "ebreve",
  27465. 0x0115,
  27466. "ecandradeva",
  27467. 0x090d,
  27468. "ecandragujarati",
  27469. 0x0a8d,
  27470. "ecandravowelsigndeva",
  27471. 0x0945,
  27472. "ecandravowelsigngujarati",
  27473. 0x0ac5,
  27474. "ecaron",
  27475. 0x011b,
  27476. "ecedillabreve",
  27477. 0x1e1d,
  27478. "echarmenian",
  27479. 0x0565,
  27480. "echyiwnarmenian",
  27481. 0x0587,
  27482. "ecircle",
  27483. 0x24d4,
  27484. "ecircumflex",
  27485. 0x00ea,
  27486. "ecircumflexacute",
  27487. 0x1ebf,
  27488. "ecircumflexbelow",
  27489. 0x1e19,
  27490. "ecircumflexdotbelow",
  27491. 0x1ec7,
  27492. "ecircumflexgrave",
  27493. 0x1ec1,
  27494. "ecircumflexhookabove",
  27495. 0x1ec3,
  27496. "ecircumflextilde",
  27497. 0x1ec5,
  27498. "ecyrillic",
  27499. 0x0454,
  27500. "edblgrave",
  27501. 0x0205,
  27502. "edeva",
  27503. 0x090f,
  27504. "edieresis",
  27505. 0x00eb,
  27506. "edot",
  27507. 0x0117,
  27508. "edotaccent",
  27509. 0x0117,
  27510. "edotbelow",
  27511. 0x1eb9,
  27512. "eegurmukhi",
  27513. 0x0a0f,
  27514. "eematragurmukhi",
  27515. 0x0a47,
  27516. "efcyrillic",
  27517. 0x0444,
  27518. "egrave",
  27519. 0x00e8,
  27520. "egujarati",
  27521. 0x0a8f,
  27522. "eharmenian",
  27523. 0x0567,
  27524. "ehbopomofo",
  27525. 0x311d,
  27526. "ehiragana",
  27527. 0x3048,
  27528. "ehookabove",
  27529. 0x1ebb,
  27530. "eibopomofo",
  27531. 0x311f,
  27532. "eight",
  27533. 0x0038,
  27534. "eightarabic",
  27535. 0x0668,
  27536. "eightbengali",
  27537. 0x09ee,
  27538. "eightcircle",
  27539. 0x2467,
  27540. "eightcircleinversesansserif",
  27541. 0x2791,
  27542. "eightdeva",
  27543. 0x096e,
  27544. "eighteencircle",
  27545. 0x2471,
  27546. "eighteenparen",
  27547. 0x2485,
  27548. "eighteenperiod",
  27549. 0x2499,
  27550. "eightgujarati",
  27551. 0x0aee,
  27552. "eightgurmukhi",
  27553. 0x0a6e,
  27554. "eighthackarabic",
  27555. 0x0668,
  27556. "eighthangzhou",
  27557. 0x3028,
  27558. "eighthnotebeamed",
  27559. 0x266b,
  27560. "eightideographicparen",
  27561. 0x3227,
  27562. "eightinferior",
  27563. 0x2088,
  27564. "eightmonospace",
  27565. 0xff18,
  27566. "eightoldstyle",
  27567. 0xf738,
  27568. "eightparen",
  27569. 0x247b,
  27570. "eightperiod",
  27571. 0x248f,
  27572. "eightpersian",
  27573. 0x06f8,
  27574. "eightroman",
  27575. 0x2177,
  27576. "eightsuperior",
  27577. 0x2078,
  27578. "eightthai",
  27579. 0x0e58,
  27580. "einvertedbreve",
  27581. 0x0207,
  27582. "eiotifiedcyrillic",
  27583. 0x0465,
  27584. "ekatakana",
  27585. 0x30a8,
  27586. "ekatakanahalfwidth",
  27587. 0xff74,
  27588. "ekonkargurmukhi",
  27589. 0x0a74,
  27590. "ekorean",
  27591. 0x3154,
  27592. "elcyrillic",
  27593. 0x043b,
  27594. "element",
  27595. 0x2208,
  27596. "elevencircle",
  27597. 0x246a,
  27598. "elevenparen",
  27599. 0x247e,
  27600. "elevenperiod",
  27601. 0x2492,
  27602. "elevenroman",
  27603. 0x217a,
  27604. "ellipsis",
  27605. 0x2026,
  27606. "ellipsisvertical",
  27607. 0x22ee,
  27608. "emacron",
  27609. 0x0113,
  27610. "emacronacute",
  27611. 0x1e17,
  27612. "emacrongrave",
  27613. 0x1e15,
  27614. "emcyrillic",
  27615. 0x043c,
  27616. "emdash",
  27617. 0x2014,
  27618. "emdashvertical",
  27619. 0xfe31,
  27620. "emonospace",
  27621. 0xff45,
  27622. "emphasismarkarmenian",
  27623. 0x055b,
  27624. "emptyset",
  27625. 0x2205,
  27626. "enbopomofo",
  27627. 0x3123,
  27628. "encyrillic",
  27629. 0x043d,
  27630. "endash",
  27631. 0x2013,
  27632. "endashvertical",
  27633. 0xfe32,
  27634. "endescendercyrillic",
  27635. 0x04a3,
  27636. "eng",
  27637. 0x014b,
  27638. "engbopomofo",
  27639. 0x3125,
  27640. "enghecyrillic",
  27641. 0x04a5,
  27642. "enhookcyrillic",
  27643. 0x04c8,
  27644. "enspace",
  27645. 0x2002,
  27646. "eogonek",
  27647. 0x0119,
  27648. "eokorean",
  27649. 0x3153,
  27650. "eopen",
  27651. 0x025b,
  27652. "eopenclosed",
  27653. 0x029a,
  27654. "eopenreversed",
  27655. 0x025c,
  27656. "eopenreversedclosed",
  27657. 0x025e,
  27658. "eopenreversedhook",
  27659. 0x025d,
  27660. "eparen",
  27661. 0x24a0,
  27662. "epsilon",
  27663. 0x03b5,
  27664. "epsilontonos",
  27665. 0x03ad,
  27666. "equal",
  27667. 0x003d,
  27668. "equalmonospace",
  27669. 0xff1d,
  27670. "equalsmall",
  27671. 0xfe66,
  27672. "equalsuperior",
  27673. 0x207c,
  27674. "equivalence",
  27675. 0x2261,
  27676. "erbopomofo",
  27677. 0x3126,
  27678. "ercyrillic",
  27679. 0x0440,
  27680. "ereversed",
  27681. 0x0258,
  27682. "ereversedcyrillic",
  27683. 0x044d,
  27684. "escyrillic",
  27685. 0x0441,
  27686. "esdescendercyrillic",
  27687. 0x04ab,
  27688. "esh",
  27689. 0x0283,
  27690. "eshcurl",
  27691. 0x0286,
  27692. "eshortdeva",
  27693. 0x090e,
  27694. "eshortvowelsigndeva",
  27695. 0x0946,
  27696. "eshreversedloop",
  27697. 0x01aa,
  27698. "eshsquatreversed",
  27699. 0x0285,
  27700. "esmallhiragana",
  27701. 0x3047,
  27702. "esmallkatakana",
  27703. 0x30a7,
  27704. "esmallkatakanahalfwidth",
  27705. 0xff6a,
  27706. "estimated",
  27707. 0x212e,
  27708. "esuperior",
  27709. 0xf6ec,
  27710. "eta",
  27711. 0x03b7,
  27712. "etarmenian",
  27713. 0x0568,
  27714. "etatonos",
  27715. 0x03ae,
  27716. "eth",
  27717. 0x00f0,
  27718. "etilde",
  27719. 0x1ebd,
  27720. "etildebelow",
  27721. 0x1e1b,
  27722. "etnahtafoukhhebrew",
  27723. 0x0591,
  27724. "etnahtafoukhlefthebrew",
  27725. 0x0591,
  27726. "etnahtahebrew",
  27727. 0x0591,
  27728. "etnahtalefthebrew",
  27729. 0x0591,
  27730. "eturned",
  27731. 0x01dd,
  27732. "eukorean",
  27733. 0x3161,
  27734. "euro",
  27735. 0x20ac,
  27736. "evowelsignbengali",
  27737. 0x09c7,
  27738. "evowelsigndeva",
  27739. 0x0947,
  27740. "evowelsigngujarati",
  27741. 0x0ac7,
  27742. "exclam",
  27743. 0x0021,
  27744. "exclamarmenian",
  27745. 0x055c,
  27746. "exclamdbl",
  27747. 0x203c,
  27748. "exclamdown",
  27749. 0x00a1,
  27750. "exclamdownsmall",
  27751. 0xf7a1,
  27752. "exclammonospace",
  27753. 0xff01,
  27754. "exclamsmall",
  27755. 0xf721,
  27756. "existential",
  27757. 0x2203,
  27758. "ezh",
  27759. 0x0292,
  27760. "ezhcaron",
  27761. 0x01ef,
  27762. "ezhcurl",
  27763. 0x0293,
  27764. "ezhreversed",
  27765. 0x01b9,
  27766. "ezhtail",
  27767. 0x01ba,
  27768. "f",
  27769. 0x0066,
  27770. "fadeva",
  27771. 0x095e,
  27772. "fagurmukhi",
  27773. 0x0a5e,
  27774. "fahrenheit",
  27775. 0x2109,
  27776. "fathaarabic",
  27777. 0x064e,
  27778. "fathalowarabic",
  27779. 0x064e,
  27780. "fathatanarabic",
  27781. 0x064b,
  27782. "fbopomofo",
  27783. 0x3108,
  27784. "fcircle",
  27785. 0x24d5,
  27786. "fdotaccent",
  27787. 0x1e1f,
  27788. "feharabic",
  27789. 0x0641,
  27790. "feharmenian",
  27791. 0x0586,
  27792. "fehfinalarabic",
  27793. 0xfed2,
  27794. "fehinitialarabic",
  27795. 0xfed3,
  27796. "fehmedialarabic",
  27797. 0xfed4,
  27798. "feicoptic",
  27799. 0x03e5,
  27800. "female",
  27801. 0x2640,
  27802. "ff",
  27803. 0xfb00,
  27804. "f_f",
  27805. 0xfb00,
  27806. "ffi",
  27807. 0xfb03,
  27808. "f_f_i",
  27809. 0xfb03,
  27810. "ffl",
  27811. 0xfb04,
  27812. "f_f_l",
  27813. 0xfb04,
  27814. "fi",
  27815. 0xfb01,
  27816. "f_i",
  27817. 0xfb01,
  27818. "fifteencircle",
  27819. 0x246e,
  27820. "fifteenparen",
  27821. 0x2482,
  27822. "fifteenperiod",
  27823. 0x2496,
  27824. "figuredash",
  27825. 0x2012,
  27826. "filledbox",
  27827. 0x25a0,
  27828. "filledrect",
  27829. 0x25ac,
  27830. "finalkaf",
  27831. 0x05da,
  27832. "finalkafdagesh",
  27833. 0xfb3a,
  27834. "finalkafdageshhebrew",
  27835. 0xfb3a,
  27836. "finalkafhebrew",
  27837. 0x05da,
  27838. "finalmem",
  27839. 0x05dd,
  27840. "finalmemhebrew",
  27841. 0x05dd,
  27842. "finalnun",
  27843. 0x05df,
  27844. "finalnunhebrew",
  27845. 0x05df,
  27846. "finalpe",
  27847. 0x05e3,
  27848. "finalpehebrew",
  27849. 0x05e3,
  27850. "finaltsadi",
  27851. 0x05e5,
  27852. "finaltsadihebrew",
  27853. 0x05e5,
  27854. "firsttonechinese",
  27855. 0x02c9,
  27856. "fisheye",
  27857. 0x25c9,
  27858. "fitacyrillic",
  27859. 0x0473,
  27860. "five",
  27861. 0x0035,
  27862. "fivearabic",
  27863. 0x0665,
  27864. "fivebengali",
  27865. 0x09eb,
  27866. "fivecircle",
  27867. 0x2464,
  27868. "fivecircleinversesansserif",
  27869. 0x278e,
  27870. "fivedeva",
  27871. 0x096b,
  27872. "fiveeighths",
  27873. 0x215d,
  27874. "fivegujarati",
  27875. 0x0aeb,
  27876. "fivegurmukhi",
  27877. 0x0a6b,
  27878. "fivehackarabic",
  27879. 0x0665,
  27880. "fivehangzhou",
  27881. 0x3025,
  27882. "fiveideographicparen",
  27883. 0x3224,
  27884. "fiveinferior",
  27885. 0x2085,
  27886. "fivemonospace",
  27887. 0xff15,
  27888. "fiveoldstyle",
  27889. 0xf735,
  27890. "fiveparen",
  27891. 0x2478,
  27892. "fiveperiod",
  27893. 0x248c,
  27894. "fivepersian",
  27895. 0x06f5,
  27896. "fiveroman",
  27897. 0x2174,
  27898. "fivesuperior",
  27899. 0x2075,
  27900. "fivethai",
  27901. 0x0e55,
  27902. "fl",
  27903. 0xfb02,
  27904. "f_l",
  27905. 0xfb02,
  27906. "florin",
  27907. 0x0192,
  27908. "fmonospace",
  27909. 0xff46,
  27910. "fmsquare",
  27911. 0x3399,
  27912. "fofanthai",
  27913. 0x0e1f,
  27914. "fofathai",
  27915. 0x0e1d,
  27916. "fongmanthai",
  27917. 0x0e4f,
  27918. "forall",
  27919. 0x2200,
  27920. "four",
  27921. 0x0034,
  27922. "fourarabic",
  27923. 0x0664,
  27924. "fourbengali",
  27925. 0x09ea,
  27926. "fourcircle",
  27927. 0x2463,
  27928. "fourcircleinversesansserif",
  27929. 0x278d,
  27930. "fourdeva",
  27931. 0x096a,
  27932. "fourgujarati",
  27933. 0x0aea,
  27934. "fourgurmukhi",
  27935. 0x0a6a,
  27936. "fourhackarabic",
  27937. 0x0664,
  27938. "fourhangzhou",
  27939. 0x3024,
  27940. "fourideographicparen",
  27941. 0x3223,
  27942. "fourinferior",
  27943. 0x2084,
  27944. "fourmonospace",
  27945. 0xff14,
  27946. "fournumeratorbengali",
  27947. 0x09f7,
  27948. "fouroldstyle",
  27949. 0xf734,
  27950. "fourparen",
  27951. 0x2477,
  27952. "fourperiod",
  27953. 0x248b,
  27954. "fourpersian",
  27955. 0x06f4,
  27956. "fourroman",
  27957. 0x2173,
  27958. "foursuperior",
  27959. 0x2074,
  27960. "fourteencircle",
  27961. 0x246d,
  27962. "fourteenparen",
  27963. 0x2481,
  27964. "fourteenperiod",
  27965. 0x2495,
  27966. "fourthai",
  27967. 0x0e54,
  27968. "fourthtonechinese",
  27969. 0x02cb,
  27970. "fparen",
  27971. 0x24a1,
  27972. "fraction",
  27973. 0x2044,
  27974. "franc",
  27975. 0x20a3,
  27976. "g",
  27977. 0x0067,
  27978. "gabengali",
  27979. 0x0997,
  27980. "gacute",
  27981. 0x01f5,
  27982. "gadeva",
  27983. 0x0917,
  27984. "gafarabic",
  27985. 0x06af,
  27986. "gaffinalarabic",
  27987. 0xfb93,
  27988. "gafinitialarabic",
  27989. 0xfb94,
  27990. "gafmedialarabic",
  27991. 0xfb95,
  27992. "gagujarati",
  27993. 0x0a97,
  27994. "gagurmukhi",
  27995. 0x0a17,
  27996. "gahiragana",
  27997. 0x304c,
  27998. "gakatakana",
  27999. 0x30ac,
  28000. "gamma",
  28001. 0x03b3,
  28002. "gammalatinsmall",
  28003. 0x0263,
  28004. "gammasuperior",
  28005. 0x02e0,
  28006. "gangiacoptic",
  28007. 0x03eb,
  28008. "gbopomofo",
  28009. 0x310d,
  28010. "gbreve",
  28011. 0x011f,
  28012. "gcaron",
  28013. 0x01e7,
  28014. "gcedilla",
  28015. 0x0123,
  28016. "gcircle",
  28017. 0x24d6,
  28018. "gcircumflex",
  28019. 0x011d,
  28020. "gcommaaccent",
  28021. 0x0123,
  28022. "gdot",
  28023. 0x0121,
  28024. "gdotaccent",
  28025. 0x0121,
  28026. "gecyrillic",
  28027. 0x0433,
  28028. "gehiragana",
  28029. 0x3052,
  28030. "gekatakana",
  28031. 0x30b2,
  28032. "geometricallyequal",
  28033. 0x2251,
  28034. "gereshaccenthebrew",
  28035. 0x059c,
  28036. "gereshhebrew",
  28037. 0x05f3,
  28038. "gereshmuqdamhebrew",
  28039. 0x059d,
  28040. "germandbls",
  28041. 0x00df,
  28042. "gershayimaccenthebrew",
  28043. 0x059e,
  28044. "gershayimhebrew",
  28045. 0x05f4,
  28046. "getamark",
  28047. 0x3013,
  28048. "ghabengali",
  28049. 0x0998,
  28050. "ghadarmenian",
  28051. 0x0572,
  28052. "ghadeva",
  28053. 0x0918,
  28054. "ghagujarati",
  28055. 0x0a98,
  28056. "ghagurmukhi",
  28057. 0x0a18,
  28058. "ghainarabic",
  28059. 0x063a,
  28060. "ghainfinalarabic",
  28061. 0xfece,
  28062. "ghaininitialarabic",
  28063. 0xfecf,
  28064. "ghainmedialarabic",
  28065. 0xfed0,
  28066. "ghemiddlehookcyrillic",
  28067. 0x0495,
  28068. "ghestrokecyrillic",
  28069. 0x0493,
  28070. "gheupturncyrillic",
  28071. 0x0491,
  28072. "ghhadeva",
  28073. 0x095a,
  28074. "ghhagurmukhi",
  28075. 0x0a5a,
  28076. "ghook",
  28077. 0x0260,
  28078. "ghzsquare",
  28079. 0x3393,
  28080. "gihiragana",
  28081. 0x304e,
  28082. "gikatakana",
  28083. 0x30ae,
  28084. "gimarmenian",
  28085. 0x0563,
  28086. "gimel",
  28087. 0x05d2,
  28088. "gimeldagesh",
  28089. 0xfb32,
  28090. "gimeldageshhebrew",
  28091. 0xfb32,
  28092. "gimelhebrew",
  28093. 0x05d2,
  28094. "gjecyrillic",
  28095. 0x0453,
  28096. "glottalinvertedstroke",
  28097. 0x01be,
  28098. "glottalstop",
  28099. 0x0294,
  28100. "glottalstopinverted",
  28101. 0x0296,
  28102. "glottalstopmod",
  28103. 0x02c0,
  28104. "glottalstopreversed",
  28105. 0x0295,
  28106. "glottalstopreversedmod",
  28107. 0x02c1,
  28108. "glottalstopreversedsuperior",
  28109. 0x02e4,
  28110. "glottalstopstroke",
  28111. 0x02a1,
  28112. "glottalstopstrokereversed",
  28113. 0x02a2,
  28114. "gmacron",
  28115. 0x1e21,
  28116. "gmonospace",
  28117. 0xff47,
  28118. "gohiragana",
  28119. 0x3054,
  28120. "gokatakana",
  28121. 0x30b4,
  28122. "gparen",
  28123. 0x24a2,
  28124. "gpasquare",
  28125. 0x33ac,
  28126. "gradient",
  28127. 0x2207,
  28128. "grave",
  28129. 0x0060,
  28130. "gravebelowcmb",
  28131. 0x0316,
  28132. "gravecmb",
  28133. 0x0300,
  28134. "gravecomb",
  28135. 0x0300,
  28136. "gravedeva",
  28137. 0x0953,
  28138. "gravelowmod",
  28139. 0x02ce,
  28140. "gravemonospace",
  28141. 0xff40,
  28142. "gravetonecmb",
  28143. 0x0340,
  28144. "greater",
  28145. 0x003e,
  28146. "greaterequal",
  28147. 0x2265,
  28148. "greaterequalorless",
  28149. 0x22db,
  28150. "greatermonospace",
  28151. 0xff1e,
  28152. "greaterorequivalent",
  28153. 0x2273,
  28154. "greaterorless",
  28155. 0x2277,
  28156. "greateroverequal",
  28157. 0x2267,
  28158. "greatersmall",
  28159. 0xfe65,
  28160. "gscript",
  28161. 0x0261,
  28162. "gstroke",
  28163. 0x01e5,
  28164. "guhiragana",
  28165. 0x3050,
  28166. "guillemotleft",
  28167. 0x00ab,
  28168. "guillemotright",
  28169. 0x00bb,
  28170. "guilsinglleft",
  28171. 0x2039,
  28172. "guilsinglright",
  28173. 0x203a,
  28174. "gukatakana",
  28175. 0x30b0,
  28176. "guramusquare",
  28177. 0x3318,
  28178. "gysquare",
  28179. 0x33c9,
  28180. "h",
  28181. 0x0068,
  28182. "haabkhasiancyrillic",
  28183. 0x04a9,
  28184. "haaltonearabic",
  28185. 0x06c1,
  28186. "habengali",
  28187. 0x09b9,
  28188. "hadescendercyrillic",
  28189. 0x04b3,
  28190. "hadeva",
  28191. 0x0939,
  28192. "hagujarati",
  28193. 0x0ab9,
  28194. "hagurmukhi",
  28195. 0x0a39,
  28196. "haharabic",
  28197. 0x062d,
  28198. "hahfinalarabic",
  28199. 0xfea2,
  28200. "hahinitialarabic",
  28201. 0xfea3,
  28202. "hahiragana",
  28203. 0x306f,
  28204. "hahmedialarabic",
  28205. 0xfea4,
  28206. "haitusquare",
  28207. 0x332a,
  28208. "hakatakana",
  28209. 0x30cf,
  28210. "hakatakanahalfwidth",
  28211. 0xff8a,
  28212. "halantgurmukhi",
  28213. 0x0a4d,
  28214. "hamzaarabic",
  28215. 0x0621,
  28216. "hamzalowarabic",
  28217. 0x0621,
  28218. "hangulfiller",
  28219. 0x3164,
  28220. "hardsigncyrillic",
  28221. 0x044a,
  28222. "harpoonleftbarbup",
  28223. 0x21bc,
  28224. "harpoonrightbarbup",
  28225. 0x21c0,
  28226. "hasquare",
  28227. 0x33ca,
  28228. "hatafpatah",
  28229. 0x05b2,
  28230. "hatafpatah16",
  28231. 0x05b2,
  28232. "hatafpatah23",
  28233. 0x05b2,
  28234. "hatafpatah2f",
  28235. 0x05b2,
  28236. "hatafpatahhebrew",
  28237. 0x05b2,
  28238. "hatafpatahnarrowhebrew",
  28239. 0x05b2,
  28240. "hatafpatahquarterhebrew",
  28241. 0x05b2,
  28242. "hatafpatahwidehebrew",
  28243. 0x05b2,
  28244. "hatafqamats",
  28245. 0x05b3,
  28246. "hatafqamats1b",
  28247. 0x05b3,
  28248. "hatafqamats28",
  28249. 0x05b3,
  28250. "hatafqamats34",
  28251. 0x05b3,
  28252. "hatafqamatshebrew",
  28253. 0x05b3,
  28254. "hatafqamatsnarrowhebrew",
  28255. 0x05b3,
  28256. "hatafqamatsquarterhebrew",
  28257. 0x05b3,
  28258. "hatafqamatswidehebrew",
  28259. 0x05b3,
  28260. "hatafsegol",
  28261. 0x05b1,
  28262. "hatafsegol17",
  28263. 0x05b1,
  28264. "hatafsegol24",
  28265. 0x05b1,
  28266. "hatafsegol30",
  28267. 0x05b1,
  28268. "hatafsegolhebrew",
  28269. 0x05b1,
  28270. "hatafsegolnarrowhebrew",
  28271. 0x05b1,
  28272. "hatafsegolquarterhebrew",
  28273. 0x05b1,
  28274. "hatafsegolwidehebrew",
  28275. 0x05b1,
  28276. "hbar",
  28277. 0x0127,
  28278. "hbopomofo",
  28279. 0x310f,
  28280. "hbrevebelow",
  28281. 0x1e2b,
  28282. "hcedilla",
  28283. 0x1e29,
  28284. "hcircle",
  28285. 0x24d7,
  28286. "hcircumflex",
  28287. 0x0125,
  28288. "hdieresis",
  28289. 0x1e27,
  28290. "hdotaccent",
  28291. 0x1e23,
  28292. "hdotbelow",
  28293. 0x1e25,
  28294. "he",
  28295. 0x05d4,
  28296. "heart",
  28297. 0x2665,
  28298. "heartsuitblack",
  28299. 0x2665,
  28300. "heartsuitwhite",
  28301. 0x2661,
  28302. "hedagesh",
  28303. 0xfb34,
  28304. "hedageshhebrew",
  28305. 0xfb34,
  28306. "hehaltonearabic",
  28307. 0x06c1,
  28308. "heharabic",
  28309. 0x0647,
  28310. "hehebrew",
  28311. 0x05d4,
  28312. "hehfinalaltonearabic",
  28313. 0xfba7,
  28314. "hehfinalalttwoarabic",
  28315. 0xfeea,
  28316. "hehfinalarabic",
  28317. 0xfeea,
  28318. "hehhamzaabovefinalarabic",
  28319. 0xfba5,
  28320. "hehhamzaaboveisolatedarabic",
  28321. 0xfba4,
  28322. "hehinitialaltonearabic",
  28323. 0xfba8,
  28324. "hehinitialarabic",
  28325. 0xfeeb,
  28326. "hehiragana",
  28327. 0x3078,
  28328. "hehmedialaltonearabic",
  28329. 0xfba9,
  28330. "hehmedialarabic",
  28331. 0xfeec,
  28332. "heiseierasquare",
  28333. 0x337b,
  28334. "hekatakana",
  28335. 0x30d8,
  28336. "hekatakanahalfwidth",
  28337. 0xff8d,
  28338. "hekutaarusquare",
  28339. 0x3336,
  28340. "henghook",
  28341. 0x0267,
  28342. "herutusquare",
  28343. 0x3339,
  28344. "het",
  28345. 0x05d7,
  28346. "hethebrew",
  28347. 0x05d7,
  28348. "hhook",
  28349. 0x0266,
  28350. "hhooksuperior",
  28351. 0x02b1,
  28352. "hieuhacirclekorean",
  28353. 0x327b,
  28354. "hieuhaparenkorean",
  28355. 0x321b,
  28356. "hieuhcirclekorean",
  28357. 0x326d,
  28358. "hieuhkorean",
  28359. 0x314e,
  28360. "hieuhparenkorean",
  28361. 0x320d,
  28362. "hihiragana",
  28363. 0x3072,
  28364. "hikatakana",
  28365. 0x30d2,
  28366. "hikatakanahalfwidth",
  28367. 0xff8b,
  28368. "hiriq",
  28369. 0x05b4,
  28370. "hiriq14",
  28371. 0x05b4,
  28372. "hiriq21",
  28373. 0x05b4,
  28374. "hiriq2d",
  28375. 0x05b4,
  28376. "hiriqhebrew",
  28377. 0x05b4,
  28378. "hiriqnarrowhebrew",
  28379. 0x05b4,
  28380. "hiriqquarterhebrew",
  28381. 0x05b4,
  28382. "hiriqwidehebrew",
  28383. 0x05b4,
  28384. "hlinebelow",
  28385. 0x1e96,
  28386. "hmonospace",
  28387. 0xff48,
  28388. "hoarmenian",
  28389. 0x0570,
  28390. "hohipthai",
  28391. 0x0e2b,
  28392. "hohiragana",
  28393. 0x307b,
  28394. "hokatakana",
  28395. 0x30db,
  28396. "hokatakanahalfwidth",
  28397. 0xff8e,
  28398. "holam",
  28399. 0x05b9,
  28400. "holam19",
  28401. 0x05b9,
  28402. "holam26",
  28403. 0x05b9,
  28404. "holam32",
  28405. 0x05b9,
  28406. "holamhebrew",
  28407. 0x05b9,
  28408. "holamnarrowhebrew",
  28409. 0x05b9,
  28410. "holamquarterhebrew",
  28411. 0x05b9,
  28412. "holamwidehebrew",
  28413. 0x05b9,
  28414. "honokhukthai",
  28415. 0x0e2e,
  28416. "hookabovecomb",
  28417. 0x0309,
  28418. "hookcmb",
  28419. 0x0309,
  28420. "hookpalatalizedbelowcmb",
  28421. 0x0321,
  28422. "hookretroflexbelowcmb",
  28423. 0x0322,
  28424. "hoonsquare",
  28425. 0x3342,
  28426. "horicoptic",
  28427. 0x03e9,
  28428. "horizontalbar",
  28429. 0x2015,
  28430. "horncmb",
  28431. 0x031b,
  28432. "hotsprings",
  28433. 0x2668,
  28434. "house",
  28435. 0x2302,
  28436. "hparen",
  28437. 0x24a3,
  28438. "hsuperior",
  28439. 0x02b0,
  28440. "hturned",
  28441. 0x0265,
  28442. "huhiragana",
  28443. 0x3075,
  28444. "huiitosquare",
  28445. 0x3333,
  28446. "hukatakana",
  28447. 0x30d5,
  28448. "hukatakanahalfwidth",
  28449. 0xff8c,
  28450. "hungarumlaut",
  28451. 0x02dd,
  28452. "hungarumlautcmb",
  28453. 0x030b,
  28454. "hv",
  28455. 0x0195,
  28456. "hyphen",
  28457. 0x002d,
  28458. "hypheninferior",
  28459. 0xf6e5,
  28460. "hyphenmonospace",
  28461. 0xff0d,
  28462. "hyphensmall",
  28463. 0xfe63,
  28464. "hyphensuperior",
  28465. 0xf6e6,
  28466. "hyphentwo",
  28467. 0x2010,
  28468. "i",
  28469. 0x0069,
  28470. "iacute",
  28471. 0x00ed,
  28472. "iacyrillic",
  28473. 0x044f,
  28474. "ibengali",
  28475. 0x0987,
  28476. "ibopomofo",
  28477. 0x3127,
  28478. "ibreve",
  28479. 0x012d,
  28480. "icaron",
  28481. 0x01d0,
  28482. "icircle",
  28483. 0x24d8,
  28484. "icircumflex",
  28485. 0x00ee,
  28486. "icyrillic",
  28487. 0x0456,
  28488. "idblgrave",
  28489. 0x0209,
  28490. "ideographearthcircle",
  28491. 0x328f,
  28492. "ideographfirecircle",
  28493. 0x328b,
  28494. "ideographicallianceparen",
  28495. 0x323f,
  28496. "ideographiccallparen",
  28497. 0x323a,
  28498. "ideographiccentrecircle",
  28499. 0x32a5,
  28500. "ideographicclose",
  28501. 0x3006,
  28502. "ideographiccomma",
  28503. 0x3001,
  28504. "ideographiccommaleft",
  28505. 0xff64,
  28506. "ideographiccongratulationparen",
  28507. 0x3237,
  28508. "ideographiccorrectcircle",
  28509. 0x32a3,
  28510. "ideographicearthparen",
  28511. 0x322f,
  28512. "ideographicenterpriseparen",
  28513. 0x323d,
  28514. "ideographicexcellentcircle",
  28515. 0x329d,
  28516. "ideographicfestivalparen",
  28517. 0x3240,
  28518. "ideographicfinancialcircle",
  28519. 0x3296,
  28520. "ideographicfinancialparen",
  28521. 0x3236,
  28522. "ideographicfireparen",
  28523. 0x322b,
  28524. "ideographichaveparen",
  28525. 0x3232,
  28526. "ideographichighcircle",
  28527. 0x32a4,
  28528. "ideographiciterationmark",
  28529. 0x3005,
  28530. "ideographiclaborcircle",
  28531. 0x3298,
  28532. "ideographiclaborparen",
  28533. 0x3238,
  28534. "ideographicleftcircle",
  28535. 0x32a7,
  28536. "ideographiclowcircle",
  28537. 0x32a6,
  28538. "ideographicmedicinecircle",
  28539. 0x32a9,
  28540. "ideographicmetalparen",
  28541. 0x322e,
  28542. "ideographicmoonparen",
  28543. 0x322a,
  28544. "ideographicnameparen",
  28545. 0x3234,
  28546. "ideographicperiod",
  28547. 0x3002,
  28548. "ideographicprintcircle",
  28549. 0x329e,
  28550. "ideographicreachparen",
  28551. 0x3243,
  28552. "ideographicrepresentparen",
  28553. 0x3239,
  28554. "ideographicresourceparen",
  28555. 0x323e,
  28556. "ideographicrightcircle",
  28557. 0x32a8,
  28558. "ideographicsecretcircle",
  28559. 0x3299,
  28560. "ideographicselfparen",
  28561. 0x3242,
  28562. "ideographicsocietyparen",
  28563. 0x3233,
  28564. "ideographicspace",
  28565. 0x3000,
  28566. "ideographicspecialparen",
  28567. 0x3235,
  28568. "ideographicstockparen",
  28569. 0x3231,
  28570. "ideographicstudyparen",
  28571. 0x323b,
  28572. "ideographicsunparen",
  28573. 0x3230,
  28574. "ideographicsuperviseparen",
  28575. 0x323c,
  28576. "ideographicwaterparen",
  28577. 0x322c,
  28578. "ideographicwoodparen",
  28579. 0x322d,
  28580. "ideographiczero",
  28581. 0x3007,
  28582. "ideographmetalcircle",
  28583. 0x328e,
  28584. "ideographmooncircle",
  28585. 0x328a,
  28586. "ideographnamecircle",
  28587. 0x3294,
  28588. "ideographsuncircle",
  28589. 0x3290,
  28590. "ideographwatercircle",
  28591. 0x328c,
  28592. "ideographwoodcircle",
  28593. 0x328d,
  28594. "ideva",
  28595. 0x0907,
  28596. "idieresis",
  28597. 0x00ef,
  28598. "idieresisacute",
  28599. 0x1e2f,
  28600. "idieresiscyrillic",
  28601. 0x04e5,
  28602. "idotbelow",
  28603. 0x1ecb,
  28604. "iebrevecyrillic",
  28605. 0x04d7,
  28606. "iecyrillic",
  28607. 0x0435,
  28608. "ieungacirclekorean",
  28609. 0x3275,
  28610. "ieungaparenkorean",
  28611. 0x3215,
  28612. "ieungcirclekorean",
  28613. 0x3267,
  28614. "ieungkorean",
  28615. 0x3147,
  28616. "ieungparenkorean",
  28617. 0x3207,
  28618. "igrave",
  28619. 0x00ec,
  28620. "igujarati",
  28621. 0x0a87,
  28622. "igurmukhi",
  28623. 0x0a07,
  28624. "ihiragana",
  28625. 0x3044,
  28626. "ihookabove",
  28627. 0x1ec9,
  28628. "iibengali",
  28629. 0x0988,
  28630. "iicyrillic",
  28631. 0x0438,
  28632. "iideva",
  28633. 0x0908,
  28634. "iigujarati",
  28635. 0x0a88,
  28636. "iigurmukhi",
  28637. 0x0a08,
  28638. "iimatragurmukhi",
  28639. 0x0a40,
  28640. "iinvertedbreve",
  28641. 0x020b,
  28642. "iishortcyrillic",
  28643. 0x0439,
  28644. "iivowelsignbengali",
  28645. 0x09c0,
  28646. "iivowelsigndeva",
  28647. 0x0940,
  28648. "iivowelsigngujarati",
  28649. 0x0ac0,
  28650. "ij",
  28651. 0x0133,
  28652. "ikatakana",
  28653. 0x30a4,
  28654. "ikatakanahalfwidth",
  28655. 0xff72,
  28656. "ikorean",
  28657. 0x3163,
  28658. "ilde",
  28659. 0x02dc,
  28660. "iluyhebrew",
  28661. 0x05ac,
  28662. "imacron",
  28663. 0x012b,
  28664. "imacroncyrillic",
  28665. 0x04e3,
  28666. "imageorapproximatelyequal",
  28667. 0x2253,
  28668. "imatragurmukhi",
  28669. 0x0a3f,
  28670. "imonospace",
  28671. 0xff49,
  28672. "increment",
  28673. 0x2206,
  28674. "infinity",
  28675. 0x221e,
  28676. "iniarmenian",
  28677. 0x056b,
  28678. "integral",
  28679. 0x222b,
  28680. "integralbottom",
  28681. 0x2321,
  28682. "integralbt",
  28683. 0x2321,
  28684. "integralex",
  28685. 0xf8f5,
  28686. "integraltop",
  28687. 0x2320,
  28688. "integraltp",
  28689. 0x2320,
  28690. "intersection",
  28691. 0x2229,
  28692. "intisquare",
  28693. 0x3305,
  28694. "invbullet",
  28695. 0x25d8,
  28696. "invcircle",
  28697. 0x25d9,
  28698. "invsmileface",
  28699. 0x263b,
  28700. "iocyrillic",
  28701. 0x0451,
  28702. "iogonek",
  28703. 0x012f,
  28704. "iota",
  28705. 0x03b9,
  28706. "iotadieresis",
  28707. 0x03ca,
  28708. "iotadieresistonos",
  28709. 0x0390,
  28710. "iotalatin",
  28711. 0x0269,
  28712. "iotatonos",
  28713. 0x03af,
  28714. "iparen",
  28715. 0x24a4,
  28716. "irigurmukhi",
  28717. 0x0a72,
  28718. "ismallhiragana",
  28719. 0x3043,
  28720. "ismallkatakana",
  28721. 0x30a3,
  28722. "ismallkatakanahalfwidth",
  28723. 0xff68,
  28724. "issharbengali",
  28725. 0x09fa,
  28726. "istroke",
  28727. 0x0268,
  28728. "isuperior",
  28729. 0xf6ed,
  28730. "iterationhiragana",
  28731. 0x309d,
  28732. "iterationkatakana",
  28733. 0x30fd,
  28734. "itilde",
  28735. 0x0129,
  28736. "itildebelow",
  28737. 0x1e2d,
  28738. "iubopomofo",
  28739. 0x3129,
  28740. "iucyrillic",
  28741. 0x044e,
  28742. "ivowelsignbengali",
  28743. 0x09bf,
  28744. "ivowelsigndeva",
  28745. 0x093f,
  28746. "ivowelsigngujarati",
  28747. 0x0abf,
  28748. "izhitsacyrillic",
  28749. 0x0475,
  28750. "izhitsadblgravecyrillic",
  28751. 0x0477,
  28752. "j",
  28753. 0x006a,
  28754. "jaarmenian",
  28755. 0x0571,
  28756. "jabengali",
  28757. 0x099c,
  28758. "jadeva",
  28759. 0x091c,
  28760. "jagujarati",
  28761. 0x0a9c,
  28762. "jagurmukhi",
  28763. 0x0a1c,
  28764. "jbopomofo",
  28765. 0x3110,
  28766. "jcaron",
  28767. 0x01f0,
  28768. "jcircle",
  28769. 0x24d9,
  28770. "jcircumflex",
  28771. 0x0135,
  28772. "jcrossedtail",
  28773. 0x029d,
  28774. "jdotlessstroke",
  28775. 0x025f,
  28776. "jecyrillic",
  28777. 0x0458,
  28778. "jeemarabic",
  28779. 0x062c,
  28780. "jeemfinalarabic",
  28781. 0xfe9e,
  28782. "jeeminitialarabic",
  28783. 0xfe9f,
  28784. "jeemmedialarabic",
  28785. 0xfea0,
  28786. "jeharabic",
  28787. 0x0698,
  28788. "jehfinalarabic",
  28789. 0xfb8b,
  28790. "jhabengali",
  28791. 0x099d,
  28792. "jhadeva",
  28793. 0x091d,
  28794. "jhagujarati",
  28795. 0x0a9d,
  28796. "jhagurmukhi",
  28797. 0x0a1d,
  28798. "jheharmenian",
  28799. 0x057b,
  28800. "jis",
  28801. 0x3004,
  28802. "jmonospace",
  28803. 0xff4a,
  28804. "jparen",
  28805. 0x24a5,
  28806. "jsuperior",
  28807. 0x02b2,
  28808. "k",
  28809. 0x006b,
  28810. "kabashkircyrillic",
  28811. 0x04a1,
  28812. "kabengali",
  28813. 0x0995,
  28814. "kacute",
  28815. 0x1e31,
  28816. "kacyrillic",
  28817. 0x043a,
  28818. "kadescendercyrillic",
  28819. 0x049b,
  28820. "kadeva",
  28821. 0x0915,
  28822. "kaf",
  28823. 0x05db,
  28824. "kafarabic",
  28825. 0x0643,
  28826. "kafdagesh",
  28827. 0xfb3b,
  28828. "kafdageshhebrew",
  28829. 0xfb3b,
  28830. "kaffinalarabic",
  28831. 0xfeda,
  28832. "kafhebrew",
  28833. 0x05db,
  28834. "kafinitialarabic",
  28835. 0xfedb,
  28836. "kafmedialarabic",
  28837. 0xfedc,
  28838. "kafrafehebrew",
  28839. 0xfb4d,
  28840. "kagujarati",
  28841. 0x0a95,
  28842. "kagurmukhi",
  28843. 0x0a15,
  28844. "kahiragana",
  28845. 0x304b,
  28846. "kahookcyrillic",
  28847. 0x04c4,
  28848. "kakatakana",
  28849. 0x30ab,
  28850. "kakatakanahalfwidth",
  28851. 0xff76,
  28852. "kappa",
  28853. 0x03ba,
  28854. "kappasymbolgreek",
  28855. 0x03f0,
  28856. "kapyeounmieumkorean",
  28857. 0x3171,
  28858. "kapyeounphieuphkorean",
  28859. 0x3184,
  28860. "kapyeounpieupkorean",
  28861. 0x3178,
  28862. "kapyeounssangpieupkorean",
  28863. 0x3179,
  28864. "karoriisquare",
  28865. 0x330d,
  28866. "kashidaautoarabic",
  28867. 0x0640,
  28868. "kashidaautonosidebearingarabic",
  28869. 0x0640,
  28870. "kasmallkatakana",
  28871. 0x30f5,
  28872. "kasquare",
  28873. 0x3384,
  28874. "kasraarabic",
  28875. 0x0650,
  28876. "kasratanarabic",
  28877. 0x064d,
  28878. "kastrokecyrillic",
  28879. 0x049f,
  28880. "katahiraprolongmarkhalfwidth",
  28881. 0xff70,
  28882. "kaverticalstrokecyrillic",
  28883. 0x049d,
  28884. "kbopomofo",
  28885. 0x310e,
  28886. "kcalsquare",
  28887. 0x3389,
  28888. "kcaron",
  28889. 0x01e9,
  28890. "kcedilla",
  28891. 0x0137,
  28892. "kcircle",
  28893. 0x24da,
  28894. "kcommaaccent",
  28895. 0x0137,
  28896. "kdotbelow",
  28897. 0x1e33,
  28898. "keharmenian",
  28899. 0x0584,
  28900. "kehiragana",
  28901. 0x3051,
  28902. "kekatakana",
  28903. 0x30b1,
  28904. "kekatakanahalfwidth",
  28905. 0xff79,
  28906. "kenarmenian",
  28907. 0x056f,
  28908. "kesmallkatakana",
  28909. 0x30f6,
  28910. "kgreenlandic",
  28911. 0x0138,
  28912. "khabengali",
  28913. 0x0996,
  28914. "khacyrillic",
  28915. 0x0445,
  28916. "khadeva",
  28917. 0x0916,
  28918. "khagujarati",
  28919. 0x0a96,
  28920. "khagurmukhi",
  28921. 0x0a16,
  28922. "khaharabic",
  28923. 0x062e,
  28924. "khahfinalarabic",
  28925. 0xfea6,
  28926. "khahinitialarabic",
  28927. 0xfea7,
  28928. "khahmedialarabic",
  28929. 0xfea8,
  28930. "kheicoptic",
  28931. 0x03e7,
  28932. "khhadeva",
  28933. 0x0959,
  28934. "khhagurmukhi",
  28935. 0x0a59,
  28936. "khieukhacirclekorean",
  28937. 0x3278,
  28938. "khieukhaparenkorean",
  28939. 0x3218,
  28940. "khieukhcirclekorean",
  28941. 0x326a,
  28942. "khieukhkorean",
  28943. 0x314b,
  28944. "khieukhparenkorean",
  28945. 0x320a,
  28946. "khokhaithai",
  28947. 0x0e02,
  28948. "khokhonthai",
  28949. 0x0e05,
  28950. "khokhuatthai",
  28951. 0x0e03,
  28952. "khokhwaithai",
  28953. 0x0e04,
  28954. "khomutthai",
  28955. 0x0e5b,
  28956. "khook",
  28957. 0x0199,
  28958. "khorakhangthai",
  28959. 0x0e06,
  28960. "khzsquare",
  28961. 0x3391,
  28962. "kihiragana",
  28963. 0x304d,
  28964. "kikatakana",
  28965. 0x30ad,
  28966. "kikatakanahalfwidth",
  28967. 0xff77,
  28968. "kiroguramusquare",
  28969. 0x3315,
  28970. "kiromeetorusquare",
  28971. 0x3316,
  28972. "kirosquare",
  28973. 0x3314,
  28974. "kiyeokacirclekorean",
  28975. 0x326e,
  28976. "kiyeokaparenkorean",
  28977. 0x320e,
  28978. "kiyeokcirclekorean",
  28979. 0x3260,
  28980. "kiyeokkorean",
  28981. 0x3131,
  28982. "kiyeokparenkorean",
  28983. 0x3200,
  28984. "kiyeoksioskorean",
  28985. 0x3133,
  28986. "kjecyrillic",
  28987. 0x045c,
  28988. "klinebelow",
  28989. 0x1e35,
  28990. "klsquare",
  28991. 0x3398,
  28992. "kmcubedsquare",
  28993. 0x33a6,
  28994. "kmonospace",
  28995. 0xff4b,
  28996. "kmsquaredsquare",
  28997. 0x33a2,
  28998. "kohiragana",
  28999. 0x3053,
  29000. "kohmsquare",
  29001. 0x33c0,
  29002. "kokaithai",
  29003. 0x0e01,
  29004. "kokatakana",
  29005. 0x30b3,
  29006. "kokatakanahalfwidth",
  29007. 0xff7a,
  29008. "kooposquare",
  29009. 0x331e,
  29010. "koppacyrillic",
  29011. 0x0481,
  29012. "koreanstandardsymbol",
  29013. 0x327f,
  29014. "koroniscmb",
  29015. 0x0343,
  29016. "kparen",
  29017. 0x24a6,
  29018. "kpasquare",
  29019. 0x33aa,
  29020. "ksicyrillic",
  29021. 0x046f,
  29022. "ktsquare",
  29023. 0x33cf,
  29024. "kturned",
  29025. 0x029e,
  29026. "kuhiragana",
  29027. 0x304f,
  29028. "kukatakana",
  29029. 0x30af,
  29030. "kukatakanahalfwidth",
  29031. 0xff78,
  29032. "kvsquare",
  29033. 0x33b8,
  29034. "kwsquare",
  29035. 0x33be,
  29036. "l",
  29037. 0x006c,
  29038. "labengali",
  29039. 0x09b2,
  29040. "lacute",
  29041. 0x013a,
  29042. "ladeva",
  29043. 0x0932,
  29044. "lagujarati",
  29045. 0x0ab2,
  29046. "lagurmukhi",
  29047. 0x0a32,
  29048. "lakkhangyaothai",
  29049. 0x0e45,
  29050. "lamaleffinalarabic",
  29051. 0xfefc,
  29052. "lamalefhamzaabovefinalarabic",
  29053. 0xfef8,
  29054. "lamalefhamzaaboveisolatedarabic",
  29055. 0xfef7,
  29056. "lamalefhamzabelowfinalarabic",
  29057. 0xfefa,
  29058. "lamalefhamzabelowisolatedarabic",
  29059. 0xfef9,
  29060. "lamalefisolatedarabic",
  29061. 0xfefb,
  29062. "lamalefmaddaabovefinalarabic",
  29063. 0xfef6,
  29064. "lamalefmaddaaboveisolatedarabic",
  29065. 0xfef5,
  29066. "lamarabic",
  29067. 0x0644,
  29068. "lambda",
  29069. 0x03bb,
  29070. "lambdastroke",
  29071. 0x019b,
  29072. "lamed",
  29073. 0x05dc,
  29074. "lameddagesh",
  29075. 0xfb3c,
  29076. "lameddageshhebrew",
  29077. 0xfb3c,
  29078. "lamedhebrew",
  29079. 0x05dc,
  29080. "lamfinalarabic",
  29081. 0xfede,
  29082. "lamhahinitialarabic",
  29083. 0xfcca,
  29084. "laminitialarabic",
  29085. 0xfedf,
  29086. "lamjeeminitialarabic",
  29087. 0xfcc9,
  29088. "lamkhahinitialarabic",
  29089. 0xfccb,
  29090. "lamlamhehisolatedarabic",
  29091. 0xfdf2,
  29092. "lammedialarabic",
  29093. 0xfee0,
  29094. "lammeemhahinitialarabic",
  29095. 0xfd88,
  29096. "lammeeminitialarabic",
  29097. 0xfccc,
  29098. "largecircle",
  29099. 0x25ef,
  29100. "lbar",
  29101. 0x019a,
  29102. "lbelt",
  29103. 0x026c,
  29104. "lbopomofo",
  29105. 0x310c,
  29106. "lcaron",
  29107. 0x013e,
  29108. "lcedilla",
  29109. 0x013c,
  29110. "lcircle",
  29111. 0x24db,
  29112. "lcircumflexbelow",
  29113. 0x1e3d,
  29114. "lcommaaccent",
  29115. 0x013c,
  29116. "ldot",
  29117. 0x0140,
  29118. "ldotaccent",
  29119. 0x0140,
  29120. "ldotbelow",
  29121. 0x1e37,
  29122. "ldotbelowmacron",
  29123. 0x1e39,
  29124. "leftangleabovecmb",
  29125. 0x031a,
  29126. "lefttackbelowcmb",
  29127. 0x0318,
  29128. "less",
  29129. 0x003c,
  29130. "lessequal",
  29131. 0x2264,
  29132. "lessequalorgreater",
  29133. 0x22da,
  29134. "lessmonospace",
  29135. 0xff1c,
  29136. "lessorequivalent",
  29137. 0x2272,
  29138. "lessorgreater",
  29139. 0x2276,
  29140. "lessoverequal",
  29141. 0x2266,
  29142. "lesssmall",
  29143. 0xfe64,
  29144. "lezh",
  29145. 0x026e,
  29146. "lfblock",
  29147. 0x258c,
  29148. "lhookretroflex",
  29149. 0x026d,
  29150. "lira",
  29151. 0x20a4,
  29152. "liwnarmenian",
  29153. 0x056c,
  29154. "lj",
  29155. 0x01c9,
  29156. "ljecyrillic",
  29157. 0x0459,
  29158. "ll",
  29159. 0xf6c0,
  29160. "lladeva",
  29161. 0x0933,
  29162. "llagujarati",
  29163. 0x0ab3,
  29164. "llinebelow",
  29165. 0x1e3b,
  29166. "llladeva",
  29167. 0x0934,
  29168. "llvocalicbengali",
  29169. 0x09e1,
  29170. "llvocalicdeva",
  29171. 0x0961,
  29172. "llvocalicvowelsignbengali",
  29173. 0x09e3,
  29174. "llvocalicvowelsigndeva",
  29175. 0x0963,
  29176. "lmiddletilde",
  29177. 0x026b,
  29178. "lmonospace",
  29179. 0xff4c,
  29180. "lmsquare",
  29181. 0x33d0,
  29182. "lochulathai",
  29183. 0x0e2c,
  29184. "logicaland",
  29185. 0x2227,
  29186. "logicalnot",
  29187. 0x00ac,
  29188. "logicalnotreversed",
  29189. 0x2310,
  29190. "logicalor",
  29191. 0x2228,
  29192. "lolingthai",
  29193. 0x0e25,
  29194. "longs",
  29195. 0x017f,
  29196. "lowlinecenterline",
  29197. 0xfe4e,
  29198. "lowlinecmb",
  29199. 0x0332,
  29200. "lowlinedashed",
  29201. 0xfe4d,
  29202. "lozenge",
  29203. 0x25ca,
  29204. "lparen",
  29205. 0x24a7,
  29206. "lslash",
  29207. 0x0142,
  29208. "lsquare",
  29209. 0x2113,
  29210. "lsuperior",
  29211. 0xf6ee,
  29212. "ltshade",
  29213. 0x2591,
  29214. "luthai",
  29215. 0x0e26,
  29216. "lvocalicbengali",
  29217. 0x098c,
  29218. "lvocalicdeva",
  29219. 0x090c,
  29220. "lvocalicvowelsignbengali",
  29221. 0x09e2,
  29222. "lvocalicvowelsigndeva",
  29223. 0x0962,
  29224. "lxsquare",
  29225. 0x33d3,
  29226. "m",
  29227. 0x006d,
  29228. "mabengali",
  29229. 0x09ae,
  29230. "macron",
  29231. 0x00af,
  29232. "macronbelowcmb",
  29233. 0x0331,
  29234. "macroncmb",
  29235. 0x0304,
  29236. "macronlowmod",
  29237. 0x02cd,
  29238. "macronmonospace",
  29239. 0xffe3,
  29240. "macute",
  29241. 0x1e3f,
  29242. "madeva",
  29243. 0x092e,
  29244. "magujarati",
  29245. 0x0aae,
  29246. "magurmukhi",
  29247. 0x0a2e,
  29248. "mahapakhhebrew",
  29249. 0x05a4,
  29250. "mahapakhlefthebrew",
  29251. 0x05a4,
  29252. "mahiragana",
  29253. 0x307e,
  29254. "maichattawalowleftthai",
  29255. 0xf895,
  29256. "maichattawalowrightthai",
  29257. 0xf894,
  29258. "maichattawathai",
  29259. 0x0e4b,
  29260. "maichattawaupperleftthai",
  29261. 0xf893,
  29262. "maieklowleftthai",
  29263. 0xf88c,
  29264. "maieklowrightthai",
  29265. 0xf88b,
  29266. "maiekthai",
  29267. 0x0e48,
  29268. "maiekupperleftthai",
  29269. 0xf88a,
  29270. "maihanakatleftthai",
  29271. 0xf884,
  29272. "maihanakatthai",
  29273. 0x0e31,
  29274. "maitaikhuleftthai",
  29275. 0xf889,
  29276. "maitaikhuthai",
  29277. 0x0e47,
  29278. "maitholowleftthai",
  29279. 0xf88f,
  29280. "maitholowrightthai",
  29281. 0xf88e,
  29282. "maithothai",
  29283. 0x0e49,
  29284. "maithoupperleftthai",
  29285. 0xf88d,
  29286. "maitrilowleftthai",
  29287. 0xf892,
  29288. "maitrilowrightthai",
  29289. 0xf891,
  29290. "maitrithai",
  29291. 0x0e4a,
  29292. "maitriupperleftthai",
  29293. 0xf890,
  29294. "maiyamokthai",
  29295. 0x0e46,
  29296. "makatakana",
  29297. 0x30de,
  29298. "makatakanahalfwidth",
  29299. 0xff8f,
  29300. "male",
  29301. 0x2642,
  29302. "mansyonsquare",
  29303. 0x3347,
  29304. "maqafhebrew",
  29305. 0x05be,
  29306. "mars",
  29307. 0x2642,
  29308. "masoracirclehebrew",
  29309. 0x05af,
  29310. "masquare",
  29311. 0x3383,
  29312. "mbopomofo",
  29313. 0x3107,
  29314. "mbsquare",
  29315. 0x33d4,
  29316. "mcircle",
  29317. 0x24dc,
  29318. "mcubedsquare",
  29319. 0x33a5,
  29320. "mdotaccent",
  29321. 0x1e41,
  29322. "mdotbelow",
  29323. 0x1e43,
  29324. "meemarabic",
  29325. 0x0645,
  29326. "meemfinalarabic",
  29327. 0xfee2,
  29328. "meeminitialarabic",
  29329. 0xfee3,
  29330. "meemmedialarabic",
  29331. 0xfee4,
  29332. "meemmeeminitialarabic",
  29333. 0xfcd1,
  29334. "meemmeemisolatedarabic",
  29335. 0xfc48,
  29336. "meetorusquare",
  29337. 0x334d,
  29338. "mehiragana",
  29339. 0x3081,
  29340. "meizierasquare",
  29341. 0x337e,
  29342. "mekatakana",
  29343. 0x30e1,
  29344. "mekatakanahalfwidth",
  29345. 0xff92,
  29346. "mem",
  29347. 0x05de,
  29348. "memdagesh",
  29349. 0xfb3e,
  29350. "memdageshhebrew",
  29351. 0xfb3e,
  29352. "memhebrew",
  29353. 0x05de,
  29354. "menarmenian",
  29355. 0x0574,
  29356. "merkhahebrew",
  29357. 0x05a5,
  29358. "merkhakefulahebrew",
  29359. 0x05a6,
  29360. "merkhakefulalefthebrew",
  29361. 0x05a6,
  29362. "merkhalefthebrew",
  29363. 0x05a5,
  29364. "mhook",
  29365. 0x0271,
  29366. "mhzsquare",
  29367. 0x3392,
  29368. "middledotkatakanahalfwidth",
  29369. 0xff65,
  29370. "middot",
  29371. 0x00b7,
  29372. "mieumacirclekorean",
  29373. 0x3272,
  29374. "mieumaparenkorean",
  29375. 0x3212,
  29376. "mieumcirclekorean",
  29377. 0x3264,
  29378. "mieumkorean",
  29379. 0x3141,
  29380. "mieumpansioskorean",
  29381. 0x3170,
  29382. "mieumparenkorean",
  29383. 0x3204,
  29384. "mieumpieupkorean",
  29385. 0x316e,
  29386. "mieumsioskorean",
  29387. 0x316f,
  29388. "mihiragana",
  29389. 0x307f,
  29390. "mikatakana",
  29391. 0x30df,
  29392. "mikatakanahalfwidth",
  29393. 0xff90,
  29394. "minus",
  29395. 0x2212,
  29396. "minusbelowcmb",
  29397. 0x0320,
  29398. "minuscircle",
  29399. 0x2296,
  29400. "minusmod",
  29401. 0x02d7,
  29402. "minusplus",
  29403. 0x2213,
  29404. "minute",
  29405. 0x2032,
  29406. "miribaarusquare",
  29407. 0x334a,
  29408. "mirisquare",
  29409. 0x3349,
  29410. "mlonglegturned",
  29411. 0x0270,
  29412. "mlsquare",
  29413. 0x3396,
  29414. "mmcubedsquare",
  29415. 0x33a3,
  29416. "mmonospace",
  29417. 0xff4d,
  29418. "mmsquaredsquare",
  29419. 0x339f,
  29420. "mohiragana",
  29421. 0x3082,
  29422. "mohmsquare",
  29423. 0x33c1,
  29424. "mokatakana",
  29425. 0x30e2,
  29426. "mokatakanahalfwidth",
  29427. 0xff93,
  29428. "molsquare",
  29429. 0x33d6,
  29430. "momathai",
  29431. 0x0e21,
  29432. "moverssquare",
  29433. 0x33a7,
  29434. "moverssquaredsquare",
  29435. 0x33a8,
  29436. "mparen",
  29437. 0x24a8,
  29438. "mpasquare",
  29439. 0x33ab,
  29440. "mssquare",
  29441. 0x33b3,
  29442. "msuperior",
  29443. 0xf6ef,
  29444. "mturned",
  29445. 0x026f,
  29446. "mu",
  29447. 0x00b5,
  29448. "mu1",
  29449. 0x00b5,
  29450. "muasquare",
  29451. 0x3382,
  29452. "muchgreater",
  29453. 0x226b,
  29454. "muchless",
  29455. 0x226a,
  29456. "mufsquare",
  29457. 0x338c,
  29458. "mugreek",
  29459. 0x03bc,
  29460. "mugsquare",
  29461. 0x338d,
  29462. "muhiragana",
  29463. 0x3080,
  29464. "mukatakana",
  29465. 0x30e0,
  29466. "mukatakanahalfwidth",
  29467. 0xff91,
  29468. "mulsquare",
  29469. 0x3395,
  29470. "multiply",
  29471. 0x00d7,
  29472. "mumsquare",
  29473. 0x339b,
  29474. "munahhebrew",
  29475. 0x05a3,
  29476. "munahlefthebrew",
  29477. 0x05a3,
  29478. "musicalnote",
  29479. 0x266a,
  29480. "musicalnotedbl",
  29481. 0x266b,
  29482. "musicflatsign",
  29483. 0x266d,
  29484. "musicsharpsign",
  29485. 0x266f,
  29486. "mussquare",
  29487. 0x33b2,
  29488. "muvsquare",
  29489. 0x33b6,
  29490. "muwsquare",
  29491. 0x33bc,
  29492. "mvmegasquare",
  29493. 0x33b9,
  29494. "mvsquare",
  29495. 0x33b7,
  29496. "mwmegasquare",
  29497. 0x33bf,
  29498. "mwsquare",
  29499. 0x33bd,
  29500. "n",
  29501. 0x006e,
  29502. "nabengali",
  29503. 0x09a8,
  29504. "nabla",
  29505. 0x2207,
  29506. "nacute",
  29507. 0x0144,
  29508. "nadeva",
  29509. 0x0928,
  29510. "nagujarati",
  29511. 0x0aa8,
  29512. "nagurmukhi",
  29513. 0x0a28,
  29514. "nahiragana",
  29515. 0x306a,
  29516. "nakatakana",
  29517. 0x30ca,
  29518. "nakatakanahalfwidth",
  29519. 0xff85,
  29520. "napostrophe",
  29521. 0x0149,
  29522. "nasquare",
  29523. 0x3381,
  29524. "nbopomofo",
  29525. 0x310b,
  29526. "nbspace",
  29527. 0x00a0,
  29528. "ncaron",
  29529. 0x0148,
  29530. "ncedilla",
  29531. 0x0146,
  29532. "ncircle",
  29533. 0x24dd,
  29534. "ncircumflexbelow",
  29535. 0x1e4b,
  29536. "ncommaaccent",
  29537. 0x0146,
  29538. "ndotaccent",
  29539. 0x1e45,
  29540. "ndotbelow",
  29541. 0x1e47,
  29542. "nehiragana",
  29543. 0x306d,
  29544. "nekatakana",
  29545. 0x30cd,
  29546. "nekatakanahalfwidth",
  29547. 0xff88,
  29548. "newsheqelsign",
  29549. 0x20aa,
  29550. "nfsquare",
  29551. 0x338b,
  29552. "ngabengali",
  29553. 0x0999,
  29554. "ngadeva",
  29555. 0x0919,
  29556. "ngagujarati",
  29557. 0x0a99,
  29558. "ngagurmukhi",
  29559. 0x0a19,
  29560. "ngonguthai",
  29561. 0x0e07,
  29562. "nhiragana",
  29563. 0x3093,
  29564. "nhookleft",
  29565. 0x0272,
  29566. "nhookretroflex",
  29567. 0x0273,
  29568. "nieunacirclekorean",
  29569. 0x326f,
  29570. "nieunaparenkorean",
  29571. 0x320f,
  29572. "nieuncieuckorean",
  29573. 0x3135,
  29574. "nieuncirclekorean",
  29575. 0x3261,
  29576. "nieunhieuhkorean",
  29577. 0x3136,
  29578. "nieunkorean",
  29579. 0x3134,
  29580. "nieunpansioskorean",
  29581. 0x3168,
  29582. "nieunparenkorean",
  29583. 0x3201,
  29584. "nieunsioskorean",
  29585. 0x3167,
  29586. "nieuntikeutkorean",
  29587. 0x3166,
  29588. "nihiragana",
  29589. 0x306b,
  29590. "nikatakana",
  29591. 0x30cb,
  29592. "nikatakanahalfwidth",
  29593. 0xff86,
  29594. "nikhahitleftthai",
  29595. 0xf899,
  29596. "nikhahitthai",
  29597. 0x0e4d,
  29598. "nine",
  29599. 0x0039,
  29600. "ninearabic",
  29601. 0x0669,
  29602. "ninebengali",
  29603. 0x09ef,
  29604. "ninecircle",
  29605. 0x2468,
  29606. "ninecircleinversesansserif",
  29607. 0x2792,
  29608. "ninedeva",
  29609. 0x096f,
  29610. "ninegujarati",
  29611. 0x0aef,
  29612. "ninegurmukhi",
  29613. 0x0a6f,
  29614. "ninehackarabic",
  29615. 0x0669,
  29616. "ninehangzhou",
  29617. 0x3029,
  29618. "nineideographicparen",
  29619. 0x3228,
  29620. "nineinferior",
  29621. 0x2089,
  29622. "ninemonospace",
  29623. 0xff19,
  29624. "nineoldstyle",
  29625. 0xf739,
  29626. "nineparen",
  29627. 0x247c,
  29628. "nineperiod",
  29629. 0x2490,
  29630. "ninepersian",
  29631. 0x06f9,
  29632. "nineroman",
  29633. 0x2178,
  29634. "ninesuperior",
  29635. 0x2079,
  29636. "nineteencircle",
  29637. 0x2472,
  29638. "nineteenparen",
  29639. 0x2486,
  29640. "nineteenperiod",
  29641. 0x249a,
  29642. "ninethai",
  29643. 0x0e59,
  29644. "nj",
  29645. 0x01cc,
  29646. "njecyrillic",
  29647. 0x045a,
  29648. "nkatakana",
  29649. 0x30f3,
  29650. "nkatakanahalfwidth",
  29651. 0xff9d,
  29652. "nlegrightlong",
  29653. 0x019e,
  29654. "nlinebelow",
  29655. 0x1e49,
  29656. "nmonospace",
  29657. 0xff4e,
  29658. "nmsquare",
  29659. 0x339a,
  29660. "nnabengali",
  29661. 0x09a3,
  29662. "nnadeva",
  29663. 0x0923,
  29664. "nnagujarati",
  29665. 0x0aa3,
  29666. "nnagurmukhi",
  29667. 0x0a23,
  29668. "nnnadeva",
  29669. 0x0929,
  29670. "nohiragana",
  29671. 0x306e,
  29672. "nokatakana",
  29673. 0x30ce,
  29674. "nokatakanahalfwidth",
  29675. 0xff89,
  29676. "nonbreakingspace",
  29677. 0x00a0,
  29678. "nonenthai",
  29679. 0x0e13,
  29680. "nonuthai",
  29681. 0x0e19,
  29682. "noonarabic",
  29683. 0x0646,
  29684. "noonfinalarabic",
  29685. 0xfee6,
  29686. "noonghunnaarabic",
  29687. 0x06ba,
  29688. "noonghunnafinalarabic",
  29689. 0xfb9f,
  29690. "nooninitialarabic",
  29691. 0xfee7,
  29692. "noonjeeminitialarabic",
  29693. 0xfcd2,
  29694. "noonjeemisolatedarabic",
  29695. 0xfc4b,
  29696. "noonmedialarabic",
  29697. 0xfee8,
  29698. "noonmeeminitialarabic",
  29699. 0xfcd5,
  29700. "noonmeemisolatedarabic",
  29701. 0xfc4e,
  29702. "noonnoonfinalarabic",
  29703. 0xfc8d,
  29704. "notcontains",
  29705. 0x220c,
  29706. "notelement",
  29707. 0x2209,
  29708. "notelementof",
  29709. 0x2209,
  29710. "notequal",
  29711. 0x2260,
  29712. "notgreater",
  29713. 0x226f,
  29714. "notgreaternorequal",
  29715. 0x2271,
  29716. "notgreaternorless",
  29717. 0x2279,
  29718. "notidentical",
  29719. 0x2262,
  29720. "notless",
  29721. 0x226e,
  29722. "notlessnorequal",
  29723. 0x2270,
  29724. "notparallel",
  29725. 0x2226,
  29726. "notprecedes",
  29727. 0x2280,
  29728. "notsubset",
  29729. 0x2284,
  29730. "notsucceeds",
  29731. 0x2281,
  29732. "notsuperset",
  29733. 0x2285,
  29734. "nowarmenian",
  29735. 0x0576,
  29736. "nparen",
  29737. 0x24a9,
  29738. "nssquare",
  29739. 0x33b1,
  29740. "nsuperior",
  29741. 0x207f,
  29742. "ntilde",
  29743. 0x00f1,
  29744. "nu",
  29745. 0x03bd,
  29746. "nuhiragana",
  29747. 0x306c,
  29748. "nukatakana",
  29749. 0x30cc,
  29750. "nukatakanahalfwidth",
  29751. 0xff87,
  29752. "nuktabengali",
  29753. 0x09bc,
  29754. "nuktadeva",
  29755. 0x093c,
  29756. "nuktagujarati",
  29757. 0x0abc,
  29758. "nuktagurmukhi",
  29759. 0x0a3c,
  29760. "numbersign",
  29761. 0x0023,
  29762. "numbersignmonospace",
  29763. 0xff03,
  29764. "numbersignsmall",
  29765. 0xfe5f,
  29766. "numeralsigngreek",
  29767. 0x0374,
  29768. "numeralsignlowergreek",
  29769. 0x0375,
  29770. "numero",
  29771. 0x2116,
  29772. "nun",
  29773. 0x05e0,
  29774. "nundagesh",
  29775. 0xfb40,
  29776. "nundageshhebrew",
  29777. 0xfb40,
  29778. "nunhebrew",
  29779. 0x05e0,
  29780. "nvsquare",
  29781. 0x33b5,
  29782. "nwsquare",
  29783. 0x33bb,
  29784. "nyabengali",
  29785. 0x099e,
  29786. "nyadeva",
  29787. 0x091e,
  29788. "nyagujarati",
  29789. 0x0a9e,
  29790. "nyagurmukhi",
  29791. 0x0a1e,
  29792. "o",
  29793. 0x006f,
  29794. "oacute",
  29795. 0x00f3,
  29796. "oangthai",
  29797. 0x0e2d,
  29798. "obarred",
  29799. 0x0275,
  29800. "obarredcyrillic",
  29801. 0x04e9,
  29802. "obarreddieresiscyrillic",
  29803. 0x04eb,
  29804. "obengali",
  29805. 0x0993,
  29806. "obopomofo",
  29807. 0x311b,
  29808. "obreve",
  29809. 0x014f,
  29810. "ocandradeva",
  29811. 0x0911,
  29812. "ocandragujarati",
  29813. 0x0a91,
  29814. "ocandravowelsigndeva",
  29815. 0x0949,
  29816. "ocandravowelsigngujarati",
  29817. 0x0ac9,
  29818. "ocaron",
  29819. 0x01d2,
  29820. "ocircle",
  29821. 0x24de,
  29822. "ocircumflex",
  29823. 0x00f4,
  29824. "ocircumflexacute",
  29825. 0x1ed1,
  29826. "ocircumflexdotbelow",
  29827. 0x1ed9,
  29828. "ocircumflexgrave",
  29829. 0x1ed3,
  29830. "ocircumflexhookabove",
  29831. 0x1ed5,
  29832. "ocircumflextilde",
  29833. 0x1ed7,
  29834. "ocyrillic",
  29835. 0x043e,
  29836. "odblacute",
  29837. 0x0151,
  29838. "odblgrave",
  29839. 0x020d,
  29840. "odeva",
  29841. 0x0913,
  29842. "odieresis",
  29843. 0x00f6,
  29844. "odieresiscyrillic",
  29845. 0x04e7,
  29846. "odotbelow",
  29847. 0x1ecd,
  29848. "oe",
  29849. 0x0153,
  29850. "oekorean",
  29851. 0x315a,
  29852. "ogonek",
  29853. 0x02db,
  29854. "ogonekcmb",
  29855. 0x0328,
  29856. "ograve",
  29857. 0x00f2,
  29858. "ogujarati",
  29859. 0x0a93,
  29860. "oharmenian",
  29861. 0x0585,
  29862. "ohiragana",
  29863. 0x304a,
  29864. "ohookabove",
  29865. 0x1ecf,
  29866. "ohorn",
  29867. 0x01a1,
  29868. "ohornacute",
  29869. 0x1edb,
  29870. "ohorndotbelow",
  29871. 0x1ee3,
  29872. "ohorngrave",
  29873. 0x1edd,
  29874. "ohornhookabove",
  29875. 0x1edf,
  29876. "ohorntilde",
  29877. 0x1ee1,
  29878. "ohungarumlaut",
  29879. 0x0151,
  29880. "oi",
  29881. 0x01a3,
  29882. "oinvertedbreve",
  29883. 0x020f,
  29884. "okatakana",
  29885. 0x30aa,
  29886. "okatakanahalfwidth",
  29887. 0xff75,
  29888. "okorean",
  29889. 0x3157,
  29890. "olehebrew",
  29891. 0x05ab,
  29892. "omacron",
  29893. 0x014d,
  29894. "omacronacute",
  29895. 0x1e53,
  29896. "omacrongrave",
  29897. 0x1e51,
  29898. "omdeva",
  29899. 0x0950,
  29900. "omega",
  29901. 0x03c9,
  29902. "omega1",
  29903. 0x03d6,
  29904. "omegacyrillic",
  29905. 0x0461,
  29906. "omegalatinclosed",
  29907. 0x0277,
  29908. "omegaroundcyrillic",
  29909. 0x047b,
  29910. "omegatitlocyrillic",
  29911. 0x047d,
  29912. "omegatonos",
  29913. 0x03ce,
  29914. "omgujarati",
  29915. 0x0ad0,
  29916. "omicron",
  29917. 0x03bf,
  29918. "omicrontonos",
  29919. 0x03cc,
  29920. "omonospace",
  29921. 0xff4f,
  29922. "one",
  29923. 0x0031,
  29924. "onearabic",
  29925. 0x0661,
  29926. "onebengali",
  29927. 0x09e7,
  29928. "onecircle",
  29929. 0x2460,
  29930. "onecircleinversesansserif",
  29931. 0x278a,
  29932. "onedeva",
  29933. 0x0967,
  29934. "onedotenleader",
  29935. 0x2024,
  29936. "oneeighth",
  29937. 0x215b,
  29938. "onefitted",
  29939. 0xf6dc,
  29940. "onegujarati",
  29941. 0x0ae7,
  29942. "onegurmukhi",
  29943. 0x0a67,
  29944. "onehackarabic",
  29945. 0x0661,
  29946. "onehalf",
  29947. 0x00bd,
  29948. "onehangzhou",
  29949. 0x3021,
  29950. "oneideographicparen",
  29951. 0x3220,
  29952. "oneinferior",
  29953. 0x2081,
  29954. "onemonospace",
  29955. 0xff11,
  29956. "onenumeratorbengali",
  29957. 0x09f4,
  29958. "oneoldstyle",
  29959. 0xf731,
  29960. "oneparen",
  29961. 0x2474,
  29962. "oneperiod",
  29963. 0x2488,
  29964. "onepersian",
  29965. 0x06f1,
  29966. "onequarter",
  29967. 0x00bc,
  29968. "oneroman",
  29969. 0x2170,
  29970. "onesuperior",
  29971. 0x00b9,
  29972. "onethai",
  29973. 0x0e51,
  29974. "onethird",
  29975. 0x2153,
  29976. "oogonek",
  29977. 0x01eb,
  29978. "oogonekmacron",
  29979. 0x01ed,
  29980. "oogurmukhi",
  29981. 0x0a13,
  29982. "oomatragurmukhi",
  29983. 0x0a4b,
  29984. "oopen",
  29985. 0x0254,
  29986. "oparen",
  29987. 0x24aa,
  29988. "openbullet",
  29989. 0x25e6,
  29990. "option",
  29991. 0x2325,
  29992. "ordfeminine",
  29993. 0x00aa,
  29994. "ordmasculine",
  29995. 0x00ba,
  29996. "orthogonal",
  29997. 0x221f,
  29998. "oshortdeva",
  29999. 0x0912,
  30000. "oshortvowelsigndeva",
  30001. 0x094a,
  30002. "oslash",
  30003. 0x00f8,
  30004. "oslashacute",
  30005. 0x01ff,
  30006. "osmallhiragana",
  30007. 0x3049,
  30008. "osmallkatakana",
  30009. 0x30a9,
  30010. "osmallkatakanahalfwidth",
  30011. 0xff6b,
  30012. "ostrokeacute",
  30013. 0x01ff,
  30014. "osuperior",
  30015. 0xf6f0,
  30016. "otcyrillic",
  30017. 0x047f,
  30018. "otilde",
  30019. 0x00f5,
  30020. "otildeacute",
  30021. 0x1e4d,
  30022. "otildedieresis",
  30023. 0x1e4f,
  30024. "oubopomofo",
  30025. 0x3121,
  30026. "overline",
  30027. 0x203e,
  30028. "overlinecenterline",
  30029. 0xfe4a,
  30030. "overlinecmb",
  30031. 0x0305,
  30032. "overlinedashed",
  30033. 0xfe49,
  30034. "overlinedblwavy",
  30035. 0xfe4c,
  30036. "overlinewavy",
  30037. 0xfe4b,
  30038. "overscore",
  30039. 0x00af,
  30040. "ovowelsignbengali",
  30041. 0x09cb,
  30042. "ovowelsigndeva",
  30043. 0x094b,
  30044. "ovowelsigngujarati",
  30045. 0x0acb,
  30046. "p",
  30047. 0x0070,
  30048. "paampssquare",
  30049. 0x3380,
  30050. "paasentosquare",
  30051. 0x332b,
  30052. "pabengali",
  30053. 0x09aa,
  30054. "pacute",
  30055. 0x1e55,
  30056. "padeva",
  30057. 0x092a,
  30058. "pagedown",
  30059. 0x21df,
  30060. "pageup",
  30061. 0x21de,
  30062. "pagujarati",
  30063. 0x0aaa,
  30064. "pagurmukhi",
  30065. 0x0a2a,
  30066. "pahiragana",
  30067. 0x3071,
  30068. "paiyannoithai",
  30069. 0x0e2f,
  30070. "pakatakana",
  30071. 0x30d1,
  30072. "palatalizationcyrilliccmb",
  30073. 0x0484,
  30074. "palochkacyrillic",
  30075. 0x04c0,
  30076. "pansioskorean",
  30077. 0x317f,
  30078. "paragraph",
  30079. 0x00b6,
  30080. "parallel",
  30081. 0x2225,
  30082. "parenleft",
  30083. 0x0028,
  30084. "parenleftaltonearabic",
  30085. 0xfd3e,
  30086. "parenleftbt",
  30087. 0xf8ed,
  30088. "parenleftex",
  30089. 0xf8ec,
  30090. "parenleftinferior",
  30091. 0x208d,
  30092. "parenleftmonospace",
  30093. 0xff08,
  30094. "parenleftsmall",
  30095. 0xfe59,
  30096. "parenleftsuperior",
  30097. 0x207d,
  30098. "parenlefttp",
  30099. 0xf8eb,
  30100. "parenleftvertical",
  30101. 0xfe35,
  30102. "parenright",
  30103. 0x0029,
  30104. "parenrightaltonearabic",
  30105. 0xfd3f,
  30106. "parenrightbt",
  30107. 0xf8f8,
  30108. "parenrightex",
  30109. 0xf8f7,
  30110. "parenrightinferior",
  30111. 0x208e,
  30112. "parenrightmonospace",
  30113. 0xff09,
  30114. "parenrightsmall",
  30115. 0xfe5a,
  30116. "parenrightsuperior",
  30117. 0x207e,
  30118. "parenrighttp",
  30119. 0xf8f6,
  30120. "parenrightvertical",
  30121. 0xfe36,
  30122. "partialdiff",
  30123. 0x2202,
  30124. "paseqhebrew",
  30125. 0x05c0,
  30126. "pashtahebrew",
  30127. 0x0599,
  30128. "pasquare",
  30129. 0x33a9,
  30130. "patah",
  30131. 0x05b7,
  30132. "patah11",
  30133. 0x05b7,
  30134. "patah1d",
  30135. 0x05b7,
  30136. "patah2a",
  30137. 0x05b7,
  30138. "patahhebrew",
  30139. 0x05b7,
  30140. "patahnarrowhebrew",
  30141. 0x05b7,
  30142. "patahquarterhebrew",
  30143. 0x05b7,
  30144. "patahwidehebrew",
  30145. 0x05b7,
  30146. "pazerhebrew",
  30147. 0x05a1,
  30148. "pbopomofo",
  30149. 0x3106,
  30150. "pcircle",
  30151. 0x24df,
  30152. "pdotaccent",
  30153. 0x1e57,
  30154. "pe",
  30155. 0x05e4,
  30156. "pecyrillic",
  30157. 0x043f,
  30158. "pedagesh",
  30159. 0xfb44,
  30160. "pedageshhebrew",
  30161. 0xfb44,
  30162. "peezisquare",
  30163. 0x333b,
  30164. "pefinaldageshhebrew",
  30165. 0xfb43,
  30166. "peharabic",
  30167. 0x067e,
  30168. "peharmenian",
  30169. 0x057a,
  30170. "pehebrew",
  30171. 0x05e4,
  30172. "pehfinalarabic",
  30173. 0xfb57,
  30174. "pehinitialarabic",
  30175. 0xfb58,
  30176. "pehiragana",
  30177. 0x307a,
  30178. "pehmedialarabic",
  30179. 0xfb59,
  30180. "pekatakana",
  30181. 0x30da,
  30182. "pemiddlehookcyrillic",
  30183. 0x04a7,
  30184. "perafehebrew",
  30185. 0xfb4e,
  30186. "percent",
  30187. 0x0025,
  30188. "percentarabic",
  30189. 0x066a,
  30190. "percentmonospace",
  30191. 0xff05,
  30192. "percentsmall",
  30193. 0xfe6a,
  30194. "period",
  30195. 0x002e,
  30196. "periodarmenian",
  30197. 0x0589,
  30198. "periodcentered",
  30199. 0x00b7,
  30200. "periodhalfwidth",
  30201. 0xff61,
  30202. "periodinferior",
  30203. 0xf6e7,
  30204. "periodmonospace",
  30205. 0xff0e,
  30206. "periodsmall",
  30207. 0xfe52,
  30208. "periodsuperior",
  30209. 0xf6e8,
  30210. "perispomenigreekcmb",
  30211. 0x0342,
  30212. "perpendicular",
  30213. 0x22a5,
  30214. "perthousand",
  30215. 0x2030,
  30216. "peseta",
  30217. 0x20a7,
  30218. "pfsquare",
  30219. 0x338a,
  30220. "phabengali",
  30221. 0x09ab,
  30222. "phadeva",
  30223. 0x092b,
  30224. "phagujarati",
  30225. 0x0aab,
  30226. "phagurmukhi",
  30227. 0x0a2b,
  30228. "phi",
  30229. 0x03c6,
  30230. "phi1",
  30231. 0x03d5,
  30232. "phieuphacirclekorean",
  30233. 0x327a,
  30234. "phieuphaparenkorean",
  30235. 0x321a,
  30236. "phieuphcirclekorean",
  30237. 0x326c,
  30238. "phieuphkorean",
  30239. 0x314d,
  30240. "phieuphparenkorean",
  30241. 0x320c,
  30242. "philatin",
  30243. 0x0278,
  30244. "phinthuthai",
  30245. 0x0e3a,
  30246. "phisymbolgreek",
  30247. 0x03d5,
  30248. "phook",
  30249. 0x01a5,
  30250. "phophanthai",
  30251. 0x0e1e,
  30252. "phophungthai",
  30253. 0x0e1c,
  30254. "phosamphaothai",
  30255. 0x0e20,
  30256. "pi",
  30257. 0x03c0,
  30258. "pieupacirclekorean",
  30259. 0x3273,
  30260. "pieupaparenkorean",
  30261. 0x3213,
  30262. "pieupcieuckorean",
  30263. 0x3176,
  30264. "pieupcirclekorean",
  30265. 0x3265,
  30266. "pieupkiyeokkorean",
  30267. 0x3172,
  30268. "pieupkorean",
  30269. 0x3142,
  30270. "pieupparenkorean",
  30271. 0x3205,
  30272. "pieupsioskiyeokkorean",
  30273. 0x3174,
  30274. "pieupsioskorean",
  30275. 0x3144,
  30276. "pieupsiostikeutkorean",
  30277. 0x3175,
  30278. "pieupthieuthkorean",
  30279. 0x3177,
  30280. "pieuptikeutkorean",
  30281. 0x3173,
  30282. "pihiragana",
  30283. 0x3074,
  30284. "pikatakana",
  30285. 0x30d4,
  30286. "pisymbolgreek",
  30287. 0x03d6,
  30288. "piwrarmenian",
  30289. 0x0583,
  30290. "plus",
  30291. 0x002b,
  30292. "plusbelowcmb",
  30293. 0x031f,
  30294. "pluscircle",
  30295. 0x2295,
  30296. "plusminus",
  30297. 0x00b1,
  30298. "plusmod",
  30299. 0x02d6,
  30300. "plusmonospace",
  30301. 0xff0b,
  30302. "plussmall",
  30303. 0xfe62,
  30304. "plussuperior",
  30305. 0x207a,
  30306. "pmonospace",
  30307. 0xff50,
  30308. "pmsquare",
  30309. 0x33d8,
  30310. "pohiragana",
  30311. 0x307d,
  30312. "pointingindexdownwhite",
  30313. 0x261f,
  30314. "pointingindexleftwhite",
  30315. 0x261c,
  30316. "pointingindexrightwhite",
  30317. 0x261e,
  30318. "pointingindexupwhite",
  30319. 0x261d,
  30320. "pokatakana",
  30321. 0x30dd,
  30322. "poplathai",
  30323. 0x0e1b,
  30324. "postalmark",
  30325. 0x3012,
  30326. "postalmarkface",
  30327. 0x3020,
  30328. "pparen",
  30329. 0x24ab,
  30330. "precedes",
  30331. 0x227a,
  30332. "prescription",
  30333. 0x211e,
  30334. "primemod",
  30335. 0x02b9,
  30336. "primereversed",
  30337. 0x2035,
  30338. "product",
  30339. 0x220f,
  30340. "projective",
  30341. 0x2305,
  30342. "prolongedkana",
  30343. 0x30fc,
  30344. "propellor",
  30345. 0x2318,
  30346. "propersubset",
  30347. 0x2282,
  30348. "propersuperset",
  30349. 0x2283,
  30350. "proportion",
  30351. 0x2237,
  30352. "proportional",
  30353. 0x221d,
  30354. "psi",
  30355. 0x03c8,
  30356. "psicyrillic",
  30357. 0x0471,
  30358. "psilipneumatacyrilliccmb",
  30359. 0x0486,
  30360. "pssquare",
  30361. 0x33b0,
  30362. "puhiragana",
  30363. 0x3077,
  30364. "pukatakana",
  30365. 0x30d7,
  30366. "pvsquare",
  30367. 0x33b4,
  30368. "pwsquare",
  30369. 0x33ba,
  30370. "q",
  30371. 0x0071,
  30372. "qadeva",
  30373. 0x0958,
  30374. "qadmahebrew",
  30375. 0x05a8,
  30376. "qafarabic",
  30377. 0x0642,
  30378. "qaffinalarabic",
  30379. 0xfed6,
  30380. "qafinitialarabic",
  30381. 0xfed7,
  30382. "qafmedialarabic",
  30383. 0xfed8,
  30384. "qamats",
  30385. 0x05b8,
  30386. "qamats10",
  30387. 0x05b8,
  30388. "qamats1a",
  30389. 0x05b8,
  30390. "qamats1c",
  30391. 0x05b8,
  30392. "qamats27",
  30393. 0x05b8,
  30394. "qamats29",
  30395. 0x05b8,
  30396. "qamats33",
  30397. 0x05b8,
  30398. "qamatsde",
  30399. 0x05b8,
  30400. "qamatshebrew",
  30401. 0x05b8,
  30402. "qamatsnarrowhebrew",
  30403. 0x05b8,
  30404. "qamatsqatanhebrew",
  30405. 0x05b8,
  30406. "qamatsqatannarrowhebrew",
  30407. 0x05b8,
  30408. "qamatsqatanquarterhebrew",
  30409. 0x05b8,
  30410. "qamatsqatanwidehebrew",
  30411. 0x05b8,
  30412. "qamatsquarterhebrew",
  30413. 0x05b8,
  30414. "qamatswidehebrew",
  30415. 0x05b8,
  30416. "qarneyparahebrew",
  30417. 0x059f,
  30418. "qbopomofo",
  30419. 0x3111,
  30420. "qcircle",
  30421. 0x24e0,
  30422. "qhook",
  30423. 0x02a0,
  30424. "qmonospace",
  30425. 0xff51,
  30426. "qof",
  30427. 0x05e7,
  30428. "qofdagesh",
  30429. 0xfb47,
  30430. "qofdageshhebrew",
  30431. 0xfb47,
  30432. "qofhebrew",
  30433. 0x05e7,
  30434. "qparen",
  30435. 0x24ac,
  30436. "quarternote",
  30437. 0x2669,
  30438. "qubuts",
  30439. 0x05bb,
  30440. "qubuts18",
  30441. 0x05bb,
  30442. "qubuts25",
  30443. 0x05bb,
  30444. "qubuts31",
  30445. 0x05bb,
  30446. "qubutshebrew",
  30447. 0x05bb,
  30448. "qubutsnarrowhebrew",
  30449. 0x05bb,
  30450. "qubutsquarterhebrew",
  30451. 0x05bb,
  30452. "qubutswidehebrew",
  30453. 0x05bb,
  30454. "question",
  30455. 0x003f,
  30456. "questionarabic",
  30457. 0x061f,
  30458. "questionarmenian",
  30459. 0x055e,
  30460. "questiondown",
  30461. 0x00bf,
  30462. "questiondownsmall",
  30463. 0xf7bf,
  30464. "questiongreek",
  30465. 0x037e,
  30466. "questionmonospace",
  30467. 0xff1f,
  30468. "questionsmall",
  30469. 0xf73f,
  30470. "quotedbl",
  30471. 0x0022,
  30472. "quotedblbase",
  30473. 0x201e,
  30474. "quotedblleft",
  30475. 0x201c,
  30476. "quotedblmonospace",
  30477. 0xff02,
  30478. "quotedblprime",
  30479. 0x301e,
  30480. "quotedblprimereversed",
  30481. 0x301d,
  30482. "quotedblright",
  30483. 0x201d,
  30484. "quoteleft",
  30485. 0x2018,
  30486. "quoteleftreversed",
  30487. 0x201b,
  30488. "quotereversed",
  30489. 0x201b,
  30490. "quoteright",
  30491. 0x2019,
  30492. "quoterightn",
  30493. 0x0149,
  30494. "quotesinglbase",
  30495. 0x201a,
  30496. "quotesingle",
  30497. 0x0027,
  30498. "quotesinglemonospace",
  30499. 0xff07,
  30500. "r",
  30501. 0x0072,
  30502. "raarmenian",
  30503. 0x057c,
  30504. "rabengali",
  30505. 0x09b0,
  30506. "racute",
  30507. 0x0155,
  30508. "radeva",
  30509. 0x0930,
  30510. "radical",
  30511. 0x221a,
  30512. "radicalex",
  30513. 0xf8e5,
  30514. "radoverssquare",
  30515. 0x33ae,
  30516. "radoverssquaredsquare",
  30517. 0x33af,
  30518. "radsquare",
  30519. 0x33ad,
  30520. "rafe",
  30521. 0x05bf,
  30522. "rafehebrew",
  30523. 0x05bf,
  30524. "ragujarati",
  30525. 0x0ab0,
  30526. "ragurmukhi",
  30527. 0x0a30,
  30528. "rahiragana",
  30529. 0x3089,
  30530. "rakatakana",
  30531. 0x30e9,
  30532. "rakatakanahalfwidth",
  30533. 0xff97,
  30534. "ralowerdiagonalbengali",
  30535. 0x09f1,
  30536. "ramiddlediagonalbengali",
  30537. 0x09f0,
  30538. "ramshorn",
  30539. 0x0264,
  30540. "ratio",
  30541. 0x2236,
  30542. "rbopomofo",
  30543. 0x3116,
  30544. "rcaron",
  30545. 0x0159,
  30546. "rcedilla",
  30547. 0x0157,
  30548. "rcircle",
  30549. 0x24e1,
  30550. "rcommaaccent",
  30551. 0x0157,
  30552. "rdblgrave",
  30553. 0x0211,
  30554. "rdotaccent",
  30555. 0x1e59,
  30556. "rdotbelow",
  30557. 0x1e5b,
  30558. "rdotbelowmacron",
  30559. 0x1e5d,
  30560. "referencemark",
  30561. 0x203b,
  30562. "reflexsubset",
  30563. 0x2286,
  30564. "reflexsuperset",
  30565. 0x2287,
  30566. "registered",
  30567. 0x00ae,
  30568. "registersans",
  30569. 0xf8e8,
  30570. "registerserif",
  30571. 0xf6da,
  30572. "reharabic",
  30573. 0x0631,
  30574. "reharmenian",
  30575. 0x0580,
  30576. "rehfinalarabic",
  30577. 0xfeae,
  30578. "rehiragana",
  30579. 0x308c,
  30580. "rekatakana",
  30581. 0x30ec,
  30582. "rekatakanahalfwidth",
  30583. 0xff9a,
  30584. "resh",
  30585. 0x05e8,
  30586. "reshdageshhebrew",
  30587. 0xfb48,
  30588. "reshhebrew",
  30589. 0x05e8,
  30590. "reversedtilde",
  30591. 0x223d,
  30592. "reviahebrew",
  30593. 0x0597,
  30594. "reviamugrashhebrew",
  30595. 0x0597,
  30596. "revlogicalnot",
  30597. 0x2310,
  30598. "rfishhook",
  30599. 0x027e,
  30600. "rfishhookreversed",
  30601. 0x027f,
  30602. "rhabengali",
  30603. 0x09dd,
  30604. "rhadeva",
  30605. 0x095d,
  30606. "rho",
  30607. 0x03c1,
  30608. "rhook",
  30609. 0x027d,
  30610. "rhookturned",
  30611. 0x027b,
  30612. "rhookturnedsuperior",
  30613. 0x02b5,
  30614. "rhosymbolgreek",
  30615. 0x03f1,
  30616. "rhotichookmod",
  30617. 0x02de,
  30618. "rieulacirclekorean",
  30619. 0x3271,
  30620. "rieulaparenkorean",
  30621. 0x3211,
  30622. "rieulcirclekorean",
  30623. 0x3263,
  30624. "rieulhieuhkorean",
  30625. 0x3140,
  30626. "rieulkiyeokkorean",
  30627. 0x313a,
  30628. "rieulkiyeoksioskorean",
  30629. 0x3169,
  30630. "rieulkorean",
  30631. 0x3139,
  30632. "rieulmieumkorean",
  30633. 0x313b,
  30634. "rieulpansioskorean",
  30635. 0x316c,
  30636. "rieulparenkorean",
  30637. 0x3203,
  30638. "rieulphieuphkorean",
  30639. 0x313f,
  30640. "rieulpieupkorean",
  30641. 0x313c,
  30642. "rieulpieupsioskorean",
  30643. 0x316b,
  30644. "rieulsioskorean",
  30645. 0x313d,
  30646. "rieulthieuthkorean",
  30647. 0x313e,
  30648. "rieultikeutkorean",
  30649. 0x316a,
  30650. "rieulyeorinhieuhkorean",
  30651. 0x316d,
  30652. "rightangle",
  30653. 0x221f,
  30654. "righttackbelowcmb",
  30655. 0x0319,
  30656. "righttriangle",
  30657. 0x22bf,
  30658. "rihiragana",
  30659. 0x308a,
  30660. "rikatakana",
  30661. 0x30ea,
  30662. "rikatakanahalfwidth",
  30663. 0xff98,
  30664. "ring",
  30665. 0x02da,
  30666. "ringbelowcmb",
  30667. 0x0325,
  30668. "ringcmb",
  30669. 0x030a,
  30670. "ringhalfleft",
  30671. 0x02bf,
  30672. "ringhalfleftarmenian",
  30673. 0x0559,
  30674. "ringhalfleftbelowcmb",
  30675. 0x031c,
  30676. "ringhalfleftcentered",
  30677. 0x02d3,
  30678. "ringhalfright",
  30679. 0x02be,
  30680. "ringhalfrightbelowcmb",
  30681. 0x0339,
  30682. "ringhalfrightcentered",
  30683. 0x02d2,
  30684. "rinvertedbreve",
  30685. 0x0213,
  30686. "rittorusquare",
  30687. 0x3351,
  30688. "rlinebelow",
  30689. 0x1e5f,
  30690. "rlongleg",
  30691. 0x027c,
  30692. "rlonglegturned",
  30693. 0x027a,
  30694. "rmonospace",
  30695. 0xff52,
  30696. "rohiragana",
  30697. 0x308d,
  30698. "rokatakana",
  30699. 0x30ed,
  30700. "rokatakanahalfwidth",
  30701. 0xff9b,
  30702. "roruathai",
  30703. 0x0e23,
  30704. "rparen",
  30705. 0x24ad,
  30706. "rrabengali",
  30707. 0x09dc,
  30708. "rradeva",
  30709. 0x0931,
  30710. "rragurmukhi",
  30711. 0x0a5c,
  30712. "rreharabic",
  30713. 0x0691,
  30714. "rrehfinalarabic",
  30715. 0xfb8d,
  30716. "rrvocalicbengali",
  30717. 0x09e0,
  30718. "rrvocalicdeva",
  30719. 0x0960,
  30720. "rrvocalicgujarati",
  30721. 0x0ae0,
  30722. "rrvocalicvowelsignbengali",
  30723. 0x09c4,
  30724. "rrvocalicvowelsigndeva",
  30725. 0x0944,
  30726. "rrvocalicvowelsigngujarati",
  30727. 0x0ac4,
  30728. "rsuperior",
  30729. 0xf6f1,
  30730. "rtblock",
  30731. 0x2590,
  30732. "rturned",
  30733. 0x0279,
  30734. "rturnedsuperior",
  30735. 0x02b4,
  30736. "ruhiragana",
  30737. 0x308b,
  30738. "rukatakana",
  30739. 0x30eb,
  30740. "rukatakanahalfwidth",
  30741. 0xff99,
  30742. "rupeemarkbengali",
  30743. 0x09f2,
  30744. "rupeesignbengali",
  30745. 0x09f3,
  30746. "rupiah",
  30747. 0xf6dd,
  30748. "ruthai",
  30749. 0x0e24,
  30750. "rvocalicbengali",
  30751. 0x098b,
  30752. "rvocalicdeva",
  30753. 0x090b,
  30754. "rvocalicgujarati",
  30755. 0x0a8b,
  30756. "rvocalicvowelsignbengali",
  30757. 0x09c3,
  30758. "rvocalicvowelsigndeva",
  30759. 0x0943,
  30760. "rvocalicvowelsigngujarati",
  30761. 0x0ac3,
  30762. "s",
  30763. 0x0073,
  30764. "sabengali",
  30765. 0x09b8,
  30766. "sacute",
  30767. 0x015b,
  30768. "sacutedotaccent",
  30769. 0x1e65,
  30770. "sadarabic",
  30771. 0x0635,
  30772. "sadeva",
  30773. 0x0938,
  30774. "sadfinalarabic",
  30775. 0xfeba,
  30776. "sadinitialarabic",
  30777. 0xfebb,
  30778. "sadmedialarabic",
  30779. 0xfebc,
  30780. "sagujarati",
  30781. 0x0ab8,
  30782. "sagurmukhi",
  30783. 0x0a38,
  30784. "sahiragana",
  30785. 0x3055,
  30786. "sakatakana",
  30787. 0x30b5,
  30788. "sakatakanahalfwidth",
  30789. 0xff7b,
  30790. "sallallahoualayhewasallamarabic",
  30791. 0xfdfa,
  30792. "samekh",
  30793. 0x05e1,
  30794. "samekhdagesh",
  30795. 0xfb41,
  30796. "samekhdageshhebrew",
  30797. 0xfb41,
  30798. "samekhhebrew",
  30799. 0x05e1,
  30800. "saraaathai",
  30801. 0x0e32,
  30802. "saraaethai",
  30803. 0x0e41,
  30804. "saraaimaimalaithai",
  30805. 0x0e44,
  30806. "saraaimaimuanthai",
  30807. 0x0e43,
  30808. "saraamthai",
  30809. 0x0e33,
  30810. "saraathai",
  30811. 0x0e30,
  30812. "saraethai",
  30813. 0x0e40,
  30814. "saraiileftthai",
  30815. 0xf886,
  30816. "saraiithai",
  30817. 0x0e35,
  30818. "saraileftthai",
  30819. 0xf885,
  30820. "saraithai",
  30821. 0x0e34,
  30822. "saraothai",
  30823. 0x0e42,
  30824. "saraueeleftthai",
  30825. 0xf888,
  30826. "saraueethai",
  30827. 0x0e37,
  30828. "saraueleftthai",
  30829. 0xf887,
  30830. "sarauethai",
  30831. 0x0e36,
  30832. "sarauthai",
  30833. 0x0e38,
  30834. "sarauuthai",
  30835. 0x0e39,
  30836. "sbopomofo",
  30837. 0x3119,
  30838. "scaron",
  30839. 0x0161,
  30840. "scarondotaccent",
  30841. 0x1e67,
  30842. "scedilla",
  30843. 0x015f,
  30844. "schwa",
  30845. 0x0259,
  30846. "schwacyrillic",
  30847. 0x04d9,
  30848. "schwadieresiscyrillic",
  30849. 0x04db,
  30850. "schwahook",
  30851. 0x025a,
  30852. "scircle",
  30853. 0x24e2,
  30854. "scircumflex",
  30855. 0x015d,
  30856. "scommaaccent",
  30857. 0x0219,
  30858. "sdotaccent",
  30859. 0x1e61,
  30860. "sdotbelow",
  30861. 0x1e63,
  30862. "sdotbelowdotaccent",
  30863. 0x1e69,
  30864. "seagullbelowcmb",
  30865. 0x033c,
  30866. "second",
  30867. 0x2033,
  30868. "secondtonechinese",
  30869. 0x02ca,
  30870. "section",
  30871. 0x00a7,
  30872. "seenarabic",
  30873. 0x0633,
  30874. "seenfinalarabic",
  30875. 0xfeb2,
  30876. "seeninitialarabic",
  30877. 0xfeb3,
  30878. "seenmedialarabic",
  30879. 0xfeb4,
  30880. "segol",
  30881. 0x05b6,
  30882. "segol13",
  30883. 0x05b6,
  30884. "segol1f",
  30885. 0x05b6,
  30886. "segol2c",
  30887. 0x05b6,
  30888. "segolhebrew",
  30889. 0x05b6,
  30890. "segolnarrowhebrew",
  30891. 0x05b6,
  30892. "segolquarterhebrew",
  30893. 0x05b6,
  30894. "segoltahebrew",
  30895. 0x0592,
  30896. "segolwidehebrew",
  30897. 0x05b6,
  30898. "seharmenian",
  30899. 0x057d,
  30900. "sehiragana",
  30901. 0x305b,
  30902. "sekatakana",
  30903. 0x30bb,
  30904. "sekatakanahalfwidth",
  30905. 0xff7e,
  30906. "semicolon",
  30907. 0x003b,
  30908. "semicolonarabic",
  30909. 0x061b,
  30910. "semicolonmonospace",
  30911. 0xff1b,
  30912. "semicolonsmall",
  30913. 0xfe54,
  30914. "semivoicedmarkkana",
  30915. 0x309c,
  30916. "semivoicedmarkkanahalfwidth",
  30917. 0xff9f,
  30918. "sentisquare",
  30919. 0x3322,
  30920. "sentosquare",
  30921. 0x3323,
  30922. "seven",
  30923. 0x0037,
  30924. "sevenarabic",
  30925. 0x0667,
  30926. "sevenbengali",
  30927. 0x09ed,
  30928. "sevencircle",
  30929. 0x2466,
  30930. "sevencircleinversesansserif",
  30931. 0x2790,
  30932. "sevendeva",
  30933. 0x096d,
  30934. "seveneighths",
  30935. 0x215e,
  30936. "sevengujarati",
  30937. 0x0aed,
  30938. "sevengurmukhi",
  30939. 0x0a6d,
  30940. "sevenhackarabic",
  30941. 0x0667,
  30942. "sevenhangzhou",
  30943. 0x3027,
  30944. "sevenideographicparen",
  30945. 0x3226,
  30946. "seveninferior",
  30947. 0x2087,
  30948. "sevenmonospace",
  30949. 0xff17,
  30950. "sevenoldstyle",
  30951. 0xf737,
  30952. "sevenparen",
  30953. 0x247a,
  30954. "sevenperiod",
  30955. 0x248e,
  30956. "sevenpersian",
  30957. 0x06f7,
  30958. "sevenroman",
  30959. 0x2176,
  30960. "sevensuperior",
  30961. 0x2077,
  30962. "seventeencircle",
  30963. 0x2470,
  30964. "seventeenparen",
  30965. 0x2484,
  30966. "seventeenperiod",
  30967. 0x2498,
  30968. "seventhai",
  30969. 0x0e57,
  30970. "sfthyphen",
  30971. 0x00ad,
  30972. "shaarmenian",
  30973. 0x0577,
  30974. "shabengali",
  30975. 0x09b6,
  30976. "shacyrillic",
  30977. 0x0448,
  30978. "shaddaarabic",
  30979. 0x0651,
  30980. "shaddadammaarabic",
  30981. 0xfc61,
  30982. "shaddadammatanarabic",
  30983. 0xfc5e,
  30984. "shaddafathaarabic",
  30985. 0xfc60,
  30986. "shaddakasraarabic",
  30987. 0xfc62,
  30988. "shaddakasratanarabic",
  30989. 0xfc5f,
  30990. "shade",
  30991. 0x2592,
  30992. "shadedark",
  30993. 0x2593,
  30994. "shadelight",
  30995. 0x2591,
  30996. "shademedium",
  30997. 0x2592,
  30998. "shadeva",
  30999. 0x0936,
  31000. "shagujarati",
  31001. 0x0ab6,
  31002. "shagurmukhi",
  31003. 0x0a36,
  31004. "shalshelethebrew",
  31005. 0x0593,
  31006. "shbopomofo",
  31007. 0x3115,
  31008. "shchacyrillic",
  31009. 0x0449,
  31010. "sheenarabic",
  31011. 0x0634,
  31012. "sheenfinalarabic",
  31013. 0xfeb6,
  31014. "sheeninitialarabic",
  31015. 0xfeb7,
  31016. "sheenmedialarabic",
  31017. 0xfeb8,
  31018. "sheicoptic",
  31019. 0x03e3,
  31020. "sheqel",
  31021. 0x20aa,
  31022. "sheqelhebrew",
  31023. 0x20aa,
  31024. "sheva",
  31025. 0x05b0,
  31026. "sheva115",
  31027. 0x05b0,
  31028. "sheva15",
  31029. 0x05b0,
  31030. "sheva22",
  31031. 0x05b0,
  31032. "sheva2e",
  31033. 0x05b0,
  31034. "shevahebrew",
  31035. 0x05b0,
  31036. "shevanarrowhebrew",
  31037. 0x05b0,
  31038. "shevaquarterhebrew",
  31039. 0x05b0,
  31040. "shevawidehebrew",
  31041. 0x05b0,
  31042. "shhacyrillic",
  31043. 0x04bb,
  31044. "shimacoptic",
  31045. 0x03ed,
  31046. "shin",
  31047. 0x05e9,
  31048. "shindagesh",
  31049. 0xfb49,
  31050. "shindageshhebrew",
  31051. 0xfb49,
  31052. "shindageshshindot",
  31053. 0xfb2c,
  31054. "shindageshshindothebrew",
  31055. 0xfb2c,
  31056. "shindageshsindot",
  31057. 0xfb2d,
  31058. "shindageshsindothebrew",
  31059. 0xfb2d,
  31060. "shindothebrew",
  31061. 0x05c1,
  31062. "shinhebrew",
  31063. 0x05e9,
  31064. "shinshindot",
  31065. 0xfb2a,
  31066. "shinshindothebrew",
  31067. 0xfb2a,
  31068. "shinsindot",
  31069. 0xfb2b,
  31070. "shinsindothebrew",
  31071. 0xfb2b,
  31072. "shook",
  31073. 0x0282,
  31074. "sigma",
  31075. 0x03c3,
  31076. "sigma1",
  31077. 0x03c2,
  31078. "sigmafinal",
  31079. 0x03c2,
  31080. "sigmalunatesymbolgreek",
  31081. 0x03f2,
  31082. "sihiragana",
  31083. 0x3057,
  31084. "sikatakana",
  31085. 0x30b7,
  31086. "sikatakanahalfwidth",
  31087. 0xff7c,
  31088. "siluqhebrew",
  31089. 0x05bd,
  31090. "siluqlefthebrew",
  31091. 0x05bd,
  31092. "similar",
  31093. 0x223c,
  31094. "sindothebrew",
  31095. 0x05c2,
  31096. "siosacirclekorean",
  31097. 0x3274,
  31098. "siosaparenkorean",
  31099. 0x3214,
  31100. "sioscieuckorean",
  31101. 0x317e,
  31102. "sioscirclekorean",
  31103. 0x3266,
  31104. "sioskiyeokkorean",
  31105. 0x317a,
  31106. "sioskorean",
  31107. 0x3145,
  31108. "siosnieunkorean",
  31109. 0x317b,
  31110. "siosparenkorean",
  31111. 0x3206,
  31112. "siospieupkorean",
  31113. 0x317d,
  31114. "siostikeutkorean",
  31115. 0x317c,
  31116. "six",
  31117. 0x0036,
  31118. "sixarabic",
  31119. 0x0666,
  31120. "sixbengali",
  31121. 0x09ec,
  31122. "sixcircle",
  31123. 0x2465,
  31124. "sixcircleinversesansserif",
  31125. 0x278f,
  31126. "sixdeva",
  31127. 0x096c,
  31128. "sixgujarati",
  31129. 0x0aec,
  31130. "sixgurmukhi",
  31131. 0x0a6c,
  31132. "sixhackarabic",
  31133. 0x0666,
  31134. "sixhangzhou",
  31135. 0x3026,
  31136. "sixideographicparen",
  31137. 0x3225,
  31138. "sixinferior",
  31139. 0x2086,
  31140. "sixmonospace",
  31141. 0xff16,
  31142. "sixoldstyle",
  31143. 0xf736,
  31144. "sixparen",
  31145. 0x2479,
  31146. "sixperiod",
  31147. 0x248d,
  31148. "sixpersian",
  31149. 0x06f6,
  31150. "sixroman",
  31151. 0x2175,
  31152. "sixsuperior",
  31153. 0x2076,
  31154. "sixteencircle",
  31155. 0x246f,
  31156. "sixteencurrencydenominatorbengali",
  31157. 0x09f9,
  31158. "sixteenparen",
  31159. 0x2483,
  31160. "sixteenperiod",
  31161. 0x2497,
  31162. "sixthai",
  31163. 0x0e56,
  31164. "slash",
  31165. 0x002f,
  31166. "slashmonospace",
  31167. 0xff0f,
  31168. "slong",
  31169. 0x017f,
  31170. "slongdotaccent",
  31171. 0x1e9b,
  31172. "smileface",
  31173. 0x263a,
  31174. "smonospace",
  31175. 0xff53,
  31176. "sofpasuqhebrew",
  31177. 0x05c3,
  31178. "softhyphen",
  31179. 0x00ad,
  31180. "softsigncyrillic",
  31181. 0x044c,
  31182. "sohiragana",
  31183. 0x305d,
  31184. "sokatakana",
  31185. 0x30bd,
  31186. "sokatakanahalfwidth",
  31187. 0xff7f,
  31188. "soliduslongoverlaycmb",
  31189. 0x0338,
  31190. "solidusshortoverlaycmb",
  31191. 0x0337,
  31192. "sorusithai",
  31193. 0x0e29,
  31194. "sosalathai",
  31195. 0x0e28,
  31196. "sosothai",
  31197. 0x0e0b,
  31198. "sosuathai",
  31199. 0x0e2a,
  31200. "space",
  31201. 0x0020,
  31202. "spacehackarabic",
  31203. 0x0020,
  31204. "spade",
  31205. 0x2660,
  31206. "spadesuitblack",
  31207. 0x2660,
  31208. "spadesuitwhite",
  31209. 0x2664,
  31210. "sparen",
  31211. 0x24ae,
  31212. "squarebelowcmb",
  31213. 0x033b,
  31214. "squarecc",
  31215. 0x33c4,
  31216. "squarecm",
  31217. 0x339d,
  31218. "squarediagonalcrosshatchfill",
  31219. 0x25a9,
  31220. "squarehorizontalfill",
  31221. 0x25a4,
  31222. "squarekg",
  31223. 0x338f,
  31224. "squarekm",
  31225. 0x339e,
  31226. "squarekmcapital",
  31227. 0x33ce,
  31228. "squareln",
  31229. 0x33d1,
  31230. "squarelog",
  31231. 0x33d2,
  31232. "squaremg",
  31233. 0x338e,
  31234. "squaremil",
  31235. 0x33d5,
  31236. "squaremm",
  31237. 0x339c,
  31238. "squaremsquared",
  31239. 0x33a1,
  31240. "squareorthogonalcrosshatchfill",
  31241. 0x25a6,
  31242. "squareupperlefttolowerrightfill",
  31243. 0x25a7,
  31244. "squareupperrighttolowerleftfill",
  31245. 0x25a8,
  31246. "squareverticalfill",
  31247. 0x25a5,
  31248. "squarewhitewithsmallblack",
  31249. 0x25a3,
  31250. "srsquare",
  31251. 0x33db,
  31252. "ssabengali",
  31253. 0x09b7,
  31254. "ssadeva",
  31255. 0x0937,
  31256. "ssagujarati",
  31257. 0x0ab7,
  31258. "ssangcieuckorean",
  31259. 0x3149,
  31260. "ssanghieuhkorean",
  31261. 0x3185,
  31262. "ssangieungkorean",
  31263. 0x3180,
  31264. "ssangkiyeokkorean",
  31265. 0x3132,
  31266. "ssangnieunkorean",
  31267. 0x3165,
  31268. "ssangpieupkorean",
  31269. 0x3143,
  31270. "ssangsioskorean",
  31271. 0x3146,
  31272. "ssangtikeutkorean",
  31273. 0x3138,
  31274. "ssuperior",
  31275. 0xf6f2,
  31276. "sterling",
  31277. 0x00a3,
  31278. "sterlingmonospace",
  31279. 0xffe1,
  31280. "strokelongoverlaycmb",
  31281. 0x0336,
  31282. "strokeshortoverlaycmb",
  31283. 0x0335,
  31284. "subset",
  31285. 0x2282,
  31286. "subsetnotequal",
  31287. 0x228a,
  31288. "subsetorequal",
  31289. 0x2286,
  31290. "succeeds",
  31291. 0x227b,
  31292. "suchthat",
  31293. 0x220b,
  31294. "suhiragana",
  31295. 0x3059,
  31296. "sukatakana",
  31297. 0x30b9,
  31298. "sukatakanahalfwidth",
  31299. 0xff7d,
  31300. "sukunarabic",
  31301. 0x0652,
  31302. "summation",
  31303. 0x2211,
  31304. "sun",
  31305. 0x263c,
  31306. "superset",
  31307. 0x2283,
  31308. "supersetnotequal",
  31309. 0x228b,
  31310. "supersetorequal",
  31311. 0x2287,
  31312. "svsquare",
  31313. 0x33dc,
  31314. "syouwaerasquare",
  31315. 0x337c,
  31316. "t",
  31317. 0x0074,
  31318. "tabengali",
  31319. 0x09a4,
  31320. "tackdown",
  31321. 0x22a4,
  31322. "tackleft",
  31323. 0x22a3,
  31324. "tadeva",
  31325. 0x0924,
  31326. "tagujarati",
  31327. 0x0aa4,
  31328. "tagurmukhi",
  31329. 0x0a24,
  31330. "taharabic",
  31331. 0x0637,
  31332. "tahfinalarabic",
  31333. 0xfec2,
  31334. "tahinitialarabic",
  31335. 0xfec3,
  31336. "tahiragana",
  31337. 0x305f,
  31338. "tahmedialarabic",
  31339. 0xfec4,
  31340. "taisyouerasquare",
  31341. 0x337d,
  31342. "takatakana",
  31343. 0x30bf,
  31344. "takatakanahalfwidth",
  31345. 0xff80,
  31346. "tatweelarabic",
  31347. 0x0640,
  31348. "tau",
  31349. 0x03c4,
  31350. "tav",
  31351. 0x05ea,
  31352. "tavdages",
  31353. 0xfb4a,
  31354. "tavdagesh",
  31355. 0xfb4a,
  31356. "tavdageshhebrew",
  31357. 0xfb4a,
  31358. "tavhebrew",
  31359. 0x05ea,
  31360. "tbar",
  31361. 0x0167,
  31362. "tbopomofo",
  31363. 0x310a,
  31364. "tcaron",
  31365. 0x0165,
  31366. "tccurl",
  31367. 0x02a8,
  31368. "tcedilla",
  31369. 0x0163,
  31370. "tcheharabic",
  31371. 0x0686,
  31372. "tchehfinalarabic",
  31373. 0xfb7b,
  31374. "tchehinitialarabic",
  31375. 0xfb7c,
  31376. "tchehmedialarabic",
  31377. 0xfb7d,
  31378. "tcircle",
  31379. 0x24e3,
  31380. "tcircumflexbelow",
  31381. 0x1e71,
  31382. "tcommaaccent",
  31383. 0x0163,
  31384. "tdieresis",
  31385. 0x1e97,
  31386. "tdotaccent",
  31387. 0x1e6b,
  31388. "tdotbelow",
  31389. 0x1e6d,
  31390. "tecyrillic",
  31391. 0x0442,
  31392. "tedescendercyrillic",
  31393. 0x04ad,
  31394. "teharabic",
  31395. 0x062a,
  31396. "tehfinalarabic",
  31397. 0xfe96,
  31398. "tehhahinitialarabic",
  31399. 0xfca2,
  31400. "tehhahisolatedarabic",
  31401. 0xfc0c,
  31402. "tehinitialarabic",
  31403. 0xfe97,
  31404. "tehiragana",
  31405. 0x3066,
  31406. "tehjeeminitialarabic",
  31407. 0xfca1,
  31408. "tehjeemisolatedarabic",
  31409. 0xfc0b,
  31410. "tehmarbutaarabic",
  31411. 0x0629,
  31412. "tehmarbutafinalarabic",
  31413. 0xfe94,
  31414. "tehmedialarabic",
  31415. 0xfe98,
  31416. "tehmeeminitialarabic",
  31417. 0xfca4,
  31418. "tehmeemisolatedarabic",
  31419. 0xfc0e,
  31420. "tehnoonfinalarabic",
  31421. 0xfc73,
  31422. "tekatakana",
  31423. 0x30c6,
  31424. "tekatakanahalfwidth",
  31425. 0xff83,
  31426. "telephone",
  31427. 0x2121,
  31428. "telephoneblack",
  31429. 0x260e,
  31430. "telishagedolahebrew",
  31431. 0x05a0,
  31432. "telishaqetanahebrew",
  31433. 0x05a9,
  31434. "tencircle",
  31435. 0x2469,
  31436. "tenideographicparen",
  31437. 0x3229,
  31438. "tenparen",
  31439. 0x247d,
  31440. "tenperiod",
  31441. 0x2491,
  31442. "tenroman",
  31443. 0x2179,
  31444. "tesh",
  31445. 0x02a7,
  31446. "tet",
  31447. 0x05d8,
  31448. "tetdagesh",
  31449. 0xfb38,
  31450. "tetdageshhebrew",
  31451. 0xfb38,
  31452. "tethebrew",
  31453. 0x05d8,
  31454. "tetsecyrillic",
  31455. 0x04b5,
  31456. "tevirhebrew",
  31457. 0x059b,
  31458. "tevirlefthebrew",
  31459. 0x059b,
  31460. "thabengali",
  31461. 0x09a5,
  31462. "thadeva",
  31463. 0x0925,
  31464. "thagujarati",
  31465. 0x0aa5,
  31466. "thagurmukhi",
  31467. 0x0a25,
  31468. "thalarabic",
  31469. 0x0630,
  31470. "thalfinalarabic",
  31471. 0xfeac,
  31472. "thanthakhatlowleftthai",
  31473. 0xf898,
  31474. "thanthakhatlowrightthai",
  31475. 0xf897,
  31476. "thanthakhatthai",
  31477. 0x0e4c,
  31478. "thanthakhatupperleftthai",
  31479. 0xf896,
  31480. "theharabic",
  31481. 0x062b,
  31482. "thehfinalarabic",
  31483. 0xfe9a,
  31484. "thehinitialarabic",
  31485. 0xfe9b,
  31486. "thehmedialarabic",
  31487. 0xfe9c,
  31488. "thereexists",
  31489. 0x2203,
  31490. "therefore",
  31491. 0x2234,
  31492. "theta",
  31493. 0x03b8,
  31494. "theta1",
  31495. 0x03d1,
  31496. "thetasymbolgreek",
  31497. 0x03d1,
  31498. "thieuthacirclekorean",
  31499. 0x3279,
  31500. "thieuthaparenkorean",
  31501. 0x3219,
  31502. "thieuthcirclekorean",
  31503. 0x326b,
  31504. "thieuthkorean",
  31505. 0x314c,
  31506. "thieuthparenkorean",
  31507. 0x320b,
  31508. "thirteencircle",
  31509. 0x246c,
  31510. "thirteenparen",
  31511. 0x2480,
  31512. "thirteenperiod",
  31513. 0x2494,
  31514. "thonangmonthothai",
  31515. 0x0e11,
  31516. "thook",
  31517. 0x01ad,
  31518. "thophuthaothai",
  31519. 0x0e12,
  31520. "thorn",
  31521. 0x00fe,
  31522. "thothahanthai",
  31523. 0x0e17,
  31524. "thothanthai",
  31525. 0x0e10,
  31526. "thothongthai",
  31527. 0x0e18,
  31528. "thothungthai",
  31529. 0x0e16,
  31530. "thousandcyrillic",
  31531. 0x0482,
  31532. "thousandsseparatorarabic",
  31533. 0x066c,
  31534. "thousandsseparatorpersian",
  31535. 0x066c,
  31536. "three",
  31537. 0x0033,
  31538. "threearabic",
  31539. 0x0663,
  31540. "threebengali",
  31541. 0x09e9,
  31542. "threecircle",
  31543. 0x2462,
  31544. "threecircleinversesansserif",
  31545. 0x278c,
  31546. "threedeva",
  31547. 0x0969,
  31548. "threeeighths",
  31549. 0x215c,
  31550. "threegujarati",
  31551. 0x0ae9,
  31552. "threegurmukhi",
  31553. 0x0a69,
  31554. "threehackarabic",
  31555. 0x0663,
  31556. "threehangzhou",
  31557. 0x3023,
  31558. "threeideographicparen",
  31559. 0x3222,
  31560. "threeinferior",
  31561. 0x2083,
  31562. "threemonospace",
  31563. 0xff13,
  31564. "threenumeratorbengali",
  31565. 0x09f6,
  31566. "threeoldstyle",
  31567. 0xf733,
  31568. "threeparen",
  31569. 0x2476,
  31570. "threeperiod",
  31571. 0x248a,
  31572. "threepersian",
  31573. 0x06f3,
  31574. "threequarters",
  31575. 0x00be,
  31576. "threequartersemdash",
  31577. 0xf6de,
  31578. "threeroman",
  31579. 0x2172,
  31580. "threesuperior",
  31581. 0x00b3,
  31582. "threethai",
  31583. 0x0e53,
  31584. "thzsquare",
  31585. 0x3394,
  31586. "tihiragana",
  31587. 0x3061,
  31588. "tikatakana",
  31589. 0x30c1,
  31590. "tikatakanahalfwidth",
  31591. 0xff81,
  31592. "tikeutacirclekorean",
  31593. 0x3270,
  31594. "tikeutaparenkorean",
  31595. 0x3210,
  31596. "tikeutcirclekorean",
  31597. 0x3262,
  31598. "tikeutkorean",
  31599. 0x3137,
  31600. "tikeutparenkorean",
  31601. 0x3202,
  31602. "tilde",
  31603. 0x02dc,
  31604. "tildebelowcmb",
  31605. 0x0330,
  31606. "tildecmb",
  31607. 0x0303,
  31608. "tildecomb",
  31609. 0x0303,
  31610. "tildedoublecmb",
  31611. 0x0360,
  31612. "tildeoperator",
  31613. 0x223c,
  31614. "tildeoverlaycmb",
  31615. 0x0334,
  31616. "tildeverticalcmb",
  31617. 0x033e,
  31618. "timescircle",
  31619. 0x2297,
  31620. "tipehahebrew",
  31621. 0x0596,
  31622. "tipehalefthebrew",
  31623. 0x0596,
  31624. "tippigurmukhi",
  31625. 0x0a70,
  31626. "titlocyrilliccmb",
  31627. 0x0483,
  31628. "tiwnarmenian",
  31629. 0x057f,
  31630. "tlinebelow",
  31631. 0x1e6f,
  31632. "tmonospace",
  31633. 0xff54,
  31634. "toarmenian",
  31635. 0x0569,
  31636. "tohiragana",
  31637. 0x3068,
  31638. "tokatakana",
  31639. 0x30c8,
  31640. "tokatakanahalfwidth",
  31641. 0xff84,
  31642. "tonebarextrahighmod",
  31643. 0x02e5,
  31644. "tonebarextralowmod",
  31645. 0x02e9,
  31646. "tonebarhighmod",
  31647. 0x02e6,
  31648. "tonebarlowmod",
  31649. 0x02e8,
  31650. "tonebarmidmod",
  31651. 0x02e7,
  31652. "tonefive",
  31653. 0x01bd,
  31654. "tonesix",
  31655. 0x0185,
  31656. "tonetwo",
  31657. 0x01a8,
  31658. "tonos",
  31659. 0x0384,
  31660. "tonsquare",
  31661. 0x3327,
  31662. "topatakthai",
  31663. 0x0e0f,
  31664. "tortoiseshellbracketleft",
  31665. 0x3014,
  31666. "tortoiseshellbracketleftsmall",
  31667. 0xfe5d,
  31668. "tortoiseshellbracketleftvertical",
  31669. 0xfe39,
  31670. "tortoiseshellbracketright",
  31671. 0x3015,
  31672. "tortoiseshellbracketrightsmall",
  31673. 0xfe5e,
  31674. "tortoiseshellbracketrightvertical",
  31675. 0xfe3a,
  31676. "totaothai",
  31677. 0x0e15,
  31678. "tpalatalhook",
  31679. 0x01ab,
  31680. "tparen",
  31681. 0x24af,
  31682. "trademark",
  31683. 0x2122,
  31684. "trademarksans",
  31685. 0xf8ea,
  31686. "trademarkserif",
  31687. 0xf6db,
  31688. "tretroflexhook",
  31689. 0x0288,
  31690. "triagdn",
  31691. 0x25bc,
  31692. "triaglf",
  31693. 0x25c4,
  31694. "triagrt",
  31695. 0x25ba,
  31696. "triagup",
  31697. 0x25b2,
  31698. "ts",
  31699. 0x02a6,
  31700. "tsadi",
  31701. 0x05e6,
  31702. "tsadidagesh",
  31703. 0xfb46,
  31704. "tsadidageshhebrew",
  31705. 0xfb46,
  31706. "tsadihebrew",
  31707. 0x05e6,
  31708. "tsecyrillic",
  31709. 0x0446,
  31710. "tsere",
  31711. 0x05b5,
  31712. "tsere12",
  31713. 0x05b5,
  31714. "tsere1e",
  31715. 0x05b5,
  31716. "tsere2b",
  31717. 0x05b5,
  31718. "tserehebrew",
  31719. 0x05b5,
  31720. "tserenarrowhebrew",
  31721. 0x05b5,
  31722. "tserequarterhebrew",
  31723. 0x05b5,
  31724. "tserewidehebrew",
  31725. 0x05b5,
  31726. "tshecyrillic",
  31727. 0x045b,
  31728. "tsuperior",
  31729. 0xf6f3,
  31730. "ttabengali",
  31731. 0x099f,
  31732. "ttadeva",
  31733. 0x091f,
  31734. "ttagujarati",
  31735. 0x0a9f,
  31736. "ttagurmukhi",
  31737. 0x0a1f,
  31738. "tteharabic",
  31739. 0x0679,
  31740. "ttehfinalarabic",
  31741. 0xfb67,
  31742. "ttehinitialarabic",
  31743. 0xfb68,
  31744. "ttehmedialarabic",
  31745. 0xfb69,
  31746. "tthabengali",
  31747. 0x09a0,
  31748. "tthadeva",
  31749. 0x0920,
  31750. "tthagujarati",
  31751. 0x0aa0,
  31752. "tthagurmukhi",
  31753. 0x0a20,
  31754. "tturned",
  31755. 0x0287,
  31756. "tuhiragana",
  31757. 0x3064,
  31758. "tukatakana",
  31759. 0x30c4,
  31760. "tukatakanahalfwidth",
  31761. 0xff82,
  31762. "tusmallhiragana",
  31763. 0x3063,
  31764. "tusmallkatakana",
  31765. 0x30c3,
  31766. "tusmallkatakanahalfwidth",
  31767. 0xff6f,
  31768. "twelvecircle",
  31769. 0x246b,
  31770. "twelveparen",
  31771. 0x247f,
  31772. "twelveperiod",
  31773. 0x2493,
  31774. "twelveroman",
  31775. 0x217b,
  31776. "twentycircle",
  31777. 0x2473,
  31778. "twentyhangzhou",
  31779. 0x5344,
  31780. "twentyparen",
  31781. 0x2487,
  31782. "twentyperiod",
  31783. 0x249b,
  31784. "two",
  31785. 0x0032,
  31786. "twoarabic",
  31787. 0x0662,
  31788. "twobengali",
  31789. 0x09e8,
  31790. "twocircle",
  31791. 0x2461,
  31792. "twocircleinversesansserif",
  31793. 0x278b,
  31794. "twodeva",
  31795. 0x0968,
  31796. "twodotenleader",
  31797. 0x2025,
  31798. "twodotleader",
  31799. 0x2025,
  31800. "twodotleadervertical",
  31801. 0xfe30,
  31802. "twogujarati",
  31803. 0x0ae8,
  31804. "twogurmukhi",
  31805. 0x0a68,
  31806. "twohackarabic",
  31807. 0x0662,
  31808. "twohangzhou",
  31809. 0x3022,
  31810. "twoideographicparen",
  31811. 0x3221,
  31812. "twoinferior",
  31813. 0x2082,
  31814. "twomonospace",
  31815. 0xff12,
  31816. "twonumeratorbengali",
  31817. 0x09f5,
  31818. "twooldstyle",
  31819. 0xf732,
  31820. "twoparen",
  31821. 0x2475,
  31822. "twoperiod",
  31823. 0x2489,
  31824. "twopersian",
  31825. 0x06f2,
  31826. "tworoman",
  31827. 0x2171,
  31828. "twostroke",
  31829. 0x01bb,
  31830. "twosuperior",
  31831. 0x00b2,
  31832. "twothai",
  31833. 0x0e52,
  31834. "twothirds",
  31835. 0x2154,
  31836. "u",
  31837. 0x0075,
  31838. "uacute",
  31839. 0x00fa,
  31840. "ubar",
  31841. 0x0289,
  31842. "ubengali",
  31843. 0x0989,
  31844. "ubopomofo",
  31845. 0x3128,
  31846. "ubreve",
  31847. 0x016d,
  31848. "ucaron",
  31849. 0x01d4,
  31850. "ucircle",
  31851. 0x24e4,
  31852. "ucircumflex",
  31853. 0x00fb,
  31854. "ucircumflexbelow",
  31855. 0x1e77,
  31856. "ucyrillic",
  31857. 0x0443,
  31858. "udattadeva",
  31859. 0x0951,
  31860. "udblacute",
  31861. 0x0171,
  31862. "udblgrave",
  31863. 0x0215,
  31864. "udeva",
  31865. 0x0909,
  31866. "udieresis",
  31867. 0x00fc,
  31868. "udieresisacute",
  31869. 0x01d8,
  31870. "udieresisbelow",
  31871. 0x1e73,
  31872. "udieresiscaron",
  31873. 0x01da,
  31874. "udieresiscyrillic",
  31875. 0x04f1,
  31876. "udieresisgrave",
  31877. 0x01dc,
  31878. "udieresismacron",
  31879. 0x01d6,
  31880. "udotbelow",
  31881. 0x1ee5,
  31882. "ugrave",
  31883. 0x00f9,
  31884. "ugujarati",
  31885. 0x0a89,
  31886. "ugurmukhi",
  31887. 0x0a09,
  31888. "uhiragana",
  31889. 0x3046,
  31890. "uhookabove",
  31891. 0x1ee7,
  31892. "uhorn",
  31893. 0x01b0,
  31894. "uhornacute",
  31895. 0x1ee9,
  31896. "uhorndotbelow",
  31897. 0x1ef1,
  31898. "uhorngrave",
  31899. 0x1eeb,
  31900. "uhornhookabove",
  31901. 0x1eed,
  31902. "uhorntilde",
  31903. 0x1eef,
  31904. "uhungarumlaut",
  31905. 0x0171,
  31906. "uhungarumlautcyrillic",
  31907. 0x04f3,
  31908. "uinvertedbreve",
  31909. 0x0217,
  31910. "ukatakana",
  31911. 0x30a6,
  31912. "ukatakanahalfwidth",
  31913. 0xff73,
  31914. "ukcyrillic",
  31915. 0x0479,
  31916. "ukorean",
  31917. 0x315c,
  31918. "umacron",
  31919. 0x016b,
  31920. "umacroncyrillic",
  31921. 0x04ef,
  31922. "umacrondieresis",
  31923. 0x1e7b,
  31924. "umatragurmukhi",
  31925. 0x0a41,
  31926. "umonospace",
  31927. 0xff55,
  31928. "underscore",
  31929. 0x005f,
  31930. "underscoredbl",
  31931. 0x2017,
  31932. "underscoremonospace",
  31933. 0xff3f,
  31934. "underscorevertical",
  31935. 0xfe33,
  31936. "underscorewavy",
  31937. 0xfe4f,
  31938. "union",
  31939. 0x222a,
  31940. "universal",
  31941. 0x2200,
  31942. "uogonek",
  31943. 0x0173,
  31944. "uparen",
  31945. 0x24b0,
  31946. "upblock",
  31947. 0x2580,
  31948. "upperdothebrew",
  31949. 0x05c4,
  31950. "upsilon",
  31951. 0x03c5,
  31952. "upsilondieresis",
  31953. 0x03cb,
  31954. "upsilondieresistonos",
  31955. 0x03b0,
  31956. "upsilonlatin",
  31957. 0x028a,
  31958. "upsilontonos",
  31959. 0x03cd,
  31960. "uptackbelowcmb",
  31961. 0x031d,
  31962. "uptackmod",
  31963. 0x02d4,
  31964. "uragurmukhi",
  31965. 0x0a73,
  31966. "uring",
  31967. 0x016f,
  31968. "ushortcyrillic",
  31969. 0x045e,
  31970. "usmallhiragana",
  31971. 0x3045,
  31972. "usmallkatakana",
  31973. 0x30a5,
  31974. "usmallkatakanahalfwidth",
  31975. 0xff69,
  31976. "ustraightcyrillic",
  31977. 0x04af,
  31978. "ustraightstrokecyrillic",
  31979. 0x04b1,
  31980. "utilde",
  31981. 0x0169,
  31982. "utildeacute",
  31983. 0x1e79,
  31984. "utildebelow",
  31985. 0x1e75,
  31986. "uubengali",
  31987. 0x098a,
  31988. "uudeva",
  31989. 0x090a,
  31990. "uugujarati",
  31991. 0x0a8a,
  31992. "uugurmukhi",
  31993. 0x0a0a,
  31994. "uumatragurmukhi",
  31995. 0x0a42,
  31996. "uuvowelsignbengali",
  31997. 0x09c2,
  31998. "uuvowelsigndeva",
  31999. 0x0942,
  32000. "uuvowelsigngujarati",
  32001. 0x0ac2,
  32002. "uvowelsignbengali",
  32003. 0x09c1,
  32004. "uvowelsigndeva",
  32005. 0x0941,
  32006. "uvowelsigngujarati",
  32007. 0x0ac1,
  32008. "v",
  32009. 0x0076,
  32010. "vadeva",
  32011. 0x0935,
  32012. "vagujarati",
  32013. 0x0ab5,
  32014. "vagurmukhi",
  32015. 0x0a35,
  32016. "vakatakana",
  32017. 0x30f7,
  32018. "vav",
  32019. 0x05d5,
  32020. "vavdagesh",
  32021. 0xfb35,
  32022. "vavdagesh65",
  32023. 0xfb35,
  32024. "vavdageshhebrew",
  32025. 0xfb35,
  32026. "vavhebrew",
  32027. 0x05d5,
  32028. "vavholam",
  32029. 0xfb4b,
  32030. "vavholamhebrew",
  32031. 0xfb4b,
  32032. "vavvavhebrew",
  32033. 0x05f0,
  32034. "vavyodhebrew",
  32035. 0x05f1,
  32036. "vcircle",
  32037. 0x24e5,
  32038. "vdotbelow",
  32039. 0x1e7f,
  32040. "vecyrillic",
  32041. 0x0432,
  32042. "veharabic",
  32043. 0x06a4,
  32044. "vehfinalarabic",
  32045. 0xfb6b,
  32046. "vehinitialarabic",
  32047. 0xfb6c,
  32048. "vehmedialarabic",
  32049. 0xfb6d,
  32050. "vekatakana",
  32051. 0x30f9,
  32052. "venus",
  32053. 0x2640,
  32054. "verticalbar",
  32055. 0x007c,
  32056. "verticallineabovecmb",
  32057. 0x030d,
  32058. "verticallinebelowcmb",
  32059. 0x0329,
  32060. "verticallinelowmod",
  32061. 0x02cc,
  32062. "verticallinemod",
  32063. 0x02c8,
  32064. "vewarmenian",
  32065. 0x057e,
  32066. "vhook",
  32067. 0x028b,
  32068. "vikatakana",
  32069. 0x30f8,
  32070. "viramabengali",
  32071. 0x09cd,
  32072. "viramadeva",
  32073. 0x094d,
  32074. "viramagujarati",
  32075. 0x0acd,
  32076. "visargabengali",
  32077. 0x0983,
  32078. "visargadeva",
  32079. 0x0903,
  32080. "visargagujarati",
  32081. 0x0a83,
  32082. "vmonospace",
  32083. 0xff56,
  32084. "voarmenian",
  32085. 0x0578,
  32086. "voicediterationhiragana",
  32087. 0x309e,
  32088. "voicediterationkatakana",
  32089. 0x30fe,
  32090. "voicedmarkkana",
  32091. 0x309b,
  32092. "voicedmarkkanahalfwidth",
  32093. 0xff9e,
  32094. "vokatakana",
  32095. 0x30fa,
  32096. "vparen",
  32097. 0x24b1,
  32098. "vtilde",
  32099. 0x1e7d,
  32100. "vturned",
  32101. 0x028c,
  32102. "vuhiragana",
  32103. 0x3094,
  32104. "vukatakana",
  32105. 0x30f4,
  32106. "w",
  32107. 0x0077,
  32108. "wacute",
  32109. 0x1e83,
  32110. "waekorean",
  32111. 0x3159,
  32112. "wahiragana",
  32113. 0x308f,
  32114. "wakatakana",
  32115. 0x30ef,
  32116. "wakatakanahalfwidth",
  32117. 0xff9c,
  32118. "wakorean",
  32119. 0x3158,
  32120. "wasmallhiragana",
  32121. 0x308e,
  32122. "wasmallkatakana",
  32123. 0x30ee,
  32124. "wattosquare",
  32125. 0x3357,
  32126. "wavedash",
  32127. 0x301c,
  32128. "wavyunderscorevertical",
  32129. 0xfe34,
  32130. "wawarabic",
  32131. 0x0648,
  32132. "wawfinalarabic",
  32133. 0xfeee,
  32134. "wawhamzaabovearabic",
  32135. 0x0624,
  32136. "wawhamzaabovefinalarabic",
  32137. 0xfe86,
  32138. "wbsquare",
  32139. 0x33dd,
  32140. "wcircle",
  32141. 0x24e6,
  32142. "wcircumflex",
  32143. 0x0175,
  32144. "wdieresis",
  32145. 0x1e85,
  32146. "wdotaccent",
  32147. 0x1e87,
  32148. "wdotbelow",
  32149. 0x1e89,
  32150. "wehiragana",
  32151. 0x3091,
  32152. "weierstrass",
  32153. 0x2118,
  32154. "wekatakana",
  32155. 0x30f1,
  32156. "wekorean",
  32157. 0x315e,
  32158. "weokorean",
  32159. 0x315d,
  32160. "wgrave",
  32161. 0x1e81,
  32162. "whitebullet",
  32163. 0x25e6,
  32164. "whitecircle",
  32165. 0x25cb,
  32166. "whitecircleinverse",
  32167. 0x25d9,
  32168. "whitecornerbracketleft",
  32169. 0x300e,
  32170. "whitecornerbracketleftvertical",
  32171. 0xfe43,
  32172. "whitecornerbracketright",
  32173. 0x300f,
  32174. "whitecornerbracketrightvertical",
  32175. 0xfe44,
  32176. "whitediamond",
  32177. 0x25c7,
  32178. "whitediamondcontainingblacksmalldiamond",
  32179. 0x25c8,
  32180. "whitedownpointingsmalltriangle",
  32181. 0x25bf,
  32182. "whitedownpointingtriangle",
  32183. 0x25bd,
  32184. "whiteleftpointingsmalltriangle",
  32185. 0x25c3,
  32186. "whiteleftpointingtriangle",
  32187. 0x25c1,
  32188. "whitelenticularbracketleft",
  32189. 0x3016,
  32190. "whitelenticularbracketright",
  32191. 0x3017,
  32192. "whiterightpointingsmalltriangle",
  32193. 0x25b9,
  32194. "whiterightpointingtriangle",
  32195. 0x25b7,
  32196. "whitesmallsquare",
  32197. 0x25ab,
  32198. "whitesmilingface",
  32199. 0x263a,
  32200. "whitesquare",
  32201. 0x25a1,
  32202. "whitestar",
  32203. 0x2606,
  32204. "whitetelephone",
  32205. 0x260f,
  32206. "whitetortoiseshellbracketleft",
  32207. 0x3018,
  32208. "whitetortoiseshellbracketright",
  32209. 0x3019,
  32210. "whiteuppointingsmalltriangle",
  32211. 0x25b5,
  32212. "whiteuppointingtriangle",
  32213. 0x25b3,
  32214. "wihiragana",
  32215. 0x3090,
  32216. "wikatakana",
  32217. 0x30f0,
  32218. "wikorean",
  32219. 0x315f,
  32220. "wmonospace",
  32221. 0xff57,
  32222. "wohiragana",
  32223. 0x3092,
  32224. "wokatakana",
  32225. 0x30f2,
  32226. "wokatakanahalfwidth",
  32227. 0xff66,
  32228. "won",
  32229. 0x20a9,
  32230. "wonmonospace",
  32231. 0xffe6,
  32232. "wowaenthai",
  32233. 0x0e27,
  32234. "wparen",
  32235. 0x24b2,
  32236. "wring",
  32237. 0x1e98,
  32238. "wsuperior",
  32239. 0x02b7,
  32240. "wturned",
  32241. 0x028d,
  32242. "wynn",
  32243. 0x01bf,
  32244. "x",
  32245. 0x0078,
  32246. "xabovecmb",
  32247. 0x033d,
  32248. "xbopomofo",
  32249. 0x3112,
  32250. "xcircle",
  32251. 0x24e7,
  32252. "xdieresis",
  32253. 0x1e8d,
  32254. "xdotaccent",
  32255. 0x1e8b,
  32256. "xeharmenian",
  32257. 0x056d,
  32258. "xi",
  32259. 0x03be,
  32260. "xmonospace",
  32261. 0xff58,
  32262. "xparen",
  32263. 0x24b3,
  32264. "xsuperior",
  32265. 0x02e3,
  32266. "y",
  32267. 0x0079,
  32268. "yaadosquare",
  32269. 0x334e,
  32270. "yabengali",
  32271. 0x09af,
  32272. "yacute",
  32273. 0x00fd,
  32274. "yadeva",
  32275. 0x092f,
  32276. "yaekorean",
  32277. 0x3152,
  32278. "yagujarati",
  32279. 0x0aaf,
  32280. "yagurmukhi",
  32281. 0x0a2f,
  32282. "yahiragana",
  32283. 0x3084,
  32284. "yakatakana",
  32285. 0x30e4,
  32286. "yakatakanahalfwidth",
  32287. 0xff94,
  32288. "yakorean",
  32289. 0x3151,
  32290. "yamakkanthai",
  32291. 0x0e4e,
  32292. "yasmallhiragana",
  32293. 0x3083,
  32294. "yasmallkatakana",
  32295. 0x30e3,
  32296. "yasmallkatakanahalfwidth",
  32297. 0xff6c,
  32298. "yatcyrillic",
  32299. 0x0463,
  32300. "ycircle",
  32301. 0x24e8,
  32302. "ycircumflex",
  32303. 0x0177,
  32304. "ydieresis",
  32305. 0x00ff,
  32306. "ydotaccent",
  32307. 0x1e8f,
  32308. "ydotbelow",
  32309. 0x1ef5,
  32310. "yeharabic",
  32311. 0x064a,
  32312. "yehbarreearabic",
  32313. 0x06d2,
  32314. "yehbarreefinalarabic",
  32315. 0xfbaf,
  32316. "yehfinalarabic",
  32317. 0xfef2,
  32318. "yehhamzaabovearabic",
  32319. 0x0626,
  32320. "yehhamzaabovefinalarabic",
  32321. 0xfe8a,
  32322. "yehhamzaaboveinitialarabic",
  32323. 0xfe8b,
  32324. "yehhamzaabovemedialarabic",
  32325. 0xfe8c,
  32326. "yehinitialarabic",
  32327. 0xfef3,
  32328. "yehmedialarabic",
  32329. 0xfef4,
  32330. "yehmeeminitialarabic",
  32331. 0xfcdd,
  32332. "yehmeemisolatedarabic",
  32333. 0xfc58,
  32334. "yehnoonfinalarabic",
  32335. 0xfc94,
  32336. "yehthreedotsbelowarabic",
  32337. 0x06d1,
  32338. "yekorean",
  32339. 0x3156,
  32340. "yen",
  32341. 0x00a5,
  32342. "yenmonospace",
  32343. 0xffe5,
  32344. "yeokorean",
  32345. 0x3155,
  32346. "yeorinhieuhkorean",
  32347. 0x3186,
  32348. "yerahbenyomohebrew",
  32349. 0x05aa,
  32350. "yerahbenyomolefthebrew",
  32351. 0x05aa,
  32352. "yericyrillic",
  32353. 0x044b,
  32354. "yerudieresiscyrillic",
  32355. 0x04f9,
  32356. "yesieungkorean",
  32357. 0x3181,
  32358. "yesieungpansioskorean",
  32359. 0x3183,
  32360. "yesieungsioskorean",
  32361. 0x3182,
  32362. "yetivhebrew",
  32363. 0x059a,
  32364. "ygrave",
  32365. 0x1ef3,
  32366. "yhook",
  32367. 0x01b4,
  32368. "yhookabove",
  32369. 0x1ef7,
  32370. "yiarmenian",
  32371. 0x0575,
  32372. "yicyrillic",
  32373. 0x0457,
  32374. "yikorean",
  32375. 0x3162,
  32376. "yinyang",
  32377. 0x262f,
  32378. "yiwnarmenian",
  32379. 0x0582,
  32380. "ymonospace",
  32381. 0xff59,
  32382. "yod",
  32383. 0x05d9,
  32384. "yoddagesh",
  32385. 0xfb39,
  32386. "yoddageshhebrew",
  32387. 0xfb39,
  32388. "yodhebrew",
  32389. 0x05d9,
  32390. "yodyodhebrew",
  32391. 0x05f2,
  32392. "yodyodpatahhebrew",
  32393. 0xfb1f,
  32394. "yohiragana",
  32395. 0x3088,
  32396. "yoikorean",
  32397. 0x3189,
  32398. "yokatakana",
  32399. 0x30e8,
  32400. "yokatakanahalfwidth",
  32401. 0xff96,
  32402. "yokorean",
  32403. 0x315b,
  32404. "yosmallhiragana",
  32405. 0x3087,
  32406. "yosmallkatakana",
  32407. 0x30e7,
  32408. "yosmallkatakanahalfwidth",
  32409. 0xff6e,
  32410. "yotgreek",
  32411. 0x03f3,
  32412. "yoyaekorean",
  32413. 0x3188,
  32414. "yoyakorean",
  32415. 0x3187,
  32416. "yoyakthai",
  32417. 0x0e22,
  32418. "yoyingthai",
  32419. 0x0e0d,
  32420. "yparen",
  32421. 0x24b4,
  32422. "ypogegrammeni",
  32423. 0x037a,
  32424. "ypogegrammenigreekcmb",
  32425. 0x0345,
  32426. "yr",
  32427. 0x01a6,
  32428. "yring",
  32429. 0x1e99,
  32430. "ysuperior",
  32431. 0x02b8,
  32432. "ytilde",
  32433. 0x1ef9,
  32434. "yturned",
  32435. 0x028e,
  32436. "yuhiragana",
  32437. 0x3086,
  32438. "yuikorean",
  32439. 0x318c,
  32440. "yukatakana",
  32441. 0x30e6,
  32442. "yukatakanahalfwidth",
  32443. 0xff95,
  32444. "yukorean",
  32445. 0x3160,
  32446. "yusbigcyrillic",
  32447. 0x046b,
  32448. "yusbigiotifiedcyrillic",
  32449. 0x046d,
  32450. "yuslittlecyrillic",
  32451. 0x0467,
  32452. "yuslittleiotifiedcyrillic",
  32453. 0x0469,
  32454. "yusmallhiragana",
  32455. 0x3085,
  32456. "yusmallkatakana",
  32457. 0x30e5,
  32458. "yusmallkatakanahalfwidth",
  32459. 0xff6d,
  32460. "yuyekorean",
  32461. 0x318b,
  32462. "yuyeokorean",
  32463. 0x318a,
  32464. "yyabengali",
  32465. 0x09df,
  32466. "yyadeva",
  32467. 0x095f,
  32468. "z",
  32469. 0x007a,
  32470. "zaarmenian",
  32471. 0x0566,
  32472. "zacute",
  32473. 0x017a,
  32474. "zadeva",
  32475. 0x095b,
  32476. "zagurmukhi",
  32477. 0x0a5b,
  32478. "zaharabic",
  32479. 0x0638,
  32480. "zahfinalarabic",
  32481. 0xfec6,
  32482. "zahinitialarabic",
  32483. 0xfec7,
  32484. "zahiragana",
  32485. 0x3056,
  32486. "zahmedialarabic",
  32487. 0xfec8,
  32488. "zainarabic",
  32489. 0x0632,
  32490. "zainfinalarabic",
  32491. 0xfeb0,
  32492. "zakatakana",
  32493. 0x30b6,
  32494. "zaqefgadolhebrew",
  32495. 0x0595,
  32496. "zaqefqatanhebrew",
  32497. 0x0594,
  32498. "zarqahebrew",
  32499. 0x0598,
  32500. "zayin",
  32501. 0x05d6,
  32502. "zayindagesh",
  32503. 0xfb36,
  32504. "zayindageshhebrew",
  32505. 0xfb36,
  32506. "zayinhebrew",
  32507. 0x05d6,
  32508. "zbopomofo",
  32509. 0x3117,
  32510. "zcaron",
  32511. 0x017e,
  32512. "zcircle",
  32513. 0x24e9,
  32514. "zcircumflex",
  32515. 0x1e91,
  32516. "zcurl",
  32517. 0x0291,
  32518. "zdot",
  32519. 0x017c,
  32520. "zdotaccent",
  32521. 0x017c,
  32522. "zdotbelow",
  32523. 0x1e93,
  32524. "zecyrillic",
  32525. 0x0437,
  32526. "zedescendercyrillic",
  32527. 0x0499,
  32528. "zedieresiscyrillic",
  32529. 0x04df,
  32530. "zehiragana",
  32531. 0x305c,
  32532. "zekatakana",
  32533. 0x30bc,
  32534. "zero",
  32535. 0x0030,
  32536. "zeroarabic",
  32537. 0x0660,
  32538. "zerobengali",
  32539. 0x09e6,
  32540. "zerodeva",
  32541. 0x0966,
  32542. "zerogujarati",
  32543. 0x0ae6,
  32544. "zerogurmukhi",
  32545. 0x0a66,
  32546. "zerohackarabic",
  32547. 0x0660,
  32548. "zeroinferior",
  32549. 0x2080,
  32550. "zeromonospace",
  32551. 0xff10,
  32552. "zerooldstyle",
  32553. 0xf730,
  32554. "zeropersian",
  32555. 0x06f0,
  32556. "zerosuperior",
  32557. 0x2070,
  32558. "zerothai",
  32559. 0x0e50,
  32560. "zerowidthjoiner",
  32561. 0xfeff,
  32562. "zerowidthnonjoiner",
  32563. 0x200c,
  32564. "zerowidthspace",
  32565. 0x200b,
  32566. "zeta",
  32567. 0x03b6,
  32568. "zhbopomofo",
  32569. 0x3113,
  32570. "zhearmenian",
  32571. 0x056a,
  32572. "zhebrevecyrillic",
  32573. 0x04c2,
  32574. "zhecyrillic",
  32575. 0x0436,
  32576. "zhedescendercyrillic",
  32577. 0x0497,
  32578. "zhedieresiscyrillic",
  32579. 0x04dd,
  32580. "zihiragana",
  32581. 0x3058,
  32582. "zikatakana",
  32583. 0x30b8,
  32584. "zinorhebrew",
  32585. 0x05ae,
  32586. "zlinebelow",
  32587. 0x1e95,
  32588. "zmonospace",
  32589. 0xff5a,
  32590. "zohiragana",
  32591. 0x305e,
  32592. "zokatakana",
  32593. 0x30be,
  32594. "zparen",
  32595. 0x24b5,
  32596. "zretroflexhook",
  32597. 0x0290,
  32598. "zstroke",
  32599. 0x01b6,
  32600. "zuhiragana",
  32601. 0x305a,
  32602. "zukatakana",
  32603. 0x30ba,
  32604. ".notdef",
  32605. 0x0000,
  32606. "angbracketleftbig",
  32607. 0x2329,
  32608. "angbracketleftBig",
  32609. 0x2329,
  32610. "angbracketleftbigg",
  32611. 0x2329,
  32612. "angbracketleftBigg",
  32613. 0x2329,
  32614. "angbracketrightBig",
  32615. 0x232a,
  32616. "angbracketrightbig",
  32617. 0x232a,
  32618. "angbracketrightBigg",
  32619. 0x232a,
  32620. "angbracketrightbigg",
  32621. 0x232a,
  32622. "arrowhookleft",
  32623. 0x21aa,
  32624. "arrowhookright",
  32625. 0x21a9,
  32626. "arrowlefttophalf",
  32627. 0x21bc,
  32628. "arrowleftbothalf",
  32629. 0x21bd,
  32630. "arrownortheast",
  32631. 0x2197,
  32632. "arrownorthwest",
  32633. 0x2196,
  32634. "arrowrighttophalf",
  32635. 0x21c0,
  32636. "arrowrightbothalf",
  32637. 0x21c1,
  32638. "arrowsoutheast",
  32639. 0x2198,
  32640. "arrowsouthwest",
  32641. 0x2199,
  32642. "backslashbig",
  32643. 0x2216,
  32644. "backslashBig",
  32645. 0x2216,
  32646. "backslashBigg",
  32647. 0x2216,
  32648. "backslashbigg",
  32649. 0x2216,
  32650. "bardbl",
  32651. 0x2016,
  32652. "bracehtipdownleft",
  32653. 0xfe37,
  32654. "bracehtipdownright",
  32655. 0xfe37,
  32656. "bracehtipupleft",
  32657. 0xfe38,
  32658. "bracehtipupright",
  32659. 0xfe38,
  32660. "braceleftBig",
  32661. 0x007b,
  32662. "braceleftbig",
  32663. 0x007b,
  32664. "braceleftbigg",
  32665. 0x007b,
  32666. "braceleftBigg",
  32667. 0x007b,
  32668. "bracerightBig",
  32669. 0x007d,
  32670. "bracerightbig",
  32671. 0x007d,
  32672. "bracerightbigg",
  32673. 0x007d,
  32674. "bracerightBigg",
  32675. 0x007d,
  32676. "bracketleftbig",
  32677. 0x005b,
  32678. "bracketleftBig",
  32679. 0x005b,
  32680. "bracketleftbigg",
  32681. 0x005b,
  32682. "bracketleftBigg",
  32683. 0x005b,
  32684. "bracketrightBig",
  32685. 0x005d,
  32686. "bracketrightbig",
  32687. 0x005d,
  32688. "bracketrightbigg",
  32689. 0x005d,
  32690. "bracketrightBigg",
  32691. 0x005d,
  32692. "ceilingleftbig",
  32693. 0x2308,
  32694. "ceilingleftBig",
  32695. 0x2308,
  32696. "ceilingleftBigg",
  32697. 0x2308,
  32698. "ceilingleftbigg",
  32699. 0x2308,
  32700. "ceilingrightbig",
  32701. 0x2309,
  32702. "ceilingrightBig",
  32703. 0x2309,
  32704. "ceilingrightbigg",
  32705. 0x2309,
  32706. "ceilingrightBigg",
  32707. 0x2309,
  32708. "circledotdisplay",
  32709. 0x2299,
  32710. "circledottext",
  32711. 0x2299,
  32712. "circlemultiplydisplay",
  32713. 0x2297,
  32714. "circlemultiplytext",
  32715. 0x2297,
  32716. "circleplusdisplay",
  32717. 0x2295,
  32718. "circleplustext",
  32719. 0x2295,
  32720. "contintegraldisplay",
  32721. 0x222e,
  32722. "contintegraltext",
  32723. 0x222e,
  32724. "coproductdisplay",
  32725. 0x2210,
  32726. "coproducttext",
  32727. 0x2210,
  32728. "floorleftBig",
  32729. 0x230a,
  32730. "floorleftbig",
  32731. 0x230a,
  32732. "floorleftbigg",
  32733. 0x230a,
  32734. "floorleftBigg",
  32735. 0x230a,
  32736. "floorrightbig",
  32737. 0x230b,
  32738. "floorrightBig",
  32739. 0x230b,
  32740. "floorrightBigg",
  32741. 0x230b,
  32742. "floorrightbigg",
  32743. 0x230b,
  32744. "hatwide",
  32745. 0x0302,
  32746. "hatwider",
  32747. 0x0302,
  32748. "hatwidest",
  32749. 0x0302,
  32750. "intercal",
  32751. 0x1d40,
  32752. "integraldisplay",
  32753. 0x222b,
  32754. "integraltext",
  32755. 0x222b,
  32756. "intersectiondisplay",
  32757. 0x22c2,
  32758. "intersectiontext",
  32759. 0x22c2,
  32760. "logicalanddisplay",
  32761. 0x2227,
  32762. "logicalandtext",
  32763. 0x2227,
  32764. "logicalordisplay",
  32765. 0x2228,
  32766. "logicalortext",
  32767. 0x2228,
  32768. "parenleftBig",
  32769. 0x0028,
  32770. "parenleftbig",
  32771. 0x0028,
  32772. "parenleftBigg",
  32773. 0x0028,
  32774. "parenleftbigg",
  32775. 0x0028,
  32776. "parenrightBig",
  32777. 0x0029,
  32778. "parenrightbig",
  32779. 0x0029,
  32780. "parenrightBigg",
  32781. 0x0029,
  32782. "parenrightbigg",
  32783. 0x0029,
  32784. "prime",
  32785. 0x2032,
  32786. "productdisplay",
  32787. 0x220f,
  32788. "producttext",
  32789. 0x220f,
  32790. "radicalbig",
  32791. 0x221a,
  32792. "radicalBig",
  32793. 0x221a,
  32794. "radicalBigg",
  32795. 0x221a,
  32796. "radicalbigg",
  32797. 0x221a,
  32798. "radicalbt",
  32799. 0x221a,
  32800. "radicaltp",
  32801. 0x221a,
  32802. "radicalvertex",
  32803. 0x221a,
  32804. "slashbig",
  32805. 0x002f,
  32806. "slashBig",
  32807. 0x002f,
  32808. "slashBigg",
  32809. 0x002f,
  32810. "slashbigg",
  32811. 0x002f,
  32812. "summationdisplay",
  32813. 0x2211,
  32814. "summationtext",
  32815. 0x2211,
  32816. "tildewide",
  32817. 0x02dc,
  32818. "tildewider",
  32819. 0x02dc,
  32820. "tildewidest",
  32821. 0x02dc,
  32822. "uniondisplay",
  32823. 0x22c3,
  32824. "unionmultidisplay",
  32825. 0x228e,
  32826. "unionmultitext",
  32827. 0x228e,
  32828. "unionsqdisplay",
  32829. 0x2294,
  32830. "unionsqtext",
  32831. 0x2294,
  32832. "uniontext",
  32833. 0x22c3,
  32834. "vextenddouble",
  32835. 0x2225,
  32836. "vextendsingle",
  32837. 0x2223
  32838. ];
  32839. });
  32840. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  32841. return [
  32842. "space",
  32843. 0x0020,
  32844. "a1",
  32845. 0x2701,
  32846. "a2",
  32847. 0x2702,
  32848. "a202",
  32849. 0x2703,
  32850. "a3",
  32851. 0x2704,
  32852. "a4",
  32853. 0x260e,
  32854. "a5",
  32855. 0x2706,
  32856. "a119",
  32857. 0x2707,
  32858. "a118",
  32859. 0x2708,
  32860. "a117",
  32861. 0x2709,
  32862. "a11",
  32863. 0x261b,
  32864. "a12",
  32865. 0x261e,
  32866. "a13",
  32867. 0x270c,
  32868. "a14",
  32869. 0x270d,
  32870. "a15",
  32871. 0x270e,
  32872. "a16",
  32873. 0x270f,
  32874. "a105",
  32875. 0x2710,
  32876. "a17",
  32877. 0x2711,
  32878. "a18",
  32879. 0x2712,
  32880. "a19",
  32881. 0x2713,
  32882. "a20",
  32883. 0x2714,
  32884. "a21",
  32885. 0x2715,
  32886. "a22",
  32887. 0x2716,
  32888. "a23",
  32889. 0x2717,
  32890. "a24",
  32891. 0x2718,
  32892. "a25",
  32893. 0x2719,
  32894. "a26",
  32895. 0x271a,
  32896. "a27",
  32897. 0x271b,
  32898. "a28",
  32899. 0x271c,
  32900. "a6",
  32901. 0x271d,
  32902. "a7",
  32903. 0x271e,
  32904. "a8",
  32905. 0x271f,
  32906. "a9",
  32907. 0x2720,
  32908. "a10",
  32909. 0x2721,
  32910. "a29",
  32911. 0x2722,
  32912. "a30",
  32913. 0x2723,
  32914. "a31",
  32915. 0x2724,
  32916. "a32",
  32917. 0x2725,
  32918. "a33",
  32919. 0x2726,
  32920. "a34",
  32921. 0x2727,
  32922. "a35",
  32923. 0x2605,
  32924. "a36",
  32925. 0x2729,
  32926. "a37",
  32927. 0x272a,
  32928. "a38",
  32929. 0x272b,
  32930. "a39",
  32931. 0x272c,
  32932. "a40",
  32933. 0x272d,
  32934. "a41",
  32935. 0x272e,
  32936. "a42",
  32937. 0x272f,
  32938. "a43",
  32939. 0x2730,
  32940. "a44",
  32941. 0x2731,
  32942. "a45",
  32943. 0x2732,
  32944. "a46",
  32945. 0x2733,
  32946. "a47",
  32947. 0x2734,
  32948. "a48",
  32949. 0x2735,
  32950. "a49",
  32951. 0x2736,
  32952. "a50",
  32953. 0x2737,
  32954. "a51",
  32955. 0x2738,
  32956. "a52",
  32957. 0x2739,
  32958. "a53",
  32959. 0x273a,
  32960. "a54",
  32961. 0x273b,
  32962. "a55",
  32963. 0x273c,
  32964. "a56",
  32965. 0x273d,
  32966. "a57",
  32967. 0x273e,
  32968. "a58",
  32969. 0x273f,
  32970. "a59",
  32971. 0x2740,
  32972. "a60",
  32973. 0x2741,
  32974. "a61",
  32975. 0x2742,
  32976. "a62",
  32977. 0x2743,
  32978. "a63",
  32979. 0x2744,
  32980. "a64",
  32981. 0x2745,
  32982. "a65",
  32983. 0x2746,
  32984. "a66",
  32985. 0x2747,
  32986. "a67",
  32987. 0x2748,
  32988. "a68",
  32989. 0x2749,
  32990. "a69",
  32991. 0x274a,
  32992. "a70",
  32993. 0x274b,
  32994. "a71",
  32995. 0x25cf,
  32996. "a72",
  32997. 0x274d,
  32998. "a73",
  32999. 0x25a0,
  33000. "a74",
  33001. 0x274f,
  33002. "a203",
  33003. 0x2750,
  33004. "a75",
  33005. 0x2751,
  33006. "a204",
  33007. 0x2752,
  33008. "a76",
  33009. 0x25b2,
  33010. "a77",
  33011. 0x25bc,
  33012. "a78",
  33013. 0x25c6,
  33014. "a79",
  33015. 0x2756,
  33016. "a81",
  33017. 0x25d7,
  33018. "a82",
  33019. 0x2758,
  33020. "a83",
  33021. 0x2759,
  33022. "a84",
  33023. 0x275a,
  33024. "a97",
  33025. 0x275b,
  33026. "a98",
  33027. 0x275c,
  33028. "a99",
  33029. 0x275d,
  33030. "a100",
  33031. 0x275e,
  33032. "a101",
  33033. 0x2761,
  33034. "a102",
  33035. 0x2762,
  33036. "a103",
  33037. 0x2763,
  33038. "a104",
  33039. 0x2764,
  33040. "a106",
  33041. 0x2765,
  33042. "a107",
  33043. 0x2766,
  33044. "a108",
  33045. 0x2767,
  33046. "a112",
  33047. 0x2663,
  33048. "a111",
  33049. 0x2666,
  33050. "a110",
  33051. 0x2665,
  33052. "a109",
  33053. 0x2660,
  33054. "a120",
  33055. 0x2460,
  33056. "a121",
  33057. 0x2461,
  33058. "a122",
  33059. 0x2462,
  33060. "a123",
  33061. 0x2463,
  33062. "a124",
  33063. 0x2464,
  33064. "a125",
  33065. 0x2465,
  33066. "a126",
  33067. 0x2466,
  33068. "a127",
  33069. 0x2467,
  33070. "a128",
  33071. 0x2468,
  33072. "a129",
  33073. 0x2469,
  33074. "a130",
  33075. 0x2776,
  33076. "a131",
  33077. 0x2777,
  33078. "a132",
  33079. 0x2778,
  33080. "a133",
  33081. 0x2779,
  33082. "a134",
  33083. 0x277a,
  33084. "a135",
  33085. 0x277b,
  33086. "a136",
  33087. 0x277c,
  33088. "a137",
  33089. 0x277d,
  33090. "a138",
  33091. 0x277e,
  33092. "a139",
  33093. 0x277f,
  33094. "a140",
  33095. 0x2780,
  33096. "a141",
  33097. 0x2781,
  33098. "a142",
  33099. 0x2782,
  33100. "a143",
  33101. 0x2783,
  33102. "a144",
  33103. 0x2784,
  33104. "a145",
  33105. 0x2785,
  33106. "a146",
  33107. 0x2786,
  33108. "a147",
  33109. 0x2787,
  33110. "a148",
  33111. 0x2788,
  33112. "a149",
  33113. 0x2789,
  33114. "a150",
  33115. 0x278a,
  33116. "a151",
  33117. 0x278b,
  33118. "a152",
  33119. 0x278c,
  33120. "a153",
  33121. 0x278d,
  33122. "a154",
  33123. 0x278e,
  33124. "a155",
  33125. 0x278f,
  33126. "a156",
  33127. 0x2790,
  33128. "a157",
  33129. 0x2791,
  33130. "a158",
  33131. 0x2792,
  33132. "a159",
  33133. 0x2793,
  33134. "a160",
  33135. 0x2794,
  33136. "a161",
  33137. 0x2192,
  33138. "a163",
  33139. 0x2194,
  33140. "a164",
  33141. 0x2195,
  33142. "a196",
  33143. 0x2798,
  33144. "a165",
  33145. 0x2799,
  33146. "a192",
  33147. 0x279a,
  33148. "a166",
  33149. 0x279b,
  33150. "a167",
  33151. 0x279c,
  33152. "a168",
  33153. 0x279d,
  33154. "a169",
  33155. 0x279e,
  33156. "a170",
  33157. 0x279f,
  33158. "a171",
  33159. 0x27a0,
  33160. "a172",
  33161. 0x27a1,
  33162. "a173",
  33163. 0x27a2,
  33164. "a162",
  33165. 0x27a3,
  33166. "a174",
  33167. 0x27a4,
  33168. "a175",
  33169. 0x27a5,
  33170. "a176",
  33171. 0x27a6,
  33172. "a177",
  33173. 0x27a7,
  33174. "a178",
  33175. 0x27a8,
  33176. "a179",
  33177. 0x27a9,
  33178. "a193",
  33179. 0x27aa,
  33180. "a180",
  33181. 0x27ab,
  33182. "a199",
  33183. 0x27ac,
  33184. "a181",
  33185. 0x27ad,
  33186. "a200",
  33187. 0x27ae,
  33188. "a182",
  33189. 0x27af,
  33190. "a201",
  33191. 0x27b1,
  33192. "a183",
  33193. 0x27b2,
  33194. "a184",
  33195. 0x27b3,
  33196. "a197",
  33197. 0x27b4,
  33198. "a185",
  33199. 0x27b5,
  33200. "a194",
  33201. 0x27b6,
  33202. "a198",
  33203. 0x27b7,
  33204. "a186",
  33205. 0x27b8,
  33206. "a195",
  33207. 0x27b9,
  33208. "a187",
  33209. 0x27ba,
  33210. "a188",
  33211. 0x27bb,
  33212. "a189",
  33213. 0x27bc,
  33214. "a190",
  33215. 0x27bd,
  33216. "a191",
  33217. 0x27be,
  33218. "a89",
  33219. 0x2768,
  33220. "a90",
  33221. 0x2769,
  33222. "a93",
  33223. 0x276a,
  33224. "a94",
  33225. 0x276b,
  33226. "a91",
  33227. 0x276c,
  33228. "a92",
  33229. 0x276d,
  33230. "a205",
  33231. 0x276e,
  33232. "a85",
  33233. 0x276f,
  33234. "a206",
  33235. 0x2770,
  33236. "a86",
  33237. 0x2771,
  33238. "a87",
  33239. 0x2772,
  33240. "a88",
  33241. 0x2773,
  33242. "a95",
  33243. 0x2774,
  33244. "a96",
  33245. 0x2775,
  33246. ".notdef",
  33247. 0x0000
  33248. ];
  33249. });
  33250. /***/ }),
  33251. /* 38 */
  33252. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  33253. __w_pdfjs_require__.r(__webpack_exports__);
  33254. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  33255. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  33256. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  33257. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  33258. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  33259. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  33260. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  33261. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  33262. /* harmony export */ });
  33263. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  33264. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  33265. t[63721] = 0x00a9;
  33266. t[63193] = 0x00a9;
  33267. t[63720] = 0x00ae;
  33268. t[63194] = 0x00ae;
  33269. t[63722] = 0x2122;
  33270. t[63195] = 0x2122;
  33271. t[63729] = 0x23a7;
  33272. t[63730] = 0x23a8;
  33273. t[63731] = 0x23a9;
  33274. t[63740] = 0x23ab;
  33275. t[63741] = 0x23ac;
  33276. t[63742] = 0x23ad;
  33277. t[63726] = 0x23a1;
  33278. t[63727] = 0x23a2;
  33279. t[63728] = 0x23a3;
  33280. t[63737] = 0x23a4;
  33281. t[63738] = 0x23a5;
  33282. t[63739] = 0x23a6;
  33283. t[63723] = 0x239b;
  33284. t[63724] = 0x239c;
  33285. t[63725] = 0x239d;
  33286. t[63734] = 0x239e;
  33287. t[63735] = 0x239f;
  33288. t[63736] = 0x23a0;
  33289. });
  33290. function mapSpecialUnicodeValues(code) {
  33291. if (code >= 0xfff0 && code <= 0xffff) {
  33292. return 0;
  33293. } else if (code >= 0xf600 && code <= 0xf8ff) {
  33294. return getSpecialPUASymbols()[code] || code;
  33295. } else if (code === 0x00ad) {
  33296. return 0x002d;
  33297. }
  33298. return code;
  33299. }
  33300. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33301. let unicode = glyphsUnicodeMap[name];
  33302. if (unicode !== undefined) {
  33303. return unicode;
  33304. }
  33305. if (!name) {
  33306. return -1;
  33307. }
  33308. if (name[0] === "u") {
  33309. const nameLen = name.length;
  33310. let hexStr;
  33311. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  33312. hexStr = name.substring(3);
  33313. } else if (nameLen >= 5 && nameLen <= 7) {
  33314. hexStr = name.substring(1);
  33315. } else {
  33316. return -1;
  33317. }
  33318. if (hexStr === hexStr.toUpperCase()) {
  33319. unicode = parseInt(hexStr, 16);
  33320. if (unicode >= 0) {
  33321. return unicode;
  33322. }
  33323. }
  33324. }
  33325. return -1;
  33326. }
  33327. const UnicodeRanges = [
  33328. {
  33329. begin: 0x0000,
  33330. end: 0x007f
  33331. },
  33332. {
  33333. begin: 0x0080,
  33334. end: 0x00ff
  33335. },
  33336. {
  33337. begin: 0x0100,
  33338. end: 0x017f
  33339. },
  33340. {
  33341. begin: 0x0180,
  33342. end: 0x024f
  33343. },
  33344. {
  33345. begin: 0x0250,
  33346. end: 0x02af
  33347. },
  33348. {
  33349. begin: 0x02b0,
  33350. end: 0x02ff
  33351. },
  33352. {
  33353. begin: 0x0300,
  33354. end: 0x036f
  33355. },
  33356. {
  33357. begin: 0x0370,
  33358. end: 0x03ff
  33359. },
  33360. {
  33361. begin: 0x2c80,
  33362. end: 0x2cff
  33363. },
  33364. {
  33365. begin: 0x0400,
  33366. end: 0x04ff
  33367. },
  33368. {
  33369. begin: 0x0530,
  33370. end: 0x058f
  33371. },
  33372. {
  33373. begin: 0x0590,
  33374. end: 0x05ff
  33375. },
  33376. {
  33377. begin: 0xa500,
  33378. end: 0xa63f
  33379. },
  33380. {
  33381. begin: 0x0600,
  33382. end: 0x06ff
  33383. },
  33384. {
  33385. begin: 0x07c0,
  33386. end: 0x07ff
  33387. },
  33388. {
  33389. begin: 0x0900,
  33390. end: 0x097f
  33391. },
  33392. {
  33393. begin: 0x0980,
  33394. end: 0x09ff
  33395. },
  33396. {
  33397. begin: 0x0a00,
  33398. end: 0x0a7f
  33399. },
  33400. {
  33401. begin: 0x0a80,
  33402. end: 0x0aff
  33403. },
  33404. {
  33405. begin: 0x0b00,
  33406. end: 0x0b7f
  33407. },
  33408. {
  33409. begin: 0x0b80,
  33410. end: 0x0bff
  33411. },
  33412. {
  33413. begin: 0x0c00,
  33414. end: 0x0c7f
  33415. },
  33416. {
  33417. begin: 0x0c80,
  33418. end: 0x0cff
  33419. },
  33420. {
  33421. begin: 0x0d00,
  33422. end: 0x0d7f
  33423. },
  33424. {
  33425. begin: 0x0e00,
  33426. end: 0x0e7f
  33427. },
  33428. {
  33429. begin: 0x0e80,
  33430. end: 0x0eff
  33431. },
  33432. {
  33433. begin: 0x10a0,
  33434. end: 0x10ff
  33435. },
  33436. {
  33437. begin: 0x1b00,
  33438. end: 0x1b7f
  33439. },
  33440. {
  33441. begin: 0x1100,
  33442. end: 0x11ff
  33443. },
  33444. {
  33445. begin: 0x1e00,
  33446. end: 0x1eff
  33447. },
  33448. {
  33449. begin: 0x1f00,
  33450. end: 0x1fff
  33451. },
  33452. {
  33453. begin: 0x2000,
  33454. end: 0x206f
  33455. },
  33456. {
  33457. begin: 0x2070,
  33458. end: 0x209f
  33459. },
  33460. {
  33461. begin: 0x20a0,
  33462. end: 0x20cf
  33463. },
  33464. {
  33465. begin: 0x20d0,
  33466. end: 0x20ff
  33467. },
  33468. {
  33469. begin: 0x2100,
  33470. end: 0x214f
  33471. },
  33472. {
  33473. begin: 0x2150,
  33474. end: 0x218f
  33475. },
  33476. {
  33477. begin: 0x2190,
  33478. end: 0x21ff
  33479. },
  33480. {
  33481. begin: 0x2200,
  33482. end: 0x22ff
  33483. },
  33484. {
  33485. begin: 0x2300,
  33486. end: 0x23ff
  33487. },
  33488. {
  33489. begin: 0x2400,
  33490. end: 0x243f
  33491. },
  33492. {
  33493. begin: 0x2440,
  33494. end: 0x245f
  33495. },
  33496. {
  33497. begin: 0x2460,
  33498. end: 0x24ff
  33499. },
  33500. {
  33501. begin: 0x2500,
  33502. end: 0x257f
  33503. },
  33504. {
  33505. begin: 0x2580,
  33506. end: 0x259f
  33507. },
  33508. {
  33509. begin: 0x25a0,
  33510. end: 0x25ff
  33511. },
  33512. {
  33513. begin: 0x2600,
  33514. end: 0x26ff
  33515. },
  33516. {
  33517. begin: 0x2700,
  33518. end: 0x27bf
  33519. },
  33520. {
  33521. begin: 0x3000,
  33522. end: 0x303f
  33523. },
  33524. {
  33525. begin: 0x3040,
  33526. end: 0x309f
  33527. },
  33528. {
  33529. begin: 0x30a0,
  33530. end: 0x30ff
  33531. },
  33532. {
  33533. begin: 0x3100,
  33534. end: 0x312f
  33535. },
  33536. {
  33537. begin: 0x3130,
  33538. end: 0x318f
  33539. },
  33540. {
  33541. begin: 0xa840,
  33542. end: 0xa87f
  33543. },
  33544. {
  33545. begin: 0x3200,
  33546. end: 0x32ff
  33547. },
  33548. {
  33549. begin: 0x3300,
  33550. end: 0x33ff
  33551. },
  33552. {
  33553. begin: 0xac00,
  33554. end: 0xd7af
  33555. },
  33556. {
  33557. begin: 0xd800,
  33558. end: 0xdfff
  33559. },
  33560. {
  33561. begin: 0x10900,
  33562. end: 0x1091f
  33563. },
  33564. {
  33565. begin: 0x4e00,
  33566. end: 0x9fff
  33567. },
  33568. {
  33569. begin: 0xe000,
  33570. end: 0xf8ff
  33571. },
  33572. {
  33573. begin: 0x31c0,
  33574. end: 0x31ef
  33575. },
  33576. {
  33577. begin: 0xfb00,
  33578. end: 0xfb4f
  33579. },
  33580. {
  33581. begin: 0xfb50,
  33582. end: 0xfdff
  33583. },
  33584. {
  33585. begin: 0xfe20,
  33586. end: 0xfe2f
  33587. },
  33588. {
  33589. begin: 0xfe10,
  33590. end: 0xfe1f
  33591. },
  33592. {
  33593. begin: 0xfe50,
  33594. end: 0xfe6f
  33595. },
  33596. {
  33597. begin: 0xfe70,
  33598. end: 0xfeff
  33599. },
  33600. {
  33601. begin: 0xff00,
  33602. end: 0xffef
  33603. },
  33604. {
  33605. begin: 0xfff0,
  33606. end: 0xffff
  33607. },
  33608. {
  33609. begin: 0x0f00,
  33610. end: 0x0fff
  33611. },
  33612. {
  33613. begin: 0x0700,
  33614. end: 0x074f
  33615. },
  33616. {
  33617. begin: 0x0780,
  33618. end: 0x07bf
  33619. },
  33620. {
  33621. begin: 0x0d80,
  33622. end: 0x0dff
  33623. },
  33624. {
  33625. begin: 0x1000,
  33626. end: 0x109f
  33627. },
  33628. {
  33629. begin: 0x1200,
  33630. end: 0x137f
  33631. },
  33632. {
  33633. begin: 0x13a0,
  33634. end: 0x13ff
  33635. },
  33636. {
  33637. begin: 0x1400,
  33638. end: 0x167f
  33639. },
  33640. {
  33641. begin: 0x1680,
  33642. end: 0x169f
  33643. },
  33644. {
  33645. begin: 0x16a0,
  33646. end: 0x16ff
  33647. },
  33648. {
  33649. begin: 0x1780,
  33650. end: 0x17ff
  33651. },
  33652. {
  33653. begin: 0x1800,
  33654. end: 0x18af
  33655. },
  33656. {
  33657. begin: 0x2800,
  33658. end: 0x28ff
  33659. },
  33660. {
  33661. begin: 0xa000,
  33662. end: 0xa48f
  33663. },
  33664. {
  33665. begin: 0x1700,
  33666. end: 0x171f
  33667. },
  33668. {
  33669. begin: 0x10300,
  33670. end: 0x1032f
  33671. },
  33672. {
  33673. begin: 0x10330,
  33674. end: 0x1034f
  33675. },
  33676. {
  33677. begin: 0x10400,
  33678. end: 0x1044f
  33679. },
  33680. {
  33681. begin: 0x1d000,
  33682. end: 0x1d0ff
  33683. },
  33684. {
  33685. begin: 0x1d400,
  33686. end: 0x1d7ff
  33687. },
  33688. {
  33689. begin: 0xff000,
  33690. end: 0xffffd
  33691. },
  33692. {
  33693. begin: 0xfe00,
  33694. end: 0xfe0f
  33695. },
  33696. {
  33697. begin: 0xe0000,
  33698. end: 0xe007f
  33699. },
  33700. {
  33701. begin: 0x1900,
  33702. end: 0x194f
  33703. },
  33704. {
  33705. begin: 0x1950,
  33706. end: 0x197f
  33707. },
  33708. {
  33709. begin: 0x1980,
  33710. end: 0x19df
  33711. },
  33712. {
  33713. begin: 0x1a00,
  33714. end: 0x1a1f
  33715. },
  33716. {
  33717. begin: 0x2c00,
  33718. end: 0x2c5f
  33719. },
  33720. {
  33721. begin: 0x2d30,
  33722. end: 0x2d7f
  33723. },
  33724. {
  33725. begin: 0x4dc0,
  33726. end: 0x4dff
  33727. },
  33728. {
  33729. begin: 0xa800,
  33730. end: 0xa82f
  33731. },
  33732. {
  33733. begin: 0x10000,
  33734. end: 0x1007f
  33735. },
  33736. {
  33737. begin: 0x10140,
  33738. end: 0x1018f
  33739. },
  33740. {
  33741. begin: 0x10380,
  33742. end: 0x1039f
  33743. },
  33744. {
  33745. begin: 0x103a0,
  33746. end: 0x103df
  33747. },
  33748. {
  33749. begin: 0x10450,
  33750. end: 0x1047f
  33751. },
  33752. {
  33753. begin: 0x10480,
  33754. end: 0x104af
  33755. },
  33756. {
  33757. begin: 0x10800,
  33758. end: 0x1083f
  33759. },
  33760. {
  33761. begin: 0x10a00,
  33762. end: 0x10a5f
  33763. },
  33764. {
  33765. begin: 0x1d300,
  33766. end: 0x1d35f
  33767. },
  33768. {
  33769. begin: 0x12000,
  33770. end: 0x123ff
  33771. },
  33772. {
  33773. begin: 0x1d360,
  33774. end: 0x1d37f
  33775. },
  33776. {
  33777. begin: 0x1b80,
  33778. end: 0x1bbf
  33779. },
  33780. {
  33781. begin: 0x1c00,
  33782. end: 0x1c4f
  33783. },
  33784. {
  33785. begin: 0x1c50,
  33786. end: 0x1c7f
  33787. },
  33788. {
  33789. begin: 0xa880,
  33790. end: 0xa8df
  33791. },
  33792. {
  33793. begin: 0xa900,
  33794. end: 0xa92f
  33795. },
  33796. {
  33797. begin: 0xa930,
  33798. end: 0xa95f
  33799. },
  33800. {
  33801. begin: 0xaa00,
  33802. end: 0xaa5f
  33803. },
  33804. {
  33805. begin: 0x10190,
  33806. end: 0x101cf
  33807. },
  33808. {
  33809. begin: 0x101d0,
  33810. end: 0x101ff
  33811. },
  33812. {
  33813. begin: 0x102a0,
  33814. end: 0x102df
  33815. },
  33816. {
  33817. begin: 0x1f030,
  33818. end: 0x1f09f
  33819. }
  33820. ];
  33821. function getUnicodeRangeFor(value) {
  33822. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33823. const range = UnicodeRanges[i];
  33824. if (value >= range.begin && value < range.end) {
  33825. return i;
  33826. }
  33827. }
  33828. return -1;
  33829. }
  33830. function isRTLRangeFor(value) {
  33831. let range = UnicodeRanges[13];
  33832. if (value >= range.begin && value < range.end) {
  33833. return true;
  33834. }
  33835. range = UnicodeRanges[11];
  33836. if (value >= range.begin && value < range.end) {
  33837. return true;
  33838. }
  33839. return false;
  33840. }
  33841. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  33842. return [
  33843. "\u00A8",
  33844. "\u0020\u0308",
  33845. "\u00AF",
  33846. "\u0020\u0304",
  33847. "\u00B4",
  33848. "\u0020\u0301",
  33849. "\u00B5",
  33850. "\u03BC",
  33851. "\u00B8",
  33852. "\u0020\u0327",
  33853. "\u0132",
  33854. "\u0049\u004A",
  33855. "\u0133",
  33856. "\u0069\u006A",
  33857. "\u013F",
  33858. "\u004C\u00B7",
  33859. "\u0140",
  33860. "\u006C\u00B7",
  33861. "\u0149",
  33862. "\u02BC\u006E",
  33863. "\u017F",
  33864. "\u0073",
  33865. "\u01C4",
  33866. "\u0044\u017D",
  33867. "\u01C5",
  33868. "\u0044\u017E",
  33869. "\u01C6",
  33870. "\u0064\u017E",
  33871. "\u01C7",
  33872. "\u004C\u004A",
  33873. "\u01C8",
  33874. "\u004C\u006A",
  33875. "\u01C9",
  33876. "\u006C\u006A",
  33877. "\u01CA",
  33878. "\u004E\u004A",
  33879. "\u01CB",
  33880. "\u004E\u006A",
  33881. "\u01CC",
  33882. "\u006E\u006A",
  33883. "\u01F1",
  33884. "\u0044\u005A",
  33885. "\u01F2",
  33886. "\u0044\u007A",
  33887. "\u01F3",
  33888. "\u0064\u007A",
  33889. "\u02D8",
  33890. "\u0020\u0306",
  33891. "\u02D9",
  33892. "\u0020\u0307",
  33893. "\u02DA",
  33894. "\u0020\u030A",
  33895. "\u02DB",
  33896. "\u0020\u0328",
  33897. "\u02DC",
  33898. "\u0020\u0303",
  33899. "\u02DD",
  33900. "\u0020\u030B",
  33901. "\u037A",
  33902. "\u0020\u0345",
  33903. "\u0384",
  33904. "\u0020\u0301",
  33905. "\u03D0",
  33906. "\u03B2",
  33907. "\u03D1",
  33908. "\u03B8",
  33909. "\u03D2",
  33910. "\u03A5",
  33911. "\u03D5",
  33912. "\u03C6",
  33913. "\u03D6",
  33914. "\u03C0",
  33915. "\u03F0",
  33916. "\u03BA",
  33917. "\u03F1",
  33918. "\u03C1",
  33919. "\u03F2",
  33920. "\u03C2",
  33921. "\u03F4",
  33922. "\u0398",
  33923. "\u03F5",
  33924. "\u03B5",
  33925. "\u03F9",
  33926. "\u03A3",
  33927. "\u0587",
  33928. "\u0565\u0582",
  33929. "\u0675",
  33930. "\u0627\u0674",
  33931. "\u0676",
  33932. "\u0648\u0674",
  33933. "\u0677",
  33934. "\u06C7\u0674",
  33935. "\u0678",
  33936. "\u064A\u0674",
  33937. "\u0E33",
  33938. "\u0E4D\u0E32",
  33939. "\u0EB3",
  33940. "\u0ECD\u0EB2",
  33941. "\u0EDC",
  33942. "\u0EAB\u0E99",
  33943. "\u0EDD",
  33944. "\u0EAB\u0EA1",
  33945. "\u0F77",
  33946. "\u0FB2\u0F81",
  33947. "\u0F79",
  33948. "\u0FB3\u0F81",
  33949. "\u1E9A",
  33950. "\u0061\u02BE",
  33951. "\u1FBD",
  33952. "\u0020\u0313",
  33953. "\u1FBF",
  33954. "\u0020\u0313",
  33955. "\u1FC0",
  33956. "\u0020\u0342",
  33957. "\u1FFE",
  33958. "\u0020\u0314",
  33959. "\u2002",
  33960. "\u0020",
  33961. "\u2003",
  33962. "\u0020",
  33963. "\u2004",
  33964. "\u0020",
  33965. "\u2005",
  33966. "\u0020",
  33967. "\u2006",
  33968. "\u0020",
  33969. "\u2008",
  33970. "\u0020",
  33971. "\u2009",
  33972. "\u0020",
  33973. "\u200A",
  33974. "\u0020",
  33975. "\u2017",
  33976. "\u0020\u0333",
  33977. "\u2024",
  33978. "\u002E",
  33979. "\u2025",
  33980. "\u002E\u002E",
  33981. "\u2026",
  33982. "\u002E\u002E\u002E",
  33983. "\u2033",
  33984. "\u2032\u2032",
  33985. "\u2034",
  33986. "\u2032\u2032\u2032",
  33987. "\u2036",
  33988. "\u2035\u2035",
  33989. "\u2037",
  33990. "\u2035\u2035\u2035",
  33991. "\u203C",
  33992. "\u0021\u0021",
  33993. "\u203E",
  33994. "\u0020\u0305",
  33995. "\u2047",
  33996. "\u003F\u003F",
  33997. "\u2048",
  33998. "\u003F\u0021",
  33999. "\u2049",
  34000. "\u0021\u003F",
  34001. "\u2057",
  34002. "\u2032\u2032\u2032\u2032",
  34003. "\u205F",
  34004. "\u0020",
  34005. "\u20A8",
  34006. "\u0052\u0073",
  34007. "\u2100",
  34008. "\u0061\u002F\u0063",
  34009. "\u2101",
  34010. "\u0061\u002F\u0073",
  34011. "\u2103",
  34012. "\u00B0\u0043",
  34013. "\u2105",
  34014. "\u0063\u002F\u006F",
  34015. "\u2106",
  34016. "\u0063\u002F\u0075",
  34017. "\u2107",
  34018. "\u0190",
  34019. "\u2109",
  34020. "\u00B0\u0046",
  34021. "\u2116",
  34022. "\u004E\u006F",
  34023. "\u2121",
  34024. "\u0054\u0045\u004C",
  34025. "\u2135",
  34026. "\u05D0",
  34027. "\u2136",
  34028. "\u05D1",
  34029. "\u2137",
  34030. "\u05D2",
  34031. "\u2138",
  34032. "\u05D3",
  34033. "\u213B",
  34034. "\u0046\u0041\u0058",
  34035. "\u2160",
  34036. "\u0049",
  34037. "\u2161",
  34038. "\u0049\u0049",
  34039. "\u2162",
  34040. "\u0049\u0049\u0049",
  34041. "\u2163",
  34042. "\u0049\u0056",
  34043. "\u2164",
  34044. "\u0056",
  34045. "\u2165",
  34046. "\u0056\u0049",
  34047. "\u2166",
  34048. "\u0056\u0049\u0049",
  34049. "\u2167",
  34050. "\u0056\u0049\u0049\u0049",
  34051. "\u2168",
  34052. "\u0049\u0058",
  34053. "\u2169",
  34054. "\u0058",
  34055. "\u216A",
  34056. "\u0058\u0049",
  34057. "\u216B",
  34058. "\u0058\u0049\u0049",
  34059. "\u216C",
  34060. "\u004C",
  34061. "\u216D",
  34062. "\u0043",
  34063. "\u216E",
  34064. "\u0044",
  34065. "\u216F",
  34066. "\u004D",
  34067. "\u2170",
  34068. "\u0069",
  34069. "\u2171",
  34070. "\u0069\u0069",
  34071. "\u2172",
  34072. "\u0069\u0069\u0069",
  34073. "\u2173",
  34074. "\u0069\u0076",
  34075. "\u2174",
  34076. "\u0076",
  34077. "\u2175",
  34078. "\u0076\u0069",
  34079. "\u2176",
  34080. "\u0076\u0069\u0069",
  34081. "\u2177",
  34082. "\u0076\u0069\u0069\u0069",
  34083. "\u2178",
  34084. "\u0069\u0078",
  34085. "\u2179",
  34086. "\u0078",
  34087. "\u217A",
  34088. "\u0078\u0069",
  34089. "\u217B",
  34090. "\u0078\u0069\u0069",
  34091. "\u217C",
  34092. "\u006C",
  34093. "\u217D",
  34094. "\u0063",
  34095. "\u217E",
  34096. "\u0064",
  34097. "\u217F",
  34098. "\u006D",
  34099. "\u222C",
  34100. "\u222B\u222B",
  34101. "\u222D",
  34102. "\u222B\u222B\u222B",
  34103. "\u222F",
  34104. "\u222E\u222E",
  34105. "\u2230",
  34106. "\u222E\u222E\u222E",
  34107. "\u2474",
  34108. "\u0028\u0031\u0029",
  34109. "\u2475",
  34110. "\u0028\u0032\u0029",
  34111. "\u2476",
  34112. "\u0028\u0033\u0029",
  34113. "\u2477",
  34114. "\u0028\u0034\u0029",
  34115. "\u2478",
  34116. "\u0028\u0035\u0029",
  34117. "\u2479",
  34118. "\u0028\u0036\u0029",
  34119. "\u247A",
  34120. "\u0028\u0037\u0029",
  34121. "\u247B",
  34122. "\u0028\u0038\u0029",
  34123. "\u247C",
  34124. "\u0028\u0039\u0029",
  34125. "\u247D",
  34126. "\u0028\u0031\u0030\u0029",
  34127. "\u247E",
  34128. "\u0028\u0031\u0031\u0029",
  34129. "\u247F",
  34130. "\u0028\u0031\u0032\u0029",
  34131. "\u2480",
  34132. "\u0028\u0031\u0033\u0029",
  34133. "\u2481",
  34134. "\u0028\u0031\u0034\u0029",
  34135. "\u2482",
  34136. "\u0028\u0031\u0035\u0029",
  34137. "\u2483",
  34138. "\u0028\u0031\u0036\u0029",
  34139. "\u2484",
  34140. "\u0028\u0031\u0037\u0029",
  34141. "\u2485",
  34142. "\u0028\u0031\u0038\u0029",
  34143. "\u2486",
  34144. "\u0028\u0031\u0039\u0029",
  34145. "\u2487",
  34146. "\u0028\u0032\u0030\u0029",
  34147. "\u2488",
  34148. "\u0031\u002E",
  34149. "\u2489",
  34150. "\u0032\u002E",
  34151. "\u248A",
  34152. "\u0033\u002E",
  34153. "\u248B",
  34154. "\u0034\u002E",
  34155. "\u248C",
  34156. "\u0035\u002E",
  34157. "\u248D",
  34158. "\u0036\u002E",
  34159. "\u248E",
  34160. "\u0037\u002E",
  34161. "\u248F",
  34162. "\u0038\u002E",
  34163. "\u2490",
  34164. "\u0039\u002E",
  34165. "\u2491",
  34166. "\u0031\u0030\u002E",
  34167. "\u2492",
  34168. "\u0031\u0031\u002E",
  34169. "\u2493",
  34170. "\u0031\u0032\u002E",
  34171. "\u2494",
  34172. "\u0031\u0033\u002E",
  34173. "\u2495",
  34174. "\u0031\u0034\u002E",
  34175. "\u2496",
  34176. "\u0031\u0035\u002E",
  34177. "\u2497",
  34178. "\u0031\u0036\u002E",
  34179. "\u2498",
  34180. "\u0031\u0037\u002E",
  34181. "\u2499",
  34182. "\u0031\u0038\u002E",
  34183. "\u249A",
  34184. "\u0031\u0039\u002E",
  34185. "\u249B",
  34186. "\u0032\u0030\u002E",
  34187. "\u249C",
  34188. "\u0028\u0061\u0029",
  34189. "\u249D",
  34190. "\u0028\u0062\u0029",
  34191. "\u249E",
  34192. "\u0028\u0063\u0029",
  34193. "\u249F",
  34194. "\u0028\u0064\u0029",
  34195. "\u24A0",
  34196. "\u0028\u0065\u0029",
  34197. "\u24A1",
  34198. "\u0028\u0066\u0029",
  34199. "\u24A2",
  34200. "\u0028\u0067\u0029",
  34201. "\u24A3",
  34202. "\u0028\u0068\u0029",
  34203. "\u24A4",
  34204. "\u0028\u0069\u0029",
  34205. "\u24A5",
  34206. "\u0028\u006A\u0029",
  34207. "\u24A6",
  34208. "\u0028\u006B\u0029",
  34209. "\u24A7",
  34210. "\u0028\u006C\u0029",
  34211. "\u24A8",
  34212. "\u0028\u006D\u0029",
  34213. "\u24A9",
  34214. "\u0028\u006E\u0029",
  34215. "\u24AA",
  34216. "\u0028\u006F\u0029",
  34217. "\u24AB",
  34218. "\u0028\u0070\u0029",
  34219. "\u24AC",
  34220. "\u0028\u0071\u0029",
  34221. "\u24AD",
  34222. "\u0028\u0072\u0029",
  34223. "\u24AE",
  34224. "\u0028\u0073\u0029",
  34225. "\u24AF",
  34226. "\u0028\u0074\u0029",
  34227. "\u24B0",
  34228. "\u0028\u0075\u0029",
  34229. "\u24B1",
  34230. "\u0028\u0076\u0029",
  34231. "\u24B2",
  34232. "\u0028\u0077\u0029",
  34233. "\u24B3",
  34234. "\u0028\u0078\u0029",
  34235. "\u24B4",
  34236. "\u0028\u0079\u0029",
  34237. "\u24B5",
  34238. "\u0028\u007A\u0029",
  34239. "\u2A0C",
  34240. "\u222B\u222B\u222B\u222B",
  34241. "\u2A74",
  34242. "\u003A\u003A\u003D",
  34243. "\u2A75",
  34244. "\u003D\u003D",
  34245. "\u2A76",
  34246. "\u003D\u003D\u003D",
  34247. "\u2E9F",
  34248. "\u6BCD",
  34249. "\u2EF3",
  34250. "\u9F9F",
  34251. "\u2F00",
  34252. "\u4E00",
  34253. "\u2F01",
  34254. "\u4E28",
  34255. "\u2F02",
  34256. "\u4E36",
  34257. "\u2F03",
  34258. "\u4E3F",
  34259. "\u2F04",
  34260. "\u4E59",
  34261. "\u2F05",
  34262. "\u4E85",
  34263. "\u2F06",
  34264. "\u4E8C",
  34265. "\u2F07",
  34266. "\u4EA0",
  34267. "\u2F08",
  34268. "\u4EBA",
  34269. "\u2F09",
  34270. "\u513F",
  34271. "\u2F0A",
  34272. "\u5165",
  34273. "\u2F0B",
  34274. "\u516B",
  34275. "\u2F0C",
  34276. "\u5182",
  34277. "\u2F0D",
  34278. "\u5196",
  34279. "\u2F0E",
  34280. "\u51AB",
  34281. "\u2F0F",
  34282. "\u51E0",
  34283. "\u2F10",
  34284. "\u51F5",
  34285. "\u2F11",
  34286. "\u5200",
  34287. "\u2F12",
  34288. "\u529B",
  34289. "\u2F13",
  34290. "\u52F9",
  34291. "\u2F14",
  34292. "\u5315",
  34293. "\u2F15",
  34294. "\u531A",
  34295. "\u2F16",
  34296. "\u5338",
  34297. "\u2F17",
  34298. "\u5341",
  34299. "\u2F18",
  34300. "\u535C",
  34301. "\u2F19",
  34302. "\u5369",
  34303. "\u2F1A",
  34304. "\u5382",
  34305. "\u2F1B",
  34306. "\u53B6",
  34307. "\u2F1C",
  34308. "\u53C8",
  34309. "\u2F1D",
  34310. "\u53E3",
  34311. "\u2F1E",
  34312. "\u56D7",
  34313. "\u2F1F",
  34314. "\u571F",
  34315. "\u2F20",
  34316. "\u58EB",
  34317. "\u2F21",
  34318. "\u5902",
  34319. "\u2F22",
  34320. "\u590A",
  34321. "\u2F23",
  34322. "\u5915",
  34323. "\u2F24",
  34324. "\u5927",
  34325. "\u2F25",
  34326. "\u5973",
  34327. "\u2F26",
  34328. "\u5B50",
  34329. "\u2F27",
  34330. "\u5B80",
  34331. "\u2F28",
  34332. "\u5BF8",
  34333. "\u2F29",
  34334. "\u5C0F",
  34335. "\u2F2A",
  34336. "\u5C22",
  34337. "\u2F2B",
  34338. "\u5C38",
  34339. "\u2F2C",
  34340. "\u5C6E",
  34341. "\u2F2D",
  34342. "\u5C71",
  34343. "\u2F2E",
  34344. "\u5DDB",
  34345. "\u2F2F",
  34346. "\u5DE5",
  34347. "\u2F30",
  34348. "\u5DF1",
  34349. "\u2F31",
  34350. "\u5DFE",
  34351. "\u2F32",
  34352. "\u5E72",
  34353. "\u2F33",
  34354. "\u5E7A",
  34355. "\u2F34",
  34356. "\u5E7F",
  34357. "\u2F35",
  34358. "\u5EF4",
  34359. "\u2F36",
  34360. "\u5EFE",
  34361. "\u2F37",
  34362. "\u5F0B",
  34363. "\u2F38",
  34364. "\u5F13",
  34365. "\u2F39",
  34366. "\u5F50",
  34367. "\u2F3A",
  34368. "\u5F61",
  34369. "\u2F3B",
  34370. "\u5F73",
  34371. "\u2F3C",
  34372. "\u5FC3",
  34373. "\u2F3D",
  34374. "\u6208",
  34375. "\u2F3E",
  34376. "\u6236",
  34377. "\u2F3F",
  34378. "\u624B",
  34379. "\u2F40",
  34380. "\u652F",
  34381. "\u2F41",
  34382. "\u6534",
  34383. "\u2F42",
  34384. "\u6587",
  34385. "\u2F43",
  34386. "\u6597",
  34387. "\u2F44",
  34388. "\u65A4",
  34389. "\u2F45",
  34390. "\u65B9",
  34391. "\u2F46",
  34392. "\u65E0",
  34393. "\u2F47",
  34394. "\u65E5",
  34395. "\u2F48",
  34396. "\u66F0",
  34397. "\u2F49",
  34398. "\u6708",
  34399. "\u2F4A",
  34400. "\u6728",
  34401. "\u2F4B",
  34402. "\u6B20",
  34403. "\u2F4C",
  34404. "\u6B62",
  34405. "\u2F4D",
  34406. "\u6B79",
  34407. "\u2F4E",
  34408. "\u6BB3",
  34409. "\u2F4F",
  34410. "\u6BCB",
  34411. "\u2F50",
  34412. "\u6BD4",
  34413. "\u2F51",
  34414. "\u6BDB",
  34415. "\u2F52",
  34416. "\u6C0F",
  34417. "\u2F53",
  34418. "\u6C14",
  34419. "\u2F54",
  34420. "\u6C34",
  34421. "\u2F55",
  34422. "\u706B",
  34423. "\u2F56",
  34424. "\u722A",
  34425. "\u2F57",
  34426. "\u7236",
  34427. "\u2F58",
  34428. "\u723B",
  34429. "\u2F59",
  34430. "\u723F",
  34431. "\u2F5A",
  34432. "\u7247",
  34433. "\u2F5B",
  34434. "\u7259",
  34435. "\u2F5C",
  34436. "\u725B",
  34437. "\u2F5D",
  34438. "\u72AC",
  34439. "\u2F5E",
  34440. "\u7384",
  34441. "\u2F5F",
  34442. "\u7389",
  34443. "\u2F60",
  34444. "\u74DC",
  34445. "\u2F61",
  34446. "\u74E6",
  34447. "\u2F62",
  34448. "\u7518",
  34449. "\u2F63",
  34450. "\u751F",
  34451. "\u2F64",
  34452. "\u7528",
  34453. "\u2F65",
  34454. "\u7530",
  34455. "\u2F66",
  34456. "\u758B",
  34457. "\u2F67",
  34458. "\u7592",
  34459. "\u2F68",
  34460. "\u7676",
  34461. "\u2F69",
  34462. "\u767D",
  34463. "\u2F6A",
  34464. "\u76AE",
  34465. "\u2F6B",
  34466. "\u76BF",
  34467. "\u2F6C",
  34468. "\u76EE",
  34469. "\u2F6D",
  34470. "\u77DB",
  34471. "\u2F6E",
  34472. "\u77E2",
  34473. "\u2F6F",
  34474. "\u77F3",
  34475. "\u2F70",
  34476. "\u793A",
  34477. "\u2F71",
  34478. "\u79B8",
  34479. "\u2F72",
  34480. "\u79BE",
  34481. "\u2F73",
  34482. "\u7A74",
  34483. "\u2F74",
  34484. "\u7ACB",
  34485. "\u2F75",
  34486. "\u7AF9",
  34487. "\u2F76",
  34488. "\u7C73",
  34489. "\u2F77",
  34490. "\u7CF8",
  34491. "\u2F78",
  34492. "\u7F36",
  34493. "\u2F79",
  34494. "\u7F51",
  34495. "\u2F7A",
  34496. "\u7F8A",
  34497. "\u2F7B",
  34498. "\u7FBD",
  34499. "\u2F7C",
  34500. "\u8001",
  34501. "\u2F7D",
  34502. "\u800C",
  34503. "\u2F7E",
  34504. "\u8012",
  34505. "\u2F7F",
  34506. "\u8033",
  34507. "\u2F80",
  34508. "\u807F",
  34509. "\u2F81",
  34510. "\u8089",
  34511. "\u2F82",
  34512. "\u81E3",
  34513. "\u2F83",
  34514. "\u81EA",
  34515. "\u2F84",
  34516. "\u81F3",
  34517. "\u2F85",
  34518. "\u81FC",
  34519. "\u2F86",
  34520. "\u820C",
  34521. "\u2F87",
  34522. "\u821B",
  34523. "\u2F88",
  34524. "\u821F",
  34525. "\u2F89",
  34526. "\u826E",
  34527. "\u2F8A",
  34528. "\u8272",
  34529. "\u2F8B",
  34530. "\u8278",
  34531. "\u2F8C",
  34532. "\u864D",
  34533. "\u2F8D",
  34534. "\u866B",
  34535. "\u2F8E",
  34536. "\u8840",
  34537. "\u2F8F",
  34538. "\u884C",
  34539. "\u2F90",
  34540. "\u8863",
  34541. "\u2F91",
  34542. "\u897E",
  34543. "\u2F92",
  34544. "\u898B",
  34545. "\u2F93",
  34546. "\u89D2",
  34547. "\u2F94",
  34548. "\u8A00",
  34549. "\u2F95",
  34550. "\u8C37",
  34551. "\u2F96",
  34552. "\u8C46",
  34553. "\u2F97",
  34554. "\u8C55",
  34555. "\u2F98",
  34556. "\u8C78",
  34557. "\u2F99",
  34558. "\u8C9D",
  34559. "\u2F9A",
  34560. "\u8D64",
  34561. "\u2F9B",
  34562. "\u8D70",
  34563. "\u2F9C",
  34564. "\u8DB3",
  34565. "\u2F9D",
  34566. "\u8EAB",
  34567. "\u2F9E",
  34568. "\u8ECA",
  34569. "\u2F9F",
  34570. "\u8F9B",
  34571. "\u2FA0",
  34572. "\u8FB0",
  34573. "\u2FA1",
  34574. "\u8FB5",
  34575. "\u2FA2",
  34576. "\u9091",
  34577. "\u2FA3",
  34578. "\u9149",
  34579. "\u2FA4",
  34580. "\u91C6",
  34581. "\u2FA5",
  34582. "\u91CC",
  34583. "\u2FA6",
  34584. "\u91D1",
  34585. "\u2FA7",
  34586. "\u9577",
  34587. "\u2FA8",
  34588. "\u9580",
  34589. "\u2FA9",
  34590. "\u961C",
  34591. "\u2FAA",
  34592. "\u96B6",
  34593. "\u2FAB",
  34594. "\u96B9",
  34595. "\u2FAC",
  34596. "\u96E8",
  34597. "\u2FAD",
  34598. "\u9751",
  34599. "\u2FAE",
  34600. "\u975E",
  34601. "\u2FAF",
  34602. "\u9762",
  34603. "\u2FB0",
  34604. "\u9769",
  34605. "\u2FB1",
  34606. "\u97CB",
  34607. "\u2FB2",
  34608. "\u97ED",
  34609. "\u2FB3",
  34610. "\u97F3",
  34611. "\u2FB4",
  34612. "\u9801",
  34613. "\u2FB5",
  34614. "\u98A8",
  34615. "\u2FB6",
  34616. "\u98DB",
  34617. "\u2FB7",
  34618. "\u98DF",
  34619. "\u2FB8",
  34620. "\u9996",
  34621. "\u2FB9",
  34622. "\u9999",
  34623. "\u2FBA",
  34624. "\u99AC",
  34625. "\u2FBB",
  34626. "\u9AA8",
  34627. "\u2FBC",
  34628. "\u9AD8",
  34629. "\u2FBD",
  34630. "\u9ADF",
  34631. "\u2FBE",
  34632. "\u9B25",
  34633. "\u2FBF",
  34634. "\u9B2F",
  34635. "\u2FC0",
  34636. "\u9B32",
  34637. "\u2FC1",
  34638. "\u9B3C",
  34639. "\u2FC2",
  34640. "\u9B5A",
  34641. "\u2FC3",
  34642. "\u9CE5",
  34643. "\u2FC4",
  34644. "\u9E75",
  34645. "\u2FC5",
  34646. "\u9E7F",
  34647. "\u2FC6",
  34648. "\u9EA5",
  34649. "\u2FC7",
  34650. "\u9EBB",
  34651. "\u2FC8",
  34652. "\u9EC3",
  34653. "\u2FC9",
  34654. "\u9ECD",
  34655. "\u2FCA",
  34656. "\u9ED1",
  34657. "\u2FCB",
  34658. "\u9EF9",
  34659. "\u2FCC",
  34660. "\u9EFD",
  34661. "\u2FCD",
  34662. "\u9F0E",
  34663. "\u2FCE",
  34664. "\u9F13",
  34665. "\u2FCF",
  34666. "\u9F20",
  34667. "\u2FD0",
  34668. "\u9F3B",
  34669. "\u2FD1",
  34670. "\u9F4A",
  34671. "\u2FD2",
  34672. "\u9F52",
  34673. "\u2FD3",
  34674. "\u9F8D",
  34675. "\u2FD4",
  34676. "\u9F9C",
  34677. "\u2FD5",
  34678. "\u9FA0",
  34679. "\u3036",
  34680. "\u3012",
  34681. "\u3038",
  34682. "\u5341",
  34683. "\u3039",
  34684. "\u5344",
  34685. "\u303A",
  34686. "\u5345",
  34687. "\u309B",
  34688. "\u0020\u3099",
  34689. "\u309C",
  34690. "\u0020\u309A",
  34691. "\u3131",
  34692. "\u1100",
  34693. "\u3132",
  34694. "\u1101",
  34695. "\u3133",
  34696. "\u11AA",
  34697. "\u3134",
  34698. "\u1102",
  34699. "\u3135",
  34700. "\u11AC",
  34701. "\u3136",
  34702. "\u11AD",
  34703. "\u3137",
  34704. "\u1103",
  34705. "\u3138",
  34706. "\u1104",
  34707. "\u3139",
  34708. "\u1105",
  34709. "\u313A",
  34710. "\u11B0",
  34711. "\u313B",
  34712. "\u11B1",
  34713. "\u313C",
  34714. "\u11B2",
  34715. "\u313D",
  34716. "\u11B3",
  34717. "\u313E",
  34718. "\u11B4",
  34719. "\u313F",
  34720. "\u11B5",
  34721. "\u3140",
  34722. "\u111A",
  34723. "\u3141",
  34724. "\u1106",
  34725. "\u3142",
  34726. "\u1107",
  34727. "\u3143",
  34728. "\u1108",
  34729. "\u3144",
  34730. "\u1121",
  34731. "\u3145",
  34732. "\u1109",
  34733. "\u3146",
  34734. "\u110A",
  34735. "\u3147",
  34736. "\u110B",
  34737. "\u3148",
  34738. "\u110C",
  34739. "\u3149",
  34740. "\u110D",
  34741. "\u314A",
  34742. "\u110E",
  34743. "\u314B",
  34744. "\u110F",
  34745. "\u314C",
  34746. "\u1110",
  34747. "\u314D",
  34748. "\u1111",
  34749. "\u314E",
  34750. "\u1112",
  34751. "\u314F",
  34752. "\u1161",
  34753. "\u3150",
  34754. "\u1162",
  34755. "\u3151",
  34756. "\u1163",
  34757. "\u3152",
  34758. "\u1164",
  34759. "\u3153",
  34760. "\u1165",
  34761. "\u3154",
  34762. "\u1166",
  34763. "\u3155",
  34764. "\u1167",
  34765. "\u3156",
  34766. "\u1168",
  34767. "\u3157",
  34768. "\u1169",
  34769. "\u3158",
  34770. "\u116A",
  34771. "\u3159",
  34772. "\u116B",
  34773. "\u315A",
  34774. "\u116C",
  34775. "\u315B",
  34776. "\u116D",
  34777. "\u315C",
  34778. "\u116E",
  34779. "\u315D",
  34780. "\u116F",
  34781. "\u315E",
  34782. "\u1170",
  34783. "\u315F",
  34784. "\u1171",
  34785. "\u3160",
  34786. "\u1172",
  34787. "\u3161",
  34788. "\u1173",
  34789. "\u3162",
  34790. "\u1174",
  34791. "\u3163",
  34792. "\u1175",
  34793. "\u3164",
  34794. "\u1160",
  34795. "\u3165",
  34796. "\u1114",
  34797. "\u3166",
  34798. "\u1115",
  34799. "\u3167",
  34800. "\u11C7",
  34801. "\u3168",
  34802. "\u11C8",
  34803. "\u3169",
  34804. "\u11CC",
  34805. "\u316A",
  34806. "\u11CE",
  34807. "\u316B",
  34808. "\u11D3",
  34809. "\u316C",
  34810. "\u11D7",
  34811. "\u316D",
  34812. "\u11D9",
  34813. "\u316E",
  34814. "\u111C",
  34815. "\u316F",
  34816. "\u11DD",
  34817. "\u3170",
  34818. "\u11DF",
  34819. "\u3171",
  34820. "\u111D",
  34821. "\u3172",
  34822. "\u111E",
  34823. "\u3173",
  34824. "\u1120",
  34825. "\u3174",
  34826. "\u1122",
  34827. "\u3175",
  34828. "\u1123",
  34829. "\u3176",
  34830. "\u1127",
  34831. "\u3177",
  34832. "\u1129",
  34833. "\u3178",
  34834. "\u112B",
  34835. "\u3179",
  34836. "\u112C",
  34837. "\u317A",
  34838. "\u112D",
  34839. "\u317B",
  34840. "\u112E",
  34841. "\u317C",
  34842. "\u112F",
  34843. "\u317D",
  34844. "\u1132",
  34845. "\u317E",
  34846. "\u1136",
  34847. "\u317F",
  34848. "\u1140",
  34849. "\u3180",
  34850. "\u1147",
  34851. "\u3181",
  34852. "\u114C",
  34853. "\u3182",
  34854. "\u11F1",
  34855. "\u3183",
  34856. "\u11F2",
  34857. "\u3184",
  34858. "\u1157",
  34859. "\u3185",
  34860. "\u1158",
  34861. "\u3186",
  34862. "\u1159",
  34863. "\u3187",
  34864. "\u1184",
  34865. "\u3188",
  34866. "\u1185",
  34867. "\u3189",
  34868. "\u1188",
  34869. "\u318A",
  34870. "\u1191",
  34871. "\u318B",
  34872. "\u1192",
  34873. "\u318C",
  34874. "\u1194",
  34875. "\u318D",
  34876. "\u119E",
  34877. "\u318E",
  34878. "\u11A1",
  34879. "\u3200",
  34880. "\u0028\u1100\u0029",
  34881. "\u3201",
  34882. "\u0028\u1102\u0029",
  34883. "\u3202",
  34884. "\u0028\u1103\u0029",
  34885. "\u3203",
  34886. "\u0028\u1105\u0029",
  34887. "\u3204",
  34888. "\u0028\u1106\u0029",
  34889. "\u3205",
  34890. "\u0028\u1107\u0029",
  34891. "\u3206",
  34892. "\u0028\u1109\u0029",
  34893. "\u3207",
  34894. "\u0028\u110B\u0029",
  34895. "\u3208",
  34896. "\u0028\u110C\u0029",
  34897. "\u3209",
  34898. "\u0028\u110E\u0029",
  34899. "\u320A",
  34900. "\u0028\u110F\u0029",
  34901. "\u320B",
  34902. "\u0028\u1110\u0029",
  34903. "\u320C",
  34904. "\u0028\u1111\u0029",
  34905. "\u320D",
  34906. "\u0028\u1112\u0029",
  34907. "\u320E",
  34908. "\u0028\u1100\u1161\u0029",
  34909. "\u320F",
  34910. "\u0028\u1102\u1161\u0029",
  34911. "\u3210",
  34912. "\u0028\u1103\u1161\u0029",
  34913. "\u3211",
  34914. "\u0028\u1105\u1161\u0029",
  34915. "\u3212",
  34916. "\u0028\u1106\u1161\u0029",
  34917. "\u3213",
  34918. "\u0028\u1107\u1161\u0029",
  34919. "\u3214",
  34920. "\u0028\u1109\u1161\u0029",
  34921. "\u3215",
  34922. "\u0028\u110B\u1161\u0029",
  34923. "\u3216",
  34924. "\u0028\u110C\u1161\u0029",
  34925. "\u3217",
  34926. "\u0028\u110E\u1161\u0029",
  34927. "\u3218",
  34928. "\u0028\u110F\u1161\u0029",
  34929. "\u3219",
  34930. "\u0028\u1110\u1161\u0029",
  34931. "\u321A",
  34932. "\u0028\u1111\u1161\u0029",
  34933. "\u321B",
  34934. "\u0028\u1112\u1161\u0029",
  34935. "\u321C",
  34936. "\u0028\u110C\u116E\u0029",
  34937. "\u321D",
  34938. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  34939. "\u321E",
  34940. "\u0028\u110B\u1169\u1112\u116E\u0029",
  34941. "\u3220",
  34942. "\u0028\u4E00\u0029",
  34943. "\u3221",
  34944. "\u0028\u4E8C\u0029",
  34945. "\u3222",
  34946. "\u0028\u4E09\u0029",
  34947. "\u3223",
  34948. "\u0028\u56DB\u0029",
  34949. "\u3224",
  34950. "\u0028\u4E94\u0029",
  34951. "\u3225",
  34952. "\u0028\u516D\u0029",
  34953. "\u3226",
  34954. "\u0028\u4E03\u0029",
  34955. "\u3227",
  34956. "\u0028\u516B\u0029",
  34957. "\u3228",
  34958. "\u0028\u4E5D\u0029",
  34959. "\u3229",
  34960. "\u0028\u5341\u0029",
  34961. "\u322A",
  34962. "\u0028\u6708\u0029",
  34963. "\u322B",
  34964. "\u0028\u706B\u0029",
  34965. "\u322C",
  34966. "\u0028\u6C34\u0029",
  34967. "\u322D",
  34968. "\u0028\u6728\u0029",
  34969. "\u322E",
  34970. "\u0028\u91D1\u0029",
  34971. "\u322F",
  34972. "\u0028\u571F\u0029",
  34973. "\u3230",
  34974. "\u0028\u65E5\u0029",
  34975. "\u3231",
  34976. "\u0028\u682A\u0029",
  34977. "\u3232",
  34978. "\u0028\u6709\u0029",
  34979. "\u3233",
  34980. "\u0028\u793E\u0029",
  34981. "\u3234",
  34982. "\u0028\u540D\u0029",
  34983. "\u3235",
  34984. "\u0028\u7279\u0029",
  34985. "\u3236",
  34986. "\u0028\u8CA1\u0029",
  34987. "\u3237",
  34988. "\u0028\u795D\u0029",
  34989. "\u3238",
  34990. "\u0028\u52B4\u0029",
  34991. "\u3239",
  34992. "\u0028\u4EE3\u0029",
  34993. "\u323A",
  34994. "\u0028\u547C\u0029",
  34995. "\u323B",
  34996. "\u0028\u5B66\u0029",
  34997. "\u323C",
  34998. "\u0028\u76E3\u0029",
  34999. "\u323D",
  35000. "\u0028\u4F01\u0029",
  35001. "\u323E",
  35002. "\u0028\u8CC7\u0029",
  35003. "\u323F",
  35004. "\u0028\u5354\u0029",
  35005. "\u3240",
  35006. "\u0028\u796D\u0029",
  35007. "\u3241",
  35008. "\u0028\u4F11\u0029",
  35009. "\u3242",
  35010. "\u0028\u81EA\u0029",
  35011. "\u3243",
  35012. "\u0028\u81F3\u0029",
  35013. "\u32C0",
  35014. "\u0031\u6708",
  35015. "\u32C1",
  35016. "\u0032\u6708",
  35017. "\u32C2",
  35018. "\u0033\u6708",
  35019. "\u32C3",
  35020. "\u0034\u6708",
  35021. "\u32C4",
  35022. "\u0035\u6708",
  35023. "\u32C5",
  35024. "\u0036\u6708",
  35025. "\u32C6",
  35026. "\u0037\u6708",
  35027. "\u32C7",
  35028. "\u0038\u6708",
  35029. "\u32C8",
  35030. "\u0039\u6708",
  35031. "\u32C9",
  35032. "\u0031\u0030\u6708",
  35033. "\u32CA",
  35034. "\u0031\u0031\u6708",
  35035. "\u32CB",
  35036. "\u0031\u0032\u6708",
  35037. "\u3358",
  35038. "\u0030\u70B9",
  35039. "\u3359",
  35040. "\u0031\u70B9",
  35041. "\u335A",
  35042. "\u0032\u70B9",
  35043. "\u335B",
  35044. "\u0033\u70B9",
  35045. "\u335C",
  35046. "\u0034\u70B9",
  35047. "\u335D",
  35048. "\u0035\u70B9",
  35049. "\u335E",
  35050. "\u0036\u70B9",
  35051. "\u335F",
  35052. "\u0037\u70B9",
  35053. "\u3360",
  35054. "\u0038\u70B9",
  35055. "\u3361",
  35056. "\u0039\u70B9",
  35057. "\u3362",
  35058. "\u0031\u0030\u70B9",
  35059. "\u3363",
  35060. "\u0031\u0031\u70B9",
  35061. "\u3364",
  35062. "\u0031\u0032\u70B9",
  35063. "\u3365",
  35064. "\u0031\u0033\u70B9",
  35065. "\u3366",
  35066. "\u0031\u0034\u70B9",
  35067. "\u3367",
  35068. "\u0031\u0035\u70B9",
  35069. "\u3368",
  35070. "\u0031\u0036\u70B9",
  35071. "\u3369",
  35072. "\u0031\u0037\u70B9",
  35073. "\u336A",
  35074. "\u0031\u0038\u70B9",
  35075. "\u336B",
  35076. "\u0031\u0039\u70B9",
  35077. "\u336C",
  35078. "\u0032\u0030\u70B9",
  35079. "\u336D",
  35080. "\u0032\u0031\u70B9",
  35081. "\u336E",
  35082. "\u0032\u0032\u70B9",
  35083. "\u336F",
  35084. "\u0032\u0033\u70B9",
  35085. "\u3370",
  35086. "\u0032\u0034\u70B9",
  35087. "\u33E0",
  35088. "\u0031\u65E5",
  35089. "\u33E1",
  35090. "\u0032\u65E5",
  35091. "\u33E2",
  35092. "\u0033\u65E5",
  35093. "\u33E3",
  35094. "\u0034\u65E5",
  35095. "\u33E4",
  35096. "\u0035\u65E5",
  35097. "\u33E5",
  35098. "\u0036\u65E5",
  35099. "\u33E6",
  35100. "\u0037\u65E5",
  35101. "\u33E7",
  35102. "\u0038\u65E5",
  35103. "\u33E8",
  35104. "\u0039\u65E5",
  35105. "\u33E9",
  35106. "\u0031\u0030\u65E5",
  35107. "\u33EA",
  35108. "\u0031\u0031\u65E5",
  35109. "\u33EB",
  35110. "\u0031\u0032\u65E5",
  35111. "\u33EC",
  35112. "\u0031\u0033\u65E5",
  35113. "\u33ED",
  35114. "\u0031\u0034\u65E5",
  35115. "\u33EE",
  35116. "\u0031\u0035\u65E5",
  35117. "\u33EF",
  35118. "\u0031\u0036\u65E5",
  35119. "\u33F0",
  35120. "\u0031\u0037\u65E5",
  35121. "\u33F1",
  35122. "\u0031\u0038\u65E5",
  35123. "\u33F2",
  35124. "\u0031\u0039\u65E5",
  35125. "\u33F3",
  35126. "\u0032\u0030\u65E5",
  35127. "\u33F4",
  35128. "\u0032\u0031\u65E5",
  35129. "\u33F5",
  35130. "\u0032\u0032\u65E5",
  35131. "\u33F6",
  35132. "\u0032\u0033\u65E5",
  35133. "\u33F7",
  35134. "\u0032\u0034\u65E5",
  35135. "\u33F8",
  35136. "\u0032\u0035\u65E5",
  35137. "\u33F9",
  35138. "\u0032\u0036\u65E5",
  35139. "\u33FA",
  35140. "\u0032\u0037\u65E5",
  35141. "\u33FB",
  35142. "\u0032\u0038\u65E5",
  35143. "\u33FC",
  35144. "\u0032\u0039\u65E5",
  35145. "\u33FD",
  35146. "\u0033\u0030\u65E5",
  35147. "\u33FE",
  35148. "\u0033\u0031\u65E5",
  35149. "\uFB00",
  35150. "\u0066\u0066",
  35151. "\uFB01",
  35152. "\u0066\u0069",
  35153. "\uFB02",
  35154. "\u0066\u006C",
  35155. "\uFB03",
  35156. "\u0066\u0066\u0069",
  35157. "\uFB04",
  35158. "\u0066\u0066\u006C",
  35159. "\uFB05",
  35160. "\u017F\u0074",
  35161. "\uFB06",
  35162. "\u0073\u0074",
  35163. "\uFB13",
  35164. "\u0574\u0576",
  35165. "\uFB14",
  35166. "\u0574\u0565",
  35167. "\uFB15",
  35168. "\u0574\u056B",
  35169. "\uFB16",
  35170. "\u057E\u0576",
  35171. "\uFB17",
  35172. "\u0574\u056D",
  35173. "\uFB4F",
  35174. "\u05D0\u05DC",
  35175. "\uFB50",
  35176. "\u0671",
  35177. "\uFB51",
  35178. "\u0671",
  35179. "\uFB52",
  35180. "\u067B",
  35181. "\uFB53",
  35182. "\u067B",
  35183. "\uFB54",
  35184. "\u067B",
  35185. "\uFB55",
  35186. "\u067B",
  35187. "\uFB56",
  35188. "\u067E",
  35189. "\uFB57",
  35190. "\u067E",
  35191. "\uFB58",
  35192. "\u067E",
  35193. "\uFB59",
  35194. "\u067E",
  35195. "\uFB5A",
  35196. "\u0680",
  35197. "\uFB5B",
  35198. "\u0680",
  35199. "\uFB5C",
  35200. "\u0680",
  35201. "\uFB5D",
  35202. "\u0680",
  35203. "\uFB5E",
  35204. "\u067A",
  35205. "\uFB5F",
  35206. "\u067A",
  35207. "\uFB60",
  35208. "\u067A",
  35209. "\uFB61",
  35210. "\u067A",
  35211. "\uFB62",
  35212. "\u067F",
  35213. "\uFB63",
  35214. "\u067F",
  35215. "\uFB64",
  35216. "\u067F",
  35217. "\uFB65",
  35218. "\u067F",
  35219. "\uFB66",
  35220. "\u0679",
  35221. "\uFB67",
  35222. "\u0679",
  35223. "\uFB68",
  35224. "\u0679",
  35225. "\uFB69",
  35226. "\u0679",
  35227. "\uFB6A",
  35228. "\u06A4",
  35229. "\uFB6B",
  35230. "\u06A4",
  35231. "\uFB6C",
  35232. "\u06A4",
  35233. "\uFB6D",
  35234. "\u06A4",
  35235. "\uFB6E",
  35236. "\u06A6",
  35237. "\uFB6F",
  35238. "\u06A6",
  35239. "\uFB70",
  35240. "\u06A6",
  35241. "\uFB71",
  35242. "\u06A6",
  35243. "\uFB72",
  35244. "\u0684",
  35245. "\uFB73",
  35246. "\u0684",
  35247. "\uFB74",
  35248. "\u0684",
  35249. "\uFB75",
  35250. "\u0684",
  35251. "\uFB76",
  35252. "\u0683",
  35253. "\uFB77",
  35254. "\u0683",
  35255. "\uFB78",
  35256. "\u0683",
  35257. "\uFB79",
  35258. "\u0683",
  35259. "\uFB7A",
  35260. "\u0686",
  35261. "\uFB7B",
  35262. "\u0686",
  35263. "\uFB7C",
  35264. "\u0686",
  35265. "\uFB7D",
  35266. "\u0686",
  35267. "\uFB7E",
  35268. "\u0687",
  35269. "\uFB7F",
  35270. "\u0687",
  35271. "\uFB80",
  35272. "\u0687",
  35273. "\uFB81",
  35274. "\u0687",
  35275. "\uFB82",
  35276. "\u068D",
  35277. "\uFB83",
  35278. "\u068D",
  35279. "\uFB84",
  35280. "\u068C",
  35281. "\uFB85",
  35282. "\u068C",
  35283. "\uFB86",
  35284. "\u068E",
  35285. "\uFB87",
  35286. "\u068E",
  35287. "\uFB88",
  35288. "\u0688",
  35289. "\uFB89",
  35290. "\u0688",
  35291. "\uFB8A",
  35292. "\u0698",
  35293. "\uFB8B",
  35294. "\u0698",
  35295. "\uFB8C",
  35296. "\u0691",
  35297. "\uFB8D",
  35298. "\u0691",
  35299. "\uFB8E",
  35300. "\u06A9",
  35301. "\uFB8F",
  35302. "\u06A9",
  35303. "\uFB90",
  35304. "\u06A9",
  35305. "\uFB91",
  35306. "\u06A9",
  35307. "\uFB92",
  35308. "\u06AF",
  35309. "\uFB93",
  35310. "\u06AF",
  35311. "\uFB94",
  35312. "\u06AF",
  35313. "\uFB95",
  35314. "\u06AF",
  35315. "\uFB96",
  35316. "\u06B3",
  35317. "\uFB97",
  35318. "\u06B3",
  35319. "\uFB98",
  35320. "\u06B3",
  35321. "\uFB99",
  35322. "\u06B3",
  35323. "\uFB9A",
  35324. "\u06B1",
  35325. "\uFB9B",
  35326. "\u06B1",
  35327. "\uFB9C",
  35328. "\u06B1",
  35329. "\uFB9D",
  35330. "\u06B1",
  35331. "\uFB9E",
  35332. "\u06BA",
  35333. "\uFB9F",
  35334. "\u06BA",
  35335. "\uFBA0",
  35336. "\u06BB",
  35337. "\uFBA1",
  35338. "\u06BB",
  35339. "\uFBA2",
  35340. "\u06BB",
  35341. "\uFBA3",
  35342. "\u06BB",
  35343. "\uFBA4",
  35344. "\u06C0",
  35345. "\uFBA5",
  35346. "\u06C0",
  35347. "\uFBA6",
  35348. "\u06C1",
  35349. "\uFBA7",
  35350. "\u06C1",
  35351. "\uFBA8",
  35352. "\u06C1",
  35353. "\uFBA9",
  35354. "\u06C1",
  35355. "\uFBAA",
  35356. "\u06BE",
  35357. "\uFBAB",
  35358. "\u06BE",
  35359. "\uFBAC",
  35360. "\u06BE",
  35361. "\uFBAD",
  35362. "\u06BE",
  35363. "\uFBAE",
  35364. "\u06D2",
  35365. "\uFBAF",
  35366. "\u06D2",
  35367. "\uFBB0",
  35368. "\u06D3",
  35369. "\uFBB1",
  35370. "\u06D3",
  35371. "\uFBD3",
  35372. "\u06AD",
  35373. "\uFBD4",
  35374. "\u06AD",
  35375. "\uFBD5",
  35376. "\u06AD",
  35377. "\uFBD6",
  35378. "\u06AD",
  35379. "\uFBD7",
  35380. "\u06C7",
  35381. "\uFBD8",
  35382. "\u06C7",
  35383. "\uFBD9",
  35384. "\u06C6",
  35385. "\uFBDA",
  35386. "\u06C6",
  35387. "\uFBDB",
  35388. "\u06C8",
  35389. "\uFBDC",
  35390. "\u06C8",
  35391. "\uFBDD",
  35392. "\u0677",
  35393. "\uFBDE",
  35394. "\u06CB",
  35395. "\uFBDF",
  35396. "\u06CB",
  35397. "\uFBE0",
  35398. "\u06C5",
  35399. "\uFBE1",
  35400. "\u06C5",
  35401. "\uFBE2",
  35402. "\u06C9",
  35403. "\uFBE3",
  35404. "\u06C9",
  35405. "\uFBE4",
  35406. "\u06D0",
  35407. "\uFBE5",
  35408. "\u06D0",
  35409. "\uFBE6",
  35410. "\u06D0",
  35411. "\uFBE7",
  35412. "\u06D0",
  35413. "\uFBE8",
  35414. "\u0649",
  35415. "\uFBE9",
  35416. "\u0649",
  35417. "\uFBEA",
  35418. "\u0626\u0627",
  35419. "\uFBEB",
  35420. "\u0626\u0627",
  35421. "\uFBEC",
  35422. "\u0626\u06D5",
  35423. "\uFBED",
  35424. "\u0626\u06D5",
  35425. "\uFBEE",
  35426. "\u0626\u0648",
  35427. "\uFBEF",
  35428. "\u0626\u0648",
  35429. "\uFBF0",
  35430. "\u0626\u06C7",
  35431. "\uFBF1",
  35432. "\u0626\u06C7",
  35433. "\uFBF2",
  35434. "\u0626\u06C6",
  35435. "\uFBF3",
  35436. "\u0626\u06C6",
  35437. "\uFBF4",
  35438. "\u0626\u06C8",
  35439. "\uFBF5",
  35440. "\u0626\u06C8",
  35441. "\uFBF6",
  35442. "\u0626\u06D0",
  35443. "\uFBF7",
  35444. "\u0626\u06D0",
  35445. "\uFBF8",
  35446. "\u0626\u06D0",
  35447. "\uFBF9",
  35448. "\u0626\u0649",
  35449. "\uFBFA",
  35450. "\u0626\u0649",
  35451. "\uFBFB",
  35452. "\u0626\u0649",
  35453. "\uFBFC",
  35454. "\u06CC",
  35455. "\uFBFD",
  35456. "\u06CC",
  35457. "\uFBFE",
  35458. "\u06CC",
  35459. "\uFBFF",
  35460. "\u06CC",
  35461. "\uFC00",
  35462. "\u0626\u062C",
  35463. "\uFC01",
  35464. "\u0626\u062D",
  35465. "\uFC02",
  35466. "\u0626\u0645",
  35467. "\uFC03",
  35468. "\u0626\u0649",
  35469. "\uFC04",
  35470. "\u0626\u064A",
  35471. "\uFC05",
  35472. "\u0628\u062C",
  35473. "\uFC06",
  35474. "\u0628\u062D",
  35475. "\uFC07",
  35476. "\u0628\u062E",
  35477. "\uFC08",
  35478. "\u0628\u0645",
  35479. "\uFC09",
  35480. "\u0628\u0649",
  35481. "\uFC0A",
  35482. "\u0628\u064A",
  35483. "\uFC0B",
  35484. "\u062A\u062C",
  35485. "\uFC0C",
  35486. "\u062A\u062D",
  35487. "\uFC0D",
  35488. "\u062A\u062E",
  35489. "\uFC0E",
  35490. "\u062A\u0645",
  35491. "\uFC0F",
  35492. "\u062A\u0649",
  35493. "\uFC10",
  35494. "\u062A\u064A",
  35495. "\uFC11",
  35496. "\u062B\u062C",
  35497. "\uFC12",
  35498. "\u062B\u0645",
  35499. "\uFC13",
  35500. "\u062B\u0649",
  35501. "\uFC14",
  35502. "\u062B\u064A",
  35503. "\uFC15",
  35504. "\u062C\u062D",
  35505. "\uFC16",
  35506. "\u062C\u0645",
  35507. "\uFC17",
  35508. "\u062D\u062C",
  35509. "\uFC18",
  35510. "\u062D\u0645",
  35511. "\uFC19",
  35512. "\u062E\u062C",
  35513. "\uFC1A",
  35514. "\u062E\u062D",
  35515. "\uFC1B",
  35516. "\u062E\u0645",
  35517. "\uFC1C",
  35518. "\u0633\u062C",
  35519. "\uFC1D",
  35520. "\u0633\u062D",
  35521. "\uFC1E",
  35522. "\u0633\u062E",
  35523. "\uFC1F",
  35524. "\u0633\u0645",
  35525. "\uFC20",
  35526. "\u0635\u062D",
  35527. "\uFC21",
  35528. "\u0635\u0645",
  35529. "\uFC22",
  35530. "\u0636\u062C",
  35531. "\uFC23",
  35532. "\u0636\u062D",
  35533. "\uFC24",
  35534. "\u0636\u062E",
  35535. "\uFC25",
  35536. "\u0636\u0645",
  35537. "\uFC26",
  35538. "\u0637\u062D",
  35539. "\uFC27",
  35540. "\u0637\u0645",
  35541. "\uFC28",
  35542. "\u0638\u0645",
  35543. "\uFC29",
  35544. "\u0639\u062C",
  35545. "\uFC2A",
  35546. "\u0639\u0645",
  35547. "\uFC2B",
  35548. "\u063A\u062C",
  35549. "\uFC2C",
  35550. "\u063A\u0645",
  35551. "\uFC2D",
  35552. "\u0641\u062C",
  35553. "\uFC2E",
  35554. "\u0641\u062D",
  35555. "\uFC2F",
  35556. "\u0641\u062E",
  35557. "\uFC30",
  35558. "\u0641\u0645",
  35559. "\uFC31",
  35560. "\u0641\u0649",
  35561. "\uFC32",
  35562. "\u0641\u064A",
  35563. "\uFC33",
  35564. "\u0642\u062D",
  35565. "\uFC34",
  35566. "\u0642\u0645",
  35567. "\uFC35",
  35568. "\u0642\u0649",
  35569. "\uFC36",
  35570. "\u0642\u064A",
  35571. "\uFC37",
  35572. "\u0643\u0627",
  35573. "\uFC38",
  35574. "\u0643\u062C",
  35575. "\uFC39",
  35576. "\u0643\u062D",
  35577. "\uFC3A",
  35578. "\u0643\u062E",
  35579. "\uFC3B",
  35580. "\u0643\u0644",
  35581. "\uFC3C",
  35582. "\u0643\u0645",
  35583. "\uFC3D",
  35584. "\u0643\u0649",
  35585. "\uFC3E",
  35586. "\u0643\u064A",
  35587. "\uFC3F",
  35588. "\u0644\u062C",
  35589. "\uFC40",
  35590. "\u0644\u062D",
  35591. "\uFC41",
  35592. "\u0644\u062E",
  35593. "\uFC42",
  35594. "\u0644\u0645",
  35595. "\uFC43",
  35596. "\u0644\u0649",
  35597. "\uFC44",
  35598. "\u0644\u064A",
  35599. "\uFC45",
  35600. "\u0645\u062C",
  35601. "\uFC46",
  35602. "\u0645\u062D",
  35603. "\uFC47",
  35604. "\u0645\u062E",
  35605. "\uFC48",
  35606. "\u0645\u0645",
  35607. "\uFC49",
  35608. "\u0645\u0649",
  35609. "\uFC4A",
  35610. "\u0645\u064A",
  35611. "\uFC4B",
  35612. "\u0646\u062C",
  35613. "\uFC4C",
  35614. "\u0646\u062D",
  35615. "\uFC4D",
  35616. "\u0646\u062E",
  35617. "\uFC4E",
  35618. "\u0646\u0645",
  35619. "\uFC4F",
  35620. "\u0646\u0649",
  35621. "\uFC50",
  35622. "\u0646\u064A",
  35623. "\uFC51",
  35624. "\u0647\u062C",
  35625. "\uFC52",
  35626. "\u0647\u0645",
  35627. "\uFC53",
  35628. "\u0647\u0649",
  35629. "\uFC54",
  35630. "\u0647\u064A",
  35631. "\uFC55",
  35632. "\u064A\u062C",
  35633. "\uFC56",
  35634. "\u064A\u062D",
  35635. "\uFC57",
  35636. "\u064A\u062E",
  35637. "\uFC58",
  35638. "\u064A\u0645",
  35639. "\uFC59",
  35640. "\u064A\u0649",
  35641. "\uFC5A",
  35642. "\u064A\u064A",
  35643. "\uFC5B",
  35644. "\u0630\u0670",
  35645. "\uFC5C",
  35646. "\u0631\u0670",
  35647. "\uFC5D",
  35648. "\u0649\u0670",
  35649. "\uFC5E",
  35650. "\u0020\u064C\u0651",
  35651. "\uFC5F",
  35652. "\u0020\u064D\u0651",
  35653. "\uFC60",
  35654. "\u0020\u064E\u0651",
  35655. "\uFC61",
  35656. "\u0020\u064F\u0651",
  35657. "\uFC62",
  35658. "\u0020\u0650\u0651",
  35659. "\uFC63",
  35660. "\u0020\u0651\u0670",
  35661. "\uFC64",
  35662. "\u0626\u0631",
  35663. "\uFC65",
  35664. "\u0626\u0632",
  35665. "\uFC66",
  35666. "\u0626\u0645",
  35667. "\uFC67",
  35668. "\u0626\u0646",
  35669. "\uFC68",
  35670. "\u0626\u0649",
  35671. "\uFC69",
  35672. "\u0626\u064A",
  35673. "\uFC6A",
  35674. "\u0628\u0631",
  35675. "\uFC6B",
  35676. "\u0628\u0632",
  35677. "\uFC6C",
  35678. "\u0628\u0645",
  35679. "\uFC6D",
  35680. "\u0628\u0646",
  35681. "\uFC6E",
  35682. "\u0628\u0649",
  35683. "\uFC6F",
  35684. "\u0628\u064A",
  35685. "\uFC70",
  35686. "\u062A\u0631",
  35687. "\uFC71",
  35688. "\u062A\u0632",
  35689. "\uFC72",
  35690. "\u062A\u0645",
  35691. "\uFC73",
  35692. "\u062A\u0646",
  35693. "\uFC74",
  35694. "\u062A\u0649",
  35695. "\uFC75",
  35696. "\u062A\u064A",
  35697. "\uFC76",
  35698. "\u062B\u0631",
  35699. "\uFC77",
  35700. "\u062B\u0632",
  35701. "\uFC78",
  35702. "\u062B\u0645",
  35703. "\uFC79",
  35704. "\u062B\u0646",
  35705. "\uFC7A",
  35706. "\u062B\u0649",
  35707. "\uFC7B",
  35708. "\u062B\u064A",
  35709. "\uFC7C",
  35710. "\u0641\u0649",
  35711. "\uFC7D",
  35712. "\u0641\u064A",
  35713. "\uFC7E",
  35714. "\u0642\u0649",
  35715. "\uFC7F",
  35716. "\u0642\u064A",
  35717. "\uFC80",
  35718. "\u0643\u0627",
  35719. "\uFC81",
  35720. "\u0643\u0644",
  35721. "\uFC82",
  35722. "\u0643\u0645",
  35723. "\uFC83",
  35724. "\u0643\u0649",
  35725. "\uFC84",
  35726. "\u0643\u064A",
  35727. "\uFC85",
  35728. "\u0644\u0645",
  35729. "\uFC86",
  35730. "\u0644\u0649",
  35731. "\uFC87",
  35732. "\u0644\u064A",
  35733. "\uFC88",
  35734. "\u0645\u0627",
  35735. "\uFC89",
  35736. "\u0645\u0645",
  35737. "\uFC8A",
  35738. "\u0646\u0631",
  35739. "\uFC8B",
  35740. "\u0646\u0632",
  35741. "\uFC8C",
  35742. "\u0646\u0645",
  35743. "\uFC8D",
  35744. "\u0646\u0646",
  35745. "\uFC8E",
  35746. "\u0646\u0649",
  35747. "\uFC8F",
  35748. "\u0646\u064A",
  35749. "\uFC90",
  35750. "\u0649\u0670",
  35751. "\uFC91",
  35752. "\u064A\u0631",
  35753. "\uFC92",
  35754. "\u064A\u0632",
  35755. "\uFC93",
  35756. "\u064A\u0645",
  35757. "\uFC94",
  35758. "\u064A\u0646",
  35759. "\uFC95",
  35760. "\u064A\u0649",
  35761. "\uFC96",
  35762. "\u064A\u064A",
  35763. "\uFC97",
  35764. "\u0626\u062C",
  35765. "\uFC98",
  35766. "\u0626\u062D",
  35767. "\uFC99",
  35768. "\u0626\u062E",
  35769. "\uFC9A",
  35770. "\u0626\u0645",
  35771. "\uFC9B",
  35772. "\u0626\u0647",
  35773. "\uFC9C",
  35774. "\u0628\u062C",
  35775. "\uFC9D",
  35776. "\u0628\u062D",
  35777. "\uFC9E",
  35778. "\u0628\u062E",
  35779. "\uFC9F",
  35780. "\u0628\u0645",
  35781. "\uFCA0",
  35782. "\u0628\u0647",
  35783. "\uFCA1",
  35784. "\u062A\u062C",
  35785. "\uFCA2",
  35786. "\u062A\u062D",
  35787. "\uFCA3",
  35788. "\u062A\u062E",
  35789. "\uFCA4",
  35790. "\u062A\u0645",
  35791. "\uFCA5",
  35792. "\u062A\u0647",
  35793. "\uFCA6",
  35794. "\u062B\u0645",
  35795. "\uFCA7",
  35796. "\u062C\u062D",
  35797. "\uFCA8",
  35798. "\u062C\u0645",
  35799. "\uFCA9",
  35800. "\u062D\u062C",
  35801. "\uFCAA",
  35802. "\u062D\u0645",
  35803. "\uFCAB",
  35804. "\u062E\u062C",
  35805. "\uFCAC",
  35806. "\u062E\u0645",
  35807. "\uFCAD",
  35808. "\u0633\u062C",
  35809. "\uFCAE",
  35810. "\u0633\u062D",
  35811. "\uFCAF",
  35812. "\u0633\u062E",
  35813. "\uFCB0",
  35814. "\u0633\u0645",
  35815. "\uFCB1",
  35816. "\u0635\u062D",
  35817. "\uFCB2",
  35818. "\u0635\u062E",
  35819. "\uFCB3",
  35820. "\u0635\u0645",
  35821. "\uFCB4",
  35822. "\u0636\u062C",
  35823. "\uFCB5",
  35824. "\u0636\u062D",
  35825. "\uFCB6",
  35826. "\u0636\u062E",
  35827. "\uFCB7",
  35828. "\u0636\u0645",
  35829. "\uFCB8",
  35830. "\u0637\u062D",
  35831. "\uFCB9",
  35832. "\u0638\u0645",
  35833. "\uFCBA",
  35834. "\u0639\u062C",
  35835. "\uFCBB",
  35836. "\u0639\u0645",
  35837. "\uFCBC",
  35838. "\u063A\u062C",
  35839. "\uFCBD",
  35840. "\u063A\u0645",
  35841. "\uFCBE",
  35842. "\u0641\u062C",
  35843. "\uFCBF",
  35844. "\u0641\u062D",
  35845. "\uFCC0",
  35846. "\u0641\u062E",
  35847. "\uFCC1",
  35848. "\u0641\u0645",
  35849. "\uFCC2",
  35850. "\u0642\u062D",
  35851. "\uFCC3",
  35852. "\u0642\u0645",
  35853. "\uFCC4",
  35854. "\u0643\u062C",
  35855. "\uFCC5",
  35856. "\u0643\u062D",
  35857. "\uFCC6",
  35858. "\u0643\u062E",
  35859. "\uFCC7",
  35860. "\u0643\u0644",
  35861. "\uFCC8",
  35862. "\u0643\u0645",
  35863. "\uFCC9",
  35864. "\u0644\u062C",
  35865. "\uFCCA",
  35866. "\u0644\u062D",
  35867. "\uFCCB",
  35868. "\u0644\u062E",
  35869. "\uFCCC",
  35870. "\u0644\u0645",
  35871. "\uFCCD",
  35872. "\u0644\u0647",
  35873. "\uFCCE",
  35874. "\u0645\u062C",
  35875. "\uFCCF",
  35876. "\u0645\u062D",
  35877. "\uFCD0",
  35878. "\u0645\u062E",
  35879. "\uFCD1",
  35880. "\u0645\u0645",
  35881. "\uFCD2",
  35882. "\u0646\u062C",
  35883. "\uFCD3",
  35884. "\u0646\u062D",
  35885. "\uFCD4",
  35886. "\u0646\u062E",
  35887. "\uFCD5",
  35888. "\u0646\u0645",
  35889. "\uFCD6",
  35890. "\u0646\u0647",
  35891. "\uFCD7",
  35892. "\u0647\u062C",
  35893. "\uFCD8",
  35894. "\u0647\u0645",
  35895. "\uFCD9",
  35896. "\u0647\u0670",
  35897. "\uFCDA",
  35898. "\u064A\u062C",
  35899. "\uFCDB",
  35900. "\u064A\u062D",
  35901. "\uFCDC",
  35902. "\u064A\u062E",
  35903. "\uFCDD",
  35904. "\u064A\u0645",
  35905. "\uFCDE",
  35906. "\u064A\u0647",
  35907. "\uFCDF",
  35908. "\u0626\u0645",
  35909. "\uFCE0",
  35910. "\u0626\u0647",
  35911. "\uFCE1",
  35912. "\u0628\u0645",
  35913. "\uFCE2",
  35914. "\u0628\u0647",
  35915. "\uFCE3",
  35916. "\u062A\u0645",
  35917. "\uFCE4",
  35918. "\u062A\u0647",
  35919. "\uFCE5",
  35920. "\u062B\u0645",
  35921. "\uFCE6",
  35922. "\u062B\u0647",
  35923. "\uFCE7",
  35924. "\u0633\u0645",
  35925. "\uFCE8",
  35926. "\u0633\u0647",
  35927. "\uFCE9",
  35928. "\u0634\u0645",
  35929. "\uFCEA",
  35930. "\u0634\u0647",
  35931. "\uFCEB",
  35932. "\u0643\u0644",
  35933. "\uFCEC",
  35934. "\u0643\u0645",
  35935. "\uFCED",
  35936. "\u0644\u0645",
  35937. "\uFCEE",
  35938. "\u0646\u0645",
  35939. "\uFCEF",
  35940. "\u0646\u0647",
  35941. "\uFCF0",
  35942. "\u064A\u0645",
  35943. "\uFCF1",
  35944. "\u064A\u0647",
  35945. "\uFCF2",
  35946. "\u0640\u064E\u0651",
  35947. "\uFCF3",
  35948. "\u0640\u064F\u0651",
  35949. "\uFCF4",
  35950. "\u0640\u0650\u0651",
  35951. "\uFCF5",
  35952. "\u0637\u0649",
  35953. "\uFCF6",
  35954. "\u0637\u064A",
  35955. "\uFCF7",
  35956. "\u0639\u0649",
  35957. "\uFCF8",
  35958. "\u0639\u064A",
  35959. "\uFCF9",
  35960. "\u063A\u0649",
  35961. "\uFCFA",
  35962. "\u063A\u064A",
  35963. "\uFCFB",
  35964. "\u0633\u0649",
  35965. "\uFCFC",
  35966. "\u0633\u064A",
  35967. "\uFCFD",
  35968. "\u0634\u0649",
  35969. "\uFCFE",
  35970. "\u0634\u064A",
  35971. "\uFCFF",
  35972. "\u062D\u0649",
  35973. "\uFD00",
  35974. "\u062D\u064A",
  35975. "\uFD01",
  35976. "\u062C\u0649",
  35977. "\uFD02",
  35978. "\u062C\u064A",
  35979. "\uFD03",
  35980. "\u062E\u0649",
  35981. "\uFD04",
  35982. "\u062E\u064A",
  35983. "\uFD05",
  35984. "\u0635\u0649",
  35985. "\uFD06",
  35986. "\u0635\u064A",
  35987. "\uFD07",
  35988. "\u0636\u0649",
  35989. "\uFD08",
  35990. "\u0636\u064A",
  35991. "\uFD09",
  35992. "\u0634\u062C",
  35993. "\uFD0A",
  35994. "\u0634\u062D",
  35995. "\uFD0B",
  35996. "\u0634\u062E",
  35997. "\uFD0C",
  35998. "\u0634\u0645",
  35999. "\uFD0D",
  36000. "\u0634\u0631",
  36001. "\uFD0E",
  36002. "\u0633\u0631",
  36003. "\uFD0F",
  36004. "\u0635\u0631",
  36005. "\uFD10",
  36006. "\u0636\u0631",
  36007. "\uFD11",
  36008. "\u0637\u0649",
  36009. "\uFD12",
  36010. "\u0637\u064A",
  36011. "\uFD13",
  36012. "\u0639\u0649",
  36013. "\uFD14",
  36014. "\u0639\u064A",
  36015. "\uFD15",
  36016. "\u063A\u0649",
  36017. "\uFD16",
  36018. "\u063A\u064A",
  36019. "\uFD17",
  36020. "\u0633\u0649",
  36021. "\uFD18",
  36022. "\u0633\u064A",
  36023. "\uFD19",
  36024. "\u0634\u0649",
  36025. "\uFD1A",
  36026. "\u0634\u064A",
  36027. "\uFD1B",
  36028. "\u062D\u0649",
  36029. "\uFD1C",
  36030. "\u062D\u064A",
  36031. "\uFD1D",
  36032. "\u062C\u0649",
  36033. "\uFD1E",
  36034. "\u062C\u064A",
  36035. "\uFD1F",
  36036. "\u062E\u0649",
  36037. "\uFD20",
  36038. "\u062E\u064A",
  36039. "\uFD21",
  36040. "\u0635\u0649",
  36041. "\uFD22",
  36042. "\u0635\u064A",
  36043. "\uFD23",
  36044. "\u0636\u0649",
  36045. "\uFD24",
  36046. "\u0636\u064A",
  36047. "\uFD25",
  36048. "\u0634\u062C",
  36049. "\uFD26",
  36050. "\u0634\u062D",
  36051. "\uFD27",
  36052. "\u0634\u062E",
  36053. "\uFD28",
  36054. "\u0634\u0645",
  36055. "\uFD29",
  36056. "\u0634\u0631",
  36057. "\uFD2A",
  36058. "\u0633\u0631",
  36059. "\uFD2B",
  36060. "\u0635\u0631",
  36061. "\uFD2C",
  36062. "\u0636\u0631",
  36063. "\uFD2D",
  36064. "\u0634\u062C",
  36065. "\uFD2E",
  36066. "\u0634\u062D",
  36067. "\uFD2F",
  36068. "\u0634\u062E",
  36069. "\uFD30",
  36070. "\u0634\u0645",
  36071. "\uFD31",
  36072. "\u0633\u0647",
  36073. "\uFD32",
  36074. "\u0634\u0647",
  36075. "\uFD33",
  36076. "\u0637\u0645",
  36077. "\uFD34",
  36078. "\u0633\u062C",
  36079. "\uFD35",
  36080. "\u0633\u062D",
  36081. "\uFD36",
  36082. "\u0633\u062E",
  36083. "\uFD37",
  36084. "\u0634\u062C",
  36085. "\uFD38",
  36086. "\u0634\u062D",
  36087. "\uFD39",
  36088. "\u0634\u062E",
  36089. "\uFD3A",
  36090. "\u0637\u0645",
  36091. "\uFD3B",
  36092. "\u0638\u0645",
  36093. "\uFD3C",
  36094. "\u0627\u064B",
  36095. "\uFD3D",
  36096. "\u0627\u064B",
  36097. "\uFD50",
  36098. "\u062A\u062C\u0645",
  36099. "\uFD51",
  36100. "\u062A\u062D\u062C",
  36101. "\uFD52",
  36102. "\u062A\u062D\u062C",
  36103. "\uFD53",
  36104. "\u062A\u062D\u0645",
  36105. "\uFD54",
  36106. "\u062A\u062E\u0645",
  36107. "\uFD55",
  36108. "\u062A\u0645\u062C",
  36109. "\uFD56",
  36110. "\u062A\u0645\u062D",
  36111. "\uFD57",
  36112. "\u062A\u0645\u062E",
  36113. "\uFD58",
  36114. "\u062C\u0645\u062D",
  36115. "\uFD59",
  36116. "\u062C\u0645\u062D",
  36117. "\uFD5A",
  36118. "\u062D\u0645\u064A",
  36119. "\uFD5B",
  36120. "\u062D\u0645\u0649",
  36121. "\uFD5C",
  36122. "\u0633\u062D\u062C",
  36123. "\uFD5D",
  36124. "\u0633\u062C\u062D",
  36125. "\uFD5E",
  36126. "\u0633\u062C\u0649",
  36127. "\uFD5F",
  36128. "\u0633\u0645\u062D",
  36129. "\uFD60",
  36130. "\u0633\u0645\u062D",
  36131. "\uFD61",
  36132. "\u0633\u0645\u062C",
  36133. "\uFD62",
  36134. "\u0633\u0645\u0645",
  36135. "\uFD63",
  36136. "\u0633\u0645\u0645",
  36137. "\uFD64",
  36138. "\u0635\u062D\u062D",
  36139. "\uFD65",
  36140. "\u0635\u062D\u062D",
  36141. "\uFD66",
  36142. "\u0635\u0645\u0645",
  36143. "\uFD67",
  36144. "\u0634\u062D\u0645",
  36145. "\uFD68",
  36146. "\u0634\u062D\u0645",
  36147. "\uFD69",
  36148. "\u0634\u062C\u064A",
  36149. "\uFD6A",
  36150. "\u0634\u0645\u062E",
  36151. "\uFD6B",
  36152. "\u0634\u0645\u062E",
  36153. "\uFD6C",
  36154. "\u0634\u0645\u0645",
  36155. "\uFD6D",
  36156. "\u0634\u0645\u0645",
  36157. "\uFD6E",
  36158. "\u0636\u062D\u0649",
  36159. "\uFD6F",
  36160. "\u0636\u062E\u0645",
  36161. "\uFD70",
  36162. "\u0636\u062E\u0645",
  36163. "\uFD71",
  36164. "\u0637\u0645\u062D",
  36165. "\uFD72",
  36166. "\u0637\u0645\u062D",
  36167. "\uFD73",
  36168. "\u0637\u0645\u0645",
  36169. "\uFD74",
  36170. "\u0637\u0645\u064A",
  36171. "\uFD75",
  36172. "\u0639\u062C\u0645",
  36173. "\uFD76",
  36174. "\u0639\u0645\u0645",
  36175. "\uFD77",
  36176. "\u0639\u0645\u0645",
  36177. "\uFD78",
  36178. "\u0639\u0645\u0649",
  36179. "\uFD79",
  36180. "\u063A\u0645\u0645",
  36181. "\uFD7A",
  36182. "\u063A\u0645\u064A",
  36183. "\uFD7B",
  36184. "\u063A\u0645\u0649",
  36185. "\uFD7C",
  36186. "\u0641\u062E\u0645",
  36187. "\uFD7D",
  36188. "\u0641\u062E\u0645",
  36189. "\uFD7E",
  36190. "\u0642\u0645\u062D",
  36191. "\uFD7F",
  36192. "\u0642\u0645\u0645",
  36193. "\uFD80",
  36194. "\u0644\u062D\u0645",
  36195. "\uFD81",
  36196. "\u0644\u062D\u064A",
  36197. "\uFD82",
  36198. "\u0644\u062D\u0649",
  36199. "\uFD83",
  36200. "\u0644\u062C\u062C",
  36201. "\uFD84",
  36202. "\u0644\u062C\u062C",
  36203. "\uFD85",
  36204. "\u0644\u062E\u0645",
  36205. "\uFD86",
  36206. "\u0644\u062E\u0645",
  36207. "\uFD87",
  36208. "\u0644\u0645\u062D",
  36209. "\uFD88",
  36210. "\u0644\u0645\u062D",
  36211. "\uFD89",
  36212. "\u0645\u062D\u062C",
  36213. "\uFD8A",
  36214. "\u0645\u062D\u0645",
  36215. "\uFD8B",
  36216. "\u0645\u062D\u064A",
  36217. "\uFD8C",
  36218. "\u0645\u062C\u062D",
  36219. "\uFD8D",
  36220. "\u0645\u062C\u0645",
  36221. "\uFD8E",
  36222. "\u0645\u062E\u062C",
  36223. "\uFD8F",
  36224. "\u0645\u062E\u0645",
  36225. "\uFD92",
  36226. "\u0645\u062C\u062E",
  36227. "\uFD93",
  36228. "\u0647\u0645\u062C",
  36229. "\uFD94",
  36230. "\u0647\u0645\u0645",
  36231. "\uFD95",
  36232. "\u0646\u062D\u0645",
  36233. "\uFD96",
  36234. "\u0646\u062D\u0649",
  36235. "\uFD97",
  36236. "\u0646\u062C\u0645",
  36237. "\uFD98",
  36238. "\u0646\u062C\u0645",
  36239. "\uFD99",
  36240. "\u0646\u062C\u0649",
  36241. "\uFD9A",
  36242. "\u0646\u0645\u064A",
  36243. "\uFD9B",
  36244. "\u0646\u0645\u0649",
  36245. "\uFD9C",
  36246. "\u064A\u0645\u0645",
  36247. "\uFD9D",
  36248. "\u064A\u0645\u0645",
  36249. "\uFD9E",
  36250. "\u0628\u062E\u064A",
  36251. "\uFD9F",
  36252. "\u062A\u062C\u064A",
  36253. "\uFDA0",
  36254. "\u062A\u062C\u0649",
  36255. "\uFDA1",
  36256. "\u062A\u062E\u064A",
  36257. "\uFDA2",
  36258. "\u062A\u062E\u0649",
  36259. "\uFDA3",
  36260. "\u062A\u0645\u064A",
  36261. "\uFDA4",
  36262. "\u062A\u0645\u0649",
  36263. "\uFDA5",
  36264. "\u062C\u0645\u064A",
  36265. "\uFDA6",
  36266. "\u062C\u062D\u0649",
  36267. "\uFDA7",
  36268. "\u062C\u0645\u0649",
  36269. "\uFDA8",
  36270. "\u0633\u062E\u0649",
  36271. "\uFDA9",
  36272. "\u0635\u062D\u064A",
  36273. "\uFDAA",
  36274. "\u0634\u062D\u064A",
  36275. "\uFDAB",
  36276. "\u0636\u062D\u064A",
  36277. "\uFDAC",
  36278. "\u0644\u062C\u064A",
  36279. "\uFDAD",
  36280. "\u0644\u0645\u064A",
  36281. "\uFDAE",
  36282. "\u064A\u062D\u064A",
  36283. "\uFDAF",
  36284. "\u064A\u062C\u064A",
  36285. "\uFDB0",
  36286. "\u064A\u0645\u064A",
  36287. "\uFDB1",
  36288. "\u0645\u0645\u064A",
  36289. "\uFDB2",
  36290. "\u0642\u0645\u064A",
  36291. "\uFDB3",
  36292. "\u0646\u062D\u064A",
  36293. "\uFDB4",
  36294. "\u0642\u0645\u062D",
  36295. "\uFDB5",
  36296. "\u0644\u062D\u0645",
  36297. "\uFDB6",
  36298. "\u0639\u0645\u064A",
  36299. "\uFDB7",
  36300. "\u0643\u0645\u064A",
  36301. "\uFDB8",
  36302. "\u0646\u062C\u062D",
  36303. "\uFDB9",
  36304. "\u0645\u062E\u064A",
  36305. "\uFDBA",
  36306. "\u0644\u062C\u0645",
  36307. "\uFDBB",
  36308. "\u0643\u0645\u0645",
  36309. "\uFDBC",
  36310. "\u0644\u062C\u0645",
  36311. "\uFDBD",
  36312. "\u0646\u062C\u062D",
  36313. "\uFDBE",
  36314. "\u062C\u062D\u064A",
  36315. "\uFDBF",
  36316. "\u062D\u062C\u064A",
  36317. "\uFDC0",
  36318. "\u0645\u062C\u064A",
  36319. "\uFDC1",
  36320. "\u0641\u0645\u064A",
  36321. "\uFDC2",
  36322. "\u0628\u062D\u064A",
  36323. "\uFDC3",
  36324. "\u0643\u0645\u0645",
  36325. "\uFDC4",
  36326. "\u0639\u062C\u0645",
  36327. "\uFDC5",
  36328. "\u0635\u0645\u0645",
  36329. "\uFDC6",
  36330. "\u0633\u062E\u064A",
  36331. "\uFDC7",
  36332. "\u0646\u062C\u064A",
  36333. "\uFE49",
  36334. "\u203E",
  36335. "\uFE4A",
  36336. "\u203E",
  36337. "\uFE4B",
  36338. "\u203E",
  36339. "\uFE4C",
  36340. "\u203E",
  36341. "\uFE4D",
  36342. "\u005F",
  36343. "\uFE4E",
  36344. "\u005F",
  36345. "\uFE4F",
  36346. "\u005F",
  36347. "\uFE80",
  36348. "\u0621",
  36349. "\uFE81",
  36350. "\u0622",
  36351. "\uFE82",
  36352. "\u0622",
  36353. "\uFE83",
  36354. "\u0623",
  36355. "\uFE84",
  36356. "\u0623",
  36357. "\uFE85",
  36358. "\u0624",
  36359. "\uFE86",
  36360. "\u0624",
  36361. "\uFE87",
  36362. "\u0625",
  36363. "\uFE88",
  36364. "\u0625",
  36365. "\uFE89",
  36366. "\u0626",
  36367. "\uFE8A",
  36368. "\u0626",
  36369. "\uFE8B",
  36370. "\u0626",
  36371. "\uFE8C",
  36372. "\u0626",
  36373. "\uFE8D",
  36374. "\u0627",
  36375. "\uFE8E",
  36376. "\u0627",
  36377. "\uFE8F",
  36378. "\u0628",
  36379. "\uFE90",
  36380. "\u0628",
  36381. "\uFE91",
  36382. "\u0628",
  36383. "\uFE92",
  36384. "\u0628",
  36385. "\uFE93",
  36386. "\u0629",
  36387. "\uFE94",
  36388. "\u0629",
  36389. "\uFE95",
  36390. "\u062A",
  36391. "\uFE96",
  36392. "\u062A",
  36393. "\uFE97",
  36394. "\u062A",
  36395. "\uFE98",
  36396. "\u062A",
  36397. "\uFE99",
  36398. "\u062B",
  36399. "\uFE9A",
  36400. "\u062B",
  36401. "\uFE9B",
  36402. "\u062B",
  36403. "\uFE9C",
  36404. "\u062B",
  36405. "\uFE9D",
  36406. "\u062C",
  36407. "\uFE9E",
  36408. "\u062C",
  36409. "\uFE9F",
  36410. "\u062C",
  36411. "\uFEA0",
  36412. "\u062C",
  36413. "\uFEA1",
  36414. "\u062D",
  36415. "\uFEA2",
  36416. "\u062D",
  36417. "\uFEA3",
  36418. "\u062D",
  36419. "\uFEA4",
  36420. "\u062D",
  36421. "\uFEA5",
  36422. "\u062E",
  36423. "\uFEA6",
  36424. "\u062E",
  36425. "\uFEA7",
  36426. "\u062E",
  36427. "\uFEA8",
  36428. "\u062E",
  36429. "\uFEA9",
  36430. "\u062F",
  36431. "\uFEAA",
  36432. "\u062F",
  36433. "\uFEAB",
  36434. "\u0630",
  36435. "\uFEAC",
  36436. "\u0630",
  36437. "\uFEAD",
  36438. "\u0631",
  36439. "\uFEAE",
  36440. "\u0631",
  36441. "\uFEAF",
  36442. "\u0632",
  36443. "\uFEB0",
  36444. "\u0632",
  36445. "\uFEB1",
  36446. "\u0633",
  36447. "\uFEB2",
  36448. "\u0633",
  36449. "\uFEB3",
  36450. "\u0633",
  36451. "\uFEB4",
  36452. "\u0633",
  36453. "\uFEB5",
  36454. "\u0634",
  36455. "\uFEB6",
  36456. "\u0634",
  36457. "\uFEB7",
  36458. "\u0634",
  36459. "\uFEB8",
  36460. "\u0634",
  36461. "\uFEB9",
  36462. "\u0635",
  36463. "\uFEBA",
  36464. "\u0635",
  36465. "\uFEBB",
  36466. "\u0635",
  36467. "\uFEBC",
  36468. "\u0635",
  36469. "\uFEBD",
  36470. "\u0636",
  36471. "\uFEBE",
  36472. "\u0636",
  36473. "\uFEBF",
  36474. "\u0636",
  36475. "\uFEC0",
  36476. "\u0636",
  36477. "\uFEC1",
  36478. "\u0637",
  36479. "\uFEC2",
  36480. "\u0637",
  36481. "\uFEC3",
  36482. "\u0637",
  36483. "\uFEC4",
  36484. "\u0637",
  36485. "\uFEC5",
  36486. "\u0638",
  36487. "\uFEC6",
  36488. "\u0638",
  36489. "\uFEC7",
  36490. "\u0638",
  36491. "\uFEC8",
  36492. "\u0638",
  36493. "\uFEC9",
  36494. "\u0639",
  36495. "\uFECA",
  36496. "\u0639",
  36497. "\uFECB",
  36498. "\u0639",
  36499. "\uFECC",
  36500. "\u0639",
  36501. "\uFECD",
  36502. "\u063A",
  36503. "\uFECE",
  36504. "\u063A",
  36505. "\uFECF",
  36506. "\u063A",
  36507. "\uFED0",
  36508. "\u063A",
  36509. "\uFED1",
  36510. "\u0641",
  36511. "\uFED2",
  36512. "\u0641",
  36513. "\uFED3",
  36514. "\u0641",
  36515. "\uFED4",
  36516. "\u0641",
  36517. "\uFED5",
  36518. "\u0642",
  36519. "\uFED6",
  36520. "\u0642",
  36521. "\uFED7",
  36522. "\u0642",
  36523. "\uFED8",
  36524. "\u0642",
  36525. "\uFED9",
  36526. "\u0643",
  36527. "\uFEDA",
  36528. "\u0643",
  36529. "\uFEDB",
  36530. "\u0643",
  36531. "\uFEDC",
  36532. "\u0643",
  36533. "\uFEDD",
  36534. "\u0644",
  36535. "\uFEDE",
  36536. "\u0644",
  36537. "\uFEDF",
  36538. "\u0644",
  36539. "\uFEE0",
  36540. "\u0644",
  36541. "\uFEE1",
  36542. "\u0645",
  36543. "\uFEE2",
  36544. "\u0645",
  36545. "\uFEE3",
  36546. "\u0645",
  36547. "\uFEE4",
  36548. "\u0645",
  36549. "\uFEE5",
  36550. "\u0646",
  36551. "\uFEE6",
  36552. "\u0646",
  36553. "\uFEE7",
  36554. "\u0646",
  36555. "\uFEE8",
  36556. "\u0646",
  36557. "\uFEE9",
  36558. "\u0647",
  36559. "\uFEEA",
  36560. "\u0647",
  36561. "\uFEEB",
  36562. "\u0647",
  36563. "\uFEEC",
  36564. "\u0647",
  36565. "\uFEED",
  36566. "\u0648",
  36567. "\uFEEE",
  36568. "\u0648",
  36569. "\uFEEF",
  36570. "\u0649",
  36571. "\uFEF0",
  36572. "\u0649",
  36573. "\uFEF1",
  36574. "\u064A",
  36575. "\uFEF2",
  36576. "\u064A",
  36577. "\uFEF3",
  36578. "\u064A",
  36579. "\uFEF4",
  36580. "\u064A",
  36581. "\uFEF5",
  36582. "\u0644\u0622",
  36583. "\uFEF6",
  36584. "\u0644\u0622",
  36585. "\uFEF7",
  36586. "\u0644\u0623",
  36587. "\uFEF8",
  36588. "\u0644\u0623",
  36589. "\uFEF9",
  36590. "\u0644\u0625",
  36591. "\uFEFA",
  36592. "\u0644\u0625",
  36593. "\uFEFB",
  36594. "\u0644\u0627",
  36595. "\uFEFC",
  36596. "\u0644\u0627"
  36597. ];
  36598. });
  36599. function reverseIfRtl(chars) {
  36600. const charsLength = chars.length;
  36601. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  36602. return chars;
  36603. }
  36604. const buf = [];
  36605. for (let ii = charsLength - 1; ii >= 0; ii--) {
  36606. buf.push(chars[ii]);
  36607. }
  36608. return buf.join("");
  36609. }
  36610. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  36611. const CategoryCache = new Map();
  36612. function getCharUnicodeCategory(char) {
  36613. const cachedCategory = CategoryCache.get(char);
  36614. if (cachedCategory) {
  36615. return cachedCategory;
  36616. }
  36617. const groups = char.match(SpecialCharRegExp);
  36618. const category = {
  36619. isWhitespace: !!(groups && groups[1]),
  36620. isZeroWidthDiacritic: !!(groups && groups[2]),
  36621. isInvisibleFormatMark: !!(groups && groups[3])
  36622. };
  36623. CategoryCache.set(char, category);
  36624. return category;
  36625. }
  36626. function clearUnicodeCaches() {
  36627. CategoryCache.clear();
  36628. }
  36629. /***/ }),
  36630. /* 39 */
  36631. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36632. Object.defineProperty(exports, "__esModule", ({
  36633. value: true
  36634. }));
  36635. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36636. exports.getStandardFontName = getStandardFontName;
  36637. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36638. var _core_utils = __w_pdfjs_require__(4);
  36639. var _fonts_utils = __w_pdfjs_require__(36);
  36640. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36641. t["Times-Roman"] = "Times-Roman";
  36642. t.Helvetica = "Helvetica";
  36643. t.Courier = "Courier";
  36644. t.Symbol = "Symbol";
  36645. t["Times-Bold"] = "Times-Bold";
  36646. t["Helvetica-Bold"] = "Helvetica-Bold";
  36647. t["Courier-Bold"] = "Courier-Bold";
  36648. t.ZapfDingbats = "ZapfDingbats";
  36649. t["Times-Italic"] = "Times-Italic";
  36650. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36651. t["Courier-Oblique"] = "Courier-Oblique";
  36652. t["Times-BoldItalic"] = "Times-BoldItalic";
  36653. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36654. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36655. t.ArialNarrow = "Helvetica";
  36656. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36657. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36658. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36659. t.ArialBlack = "Helvetica";
  36660. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36661. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36662. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36663. t["Arial-Black"] = "Helvetica";
  36664. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36665. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36666. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36667. t.Arial = "Helvetica";
  36668. t["Arial-Bold"] = "Helvetica-Bold";
  36669. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36670. t["Arial-Italic"] = "Helvetica-Oblique";
  36671. t.ArialMT = "Helvetica";
  36672. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36673. t["Arial-BoldMT"] = "Helvetica-Bold";
  36674. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36675. t.ArialUnicodeMS = "Helvetica";
  36676. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  36677. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  36678. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  36679. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36680. t["Courier-Italic"] = "Courier-Oblique";
  36681. t.CourierNew = "Courier";
  36682. t["CourierNew-Bold"] = "Courier-Bold";
  36683. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  36684. t["CourierNew-Italic"] = "Courier-Oblique";
  36685. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  36686. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  36687. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  36688. t.CourierNewPSMT = "Courier";
  36689. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  36690. t["Helvetica-Italic"] = "Helvetica-Oblique";
  36691. t["Symbol-Bold"] = "Symbol";
  36692. t["Symbol-BoldItalic"] = "Symbol";
  36693. t["Symbol-Italic"] = "Symbol";
  36694. t.TimesNewRoman = "Times-Roman";
  36695. t["TimesNewRoman-Bold"] = "Times-Bold";
  36696. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  36697. t["TimesNewRoman-Italic"] = "Times-Italic";
  36698. t.TimesNewRomanPS = "Times-Roman";
  36699. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  36700. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  36701. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  36702. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  36703. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  36704. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  36705. t.TimesNewRomanPSMT = "Times-Roman";
  36706. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  36707. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  36708. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  36709. });
  36710. exports.getStdFontMap = getStdFontMap;
  36711. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36712. t.Courier = "FoxitFixed.pfb";
  36713. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  36714. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  36715. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  36716. t.Helvetica = "FoxitSans.pfb";
  36717. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  36718. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  36719. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36720. t["Times-Roman"] = "FoxitSerif.pfb";
  36721. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36722. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36723. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36724. t.Symbol = "FoxitSymbol.pfb";
  36725. t.ZapfDingbats = "FoxitDingbats.pfb";
  36726. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36727. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36728. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36729. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36730. });
  36731. exports.getFontNameToFileMap = getFontNameToFileMap;
  36732. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36733. t.Calibri = "Helvetica";
  36734. t["Calibri-Bold"] = "Helvetica-Bold";
  36735. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36736. t["Calibri-Italic"] = "Helvetica-Oblique";
  36737. t.CenturyGothic = "Helvetica";
  36738. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36739. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36740. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36741. t.ComicSansMS = "Comic Sans MS";
  36742. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36743. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36744. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36745. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36746. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36747. t["ItcSymbol-Book"] = "Helvetica";
  36748. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36749. t["ItcSymbol-Medium"] = "Helvetica";
  36750. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36751. t.LucidaConsole = "Courier";
  36752. t["LucidaConsole-Bold"] = "Courier-Bold";
  36753. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36754. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36755. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36756. t["MS-Gothic"] = "MS Gothic";
  36757. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36758. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36759. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36760. t["MS-Mincho"] = "MS Mincho";
  36761. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36762. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36763. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36764. t["MS-PGothic"] = "MS PGothic";
  36765. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36766. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36767. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36768. t["MS-PMincho"] = "MS PMincho";
  36769. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36770. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36771. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36772. t.NuptialScript = "Times-Italic";
  36773. t.SegoeUISymbol = "Helvetica";
  36774. t.Wingdings = "ZapfDingbats";
  36775. t["Wingdings-Regular"] = "ZapfDingbats";
  36776. });
  36777. exports.getNonStdFontMap = getNonStdFontMap;
  36778. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36779. t["Adobe Jenson"] = true;
  36780. t["Adobe Text"] = true;
  36781. t.Albertus = true;
  36782. t.Aldus = true;
  36783. t.Alexandria = true;
  36784. t.Algerian = true;
  36785. t["American Typewriter"] = true;
  36786. t.Antiqua = true;
  36787. t.Apex = true;
  36788. t.Arno = true;
  36789. t.Aster = true;
  36790. t.Aurora = true;
  36791. t.Baskerville = true;
  36792. t.Bell = true;
  36793. t.Bembo = true;
  36794. t["Bembo Schoolbook"] = true;
  36795. t.Benguiat = true;
  36796. t["Berkeley Old Style"] = true;
  36797. t["Bernhard Modern"] = true;
  36798. t["Berthold City"] = true;
  36799. t.Bodoni = true;
  36800. t["Bauer Bodoni"] = true;
  36801. t["Book Antiqua"] = true;
  36802. t.Bookman = true;
  36803. t["Bordeaux Roman"] = true;
  36804. t["Californian FB"] = true;
  36805. t.Calisto = true;
  36806. t.Calvert = true;
  36807. t.Capitals = true;
  36808. t.Cambria = true;
  36809. t.Cartier = true;
  36810. t.Caslon = true;
  36811. t.Catull = true;
  36812. t.Centaur = true;
  36813. t["Century Old Style"] = true;
  36814. t["Century Schoolbook"] = true;
  36815. t.Chaparral = true;
  36816. t["Charis SIL"] = true;
  36817. t.Cheltenham = true;
  36818. t["Cholla Slab"] = true;
  36819. t.Clarendon = true;
  36820. t.Clearface = true;
  36821. t.Cochin = true;
  36822. t.Colonna = true;
  36823. t["Computer Modern"] = true;
  36824. t["Concrete Roman"] = true;
  36825. t.Constantia = true;
  36826. t["Cooper Black"] = true;
  36827. t.Corona = true;
  36828. t.Ecotype = true;
  36829. t.Egyptienne = true;
  36830. t.Elephant = true;
  36831. t.Excelsior = true;
  36832. t.Fairfield = true;
  36833. t["FF Scala"] = true;
  36834. t.Folkard = true;
  36835. t.Footlight = true;
  36836. t.FreeSerif = true;
  36837. t["Friz Quadrata"] = true;
  36838. t.Garamond = true;
  36839. t.Gentium = true;
  36840. t.Georgia = true;
  36841. t.Gloucester = true;
  36842. t["Goudy Old Style"] = true;
  36843. t["Goudy Schoolbook"] = true;
  36844. t["Goudy Pro Font"] = true;
  36845. t.Granjon = true;
  36846. t["Guardian Egyptian"] = true;
  36847. t.Heather = true;
  36848. t.Hercules = true;
  36849. t["High Tower Text"] = true;
  36850. t.Hiroshige = true;
  36851. t["Hoefler Text"] = true;
  36852. t["Humana Serif"] = true;
  36853. t.Imprint = true;
  36854. t["Ionic No. 5"] = true;
  36855. t.Janson = true;
  36856. t.Joanna = true;
  36857. t.Korinna = true;
  36858. t.Lexicon = true;
  36859. t.LiberationSerif = true;
  36860. t["Liberation Serif"] = true;
  36861. t["Linux Libertine"] = true;
  36862. t.Literaturnaya = true;
  36863. t.Lucida = true;
  36864. t["Lucida Bright"] = true;
  36865. t.Melior = true;
  36866. t.Memphis = true;
  36867. t.Miller = true;
  36868. t.Minion = true;
  36869. t.Modern = true;
  36870. t["Mona Lisa"] = true;
  36871. t["Mrs Eaves"] = true;
  36872. t["MS Serif"] = true;
  36873. t["Museo Slab"] = true;
  36874. t["New York"] = true;
  36875. t["Nimbus Roman"] = true;
  36876. t["NPS Rawlinson Roadway"] = true;
  36877. t.NuptialScript = true;
  36878. t.Palatino = true;
  36879. t.Perpetua = true;
  36880. t.Plantin = true;
  36881. t["Plantin Schoolbook"] = true;
  36882. t.Playbill = true;
  36883. t["Poor Richard"] = true;
  36884. t["Rawlinson Roadway"] = true;
  36885. t.Renault = true;
  36886. t.Requiem = true;
  36887. t.Rockwell = true;
  36888. t.Roman = true;
  36889. t["Rotis Serif"] = true;
  36890. t.Sabon = true;
  36891. t.Scala = true;
  36892. t.Seagull = true;
  36893. t.Sistina = true;
  36894. t.Souvenir = true;
  36895. t.STIX = true;
  36896. t["Stone Informal"] = true;
  36897. t["Stone Serif"] = true;
  36898. t.Sylfaen = true;
  36899. t.Times = true;
  36900. t.Trajan = true;
  36901. t["Trinité"] = true;
  36902. t["Trump Mediaeval"] = true;
  36903. t.Utopia = true;
  36904. t["Vale Type"] = true;
  36905. t["Bitstream Vera"] = true;
  36906. t["Vera Serif"] = true;
  36907. t.Versailles = true;
  36908. t.Wanted = true;
  36909. t.Weiss = true;
  36910. t["Wide Latin"] = true;
  36911. t.Windsor = true;
  36912. t.XITS = true;
  36913. });
  36914. exports.getSerifFonts = getSerifFonts;
  36915. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36916. t.Dingbats = true;
  36917. t.Symbol = true;
  36918. t.ZapfDingbats = true;
  36919. });
  36920. exports.getSymbolsFonts = getSymbolsFonts;
  36921. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36922. t[2] = 10;
  36923. t[3] = 32;
  36924. t[4] = 33;
  36925. t[5] = 34;
  36926. t[6] = 35;
  36927. t[7] = 36;
  36928. t[8] = 37;
  36929. t[9] = 38;
  36930. t[10] = 39;
  36931. t[11] = 40;
  36932. t[12] = 41;
  36933. t[13] = 42;
  36934. t[14] = 43;
  36935. t[15] = 44;
  36936. t[16] = 45;
  36937. t[17] = 46;
  36938. t[18] = 47;
  36939. t[19] = 48;
  36940. t[20] = 49;
  36941. t[21] = 50;
  36942. t[22] = 51;
  36943. t[23] = 52;
  36944. t[24] = 53;
  36945. t[25] = 54;
  36946. t[26] = 55;
  36947. t[27] = 56;
  36948. t[28] = 57;
  36949. t[29] = 58;
  36950. t[30] = 894;
  36951. t[31] = 60;
  36952. t[32] = 61;
  36953. t[33] = 62;
  36954. t[34] = 63;
  36955. t[35] = 64;
  36956. t[36] = 65;
  36957. t[37] = 66;
  36958. t[38] = 67;
  36959. t[39] = 68;
  36960. t[40] = 69;
  36961. t[41] = 70;
  36962. t[42] = 71;
  36963. t[43] = 72;
  36964. t[44] = 73;
  36965. t[45] = 74;
  36966. t[46] = 75;
  36967. t[47] = 76;
  36968. t[48] = 77;
  36969. t[49] = 78;
  36970. t[50] = 79;
  36971. t[51] = 80;
  36972. t[52] = 81;
  36973. t[53] = 82;
  36974. t[54] = 83;
  36975. t[55] = 84;
  36976. t[56] = 85;
  36977. t[57] = 86;
  36978. t[58] = 87;
  36979. t[59] = 88;
  36980. t[60] = 89;
  36981. t[61] = 90;
  36982. t[62] = 91;
  36983. t[63] = 92;
  36984. t[64] = 93;
  36985. t[65] = 94;
  36986. t[66] = 95;
  36987. t[67] = 96;
  36988. t[68] = 97;
  36989. t[69] = 98;
  36990. t[70] = 99;
  36991. t[71] = 100;
  36992. t[72] = 101;
  36993. t[73] = 102;
  36994. t[74] = 103;
  36995. t[75] = 104;
  36996. t[76] = 105;
  36997. t[77] = 106;
  36998. t[78] = 107;
  36999. t[79] = 108;
  37000. t[80] = 109;
  37001. t[81] = 110;
  37002. t[82] = 111;
  37003. t[83] = 112;
  37004. t[84] = 113;
  37005. t[85] = 114;
  37006. t[86] = 115;
  37007. t[87] = 116;
  37008. t[88] = 117;
  37009. t[89] = 118;
  37010. t[90] = 119;
  37011. t[91] = 120;
  37012. t[92] = 121;
  37013. t[93] = 122;
  37014. t[94] = 123;
  37015. t[95] = 124;
  37016. t[96] = 125;
  37017. t[97] = 126;
  37018. t[98] = 196;
  37019. t[99] = 197;
  37020. t[100] = 199;
  37021. t[101] = 201;
  37022. t[102] = 209;
  37023. t[103] = 214;
  37024. t[104] = 220;
  37025. t[105] = 225;
  37026. t[106] = 224;
  37027. t[107] = 226;
  37028. t[108] = 228;
  37029. t[109] = 227;
  37030. t[110] = 229;
  37031. t[111] = 231;
  37032. t[112] = 233;
  37033. t[113] = 232;
  37034. t[114] = 234;
  37035. t[115] = 235;
  37036. t[116] = 237;
  37037. t[117] = 236;
  37038. t[118] = 238;
  37039. t[119] = 239;
  37040. t[120] = 241;
  37041. t[121] = 243;
  37042. t[122] = 242;
  37043. t[123] = 244;
  37044. t[124] = 246;
  37045. t[125] = 245;
  37046. t[126] = 250;
  37047. t[127] = 249;
  37048. t[128] = 251;
  37049. t[129] = 252;
  37050. t[130] = 8224;
  37051. t[131] = 176;
  37052. t[132] = 162;
  37053. t[133] = 163;
  37054. t[134] = 167;
  37055. t[135] = 8226;
  37056. t[136] = 182;
  37057. t[137] = 223;
  37058. t[138] = 174;
  37059. t[139] = 169;
  37060. t[140] = 8482;
  37061. t[141] = 180;
  37062. t[142] = 168;
  37063. t[143] = 8800;
  37064. t[144] = 198;
  37065. t[145] = 216;
  37066. t[146] = 8734;
  37067. t[147] = 177;
  37068. t[148] = 8804;
  37069. t[149] = 8805;
  37070. t[150] = 165;
  37071. t[151] = 181;
  37072. t[152] = 8706;
  37073. t[153] = 8721;
  37074. t[154] = 8719;
  37075. t[156] = 8747;
  37076. t[157] = 170;
  37077. t[158] = 186;
  37078. t[159] = 8486;
  37079. t[160] = 230;
  37080. t[161] = 248;
  37081. t[162] = 191;
  37082. t[163] = 161;
  37083. t[164] = 172;
  37084. t[165] = 8730;
  37085. t[166] = 402;
  37086. t[167] = 8776;
  37087. t[168] = 8710;
  37088. t[169] = 171;
  37089. t[170] = 187;
  37090. t[171] = 8230;
  37091. t[179] = 8220;
  37092. t[180] = 8221;
  37093. t[181] = 8216;
  37094. t[182] = 8217;
  37095. t[200] = 193;
  37096. t[203] = 205;
  37097. t[210] = 218;
  37098. t[223] = 711;
  37099. t[224] = 321;
  37100. t[225] = 322;
  37101. t[226] = 352;
  37102. t[227] = 353;
  37103. t[228] = 381;
  37104. t[229] = 382;
  37105. t[233] = 221;
  37106. t[234] = 253;
  37107. t[252] = 263;
  37108. t[253] = 268;
  37109. t[254] = 269;
  37110. t[258] = 258;
  37111. t[260] = 260;
  37112. t[261] = 261;
  37113. t[265] = 280;
  37114. t[266] = 281;
  37115. t[267] = 282;
  37116. t[268] = 283;
  37117. t[269] = 313;
  37118. t[275] = 323;
  37119. t[276] = 324;
  37120. t[278] = 328;
  37121. t[283] = 344;
  37122. t[284] = 345;
  37123. t[285] = 346;
  37124. t[286] = 347;
  37125. t[292] = 367;
  37126. t[295] = 377;
  37127. t[296] = 378;
  37128. t[298] = 380;
  37129. t[305] = 963;
  37130. t[306] = 964;
  37131. t[307] = 966;
  37132. t[308] = 8215;
  37133. t[309] = 8252;
  37134. t[310] = 8319;
  37135. t[311] = 8359;
  37136. t[312] = 8592;
  37137. t[313] = 8593;
  37138. t[337] = 9552;
  37139. t[493] = 1039;
  37140. t[494] = 1040;
  37141. t[672] = 1488;
  37142. t[673] = 1489;
  37143. t[674] = 1490;
  37144. t[675] = 1491;
  37145. t[676] = 1492;
  37146. t[677] = 1493;
  37147. t[678] = 1494;
  37148. t[679] = 1495;
  37149. t[680] = 1496;
  37150. t[681] = 1497;
  37151. t[682] = 1498;
  37152. t[683] = 1499;
  37153. t[684] = 1500;
  37154. t[685] = 1501;
  37155. t[686] = 1502;
  37156. t[687] = 1503;
  37157. t[688] = 1504;
  37158. t[689] = 1505;
  37159. t[690] = 1506;
  37160. t[691] = 1507;
  37161. t[692] = 1508;
  37162. t[693] = 1509;
  37163. t[694] = 1510;
  37164. t[695] = 1511;
  37165. t[696] = 1512;
  37166. t[697] = 1513;
  37167. t[698] = 1514;
  37168. t[705] = 1524;
  37169. t[706] = 8362;
  37170. t[710] = 64288;
  37171. t[711] = 64298;
  37172. t[759] = 1617;
  37173. t[761] = 1776;
  37174. t[763] = 1778;
  37175. t[775] = 1652;
  37176. t[777] = 1764;
  37177. t[778] = 1780;
  37178. t[779] = 1781;
  37179. t[780] = 1782;
  37180. t[782] = 771;
  37181. t[783] = 64726;
  37182. t[786] = 8363;
  37183. t[788] = 8532;
  37184. t[790] = 768;
  37185. t[791] = 769;
  37186. t[792] = 768;
  37187. t[795] = 803;
  37188. t[797] = 64336;
  37189. t[798] = 64337;
  37190. t[799] = 64342;
  37191. t[800] = 64343;
  37192. t[801] = 64344;
  37193. t[802] = 64345;
  37194. t[803] = 64362;
  37195. t[804] = 64363;
  37196. t[805] = 64364;
  37197. t[2424] = 7821;
  37198. t[2425] = 7822;
  37199. t[2426] = 7823;
  37200. t[2427] = 7824;
  37201. t[2428] = 7825;
  37202. t[2429] = 7826;
  37203. t[2430] = 7827;
  37204. t[2433] = 7682;
  37205. t[2678] = 8045;
  37206. t[2679] = 8046;
  37207. t[2830] = 1552;
  37208. t[2838] = 686;
  37209. t[2840] = 751;
  37210. t[2842] = 753;
  37211. t[2843] = 754;
  37212. t[2844] = 755;
  37213. t[2846] = 757;
  37214. t[2856] = 767;
  37215. t[2857] = 848;
  37216. t[2858] = 849;
  37217. t[2862] = 853;
  37218. t[2863] = 854;
  37219. t[2864] = 855;
  37220. t[2865] = 861;
  37221. t[2866] = 862;
  37222. t[2906] = 7460;
  37223. t[2908] = 7462;
  37224. t[2909] = 7463;
  37225. t[2910] = 7464;
  37226. t[2912] = 7466;
  37227. t[2913] = 7467;
  37228. t[2914] = 7468;
  37229. t[2916] = 7470;
  37230. t[2917] = 7471;
  37231. t[2918] = 7472;
  37232. t[2920] = 7474;
  37233. t[2921] = 7475;
  37234. t[2922] = 7476;
  37235. t[2924] = 7478;
  37236. t[2925] = 7479;
  37237. t[2926] = 7480;
  37238. t[2928] = 7482;
  37239. t[2929] = 7483;
  37240. t[2930] = 7484;
  37241. t[2932] = 7486;
  37242. t[2933] = 7487;
  37243. t[2934] = 7488;
  37244. t[2936] = 7490;
  37245. t[2937] = 7491;
  37246. t[2938] = 7492;
  37247. t[2940] = 7494;
  37248. t[2941] = 7495;
  37249. t[2942] = 7496;
  37250. t[2944] = 7498;
  37251. t[2946] = 7500;
  37252. t[2948] = 7502;
  37253. t[2950] = 7504;
  37254. t[2951] = 7505;
  37255. t[2952] = 7506;
  37256. t[2954] = 7508;
  37257. t[2955] = 7509;
  37258. t[2956] = 7510;
  37259. t[2958] = 7512;
  37260. t[2959] = 7513;
  37261. t[2960] = 7514;
  37262. t[2962] = 7516;
  37263. t[2963] = 7517;
  37264. t[2964] = 7518;
  37265. t[2966] = 7520;
  37266. t[2967] = 7521;
  37267. t[2968] = 7522;
  37268. t[2970] = 7524;
  37269. t[2971] = 7525;
  37270. t[2972] = 7526;
  37271. t[2974] = 7528;
  37272. t[2975] = 7529;
  37273. t[2976] = 7530;
  37274. t[2978] = 1537;
  37275. t[2979] = 1538;
  37276. t[2980] = 1539;
  37277. t[2982] = 1549;
  37278. t[2983] = 1551;
  37279. t[2984] = 1552;
  37280. t[2986] = 1554;
  37281. t[2987] = 1555;
  37282. t[2988] = 1556;
  37283. t[2990] = 1623;
  37284. t[2991] = 1624;
  37285. t[2995] = 1775;
  37286. t[2999] = 1791;
  37287. t[3002] = 64290;
  37288. t[3003] = 64291;
  37289. t[3004] = 64292;
  37290. t[3006] = 64294;
  37291. t[3007] = 64295;
  37292. t[3008] = 64296;
  37293. t[3011] = 1900;
  37294. t[3014] = 8223;
  37295. t[3015] = 8244;
  37296. t[3017] = 7532;
  37297. t[3018] = 7533;
  37298. t[3019] = 7534;
  37299. t[3075] = 7590;
  37300. t[3076] = 7591;
  37301. t[3079] = 7594;
  37302. t[3080] = 7595;
  37303. t[3083] = 7598;
  37304. t[3084] = 7599;
  37305. t[3087] = 7602;
  37306. t[3088] = 7603;
  37307. t[3091] = 7606;
  37308. t[3092] = 7607;
  37309. t[3095] = 7610;
  37310. t[3096] = 7611;
  37311. t[3099] = 7614;
  37312. t[3100] = 7615;
  37313. t[3103] = 7618;
  37314. t[3104] = 7619;
  37315. t[3107] = 8337;
  37316. t[3108] = 8338;
  37317. t[3116] = 1884;
  37318. t[3119] = 1885;
  37319. t[3120] = 1885;
  37320. t[3123] = 1886;
  37321. t[3124] = 1886;
  37322. t[3127] = 1887;
  37323. t[3128] = 1887;
  37324. t[3131] = 1888;
  37325. t[3132] = 1888;
  37326. t[3135] = 1889;
  37327. t[3136] = 1889;
  37328. t[3139] = 1890;
  37329. t[3140] = 1890;
  37330. t[3143] = 1891;
  37331. t[3144] = 1891;
  37332. t[3147] = 1892;
  37333. t[3148] = 1892;
  37334. t[3153] = 580;
  37335. t[3154] = 581;
  37336. t[3157] = 584;
  37337. t[3158] = 585;
  37338. t[3161] = 588;
  37339. t[3162] = 589;
  37340. t[3165] = 891;
  37341. t[3166] = 892;
  37342. t[3169] = 1274;
  37343. t[3170] = 1275;
  37344. t[3173] = 1278;
  37345. t[3174] = 1279;
  37346. t[3181] = 7622;
  37347. t[3182] = 7623;
  37348. t[3282] = 11799;
  37349. t[3316] = 578;
  37350. t[3379] = 42785;
  37351. t[3393] = 1159;
  37352. t[3416] = 8377;
  37353. });
  37354. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37355. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37356. t[227] = 322;
  37357. t[264] = 261;
  37358. t[291] = 346;
  37359. });
  37360. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37361. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37362. t[1] = 32;
  37363. t[4] = 65;
  37364. t[5] = 192;
  37365. t[6] = 193;
  37366. t[9] = 196;
  37367. t[17] = 66;
  37368. t[18] = 67;
  37369. t[21] = 268;
  37370. t[24] = 68;
  37371. t[28] = 69;
  37372. t[29] = 200;
  37373. t[30] = 201;
  37374. t[32] = 282;
  37375. t[38] = 70;
  37376. t[39] = 71;
  37377. t[44] = 72;
  37378. t[47] = 73;
  37379. t[48] = 204;
  37380. t[49] = 205;
  37381. t[58] = 74;
  37382. t[60] = 75;
  37383. t[62] = 76;
  37384. t[68] = 77;
  37385. t[69] = 78;
  37386. t[75] = 79;
  37387. t[76] = 210;
  37388. t[80] = 214;
  37389. t[87] = 80;
  37390. t[89] = 81;
  37391. t[90] = 82;
  37392. t[92] = 344;
  37393. t[94] = 83;
  37394. t[97] = 352;
  37395. t[100] = 84;
  37396. t[104] = 85;
  37397. t[109] = 220;
  37398. t[115] = 86;
  37399. t[116] = 87;
  37400. t[121] = 88;
  37401. t[122] = 89;
  37402. t[124] = 221;
  37403. t[127] = 90;
  37404. t[129] = 381;
  37405. t[258] = 97;
  37406. t[259] = 224;
  37407. t[260] = 225;
  37408. t[263] = 228;
  37409. t[268] = 261;
  37410. t[271] = 98;
  37411. t[272] = 99;
  37412. t[273] = 263;
  37413. t[275] = 269;
  37414. t[282] = 100;
  37415. t[286] = 101;
  37416. t[287] = 232;
  37417. t[288] = 233;
  37418. t[290] = 283;
  37419. t[295] = 281;
  37420. t[296] = 102;
  37421. t[336] = 103;
  37422. t[346] = 104;
  37423. t[349] = 105;
  37424. t[350] = 236;
  37425. t[351] = 237;
  37426. t[361] = 106;
  37427. t[364] = 107;
  37428. t[367] = 108;
  37429. t[371] = 322;
  37430. t[373] = 109;
  37431. t[374] = 110;
  37432. t[381] = 111;
  37433. t[382] = 242;
  37434. t[383] = 243;
  37435. t[386] = 246;
  37436. t[393] = 112;
  37437. t[395] = 113;
  37438. t[396] = 114;
  37439. t[398] = 345;
  37440. t[400] = 115;
  37441. t[401] = 347;
  37442. t[403] = 353;
  37443. t[410] = 116;
  37444. t[437] = 117;
  37445. t[442] = 252;
  37446. t[448] = 118;
  37447. t[449] = 119;
  37448. t[454] = 120;
  37449. t[455] = 121;
  37450. t[457] = 253;
  37451. t[460] = 122;
  37452. t[462] = 382;
  37453. t[463] = 380;
  37454. t[853] = 44;
  37455. t[855] = 58;
  37456. t[856] = 46;
  37457. t[876] = 47;
  37458. t[878] = 45;
  37459. t[882] = 45;
  37460. t[894] = 40;
  37461. t[895] = 41;
  37462. t[896] = 91;
  37463. t[897] = 93;
  37464. t[923] = 64;
  37465. t[1004] = 48;
  37466. t[1005] = 49;
  37467. t[1006] = 50;
  37468. t[1007] = 51;
  37469. t[1008] = 52;
  37470. t[1009] = 53;
  37471. t[1010] = 54;
  37472. t[1011] = 55;
  37473. t[1012] = 56;
  37474. t[1013] = 57;
  37475. t[1081] = 37;
  37476. t[1085] = 43;
  37477. t[1086] = 45;
  37478. });
  37479. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37480. function getStandardFontName(name) {
  37481. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37482. const stdFontMap = getStdFontMap();
  37483. return stdFontMap[fontName];
  37484. }
  37485. /***/ }),
  37486. /* 40 */
  37487. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37488. Object.defineProperty(exports, "__esModule", ({
  37489. value: true
  37490. }));
  37491. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37492. var _util = __w_pdfjs_require__(2);
  37493. class ToUnicodeMap {
  37494. constructor(cmap = []) {
  37495. this._map = cmap;
  37496. }
  37497. get length() {
  37498. return this._map.length;
  37499. }
  37500. forEach(callback) {
  37501. for (const charCode in this._map) {
  37502. callback(charCode, this._map[charCode].charCodeAt(0));
  37503. }
  37504. }
  37505. has(i) {
  37506. return this._map[i] !== undefined;
  37507. }
  37508. get(i) {
  37509. return this._map[i];
  37510. }
  37511. charCodeOf(value) {
  37512. const map = this._map;
  37513. if (map.length <= 0x10000) {
  37514. return map.indexOf(value);
  37515. }
  37516. for (const charCode in map) {
  37517. if (map[charCode] === value) {
  37518. return charCode | 0;
  37519. }
  37520. }
  37521. return -1;
  37522. }
  37523. amend(map) {
  37524. for (const charCode in map) {
  37525. this._map[charCode] = map[charCode];
  37526. }
  37527. }
  37528. }
  37529. exports.ToUnicodeMap = ToUnicodeMap;
  37530. class IdentityToUnicodeMap {
  37531. constructor(firstChar, lastChar) {
  37532. this.firstChar = firstChar;
  37533. this.lastChar = lastChar;
  37534. }
  37535. get length() {
  37536. return this.lastChar + 1 - this.firstChar;
  37537. }
  37538. forEach(callback) {
  37539. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37540. callback(i, i);
  37541. }
  37542. }
  37543. has(i) {
  37544. return this.firstChar <= i && i <= this.lastChar;
  37545. }
  37546. get(i) {
  37547. if (this.firstChar <= i && i <= this.lastChar) {
  37548. return String.fromCharCode(i);
  37549. }
  37550. return undefined;
  37551. }
  37552. charCodeOf(v) {
  37553. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37554. }
  37555. amend(map) {
  37556. (0, _util.unreachable)("Should not call amend()");
  37557. }
  37558. }
  37559. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37560. /***/ }),
  37561. /* 41 */
  37562. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37563. Object.defineProperty(exports, "__esModule", ({
  37564. value: true
  37565. }));
  37566. exports.CFFFont = void 0;
  37567. var _cff_parser = __w_pdfjs_require__(33);
  37568. var _fonts_utils = __w_pdfjs_require__(36);
  37569. var _util = __w_pdfjs_require__(2);
  37570. class CFFFont {
  37571. constructor(file, properties) {
  37572. this.properties = properties;
  37573. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37574. this.cff = parser.parse();
  37575. this.cff.duplicateFirstGlyph();
  37576. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37577. this.seacs = this.cff.seacs;
  37578. try {
  37579. this.data = compiler.compile();
  37580. } catch (e) {
  37581. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37582. this.data = file;
  37583. }
  37584. this._createBuiltInEncoding();
  37585. }
  37586. get numGlyphs() {
  37587. return this.cff.charStrings.count;
  37588. }
  37589. getCharset() {
  37590. return this.cff.charset.charset;
  37591. }
  37592. getGlyphMapping() {
  37593. const cff = this.cff;
  37594. const properties = this.properties;
  37595. const {
  37596. cidToGidMap,
  37597. cMap
  37598. } = properties;
  37599. const charsets = cff.charset.charset;
  37600. let charCodeToGlyphId;
  37601. let glyphId;
  37602. if (properties.composite) {
  37603. let invCidToGidMap;
  37604. if (cidToGidMap && cidToGidMap.length > 0) {
  37605. invCidToGidMap = Object.create(null);
  37606. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  37607. const gid = cidToGidMap[i];
  37608. if (gid !== undefined) {
  37609. invCidToGidMap[gid] = i;
  37610. }
  37611. }
  37612. }
  37613. charCodeToGlyphId = Object.create(null);
  37614. let charCode;
  37615. if (cff.isCIDFont) {
  37616. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37617. const cid = charsets[glyphId];
  37618. charCode = cMap.charCodeOf(cid);
  37619. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  37620. charCode = invCidToGidMap[charCode];
  37621. }
  37622. charCodeToGlyphId[charCode] = glyphId;
  37623. }
  37624. } else {
  37625. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37626. charCode = cMap.charCodeOf(glyphId);
  37627. charCodeToGlyphId[charCode] = glyphId;
  37628. }
  37629. }
  37630. return charCodeToGlyphId;
  37631. }
  37632. let encoding = cff.encoding ? cff.encoding.encoding : null;
  37633. if (properties.isInternalFont) {
  37634. encoding = properties.defaultEncoding;
  37635. }
  37636. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  37637. return charCodeToGlyphId;
  37638. }
  37639. hasGlyphId(id) {
  37640. return this.cff.hasGlyphId(id);
  37641. }
  37642. _createBuiltInEncoding() {
  37643. const {
  37644. charset,
  37645. encoding
  37646. } = this.cff;
  37647. if (!charset || !encoding) {
  37648. return;
  37649. }
  37650. const charsets = charset.charset,
  37651. encodings = encoding.encoding;
  37652. const map = [];
  37653. for (const charCode in encodings) {
  37654. const glyphId = encodings[charCode];
  37655. if (glyphId >= 0) {
  37656. const glyphName = charsets[glyphId];
  37657. if (glyphName) {
  37658. map[charCode] = glyphName;
  37659. }
  37660. }
  37661. }
  37662. if (map.length > 0) {
  37663. this.properties.builtInEncoding = map;
  37664. }
  37665. }
  37666. }
  37667. exports.CFFFont = CFFFont;
  37668. /***/ }),
  37669. /* 42 */
  37670. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37671. Object.defineProperty(exports, "__esModule", ({
  37672. value: true
  37673. }));
  37674. exports.FontRendererFactory = void 0;
  37675. var _util = __w_pdfjs_require__(2);
  37676. var _cff_parser = __w_pdfjs_require__(33);
  37677. var _glyphlist = __w_pdfjs_require__(37);
  37678. var _encodings = __w_pdfjs_require__(35);
  37679. var _stream = __w_pdfjs_require__(8);
  37680. function getUint32(data, offset) {
  37681. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  37682. }
  37683. function getUint16(data, offset) {
  37684. return data[offset] << 8 | data[offset + 1];
  37685. }
  37686. function getInt16(data, offset) {
  37687. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37688. }
  37689. function getInt8(data, offset) {
  37690. return data[offset] << 24 >> 24;
  37691. }
  37692. function getFloat214(data, offset) {
  37693. return getInt16(data, offset) / 16384;
  37694. }
  37695. function getSubroutineBias(subrs) {
  37696. const numSubrs = subrs.length;
  37697. let bias = 32768;
  37698. if (numSubrs < 1240) {
  37699. bias = 107;
  37700. } else if (numSubrs < 33900) {
  37701. bias = 1131;
  37702. }
  37703. return bias;
  37704. }
  37705. function parseCmap(data, start, end) {
  37706. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37707. const format = getUint16(data, start + offset);
  37708. let ranges, p, i;
  37709. if (format === 4) {
  37710. getUint16(data, start + offset + 2);
  37711. const segCount = getUint16(data, start + offset + 6) >> 1;
  37712. p = start + offset + 14;
  37713. ranges = [];
  37714. for (i = 0; i < segCount; i++, p += 2) {
  37715. ranges[i] = {
  37716. end: getUint16(data, p)
  37717. };
  37718. }
  37719. p += 2;
  37720. for (i = 0; i < segCount; i++, p += 2) {
  37721. ranges[i].start = getUint16(data, p);
  37722. }
  37723. for (i = 0; i < segCount; i++, p += 2) {
  37724. ranges[i].idDelta = getUint16(data, p);
  37725. }
  37726. for (i = 0; i < segCount; i++, p += 2) {
  37727. let idOffset = getUint16(data, p);
  37728. if (idOffset === 0) {
  37729. continue;
  37730. }
  37731. ranges[i].ids = [];
  37732. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  37733. ranges[i].ids[j] = getUint16(data, p + idOffset);
  37734. idOffset += 2;
  37735. }
  37736. }
  37737. return ranges;
  37738. } else if (format === 12) {
  37739. const groups = getUint32(data, start + offset + 12);
  37740. p = start + offset + 16;
  37741. ranges = [];
  37742. for (i = 0; i < groups; i++) {
  37743. start = getUint32(data, p);
  37744. ranges.push({
  37745. start,
  37746. end: getUint32(data, p + 4),
  37747. idDelta: getUint32(data, p + 8) - start
  37748. });
  37749. p += 12;
  37750. }
  37751. return ranges;
  37752. }
  37753. throw new _util.FormatError(`unsupported cmap: ${format}`);
  37754. }
  37755. function parseCff(data, start, end, seacAnalysisEnabled) {
  37756. const properties = {};
  37757. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  37758. const cff = parser.parse();
  37759. return {
  37760. glyphs: cff.charStrings.objects,
  37761. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  37762. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  37763. isCFFCIDFont: cff.isCIDFont,
  37764. fdSelect: cff.fdSelect,
  37765. fdArray: cff.fdArray
  37766. };
  37767. }
  37768. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  37769. let itemSize, itemDecode;
  37770. if (isGlyphLocationsLong) {
  37771. itemSize = 4;
  37772. itemDecode = getUint32;
  37773. } else {
  37774. itemSize = 2;
  37775. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  37776. }
  37777. const glyphs = [];
  37778. let startOffset = itemDecode(loca, 0);
  37779. for (let j = itemSize; j < loca.length; j += itemSize) {
  37780. const endOffset = itemDecode(loca, j);
  37781. glyphs.push(glyf.subarray(startOffset, endOffset));
  37782. startOffset = endOffset;
  37783. }
  37784. return glyphs;
  37785. }
  37786. function lookupCmap(ranges, unicode) {
  37787. const code = unicode.codePointAt(0);
  37788. let gid = 0,
  37789. l = 0,
  37790. r = ranges.length - 1;
  37791. while (l < r) {
  37792. const c = l + r + 1 >> 1;
  37793. if (code < ranges[c].start) {
  37794. r = c - 1;
  37795. } else {
  37796. l = c;
  37797. }
  37798. }
  37799. if (ranges[l].start <= code && code <= ranges[l].end) {
  37800. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37801. }
  37802. return {
  37803. charCode: code,
  37804. glyphId: gid
  37805. };
  37806. }
  37807. function compileGlyf(code, cmds, font) {
  37808. function moveTo(x, y) {
  37809. cmds.push({
  37810. cmd: "moveTo",
  37811. args: [x, y]
  37812. });
  37813. }
  37814. function lineTo(x, y) {
  37815. cmds.push({
  37816. cmd: "lineTo",
  37817. args: [x, y]
  37818. });
  37819. }
  37820. function quadraticCurveTo(xa, ya, x, y) {
  37821. cmds.push({
  37822. cmd: "quadraticCurveTo",
  37823. args: [xa, ya, x, y]
  37824. });
  37825. }
  37826. let i = 0;
  37827. const numberOfContours = getInt16(code, i);
  37828. let flags;
  37829. let x = 0,
  37830. y = 0;
  37831. i += 10;
  37832. if (numberOfContours < 0) {
  37833. do {
  37834. flags = getUint16(code, i);
  37835. const glyphIndex = getUint16(code, i + 2);
  37836. i += 4;
  37837. let arg1, arg2;
  37838. if (flags & 0x01) {
  37839. if (flags & 0x02) {
  37840. arg1 = getInt16(code, i);
  37841. arg2 = getInt16(code, i + 2);
  37842. } else {
  37843. arg1 = getUint16(code, i);
  37844. arg2 = getUint16(code, i + 2);
  37845. }
  37846. i += 4;
  37847. } else {
  37848. if (flags & 0x02) {
  37849. arg1 = getInt8(code, i++);
  37850. arg2 = getInt8(code, i++);
  37851. } else {
  37852. arg1 = code[i++];
  37853. arg2 = code[i++];
  37854. }
  37855. }
  37856. if (flags & 0x02) {
  37857. x = arg1;
  37858. y = arg2;
  37859. } else {
  37860. x = 0;
  37861. y = 0;
  37862. }
  37863. let scaleX = 1,
  37864. scaleY = 1,
  37865. scale01 = 0,
  37866. scale10 = 0;
  37867. if (flags & 0x08) {
  37868. scaleX = scaleY = getFloat214(code, i);
  37869. i += 2;
  37870. } else if (flags & 0x40) {
  37871. scaleX = getFloat214(code, i);
  37872. scaleY = getFloat214(code, i + 2);
  37873. i += 4;
  37874. } else if (flags & 0x80) {
  37875. scaleX = getFloat214(code, i);
  37876. scale01 = getFloat214(code, i + 2);
  37877. scale10 = getFloat214(code, i + 4);
  37878. scaleY = getFloat214(code, i + 6);
  37879. i += 8;
  37880. }
  37881. const subglyph = font.glyphs[glyphIndex];
  37882. if (subglyph) {
  37883. cmds.push({
  37884. cmd: "save"
  37885. }, {
  37886. cmd: "transform",
  37887. args: [scaleX, scale01, scale10, scaleY, x, y]
  37888. });
  37889. if (!(flags & 0x02)) {}
  37890. compileGlyf(subglyph, cmds, font);
  37891. cmds.push({
  37892. cmd: "restore"
  37893. });
  37894. }
  37895. } while (flags & 0x20);
  37896. } else {
  37897. const endPtsOfContours = [];
  37898. let j, jj;
  37899. for (j = 0; j < numberOfContours; j++) {
  37900. endPtsOfContours.push(getUint16(code, i));
  37901. i += 2;
  37902. }
  37903. const instructionLength = getUint16(code, i);
  37904. i += 2 + instructionLength;
  37905. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  37906. const points = [];
  37907. while (points.length < numberOfPoints) {
  37908. flags = code[i++];
  37909. let repeat = 1;
  37910. if (flags & 0x08) {
  37911. repeat += code[i++];
  37912. }
  37913. while (repeat-- > 0) {
  37914. points.push({
  37915. flags
  37916. });
  37917. }
  37918. }
  37919. for (j = 0; j < numberOfPoints; j++) {
  37920. switch (points[j].flags & 0x12) {
  37921. case 0x00:
  37922. x += getInt16(code, i);
  37923. i += 2;
  37924. break;
  37925. case 0x02:
  37926. x -= code[i++];
  37927. break;
  37928. case 0x12:
  37929. x += code[i++];
  37930. break;
  37931. }
  37932. points[j].x = x;
  37933. }
  37934. for (j = 0; j < numberOfPoints; j++) {
  37935. switch (points[j].flags & 0x24) {
  37936. case 0x00:
  37937. y += getInt16(code, i);
  37938. i += 2;
  37939. break;
  37940. case 0x04:
  37941. y -= code[i++];
  37942. break;
  37943. case 0x24:
  37944. y += code[i++];
  37945. break;
  37946. }
  37947. points[j].y = y;
  37948. }
  37949. let startPoint = 0;
  37950. for (i = 0; i < numberOfContours; i++) {
  37951. const endPoint = endPtsOfContours[i];
  37952. const contour = points.slice(startPoint, endPoint + 1);
  37953. if (contour[0].flags & 1) {
  37954. contour.push(contour[0]);
  37955. } else if (contour.at(-1).flags & 1) {
  37956. contour.unshift(contour.at(-1));
  37957. } else {
  37958. const p = {
  37959. flags: 1,
  37960. x: (contour[0].x + contour.at(-1).x) / 2,
  37961. y: (contour[0].y + contour.at(-1).y) / 2
  37962. };
  37963. contour.unshift(p);
  37964. contour.push(p);
  37965. }
  37966. moveTo(contour[0].x, contour[0].y);
  37967. for (j = 1, jj = contour.length; j < jj; j++) {
  37968. if (contour[j].flags & 1) {
  37969. lineTo(contour[j].x, contour[j].y);
  37970. } else if (contour[j + 1].flags & 1) {
  37971. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37972. j++;
  37973. } else {
  37974. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37975. }
  37976. }
  37977. startPoint = endPoint + 1;
  37978. }
  37979. }
  37980. }
  37981. function compileCharString(charStringCode, cmds, font, glyphId) {
  37982. function moveTo(x, y) {
  37983. cmds.push({
  37984. cmd: "moveTo",
  37985. args: [x, y]
  37986. });
  37987. }
  37988. function lineTo(x, y) {
  37989. cmds.push({
  37990. cmd: "lineTo",
  37991. args: [x, y]
  37992. });
  37993. }
  37994. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37995. cmds.push({
  37996. cmd: "bezierCurveTo",
  37997. args: [x1, y1, x2, y2, x, y]
  37998. });
  37999. }
  38000. const stack = [];
  38001. let x = 0,
  38002. y = 0;
  38003. let stems = 0;
  38004. function parse(code) {
  38005. let i = 0;
  38006. while (i < code.length) {
  38007. let stackClean = false;
  38008. let v = code[i++];
  38009. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38010. switch (v) {
  38011. case 1:
  38012. stems += stack.length >> 1;
  38013. stackClean = true;
  38014. break;
  38015. case 3:
  38016. stems += stack.length >> 1;
  38017. stackClean = true;
  38018. break;
  38019. case 4:
  38020. y += stack.pop();
  38021. moveTo(x, y);
  38022. stackClean = true;
  38023. break;
  38024. case 5:
  38025. while (stack.length > 0) {
  38026. x += stack.shift();
  38027. y += stack.shift();
  38028. lineTo(x, y);
  38029. }
  38030. break;
  38031. case 6:
  38032. while (stack.length > 0) {
  38033. x += stack.shift();
  38034. lineTo(x, y);
  38035. if (stack.length === 0) {
  38036. break;
  38037. }
  38038. y += stack.shift();
  38039. lineTo(x, y);
  38040. }
  38041. break;
  38042. case 7:
  38043. while (stack.length > 0) {
  38044. y += stack.shift();
  38045. lineTo(x, y);
  38046. if (stack.length === 0) {
  38047. break;
  38048. }
  38049. x += stack.shift();
  38050. lineTo(x, y);
  38051. }
  38052. break;
  38053. case 8:
  38054. while (stack.length > 0) {
  38055. xa = x + stack.shift();
  38056. ya = y + stack.shift();
  38057. xb = xa + stack.shift();
  38058. yb = ya + stack.shift();
  38059. x = xb + stack.shift();
  38060. y = yb + stack.shift();
  38061. bezierCurveTo(xa, ya, xb, yb, x, y);
  38062. }
  38063. break;
  38064. case 10:
  38065. n = stack.pop();
  38066. subrCode = null;
  38067. if (font.isCFFCIDFont) {
  38068. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38069. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38070. const fontDict = font.fdArray[fdIndex];
  38071. let subrs;
  38072. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38073. subrs = fontDict.privateDict.subrsIndex.objects;
  38074. }
  38075. if (subrs) {
  38076. n += getSubroutineBias(subrs);
  38077. subrCode = subrs[n];
  38078. }
  38079. } else {
  38080. (0, _util.warn)("Invalid fd index for glyph index.");
  38081. }
  38082. } else {
  38083. subrCode = font.subrs[n + font.subrsBias];
  38084. }
  38085. if (subrCode) {
  38086. parse(subrCode);
  38087. }
  38088. break;
  38089. case 11:
  38090. return;
  38091. case 12:
  38092. v = code[i++];
  38093. switch (v) {
  38094. case 34:
  38095. xa = x + stack.shift();
  38096. xb = xa + stack.shift();
  38097. y1 = y + stack.shift();
  38098. x = xb + stack.shift();
  38099. bezierCurveTo(xa, y, xb, y1, x, y1);
  38100. xa = x + stack.shift();
  38101. xb = xa + stack.shift();
  38102. x = xb + stack.shift();
  38103. bezierCurveTo(xa, y1, xb, y, x, y);
  38104. break;
  38105. case 35:
  38106. xa = x + stack.shift();
  38107. ya = y + stack.shift();
  38108. xb = xa + stack.shift();
  38109. yb = ya + stack.shift();
  38110. x = xb + stack.shift();
  38111. y = yb + stack.shift();
  38112. bezierCurveTo(xa, ya, xb, yb, x, y);
  38113. xa = x + stack.shift();
  38114. ya = y + stack.shift();
  38115. xb = xa + stack.shift();
  38116. yb = ya + stack.shift();
  38117. x = xb + stack.shift();
  38118. y = yb + stack.shift();
  38119. bezierCurveTo(xa, ya, xb, yb, x, y);
  38120. stack.pop();
  38121. break;
  38122. case 36:
  38123. xa = x + stack.shift();
  38124. y1 = y + stack.shift();
  38125. xb = xa + stack.shift();
  38126. y2 = y1 + stack.shift();
  38127. x = xb + stack.shift();
  38128. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38129. xa = x + stack.shift();
  38130. xb = xa + stack.shift();
  38131. y3 = y2 + stack.shift();
  38132. x = xb + stack.shift();
  38133. bezierCurveTo(xa, y2, xb, y3, x, y);
  38134. break;
  38135. case 37:
  38136. const x0 = x,
  38137. y0 = y;
  38138. xa = x + stack.shift();
  38139. ya = y + stack.shift();
  38140. xb = xa + stack.shift();
  38141. yb = ya + stack.shift();
  38142. x = xb + stack.shift();
  38143. y = yb + stack.shift();
  38144. bezierCurveTo(xa, ya, xb, yb, x, y);
  38145. xa = x + stack.shift();
  38146. ya = y + stack.shift();
  38147. xb = xa + stack.shift();
  38148. yb = ya + stack.shift();
  38149. x = xb;
  38150. y = yb;
  38151. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38152. x += stack.shift();
  38153. } else {
  38154. y += stack.shift();
  38155. }
  38156. bezierCurveTo(xa, ya, xb, yb, x, y);
  38157. break;
  38158. default:
  38159. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38160. }
  38161. break;
  38162. case 14:
  38163. if (stack.length >= 4) {
  38164. const achar = stack.pop();
  38165. const bchar = stack.pop();
  38166. y = stack.pop();
  38167. x = stack.pop();
  38168. cmds.push({
  38169. cmd: "save"
  38170. }, {
  38171. cmd: "translate",
  38172. args: [x, y]
  38173. });
  38174. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38175. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38176. cmds.push({
  38177. cmd: "restore"
  38178. });
  38179. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38180. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38181. }
  38182. return;
  38183. case 18:
  38184. stems += stack.length >> 1;
  38185. stackClean = true;
  38186. break;
  38187. case 19:
  38188. stems += stack.length >> 1;
  38189. i += stems + 7 >> 3;
  38190. stackClean = true;
  38191. break;
  38192. case 20:
  38193. stems += stack.length >> 1;
  38194. i += stems + 7 >> 3;
  38195. stackClean = true;
  38196. break;
  38197. case 21:
  38198. y += stack.pop();
  38199. x += stack.pop();
  38200. moveTo(x, y);
  38201. stackClean = true;
  38202. break;
  38203. case 22:
  38204. x += stack.pop();
  38205. moveTo(x, y);
  38206. stackClean = true;
  38207. break;
  38208. case 23:
  38209. stems += stack.length >> 1;
  38210. stackClean = true;
  38211. break;
  38212. case 24:
  38213. while (stack.length > 2) {
  38214. xa = x + stack.shift();
  38215. ya = y + stack.shift();
  38216. xb = xa + stack.shift();
  38217. yb = ya + stack.shift();
  38218. x = xb + stack.shift();
  38219. y = yb + stack.shift();
  38220. bezierCurveTo(xa, ya, xb, yb, x, y);
  38221. }
  38222. x += stack.shift();
  38223. y += stack.shift();
  38224. lineTo(x, y);
  38225. break;
  38226. case 25:
  38227. while (stack.length > 6) {
  38228. x += stack.shift();
  38229. y += stack.shift();
  38230. lineTo(x, y);
  38231. }
  38232. xa = x + stack.shift();
  38233. ya = y + stack.shift();
  38234. xb = xa + stack.shift();
  38235. yb = ya + stack.shift();
  38236. x = xb + stack.shift();
  38237. y = yb + stack.shift();
  38238. bezierCurveTo(xa, ya, xb, yb, x, y);
  38239. break;
  38240. case 26:
  38241. if (stack.length % 2) {
  38242. x += stack.shift();
  38243. }
  38244. while (stack.length > 0) {
  38245. xa = x;
  38246. ya = y + stack.shift();
  38247. xb = xa + stack.shift();
  38248. yb = ya + stack.shift();
  38249. x = xb;
  38250. y = yb + stack.shift();
  38251. bezierCurveTo(xa, ya, xb, yb, x, y);
  38252. }
  38253. break;
  38254. case 27:
  38255. if (stack.length % 2) {
  38256. y += stack.shift();
  38257. }
  38258. while (stack.length > 0) {
  38259. xa = x + stack.shift();
  38260. ya = y;
  38261. xb = xa + stack.shift();
  38262. yb = ya + stack.shift();
  38263. x = xb + stack.shift();
  38264. y = yb;
  38265. bezierCurveTo(xa, ya, xb, yb, x, y);
  38266. }
  38267. break;
  38268. case 28:
  38269. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38270. i += 2;
  38271. break;
  38272. case 29:
  38273. n = stack.pop() + font.gsubrsBias;
  38274. subrCode = font.gsubrs[n];
  38275. if (subrCode) {
  38276. parse(subrCode);
  38277. }
  38278. break;
  38279. case 30:
  38280. while (stack.length > 0) {
  38281. xa = x;
  38282. ya = y + stack.shift();
  38283. xb = xa + stack.shift();
  38284. yb = ya + stack.shift();
  38285. x = xb + stack.shift();
  38286. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38287. bezierCurveTo(xa, ya, xb, yb, x, y);
  38288. if (stack.length === 0) {
  38289. break;
  38290. }
  38291. xa = x + stack.shift();
  38292. ya = y;
  38293. xb = xa + stack.shift();
  38294. yb = ya + stack.shift();
  38295. y = yb + stack.shift();
  38296. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38297. bezierCurveTo(xa, ya, xb, yb, x, y);
  38298. }
  38299. break;
  38300. case 31:
  38301. while (stack.length > 0) {
  38302. xa = x + stack.shift();
  38303. ya = y;
  38304. xb = xa + stack.shift();
  38305. yb = ya + stack.shift();
  38306. y = yb + stack.shift();
  38307. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38308. bezierCurveTo(xa, ya, xb, yb, x, y);
  38309. if (stack.length === 0) {
  38310. break;
  38311. }
  38312. xa = x;
  38313. ya = y + stack.shift();
  38314. xb = xa + stack.shift();
  38315. yb = ya + stack.shift();
  38316. x = xb + stack.shift();
  38317. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38318. bezierCurveTo(xa, ya, xb, yb, x, y);
  38319. }
  38320. break;
  38321. default:
  38322. if (v < 32) {
  38323. throw new _util.FormatError(`unknown operator: ${v}`);
  38324. }
  38325. if (v < 247) {
  38326. stack.push(v - 139);
  38327. } else if (v < 251) {
  38328. stack.push((v - 247) * 256 + code[i++] + 108);
  38329. } else if (v < 255) {
  38330. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38331. } else {
  38332. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38333. i += 4;
  38334. }
  38335. break;
  38336. }
  38337. if (stackClean) {
  38338. stack.length = 0;
  38339. }
  38340. }
  38341. }
  38342. parse(charStringCode);
  38343. }
  38344. const NOOP = [];
  38345. class CompiledFont {
  38346. constructor(fontMatrix) {
  38347. if (this.constructor === CompiledFont) {
  38348. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38349. }
  38350. this.fontMatrix = fontMatrix;
  38351. this.compiledGlyphs = Object.create(null);
  38352. this.compiledCharCodeToGlyphId = Object.create(null);
  38353. }
  38354. getPathJs(unicode) {
  38355. const {
  38356. charCode,
  38357. glyphId
  38358. } = lookupCmap(this.cmap, unicode);
  38359. let fn = this.compiledGlyphs[glyphId];
  38360. if (!fn) {
  38361. try {
  38362. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38363. this.compiledGlyphs[glyphId] = fn;
  38364. } catch (ex) {
  38365. this.compiledGlyphs[glyphId] = NOOP;
  38366. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38367. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38368. }
  38369. throw ex;
  38370. }
  38371. }
  38372. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38373. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38374. }
  38375. return fn;
  38376. }
  38377. compileGlyph(code, glyphId) {
  38378. if (!code || code.length === 0 || code[0] === 14) {
  38379. return NOOP;
  38380. }
  38381. let fontMatrix = this.fontMatrix;
  38382. if (this.isCFFCIDFont) {
  38383. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38384. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38385. const fontDict = this.fdArray[fdIndex];
  38386. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38387. } else {
  38388. (0, _util.warn)("Invalid fd index for glyph index.");
  38389. }
  38390. }
  38391. const cmds = [{
  38392. cmd: "save"
  38393. }, {
  38394. cmd: "transform",
  38395. args: fontMatrix.slice()
  38396. }, {
  38397. cmd: "scale",
  38398. args: ["size", "-size"]
  38399. }];
  38400. this.compileGlyphImpl(code, cmds, glyphId);
  38401. cmds.push({
  38402. cmd: "restore"
  38403. });
  38404. return cmds;
  38405. }
  38406. compileGlyphImpl() {
  38407. (0, _util.unreachable)("Children classes should implement this.");
  38408. }
  38409. hasBuiltPath(unicode) {
  38410. const {
  38411. charCode,
  38412. glyphId
  38413. } = lookupCmap(this.cmap, unicode);
  38414. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38415. }
  38416. }
  38417. class TrueTypeCompiled extends CompiledFont {
  38418. constructor(glyphs, cmap, fontMatrix) {
  38419. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38420. this.glyphs = glyphs;
  38421. this.cmap = cmap;
  38422. }
  38423. compileGlyphImpl(code, cmds) {
  38424. compileGlyf(code, cmds, this);
  38425. }
  38426. }
  38427. class Type2Compiled extends CompiledFont {
  38428. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38429. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38430. this.glyphs = cffInfo.glyphs;
  38431. this.gsubrs = cffInfo.gsubrs || [];
  38432. this.subrs = cffInfo.subrs || [];
  38433. this.cmap = cmap;
  38434. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38435. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38436. this.subrsBias = getSubroutineBias(this.subrs);
  38437. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38438. this.fdSelect = cffInfo.fdSelect;
  38439. this.fdArray = cffInfo.fdArray;
  38440. }
  38441. compileGlyphImpl(code, cmds, glyphId) {
  38442. compileCharString(code, cmds, this, glyphId);
  38443. }
  38444. }
  38445. class FontRendererFactory {
  38446. static create(font, seacAnalysisEnabled) {
  38447. const data = new Uint8Array(font.data);
  38448. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38449. const numTables = getUint16(data, 4);
  38450. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38451. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38452. const offset = getUint32(data, p + 8);
  38453. const length = getUint32(data, p + 12);
  38454. switch (tag) {
  38455. case "cmap":
  38456. cmap = parseCmap(data, offset, offset + length);
  38457. break;
  38458. case "glyf":
  38459. glyf = data.subarray(offset, offset + length);
  38460. break;
  38461. case "loca":
  38462. loca = data.subarray(offset, offset + length);
  38463. break;
  38464. case "head":
  38465. unitsPerEm = getUint16(data, offset + 18);
  38466. indexToLocFormat = getUint16(data, offset + 50);
  38467. break;
  38468. case "CFF ":
  38469. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38470. break;
  38471. }
  38472. }
  38473. if (glyf) {
  38474. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38475. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38476. }
  38477. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38478. }
  38479. }
  38480. exports.FontRendererFactory = FontRendererFactory;
  38481. /***/ }),
  38482. /* 43 */
  38483. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38484. Object.defineProperty(exports, "__esModule", ({
  38485. value: true
  38486. }));
  38487. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38488. var _core_utils = __w_pdfjs_require__(4);
  38489. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38490. t.Courier = 600;
  38491. t["Courier-Bold"] = 600;
  38492. t["Courier-BoldOblique"] = 600;
  38493. t["Courier-Oblique"] = 600;
  38494. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38495. t.space = 278;
  38496. t.exclam = 278;
  38497. t.quotedbl = 355;
  38498. t.numbersign = 556;
  38499. t.dollar = 556;
  38500. t.percent = 889;
  38501. t.ampersand = 667;
  38502. t.quoteright = 222;
  38503. t.parenleft = 333;
  38504. t.parenright = 333;
  38505. t.asterisk = 389;
  38506. t.plus = 584;
  38507. t.comma = 278;
  38508. t.hyphen = 333;
  38509. t.period = 278;
  38510. t.slash = 278;
  38511. t.zero = 556;
  38512. t.one = 556;
  38513. t.two = 556;
  38514. t.three = 556;
  38515. t.four = 556;
  38516. t.five = 556;
  38517. t.six = 556;
  38518. t.seven = 556;
  38519. t.eight = 556;
  38520. t.nine = 556;
  38521. t.colon = 278;
  38522. t.semicolon = 278;
  38523. t.less = 584;
  38524. t.equal = 584;
  38525. t.greater = 584;
  38526. t.question = 556;
  38527. t.at = 1015;
  38528. t.A = 667;
  38529. t.B = 667;
  38530. t.C = 722;
  38531. t.D = 722;
  38532. t.E = 667;
  38533. t.F = 611;
  38534. t.G = 778;
  38535. t.H = 722;
  38536. t.I = 278;
  38537. t.J = 500;
  38538. t.K = 667;
  38539. t.L = 556;
  38540. t.M = 833;
  38541. t.N = 722;
  38542. t.O = 778;
  38543. t.P = 667;
  38544. t.Q = 778;
  38545. t.R = 722;
  38546. t.S = 667;
  38547. t.T = 611;
  38548. t.U = 722;
  38549. t.V = 667;
  38550. t.W = 944;
  38551. t.X = 667;
  38552. t.Y = 667;
  38553. t.Z = 611;
  38554. t.bracketleft = 278;
  38555. t.backslash = 278;
  38556. t.bracketright = 278;
  38557. t.asciicircum = 469;
  38558. t.underscore = 556;
  38559. t.quoteleft = 222;
  38560. t.a = 556;
  38561. t.b = 556;
  38562. t.c = 500;
  38563. t.d = 556;
  38564. t.e = 556;
  38565. t.f = 278;
  38566. t.g = 556;
  38567. t.h = 556;
  38568. t.i = 222;
  38569. t.j = 222;
  38570. t.k = 500;
  38571. t.l = 222;
  38572. t.m = 833;
  38573. t.n = 556;
  38574. t.o = 556;
  38575. t.p = 556;
  38576. t.q = 556;
  38577. t.r = 333;
  38578. t.s = 500;
  38579. t.t = 278;
  38580. t.u = 556;
  38581. t.v = 500;
  38582. t.w = 722;
  38583. t.x = 500;
  38584. t.y = 500;
  38585. t.z = 500;
  38586. t.braceleft = 334;
  38587. t.bar = 260;
  38588. t.braceright = 334;
  38589. t.asciitilde = 584;
  38590. t.exclamdown = 333;
  38591. t.cent = 556;
  38592. t.sterling = 556;
  38593. t.fraction = 167;
  38594. t.yen = 556;
  38595. t.florin = 556;
  38596. t.section = 556;
  38597. t.currency = 556;
  38598. t.quotesingle = 191;
  38599. t.quotedblleft = 333;
  38600. t.guillemotleft = 556;
  38601. t.guilsinglleft = 333;
  38602. t.guilsinglright = 333;
  38603. t.fi = 500;
  38604. t.fl = 500;
  38605. t.endash = 556;
  38606. t.dagger = 556;
  38607. t.daggerdbl = 556;
  38608. t.periodcentered = 278;
  38609. t.paragraph = 537;
  38610. t.bullet = 350;
  38611. t.quotesinglbase = 222;
  38612. t.quotedblbase = 333;
  38613. t.quotedblright = 333;
  38614. t.guillemotright = 556;
  38615. t.ellipsis = 1000;
  38616. t.perthousand = 1000;
  38617. t.questiondown = 611;
  38618. t.grave = 333;
  38619. t.acute = 333;
  38620. t.circumflex = 333;
  38621. t.tilde = 333;
  38622. t.macron = 333;
  38623. t.breve = 333;
  38624. t.dotaccent = 333;
  38625. t.dieresis = 333;
  38626. t.ring = 333;
  38627. t.cedilla = 333;
  38628. t.hungarumlaut = 333;
  38629. t.ogonek = 333;
  38630. t.caron = 333;
  38631. t.emdash = 1000;
  38632. t.AE = 1000;
  38633. t.ordfeminine = 370;
  38634. t.Lslash = 556;
  38635. t.Oslash = 778;
  38636. t.OE = 1000;
  38637. t.ordmasculine = 365;
  38638. t.ae = 889;
  38639. t.dotlessi = 278;
  38640. t.lslash = 222;
  38641. t.oslash = 611;
  38642. t.oe = 944;
  38643. t.germandbls = 611;
  38644. t.Idieresis = 278;
  38645. t.eacute = 556;
  38646. t.abreve = 556;
  38647. t.uhungarumlaut = 556;
  38648. t.ecaron = 556;
  38649. t.Ydieresis = 667;
  38650. t.divide = 584;
  38651. t.Yacute = 667;
  38652. t.Acircumflex = 667;
  38653. t.aacute = 556;
  38654. t.Ucircumflex = 722;
  38655. t.yacute = 500;
  38656. t.scommaaccent = 500;
  38657. t.ecircumflex = 556;
  38658. t.Uring = 722;
  38659. t.Udieresis = 722;
  38660. t.aogonek = 556;
  38661. t.Uacute = 722;
  38662. t.uogonek = 556;
  38663. t.Edieresis = 667;
  38664. t.Dcroat = 722;
  38665. t.commaaccent = 250;
  38666. t.copyright = 737;
  38667. t.Emacron = 667;
  38668. t.ccaron = 500;
  38669. t.aring = 556;
  38670. t.Ncommaaccent = 722;
  38671. t.lacute = 222;
  38672. t.agrave = 556;
  38673. t.Tcommaaccent = 611;
  38674. t.Cacute = 722;
  38675. t.atilde = 556;
  38676. t.Edotaccent = 667;
  38677. t.scaron = 500;
  38678. t.scedilla = 500;
  38679. t.iacute = 278;
  38680. t.lozenge = 471;
  38681. t.Rcaron = 722;
  38682. t.Gcommaaccent = 778;
  38683. t.ucircumflex = 556;
  38684. t.acircumflex = 556;
  38685. t.Amacron = 667;
  38686. t.rcaron = 333;
  38687. t.ccedilla = 500;
  38688. t.Zdotaccent = 611;
  38689. t.Thorn = 667;
  38690. t.Omacron = 778;
  38691. t.Racute = 722;
  38692. t.Sacute = 667;
  38693. t.dcaron = 643;
  38694. t.Umacron = 722;
  38695. t.uring = 556;
  38696. t.threesuperior = 333;
  38697. t.Ograve = 778;
  38698. t.Agrave = 667;
  38699. t.Abreve = 667;
  38700. t.multiply = 584;
  38701. t.uacute = 556;
  38702. t.Tcaron = 611;
  38703. t.partialdiff = 476;
  38704. t.ydieresis = 500;
  38705. t.Nacute = 722;
  38706. t.icircumflex = 278;
  38707. t.Ecircumflex = 667;
  38708. t.adieresis = 556;
  38709. t.edieresis = 556;
  38710. t.cacute = 500;
  38711. t.nacute = 556;
  38712. t.umacron = 556;
  38713. t.Ncaron = 722;
  38714. t.Iacute = 278;
  38715. t.plusminus = 584;
  38716. t.brokenbar = 260;
  38717. t.registered = 737;
  38718. t.Gbreve = 778;
  38719. t.Idotaccent = 278;
  38720. t.summation = 600;
  38721. t.Egrave = 667;
  38722. t.racute = 333;
  38723. t.omacron = 556;
  38724. t.Zacute = 611;
  38725. t.Zcaron = 611;
  38726. t.greaterequal = 549;
  38727. t.Eth = 722;
  38728. t.Ccedilla = 722;
  38729. t.lcommaaccent = 222;
  38730. t.tcaron = 317;
  38731. t.eogonek = 556;
  38732. t.Uogonek = 722;
  38733. t.Aacute = 667;
  38734. t.Adieresis = 667;
  38735. t.egrave = 556;
  38736. t.zacute = 500;
  38737. t.iogonek = 222;
  38738. t.Oacute = 778;
  38739. t.oacute = 556;
  38740. t.amacron = 556;
  38741. t.sacute = 500;
  38742. t.idieresis = 278;
  38743. t.Ocircumflex = 778;
  38744. t.Ugrave = 722;
  38745. t.Delta = 612;
  38746. t.thorn = 556;
  38747. t.twosuperior = 333;
  38748. t.Odieresis = 778;
  38749. t.mu = 556;
  38750. t.igrave = 278;
  38751. t.ohungarumlaut = 556;
  38752. t.Eogonek = 667;
  38753. t.dcroat = 556;
  38754. t.threequarters = 834;
  38755. t.Scedilla = 667;
  38756. t.lcaron = 299;
  38757. t.Kcommaaccent = 667;
  38758. t.Lacute = 556;
  38759. t.trademark = 1000;
  38760. t.edotaccent = 556;
  38761. t.Igrave = 278;
  38762. t.Imacron = 278;
  38763. t.Lcaron = 556;
  38764. t.onehalf = 834;
  38765. t.lessequal = 549;
  38766. t.ocircumflex = 556;
  38767. t.ntilde = 556;
  38768. t.Uhungarumlaut = 722;
  38769. t.Eacute = 667;
  38770. t.emacron = 556;
  38771. t.gbreve = 556;
  38772. t.onequarter = 834;
  38773. t.Scaron = 667;
  38774. t.Scommaaccent = 667;
  38775. t.Ohungarumlaut = 778;
  38776. t.degree = 400;
  38777. t.ograve = 556;
  38778. t.Ccaron = 722;
  38779. t.ugrave = 556;
  38780. t.radical = 453;
  38781. t.Dcaron = 722;
  38782. t.rcommaaccent = 333;
  38783. t.Ntilde = 722;
  38784. t.otilde = 556;
  38785. t.Rcommaaccent = 722;
  38786. t.Lcommaaccent = 556;
  38787. t.Atilde = 667;
  38788. t.Aogonek = 667;
  38789. t.Aring = 667;
  38790. t.Otilde = 778;
  38791. t.zdotaccent = 500;
  38792. t.Ecaron = 667;
  38793. t.Iogonek = 278;
  38794. t.kcommaaccent = 500;
  38795. t.minus = 584;
  38796. t.Icircumflex = 278;
  38797. t.ncaron = 556;
  38798. t.tcommaaccent = 278;
  38799. t.logicalnot = 584;
  38800. t.odieresis = 556;
  38801. t.udieresis = 556;
  38802. t.notequal = 549;
  38803. t.gcommaaccent = 556;
  38804. t.eth = 556;
  38805. t.zcaron = 500;
  38806. t.ncommaaccent = 556;
  38807. t.onesuperior = 333;
  38808. t.imacron = 278;
  38809. t.Euro = 556;
  38810. });
  38811. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38812. t.space = 278;
  38813. t.exclam = 333;
  38814. t.quotedbl = 474;
  38815. t.numbersign = 556;
  38816. t.dollar = 556;
  38817. t.percent = 889;
  38818. t.ampersand = 722;
  38819. t.quoteright = 278;
  38820. t.parenleft = 333;
  38821. t.parenright = 333;
  38822. t.asterisk = 389;
  38823. t.plus = 584;
  38824. t.comma = 278;
  38825. t.hyphen = 333;
  38826. t.period = 278;
  38827. t.slash = 278;
  38828. t.zero = 556;
  38829. t.one = 556;
  38830. t.two = 556;
  38831. t.three = 556;
  38832. t.four = 556;
  38833. t.five = 556;
  38834. t.six = 556;
  38835. t.seven = 556;
  38836. t.eight = 556;
  38837. t.nine = 556;
  38838. t.colon = 333;
  38839. t.semicolon = 333;
  38840. t.less = 584;
  38841. t.equal = 584;
  38842. t.greater = 584;
  38843. t.question = 611;
  38844. t.at = 975;
  38845. t.A = 722;
  38846. t.B = 722;
  38847. t.C = 722;
  38848. t.D = 722;
  38849. t.E = 667;
  38850. t.F = 611;
  38851. t.G = 778;
  38852. t.H = 722;
  38853. t.I = 278;
  38854. t.J = 556;
  38855. t.K = 722;
  38856. t.L = 611;
  38857. t.M = 833;
  38858. t.N = 722;
  38859. t.O = 778;
  38860. t.P = 667;
  38861. t.Q = 778;
  38862. t.R = 722;
  38863. t.S = 667;
  38864. t.T = 611;
  38865. t.U = 722;
  38866. t.V = 667;
  38867. t.W = 944;
  38868. t.X = 667;
  38869. t.Y = 667;
  38870. t.Z = 611;
  38871. t.bracketleft = 333;
  38872. t.backslash = 278;
  38873. t.bracketright = 333;
  38874. t.asciicircum = 584;
  38875. t.underscore = 556;
  38876. t.quoteleft = 278;
  38877. t.a = 556;
  38878. t.b = 611;
  38879. t.c = 556;
  38880. t.d = 611;
  38881. t.e = 556;
  38882. t.f = 333;
  38883. t.g = 611;
  38884. t.h = 611;
  38885. t.i = 278;
  38886. t.j = 278;
  38887. t.k = 556;
  38888. t.l = 278;
  38889. t.m = 889;
  38890. t.n = 611;
  38891. t.o = 611;
  38892. t.p = 611;
  38893. t.q = 611;
  38894. t.r = 389;
  38895. t.s = 556;
  38896. t.t = 333;
  38897. t.u = 611;
  38898. t.v = 556;
  38899. t.w = 778;
  38900. t.x = 556;
  38901. t.y = 556;
  38902. t.z = 500;
  38903. t.braceleft = 389;
  38904. t.bar = 280;
  38905. t.braceright = 389;
  38906. t.asciitilde = 584;
  38907. t.exclamdown = 333;
  38908. t.cent = 556;
  38909. t.sterling = 556;
  38910. t.fraction = 167;
  38911. t.yen = 556;
  38912. t.florin = 556;
  38913. t.section = 556;
  38914. t.currency = 556;
  38915. t.quotesingle = 238;
  38916. t.quotedblleft = 500;
  38917. t.guillemotleft = 556;
  38918. t.guilsinglleft = 333;
  38919. t.guilsinglright = 333;
  38920. t.fi = 611;
  38921. t.fl = 611;
  38922. t.endash = 556;
  38923. t.dagger = 556;
  38924. t.daggerdbl = 556;
  38925. t.periodcentered = 278;
  38926. t.paragraph = 556;
  38927. t.bullet = 350;
  38928. t.quotesinglbase = 278;
  38929. t.quotedblbase = 500;
  38930. t.quotedblright = 500;
  38931. t.guillemotright = 556;
  38932. t.ellipsis = 1000;
  38933. t.perthousand = 1000;
  38934. t.questiondown = 611;
  38935. t.grave = 333;
  38936. t.acute = 333;
  38937. t.circumflex = 333;
  38938. t.tilde = 333;
  38939. t.macron = 333;
  38940. t.breve = 333;
  38941. t.dotaccent = 333;
  38942. t.dieresis = 333;
  38943. t.ring = 333;
  38944. t.cedilla = 333;
  38945. t.hungarumlaut = 333;
  38946. t.ogonek = 333;
  38947. t.caron = 333;
  38948. t.emdash = 1000;
  38949. t.AE = 1000;
  38950. t.ordfeminine = 370;
  38951. t.Lslash = 611;
  38952. t.Oslash = 778;
  38953. t.OE = 1000;
  38954. t.ordmasculine = 365;
  38955. t.ae = 889;
  38956. t.dotlessi = 278;
  38957. t.lslash = 278;
  38958. t.oslash = 611;
  38959. t.oe = 944;
  38960. t.germandbls = 611;
  38961. t.Idieresis = 278;
  38962. t.eacute = 556;
  38963. t.abreve = 556;
  38964. t.uhungarumlaut = 611;
  38965. t.ecaron = 556;
  38966. t.Ydieresis = 667;
  38967. t.divide = 584;
  38968. t.Yacute = 667;
  38969. t.Acircumflex = 722;
  38970. t.aacute = 556;
  38971. t.Ucircumflex = 722;
  38972. t.yacute = 556;
  38973. t.scommaaccent = 556;
  38974. t.ecircumflex = 556;
  38975. t.Uring = 722;
  38976. t.Udieresis = 722;
  38977. t.aogonek = 556;
  38978. t.Uacute = 722;
  38979. t.uogonek = 611;
  38980. t.Edieresis = 667;
  38981. t.Dcroat = 722;
  38982. t.commaaccent = 250;
  38983. t.copyright = 737;
  38984. t.Emacron = 667;
  38985. t.ccaron = 556;
  38986. t.aring = 556;
  38987. t.Ncommaaccent = 722;
  38988. t.lacute = 278;
  38989. t.agrave = 556;
  38990. t.Tcommaaccent = 611;
  38991. t.Cacute = 722;
  38992. t.atilde = 556;
  38993. t.Edotaccent = 667;
  38994. t.scaron = 556;
  38995. t.scedilla = 556;
  38996. t.iacute = 278;
  38997. t.lozenge = 494;
  38998. t.Rcaron = 722;
  38999. t.Gcommaaccent = 778;
  39000. t.ucircumflex = 611;
  39001. t.acircumflex = 556;
  39002. t.Amacron = 722;
  39003. t.rcaron = 389;
  39004. t.ccedilla = 556;
  39005. t.Zdotaccent = 611;
  39006. t.Thorn = 667;
  39007. t.Omacron = 778;
  39008. t.Racute = 722;
  39009. t.Sacute = 667;
  39010. t.dcaron = 743;
  39011. t.Umacron = 722;
  39012. t.uring = 611;
  39013. t.threesuperior = 333;
  39014. t.Ograve = 778;
  39015. t.Agrave = 722;
  39016. t.Abreve = 722;
  39017. t.multiply = 584;
  39018. t.uacute = 611;
  39019. t.Tcaron = 611;
  39020. t.partialdiff = 494;
  39021. t.ydieresis = 556;
  39022. t.Nacute = 722;
  39023. t.icircumflex = 278;
  39024. t.Ecircumflex = 667;
  39025. t.adieresis = 556;
  39026. t.edieresis = 556;
  39027. t.cacute = 556;
  39028. t.nacute = 611;
  39029. t.umacron = 611;
  39030. t.Ncaron = 722;
  39031. t.Iacute = 278;
  39032. t.plusminus = 584;
  39033. t.brokenbar = 280;
  39034. t.registered = 737;
  39035. t.Gbreve = 778;
  39036. t.Idotaccent = 278;
  39037. t.summation = 600;
  39038. t.Egrave = 667;
  39039. t.racute = 389;
  39040. t.omacron = 611;
  39041. t.Zacute = 611;
  39042. t.Zcaron = 611;
  39043. t.greaterequal = 549;
  39044. t.Eth = 722;
  39045. t.Ccedilla = 722;
  39046. t.lcommaaccent = 278;
  39047. t.tcaron = 389;
  39048. t.eogonek = 556;
  39049. t.Uogonek = 722;
  39050. t.Aacute = 722;
  39051. t.Adieresis = 722;
  39052. t.egrave = 556;
  39053. t.zacute = 500;
  39054. t.iogonek = 278;
  39055. t.Oacute = 778;
  39056. t.oacute = 611;
  39057. t.amacron = 556;
  39058. t.sacute = 556;
  39059. t.idieresis = 278;
  39060. t.Ocircumflex = 778;
  39061. t.Ugrave = 722;
  39062. t.Delta = 612;
  39063. t.thorn = 611;
  39064. t.twosuperior = 333;
  39065. t.Odieresis = 778;
  39066. t.mu = 611;
  39067. t.igrave = 278;
  39068. t.ohungarumlaut = 611;
  39069. t.Eogonek = 667;
  39070. t.dcroat = 611;
  39071. t.threequarters = 834;
  39072. t.Scedilla = 667;
  39073. t.lcaron = 400;
  39074. t.Kcommaaccent = 722;
  39075. t.Lacute = 611;
  39076. t.trademark = 1000;
  39077. t.edotaccent = 556;
  39078. t.Igrave = 278;
  39079. t.Imacron = 278;
  39080. t.Lcaron = 611;
  39081. t.onehalf = 834;
  39082. t.lessequal = 549;
  39083. t.ocircumflex = 611;
  39084. t.ntilde = 611;
  39085. t.Uhungarumlaut = 722;
  39086. t.Eacute = 667;
  39087. t.emacron = 556;
  39088. t.gbreve = 611;
  39089. t.onequarter = 834;
  39090. t.Scaron = 667;
  39091. t.Scommaaccent = 667;
  39092. t.Ohungarumlaut = 778;
  39093. t.degree = 400;
  39094. t.ograve = 611;
  39095. t.Ccaron = 722;
  39096. t.ugrave = 611;
  39097. t.radical = 549;
  39098. t.Dcaron = 722;
  39099. t.rcommaaccent = 389;
  39100. t.Ntilde = 722;
  39101. t.otilde = 611;
  39102. t.Rcommaaccent = 722;
  39103. t.Lcommaaccent = 611;
  39104. t.Atilde = 722;
  39105. t.Aogonek = 722;
  39106. t.Aring = 722;
  39107. t.Otilde = 778;
  39108. t.zdotaccent = 500;
  39109. t.Ecaron = 667;
  39110. t.Iogonek = 278;
  39111. t.kcommaaccent = 556;
  39112. t.minus = 584;
  39113. t.Icircumflex = 278;
  39114. t.ncaron = 611;
  39115. t.tcommaaccent = 333;
  39116. t.logicalnot = 584;
  39117. t.odieresis = 611;
  39118. t.udieresis = 611;
  39119. t.notequal = 549;
  39120. t.gcommaaccent = 611;
  39121. t.eth = 611;
  39122. t.zcaron = 500;
  39123. t.ncommaaccent = 611;
  39124. t.onesuperior = 333;
  39125. t.imacron = 278;
  39126. t.Euro = 556;
  39127. });
  39128. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39129. t.space = 278;
  39130. t.exclam = 333;
  39131. t.quotedbl = 474;
  39132. t.numbersign = 556;
  39133. t.dollar = 556;
  39134. t.percent = 889;
  39135. t.ampersand = 722;
  39136. t.quoteright = 278;
  39137. t.parenleft = 333;
  39138. t.parenright = 333;
  39139. t.asterisk = 389;
  39140. t.plus = 584;
  39141. t.comma = 278;
  39142. t.hyphen = 333;
  39143. t.period = 278;
  39144. t.slash = 278;
  39145. t.zero = 556;
  39146. t.one = 556;
  39147. t.two = 556;
  39148. t.three = 556;
  39149. t.four = 556;
  39150. t.five = 556;
  39151. t.six = 556;
  39152. t.seven = 556;
  39153. t.eight = 556;
  39154. t.nine = 556;
  39155. t.colon = 333;
  39156. t.semicolon = 333;
  39157. t.less = 584;
  39158. t.equal = 584;
  39159. t.greater = 584;
  39160. t.question = 611;
  39161. t.at = 975;
  39162. t.A = 722;
  39163. t.B = 722;
  39164. t.C = 722;
  39165. t.D = 722;
  39166. t.E = 667;
  39167. t.F = 611;
  39168. t.G = 778;
  39169. t.H = 722;
  39170. t.I = 278;
  39171. t.J = 556;
  39172. t.K = 722;
  39173. t.L = 611;
  39174. t.M = 833;
  39175. t.N = 722;
  39176. t.O = 778;
  39177. t.P = 667;
  39178. t.Q = 778;
  39179. t.R = 722;
  39180. t.S = 667;
  39181. t.T = 611;
  39182. t.U = 722;
  39183. t.V = 667;
  39184. t.W = 944;
  39185. t.X = 667;
  39186. t.Y = 667;
  39187. t.Z = 611;
  39188. t.bracketleft = 333;
  39189. t.backslash = 278;
  39190. t.bracketright = 333;
  39191. t.asciicircum = 584;
  39192. t.underscore = 556;
  39193. t.quoteleft = 278;
  39194. t.a = 556;
  39195. t.b = 611;
  39196. t.c = 556;
  39197. t.d = 611;
  39198. t.e = 556;
  39199. t.f = 333;
  39200. t.g = 611;
  39201. t.h = 611;
  39202. t.i = 278;
  39203. t.j = 278;
  39204. t.k = 556;
  39205. t.l = 278;
  39206. t.m = 889;
  39207. t.n = 611;
  39208. t.o = 611;
  39209. t.p = 611;
  39210. t.q = 611;
  39211. t.r = 389;
  39212. t.s = 556;
  39213. t.t = 333;
  39214. t.u = 611;
  39215. t.v = 556;
  39216. t.w = 778;
  39217. t.x = 556;
  39218. t.y = 556;
  39219. t.z = 500;
  39220. t.braceleft = 389;
  39221. t.bar = 280;
  39222. t.braceright = 389;
  39223. t.asciitilde = 584;
  39224. t.exclamdown = 333;
  39225. t.cent = 556;
  39226. t.sterling = 556;
  39227. t.fraction = 167;
  39228. t.yen = 556;
  39229. t.florin = 556;
  39230. t.section = 556;
  39231. t.currency = 556;
  39232. t.quotesingle = 238;
  39233. t.quotedblleft = 500;
  39234. t.guillemotleft = 556;
  39235. t.guilsinglleft = 333;
  39236. t.guilsinglright = 333;
  39237. t.fi = 611;
  39238. t.fl = 611;
  39239. t.endash = 556;
  39240. t.dagger = 556;
  39241. t.daggerdbl = 556;
  39242. t.periodcentered = 278;
  39243. t.paragraph = 556;
  39244. t.bullet = 350;
  39245. t.quotesinglbase = 278;
  39246. t.quotedblbase = 500;
  39247. t.quotedblright = 500;
  39248. t.guillemotright = 556;
  39249. t.ellipsis = 1000;
  39250. t.perthousand = 1000;
  39251. t.questiondown = 611;
  39252. t.grave = 333;
  39253. t.acute = 333;
  39254. t.circumflex = 333;
  39255. t.tilde = 333;
  39256. t.macron = 333;
  39257. t.breve = 333;
  39258. t.dotaccent = 333;
  39259. t.dieresis = 333;
  39260. t.ring = 333;
  39261. t.cedilla = 333;
  39262. t.hungarumlaut = 333;
  39263. t.ogonek = 333;
  39264. t.caron = 333;
  39265. t.emdash = 1000;
  39266. t.AE = 1000;
  39267. t.ordfeminine = 370;
  39268. t.Lslash = 611;
  39269. t.Oslash = 778;
  39270. t.OE = 1000;
  39271. t.ordmasculine = 365;
  39272. t.ae = 889;
  39273. t.dotlessi = 278;
  39274. t.lslash = 278;
  39275. t.oslash = 611;
  39276. t.oe = 944;
  39277. t.germandbls = 611;
  39278. t.Idieresis = 278;
  39279. t.eacute = 556;
  39280. t.abreve = 556;
  39281. t.uhungarumlaut = 611;
  39282. t.ecaron = 556;
  39283. t.Ydieresis = 667;
  39284. t.divide = 584;
  39285. t.Yacute = 667;
  39286. t.Acircumflex = 722;
  39287. t.aacute = 556;
  39288. t.Ucircumflex = 722;
  39289. t.yacute = 556;
  39290. t.scommaaccent = 556;
  39291. t.ecircumflex = 556;
  39292. t.Uring = 722;
  39293. t.Udieresis = 722;
  39294. t.aogonek = 556;
  39295. t.Uacute = 722;
  39296. t.uogonek = 611;
  39297. t.Edieresis = 667;
  39298. t.Dcroat = 722;
  39299. t.commaaccent = 250;
  39300. t.copyright = 737;
  39301. t.Emacron = 667;
  39302. t.ccaron = 556;
  39303. t.aring = 556;
  39304. t.Ncommaaccent = 722;
  39305. t.lacute = 278;
  39306. t.agrave = 556;
  39307. t.Tcommaaccent = 611;
  39308. t.Cacute = 722;
  39309. t.atilde = 556;
  39310. t.Edotaccent = 667;
  39311. t.scaron = 556;
  39312. t.scedilla = 556;
  39313. t.iacute = 278;
  39314. t.lozenge = 494;
  39315. t.Rcaron = 722;
  39316. t.Gcommaaccent = 778;
  39317. t.ucircumflex = 611;
  39318. t.acircumflex = 556;
  39319. t.Amacron = 722;
  39320. t.rcaron = 389;
  39321. t.ccedilla = 556;
  39322. t.Zdotaccent = 611;
  39323. t.Thorn = 667;
  39324. t.Omacron = 778;
  39325. t.Racute = 722;
  39326. t.Sacute = 667;
  39327. t.dcaron = 743;
  39328. t.Umacron = 722;
  39329. t.uring = 611;
  39330. t.threesuperior = 333;
  39331. t.Ograve = 778;
  39332. t.Agrave = 722;
  39333. t.Abreve = 722;
  39334. t.multiply = 584;
  39335. t.uacute = 611;
  39336. t.Tcaron = 611;
  39337. t.partialdiff = 494;
  39338. t.ydieresis = 556;
  39339. t.Nacute = 722;
  39340. t.icircumflex = 278;
  39341. t.Ecircumflex = 667;
  39342. t.adieresis = 556;
  39343. t.edieresis = 556;
  39344. t.cacute = 556;
  39345. t.nacute = 611;
  39346. t.umacron = 611;
  39347. t.Ncaron = 722;
  39348. t.Iacute = 278;
  39349. t.plusminus = 584;
  39350. t.brokenbar = 280;
  39351. t.registered = 737;
  39352. t.Gbreve = 778;
  39353. t.Idotaccent = 278;
  39354. t.summation = 600;
  39355. t.Egrave = 667;
  39356. t.racute = 389;
  39357. t.omacron = 611;
  39358. t.Zacute = 611;
  39359. t.Zcaron = 611;
  39360. t.greaterequal = 549;
  39361. t.Eth = 722;
  39362. t.Ccedilla = 722;
  39363. t.lcommaaccent = 278;
  39364. t.tcaron = 389;
  39365. t.eogonek = 556;
  39366. t.Uogonek = 722;
  39367. t.Aacute = 722;
  39368. t.Adieresis = 722;
  39369. t.egrave = 556;
  39370. t.zacute = 500;
  39371. t.iogonek = 278;
  39372. t.Oacute = 778;
  39373. t.oacute = 611;
  39374. t.amacron = 556;
  39375. t.sacute = 556;
  39376. t.idieresis = 278;
  39377. t.Ocircumflex = 778;
  39378. t.Ugrave = 722;
  39379. t.Delta = 612;
  39380. t.thorn = 611;
  39381. t.twosuperior = 333;
  39382. t.Odieresis = 778;
  39383. t.mu = 611;
  39384. t.igrave = 278;
  39385. t.ohungarumlaut = 611;
  39386. t.Eogonek = 667;
  39387. t.dcroat = 611;
  39388. t.threequarters = 834;
  39389. t.Scedilla = 667;
  39390. t.lcaron = 400;
  39391. t.Kcommaaccent = 722;
  39392. t.Lacute = 611;
  39393. t.trademark = 1000;
  39394. t.edotaccent = 556;
  39395. t.Igrave = 278;
  39396. t.Imacron = 278;
  39397. t.Lcaron = 611;
  39398. t.onehalf = 834;
  39399. t.lessequal = 549;
  39400. t.ocircumflex = 611;
  39401. t.ntilde = 611;
  39402. t.Uhungarumlaut = 722;
  39403. t.Eacute = 667;
  39404. t.emacron = 556;
  39405. t.gbreve = 611;
  39406. t.onequarter = 834;
  39407. t.Scaron = 667;
  39408. t.Scommaaccent = 667;
  39409. t.Ohungarumlaut = 778;
  39410. t.degree = 400;
  39411. t.ograve = 611;
  39412. t.Ccaron = 722;
  39413. t.ugrave = 611;
  39414. t.radical = 549;
  39415. t.Dcaron = 722;
  39416. t.rcommaaccent = 389;
  39417. t.Ntilde = 722;
  39418. t.otilde = 611;
  39419. t.Rcommaaccent = 722;
  39420. t.Lcommaaccent = 611;
  39421. t.Atilde = 722;
  39422. t.Aogonek = 722;
  39423. t.Aring = 722;
  39424. t.Otilde = 778;
  39425. t.zdotaccent = 500;
  39426. t.Ecaron = 667;
  39427. t.Iogonek = 278;
  39428. t.kcommaaccent = 556;
  39429. t.minus = 584;
  39430. t.Icircumflex = 278;
  39431. t.ncaron = 611;
  39432. t.tcommaaccent = 333;
  39433. t.logicalnot = 584;
  39434. t.odieresis = 611;
  39435. t.udieresis = 611;
  39436. t.notequal = 549;
  39437. t.gcommaaccent = 611;
  39438. t.eth = 611;
  39439. t.zcaron = 500;
  39440. t.ncommaaccent = 611;
  39441. t.onesuperior = 333;
  39442. t.imacron = 278;
  39443. t.Euro = 556;
  39444. });
  39445. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39446. t.space = 278;
  39447. t.exclam = 278;
  39448. t.quotedbl = 355;
  39449. t.numbersign = 556;
  39450. t.dollar = 556;
  39451. t.percent = 889;
  39452. t.ampersand = 667;
  39453. t.quoteright = 222;
  39454. t.parenleft = 333;
  39455. t.parenright = 333;
  39456. t.asterisk = 389;
  39457. t.plus = 584;
  39458. t.comma = 278;
  39459. t.hyphen = 333;
  39460. t.period = 278;
  39461. t.slash = 278;
  39462. t.zero = 556;
  39463. t.one = 556;
  39464. t.two = 556;
  39465. t.three = 556;
  39466. t.four = 556;
  39467. t.five = 556;
  39468. t.six = 556;
  39469. t.seven = 556;
  39470. t.eight = 556;
  39471. t.nine = 556;
  39472. t.colon = 278;
  39473. t.semicolon = 278;
  39474. t.less = 584;
  39475. t.equal = 584;
  39476. t.greater = 584;
  39477. t.question = 556;
  39478. t.at = 1015;
  39479. t.A = 667;
  39480. t.B = 667;
  39481. t.C = 722;
  39482. t.D = 722;
  39483. t.E = 667;
  39484. t.F = 611;
  39485. t.G = 778;
  39486. t.H = 722;
  39487. t.I = 278;
  39488. t.J = 500;
  39489. t.K = 667;
  39490. t.L = 556;
  39491. t.M = 833;
  39492. t.N = 722;
  39493. t.O = 778;
  39494. t.P = 667;
  39495. t.Q = 778;
  39496. t.R = 722;
  39497. t.S = 667;
  39498. t.T = 611;
  39499. t.U = 722;
  39500. t.V = 667;
  39501. t.W = 944;
  39502. t.X = 667;
  39503. t.Y = 667;
  39504. t.Z = 611;
  39505. t.bracketleft = 278;
  39506. t.backslash = 278;
  39507. t.bracketright = 278;
  39508. t.asciicircum = 469;
  39509. t.underscore = 556;
  39510. t.quoteleft = 222;
  39511. t.a = 556;
  39512. t.b = 556;
  39513. t.c = 500;
  39514. t.d = 556;
  39515. t.e = 556;
  39516. t.f = 278;
  39517. t.g = 556;
  39518. t.h = 556;
  39519. t.i = 222;
  39520. t.j = 222;
  39521. t.k = 500;
  39522. t.l = 222;
  39523. t.m = 833;
  39524. t.n = 556;
  39525. t.o = 556;
  39526. t.p = 556;
  39527. t.q = 556;
  39528. t.r = 333;
  39529. t.s = 500;
  39530. t.t = 278;
  39531. t.u = 556;
  39532. t.v = 500;
  39533. t.w = 722;
  39534. t.x = 500;
  39535. t.y = 500;
  39536. t.z = 500;
  39537. t.braceleft = 334;
  39538. t.bar = 260;
  39539. t.braceright = 334;
  39540. t.asciitilde = 584;
  39541. t.exclamdown = 333;
  39542. t.cent = 556;
  39543. t.sterling = 556;
  39544. t.fraction = 167;
  39545. t.yen = 556;
  39546. t.florin = 556;
  39547. t.section = 556;
  39548. t.currency = 556;
  39549. t.quotesingle = 191;
  39550. t.quotedblleft = 333;
  39551. t.guillemotleft = 556;
  39552. t.guilsinglleft = 333;
  39553. t.guilsinglright = 333;
  39554. t.fi = 500;
  39555. t.fl = 500;
  39556. t.endash = 556;
  39557. t.dagger = 556;
  39558. t.daggerdbl = 556;
  39559. t.periodcentered = 278;
  39560. t.paragraph = 537;
  39561. t.bullet = 350;
  39562. t.quotesinglbase = 222;
  39563. t.quotedblbase = 333;
  39564. t.quotedblright = 333;
  39565. t.guillemotright = 556;
  39566. t.ellipsis = 1000;
  39567. t.perthousand = 1000;
  39568. t.questiondown = 611;
  39569. t.grave = 333;
  39570. t.acute = 333;
  39571. t.circumflex = 333;
  39572. t.tilde = 333;
  39573. t.macron = 333;
  39574. t.breve = 333;
  39575. t.dotaccent = 333;
  39576. t.dieresis = 333;
  39577. t.ring = 333;
  39578. t.cedilla = 333;
  39579. t.hungarumlaut = 333;
  39580. t.ogonek = 333;
  39581. t.caron = 333;
  39582. t.emdash = 1000;
  39583. t.AE = 1000;
  39584. t.ordfeminine = 370;
  39585. t.Lslash = 556;
  39586. t.Oslash = 778;
  39587. t.OE = 1000;
  39588. t.ordmasculine = 365;
  39589. t.ae = 889;
  39590. t.dotlessi = 278;
  39591. t.lslash = 222;
  39592. t.oslash = 611;
  39593. t.oe = 944;
  39594. t.germandbls = 611;
  39595. t.Idieresis = 278;
  39596. t.eacute = 556;
  39597. t.abreve = 556;
  39598. t.uhungarumlaut = 556;
  39599. t.ecaron = 556;
  39600. t.Ydieresis = 667;
  39601. t.divide = 584;
  39602. t.Yacute = 667;
  39603. t.Acircumflex = 667;
  39604. t.aacute = 556;
  39605. t.Ucircumflex = 722;
  39606. t.yacute = 500;
  39607. t.scommaaccent = 500;
  39608. t.ecircumflex = 556;
  39609. t.Uring = 722;
  39610. t.Udieresis = 722;
  39611. t.aogonek = 556;
  39612. t.Uacute = 722;
  39613. t.uogonek = 556;
  39614. t.Edieresis = 667;
  39615. t.Dcroat = 722;
  39616. t.commaaccent = 250;
  39617. t.copyright = 737;
  39618. t.Emacron = 667;
  39619. t.ccaron = 500;
  39620. t.aring = 556;
  39621. t.Ncommaaccent = 722;
  39622. t.lacute = 222;
  39623. t.agrave = 556;
  39624. t.Tcommaaccent = 611;
  39625. t.Cacute = 722;
  39626. t.atilde = 556;
  39627. t.Edotaccent = 667;
  39628. t.scaron = 500;
  39629. t.scedilla = 500;
  39630. t.iacute = 278;
  39631. t.lozenge = 471;
  39632. t.Rcaron = 722;
  39633. t.Gcommaaccent = 778;
  39634. t.ucircumflex = 556;
  39635. t.acircumflex = 556;
  39636. t.Amacron = 667;
  39637. t.rcaron = 333;
  39638. t.ccedilla = 500;
  39639. t.Zdotaccent = 611;
  39640. t.Thorn = 667;
  39641. t.Omacron = 778;
  39642. t.Racute = 722;
  39643. t.Sacute = 667;
  39644. t.dcaron = 643;
  39645. t.Umacron = 722;
  39646. t.uring = 556;
  39647. t.threesuperior = 333;
  39648. t.Ograve = 778;
  39649. t.Agrave = 667;
  39650. t.Abreve = 667;
  39651. t.multiply = 584;
  39652. t.uacute = 556;
  39653. t.Tcaron = 611;
  39654. t.partialdiff = 476;
  39655. t.ydieresis = 500;
  39656. t.Nacute = 722;
  39657. t.icircumflex = 278;
  39658. t.Ecircumflex = 667;
  39659. t.adieresis = 556;
  39660. t.edieresis = 556;
  39661. t.cacute = 500;
  39662. t.nacute = 556;
  39663. t.umacron = 556;
  39664. t.Ncaron = 722;
  39665. t.Iacute = 278;
  39666. t.plusminus = 584;
  39667. t.brokenbar = 260;
  39668. t.registered = 737;
  39669. t.Gbreve = 778;
  39670. t.Idotaccent = 278;
  39671. t.summation = 600;
  39672. t.Egrave = 667;
  39673. t.racute = 333;
  39674. t.omacron = 556;
  39675. t.Zacute = 611;
  39676. t.Zcaron = 611;
  39677. t.greaterequal = 549;
  39678. t.Eth = 722;
  39679. t.Ccedilla = 722;
  39680. t.lcommaaccent = 222;
  39681. t.tcaron = 317;
  39682. t.eogonek = 556;
  39683. t.Uogonek = 722;
  39684. t.Aacute = 667;
  39685. t.Adieresis = 667;
  39686. t.egrave = 556;
  39687. t.zacute = 500;
  39688. t.iogonek = 222;
  39689. t.Oacute = 778;
  39690. t.oacute = 556;
  39691. t.amacron = 556;
  39692. t.sacute = 500;
  39693. t.idieresis = 278;
  39694. t.Ocircumflex = 778;
  39695. t.Ugrave = 722;
  39696. t.Delta = 612;
  39697. t.thorn = 556;
  39698. t.twosuperior = 333;
  39699. t.Odieresis = 778;
  39700. t.mu = 556;
  39701. t.igrave = 278;
  39702. t.ohungarumlaut = 556;
  39703. t.Eogonek = 667;
  39704. t.dcroat = 556;
  39705. t.threequarters = 834;
  39706. t.Scedilla = 667;
  39707. t.lcaron = 299;
  39708. t.Kcommaaccent = 667;
  39709. t.Lacute = 556;
  39710. t.trademark = 1000;
  39711. t.edotaccent = 556;
  39712. t.Igrave = 278;
  39713. t.Imacron = 278;
  39714. t.Lcaron = 556;
  39715. t.onehalf = 834;
  39716. t.lessequal = 549;
  39717. t.ocircumflex = 556;
  39718. t.ntilde = 556;
  39719. t.Uhungarumlaut = 722;
  39720. t.Eacute = 667;
  39721. t.emacron = 556;
  39722. t.gbreve = 556;
  39723. t.onequarter = 834;
  39724. t.Scaron = 667;
  39725. t.Scommaaccent = 667;
  39726. t.Ohungarumlaut = 778;
  39727. t.degree = 400;
  39728. t.ograve = 556;
  39729. t.Ccaron = 722;
  39730. t.ugrave = 556;
  39731. t.radical = 453;
  39732. t.Dcaron = 722;
  39733. t.rcommaaccent = 333;
  39734. t.Ntilde = 722;
  39735. t.otilde = 556;
  39736. t.Rcommaaccent = 722;
  39737. t.Lcommaaccent = 556;
  39738. t.Atilde = 667;
  39739. t.Aogonek = 667;
  39740. t.Aring = 667;
  39741. t.Otilde = 778;
  39742. t.zdotaccent = 500;
  39743. t.Ecaron = 667;
  39744. t.Iogonek = 278;
  39745. t.kcommaaccent = 500;
  39746. t.minus = 584;
  39747. t.Icircumflex = 278;
  39748. t.ncaron = 556;
  39749. t.tcommaaccent = 278;
  39750. t.logicalnot = 584;
  39751. t.odieresis = 556;
  39752. t.udieresis = 556;
  39753. t.notequal = 549;
  39754. t.gcommaaccent = 556;
  39755. t.eth = 556;
  39756. t.zcaron = 500;
  39757. t.ncommaaccent = 556;
  39758. t.onesuperior = 333;
  39759. t.imacron = 278;
  39760. t.Euro = 556;
  39761. });
  39762. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  39763. t.space = 250;
  39764. t.exclam = 333;
  39765. t.universal = 713;
  39766. t.numbersign = 500;
  39767. t.existential = 549;
  39768. t.percent = 833;
  39769. t.ampersand = 778;
  39770. t.suchthat = 439;
  39771. t.parenleft = 333;
  39772. t.parenright = 333;
  39773. t.asteriskmath = 500;
  39774. t.plus = 549;
  39775. t.comma = 250;
  39776. t.minus = 549;
  39777. t.period = 250;
  39778. t.slash = 278;
  39779. t.zero = 500;
  39780. t.one = 500;
  39781. t.two = 500;
  39782. t.three = 500;
  39783. t.four = 500;
  39784. t.five = 500;
  39785. t.six = 500;
  39786. t.seven = 500;
  39787. t.eight = 500;
  39788. t.nine = 500;
  39789. t.colon = 278;
  39790. t.semicolon = 278;
  39791. t.less = 549;
  39792. t.equal = 549;
  39793. t.greater = 549;
  39794. t.question = 444;
  39795. t.congruent = 549;
  39796. t.Alpha = 722;
  39797. t.Beta = 667;
  39798. t.Chi = 722;
  39799. t.Delta = 612;
  39800. t.Epsilon = 611;
  39801. t.Phi = 763;
  39802. t.Gamma = 603;
  39803. t.Eta = 722;
  39804. t.Iota = 333;
  39805. t.theta1 = 631;
  39806. t.Kappa = 722;
  39807. t.Lambda = 686;
  39808. t.Mu = 889;
  39809. t.Nu = 722;
  39810. t.Omicron = 722;
  39811. t.Pi = 768;
  39812. t.Theta = 741;
  39813. t.Rho = 556;
  39814. t.Sigma = 592;
  39815. t.Tau = 611;
  39816. t.Upsilon = 690;
  39817. t.sigma1 = 439;
  39818. t.Omega = 768;
  39819. t.Xi = 645;
  39820. t.Psi = 795;
  39821. t.Zeta = 611;
  39822. t.bracketleft = 333;
  39823. t.therefore = 863;
  39824. t.bracketright = 333;
  39825. t.perpendicular = 658;
  39826. t.underscore = 500;
  39827. t.radicalex = 500;
  39828. t.alpha = 631;
  39829. t.beta = 549;
  39830. t.chi = 549;
  39831. t.delta = 494;
  39832. t.epsilon = 439;
  39833. t.phi = 521;
  39834. t.gamma = 411;
  39835. t.eta = 603;
  39836. t.iota = 329;
  39837. t.phi1 = 603;
  39838. t.kappa = 549;
  39839. t.lambda = 549;
  39840. t.mu = 576;
  39841. t.nu = 521;
  39842. t.omicron = 549;
  39843. t.pi = 549;
  39844. t.theta = 521;
  39845. t.rho = 549;
  39846. t.sigma = 603;
  39847. t.tau = 439;
  39848. t.upsilon = 576;
  39849. t.omega1 = 713;
  39850. t.omega = 686;
  39851. t.xi = 493;
  39852. t.psi = 686;
  39853. t.zeta = 494;
  39854. t.braceleft = 480;
  39855. t.bar = 200;
  39856. t.braceright = 480;
  39857. t.similar = 549;
  39858. t.Euro = 750;
  39859. t.Upsilon1 = 620;
  39860. t.minute = 247;
  39861. t.lessequal = 549;
  39862. t.fraction = 167;
  39863. t.infinity = 713;
  39864. t.florin = 500;
  39865. t.club = 753;
  39866. t.diamond = 753;
  39867. t.heart = 753;
  39868. t.spade = 753;
  39869. t.arrowboth = 1042;
  39870. t.arrowleft = 987;
  39871. t.arrowup = 603;
  39872. t.arrowright = 987;
  39873. t.arrowdown = 603;
  39874. t.degree = 400;
  39875. t.plusminus = 549;
  39876. t.second = 411;
  39877. t.greaterequal = 549;
  39878. t.multiply = 549;
  39879. t.proportional = 713;
  39880. t.partialdiff = 494;
  39881. t.bullet = 460;
  39882. t.divide = 549;
  39883. t.notequal = 549;
  39884. t.equivalence = 549;
  39885. t.approxequal = 549;
  39886. t.ellipsis = 1000;
  39887. t.arrowvertex = 603;
  39888. t.arrowhorizex = 1000;
  39889. t.carriagereturn = 658;
  39890. t.aleph = 823;
  39891. t.Ifraktur = 686;
  39892. t.Rfraktur = 795;
  39893. t.weierstrass = 987;
  39894. t.circlemultiply = 768;
  39895. t.circleplus = 768;
  39896. t.emptyset = 823;
  39897. t.intersection = 768;
  39898. t.union = 768;
  39899. t.propersuperset = 713;
  39900. t.reflexsuperset = 713;
  39901. t.notsubset = 713;
  39902. t.propersubset = 713;
  39903. t.reflexsubset = 713;
  39904. t.element = 713;
  39905. t.notelement = 713;
  39906. t.angle = 768;
  39907. t.gradient = 713;
  39908. t.registerserif = 790;
  39909. t.copyrightserif = 790;
  39910. t.trademarkserif = 890;
  39911. t.product = 823;
  39912. t.radical = 549;
  39913. t.dotmath = 250;
  39914. t.logicalnot = 713;
  39915. t.logicaland = 603;
  39916. t.logicalor = 603;
  39917. t.arrowdblboth = 1042;
  39918. t.arrowdblleft = 987;
  39919. t.arrowdblup = 603;
  39920. t.arrowdblright = 987;
  39921. t.arrowdbldown = 603;
  39922. t.lozenge = 494;
  39923. t.angleleft = 329;
  39924. t.registersans = 790;
  39925. t.copyrightsans = 790;
  39926. t.trademarksans = 786;
  39927. t.summation = 713;
  39928. t.parenlefttp = 384;
  39929. t.parenleftex = 384;
  39930. t.parenleftbt = 384;
  39931. t.bracketlefttp = 384;
  39932. t.bracketleftex = 384;
  39933. t.bracketleftbt = 384;
  39934. t.bracelefttp = 494;
  39935. t.braceleftmid = 494;
  39936. t.braceleftbt = 494;
  39937. t.braceex = 494;
  39938. t.angleright = 329;
  39939. t.integral = 274;
  39940. t.integraltp = 686;
  39941. t.integralex = 686;
  39942. t.integralbt = 686;
  39943. t.parenrighttp = 384;
  39944. t.parenrightex = 384;
  39945. t.parenrightbt = 384;
  39946. t.bracketrighttp = 384;
  39947. t.bracketrightex = 384;
  39948. t.bracketrightbt = 384;
  39949. t.bracerighttp = 494;
  39950. t.bracerightmid = 494;
  39951. t.bracerightbt = 494;
  39952. t.apple = 790;
  39953. });
  39954. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39955. t.space = 250;
  39956. t.exclam = 333;
  39957. t.quotedbl = 408;
  39958. t.numbersign = 500;
  39959. t.dollar = 500;
  39960. t.percent = 833;
  39961. t.ampersand = 778;
  39962. t.quoteright = 333;
  39963. t.parenleft = 333;
  39964. t.parenright = 333;
  39965. t.asterisk = 500;
  39966. t.plus = 564;
  39967. t.comma = 250;
  39968. t.hyphen = 333;
  39969. t.period = 250;
  39970. t.slash = 278;
  39971. t.zero = 500;
  39972. t.one = 500;
  39973. t.two = 500;
  39974. t.three = 500;
  39975. t.four = 500;
  39976. t.five = 500;
  39977. t.six = 500;
  39978. t.seven = 500;
  39979. t.eight = 500;
  39980. t.nine = 500;
  39981. t.colon = 278;
  39982. t.semicolon = 278;
  39983. t.less = 564;
  39984. t.equal = 564;
  39985. t.greater = 564;
  39986. t.question = 444;
  39987. t.at = 921;
  39988. t.A = 722;
  39989. t.B = 667;
  39990. t.C = 667;
  39991. t.D = 722;
  39992. t.E = 611;
  39993. t.F = 556;
  39994. t.G = 722;
  39995. t.H = 722;
  39996. t.I = 333;
  39997. t.J = 389;
  39998. t.K = 722;
  39999. t.L = 611;
  40000. t.M = 889;
  40001. t.N = 722;
  40002. t.O = 722;
  40003. t.P = 556;
  40004. t.Q = 722;
  40005. t.R = 667;
  40006. t.S = 556;
  40007. t.T = 611;
  40008. t.U = 722;
  40009. t.V = 722;
  40010. t.W = 944;
  40011. t.X = 722;
  40012. t.Y = 722;
  40013. t.Z = 611;
  40014. t.bracketleft = 333;
  40015. t.backslash = 278;
  40016. t.bracketright = 333;
  40017. t.asciicircum = 469;
  40018. t.underscore = 500;
  40019. t.quoteleft = 333;
  40020. t.a = 444;
  40021. t.b = 500;
  40022. t.c = 444;
  40023. t.d = 500;
  40024. t.e = 444;
  40025. t.f = 333;
  40026. t.g = 500;
  40027. t.h = 500;
  40028. t.i = 278;
  40029. t.j = 278;
  40030. t.k = 500;
  40031. t.l = 278;
  40032. t.m = 778;
  40033. t.n = 500;
  40034. t.o = 500;
  40035. t.p = 500;
  40036. t.q = 500;
  40037. t.r = 333;
  40038. t.s = 389;
  40039. t.t = 278;
  40040. t.u = 500;
  40041. t.v = 500;
  40042. t.w = 722;
  40043. t.x = 500;
  40044. t.y = 500;
  40045. t.z = 444;
  40046. t.braceleft = 480;
  40047. t.bar = 200;
  40048. t.braceright = 480;
  40049. t.asciitilde = 541;
  40050. t.exclamdown = 333;
  40051. t.cent = 500;
  40052. t.sterling = 500;
  40053. t.fraction = 167;
  40054. t.yen = 500;
  40055. t.florin = 500;
  40056. t.section = 500;
  40057. t.currency = 500;
  40058. t.quotesingle = 180;
  40059. t.quotedblleft = 444;
  40060. t.guillemotleft = 500;
  40061. t.guilsinglleft = 333;
  40062. t.guilsinglright = 333;
  40063. t.fi = 556;
  40064. t.fl = 556;
  40065. t.endash = 500;
  40066. t.dagger = 500;
  40067. t.daggerdbl = 500;
  40068. t.periodcentered = 250;
  40069. t.paragraph = 453;
  40070. t.bullet = 350;
  40071. t.quotesinglbase = 333;
  40072. t.quotedblbase = 444;
  40073. t.quotedblright = 444;
  40074. t.guillemotright = 500;
  40075. t.ellipsis = 1000;
  40076. t.perthousand = 1000;
  40077. t.questiondown = 444;
  40078. t.grave = 333;
  40079. t.acute = 333;
  40080. t.circumflex = 333;
  40081. t.tilde = 333;
  40082. t.macron = 333;
  40083. t.breve = 333;
  40084. t.dotaccent = 333;
  40085. t.dieresis = 333;
  40086. t.ring = 333;
  40087. t.cedilla = 333;
  40088. t.hungarumlaut = 333;
  40089. t.ogonek = 333;
  40090. t.caron = 333;
  40091. t.emdash = 1000;
  40092. t.AE = 889;
  40093. t.ordfeminine = 276;
  40094. t.Lslash = 611;
  40095. t.Oslash = 722;
  40096. t.OE = 889;
  40097. t.ordmasculine = 310;
  40098. t.ae = 667;
  40099. t.dotlessi = 278;
  40100. t.lslash = 278;
  40101. t.oslash = 500;
  40102. t.oe = 722;
  40103. t.germandbls = 500;
  40104. t.Idieresis = 333;
  40105. t.eacute = 444;
  40106. t.abreve = 444;
  40107. t.uhungarumlaut = 500;
  40108. t.ecaron = 444;
  40109. t.Ydieresis = 722;
  40110. t.divide = 564;
  40111. t.Yacute = 722;
  40112. t.Acircumflex = 722;
  40113. t.aacute = 444;
  40114. t.Ucircumflex = 722;
  40115. t.yacute = 500;
  40116. t.scommaaccent = 389;
  40117. t.ecircumflex = 444;
  40118. t.Uring = 722;
  40119. t.Udieresis = 722;
  40120. t.aogonek = 444;
  40121. t.Uacute = 722;
  40122. t.uogonek = 500;
  40123. t.Edieresis = 611;
  40124. t.Dcroat = 722;
  40125. t.commaaccent = 250;
  40126. t.copyright = 760;
  40127. t.Emacron = 611;
  40128. t.ccaron = 444;
  40129. t.aring = 444;
  40130. t.Ncommaaccent = 722;
  40131. t.lacute = 278;
  40132. t.agrave = 444;
  40133. t.Tcommaaccent = 611;
  40134. t.Cacute = 667;
  40135. t.atilde = 444;
  40136. t.Edotaccent = 611;
  40137. t.scaron = 389;
  40138. t.scedilla = 389;
  40139. t.iacute = 278;
  40140. t.lozenge = 471;
  40141. t.Rcaron = 667;
  40142. t.Gcommaaccent = 722;
  40143. t.ucircumflex = 500;
  40144. t.acircumflex = 444;
  40145. t.Amacron = 722;
  40146. t.rcaron = 333;
  40147. t.ccedilla = 444;
  40148. t.Zdotaccent = 611;
  40149. t.Thorn = 556;
  40150. t.Omacron = 722;
  40151. t.Racute = 667;
  40152. t.Sacute = 556;
  40153. t.dcaron = 588;
  40154. t.Umacron = 722;
  40155. t.uring = 500;
  40156. t.threesuperior = 300;
  40157. t.Ograve = 722;
  40158. t.Agrave = 722;
  40159. t.Abreve = 722;
  40160. t.multiply = 564;
  40161. t.uacute = 500;
  40162. t.Tcaron = 611;
  40163. t.partialdiff = 476;
  40164. t.ydieresis = 500;
  40165. t.Nacute = 722;
  40166. t.icircumflex = 278;
  40167. t.Ecircumflex = 611;
  40168. t.adieresis = 444;
  40169. t.edieresis = 444;
  40170. t.cacute = 444;
  40171. t.nacute = 500;
  40172. t.umacron = 500;
  40173. t.Ncaron = 722;
  40174. t.Iacute = 333;
  40175. t.plusminus = 564;
  40176. t.brokenbar = 200;
  40177. t.registered = 760;
  40178. t.Gbreve = 722;
  40179. t.Idotaccent = 333;
  40180. t.summation = 600;
  40181. t.Egrave = 611;
  40182. t.racute = 333;
  40183. t.omacron = 500;
  40184. t.Zacute = 611;
  40185. t.Zcaron = 611;
  40186. t.greaterequal = 549;
  40187. t.Eth = 722;
  40188. t.Ccedilla = 667;
  40189. t.lcommaaccent = 278;
  40190. t.tcaron = 326;
  40191. t.eogonek = 444;
  40192. t.Uogonek = 722;
  40193. t.Aacute = 722;
  40194. t.Adieresis = 722;
  40195. t.egrave = 444;
  40196. t.zacute = 444;
  40197. t.iogonek = 278;
  40198. t.Oacute = 722;
  40199. t.oacute = 500;
  40200. t.amacron = 444;
  40201. t.sacute = 389;
  40202. t.idieresis = 278;
  40203. t.Ocircumflex = 722;
  40204. t.Ugrave = 722;
  40205. t.Delta = 612;
  40206. t.thorn = 500;
  40207. t.twosuperior = 300;
  40208. t.Odieresis = 722;
  40209. t.mu = 500;
  40210. t.igrave = 278;
  40211. t.ohungarumlaut = 500;
  40212. t.Eogonek = 611;
  40213. t.dcroat = 500;
  40214. t.threequarters = 750;
  40215. t.Scedilla = 556;
  40216. t.lcaron = 344;
  40217. t.Kcommaaccent = 722;
  40218. t.Lacute = 611;
  40219. t.trademark = 980;
  40220. t.edotaccent = 444;
  40221. t.Igrave = 333;
  40222. t.Imacron = 333;
  40223. t.Lcaron = 611;
  40224. t.onehalf = 750;
  40225. t.lessequal = 549;
  40226. t.ocircumflex = 500;
  40227. t.ntilde = 500;
  40228. t.Uhungarumlaut = 722;
  40229. t.Eacute = 611;
  40230. t.emacron = 444;
  40231. t.gbreve = 500;
  40232. t.onequarter = 750;
  40233. t.Scaron = 556;
  40234. t.Scommaaccent = 556;
  40235. t.Ohungarumlaut = 722;
  40236. t.degree = 400;
  40237. t.ograve = 500;
  40238. t.Ccaron = 667;
  40239. t.ugrave = 500;
  40240. t.radical = 453;
  40241. t.Dcaron = 722;
  40242. t.rcommaaccent = 333;
  40243. t.Ntilde = 722;
  40244. t.otilde = 500;
  40245. t.Rcommaaccent = 667;
  40246. t.Lcommaaccent = 611;
  40247. t.Atilde = 722;
  40248. t.Aogonek = 722;
  40249. t.Aring = 722;
  40250. t.Otilde = 722;
  40251. t.zdotaccent = 444;
  40252. t.Ecaron = 611;
  40253. t.Iogonek = 333;
  40254. t.kcommaaccent = 500;
  40255. t.minus = 564;
  40256. t.Icircumflex = 333;
  40257. t.ncaron = 500;
  40258. t.tcommaaccent = 278;
  40259. t.logicalnot = 564;
  40260. t.odieresis = 500;
  40261. t.udieresis = 500;
  40262. t.notequal = 549;
  40263. t.gcommaaccent = 500;
  40264. t.eth = 500;
  40265. t.zcaron = 444;
  40266. t.ncommaaccent = 500;
  40267. t.onesuperior = 300;
  40268. t.imacron = 278;
  40269. t.Euro = 500;
  40270. });
  40271. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40272. t.space = 250;
  40273. t.exclam = 333;
  40274. t.quotedbl = 555;
  40275. t.numbersign = 500;
  40276. t.dollar = 500;
  40277. t.percent = 1000;
  40278. t.ampersand = 833;
  40279. t.quoteright = 333;
  40280. t.parenleft = 333;
  40281. t.parenright = 333;
  40282. t.asterisk = 500;
  40283. t.plus = 570;
  40284. t.comma = 250;
  40285. t.hyphen = 333;
  40286. t.period = 250;
  40287. t.slash = 278;
  40288. t.zero = 500;
  40289. t.one = 500;
  40290. t.two = 500;
  40291. t.three = 500;
  40292. t.four = 500;
  40293. t.five = 500;
  40294. t.six = 500;
  40295. t.seven = 500;
  40296. t.eight = 500;
  40297. t.nine = 500;
  40298. t.colon = 333;
  40299. t.semicolon = 333;
  40300. t.less = 570;
  40301. t.equal = 570;
  40302. t.greater = 570;
  40303. t.question = 500;
  40304. t.at = 930;
  40305. t.A = 722;
  40306. t.B = 667;
  40307. t.C = 722;
  40308. t.D = 722;
  40309. t.E = 667;
  40310. t.F = 611;
  40311. t.G = 778;
  40312. t.H = 778;
  40313. t.I = 389;
  40314. t.J = 500;
  40315. t.K = 778;
  40316. t.L = 667;
  40317. t.M = 944;
  40318. t.N = 722;
  40319. t.O = 778;
  40320. t.P = 611;
  40321. t.Q = 778;
  40322. t.R = 722;
  40323. t.S = 556;
  40324. t.T = 667;
  40325. t.U = 722;
  40326. t.V = 722;
  40327. t.W = 1000;
  40328. t.X = 722;
  40329. t.Y = 722;
  40330. t.Z = 667;
  40331. t.bracketleft = 333;
  40332. t.backslash = 278;
  40333. t.bracketright = 333;
  40334. t.asciicircum = 581;
  40335. t.underscore = 500;
  40336. t.quoteleft = 333;
  40337. t.a = 500;
  40338. t.b = 556;
  40339. t.c = 444;
  40340. t.d = 556;
  40341. t.e = 444;
  40342. t.f = 333;
  40343. t.g = 500;
  40344. t.h = 556;
  40345. t.i = 278;
  40346. t.j = 333;
  40347. t.k = 556;
  40348. t.l = 278;
  40349. t.m = 833;
  40350. t.n = 556;
  40351. t.o = 500;
  40352. t.p = 556;
  40353. t.q = 556;
  40354. t.r = 444;
  40355. t.s = 389;
  40356. t.t = 333;
  40357. t.u = 556;
  40358. t.v = 500;
  40359. t.w = 722;
  40360. t.x = 500;
  40361. t.y = 500;
  40362. t.z = 444;
  40363. t.braceleft = 394;
  40364. t.bar = 220;
  40365. t.braceright = 394;
  40366. t.asciitilde = 520;
  40367. t.exclamdown = 333;
  40368. t.cent = 500;
  40369. t.sterling = 500;
  40370. t.fraction = 167;
  40371. t.yen = 500;
  40372. t.florin = 500;
  40373. t.section = 500;
  40374. t.currency = 500;
  40375. t.quotesingle = 278;
  40376. t.quotedblleft = 500;
  40377. t.guillemotleft = 500;
  40378. t.guilsinglleft = 333;
  40379. t.guilsinglright = 333;
  40380. t.fi = 556;
  40381. t.fl = 556;
  40382. t.endash = 500;
  40383. t.dagger = 500;
  40384. t.daggerdbl = 500;
  40385. t.periodcentered = 250;
  40386. t.paragraph = 540;
  40387. t.bullet = 350;
  40388. t.quotesinglbase = 333;
  40389. t.quotedblbase = 500;
  40390. t.quotedblright = 500;
  40391. t.guillemotright = 500;
  40392. t.ellipsis = 1000;
  40393. t.perthousand = 1000;
  40394. t.questiondown = 500;
  40395. t.grave = 333;
  40396. t.acute = 333;
  40397. t.circumflex = 333;
  40398. t.tilde = 333;
  40399. t.macron = 333;
  40400. t.breve = 333;
  40401. t.dotaccent = 333;
  40402. t.dieresis = 333;
  40403. t.ring = 333;
  40404. t.cedilla = 333;
  40405. t.hungarumlaut = 333;
  40406. t.ogonek = 333;
  40407. t.caron = 333;
  40408. t.emdash = 1000;
  40409. t.AE = 1000;
  40410. t.ordfeminine = 300;
  40411. t.Lslash = 667;
  40412. t.Oslash = 778;
  40413. t.OE = 1000;
  40414. t.ordmasculine = 330;
  40415. t.ae = 722;
  40416. t.dotlessi = 278;
  40417. t.lslash = 278;
  40418. t.oslash = 500;
  40419. t.oe = 722;
  40420. t.germandbls = 556;
  40421. t.Idieresis = 389;
  40422. t.eacute = 444;
  40423. t.abreve = 500;
  40424. t.uhungarumlaut = 556;
  40425. t.ecaron = 444;
  40426. t.Ydieresis = 722;
  40427. t.divide = 570;
  40428. t.Yacute = 722;
  40429. t.Acircumflex = 722;
  40430. t.aacute = 500;
  40431. t.Ucircumflex = 722;
  40432. t.yacute = 500;
  40433. t.scommaaccent = 389;
  40434. t.ecircumflex = 444;
  40435. t.Uring = 722;
  40436. t.Udieresis = 722;
  40437. t.aogonek = 500;
  40438. t.Uacute = 722;
  40439. t.uogonek = 556;
  40440. t.Edieresis = 667;
  40441. t.Dcroat = 722;
  40442. t.commaaccent = 250;
  40443. t.copyright = 747;
  40444. t.Emacron = 667;
  40445. t.ccaron = 444;
  40446. t.aring = 500;
  40447. t.Ncommaaccent = 722;
  40448. t.lacute = 278;
  40449. t.agrave = 500;
  40450. t.Tcommaaccent = 667;
  40451. t.Cacute = 722;
  40452. t.atilde = 500;
  40453. t.Edotaccent = 667;
  40454. t.scaron = 389;
  40455. t.scedilla = 389;
  40456. t.iacute = 278;
  40457. t.lozenge = 494;
  40458. t.Rcaron = 722;
  40459. t.Gcommaaccent = 778;
  40460. t.ucircumflex = 556;
  40461. t.acircumflex = 500;
  40462. t.Amacron = 722;
  40463. t.rcaron = 444;
  40464. t.ccedilla = 444;
  40465. t.Zdotaccent = 667;
  40466. t.Thorn = 611;
  40467. t.Omacron = 778;
  40468. t.Racute = 722;
  40469. t.Sacute = 556;
  40470. t.dcaron = 672;
  40471. t.Umacron = 722;
  40472. t.uring = 556;
  40473. t.threesuperior = 300;
  40474. t.Ograve = 778;
  40475. t.Agrave = 722;
  40476. t.Abreve = 722;
  40477. t.multiply = 570;
  40478. t.uacute = 556;
  40479. t.Tcaron = 667;
  40480. t.partialdiff = 494;
  40481. t.ydieresis = 500;
  40482. t.Nacute = 722;
  40483. t.icircumflex = 278;
  40484. t.Ecircumflex = 667;
  40485. t.adieresis = 500;
  40486. t.edieresis = 444;
  40487. t.cacute = 444;
  40488. t.nacute = 556;
  40489. t.umacron = 556;
  40490. t.Ncaron = 722;
  40491. t.Iacute = 389;
  40492. t.plusminus = 570;
  40493. t.brokenbar = 220;
  40494. t.registered = 747;
  40495. t.Gbreve = 778;
  40496. t.Idotaccent = 389;
  40497. t.summation = 600;
  40498. t.Egrave = 667;
  40499. t.racute = 444;
  40500. t.omacron = 500;
  40501. t.Zacute = 667;
  40502. t.Zcaron = 667;
  40503. t.greaterequal = 549;
  40504. t.Eth = 722;
  40505. t.Ccedilla = 722;
  40506. t.lcommaaccent = 278;
  40507. t.tcaron = 416;
  40508. t.eogonek = 444;
  40509. t.Uogonek = 722;
  40510. t.Aacute = 722;
  40511. t.Adieresis = 722;
  40512. t.egrave = 444;
  40513. t.zacute = 444;
  40514. t.iogonek = 278;
  40515. t.Oacute = 778;
  40516. t.oacute = 500;
  40517. t.amacron = 500;
  40518. t.sacute = 389;
  40519. t.idieresis = 278;
  40520. t.Ocircumflex = 778;
  40521. t.Ugrave = 722;
  40522. t.Delta = 612;
  40523. t.thorn = 556;
  40524. t.twosuperior = 300;
  40525. t.Odieresis = 778;
  40526. t.mu = 556;
  40527. t.igrave = 278;
  40528. t.ohungarumlaut = 500;
  40529. t.Eogonek = 667;
  40530. t.dcroat = 556;
  40531. t.threequarters = 750;
  40532. t.Scedilla = 556;
  40533. t.lcaron = 394;
  40534. t.Kcommaaccent = 778;
  40535. t.Lacute = 667;
  40536. t.trademark = 1000;
  40537. t.edotaccent = 444;
  40538. t.Igrave = 389;
  40539. t.Imacron = 389;
  40540. t.Lcaron = 667;
  40541. t.onehalf = 750;
  40542. t.lessequal = 549;
  40543. t.ocircumflex = 500;
  40544. t.ntilde = 556;
  40545. t.Uhungarumlaut = 722;
  40546. t.Eacute = 667;
  40547. t.emacron = 444;
  40548. t.gbreve = 500;
  40549. t.onequarter = 750;
  40550. t.Scaron = 556;
  40551. t.Scommaaccent = 556;
  40552. t.Ohungarumlaut = 778;
  40553. t.degree = 400;
  40554. t.ograve = 500;
  40555. t.Ccaron = 722;
  40556. t.ugrave = 556;
  40557. t.radical = 549;
  40558. t.Dcaron = 722;
  40559. t.rcommaaccent = 444;
  40560. t.Ntilde = 722;
  40561. t.otilde = 500;
  40562. t.Rcommaaccent = 722;
  40563. t.Lcommaaccent = 667;
  40564. t.Atilde = 722;
  40565. t.Aogonek = 722;
  40566. t.Aring = 722;
  40567. t.Otilde = 778;
  40568. t.zdotaccent = 444;
  40569. t.Ecaron = 667;
  40570. t.Iogonek = 389;
  40571. t.kcommaaccent = 556;
  40572. t.minus = 570;
  40573. t.Icircumflex = 389;
  40574. t.ncaron = 556;
  40575. t.tcommaaccent = 333;
  40576. t.logicalnot = 570;
  40577. t.odieresis = 500;
  40578. t.udieresis = 556;
  40579. t.notequal = 549;
  40580. t.gcommaaccent = 500;
  40581. t.eth = 500;
  40582. t.zcaron = 444;
  40583. t.ncommaaccent = 556;
  40584. t.onesuperior = 300;
  40585. t.imacron = 278;
  40586. t.Euro = 500;
  40587. });
  40588. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40589. t.space = 250;
  40590. t.exclam = 389;
  40591. t.quotedbl = 555;
  40592. t.numbersign = 500;
  40593. t.dollar = 500;
  40594. t.percent = 833;
  40595. t.ampersand = 778;
  40596. t.quoteright = 333;
  40597. t.parenleft = 333;
  40598. t.parenright = 333;
  40599. t.asterisk = 500;
  40600. t.plus = 570;
  40601. t.comma = 250;
  40602. t.hyphen = 333;
  40603. t.period = 250;
  40604. t.slash = 278;
  40605. t.zero = 500;
  40606. t.one = 500;
  40607. t.two = 500;
  40608. t.three = 500;
  40609. t.four = 500;
  40610. t.five = 500;
  40611. t.six = 500;
  40612. t.seven = 500;
  40613. t.eight = 500;
  40614. t.nine = 500;
  40615. t.colon = 333;
  40616. t.semicolon = 333;
  40617. t.less = 570;
  40618. t.equal = 570;
  40619. t.greater = 570;
  40620. t.question = 500;
  40621. t.at = 832;
  40622. t.A = 667;
  40623. t.B = 667;
  40624. t.C = 667;
  40625. t.D = 722;
  40626. t.E = 667;
  40627. t.F = 667;
  40628. t.G = 722;
  40629. t.H = 778;
  40630. t.I = 389;
  40631. t.J = 500;
  40632. t.K = 667;
  40633. t.L = 611;
  40634. t.M = 889;
  40635. t.N = 722;
  40636. t.O = 722;
  40637. t.P = 611;
  40638. t.Q = 722;
  40639. t.R = 667;
  40640. t.S = 556;
  40641. t.T = 611;
  40642. t.U = 722;
  40643. t.V = 667;
  40644. t.W = 889;
  40645. t.X = 667;
  40646. t.Y = 611;
  40647. t.Z = 611;
  40648. t.bracketleft = 333;
  40649. t.backslash = 278;
  40650. t.bracketright = 333;
  40651. t.asciicircum = 570;
  40652. t.underscore = 500;
  40653. t.quoteleft = 333;
  40654. t.a = 500;
  40655. t.b = 500;
  40656. t.c = 444;
  40657. t.d = 500;
  40658. t.e = 444;
  40659. t.f = 333;
  40660. t.g = 500;
  40661. t.h = 556;
  40662. t.i = 278;
  40663. t.j = 278;
  40664. t.k = 500;
  40665. t.l = 278;
  40666. t.m = 778;
  40667. t.n = 556;
  40668. t.o = 500;
  40669. t.p = 500;
  40670. t.q = 500;
  40671. t.r = 389;
  40672. t.s = 389;
  40673. t.t = 278;
  40674. t.u = 556;
  40675. t.v = 444;
  40676. t.w = 667;
  40677. t.x = 500;
  40678. t.y = 444;
  40679. t.z = 389;
  40680. t.braceleft = 348;
  40681. t.bar = 220;
  40682. t.braceright = 348;
  40683. t.asciitilde = 570;
  40684. t.exclamdown = 389;
  40685. t.cent = 500;
  40686. t.sterling = 500;
  40687. t.fraction = 167;
  40688. t.yen = 500;
  40689. t.florin = 500;
  40690. t.section = 500;
  40691. t.currency = 500;
  40692. t.quotesingle = 278;
  40693. t.quotedblleft = 500;
  40694. t.guillemotleft = 500;
  40695. t.guilsinglleft = 333;
  40696. t.guilsinglright = 333;
  40697. t.fi = 556;
  40698. t.fl = 556;
  40699. t.endash = 500;
  40700. t.dagger = 500;
  40701. t.daggerdbl = 500;
  40702. t.periodcentered = 250;
  40703. t.paragraph = 500;
  40704. t.bullet = 350;
  40705. t.quotesinglbase = 333;
  40706. t.quotedblbase = 500;
  40707. t.quotedblright = 500;
  40708. t.guillemotright = 500;
  40709. t.ellipsis = 1000;
  40710. t.perthousand = 1000;
  40711. t.questiondown = 500;
  40712. t.grave = 333;
  40713. t.acute = 333;
  40714. t.circumflex = 333;
  40715. t.tilde = 333;
  40716. t.macron = 333;
  40717. t.breve = 333;
  40718. t.dotaccent = 333;
  40719. t.dieresis = 333;
  40720. t.ring = 333;
  40721. t.cedilla = 333;
  40722. t.hungarumlaut = 333;
  40723. t.ogonek = 333;
  40724. t.caron = 333;
  40725. t.emdash = 1000;
  40726. t.AE = 944;
  40727. t.ordfeminine = 266;
  40728. t.Lslash = 611;
  40729. t.Oslash = 722;
  40730. t.OE = 944;
  40731. t.ordmasculine = 300;
  40732. t.ae = 722;
  40733. t.dotlessi = 278;
  40734. t.lslash = 278;
  40735. t.oslash = 500;
  40736. t.oe = 722;
  40737. t.germandbls = 500;
  40738. t.Idieresis = 389;
  40739. t.eacute = 444;
  40740. t.abreve = 500;
  40741. t.uhungarumlaut = 556;
  40742. t.ecaron = 444;
  40743. t.Ydieresis = 611;
  40744. t.divide = 570;
  40745. t.Yacute = 611;
  40746. t.Acircumflex = 667;
  40747. t.aacute = 500;
  40748. t.Ucircumflex = 722;
  40749. t.yacute = 444;
  40750. t.scommaaccent = 389;
  40751. t.ecircumflex = 444;
  40752. t.Uring = 722;
  40753. t.Udieresis = 722;
  40754. t.aogonek = 500;
  40755. t.Uacute = 722;
  40756. t.uogonek = 556;
  40757. t.Edieresis = 667;
  40758. t.Dcroat = 722;
  40759. t.commaaccent = 250;
  40760. t.copyright = 747;
  40761. t.Emacron = 667;
  40762. t.ccaron = 444;
  40763. t.aring = 500;
  40764. t.Ncommaaccent = 722;
  40765. t.lacute = 278;
  40766. t.agrave = 500;
  40767. t.Tcommaaccent = 611;
  40768. t.Cacute = 667;
  40769. t.atilde = 500;
  40770. t.Edotaccent = 667;
  40771. t.scaron = 389;
  40772. t.scedilla = 389;
  40773. t.iacute = 278;
  40774. t.lozenge = 494;
  40775. t.Rcaron = 667;
  40776. t.Gcommaaccent = 722;
  40777. t.ucircumflex = 556;
  40778. t.acircumflex = 500;
  40779. t.Amacron = 667;
  40780. t.rcaron = 389;
  40781. t.ccedilla = 444;
  40782. t.Zdotaccent = 611;
  40783. t.Thorn = 611;
  40784. t.Omacron = 722;
  40785. t.Racute = 667;
  40786. t.Sacute = 556;
  40787. t.dcaron = 608;
  40788. t.Umacron = 722;
  40789. t.uring = 556;
  40790. t.threesuperior = 300;
  40791. t.Ograve = 722;
  40792. t.Agrave = 667;
  40793. t.Abreve = 667;
  40794. t.multiply = 570;
  40795. t.uacute = 556;
  40796. t.Tcaron = 611;
  40797. t.partialdiff = 494;
  40798. t.ydieresis = 444;
  40799. t.Nacute = 722;
  40800. t.icircumflex = 278;
  40801. t.Ecircumflex = 667;
  40802. t.adieresis = 500;
  40803. t.edieresis = 444;
  40804. t.cacute = 444;
  40805. t.nacute = 556;
  40806. t.umacron = 556;
  40807. t.Ncaron = 722;
  40808. t.Iacute = 389;
  40809. t.plusminus = 570;
  40810. t.brokenbar = 220;
  40811. t.registered = 747;
  40812. t.Gbreve = 722;
  40813. t.Idotaccent = 389;
  40814. t.summation = 600;
  40815. t.Egrave = 667;
  40816. t.racute = 389;
  40817. t.omacron = 500;
  40818. t.Zacute = 611;
  40819. t.Zcaron = 611;
  40820. t.greaterequal = 549;
  40821. t.Eth = 722;
  40822. t.Ccedilla = 667;
  40823. t.lcommaaccent = 278;
  40824. t.tcaron = 366;
  40825. t.eogonek = 444;
  40826. t.Uogonek = 722;
  40827. t.Aacute = 667;
  40828. t.Adieresis = 667;
  40829. t.egrave = 444;
  40830. t.zacute = 389;
  40831. t.iogonek = 278;
  40832. t.Oacute = 722;
  40833. t.oacute = 500;
  40834. t.amacron = 500;
  40835. t.sacute = 389;
  40836. t.idieresis = 278;
  40837. t.Ocircumflex = 722;
  40838. t.Ugrave = 722;
  40839. t.Delta = 612;
  40840. t.thorn = 500;
  40841. t.twosuperior = 300;
  40842. t.Odieresis = 722;
  40843. t.mu = 576;
  40844. t.igrave = 278;
  40845. t.ohungarumlaut = 500;
  40846. t.Eogonek = 667;
  40847. t.dcroat = 500;
  40848. t.threequarters = 750;
  40849. t.Scedilla = 556;
  40850. t.lcaron = 382;
  40851. t.Kcommaaccent = 667;
  40852. t.Lacute = 611;
  40853. t.trademark = 1000;
  40854. t.edotaccent = 444;
  40855. t.Igrave = 389;
  40856. t.Imacron = 389;
  40857. t.Lcaron = 611;
  40858. t.onehalf = 750;
  40859. t.lessequal = 549;
  40860. t.ocircumflex = 500;
  40861. t.ntilde = 556;
  40862. t.Uhungarumlaut = 722;
  40863. t.Eacute = 667;
  40864. t.emacron = 444;
  40865. t.gbreve = 500;
  40866. t.onequarter = 750;
  40867. t.Scaron = 556;
  40868. t.Scommaaccent = 556;
  40869. t.Ohungarumlaut = 722;
  40870. t.degree = 400;
  40871. t.ograve = 500;
  40872. t.Ccaron = 667;
  40873. t.ugrave = 556;
  40874. t.radical = 549;
  40875. t.Dcaron = 722;
  40876. t.rcommaaccent = 389;
  40877. t.Ntilde = 722;
  40878. t.otilde = 500;
  40879. t.Rcommaaccent = 667;
  40880. t.Lcommaaccent = 611;
  40881. t.Atilde = 667;
  40882. t.Aogonek = 667;
  40883. t.Aring = 667;
  40884. t.Otilde = 722;
  40885. t.zdotaccent = 389;
  40886. t.Ecaron = 667;
  40887. t.Iogonek = 389;
  40888. t.kcommaaccent = 500;
  40889. t.minus = 606;
  40890. t.Icircumflex = 389;
  40891. t.ncaron = 556;
  40892. t.tcommaaccent = 278;
  40893. t.logicalnot = 606;
  40894. t.odieresis = 500;
  40895. t.udieresis = 556;
  40896. t.notequal = 549;
  40897. t.gcommaaccent = 500;
  40898. t.eth = 500;
  40899. t.zcaron = 389;
  40900. t.ncommaaccent = 556;
  40901. t.onesuperior = 300;
  40902. t.imacron = 278;
  40903. t.Euro = 500;
  40904. });
  40905. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40906. t.space = 250;
  40907. t.exclam = 333;
  40908. t.quotedbl = 420;
  40909. t.numbersign = 500;
  40910. t.dollar = 500;
  40911. t.percent = 833;
  40912. t.ampersand = 778;
  40913. t.quoteright = 333;
  40914. t.parenleft = 333;
  40915. t.parenright = 333;
  40916. t.asterisk = 500;
  40917. t.plus = 675;
  40918. t.comma = 250;
  40919. t.hyphen = 333;
  40920. t.period = 250;
  40921. t.slash = 278;
  40922. t.zero = 500;
  40923. t.one = 500;
  40924. t.two = 500;
  40925. t.three = 500;
  40926. t.four = 500;
  40927. t.five = 500;
  40928. t.six = 500;
  40929. t.seven = 500;
  40930. t.eight = 500;
  40931. t.nine = 500;
  40932. t.colon = 333;
  40933. t.semicolon = 333;
  40934. t.less = 675;
  40935. t.equal = 675;
  40936. t.greater = 675;
  40937. t.question = 500;
  40938. t.at = 920;
  40939. t.A = 611;
  40940. t.B = 611;
  40941. t.C = 667;
  40942. t.D = 722;
  40943. t.E = 611;
  40944. t.F = 611;
  40945. t.G = 722;
  40946. t.H = 722;
  40947. t.I = 333;
  40948. t.J = 444;
  40949. t.K = 667;
  40950. t.L = 556;
  40951. t.M = 833;
  40952. t.N = 667;
  40953. t.O = 722;
  40954. t.P = 611;
  40955. t.Q = 722;
  40956. t.R = 611;
  40957. t.S = 500;
  40958. t.T = 556;
  40959. t.U = 722;
  40960. t.V = 611;
  40961. t.W = 833;
  40962. t.X = 611;
  40963. t.Y = 556;
  40964. t.Z = 556;
  40965. t.bracketleft = 389;
  40966. t.backslash = 278;
  40967. t.bracketright = 389;
  40968. t.asciicircum = 422;
  40969. t.underscore = 500;
  40970. t.quoteleft = 333;
  40971. t.a = 500;
  40972. t.b = 500;
  40973. t.c = 444;
  40974. t.d = 500;
  40975. t.e = 444;
  40976. t.f = 278;
  40977. t.g = 500;
  40978. t.h = 500;
  40979. t.i = 278;
  40980. t.j = 278;
  40981. t.k = 444;
  40982. t.l = 278;
  40983. t.m = 722;
  40984. t.n = 500;
  40985. t.o = 500;
  40986. t.p = 500;
  40987. t.q = 500;
  40988. t.r = 389;
  40989. t.s = 389;
  40990. t.t = 278;
  40991. t.u = 500;
  40992. t.v = 444;
  40993. t.w = 667;
  40994. t.x = 444;
  40995. t.y = 444;
  40996. t.z = 389;
  40997. t.braceleft = 400;
  40998. t.bar = 275;
  40999. t.braceright = 400;
  41000. t.asciitilde = 541;
  41001. t.exclamdown = 389;
  41002. t.cent = 500;
  41003. t.sterling = 500;
  41004. t.fraction = 167;
  41005. t.yen = 500;
  41006. t.florin = 500;
  41007. t.section = 500;
  41008. t.currency = 500;
  41009. t.quotesingle = 214;
  41010. t.quotedblleft = 556;
  41011. t.guillemotleft = 500;
  41012. t.guilsinglleft = 333;
  41013. t.guilsinglright = 333;
  41014. t.fi = 500;
  41015. t.fl = 500;
  41016. t.endash = 500;
  41017. t.dagger = 500;
  41018. t.daggerdbl = 500;
  41019. t.periodcentered = 250;
  41020. t.paragraph = 523;
  41021. t.bullet = 350;
  41022. t.quotesinglbase = 333;
  41023. t.quotedblbase = 556;
  41024. t.quotedblright = 556;
  41025. t.guillemotright = 500;
  41026. t.ellipsis = 889;
  41027. t.perthousand = 1000;
  41028. t.questiondown = 500;
  41029. t.grave = 333;
  41030. t.acute = 333;
  41031. t.circumflex = 333;
  41032. t.tilde = 333;
  41033. t.macron = 333;
  41034. t.breve = 333;
  41035. t.dotaccent = 333;
  41036. t.dieresis = 333;
  41037. t.ring = 333;
  41038. t.cedilla = 333;
  41039. t.hungarumlaut = 333;
  41040. t.ogonek = 333;
  41041. t.caron = 333;
  41042. t.emdash = 889;
  41043. t.AE = 889;
  41044. t.ordfeminine = 276;
  41045. t.Lslash = 556;
  41046. t.Oslash = 722;
  41047. t.OE = 944;
  41048. t.ordmasculine = 310;
  41049. t.ae = 667;
  41050. t.dotlessi = 278;
  41051. t.lslash = 278;
  41052. t.oslash = 500;
  41053. t.oe = 667;
  41054. t.germandbls = 500;
  41055. t.Idieresis = 333;
  41056. t.eacute = 444;
  41057. t.abreve = 500;
  41058. t.uhungarumlaut = 500;
  41059. t.ecaron = 444;
  41060. t.Ydieresis = 556;
  41061. t.divide = 675;
  41062. t.Yacute = 556;
  41063. t.Acircumflex = 611;
  41064. t.aacute = 500;
  41065. t.Ucircumflex = 722;
  41066. t.yacute = 444;
  41067. t.scommaaccent = 389;
  41068. t.ecircumflex = 444;
  41069. t.Uring = 722;
  41070. t.Udieresis = 722;
  41071. t.aogonek = 500;
  41072. t.Uacute = 722;
  41073. t.uogonek = 500;
  41074. t.Edieresis = 611;
  41075. t.Dcroat = 722;
  41076. t.commaaccent = 250;
  41077. t.copyright = 760;
  41078. t.Emacron = 611;
  41079. t.ccaron = 444;
  41080. t.aring = 500;
  41081. t.Ncommaaccent = 667;
  41082. t.lacute = 278;
  41083. t.agrave = 500;
  41084. t.Tcommaaccent = 556;
  41085. t.Cacute = 667;
  41086. t.atilde = 500;
  41087. t.Edotaccent = 611;
  41088. t.scaron = 389;
  41089. t.scedilla = 389;
  41090. t.iacute = 278;
  41091. t.lozenge = 471;
  41092. t.Rcaron = 611;
  41093. t.Gcommaaccent = 722;
  41094. t.ucircumflex = 500;
  41095. t.acircumflex = 500;
  41096. t.Amacron = 611;
  41097. t.rcaron = 389;
  41098. t.ccedilla = 444;
  41099. t.Zdotaccent = 556;
  41100. t.Thorn = 611;
  41101. t.Omacron = 722;
  41102. t.Racute = 611;
  41103. t.Sacute = 500;
  41104. t.dcaron = 544;
  41105. t.Umacron = 722;
  41106. t.uring = 500;
  41107. t.threesuperior = 300;
  41108. t.Ograve = 722;
  41109. t.Agrave = 611;
  41110. t.Abreve = 611;
  41111. t.multiply = 675;
  41112. t.uacute = 500;
  41113. t.Tcaron = 556;
  41114. t.partialdiff = 476;
  41115. t.ydieresis = 444;
  41116. t.Nacute = 667;
  41117. t.icircumflex = 278;
  41118. t.Ecircumflex = 611;
  41119. t.adieresis = 500;
  41120. t.edieresis = 444;
  41121. t.cacute = 444;
  41122. t.nacute = 500;
  41123. t.umacron = 500;
  41124. t.Ncaron = 667;
  41125. t.Iacute = 333;
  41126. t.plusminus = 675;
  41127. t.brokenbar = 275;
  41128. t.registered = 760;
  41129. t.Gbreve = 722;
  41130. t.Idotaccent = 333;
  41131. t.summation = 600;
  41132. t.Egrave = 611;
  41133. t.racute = 389;
  41134. t.omacron = 500;
  41135. t.Zacute = 556;
  41136. t.Zcaron = 556;
  41137. t.greaterequal = 549;
  41138. t.Eth = 722;
  41139. t.Ccedilla = 667;
  41140. t.lcommaaccent = 278;
  41141. t.tcaron = 300;
  41142. t.eogonek = 444;
  41143. t.Uogonek = 722;
  41144. t.Aacute = 611;
  41145. t.Adieresis = 611;
  41146. t.egrave = 444;
  41147. t.zacute = 389;
  41148. t.iogonek = 278;
  41149. t.Oacute = 722;
  41150. t.oacute = 500;
  41151. t.amacron = 500;
  41152. t.sacute = 389;
  41153. t.idieresis = 278;
  41154. t.Ocircumflex = 722;
  41155. t.Ugrave = 722;
  41156. t.Delta = 612;
  41157. t.thorn = 500;
  41158. t.twosuperior = 300;
  41159. t.Odieresis = 722;
  41160. t.mu = 500;
  41161. t.igrave = 278;
  41162. t.ohungarumlaut = 500;
  41163. t.Eogonek = 611;
  41164. t.dcroat = 500;
  41165. t.threequarters = 750;
  41166. t.Scedilla = 500;
  41167. t.lcaron = 300;
  41168. t.Kcommaaccent = 667;
  41169. t.Lacute = 556;
  41170. t.trademark = 980;
  41171. t.edotaccent = 444;
  41172. t.Igrave = 333;
  41173. t.Imacron = 333;
  41174. t.Lcaron = 611;
  41175. t.onehalf = 750;
  41176. t.lessequal = 549;
  41177. t.ocircumflex = 500;
  41178. t.ntilde = 500;
  41179. t.Uhungarumlaut = 722;
  41180. t.Eacute = 611;
  41181. t.emacron = 444;
  41182. t.gbreve = 500;
  41183. t.onequarter = 750;
  41184. t.Scaron = 500;
  41185. t.Scommaaccent = 500;
  41186. t.Ohungarumlaut = 722;
  41187. t.degree = 400;
  41188. t.ograve = 500;
  41189. t.Ccaron = 667;
  41190. t.ugrave = 500;
  41191. t.radical = 453;
  41192. t.Dcaron = 722;
  41193. t.rcommaaccent = 389;
  41194. t.Ntilde = 667;
  41195. t.otilde = 500;
  41196. t.Rcommaaccent = 611;
  41197. t.Lcommaaccent = 556;
  41198. t.Atilde = 611;
  41199. t.Aogonek = 611;
  41200. t.Aring = 611;
  41201. t.Otilde = 722;
  41202. t.zdotaccent = 389;
  41203. t.Ecaron = 611;
  41204. t.Iogonek = 333;
  41205. t.kcommaaccent = 444;
  41206. t.minus = 675;
  41207. t.Icircumflex = 333;
  41208. t.ncaron = 500;
  41209. t.tcommaaccent = 278;
  41210. t.logicalnot = 675;
  41211. t.odieresis = 500;
  41212. t.udieresis = 500;
  41213. t.notequal = 549;
  41214. t.gcommaaccent = 500;
  41215. t.eth = 500;
  41216. t.zcaron = 389;
  41217. t.ncommaaccent = 500;
  41218. t.onesuperior = 300;
  41219. t.imacron = 278;
  41220. t.Euro = 500;
  41221. });
  41222. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41223. t.space = 278;
  41224. t.a1 = 974;
  41225. t.a2 = 961;
  41226. t.a202 = 974;
  41227. t.a3 = 980;
  41228. t.a4 = 719;
  41229. t.a5 = 789;
  41230. t.a119 = 790;
  41231. t.a118 = 791;
  41232. t.a117 = 690;
  41233. t.a11 = 960;
  41234. t.a12 = 939;
  41235. t.a13 = 549;
  41236. t.a14 = 855;
  41237. t.a15 = 911;
  41238. t.a16 = 933;
  41239. t.a105 = 911;
  41240. t.a17 = 945;
  41241. t.a18 = 974;
  41242. t.a19 = 755;
  41243. t.a20 = 846;
  41244. t.a21 = 762;
  41245. t.a22 = 761;
  41246. t.a23 = 571;
  41247. t.a24 = 677;
  41248. t.a25 = 763;
  41249. t.a26 = 760;
  41250. t.a27 = 759;
  41251. t.a28 = 754;
  41252. t.a6 = 494;
  41253. t.a7 = 552;
  41254. t.a8 = 537;
  41255. t.a9 = 577;
  41256. t.a10 = 692;
  41257. t.a29 = 786;
  41258. t.a30 = 788;
  41259. t.a31 = 788;
  41260. t.a32 = 790;
  41261. t.a33 = 793;
  41262. t.a34 = 794;
  41263. t.a35 = 816;
  41264. t.a36 = 823;
  41265. t.a37 = 789;
  41266. t.a38 = 841;
  41267. t.a39 = 823;
  41268. t.a40 = 833;
  41269. t.a41 = 816;
  41270. t.a42 = 831;
  41271. t.a43 = 923;
  41272. t.a44 = 744;
  41273. t.a45 = 723;
  41274. t.a46 = 749;
  41275. t.a47 = 790;
  41276. t.a48 = 792;
  41277. t.a49 = 695;
  41278. t.a50 = 776;
  41279. t.a51 = 768;
  41280. t.a52 = 792;
  41281. t.a53 = 759;
  41282. t.a54 = 707;
  41283. t.a55 = 708;
  41284. t.a56 = 682;
  41285. t.a57 = 701;
  41286. t.a58 = 826;
  41287. t.a59 = 815;
  41288. t.a60 = 789;
  41289. t.a61 = 789;
  41290. t.a62 = 707;
  41291. t.a63 = 687;
  41292. t.a64 = 696;
  41293. t.a65 = 689;
  41294. t.a66 = 786;
  41295. t.a67 = 787;
  41296. t.a68 = 713;
  41297. t.a69 = 791;
  41298. t.a70 = 785;
  41299. t.a71 = 791;
  41300. t.a72 = 873;
  41301. t.a73 = 761;
  41302. t.a74 = 762;
  41303. t.a203 = 762;
  41304. t.a75 = 759;
  41305. t.a204 = 759;
  41306. t.a76 = 892;
  41307. t.a77 = 892;
  41308. t.a78 = 788;
  41309. t.a79 = 784;
  41310. t.a81 = 438;
  41311. t.a82 = 138;
  41312. t.a83 = 277;
  41313. t.a84 = 415;
  41314. t.a97 = 392;
  41315. t.a98 = 392;
  41316. t.a99 = 668;
  41317. t.a100 = 668;
  41318. t.a89 = 390;
  41319. t.a90 = 390;
  41320. t.a93 = 317;
  41321. t.a94 = 317;
  41322. t.a91 = 276;
  41323. t.a92 = 276;
  41324. t.a205 = 509;
  41325. t.a85 = 509;
  41326. t.a206 = 410;
  41327. t.a86 = 410;
  41328. t.a87 = 234;
  41329. t.a88 = 234;
  41330. t.a95 = 334;
  41331. t.a96 = 334;
  41332. t.a101 = 732;
  41333. t.a102 = 544;
  41334. t.a103 = 544;
  41335. t.a104 = 910;
  41336. t.a106 = 667;
  41337. t.a107 = 760;
  41338. t.a108 = 760;
  41339. t.a112 = 776;
  41340. t.a111 = 595;
  41341. t.a110 = 694;
  41342. t.a109 = 626;
  41343. t.a120 = 788;
  41344. t.a121 = 788;
  41345. t.a122 = 788;
  41346. t.a123 = 788;
  41347. t.a124 = 788;
  41348. t.a125 = 788;
  41349. t.a126 = 788;
  41350. t.a127 = 788;
  41351. t.a128 = 788;
  41352. t.a129 = 788;
  41353. t.a130 = 788;
  41354. t.a131 = 788;
  41355. t.a132 = 788;
  41356. t.a133 = 788;
  41357. t.a134 = 788;
  41358. t.a135 = 788;
  41359. t.a136 = 788;
  41360. t.a137 = 788;
  41361. t.a138 = 788;
  41362. t.a139 = 788;
  41363. t.a140 = 788;
  41364. t.a141 = 788;
  41365. t.a142 = 788;
  41366. t.a143 = 788;
  41367. t.a144 = 788;
  41368. t.a145 = 788;
  41369. t.a146 = 788;
  41370. t.a147 = 788;
  41371. t.a148 = 788;
  41372. t.a149 = 788;
  41373. t.a150 = 788;
  41374. t.a151 = 788;
  41375. t.a152 = 788;
  41376. t.a153 = 788;
  41377. t.a154 = 788;
  41378. t.a155 = 788;
  41379. t.a156 = 788;
  41380. t.a157 = 788;
  41381. t.a158 = 788;
  41382. t.a159 = 788;
  41383. t.a160 = 894;
  41384. t.a161 = 838;
  41385. t.a163 = 1016;
  41386. t.a164 = 458;
  41387. t.a196 = 748;
  41388. t.a165 = 924;
  41389. t.a192 = 748;
  41390. t.a166 = 918;
  41391. t.a167 = 927;
  41392. t.a168 = 928;
  41393. t.a169 = 928;
  41394. t.a170 = 834;
  41395. t.a171 = 873;
  41396. t.a172 = 828;
  41397. t.a173 = 924;
  41398. t.a162 = 924;
  41399. t.a174 = 917;
  41400. t.a175 = 930;
  41401. t.a176 = 931;
  41402. t.a177 = 463;
  41403. t.a178 = 883;
  41404. t.a179 = 836;
  41405. t.a193 = 836;
  41406. t.a180 = 867;
  41407. t.a199 = 867;
  41408. t.a181 = 696;
  41409. t.a200 = 696;
  41410. t.a182 = 874;
  41411. t.a201 = 874;
  41412. t.a183 = 760;
  41413. t.a184 = 946;
  41414. t.a197 = 771;
  41415. t.a185 = 865;
  41416. t.a194 = 771;
  41417. t.a198 = 888;
  41418. t.a186 = 967;
  41419. t.a195 = 888;
  41420. t.a187 = 831;
  41421. t.a188 = 873;
  41422. t.a189 = 927;
  41423. t.a190 = 970;
  41424. t.a191 = 918;
  41425. });
  41426. });
  41427. exports.getMetrics = getMetrics;
  41428. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41429. t.Courier = {
  41430. ascent: 629,
  41431. descent: -157,
  41432. capHeight: 562,
  41433. xHeight: -426
  41434. };
  41435. t["Courier-Bold"] = {
  41436. ascent: 629,
  41437. descent: -157,
  41438. capHeight: 562,
  41439. xHeight: 439
  41440. };
  41441. t["Courier-Oblique"] = {
  41442. ascent: 629,
  41443. descent: -157,
  41444. capHeight: 562,
  41445. xHeight: 426
  41446. };
  41447. t["Courier-BoldOblique"] = {
  41448. ascent: 629,
  41449. descent: -157,
  41450. capHeight: 562,
  41451. xHeight: 426
  41452. };
  41453. t.Helvetica = {
  41454. ascent: 718,
  41455. descent: -207,
  41456. capHeight: 718,
  41457. xHeight: 523
  41458. };
  41459. t["Helvetica-Bold"] = {
  41460. ascent: 718,
  41461. descent: -207,
  41462. capHeight: 718,
  41463. xHeight: 532
  41464. };
  41465. t["Helvetica-Oblique"] = {
  41466. ascent: 718,
  41467. descent: -207,
  41468. capHeight: 718,
  41469. xHeight: 523
  41470. };
  41471. t["Helvetica-BoldOblique"] = {
  41472. ascent: 718,
  41473. descent: -207,
  41474. capHeight: 718,
  41475. xHeight: 532
  41476. };
  41477. t["Times-Roman"] = {
  41478. ascent: 683,
  41479. descent: -217,
  41480. capHeight: 662,
  41481. xHeight: 450
  41482. };
  41483. t["Times-Bold"] = {
  41484. ascent: 683,
  41485. descent: -217,
  41486. capHeight: 676,
  41487. xHeight: 461
  41488. };
  41489. t["Times-Italic"] = {
  41490. ascent: 683,
  41491. descent: -217,
  41492. capHeight: 653,
  41493. xHeight: 441
  41494. };
  41495. t["Times-BoldItalic"] = {
  41496. ascent: 683,
  41497. descent: -217,
  41498. capHeight: 669,
  41499. xHeight: 462
  41500. };
  41501. t.Symbol = {
  41502. ascent: Math.NaN,
  41503. descent: Math.NaN,
  41504. capHeight: Math.NaN,
  41505. xHeight: Math.NaN
  41506. };
  41507. t.ZapfDingbats = {
  41508. ascent: Math.NaN,
  41509. descent: Math.NaN,
  41510. capHeight: Math.NaN,
  41511. xHeight: Math.NaN
  41512. };
  41513. });
  41514. exports.getFontBasicMetrics = getFontBasicMetrics;
  41515. /***/ }),
  41516. /* 44 */
  41517. /***/ ((__unused_webpack_module, exports) => {
  41518. Object.defineProperty(exports, "__esModule", ({
  41519. value: true
  41520. }));
  41521. exports.GlyfTable = void 0;
  41522. const ON_CURVE_POINT = 1 << 0;
  41523. const X_SHORT_VECTOR = 1 << 1;
  41524. const Y_SHORT_VECTOR = 1 << 2;
  41525. const REPEAT_FLAG = 1 << 3;
  41526. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41527. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41528. const OVERLAP_SIMPLE = 1 << 6;
  41529. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41530. const ARGS_ARE_XY_VALUES = 1 << 1;
  41531. const WE_HAVE_A_SCALE = 1 << 3;
  41532. const MORE_COMPONENTS = 1 << 5;
  41533. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41534. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41535. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41536. class GlyfTable {
  41537. constructor({
  41538. glyfTable,
  41539. isGlyphLocationsLong,
  41540. locaTable,
  41541. numGlyphs
  41542. }) {
  41543. this.glyphs = [];
  41544. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41545. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41546. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41547. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41548. let pos = 0;
  41549. for (let i = 0; i < numGlyphs; i++) {
  41550. pos += offsetSize;
  41551. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41552. if (next === prev) {
  41553. this.glyphs.push(new Glyph({}));
  41554. continue;
  41555. }
  41556. const glyph = Glyph.parse(prev, glyf);
  41557. this.glyphs.push(glyph);
  41558. prev = next;
  41559. }
  41560. }
  41561. getSize() {
  41562. return this.glyphs.reduce((a, g) => {
  41563. const size = g.getSize();
  41564. return a + (size + 3 & ~3);
  41565. }, 0);
  41566. }
  41567. write() {
  41568. const totalSize = this.getSize();
  41569. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41570. const isLocationLong = totalSize > 0x1fffe;
  41571. const offsetSize = isLocationLong ? 4 : 2;
  41572. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41573. if (isLocationLong) {
  41574. locaTable.setUint32(0, 0);
  41575. } else {
  41576. locaTable.setUint16(0, 0);
  41577. }
  41578. let pos = 0;
  41579. let locaIndex = 0;
  41580. for (const glyph of this.glyphs) {
  41581. pos += glyph.write(pos, glyfTable);
  41582. pos = pos + 3 & ~3;
  41583. locaIndex += offsetSize;
  41584. if (isLocationLong) {
  41585. locaTable.setUint32(locaIndex, pos);
  41586. } else {
  41587. locaTable.setUint16(locaIndex, pos >> 1);
  41588. }
  41589. }
  41590. return {
  41591. isLocationLong,
  41592. loca: new Uint8Array(locaTable.buffer),
  41593. glyf: new Uint8Array(glyfTable.buffer)
  41594. };
  41595. }
  41596. scale(factors) {
  41597. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41598. this.glyphs[i].scale(factors[i]);
  41599. }
  41600. }
  41601. }
  41602. exports.GlyfTable = GlyfTable;
  41603. class Glyph {
  41604. constructor({
  41605. header = null,
  41606. simple = null,
  41607. composites = null
  41608. }) {
  41609. this.header = header;
  41610. this.simple = simple;
  41611. this.composites = composites;
  41612. }
  41613. static parse(pos, glyf) {
  41614. const [read, header] = GlyphHeader.parse(pos, glyf);
  41615. pos += read;
  41616. if (header.numberOfContours < 0) {
  41617. const composites = [];
  41618. while (true) {
  41619. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41620. pos += n;
  41621. composites.push(composite);
  41622. if (!(composite.flags & MORE_COMPONENTS)) {
  41623. break;
  41624. }
  41625. }
  41626. return new Glyph({
  41627. header,
  41628. composites
  41629. });
  41630. }
  41631. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  41632. return new Glyph({
  41633. header,
  41634. simple
  41635. });
  41636. }
  41637. getSize() {
  41638. if (!this.header) {
  41639. return 0;
  41640. }
  41641. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  41642. return this.header.getSize() + size;
  41643. }
  41644. write(pos, buf) {
  41645. if (!this.header) {
  41646. return 0;
  41647. }
  41648. const spos = pos;
  41649. pos += this.header.write(pos, buf);
  41650. if (this.simple) {
  41651. pos += this.simple.write(pos, buf);
  41652. } else {
  41653. for (const composite of this.composites) {
  41654. pos += composite.write(pos, buf);
  41655. }
  41656. }
  41657. return pos - spos;
  41658. }
  41659. scale(factor) {
  41660. if (!this.header) {
  41661. return;
  41662. }
  41663. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  41664. this.header.scale(xMiddle, factor);
  41665. if (this.simple) {
  41666. this.simple.scale(xMiddle, factor);
  41667. } else {
  41668. for (const composite of this.composites) {
  41669. composite.scale(xMiddle, factor);
  41670. }
  41671. }
  41672. }
  41673. }
  41674. class GlyphHeader {
  41675. constructor({
  41676. numberOfContours,
  41677. xMin,
  41678. yMin,
  41679. xMax,
  41680. yMax
  41681. }) {
  41682. this.numberOfContours = numberOfContours;
  41683. this.xMin = xMin;
  41684. this.yMin = yMin;
  41685. this.xMax = xMax;
  41686. this.yMax = yMax;
  41687. }
  41688. static parse(pos, glyf) {
  41689. return [10, new GlyphHeader({
  41690. numberOfContours: glyf.getInt16(pos),
  41691. xMin: glyf.getInt16(pos + 2),
  41692. yMin: glyf.getInt16(pos + 4),
  41693. xMax: glyf.getInt16(pos + 6),
  41694. yMax: glyf.getInt16(pos + 8)
  41695. })];
  41696. }
  41697. getSize() {
  41698. return 10;
  41699. }
  41700. write(pos, buf) {
  41701. buf.setInt16(pos, this.numberOfContours);
  41702. buf.setInt16(pos + 2, this.xMin);
  41703. buf.setInt16(pos + 4, this.yMin);
  41704. buf.setInt16(pos + 6, this.xMax);
  41705. buf.setInt16(pos + 8, this.yMax);
  41706. return 10;
  41707. }
  41708. scale(x, factor) {
  41709. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41710. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41711. }
  41712. }
  41713. class Contour {
  41714. constructor({
  41715. flags,
  41716. xCoordinates,
  41717. yCoordinates
  41718. }) {
  41719. this.xCoordinates = xCoordinates;
  41720. this.yCoordinates = yCoordinates;
  41721. this.flags = flags;
  41722. }
  41723. }
  41724. class SimpleGlyph {
  41725. constructor({
  41726. contours,
  41727. instructions
  41728. }) {
  41729. this.contours = contours;
  41730. this.instructions = instructions;
  41731. }
  41732. static parse(pos, glyf, numberOfContours) {
  41733. const endPtsOfContours = [];
  41734. for (let i = 0; i < numberOfContours; i++) {
  41735. const endPt = glyf.getUint16(pos);
  41736. pos += 2;
  41737. endPtsOfContours.push(endPt);
  41738. }
  41739. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  41740. const instructionLength = glyf.getUint16(pos);
  41741. pos += 2;
  41742. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41743. pos += instructionLength;
  41744. const flags = [];
  41745. for (let i = 0; i < numberOfPt; pos++, i++) {
  41746. let flag = glyf.getUint8(pos);
  41747. flags.push(flag);
  41748. if (flag & REPEAT_FLAG) {
  41749. const count = glyf.getUint8(++pos);
  41750. flag ^= REPEAT_FLAG;
  41751. for (let m = 0; m < count; m++) {
  41752. flags.push(flag);
  41753. }
  41754. i += count;
  41755. }
  41756. }
  41757. const allXCoordinates = [];
  41758. let xCoordinates = [];
  41759. let yCoordinates = [];
  41760. let pointFlags = [];
  41761. const contours = [];
  41762. let endPtsOfContoursIndex = 0;
  41763. let lastCoordinate = 0;
  41764. for (let i = 0; i < numberOfPt; i++) {
  41765. const flag = flags[i];
  41766. if (flag & X_SHORT_VECTOR) {
  41767. const x = glyf.getUint8(pos++);
  41768. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  41769. xCoordinates.push(lastCoordinate);
  41770. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  41771. xCoordinates.push(lastCoordinate);
  41772. } else {
  41773. lastCoordinate += glyf.getInt16(pos);
  41774. pos += 2;
  41775. xCoordinates.push(lastCoordinate);
  41776. }
  41777. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41778. endPtsOfContoursIndex++;
  41779. allXCoordinates.push(xCoordinates);
  41780. xCoordinates = [];
  41781. }
  41782. }
  41783. lastCoordinate = 0;
  41784. endPtsOfContoursIndex = 0;
  41785. for (let i = 0; i < numberOfPt; i++) {
  41786. const flag = flags[i];
  41787. if (flag & Y_SHORT_VECTOR) {
  41788. const y = glyf.getUint8(pos++);
  41789. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  41790. yCoordinates.push(lastCoordinate);
  41791. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  41792. yCoordinates.push(lastCoordinate);
  41793. } else {
  41794. lastCoordinate += glyf.getInt16(pos);
  41795. pos += 2;
  41796. yCoordinates.push(lastCoordinate);
  41797. }
  41798. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  41799. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41800. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  41801. endPtsOfContoursIndex++;
  41802. contours.push(new Contour({
  41803. flags: pointFlags,
  41804. xCoordinates,
  41805. yCoordinates
  41806. }));
  41807. yCoordinates = [];
  41808. pointFlags = [];
  41809. }
  41810. }
  41811. return new SimpleGlyph({
  41812. contours,
  41813. instructions
  41814. });
  41815. }
  41816. getSize() {
  41817. let size = this.contours.length * 2 + 2 + this.instructions.length;
  41818. let lastX = 0;
  41819. let lastY = 0;
  41820. for (const contour of this.contours) {
  41821. size += contour.flags.length;
  41822. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41823. const x = contour.xCoordinates[i];
  41824. const y = contour.yCoordinates[i];
  41825. let abs = Math.abs(x - lastX);
  41826. if (abs > 255) {
  41827. size += 2;
  41828. } else if (abs > 0) {
  41829. size += 1;
  41830. }
  41831. lastX = x;
  41832. abs = Math.abs(y - lastY);
  41833. if (abs > 255) {
  41834. size += 2;
  41835. } else if (abs > 0) {
  41836. size += 1;
  41837. }
  41838. lastY = y;
  41839. }
  41840. }
  41841. return size;
  41842. }
  41843. write(pos, buf) {
  41844. const spos = pos;
  41845. const xCoordinates = [];
  41846. const yCoordinates = [];
  41847. const flags = [];
  41848. let lastX = 0;
  41849. let lastY = 0;
  41850. for (const contour of this.contours) {
  41851. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41852. let flag = contour.flags[i];
  41853. const x = contour.xCoordinates[i];
  41854. let delta = x - lastX;
  41855. if (delta === 0) {
  41856. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  41857. xCoordinates.push(0);
  41858. } else {
  41859. const abs = Math.abs(delta);
  41860. if (abs <= 255) {
  41861. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  41862. xCoordinates.push(abs);
  41863. } else {
  41864. xCoordinates.push(delta);
  41865. }
  41866. }
  41867. lastX = x;
  41868. const y = contour.yCoordinates[i];
  41869. delta = y - lastY;
  41870. if (delta === 0) {
  41871. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  41872. yCoordinates.push(0);
  41873. } else {
  41874. const abs = Math.abs(delta);
  41875. if (abs <= 255) {
  41876. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  41877. yCoordinates.push(abs);
  41878. } else {
  41879. yCoordinates.push(delta);
  41880. }
  41881. }
  41882. lastY = y;
  41883. flags.push(flag);
  41884. }
  41885. buf.setUint16(pos, xCoordinates.length - 1);
  41886. pos += 2;
  41887. }
  41888. buf.setUint16(pos, this.instructions.length);
  41889. pos += 2;
  41890. if (this.instructions.length) {
  41891. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41892. pos += this.instructions.length;
  41893. }
  41894. for (const flag of flags) {
  41895. buf.setUint8(pos++, flag);
  41896. }
  41897. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  41898. const x = xCoordinates[i];
  41899. const flag = flags[i];
  41900. if (flag & X_SHORT_VECTOR) {
  41901. buf.setUint8(pos++, x);
  41902. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  41903. buf.setInt16(pos, x);
  41904. pos += 2;
  41905. }
  41906. }
  41907. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  41908. const y = yCoordinates[i];
  41909. const flag = flags[i];
  41910. if (flag & Y_SHORT_VECTOR) {
  41911. buf.setUint8(pos++, y);
  41912. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  41913. buf.setInt16(pos, y);
  41914. pos += 2;
  41915. }
  41916. }
  41917. return pos - spos;
  41918. }
  41919. scale(x, factor) {
  41920. for (const contour of this.contours) {
  41921. if (contour.xCoordinates.length === 0) {
  41922. continue;
  41923. }
  41924. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41925. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  41926. }
  41927. }
  41928. }
  41929. }
  41930. class CompositeGlyph {
  41931. constructor({
  41932. flags,
  41933. glyphIndex,
  41934. argument1,
  41935. argument2,
  41936. transf,
  41937. instructions
  41938. }) {
  41939. this.flags = flags;
  41940. this.glyphIndex = glyphIndex;
  41941. this.argument1 = argument1;
  41942. this.argument2 = argument2;
  41943. this.transf = transf;
  41944. this.instructions = instructions;
  41945. }
  41946. static parse(pos, glyf) {
  41947. const spos = pos;
  41948. const transf = [];
  41949. let flags = glyf.getUint16(pos);
  41950. const glyphIndex = glyf.getUint16(pos + 2);
  41951. pos += 4;
  41952. let argument1, argument2;
  41953. if (flags & ARG_1_AND_2_ARE_WORDS) {
  41954. if (flags & ARGS_ARE_XY_VALUES) {
  41955. argument1 = glyf.getInt16(pos);
  41956. argument2 = glyf.getInt16(pos + 2);
  41957. } else {
  41958. argument1 = glyf.getUint16(pos);
  41959. argument2 = glyf.getUint16(pos + 2);
  41960. }
  41961. pos += 4;
  41962. flags ^= ARG_1_AND_2_ARE_WORDS;
  41963. } else {
  41964. if (flags & ARGS_ARE_XY_VALUES) {
  41965. argument1 = glyf.getInt8(pos);
  41966. argument2 = glyf.getInt8(pos + 1);
  41967. } else {
  41968. argument1 = glyf.getUint8(pos);
  41969. argument2 = glyf.getUint8(pos + 1);
  41970. }
  41971. pos += 2;
  41972. }
  41973. if (flags & WE_HAVE_A_SCALE) {
  41974. transf.push(glyf.getUint16(pos));
  41975. pos += 2;
  41976. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  41977. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  41978. pos += 4;
  41979. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  41980. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  41981. pos += 8;
  41982. }
  41983. let instructions = null;
  41984. if (flags & WE_HAVE_INSTRUCTIONS) {
  41985. const instructionLength = glyf.getUint16(pos);
  41986. pos += 2;
  41987. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41988. pos += instructionLength;
  41989. }
  41990. return [pos - spos, new CompositeGlyph({
  41991. flags,
  41992. glyphIndex,
  41993. argument1,
  41994. argument2,
  41995. transf,
  41996. instructions
  41997. })];
  41998. }
  41999. getSize() {
  42000. let size = 2 + 2 + this.transf.length * 2;
  42001. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42002. size += 2 + this.instructions.length;
  42003. }
  42004. size += 2;
  42005. if (this.flags & 2) {
  42006. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42007. size += 2;
  42008. }
  42009. } else {
  42010. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42011. size += 2;
  42012. }
  42013. }
  42014. return size;
  42015. }
  42016. write(pos, buf) {
  42017. const spos = pos;
  42018. if (this.flags & ARGS_ARE_XY_VALUES) {
  42019. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42020. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42021. }
  42022. } else {
  42023. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42024. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42025. }
  42026. }
  42027. buf.setUint16(pos, this.flags);
  42028. buf.setUint16(pos + 2, this.glyphIndex);
  42029. pos += 4;
  42030. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42031. if (this.flags & ARGS_ARE_XY_VALUES) {
  42032. buf.setInt16(pos, this.argument1);
  42033. buf.setInt16(pos + 2, this.argument2);
  42034. } else {
  42035. buf.setUint16(pos, this.argument1);
  42036. buf.setUint16(pos + 2, this.argument2);
  42037. }
  42038. pos += 4;
  42039. } else {
  42040. buf.setUint8(pos, this.argument1);
  42041. buf.setUint8(pos + 1, this.argument2);
  42042. pos += 2;
  42043. }
  42044. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42045. buf.setUint16(pos, this.instructions.length);
  42046. pos += 2;
  42047. if (this.instructions.length) {
  42048. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42049. pos += this.instructions.length;
  42050. }
  42051. }
  42052. return pos - spos;
  42053. }
  42054. scale(x, factor) {}
  42055. }
  42056. /***/ }),
  42057. /* 45 */
  42058. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42059. Object.defineProperty(exports, "__esModule", ({
  42060. value: true
  42061. }));
  42062. exports.OpenTypeFileBuilder = void 0;
  42063. var _core_utils = __w_pdfjs_require__(4);
  42064. var _util = __w_pdfjs_require__(2);
  42065. function writeInt16(dest, offset, num) {
  42066. dest[offset] = num >> 8 & 0xff;
  42067. dest[offset + 1] = num & 0xff;
  42068. }
  42069. function writeInt32(dest, offset, num) {
  42070. dest[offset] = num >> 24 & 0xff;
  42071. dest[offset + 1] = num >> 16 & 0xff;
  42072. dest[offset + 2] = num >> 8 & 0xff;
  42073. dest[offset + 3] = num & 0xff;
  42074. }
  42075. function writeData(dest, offset, data) {
  42076. if (data instanceof Uint8Array) {
  42077. dest.set(data, offset);
  42078. } else if (typeof data === "string") {
  42079. for (let i = 0, ii = data.length; i < ii; i++) {
  42080. dest[offset++] = data.charCodeAt(i) & 0xff;
  42081. }
  42082. } else {
  42083. for (const num of data) {
  42084. dest[offset++] = num & 0xff;
  42085. }
  42086. }
  42087. }
  42088. const OTF_HEADER_SIZE = 12;
  42089. const OTF_TABLE_ENTRY_SIZE = 16;
  42090. class OpenTypeFileBuilder {
  42091. constructor(sfnt) {
  42092. this.sfnt = sfnt;
  42093. this.tables = Object.create(null);
  42094. }
  42095. static getSearchParams(entriesCount, entrySize) {
  42096. let maxPower2 = 1,
  42097. log2 = 0;
  42098. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42099. maxPower2 <<= 1;
  42100. log2++;
  42101. }
  42102. const searchRange = maxPower2 * entrySize;
  42103. return {
  42104. range: searchRange,
  42105. entry: log2,
  42106. rangeShift: entrySize * entriesCount - searchRange
  42107. };
  42108. }
  42109. toArray() {
  42110. let sfnt = this.sfnt;
  42111. const tables = this.tables;
  42112. const tablesNames = Object.keys(tables);
  42113. tablesNames.sort();
  42114. const numTables = tablesNames.length;
  42115. let i, j, jj, table, tableName;
  42116. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42117. const tableOffsets = [offset];
  42118. for (i = 0; i < numTables; i++) {
  42119. table = tables[tablesNames[i]];
  42120. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42121. offset += paddedLength;
  42122. tableOffsets.push(offset);
  42123. }
  42124. const file = new Uint8Array(offset);
  42125. for (i = 0; i < numTables; i++) {
  42126. table = tables[tablesNames[i]];
  42127. writeData(file, tableOffsets[i], table);
  42128. }
  42129. if (sfnt === "true") {
  42130. sfnt = (0, _util.string32)(0x00010000);
  42131. }
  42132. file[0] = sfnt.charCodeAt(0) & 0xff;
  42133. file[1] = sfnt.charCodeAt(1) & 0xff;
  42134. file[2] = sfnt.charCodeAt(2) & 0xff;
  42135. file[3] = sfnt.charCodeAt(3) & 0xff;
  42136. writeInt16(file, 4, numTables);
  42137. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42138. writeInt16(file, 6, searchParams.range);
  42139. writeInt16(file, 8, searchParams.entry);
  42140. writeInt16(file, 10, searchParams.rangeShift);
  42141. offset = OTF_HEADER_SIZE;
  42142. for (i = 0; i < numTables; i++) {
  42143. tableName = tablesNames[i];
  42144. file[offset] = tableName.charCodeAt(0) & 0xff;
  42145. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42146. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42147. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42148. let checksum = 0;
  42149. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42150. const quad = (0, _core_utils.readUint32)(file, j);
  42151. checksum = checksum + quad >>> 0;
  42152. }
  42153. writeInt32(file, offset + 4, checksum);
  42154. writeInt32(file, offset + 8, tableOffsets[i]);
  42155. writeInt32(file, offset + 12, tables[tableName].length);
  42156. offset += OTF_TABLE_ENTRY_SIZE;
  42157. }
  42158. return file;
  42159. }
  42160. addTable(tag, data) {
  42161. if (tag in this.tables) {
  42162. throw new Error("Table " + tag + " already exists");
  42163. }
  42164. this.tables[tag] = data;
  42165. }
  42166. }
  42167. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42168. /***/ }),
  42169. /* 46 */
  42170. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42171. Object.defineProperty(exports, "__esModule", ({
  42172. value: true
  42173. }));
  42174. exports.Type1Font = void 0;
  42175. var _cff_parser = __w_pdfjs_require__(33);
  42176. var _util = __w_pdfjs_require__(2);
  42177. var _fonts_utils = __w_pdfjs_require__(36);
  42178. var _core_utils = __w_pdfjs_require__(4);
  42179. var _stream = __w_pdfjs_require__(8);
  42180. var _type1_parser = __w_pdfjs_require__(47);
  42181. function findBlock(streamBytes, signature, startIndex) {
  42182. const streamBytesLength = streamBytes.length;
  42183. const signatureLength = signature.length;
  42184. const scanLength = streamBytesLength - signatureLength;
  42185. let i = startIndex,
  42186. found = false;
  42187. while (i < scanLength) {
  42188. let j = 0;
  42189. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42190. j++;
  42191. }
  42192. if (j >= signatureLength) {
  42193. i += j;
  42194. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42195. i++;
  42196. }
  42197. found = true;
  42198. break;
  42199. }
  42200. i++;
  42201. }
  42202. return {
  42203. found,
  42204. length: i
  42205. };
  42206. }
  42207. function getHeaderBlock(stream, suggestedLength) {
  42208. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42209. const streamStartPos = stream.pos;
  42210. let headerBytes, headerBytesLength, block;
  42211. try {
  42212. headerBytes = stream.getBytes(suggestedLength);
  42213. headerBytesLength = headerBytes.length;
  42214. } catch (ex) {}
  42215. if (headerBytesLength === suggestedLength) {
  42216. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42217. if (block.found && block.length === suggestedLength) {
  42218. return {
  42219. stream: new _stream.Stream(headerBytes),
  42220. length: suggestedLength
  42221. };
  42222. }
  42223. }
  42224. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42225. stream.pos = streamStartPos;
  42226. const SCAN_BLOCK_LENGTH = 2048;
  42227. let actualLength;
  42228. while (true) {
  42229. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42230. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42231. if (block.length === 0) {
  42232. break;
  42233. }
  42234. stream.pos += block.length;
  42235. if (block.found) {
  42236. actualLength = stream.pos - streamStartPos;
  42237. break;
  42238. }
  42239. }
  42240. stream.pos = streamStartPos;
  42241. if (actualLength) {
  42242. return {
  42243. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42244. length: actualLength
  42245. };
  42246. }
  42247. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42248. return {
  42249. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42250. length: suggestedLength
  42251. };
  42252. }
  42253. function getEexecBlock(stream, suggestedLength) {
  42254. const eexecBytes = stream.getBytes();
  42255. if (eexecBytes.length === 0) {
  42256. throw new _util.FormatError("getEexecBlock - no font program found.");
  42257. }
  42258. return {
  42259. stream: new _stream.Stream(eexecBytes),
  42260. length: eexecBytes.length
  42261. };
  42262. }
  42263. class Type1Font {
  42264. constructor(name, file, properties) {
  42265. const PFB_HEADER_SIZE = 6;
  42266. let headerBlockLength = properties.length1;
  42267. let eexecBlockLength = properties.length2;
  42268. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42269. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42270. if (pfbHeaderPresent) {
  42271. file.skip(PFB_HEADER_SIZE);
  42272. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42273. }
  42274. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42275. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42276. headerBlockParser.extractFontHeader(properties);
  42277. if (pfbHeaderPresent) {
  42278. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42279. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42280. }
  42281. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42282. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42283. const data = eexecBlockParser.extractFontProgram(properties);
  42284. for (const key in data.properties) {
  42285. properties[key] = data.properties[key];
  42286. }
  42287. const charstrings = data.charstrings;
  42288. const type2Charstrings = this.getType2Charstrings(charstrings);
  42289. const subrs = this.getType2Subrs(data.subrs);
  42290. this.charstrings = charstrings;
  42291. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42292. this.seacs = this.getSeacs(data.charstrings);
  42293. }
  42294. get numGlyphs() {
  42295. return this.charstrings.length + 1;
  42296. }
  42297. getCharset() {
  42298. const charset = [".notdef"];
  42299. for (const {
  42300. glyphName
  42301. } of this.charstrings) {
  42302. charset.push(glyphName);
  42303. }
  42304. return charset;
  42305. }
  42306. getGlyphMapping(properties) {
  42307. const charstrings = this.charstrings;
  42308. if (properties.composite) {
  42309. const charCodeToGlyphId = Object.create(null);
  42310. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42311. const charCode = properties.cMap.charCodeOf(glyphId);
  42312. charCodeToGlyphId[charCode] = glyphId + 1;
  42313. }
  42314. return charCodeToGlyphId;
  42315. }
  42316. const glyphNames = [".notdef"];
  42317. let builtInEncoding, glyphId;
  42318. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42319. glyphNames.push(charstrings[glyphId].glyphName);
  42320. }
  42321. const encoding = properties.builtInEncoding;
  42322. if (encoding) {
  42323. builtInEncoding = Object.create(null);
  42324. for (const charCode in encoding) {
  42325. glyphId = glyphNames.indexOf(encoding[charCode]);
  42326. if (glyphId >= 0) {
  42327. builtInEncoding[charCode] = glyphId;
  42328. }
  42329. }
  42330. }
  42331. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42332. }
  42333. hasGlyphId(id) {
  42334. if (id < 0 || id >= this.numGlyphs) {
  42335. return false;
  42336. }
  42337. if (id === 0) {
  42338. return true;
  42339. }
  42340. const glyph = this.charstrings[id - 1];
  42341. return glyph.charstring.length > 0;
  42342. }
  42343. getSeacs(charstrings) {
  42344. const seacMap = [];
  42345. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42346. const charstring = charstrings[i];
  42347. if (charstring.seac) {
  42348. seacMap[i + 1] = charstring.seac;
  42349. }
  42350. }
  42351. return seacMap;
  42352. }
  42353. getType2Charstrings(type1Charstrings) {
  42354. const type2Charstrings = [];
  42355. for (const type1Charstring of type1Charstrings) {
  42356. type2Charstrings.push(type1Charstring.charstring);
  42357. }
  42358. return type2Charstrings;
  42359. }
  42360. getType2Subrs(type1Subrs) {
  42361. let bias = 0;
  42362. const count = type1Subrs.length;
  42363. if (count < 1133) {
  42364. bias = 107;
  42365. } else if (count < 33769) {
  42366. bias = 1131;
  42367. } else {
  42368. bias = 32768;
  42369. }
  42370. const type2Subrs = [];
  42371. let i;
  42372. for (i = 0; i < bias; i++) {
  42373. type2Subrs.push([0x0b]);
  42374. }
  42375. for (i = 0; i < count; i++) {
  42376. type2Subrs.push(type1Subrs[i]);
  42377. }
  42378. return type2Subrs;
  42379. }
  42380. wrap(name, glyphs, charstrings, subrs, properties) {
  42381. const cff = new _cff_parser.CFF();
  42382. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42383. cff.names = [name];
  42384. const topDict = new _cff_parser.CFFTopDict();
  42385. topDict.setByName("version", 391);
  42386. topDict.setByName("Notice", 392);
  42387. topDict.setByName("FullName", 393);
  42388. topDict.setByName("FamilyName", 394);
  42389. topDict.setByName("Weight", 395);
  42390. topDict.setByName("Encoding", null);
  42391. topDict.setByName("FontMatrix", properties.fontMatrix);
  42392. topDict.setByName("FontBBox", properties.bbox);
  42393. topDict.setByName("charset", null);
  42394. topDict.setByName("CharStrings", null);
  42395. topDict.setByName("Private", null);
  42396. cff.topDict = topDict;
  42397. const strings = new _cff_parser.CFFStrings();
  42398. strings.add("Version 0.11");
  42399. strings.add("See original notice");
  42400. strings.add(name);
  42401. strings.add(name);
  42402. strings.add("Medium");
  42403. cff.strings = strings;
  42404. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42405. const count = glyphs.length;
  42406. const charsetArray = [".notdef"];
  42407. let i, ii;
  42408. for (i = 0; i < count; i++) {
  42409. const glyphName = charstrings[i].glyphName;
  42410. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42411. if (index === -1) {
  42412. strings.add(glyphName);
  42413. }
  42414. charsetArray.push(glyphName);
  42415. }
  42416. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42417. const charStringsIndex = new _cff_parser.CFFIndex();
  42418. charStringsIndex.add([0x8b, 0x0e]);
  42419. for (i = 0; i < count; i++) {
  42420. charStringsIndex.add(glyphs[i]);
  42421. }
  42422. cff.charStrings = charStringsIndex;
  42423. const privateDict = new _cff_parser.CFFPrivateDict();
  42424. privateDict.setByName("Subrs", null);
  42425. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42426. for (i = 0, ii = fields.length; i < ii; i++) {
  42427. const field = fields[i];
  42428. if (!(field in properties.privateData)) {
  42429. continue;
  42430. }
  42431. const value = properties.privateData[field];
  42432. if (Array.isArray(value)) {
  42433. for (let j = value.length - 1; j > 0; j--) {
  42434. value[j] -= value[j - 1];
  42435. }
  42436. }
  42437. privateDict.setByName(field, value);
  42438. }
  42439. cff.topDict.privateDict = privateDict;
  42440. const subrIndex = new _cff_parser.CFFIndex();
  42441. for (i = 0, ii = subrs.length; i < ii; i++) {
  42442. subrIndex.add(subrs[i]);
  42443. }
  42444. privateDict.subrsIndex = subrIndex;
  42445. const compiler = new _cff_parser.CFFCompiler(cff);
  42446. return compiler.compile();
  42447. }
  42448. }
  42449. exports.Type1Font = Type1Font;
  42450. /***/ }),
  42451. /* 47 */
  42452. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42453. Object.defineProperty(exports, "__esModule", ({
  42454. value: true
  42455. }));
  42456. exports.Type1Parser = void 0;
  42457. var _encodings = __w_pdfjs_require__(35);
  42458. var _core_utils = __w_pdfjs_require__(4);
  42459. var _stream = __w_pdfjs_require__(8);
  42460. var _util = __w_pdfjs_require__(2);
  42461. const HINTING_ENABLED = false;
  42462. const COMMAND_MAP = {
  42463. hstem: [1],
  42464. vstem: [3],
  42465. vmoveto: [4],
  42466. rlineto: [5],
  42467. hlineto: [6],
  42468. vlineto: [7],
  42469. rrcurveto: [8],
  42470. callsubr: [10],
  42471. flex: [12, 35],
  42472. drop: [12, 18],
  42473. endchar: [14],
  42474. rmoveto: [21],
  42475. hmoveto: [22],
  42476. vhcurveto: [30],
  42477. hvcurveto: [31]
  42478. };
  42479. class Type1CharString {
  42480. constructor() {
  42481. this.width = 0;
  42482. this.lsb = 0;
  42483. this.flexing = false;
  42484. this.output = [];
  42485. this.stack = [];
  42486. }
  42487. convert(encoded, subrs, seacAnalysisEnabled) {
  42488. const count = encoded.length;
  42489. let error = false;
  42490. let wx, sbx, subrNumber;
  42491. for (let i = 0; i < count; i++) {
  42492. let value = encoded[i];
  42493. if (value < 32) {
  42494. if (value === 12) {
  42495. value = (value << 8) + encoded[++i];
  42496. }
  42497. switch (value) {
  42498. case 1:
  42499. if (!HINTING_ENABLED) {
  42500. this.stack = [];
  42501. break;
  42502. }
  42503. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42504. break;
  42505. case 3:
  42506. if (!HINTING_ENABLED) {
  42507. this.stack = [];
  42508. break;
  42509. }
  42510. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42511. break;
  42512. case 4:
  42513. if (this.flexing) {
  42514. if (this.stack.length < 1) {
  42515. error = true;
  42516. break;
  42517. }
  42518. const dy = this.stack.pop();
  42519. this.stack.push(0, dy);
  42520. break;
  42521. }
  42522. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42523. break;
  42524. case 5:
  42525. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42526. break;
  42527. case 6:
  42528. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42529. break;
  42530. case 7:
  42531. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42532. break;
  42533. case 8:
  42534. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42535. break;
  42536. case 9:
  42537. this.stack = [];
  42538. break;
  42539. case 10:
  42540. if (this.stack.length < 1) {
  42541. error = true;
  42542. break;
  42543. }
  42544. subrNumber = this.stack.pop();
  42545. if (!subrs[subrNumber]) {
  42546. error = true;
  42547. break;
  42548. }
  42549. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42550. break;
  42551. case 11:
  42552. return error;
  42553. case 13:
  42554. if (this.stack.length < 2) {
  42555. error = true;
  42556. break;
  42557. }
  42558. wx = this.stack.pop();
  42559. sbx = this.stack.pop();
  42560. this.lsb = sbx;
  42561. this.width = wx;
  42562. this.stack.push(wx, sbx);
  42563. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42564. break;
  42565. case 14:
  42566. this.output.push(COMMAND_MAP.endchar[0]);
  42567. break;
  42568. case 21:
  42569. if (this.flexing) {
  42570. break;
  42571. }
  42572. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42573. break;
  42574. case 22:
  42575. if (this.flexing) {
  42576. this.stack.push(0);
  42577. break;
  42578. }
  42579. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42580. break;
  42581. case 30:
  42582. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42583. break;
  42584. case 31:
  42585. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42586. break;
  42587. case (12 << 8) + 0:
  42588. this.stack = [];
  42589. break;
  42590. case (12 << 8) + 1:
  42591. if (!HINTING_ENABLED) {
  42592. this.stack = [];
  42593. break;
  42594. }
  42595. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42596. break;
  42597. case (12 << 8) + 2:
  42598. if (!HINTING_ENABLED) {
  42599. this.stack = [];
  42600. break;
  42601. }
  42602. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42603. break;
  42604. case (12 << 8) + 6:
  42605. if (seacAnalysisEnabled) {
  42606. const asb = this.stack.at(-5);
  42607. this.seac = this.stack.splice(-4, 4);
  42608. this.seac[0] += this.lsb - asb;
  42609. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42610. } else {
  42611. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42612. }
  42613. break;
  42614. case (12 << 8) + 7:
  42615. if (this.stack.length < 4) {
  42616. error = true;
  42617. break;
  42618. }
  42619. this.stack.pop();
  42620. wx = this.stack.pop();
  42621. const sby = this.stack.pop();
  42622. sbx = this.stack.pop();
  42623. this.lsb = sbx;
  42624. this.width = wx;
  42625. this.stack.push(wx, sbx, sby);
  42626. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42627. break;
  42628. case (12 << 8) + 12:
  42629. if (this.stack.length < 2) {
  42630. error = true;
  42631. break;
  42632. }
  42633. const num2 = this.stack.pop();
  42634. const num1 = this.stack.pop();
  42635. this.stack.push(num1 / num2);
  42636. break;
  42637. case (12 << 8) + 16:
  42638. if (this.stack.length < 2) {
  42639. error = true;
  42640. break;
  42641. }
  42642. subrNumber = this.stack.pop();
  42643. const numArgs = this.stack.pop();
  42644. if (subrNumber === 0 && numArgs === 3) {
  42645. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  42646. 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]);
  42647. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  42648. this.flexing = false;
  42649. this.stack.push(flexArgs[15], flexArgs[16]);
  42650. } else if (subrNumber === 1 && numArgs === 0) {
  42651. this.flexing = true;
  42652. }
  42653. break;
  42654. case (12 << 8) + 17:
  42655. break;
  42656. case (12 << 8) + 33:
  42657. this.stack = [];
  42658. break;
  42659. default:
  42660. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  42661. break;
  42662. }
  42663. if (error) {
  42664. break;
  42665. }
  42666. continue;
  42667. } else if (value <= 246) {
  42668. value -= 139;
  42669. } else if (value <= 250) {
  42670. value = (value - 247) * 256 + encoded[++i] + 108;
  42671. } else if (value <= 254) {
  42672. value = -((value - 251) * 256) - encoded[++i] - 108;
  42673. } else {
  42674. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  42675. }
  42676. this.stack.push(value);
  42677. }
  42678. return error;
  42679. }
  42680. executeCommand(howManyArgs, command, keepStack) {
  42681. const stackLength = this.stack.length;
  42682. if (howManyArgs > stackLength) {
  42683. return true;
  42684. }
  42685. const start = stackLength - howManyArgs;
  42686. for (let i = start; i < stackLength; i++) {
  42687. let value = this.stack[i];
  42688. if (Number.isInteger(value)) {
  42689. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42690. } else {
  42691. value = 65536 * value | 0;
  42692. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42693. }
  42694. }
  42695. this.output.push(...command);
  42696. if (keepStack) {
  42697. this.stack.splice(start, howManyArgs);
  42698. } else {
  42699. this.stack.length = 0;
  42700. }
  42701. return false;
  42702. }
  42703. }
  42704. const EEXEC_ENCRYPT_KEY = 55665;
  42705. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42706. function isHexDigit(code) {
  42707. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42708. }
  42709. function decrypt(data, key, discardNumber) {
  42710. if (discardNumber >= data.length) {
  42711. return new Uint8Array(0);
  42712. }
  42713. const c1 = 52845,
  42714. c2 = 22719;
  42715. let r = key | 0,
  42716. i,
  42717. j;
  42718. for (i = 0; i < discardNumber; i++) {
  42719. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  42720. }
  42721. const count = data.length - discardNumber;
  42722. const decrypted = new Uint8Array(count);
  42723. for (i = discardNumber, j = 0; j < count; i++, j++) {
  42724. const value = data[i];
  42725. decrypted[j] = value ^ r >> 8;
  42726. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42727. }
  42728. return decrypted;
  42729. }
  42730. function decryptAscii(data, key, discardNumber) {
  42731. const c1 = 52845,
  42732. c2 = 22719;
  42733. let r = key | 0;
  42734. const count = data.length,
  42735. maybeLength = count >>> 1;
  42736. const decrypted = new Uint8Array(maybeLength);
  42737. let i, j;
  42738. for (i = 0, j = 0; i < count; i++) {
  42739. const digit1 = data[i];
  42740. if (!isHexDigit(digit1)) {
  42741. continue;
  42742. }
  42743. i++;
  42744. let digit2;
  42745. while (i < count && !isHexDigit(digit2 = data[i])) {
  42746. i++;
  42747. }
  42748. if (i < count) {
  42749. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  42750. decrypted[j++] = value ^ r >> 8;
  42751. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42752. }
  42753. }
  42754. return decrypted.slice(discardNumber, j);
  42755. }
  42756. function isSpecial(c) {
  42757. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  42758. }
  42759. class Type1Parser {
  42760. constructor(stream, encrypted, seacAnalysisEnabled) {
  42761. if (encrypted) {
  42762. const data = stream.getBytes();
  42763. 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]));
  42764. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  42765. }
  42766. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  42767. this.stream = stream;
  42768. this.nextChar();
  42769. }
  42770. readNumberArray() {
  42771. this.getToken();
  42772. const array = [];
  42773. while (true) {
  42774. const token = this.getToken();
  42775. if (token === null || token === "]" || token === "}") {
  42776. break;
  42777. }
  42778. array.push(parseFloat(token || 0));
  42779. }
  42780. return array;
  42781. }
  42782. readNumber() {
  42783. const token = this.getToken();
  42784. return parseFloat(token || 0);
  42785. }
  42786. readInt() {
  42787. const token = this.getToken();
  42788. return parseInt(token || 0, 10) | 0;
  42789. }
  42790. readBoolean() {
  42791. const token = this.getToken();
  42792. return token === "true" ? 1 : 0;
  42793. }
  42794. nextChar() {
  42795. return this.currentChar = this.stream.getByte();
  42796. }
  42797. prevChar() {
  42798. this.stream.skip(-2);
  42799. return this.currentChar = this.stream.getByte();
  42800. }
  42801. getToken() {
  42802. let comment = false;
  42803. let ch = this.currentChar;
  42804. while (true) {
  42805. if (ch === -1) {
  42806. return null;
  42807. }
  42808. if (comment) {
  42809. if (ch === 0x0a || ch === 0x0d) {
  42810. comment = false;
  42811. }
  42812. } else if (ch === 0x25) {
  42813. comment = true;
  42814. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42815. break;
  42816. }
  42817. ch = this.nextChar();
  42818. }
  42819. if (isSpecial(ch)) {
  42820. this.nextChar();
  42821. return String.fromCharCode(ch);
  42822. }
  42823. let token = "";
  42824. do {
  42825. token += String.fromCharCode(ch);
  42826. ch = this.nextChar();
  42827. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  42828. return token;
  42829. }
  42830. readCharStrings(bytes, lenIV) {
  42831. if (lenIV === -1) {
  42832. return bytes;
  42833. }
  42834. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  42835. }
  42836. extractFontProgram(properties) {
  42837. const stream = this.stream;
  42838. const subrs = [],
  42839. charstrings = [];
  42840. const privateData = Object.create(null);
  42841. privateData.lenIV = 4;
  42842. const program = {
  42843. subrs: [],
  42844. charstrings: [],
  42845. properties: {
  42846. privateData
  42847. }
  42848. };
  42849. let token, length, data, lenIV;
  42850. while ((token = this.getToken()) !== null) {
  42851. if (token !== "/") {
  42852. continue;
  42853. }
  42854. token = this.getToken();
  42855. switch (token) {
  42856. case "CharStrings":
  42857. this.getToken();
  42858. this.getToken();
  42859. this.getToken();
  42860. this.getToken();
  42861. while (true) {
  42862. token = this.getToken();
  42863. if (token === null || token === "end") {
  42864. break;
  42865. }
  42866. if (token !== "/") {
  42867. continue;
  42868. }
  42869. const glyph = this.getToken();
  42870. length = this.readInt();
  42871. this.getToken();
  42872. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42873. lenIV = program.properties.privateData.lenIV;
  42874. const encoded = this.readCharStrings(data, lenIV);
  42875. this.nextChar();
  42876. token = this.getToken();
  42877. if (token === "noaccess") {
  42878. this.getToken();
  42879. } else if (token === "/") {
  42880. this.prevChar();
  42881. }
  42882. charstrings.push({
  42883. glyph,
  42884. encoded
  42885. });
  42886. }
  42887. break;
  42888. case "Subrs":
  42889. this.readInt();
  42890. this.getToken();
  42891. while (this.getToken() === "dup") {
  42892. const index = this.readInt();
  42893. length = this.readInt();
  42894. this.getToken();
  42895. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42896. lenIV = program.properties.privateData.lenIV;
  42897. const encoded = this.readCharStrings(data, lenIV);
  42898. this.nextChar();
  42899. token = this.getToken();
  42900. if (token === "noaccess") {
  42901. this.getToken();
  42902. }
  42903. subrs[index] = encoded;
  42904. }
  42905. break;
  42906. case "BlueValues":
  42907. case "OtherBlues":
  42908. case "FamilyBlues":
  42909. case "FamilyOtherBlues":
  42910. const blueArray = this.readNumberArray();
  42911. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  42912. program.properties.privateData[token] = blueArray;
  42913. }
  42914. break;
  42915. case "StemSnapH":
  42916. case "StemSnapV":
  42917. program.properties.privateData[token] = this.readNumberArray();
  42918. break;
  42919. case "StdHW":
  42920. case "StdVW":
  42921. program.properties.privateData[token] = this.readNumberArray()[0];
  42922. break;
  42923. case "BlueShift":
  42924. case "lenIV":
  42925. case "BlueFuzz":
  42926. case "BlueScale":
  42927. case "LanguageGroup":
  42928. case "ExpansionFactor":
  42929. program.properties.privateData[token] = this.readNumber();
  42930. break;
  42931. case "ForceBold":
  42932. program.properties.privateData[token] = this.readBoolean();
  42933. break;
  42934. }
  42935. }
  42936. for (const {
  42937. encoded,
  42938. glyph
  42939. } of charstrings) {
  42940. const charString = new Type1CharString();
  42941. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  42942. let output = charString.output;
  42943. if (error) {
  42944. output = [14];
  42945. }
  42946. const charStringObject = {
  42947. glyphName: glyph,
  42948. charstring: output,
  42949. width: charString.width,
  42950. lsb: charString.lsb,
  42951. seac: charString.seac
  42952. };
  42953. if (glyph === ".notdef") {
  42954. program.charstrings.unshift(charStringObject);
  42955. } else {
  42956. program.charstrings.push(charStringObject);
  42957. }
  42958. if (properties.builtInEncoding) {
  42959. const index = properties.builtInEncoding.indexOf(glyph);
  42960. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  42961. properties.widths[index] = charString.width;
  42962. }
  42963. }
  42964. }
  42965. return program;
  42966. }
  42967. extractFontHeader(properties) {
  42968. let token;
  42969. while ((token = this.getToken()) !== null) {
  42970. if (token !== "/") {
  42971. continue;
  42972. }
  42973. token = this.getToken();
  42974. switch (token) {
  42975. case "FontMatrix":
  42976. const matrix = this.readNumberArray();
  42977. properties.fontMatrix = matrix;
  42978. break;
  42979. case "Encoding":
  42980. const encodingArg = this.getToken();
  42981. let encoding;
  42982. if (!/^\d+$/.test(encodingArg)) {
  42983. encoding = (0, _encodings.getEncoding)(encodingArg);
  42984. } else {
  42985. encoding = [];
  42986. const size = parseInt(encodingArg, 10) | 0;
  42987. this.getToken();
  42988. for (let j = 0; j < size; j++) {
  42989. token = this.getToken();
  42990. while (token !== "dup" && token !== "def") {
  42991. token = this.getToken();
  42992. if (token === null) {
  42993. return;
  42994. }
  42995. }
  42996. if (token === "def") {
  42997. break;
  42998. }
  42999. const index = this.readInt();
  43000. this.getToken();
  43001. const glyph = this.getToken();
  43002. encoding[index] = glyph;
  43003. this.getToken();
  43004. }
  43005. }
  43006. properties.builtInEncoding = encoding;
  43007. break;
  43008. case "FontBBox":
  43009. const fontBBox = this.readNumberArray();
  43010. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  43011. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43012. properties.ascentScaled = true;
  43013. break;
  43014. }
  43015. }
  43016. }
  43017. }
  43018. exports.Type1Parser = Type1Parser;
  43019. /***/ }),
  43020. /* 48 */
  43021. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43022. Object.defineProperty(exports, "__esModule", ({
  43023. value: true
  43024. }));
  43025. exports.Pattern = void 0;
  43026. exports.getTilingPatternIR = getTilingPatternIR;
  43027. var _util = __w_pdfjs_require__(2);
  43028. var _base_stream = __w_pdfjs_require__(5);
  43029. var _colorspace = __w_pdfjs_require__(12);
  43030. var _core_utils = __w_pdfjs_require__(4);
  43031. const ShadingType = {
  43032. FUNCTION_BASED: 1,
  43033. AXIAL: 2,
  43034. RADIAL: 3,
  43035. FREE_FORM_MESH: 4,
  43036. LATTICE_FORM_MESH: 5,
  43037. COONS_PATCH_MESH: 6,
  43038. TENSOR_PATCH_MESH: 7
  43039. };
  43040. class Pattern {
  43041. constructor() {
  43042. (0, _util.unreachable)("Cannot initialize Pattern.");
  43043. }
  43044. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43045. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43046. const type = dict.get("ShadingType");
  43047. try {
  43048. switch (type) {
  43049. case ShadingType.AXIAL:
  43050. case ShadingType.RADIAL:
  43051. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43052. case ShadingType.FREE_FORM_MESH:
  43053. case ShadingType.LATTICE_FORM_MESH:
  43054. case ShadingType.COONS_PATCH_MESH:
  43055. case ShadingType.TENSOR_PATCH_MESH:
  43056. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43057. default:
  43058. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43059. }
  43060. } catch (ex) {
  43061. if (ex instanceof _core_utils.MissingDataException) {
  43062. throw ex;
  43063. }
  43064. handler.send("UnsupportedFeature", {
  43065. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43066. });
  43067. (0, _util.warn)(ex);
  43068. return new DummyShading();
  43069. }
  43070. }
  43071. }
  43072. exports.Pattern = Pattern;
  43073. class BaseShading {
  43074. static get SMALL_NUMBER() {
  43075. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43076. }
  43077. constructor() {
  43078. if (this.constructor === BaseShading) {
  43079. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43080. }
  43081. }
  43082. getIR() {
  43083. (0, _util.unreachable)("Abstract method `getIR` called.");
  43084. }
  43085. }
  43086. class RadialAxialShading extends BaseShading {
  43087. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43088. super();
  43089. this.coordsArr = dict.getArray("Coords");
  43090. this.shadingType = dict.get("ShadingType");
  43091. const cs = _colorspace.ColorSpace.parse({
  43092. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43093. xref,
  43094. resources,
  43095. pdfFunctionFactory,
  43096. localColorSpaceCache
  43097. });
  43098. const bbox = dict.getArray("BBox");
  43099. if (Array.isArray(bbox) && bbox.length === 4) {
  43100. this.bbox = _util.Util.normalizeRect(bbox);
  43101. } else {
  43102. this.bbox = null;
  43103. }
  43104. let t0 = 0.0,
  43105. t1 = 1.0;
  43106. if (dict.has("Domain")) {
  43107. const domainArr = dict.getArray("Domain");
  43108. t0 = domainArr[0];
  43109. t1 = domainArr[1];
  43110. }
  43111. let extendStart = false,
  43112. extendEnd = false;
  43113. if (dict.has("Extend")) {
  43114. const extendArr = dict.getArray("Extend");
  43115. extendStart = extendArr[0];
  43116. extendEnd = extendArr[1];
  43117. }
  43118. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43119. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43120. const distance = Math.hypot(x1 - x2, y1 - y2);
  43121. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43122. (0, _util.warn)("Unsupported radial gradient.");
  43123. }
  43124. }
  43125. this.extendStart = extendStart;
  43126. this.extendEnd = extendEnd;
  43127. const fnObj = dict.getRaw("Function");
  43128. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43129. const NUMBER_OF_SAMPLES = 10;
  43130. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43131. const colorStops = this.colorStops = [];
  43132. if (t0 >= t1 || step <= 0) {
  43133. (0, _util.info)("Bad shading domain.");
  43134. return;
  43135. }
  43136. const color = new Float32Array(cs.numComps),
  43137. ratio = new Float32Array(1);
  43138. let rgbColor;
  43139. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43140. ratio[0] = t0 + i * step;
  43141. fn(ratio, 0, color, 0);
  43142. rgbColor = cs.getRgb(color, 0);
  43143. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43144. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43145. }
  43146. let background = "transparent";
  43147. if (dict.has("Background")) {
  43148. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43149. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43150. }
  43151. if (!extendStart) {
  43152. colorStops.unshift([0, background]);
  43153. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43154. }
  43155. if (!extendEnd) {
  43156. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43157. colorStops.push([1, background]);
  43158. }
  43159. this.colorStops = colorStops;
  43160. }
  43161. getIR() {
  43162. const coordsArr = this.coordsArr;
  43163. const shadingType = this.shadingType;
  43164. let type, p0, p1, r0, r1;
  43165. if (shadingType === ShadingType.AXIAL) {
  43166. p0 = [coordsArr[0], coordsArr[1]];
  43167. p1 = [coordsArr[2], coordsArr[3]];
  43168. r0 = null;
  43169. r1 = null;
  43170. type = "axial";
  43171. } else if (shadingType === ShadingType.RADIAL) {
  43172. p0 = [coordsArr[0], coordsArr[1]];
  43173. p1 = [coordsArr[3], coordsArr[4]];
  43174. r0 = coordsArr[2];
  43175. r1 = coordsArr[5];
  43176. type = "radial";
  43177. } else {
  43178. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43179. }
  43180. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43181. }
  43182. }
  43183. class MeshStreamReader {
  43184. constructor(stream, context) {
  43185. this.stream = stream;
  43186. this.context = context;
  43187. this.buffer = 0;
  43188. this.bufferLength = 0;
  43189. const numComps = context.numComps;
  43190. this.tmpCompsBuf = new Float32Array(numComps);
  43191. const csNumComps = context.colorSpace.numComps;
  43192. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43193. }
  43194. get hasData() {
  43195. if (this.stream.end) {
  43196. return this.stream.pos < this.stream.end;
  43197. }
  43198. if (this.bufferLength > 0) {
  43199. return true;
  43200. }
  43201. const nextByte = this.stream.getByte();
  43202. if (nextByte < 0) {
  43203. return false;
  43204. }
  43205. this.buffer = nextByte;
  43206. this.bufferLength = 8;
  43207. return true;
  43208. }
  43209. readBits(n) {
  43210. let buffer = this.buffer;
  43211. let bufferLength = this.bufferLength;
  43212. if (n === 32) {
  43213. if (bufferLength === 0) {
  43214. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43215. }
  43216. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43217. const nextByte = this.stream.getByte();
  43218. this.buffer = nextByte & (1 << bufferLength) - 1;
  43219. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43220. }
  43221. if (n === 8 && bufferLength === 0) {
  43222. return this.stream.getByte();
  43223. }
  43224. while (bufferLength < n) {
  43225. buffer = buffer << 8 | this.stream.getByte();
  43226. bufferLength += 8;
  43227. }
  43228. bufferLength -= n;
  43229. this.bufferLength = bufferLength;
  43230. this.buffer = buffer & (1 << bufferLength) - 1;
  43231. return buffer >> bufferLength;
  43232. }
  43233. align() {
  43234. this.buffer = 0;
  43235. this.bufferLength = 0;
  43236. }
  43237. readFlag() {
  43238. return this.readBits(this.context.bitsPerFlag);
  43239. }
  43240. readCoordinate() {
  43241. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43242. const xi = this.readBits(bitsPerCoordinate);
  43243. const yi = this.readBits(bitsPerCoordinate);
  43244. const decode = this.context.decode;
  43245. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43246. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43247. }
  43248. readComponents() {
  43249. const numComps = this.context.numComps;
  43250. const bitsPerComponent = this.context.bitsPerComponent;
  43251. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43252. const decode = this.context.decode;
  43253. const components = this.tmpCompsBuf;
  43254. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43255. const ci = this.readBits(bitsPerComponent);
  43256. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43257. }
  43258. const color = this.tmpCsCompsBuf;
  43259. if (this.context.colorFn) {
  43260. this.context.colorFn(components, 0, color, 0);
  43261. }
  43262. return this.context.colorSpace.getRgb(color, 0);
  43263. }
  43264. }
  43265. const getB = function getBClosure() {
  43266. function buildB(count) {
  43267. const lut = [];
  43268. for (let i = 0; i <= count; i++) {
  43269. const t = i / count,
  43270. t_ = 1 - t;
  43271. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43272. }
  43273. return lut;
  43274. }
  43275. const cache = [];
  43276. return function (count) {
  43277. if (!cache[count]) {
  43278. cache[count] = buildB(count);
  43279. }
  43280. return cache[count];
  43281. };
  43282. }();
  43283. class MeshShading extends BaseShading {
  43284. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43285. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43286. }
  43287. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43288. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43289. }
  43290. static get TRIANGLE_DENSITY() {
  43291. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43292. }
  43293. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43294. super();
  43295. if (!(stream instanceof _base_stream.BaseStream)) {
  43296. throw new _util.FormatError("Mesh data is not a stream");
  43297. }
  43298. const dict = stream.dict;
  43299. this.shadingType = dict.get("ShadingType");
  43300. const bbox = dict.getArray("BBox");
  43301. if (Array.isArray(bbox) && bbox.length === 4) {
  43302. this.bbox = _util.Util.normalizeRect(bbox);
  43303. } else {
  43304. this.bbox = null;
  43305. }
  43306. const cs = _colorspace.ColorSpace.parse({
  43307. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43308. xref,
  43309. resources,
  43310. pdfFunctionFactory,
  43311. localColorSpaceCache
  43312. });
  43313. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43314. const fnObj = dict.getRaw("Function");
  43315. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43316. this.coords = [];
  43317. this.colors = [];
  43318. this.figures = [];
  43319. const decodeContext = {
  43320. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43321. bitsPerComponent: dict.get("BitsPerComponent"),
  43322. bitsPerFlag: dict.get("BitsPerFlag"),
  43323. decode: dict.getArray("Decode"),
  43324. colorFn: fn,
  43325. colorSpace: cs,
  43326. numComps: fn ? 1 : cs.numComps
  43327. };
  43328. const reader = new MeshStreamReader(stream, decodeContext);
  43329. let patchMesh = false;
  43330. switch (this.shadingType) {
  43331. case ShadingType.FREE_FORM_MESH:
  43332. this._decodeType4Shading(reader);
  43333. break;
  43334. case ShadingType.LATTICE_FORM_MESH:
  43335. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43336. if (verticesPerRow < 2) {
  43337. throw new _util.FormatError("Invalid VerticesPerRow");
  43338. }
  43339. this._decodeType5Shading(reader, verticesPerRow);
  43340. break;
  43341. case ShadingType.COONS_PATCH_MESH:
  43342. this._decodeType6Shading(reader);
  43343. patchMesh = true;
  43344. break;
  43345. case ShadingType.TENSOR_PATCH_MESH:
  43346. this._decodeType7Shading(reader);
  43347. patchMesh = true;
  43348. break;
  43349. default:
  43350. (0, _util.unreachable)("Unsupported mesh type.");
  43351. break;
  43352. }
  43353. if (patchMesh) {
  43354. this._updateBounds();
  43355. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43356. this._buildFigureFromPatch(i);
  43357. }
  43358. }
  43359. this._updateBounds();
  43360. this._packData();
  43361. }
  43362. _decodeType4Shading(reader) {
  43363. const coords = this.coords;
  43364. const colors = this.colors;
  43365. const operators = [];
  43366. const ps = [];
  43367. let verticesLeft = 0;
  43368. while (reader.hasData) {
  43369. const f = reader.readFlag();
  43370. const coord = reader.readCoordinate();
  43371. const color = reader.readComponents();
  43372. if (verticesLeft === 0) {
  43373. if (!(0 <= f && f <= 2)) {
  43374. throw new _util.FormatError("Unknown type4 flag");
  43375. }
  43376. switch (f) {
  43377. case 0:
  43378. verticesLeft = 3;
  43379. break;
  43380. case 1:
  43381. ps.push(ps.at(-2), ps.at(-1));
  43382. verticesLeft = 1;
  43383. break;
  43384. case 2:
  43385. ps.push(ps.at(-3), ps.at(-1));
  43386. verticesLeft = 1;
  43387. break;
  43388. }
  43389. operators.push(f);
  43390. }
  43391. ps.push(coords.length);
  43392. coords.push(coord);
  43393. colors.push(color);
  43394. verticesLeft--;
  43395. reader.align();
  43396. }
  43397. this.figures.push({
  43398. type: "triangles",
  43399. coords: new Int32Array(ps),
  43400. colors: new Int32Array(ps)
  43401. });
  43402. }
  43403. _decodeType5Shading(reader, verticesPerRow) {
  43404. const coords = this.coords;
  43405. const colors = this.colors;
  43406. const ps = [];
  43407. while (reader.hasData) {
  43408. const coord = reader.readCoordinate();
  43409. const color = reader.readComponents();
  43410. ps.push(coords.length);
  43411. coords.push(coord);
  43412. colors.push(color);
  43413. }
  43414. this.figures.push({
  43415. type: "lattice",
  43416. coords: new Int32Array(ps),
  43417. colors: new Int32Array(ps),
  43418. verticesPerRow
  43419. });
  43420. }
  43421. _decodeType6Shading(reader) {
  43422. const coords = this.coords;
  43423. const colors = this.colors;
  43424. const ps = new Int32Array(16);
  43425. const cs = new Int32Array(4);
  43426. while (reader.hasData) {
  43427. const f = reader.readFlag();
  43428. if (!(0 <= f && f <= 3)) {
  43429. throw new _util.FormatError("Unknown type6 flag");
  43430. }
  43431. const pi = coords.length;
  43432. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43433. coords.push(reader.readCoordinate());
  43434. }
  43435. const ci = colors.length;
  43436. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43437. colors.push(reader.readComponents());
  43438. }
  43439. let tmp1, tmp2, tmp3, tmp4;
  43440. switch (f) {
  43441. case 0:
  43442. ps[12] = pi + 3;
  43443. ps[13] = pi + 4;
  43444. ps[14] = pi + 5;
  43445. ps[15] = pi + 6;
  43446. ps[8] = pi + 2;
  43447. ps[11] = pi + 7;
  43448. ps[4] = pi + 1;
  43449. ps[7] = pi + 8;
  43450. ps[0] = pi;
  43451. ps[1] = pi + 11;
  43452. ps[2] = pi + 10;
  43453. ps[3] = pi + 9;
  43454. cs[2] = ci + 1;
  43455. cs[3] = ci + 2;
  43456. cs[0] = ci;
  43457. cs[1] = ci + 3;
  43458. break;
  43459. case 1:
  43460. tmp1 = ps[12];
  43461. tmp2 = ps[13];
  43462. tmp3 = ps[14];
  43463. tmp4 = ps[15];
  43464. ps[12] = tmp4;
  43465. ps[13] = pi + 0;
  43466. ps[14] = pi + 1;
  43467. ps[15] = pi + 2;
  43468. ps[8] = tmp3;
  43469. ps[11] = pi + 3;
  43470. ps[4] = tmp2;
  43471. ps[7] = pi + 4;
  43472. ps[0] = tmp1;
  43473. ps[1] = pi + 7;
  43474. ps[2] = pi + 6;
  43475. ps[3] = pi + 5;
  43476. tmp1 = cs[2];
  43477. tmp2 = cs[3];
  43478. cs[2] = tmp2;
  43479. cs[3] = ci;
  43480. cs[0] = tmp1;
  43481. cs[1] = ci + 1;
  43482. break;
  43483. case 2:
  43484. tmp1 = ps[15];
  43485. tmp2 = ps[11];
  43486. ps[12] = ps[3];
  43487. ps[13] = pi + 0;
  43488. ps[14] = pi + 1;
  43489. ps[15] = pi + 2;
  43490. ps[8] = ps[7];
  43491. ps[11] = pi + 3;
  43492. ps[4] = tmp2;
  43493. ps[7] = pi + 4;
  43494. ps[0] = tmp1;
  43495. ps[1] = pi + 7;
  43496. ps[2] = pi + 6;
  43497. ps[3] = pi + 5;
  43498. tmp1 = cs[3];
  43499. cs[2] = cs[1];
  43500. cs[3] = ci;
  43501. cs[0] = tmp1;
  43502. cs[1] = ci + 1;
  43503. break;
  43504. case 3:
  43505. ps[12] = ps[0];
  43506. ps[13] = pi + 0;
  43507. ps[14] = pi + 1;
  43508. ps[15] = pi + 2;
  43509. ps[8] = ps[1];
  43510. ps[11] = pi + 3;
  43511. ps[4] = ps[2];
  43512. ps[7] = pi + 4;
  43513. ps[0] = ps[3];
  43514. ps[1] = pi + 7;
  43515. ps[2] = pi + 6;
  43516. ps[3] = pi + 5;
  43517. cs[2] = cs[0];
  43518. cs[3] = ci;
  43519. cs[0] = cs[1];
  43520. cs[1] = ci + 1;
  43521. break;
  43522. }
  43523. ps[5] = coords.length;
  43524. 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]);
  43525. ps[6] = coords.length;
  43526. 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]);
  43527. ps[9] = coords.length;
  43528. 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]);
  43529. ps[10] = coords.length;
  43530. 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]);
  43531. this.figures.push({
  43532. type: "patch",
  43533. coords: new Int32Array(ps),
  43534. colors: new Int32Array(cs)
  43535. });
  43536. }
  43537. }
  43538. _decodeType7Shading(reader) {
  43539. const coords = this.coords;
  43540. const colors = this.colors;
  43541. const ps = new Int32Array(16);
  43542. const cs = new Int32Array(4);
  43543. while (reader.hasData) {
  43544. const f = reader.readFlag();
  43545. if (!(0 <= f && f <= 3)) {
  43546. throw new _util.FormatError("Unknown type7 flag");
  43547. }
  43548. const pi = coords.length;
  43549. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43550. coords.push(reader.readCoordinate());
  43551. }
  43552. const ci = colors.length;
  43553. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43554. colors.push(reader.readComponents());
  43555. }
  43556. let tmp1, tmp2, tmp3, tmp4;
  43557. switch (f) {
  43558. case 0:
  43559. ps[12] = pi + 3;
  43560. ps[13] = pi + 4;
  43561. ps[14] = pi + 5;
  43562. ps[15] = pi + 6;
  43563. ps[8] = pi + 2;
  43564. ps[9] = pi + 13;
  43565. ps[10] = pi + 14;
  43566. ps[11] = pi + 7;
  43567. ps[4] = pi + 1;
  43568. ps[5] = pi + 12;
  43569. ps[6] = pi + 15;
  43570. ps[7] = pi + 8;
  43571. ps[0] = pi;
  43572. ps[1] = pi + 11;
  43573. ps[2] = pi + 10;
  43574. ps[3] = pi + 9;
  43575. cs[2] = ci + 1;
  43576. cs[3] = ci + 2;
  43577. cs[0] = ci;
  43578. cs[1] = ci + 3;
  43579. break;
  43580. case 1:
  43581. tmp1 = ps[12];
  43582. tmp2 = ps[13];
  43583. tmp3 = ps[14];
  43584. tmp4 = ps[15];
  43585. ps[12] = tmp4;
  43586. ps[13] = pi + 0;
  43587. ps[14] = pi + 1;
  43588. ps[15] = pi + 2;
  43589. ps[8] = tmp3;
  43590. ps[9] = pi + 9;
  43591. ps[10] = pi + 10;
  43592. ps[11] = pi + 3;
  43593. ps[4] = tmp2;
  43594. ps[5] = pi + 8;
  43595. ps[6] = pi + 11;
  43596. ps[7] = pi + 4;
  43597. ps[0] = tmp1;
  43598. ps[1] = pi + 7;
  43599. ps[2] = pi + 6;
  43600. ps[3] = pi + 5;
  43601. tmp1 = cs[2];
  43602. tmp2 = cs[3];
  43603. cs[2] = tmp2;
  43604. cs[3] = ci;
  43605. cs[0] = tmp1;
  43606. cs[1] = ci + 1;
  43607. break;
  43608. case 2:
  43609. tmp1 = ps[15];
  43610. tmp2 = ps[11];
  43611. ps[12] = ps[3];
  43612. ps[13] = pi + 0;
  43613. ps[14] = pi + 1;
  43614. ps[15] = pi + 2;
  43615. ps[8] = ps[7];
  43616. ps[9] = pi + 9;
  43617. ps[10] = pi + 10;
  43618. ps[11] = pi + 3;
  43619. ps[4] = tmp2;
  43620. ps[5] = pi + 8;
  43621. ps[6] = pi + 11;
  43622. ps[7] = pi + 4;
  43623. ps[0] = tmp1;
  43624. ps[1] = pi + 7;
  43625. ps[2] = pi + 6;
  43626. ps[3] = pi + 5;
  43627. tmp1 = cs[3];
  43628. cs[2] = cs[1];
  43629. cs[3] = ci;
  43630. cs[0] = tmp1;
  43631. cs[1] = ci + 1;
  43632. break;
  43633. case 3:
  43634. ps[12] = ps[0];
  43635. ps[13] = pi + 0;
  43636. ps[14] = pi + 1;
  43637. ps[15] = pi + 2;
  43638. ps[8] = ps[1];
  43639. ps[9] = pi + 9;
  43640. ps[10] = pi + 10;
  43641. ps[11] = pi + 3;
  43642. ps[4] = ps[2];
  43643. ps[5] = pi + 8;
  43644. ps[6] = pi + 11;
  43645. ps[7] = pi + 4;
  43646. ps[0] = ps[3];
  43647. ps[1] = pi + 7;
  43648. ps[2] = pi + 6;
  43649. ps[3] = pi + 5;
  43650. cs[2] = cs[0];
  43651. cs[3] = ci;
  43652. cs[0] = cs[1];
  43653. cs[1] = ci + 1;
  43654. break;
  43655. }
  43656. this.figures.push({
  43657. type: "patch",
  43658. coords: new Int32Array(ps),
  43659. colors: new Int32Array(cs)
  43660. });
  43661. }
  43662. }
  43663. _buildFigureFromPatch(index) {
  43664. const figure = this.figures[index];
  43665. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  43666. const coords = this.coords,
  43667. colors = this.colors;
  43668. const pi = figure.coords;
  43669. const ci = figure.colors;
  43670. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43671. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43672. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43673. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43674. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  43675. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  43676. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  43677. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  43678. const verticesPerRow = splitXBy + 1;
  43679. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  43680. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  43681. let k = 0;
  43682. const cl = new Uint8Array(3),
  43683. cr = new Uint8Array(3);
  43684. const c0 = colors[ci[0]],
  43685. c1 = colors[ci[1]],
  43686. c2 = colors[ci[2]],
  43687. c3 = colors[ci[3]];
  43688. const bRow = getB(splitYBy),
  43689. bCol = getB(splitXBy);
  43690. for (let row = 0; row <= splitYBy; row++) {
  43691. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43692. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43693. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43694. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43695. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43696. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43697. for (let col = 0; col <= splitXBy; col++, k++) {
  43698. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43699. continue;
  43700. }
  43701. let x = 0,
  43702. y = 0;
  43703. let q = 0;
  43704. for (let i = 0; i <= 3; i++) {
  43705. for (let j = 0; j <= 3; j++, q++) {
  43706. const m = bRow[row][i] * bCol[col][j];
  43707. x += coords[pi[q]][0] * m;
  43708. y += coords[pi[q]][1] * m;
  43709. }
  43710. }
  43711. figureCoords[k] = coords.length;
  43712. coords.push([x, y]);
  43713. figureColors[k] = colors.length;
  43714. const newColor = new Uint8Array(3);
  43715. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  43716. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  43717. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  43718. colors.push(newColor);
  43719. }
  43720. }
  43721. figureCoords[0] = pi[0];
  43722. figureColors[0] = ci[0];
  43723. figureCoords[splitXBy] = pi[3];
  43724. figureColors[splitXBy] = ci[1];
  43725. figureCoords[verticesPerRow * splitYBy] = pi[12];
  43726. figureColors[verticesPerRow * splitYBy] = ci[2];
  43727. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  43728. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  43729. this.figures[index] = {
  43730. type: "lattice",
  43731. coords: figureCoords,
  43732. colors: figureColors,
  43733. verticesPerRow
  43734. };
  43735. }
  43736. _updateBounds() {
  43737. let minX = this.coords[0][0],
  43738. minY = this.coords[0][1],
  43739. maxX = minX,
  43740. maxY = minY;
  43741. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  43742. const x = this.coords[i][0],
  43743. y = this.coords[i][1];
  43744. minX = minX > x ? x : minX;
  43745. minY = minY > y ? y : minY;
  43746. maxX = maxX < x ? x : maxX;
  43747. maxY = maxY < y ? y : maxY;
  43748. }
  43749. this.bounds = [minX, minY, maxX, maxY];
  43750. }
  43751. _packData() {
  43752. let i, ii, j, jj;
  43753. const coords = this.coords;
  43754. const coordsPacked = new Float32Array(coords.length * 2);
  43755. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  43756. const xy = coords[i];
  43757. coordsPacked[j++] = xy[0];
  43758. coordsPacked[j++] = xy[1];
  43759. }
  43760. this.coords = coordsPacked;
  43761. const colors = this.colors;
  43762. const colorsPacked = new Uint8Array(colors.length * 3);
  43763. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  43764. const c = colors[i];
  43765. colorsPacked[j++] = c[0];
  43766. colorsPacked[j++] = c[1];
  43767. colorsPacked[j++] = c[2];
  43768. }
  43769. this.colors = colorsPacked;
  43770. const figures = this.figures;
  43771. for (i = 0, ii = figures.length; i < ii; i++) {
  43772. const figure = figures[i],
  43773. ps = figure.coords,
  43774. cs = figure.colors;
  43775. for (j = 0, jj = ps.length; j < jj; j++) {
  43776. ps[j] *= 2;
  43777. cs[j] *= 3;
  43778. }
  43779. }
  43780. }
  43781. getIR() {
  43782. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  43783. }
  43784. }
  43785. class DummyShading extends BaseShading {
  43786. getIR() {
  43787. return ["Dummy"];
  43788. }
  43789. }
  43790. function getTilingPatternIR(operatorList, dict, color) {
  43791. const matrix = dict.getArray("Matrix");
  43792. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  43793. const xstep = dict.get("XStep");
  43794. const ystep = dict.get("YStep");
  43795. const paintType = dict.get("PaintType");
  43796. const tilingType = dict.get("TilingType");
  43797. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  43798. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  43799. }
  43800. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  43801. }
  43802. /***/ }),
  43803. /* 49 */
  43804. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43805. Object.defineProperty(exports, "__esModule", ({
  43806. value: true
  43807. }));
  43808. exports.getXfaFontDict = getXfaFontDict;
  43809. exports.getXfaFontName = getXfaFontName;
  43810. var _calibri_factors = __w_pdfjs_require__(50);
  43811. var _primitives = __w_pdfjs_require__(3);
  43812. var _helvetica_factors = __w_pdfjs_require__(51);
  43813. var _liberationsans_widths = __w_pdfjs_require__(52);
  43814. var _myriadpro_factors = __w_pdfjs_require__(53);
  43815. var _segoeui_factors = __w_pdfjs_require__(54);
  43816. var _core_utils = __w_pdfjs_require__(4);
  43817. var _fonts_utils = __w_pdfjs_require__(36);
  43818. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  43819. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  43820. name: "LiberationSans-Regular",
  43821. factors: _myriadpro_factors.MyriadProRegularFactors,
  43822. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43823. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43824. metrics: _myriadpro_factors.MyriadProRegularMetrics
  43825. };
  43826. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  43827. name: "LiberationSans-Bold",
  43828. factors: _myriadpro_factors.MyriadProBoldFactors,
  43829. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43830. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43831. metrics: _myriadpro_factors.MyriadProBoldMetrics
  43832. };
  43833. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  43834. name: "LiberationSans-Italic",
  43835. factors: _myriadpro_factors.MyriadProItalicFactors,
  43836. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43837. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43838. metrics: _myriadpro_factors.MyriadProItalicMetrics
  43839. };
  43840. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  43841. name: "LiberationSans-BoldItalic",
  43842. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  43843. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43844. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43845. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  43846. };
  43847. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  43848. name: "LiberationSans-Regular",
  43849. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43850. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  43851. };
  43852. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  43853. name: "LiberationSans-Bold",
  43854. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43855. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  43856. };
  43857. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  43858. name: "LiberationSans-Italic",
  43859. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43860. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  43861. };
  43862. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  43863. name: "LiberationSans-BoldItalic",
  43864. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43865. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  43866. };
  43867. t["Calibri-Regular"] = {
  43868. name: "LiberationSans-Regular",
  43869. factors: _calibri_factors.CalibriRegularFactors,
  43870. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43871. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43872. metrics: _calibri_factors.CalibriRegularMetrics
  43873. };
  43874. t["Calibri-Bold"] = {
  43875. name: "LiberationSans-Bold",
  43876. factors: _calibri_factors.CalibriBoldFactors,
  43877. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43878. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43879. metrics: _calibri_factors.CalibriBoldMetrics
  43880. };
  43881. t["Calibri-Italic"] = {
  43882. name: "LiberationSans-Italic",
  43883. factors: _calibri_factors.CalibriItalicFactors,
  43884. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43885. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43886. metrics: _calibri_factors.CalibriItalicMetrics
  43887. };
  43888. t["Calibri-BoldItalic"] = {
  43889. name: "LiberationSans-BoldItalic",
  43890. factors: _calibri_factors.CalibriBoldItalicFactors,
  43891. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43892. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43893. metrics: _calibri_factors.CalibriBoldItalicMetrics
  43894. };
  43895. t["Segoeui-Regular"] = {
  43896. name: "LiberationSans-Regular",
  43897. factors: _segoeui_factors.SegoeuiRegularFactors,
  43898. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43899. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43900. metrics: _segoeui_factors.SegoeuiRegularMetrics
  43901. };
  43902. t["Segoeui-Bold"] = {
  43903. name: "LiberationSans-Bold",
  43904. factors: _segoeui_factors.SegoeuiBoldFactors,
  43905. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43906. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43907. metrics: _segoeui_factors.SegoeuiBoldMetrics
  43908. };
  43909. t["Segoeui-Italic"] = {
  43910. name: "LiberationSans-Italic",
  43911. factors: _segoeui_factors.SegoeuiItalicFactors,
  43912. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43913. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43914. metrics: _segoeui_factors.SegoeuiItalicMetrics
  43915. };
  43916. t["Segoeui-BoldItalic"] = {
  43917. name: "LiberationSans-BoldItalic",
  43918. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  43919. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43920. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43921. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  43922. };
  43923. t["Helvetica-Regular"] = t.Helvetica = {
  43924. name: "LiberationSans-Regular",
  43925. factors: _helvetica_factors.HelveticaRegularFactors,
  43926. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43927. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43928. metrics: _helvetica_factors.HelveticaRegularMetrics
  43929. };
  43930. t["Helvetica-Bold"] = {
  43931. name: "LiberationSans-Bold",
  43932. factors: _helvetica_factors.HelveticaBoldFactors,
  43933. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43934. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43935. metrics: _helvetica_factors.HelveticaBoldMetrics
  43936. };
  43937. t["Helvetica-Italic"] = {
  43938. name: "LiberationSans-Italic",
  43939. factors: _helvetica_factors.HelveticaItalicFactors,
  43940. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43941. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43942. metrics: _helvetica_factors.HelveticaItalicMetrics
  43943. };
  43944. t["Helvetica-BoldItalic"] = {
  43945. name: "LiberationSans-BoldItalic",
  43946. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  43947. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43948. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43949. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  43950. };
  43951. });
  43952. function getXfaFontName(name) {
  43953. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  43954. const fontMap = getXFAFontMap();
  43955. return fontMap[fontName];
  43956. }
  43957. function getXfaFontWidths(name) {
  43958. const info = getXfaFontName(name);
  43959. if (!info) {
  43960. return null;
  43961. }
  43962. const {
  43963. baseWidths,
  43964. baseMapping,
  43965. factors
  43966. } = info;
  43967. let rescaledBaseWidths;
  43968. if (!factors) {
  43969. rescaledBaseWidths = baseWidths;
  43970. } else {
  43971. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  43972. }
  43973. let currentCode = -2;
  43974. let currentArray;
  43975. const newWidths = [];
  43976. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  43977. if (unicode === -1) {
  43978. continue;
  43979. }
  43980. if (unicode === currentCode + 1) {
  43981. currentArray.push(rescaledBaseWidths[glyphIndex]);
  43982. currentCode += 1;
  43983. } else {
  43984. currentCode = unicode;
  43985. currentArray = [rescaledBaseWidths[glyphIndex]];
  43986. newWidths.push(unicode, currentArray);
  43987. }
  43988. }
  43989. return newWidths;
  43990. }
  43991. function getXfaFontDict(name) {
  43992. const widths = getXfaFontWidths(name);
  43993. const dict = new _primitives.Dict(null);
  43994. dict.set("BaseFont", _primitives.Name.get(name));
  43995. dict.set("Type", _primitives.Name.get("Font"));
  43996. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  43997. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  43998. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  43999. dict.set("W", widths);
  44000. dict.set("FirstChar", widths[0]);
  44001. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  44002. const descriptor = new _primitives.Dict(null);
  44003. dict.set("FontDescriptor", descriptor);
  44004. const systemInfo = new _primitives.Dict(null);
  44005. systemInfo.set("Ordering", "Identity");
  44006. systemInfo.set("Registry", "Adobe");
  44007. systemInfo.set("Supplement", 0);
  44008. dict.set("CIDSystemInfo", systemInfo);
  44009. return dict;
  44010. }
  44011. /***/ }),
  44012. /* 50 */
  44013. /***/ ((__unused_webpack_module, exports) => {
  44014. Object.defineProperty(exports, "__esModule", ({
  44015. value: true
  44016. }));
  44017. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  44018. 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];
  44019. exports.CalibriBoldFactors = CalibriBoldFactors;
  44020. const CalibriBoldMetrics = {
  44021. lineHeight: 1.2207,
  44022. lineGap: 0.2207
  44023. };
  44024. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  44025. 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];
  44026. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  44027. const CalibriBoldItalicMetrics = {
  44028. lineHeight: 1.2207,
  44029. lineGap: 0.2207
  44030. };
  44031. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  44032. 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];
  44033. exports.CalibriItalicFactors = CalibriItalicFactors;
  44034. const CalibriItalicMetrics = {
  44035. lineHeight: 1.2207,
  44036. lineGap: 0.2207
  44037. };
  44038. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  44039. 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];
  44040. exports.CalibriRegularFactors = CalibriRegularFactors;
  44041. const CalibriRegularMetrics = {
  44042. lineHeight: 1.2207,
  44043. lineGap: 0.2207
  44044. };
  44045. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  44046. /***/ }),
  44047. /* 51 */
  44048. /***/ ((__unused_webpack_module, exports) => {
  44049. Object.defineProperty(exports, "__esModule", ({
  44050. value: true
  44051. }));
  44052. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  44053. 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];
  44054. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  44055. const HelveticaBoldMetrics = {
  44056. lineHeight: 1.2,
  44057. lineGap: 0.2
  44058. };
  44059. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  44060. 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];
  44061. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  44062. const HelveticaBoldItalicMetrics = {
  44063. lineHeight: 1.35,
  44064. lineGap: 0.2
  44065. };
  44066. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  44067. 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];
  44068. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  44069. const HelveticaItalicMetrics = {
  44070. lineHeight: 1.35,
  44071. lineGap: 0.2
  44072. };
  44073. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  44074. 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];
  44075. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  44076. const HelveticaRegularMetrics = {
  44077. lineHeight: 1.2,
  44078. lineGap: 0.2
  44079. };
  44080. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  44081. /***/ }),
  44082. /* 52 */
  44083. /***/ ((__unused_webpack_module, exports) => {
  44084. Object.defineProperty(exports, "__esModule", ({
  44085. value: true
  44086. }));
  44087. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  44088. 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];
  44089. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  44090. 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];
  44091. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  44092. 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];
  44093. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  44094. 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];
  44095. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  44096. 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];
  44097. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  44098. 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];
  44099. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  44100. 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];
  44101. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  44102. 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];
  44103. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  44104. /***/ }),
  44105. /* 53 */
  44106. /***/ ((__unused_webpack_module, exports) => {
  44107. Object.defineProperty(exports, "__esModule", ({
  44108. value: true
  44109. }));
  44110. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  44111. 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];
  44112. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  44113. const MyriadProBoldMetrics = {
  44114. lineHeight: 1.2,
  44115. lineGap: 0.2
  44116. };
  44117. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  44118. 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];
  44119. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  44120. const MyriadProBoldItalicMetrics = {
  44121. lineHeight: 1.2,
  44122. lineGap: 0.2
  44123. };
  44124. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  44125. 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];
  44126. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  44127. const MyriadProItalicMetrics = {
  44128. lineHeight: 1.2,
  44129. lineGap: 0.2
  44130. };
  44131. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  44132. 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];
  44133. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  44134. const MyriadProRegularMetrics = {
  44135. lineHeight: 1.2,
  44136. lineGap: 0.2
  44137. };
  44138. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  44139. /***/ }),
  44140. /* 54 */
  44141. /***/ ((__unused_webpack_module, exports) => {
  44142. Object.defineProperty(exports, "__esModule", ({
  44143. value: true
  44144. }));
  44145. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  44146. 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];
  44147. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  44148. const SegoeuiBoldMetrics = {
  44149. lineHeight: 1.33008,
  44150. lineGap: 0
  44151. };
  44152. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  44153. 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];
  44154. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  44155. const SegoeuiBoldItalicMetrics = {
  44156. lineHeight: 1.33008,
  44157. lineGap: 0
  44158. };
  44159. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  44160. 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];
  44161. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  44162. const SegoeuiItalicMetrics = {
  44163. lineHeight: 1.33008,
  44164. lineGap: 0
  44165. };
  44166. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  44167. 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];
  44168. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  44169. const SegoeuiRegularMetrics = {
  44170. lineHeight: 1.33008,
  44171. lineGap: 0
  44172. };
  44173. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  44174. /***/ }),
  44175. /* 55 */
  44176. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44177. Object.defineProperty(exports, "__esModule", ({
  44178. value: true
  44179. }));
  44180. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44181. exports.isPDFFunction = isPDFFunction;
  44182. var _primitives = __w_pdfjs_require__(3);
  44183. var _util = __w_pdfjs_require__(2);
  44184. var _ps_parser = __w_pdfjs_require__(56);
  44185. var _base_stream = __w_pdfjs_require__(5);
  44186. var _image_utils = __w_pdfjs_require__(57);
  44187. class PDFFunctionFactory {
  44188. constructor({
  44189. xref,
  44190. isEvalSupported = true
  44191. }) {
  44192. this.xref = xref;
  44193. this.isEvalSupported = isEvalSupported !== false;
  44194. }
  44195. create(fn) {
  44196. const cachedFunction = this.getCached(fn);
  44197. if (cachedFunction) {
  44198. return cachedFunction;
  44199. }
  44200. const parsedFunction = PDFFunction.parse({
  44201. xref: this.xref,
  44202. isEvalSupported: this.isEvalSupported,
  44203. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44204. });
  44205. this._cache(fn, parsedFunction);
  44206. return parsedFunction;
  44207. }
  44208. createFromArray(fnObj) {
  44209. const cachedFunction = this.getCached(fnObj);
  44210. if (cachedFunction) {
  44211. return cachedFunction;
  44212. }
  44213. const parsedFunction = PDFFunction.parseArray({
  44214. xref: this.xref,
  44215. isEvalSupported: this.isEvalSupported,
  44216. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44217. });
  44218. this._cache(fnObj, parsedFunction);
  44219. return parsedFunction;
  44220. }
  44221. getCached(cacheKey) {
  44222. let fnRef;
  44223. if (cacheKey instanceof _primitives.Ref) {
  44224. fnRef = cacheKey;
  44225. } else if (cacheKey instanceof _primitives.Dict) {
  44226. fnRef = cacheKey.objId;
  44227. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44228. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44229. }
  44230. if (fnRef) {
  44231. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44232. if (localFunction) {
  44233. return localFunction;
  44234. }
  44235. }
  44236. return null;
  44237. }
  44238. _cache(cacheKey, parsedFunction) {
  44239. if (!parsedFunction) {
  44240. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44241. }
  44242. let fnRef;
  44243. if (cacheKey instanceof _primitives.Ref) {
  44244. fnRef = cacheKey;
  44245. } else if (cacheKey instanceof _primitives.Dict) {
  44246. fnRef = cacheKey.objId;
  44247. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44248. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44249. }
  44250. if (fnRef) {
  44251. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44252. }
  44253. }
  44254. get _localFunctionCache() {
  44255. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44256. }
  44257. }
  44258. exports.PDFFunctionFactory = PDFFunctionFactory;
  44259. function toNumberArray(arr) {
  44260. if (!Array.isArray(arr)) {
  44261. return null;
  44262. }
  44263. const length = arr.length;
  44264. for (let i = 0; i < length; i++) {
  44265. if (typeof arr[i] !== "number") {
  44266. const result = new Array(length);
  44267. for (let j = 0; j < length; j++) {
  44268. result[j] = +arr[j];
  44269. }
  44270. return result;
  44271. }
  44272. }
  44273. return arr;
  44274. }
  44275. class PDFFunction {
  44276. static getSampleArray(size, outputSize, bps, stream) {
  44277. let i, ii;
  44278. let length = 1;
  44279. for (i = 0, ii = size.length; i < ii; i++) {
  44280. length *= size[i];
  44281. }
  44282. length *= outputSize;
  44283. const array = new Array(length);
  44284. let codeSize = 0;
  44285. let codeBuf = 0;
  44286. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44287. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44288. let strIdx = 0;
  44289. for (i = 0; i < length; i++) {
  44290. while (codeSize < bps) {
  44291. codeBuf <<= 8;
  44292. codeBuf |= strBytes[strIdx++];
  44293. codeSize += 8;
  44294. }
  44295. codeSize -= bps;
  44296. array[i] = (codeBuf >> codeSize) * sampleMul;
  44297. codeBuf &= (1 << codeSize) - 1;
  44298. }
  44299. return array;
  44300. }
  44301. static parse({
  44302. xref,
  44303. isEvalSupported,
  44304. fn
  44305. }) {
  44306. const dict = fn.dict || fn;
  44307. const typeNum = dict.get("FunctionType");
  44308. switch (typeNum) {
  44309. case 0:
  44310. return this.constructSampled({
  44311. xref,
  44312. isEvalSupported,
  44313. fn,
  44314. dict
  44315. });
  44316. case 1:
  44317. break;
  44318. case 2:
  44319. return this.constructInterpolated({
  44320. xref,
  44321. isEvalSupported,
  44322. dict
  44323. });
  44324. case 3:
  44325. return this.constructStiched({
  44326. xref,
  44327. isEvalSupported,
  44328. dict
  44329. });
  44330. case 4:
  44331. return this.constructPostScript({
  44332. xref,
  44333. isEvalSupported,
  44334. fn,
  44335. dict
  44336. });
  44337. }
  44338. throw new _util.FormatError("Unknown type of function");
  44339. }
  44340. static parseArray({
  44341. xref,
  44342. isEvalSupported,
  44343. fnObj
  44344. }) {
  44345. if (!Array.isArray(fnObj)) {
  44346. return this.parse({
  44347. xref,
  44348. isEvalSupported,
  44349. fn: fnObj
  44350. });
  44351. }
  44352. const fnArray = [];
  44353. for (const fn of fnObj) {
  44354. fnArray.push(this.parse({
  44355. xref,
  44356. isEvalSupported,
  44357. fn: xref.fetchIfRef(fn)
  44358. }));
  44359. }
  44360. return function (src, srcOffset, dest, destOffset) {
  44361. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44362. fnArray[i](src, srcOffset, dest, destOffset + i);
  44363. }
  44364. };
  44365. }
  44366. static constructSampled({
  44367. xref,
  44368. isEvalSupported,
  44369. fn,
  44370. dict
  44371. }) {
  44372. function toMultiArray(arr) {
  44373. const inputLength = arr.length;
  44374. const out = [];
  44375. let index = 0;
  44376. for (let i = 0; i < inputLength; i += 2) {
  44377. out[index++] = [arr[i], arr[i + 1]];
  44378. }
  44379. return out;
  44380. }
  44381. function interpolate(x, xmin, xmax, ymin, ymax) {
  44382. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44383. }
  44384. let domain = toNumberArray(dict.getArray("Domain"));
  44385. let range = toNumberArray(dict.getArray("Range"));
  44386. if (!domain || !range) {
  44387. throw new _util.FormatError("No domain or range");
  44388. }
  44389. const inputSize = domain.length / 2;
  44390. const outputSize = range.length / 2;
  44391. domain = toMultiArray(domain);
  44392. range = toMultiArray(range);
  44393. const size = toNumberArray(dict.getArray("Size"));
  44394. const bps = dict.get("BitsPerSample");
  44395. const order = dict.get("Order") || 1;
  44396. if (order !== 1) {
  44397. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44398. }
  44399. let encode = toNumberArray(dict.getArray("Encode"));
  44400. if (!encode) {
  44401. encode = [];
  44402. for (let i = 0; i < inputSize; ++i) {
  44403. encode.push([0, size[i] - 1]);
  44404. }
  44405. } else {
  44406. encode = toMultiArray(encode);
  44407. }
  44408. let decode = toNumberArray(dict.getArray("Decode"));
  44409. if (!decode) {
  44410. decode = range;
  44411. } else {
  44412. decode = toMultiArray(decode);
  44413. }
  44414. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44415. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44416. const cubeVertices = 1 << inputSize;
  44417. const cubeN = new Float64Array(cubeVertices);
  44418. const cubeVertex = new Uint32Array(cubeVertices);
  44419. let i, j;
  44420. for (j = 0; j < cubeVertices; j++) {
  44421. cubeN[j] = 1;
  44422. }
  44423. let k = outputSize,
  44424. pos = 1;
  44425. for (i = 0; i < inputSize; ++i) {
  44426. const domain_2i = domain[i][0];
  44427. const domain_2i_1 = domain[i][1];
  44428. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44429. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44430. const size_i = size[i];
  44431. e = Math.min(Math.max(e, 0), size_i - 1);
  44432. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44433. const n0 = e0 + 1 - e;
  44434. const n1 = e - e0;
  44435. const offset0 = e0 * k;
  44436. const offset1 = offset0 + k;
  44437. for (j = 0; j < cubeVertices; j++) {
  44438. if (j & pos) {
  44439. cubeN[j] *= n1;
  44440. cubeVertex[j] += offset1;
  44441. } else {
  44442. cubeN[j] *= n0;
  44443. cubeVertex[j] += offset0;
  44444. }
  44445. }
  44446. k *= size_i;
  44447. pos <<= 1;
  44448. }
  44449. for (j = 0; j < outputSize; ++j) {
  44450. let rj = 0;
  44451. for (i = 0; i < cubeVertices; i++) {
  44452. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44453. }
  44454. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44455. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44456. }
  44457. };
  44458. }
  44459. static constructInterpolated({
  44460. xref,
  44461. isEvalSupported,
  44462. dict
  44463. }) {
  44464. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44465. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44466. const n = dict.get("N");
  44467. const diff = [];
  44468. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44469. diff.push(c1[i] - c0[i]);
  44470. }
  44471. const length = diff.length;
  44472. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44473. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44474. for (let j = 0; j < length; ++j) {
  44475. dest[destOffset + j] = c0[j] + x * diff[j];
  44476. }
  44477. };
  44478. }
  44479. static constructStiched({
  44480. xref,
  44481. isEvalSupported,
  44482. dict
  44483. }) {
  44484. const domain = toNumberArray(dict.getArray("Domain"));
  44485. if (!domain) {
  44486. throw new _util.FormatError("No domain");
  44487. }
  44488. const inputSize = domain.length / 2;
  44489. if (inputSize !== 1) {
  44490. throw new _util.FormatError("Bad domain for stiched function");
  44491. }
  44492. const fns = [];
  44493. for (const fn of dict.get("Functions")) {
  44494. fns.push(this.parse({
  44495. xref,
  44496. isEvalSupported,
  44497. fn: xref.fetchIfRef(fn)
  44498. }));
  44499. }
  44500. const bounds = toNumberArray(dict.getArray("Bounds"));
  44501. const encode = toNumberArray(dict.getArray("Encode"));
  44502. const tmpBuf = new Float32Array(1);
  44503. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44504. const clip = function constructStichedFromIRClip(v, min, max) {
  44505. if (v > max) {
  44506. v = max;
  44507. } else if (v < min) {
  44508. v = min;
  44509. }
  44510. return v;
  44511. };
  44512. const v = clip(src[srcOffset], domain[0], domain[1]);
  44513. const length = bounds.length;
  44514. let i;
  44515. for (i = 0; i < length; ++i) {
  44516. if (v < bounds[i]) {
  44517. break;
  44518. }
  44519. }
  44520. let dmin = domain[0];
  44521. if (i > 0) {
  44522. dmin = bounds[i - 1];
  44523. }
  44524. let dmax = domain[1];
  44525. if (i < bounds.length) {
  44526. dmax = bounds[i];
  44527. }
  44528. const rmin = encode[2 * i];
  44529. const rmax = encode[2 * i + 1];
  44530. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44531. fns[i](tmpBuf, 0, dest, destOffset);
  44532. };
  44533. }
  44534. static constructPostScript({
  44535. xref,
  44536. isEvalSupported,
  44537. fn,
  44538. dict
  44539. }) {
  44540. const domain = toNumberArray(dict.getArray("Domain"));
  44541. const range = toNumberArray(dict.getArray("Range"));
  44542. if (!domain) {
  44543. throw new _util.FormatError("No domain.");
  44544. }
  44545. if (!range) {
  44546. throw new _util.FormatError("No range.");
  44547. }
  44548. const lexer = new _ps_parser.PostScriptLexer(fn);
  44549. const parser = new _ps_parser.PostScriptParser(lexer);
  44550. const code = parser.parse();
  44551. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44552. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44553. if (compiled) {
  44554. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44555. }
  44556. }
  44557. (0, _util.info)("Unable to compile PS function");
  44558. const numOutputs = range.length >> 1;
  44559. const numInputs = domain.length >> 1;
  44560. const evaluator = new PostScriptEvaluator(code);
  44561. const cache = Object.create(null);
  44562. const MAX_CACHE_SIZE = 2048 * 4;
  44563. let cache_available = MAX_CACHE_SIZE;
  44564. const tmpBuf = new Float32Array(numInputs);
  44565. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44566. let i, value;
  44567. let key = "";
  44568. const input = tmpBuf;
  44569. for (i = 0; i < numInputs; i++) {
  44570. value = src[srcOffset + i];
  44571. input[i] = value;
  44572. key += value + "_";
  44573. }
  44574. const cachedValue = cache[key];
  44575. if (cachedValue !== undefined) {
  44576. dest.set(cachedValue, destOffset);
  44577. return;
  44578. }
  44579. const output = new Float32Array(numOutputs);
  44580. const stack = evaluator.execute(input);
  44581. const stackIndex = stack.length - numOutputs;
  44582. for (i = 0; i < numOutputs; i++) {
  44583. value = stack[stackIndex + i];
  44584. let bound = range[i * 2];
  44585. if (value < bound) {
  44586. value = bound;
  44587. } else {
  44588. bound = range[i * 2 + 1];
  44589. if (value > bound) {
  44590. value = bound;
  44591. }
  44592. }
  44593. output[i] = value;
  44594. }
  44595. if (cache_available > 0) {
  44596. cache_available--;
  44597. cache[key] = output;
  44598. }
  44599. dest.set(output, destOffset);
  44600. };
  44601. }
  44602. }
  44603. function isPDFFunction(v) {
  44604. let fnDict;
  44605. if (typeof v !== "object") {
  44606. return false;
  44607. } else if (v instanceof _primitives.Dict) {
  44608. fnDict = v;
  44609. } else if (v instanceof _base_stream.BaseStream) {
  44610. fnDict = v.dict;
  44611. } else {
  44612. return false;
  44613. }
  44614. return fnDict.has("FunctionType");
  44615. }
  44616. class PostScriptStack {
  44617. static get MAX_STACK_SIZE() {
  44618. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  44619. }
  44620. constructor(initialStack) {
  44621. this.stack = initialStack ? Array.from(initialStack) : [];
  44622. }
  44623. push(value) {
  44624. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  44625. throw new Error("PostScript function stack overflow.");
  44626. }
  44627. this.stack.push(value);
  44628. }
  44629. pop() {
  44630. if (this.stack.length <= 0) {
  44631. throw new Error("PostScript function stack underflow.");
  44632. }
  44633. return this.stack.pop();
  44634. }
  44635. copy(n) {
  44636. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  44637. throw new Error("PostScript function stack overflow.");
  44638. }
  44639. const stack = this.stack;
  44640. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  44641. stack.push(stack[i]);
  44642. }
  44643. }
  44644. index(n) {
  44645. this.push(this.stack[this.stack.length - n - 1]);
  44646. }
  44647. roll(n, p) {
  44648. const stack = this.stack;
  44649. const l = stack.length - n;
  44650. const r = stack.length - 1;
  44651. const c = l + (p - Math.floor(p / n) * n);
  44652. for (let i = l, j = r; i < j; i++, j--) {
  44653. const t = stack[i];
  44654. stack[i] = stack[j];
  44655. stack[j] = t;
  44656. }
  44657. for (let i = l, j = c - 1; i < j; i++, j--) {
  44658. const t = stack[i];
  44659. stack[i] = stack[j];
  44660. stack[j] = t;
  44661. }
  44662. for (let i = c, j = r; i < j; i++, j--) {
  44663. const t = stack[i];
  44664. stack[i] = stack[j];
  44665. stack[j] = t;
  44666. }
  44667. }
  44668. }
  44669. class PostScriptEvaluator {
  44670. constructor(operators) {
  44671. this.operators = operators;
  44672. }
  44673. execute(initialStack) {
  44674. const stack = new PostScriptStack(initialStack);
  44675. let counter = 0;
  44676. const operators = this.operators;
  44677. const length = operators.length;
  44678. let operator, a, b;
  44679. while (counter < length) {
  44680. operator = operators[counter++];
  44681. if (typeof operator === "number") {
  44682. stack.push(operator);
  44683. continue;
  44684. }
  44685. switch (operator) {
  44686. case "jz":
  44687. b = stack.pop();
  44688. a = stack.pop();
  44689. if (!a) {
  44690. counter = b;
  44691. }
  44692. break;
  44693. case "j":
  44694. a = stack.pop();
  44695. counter = a;
  44696. break;
  44697. case "abs":
  44698. a = stack.pop();
  44699. stack.push(Math.abs(a));
  44700. break;
  44701. case "add":
  44702. b = stack.pop();
  44703. a = stack.pop();
  44704. stack.push(a + b);
  44705. break;
  44706. case "and":
  44707. b = stack.pop();
  44708. a = stack.pop();
  44709. if (typeof a === "boolean" && typeof b === "boolean") {
  44710. stack.push(a && b);
  44711. } else {
  44712. stack.push(a & b);
  44713. }
  44714. break;
  44715. case "atan":
  44716. a = stack.pop();
  44717. stack.push(Math.atan(a));
  44718. break;
  44719. case "bitshift":
  44720. b = stack.pop();
  44721. a = stack.pop();
  44722. if (a > 0) {
  44723. stack.push(a << b);
  44724. } else {
  44725. stack.push(a >> b);
  44726. }
  44727. break;
  44728. case "ceiling":
  44729. a = stack.pop();
  44730. stack.push(Math.ceil(a));
  44731. break;
  44732. case "copy":
  44733. a = stack.pop();
  44734. stack.copy(a);
  44735. break;
  44736. case "cos":
  44737. a = stack.pop();
  44738. stack.push(Math.cos(a));
  44739. break;
  44740. case "cvi":
  44741. a = stack.pop() | 0;
  44742. stack.push(a);
  44743. break;
  44744. case "cvr":
  44745. break;
  44746. case "div":
  44747. b = stack.pop();
  44748. a = stack.pop();
  44749. stack.push(a / b);
  44750. break;
  44751. case "dup":
  44752. stack.copy(1);
  44753. break;
  44754. case "eq":
  44755. b = stack.pop();
  44756. a = stack.pop();
  44757. stack.push(a === b);
  44758. break;
  44759. case "exch":
  44760. stack.roll(2, 1);
  44761. break;
  44762. case "exp":
  44763. b = stack.pop();
  44764. a = stack.pop();
  44765. stack.push(a ** b);
  44766. break;
  44767. case "false":
  44768. stack.push(false);
  44769. break;
  44770. case "floor":
  44771. a = stack.pop();
  44772. stack.push(Math.floor(a));
  44773. break;
  44774. case "ge":
  44775. b = stack.pop();
  44776. a = stack.pop();
  44777. stack.push(a >= b);
  44778. break;
  44779. case "gt":
  44780. b = stack.pop();
  44781. a = stack.pop();
  44782. stack.push(a > b);
  44783. break;
  44784. case "idiv":
  44785. b = stack.pop();
  44786. a = stack.pop();
  44787. stack.push(a / b | 0);
  44788. break;
  44789. case "index":
  44790. a = stack.pop();
  44791. stack.index(a);
  44792. break;
  44793. case "le":
  44794. b = stack.pop();
  44795. a = stack.pop();
  44796. stack.push(a <= b);
  44797. break;
  44798. case "ln":
  44799. a = stack.pop();
  44800. stack.push(Math.log(a));
  44801. break;
  44802. case "log":
  44803. a = stack.pop();
  44804. stack.push(Math.log(a) / Math.LN10);
  44805. break;
  44806. case "lt":
  44807. b = stack.pop();
  44808. a = stack.pop();
  44809. stack.push(a < b);
  44810. break;
  44811. case "mod":
  44812. b = stack.pop();
  44813. a = stack.pop();
  44814. stack.push(a % b);
  44815. break;
  44816. case "mul":
  44817. b = stack.pop();
  44818. a = stack.pop();
  44819. stack.push(a * b);
  44820. break;
  44821. case "ne":
  44822. b = stack.pop();
  44823. a = stack.pop();
  44824. stack.push(a !== b);
  44825. break;
  44826. case "neg":
  44827. a = stack.pop();
  44828. stack.push(-a);
  44829. break;
  44830. case "not":
  44831. a = stack.pop();
  44832. if (typeof a === "boolean") {
  44833. stack.push(!a);
  44834. } else {
  44835. stack.push(~a);
  44836. }
  44837. break;
  44838. case "or":
  44839. b = stack.pop();
  44840. a = stack.pop();
  44841. if (typeof a === "boolean" && typeof b === "boolean") {
  44842. stack.push(a || b);
  44843. } else {
  44844. stack.push(a | b);
  44845. }
  44846. break;
  44847. case "pop":
  44848. stack.pop();
  44849. break;
  44850. case "roll":
  44851. b = stack.pop();
  44852. a = stack.pop();
  44853. stack.roll(a, b);
  44854. break;
  44855. case "round":
  44856. a = stack.pop();
  44857. stack.push(Math.round(a));
  44858. break;
  44859. case "sin":
  44860. a = stack.pop();
  44861. stack.push(Math.sin(a));
  44862. break;
  44863. case "sqrt":
  44864. a = stack.pop();
  44865. stack.push(Math.sqrt(a));
  44866. break;
  44867. case "sub":
  44868. b = stack.pop();
  44869. a = stack.pop();
  44870. stack.push(a - b);
  44871. break;
  44872. case "true":
  44873. stack.push(true);
  44874. break;
  44875. case "truncate":
  44876. a = stack.pop();
  44877. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  44878. stack.push(a);
  44879. break;
  44880. case "xor":
  44881. b = stack.pop();
  44882. a = stack.pop();
  44883. if (typeof a === "boolean" && typeof b === "boolean") {
  44884. stack.push(a !== b);
  44885. } else {
  44886. stack.push(a ^ b);
  44887. }
  44888. break;
  44889. default:
  44890. throw new _util.FormatError(`Unknown operator ${operator}`);
  44891. }
  44892. }
  44893. return stack.stack;
  44894. }
  44895. }
  44896. exports.PostScriptEvaluator = PostScriptEvaluator;
  44897. class AstNode {
  44898. constructor(type) {
  44899. this.type = type;
  44900. }
  44901. visit(visitor) {
  44902. (0, _util.unreachable)("abstract method");
  44903. }
  44904. }
  44905. class AstArgument extends AstNode {
  44906. constructor(index, min, max) {
  44907. super("args");
  44908. this.index = index;
  44909. this.min = min;
  44910. this.max = max;
  44911. }
  44912. visit(visitor) {
  44913. visitor.visitArgument(this);
  44914. }
  44915. }
  44916. class AstLiteral extends AstNode {
  44917. constructor(number) {
  44918. super("literal");
  44919. this.number = number;
  44920. this.min = number;
  44921. this.max = number;
  44922. }
  44923. visit(visitor) {
  44924. visitor.visitLiteral(this);
  44925. }
  44926. }
  44927. class AstBinaryOperation extends AstNode {
  44928. constructor(op, arg1, arg2, min, max) {
  44929. super("binary");
  44930. this.op = op;
  44931. this.arg1 = arg1;
  44932. this.arg2 = arg2;
  44933. this.min = min;
  44934. this.max = max;
  44935. }
  44936. visit(visitor) {
  44937. visitor.visitBinaryOperation(this);
  44938. }
  44939. }
  44940. class AstMin extends AstNode {
  44941. constructor(arg, max) {
  44942. super("max");
  44943. this.arg = arg;
  44944. this.min = arg.min;
  44945. this.max = max;
  44946. }
  44947. visit(visitor) {
  44948. visitor.visitMin(this);
  44949. }
  44950. }
  44951. class AstVariable extends AstNode {
  44952. constructor(index, min, max) {
  44953. super("var");
  44954. this.index = index;
  44955. this.min = min;
  44956. this.max = max;
  44957. }
  44958. visit(visitor) {
  44959. visitor.visitVariable(this);
  44960. }
  44961. }
  44962. class AstVariableDefinition extends AstNode {
  44963. constructor(variable, arg) {
  44964. super("definition");
  44965. this.variable = variable;
  44966. this.arg = arg;
  44967. }
  44968. visit(visitor) {
  44969. visitor.visitVariableDefinition(this);
  44970. }
  44971. }
  44972. class ExpressionBuilderVisitor {
  44973. constructor() {
  44974. this.parts = [];
  44975. }
  44976. visitArgument(arg) {
  44977. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  44978. }
  44979. visitVariable(variable) {
  44980. this.parts.push("v", variable.index);
  44981. }
  44982. visitLiteral(literal) {
  44983. this.parts.push(literal.number);
  44984. }
  44985. visitBinaryOperation(operation) {
  44986. this.parts.push("(");
  44987. operation.arg1.visit(this);
  44988. this.parts.push(" ", operation.op, " ");
  44989. operation.arg2.visit(this);
  44990. this.parts.push(")");
  44991. }
  44992. visitVariableDefinition(definition) {
  44993. this.parts.push("var ");
  44994. definition.variable.visit(this);
  44995. this.parts.push(" = ");
  44996. definition.arg.visit(this);
  44997. this.parts.push(";");
  44998. }
  44999. visitMin(max) {
  45000. this.parts.push("Math.min(");
  45001. max.arg.visit(this);
  45002. this.parts.push(", ", max.max, ")");
  45003. }
  45004. toString() {
  45005. return this.parts.join("");
  45006. }
  45007. }
  45008. function buildAddOperation(num1, num2) {
  45009. if (num2.type === "literal" && num2.number === 0) {
  45010. return num1;
  45011. }
  45012. if (num1.type === "literal" && num1.number === 0) {
  45013. return num2;
  45014. }
  45015. if (num2.type === "literal" && num1.type === "literal") {
  45016. return new AstLiteral(num1.number + num2.number);
  45017. }
  45018. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  45019. }
  45020. function buildMulOperation(num1, num2) {
  45021. if (num2.type === "literal") {
  45022. if (num2.number === 0) {
  45023. return new AstLiteral(0);
  45024. } else if (num2.number === 1) {
  45025. return num1;
  45026. } else if (num1.type === "literal") {
  45027. return new AstLiteral(num1.number * num2.number);
  45028. }
  45029. }
  45030. if (num1.type === "literal") {
  45031. if (num1.number === 0) {
  45032. return new AstLiteral(0);
  45033. } else if (num1.number === 1) {
  45034. return num2;
  45035. }
  45036. }
  45037. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45038. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45039. return new AstBinaryOperation("*", num1, num2, min, max);
  45040. }
  45041. function buildSubOperation(num1, num2) {
  45042. if (num2.type === "literal") {
  45043. if (num2.number === 0) {
  45044. return num1;
  45045. } else if (num1.type === "literal") {
  45046. return new AstLiteral(num1.number - num2.number);
  45047. }
  45048. }
  45049. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  45050. return num2.arg2;
  45051. }
  45052. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  45053. }
  45054. function buildMinOperation(num1, max) {
  45055. if (num1.min >= max) {
  45056. return new AstLiteral(max);
  45057. } else if (num1.max <= max) {
  45058. return num1;
  45059. }
  45060. return new AstMin(num1, max);
  45061. }
  45062. class PostScriptCompiler {
  45063. compile(code, domain, range) {
  45064. const stack = [];
  45065. const instructions = [];
  45066. const inputSize = domain.length >> 1,
  45067. outputSize = range.length >> 1;
  45068. let lastRegister = 0;
  45069. let n, j;
  45070. let num1, num2, ast1, ast2, tmpVar, item;
  45071. for (let i = 0; i < inputSize; i++) {
  45072. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  45073. }
  45074. for (let i = 0, ii = code.length; i < ii; i++) {
  45075. item = code[i];
  45076. if (typeof item === "number") {
  45077. stack.push(new AstLiteral(item));
  45078. continue;
  45079. }
  45080. switch (item) {
  45081. case "add":
  45082. if (stack.length < 2) {
  45083. return null;
  45084. }
  45085. num2 = stack.pop();
  45086. num1 = stack.pop();
  45087. stack.push(buildAddOperation(num1, num2));
  45088. break;
  45089. case "cvr":
  45090. if (stack.length < 1) {
  45091. return null;
  45092. }
  45093. break;
  45094. case "mul":
  45095. if (stack.length < 2) {
  45096. return null;
  45097. }
  45098. num2 = stack.pop();
  45099. num1 = stack.pop();
  45100. stack.push(buildMulOperation(num1, num2));
  45101. break;
  45102. case "sub":
  45103. if (stack.length < 2) {
  45104. return null;
  45105. }
  45106. num2 = stack.pop();
  45107. num1 = stack.pop();
  45108. stack.push(buildSubOperation(num1, num2));
  45109. break;
  45110. case "exch":
  45111. if (stack.length < 2) {
  45112. return null;
  45113. }
  45114. ast1 = stack.pop();
  45115. ast2 = stack.pop();
  45116. stack.push(ast1, ast2);
  45117. break;
  45118. case "pop":
  45119. if (stack.length < 1) {
  45120. return null;
  45121. }
  45122. stack.pop();
  45123. break;
  45124. case "index":
  45125. if (stack.length < 1) {
  45126. return null;
  45127. }
  45128. num1 = stack.pop();
  45129. if (num1.type !== "literal") {
  45130. return null;
  45131. }
  45132. n = num1.number;
  45133. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45134. return null;
  45135. }
  45136. ast1 = stack[stack.length - n - 1];
  45137. if (ast1.type === "literal" || ast1.type === "var") {
  45138. stack.push(ast1);
  45139. break;
  45140. }
  45141. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45142. stack[stack.length - n - 1] = tmpVar;
  45143. stack.push(tmpVar);
  45144. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45145. break;
  45146. case "dup":
  45147. if (stack.length < 1) {
  45148. return null;
  45149. }
  45150. 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]) {
  45151. num1 = stack.pop();
  45152. stack.push(buildMinOperation(num1, code[i + 1]));
  45153. i += 6;
  45154. break;
  45155. }
  45156. ast1 = stack.at(-1);
  45157. if (ast1.type === "literal" || ast1.type === "var") {
  45158. stack.push(ast1);
  45159. break;
  45160. }
  45161. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45162. stack[stack.length - 1] = tmpVar;
  45163. stack.push(tmpVar);
  45164. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45165. break;
  45166. case "roll":
  45167. if (stack.length < 2) {
  45168. return null;
  45169. }
  45170. num2 = stack.pop();
  45171. num1 = stack.pop();
  45172. if (num2.type !== "literal" || num1.type !== "literal") {
  45173. return null;
  45174. }
  45175. j = num2.number;
  45176. n = num1.number;
  45177. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45178. return null;
  45179. }
  45180. j = (j % n + n) % n;
  45181. if (j === 0) {
  45182. break;
  45183. }
  45184. stack.push(...stack.splice(stack.length - n, n - j));
  45185. break;
  45186. default:
  45187. return null;
  45188. }
  45189. }
  45190. if (stack.length !== outputSize) {
  45191. return null;
  45192. }
  45193. const result = [];
  45194. for (const instruction of instructions) {
  45195. const statementBuilder = new ExpressionBuilderVisitor();
  45196. instruction.visit(statementBuilder);
  45197. result.push(statementBuilder.toString());
  45198. }
  45199. for (let i = 0, ii = stack.length; i < ii; i++) {
  45200. const expr = stack[i],
  45201. statementBuilder = new ExpressionBuilderVisitor();
  45202. expr.visit(statementBuilder);
  45203. const min = range[i * 2],
  45204. max = range[i * 2 + 1];
  45205. const out = [statementBuilder.toString()];
  45206. if (min > expr.min) {
  45207. out.unshift("Math.max(", min, ", ");
  45208. out.push(")");
  45209. }
  45210. if (max < expr.max) {
  45211. out.unshift("Math.min(", max, ", ");
  45212. out.push(")");
  45213. }
  45214. out.unshift("dest[destOffset + ", i, "] = ");
  45215. out.push(";");
  45216. result.push(out.join(""));
  45217. }
  45218. return result.join("\n");
  45219. }
  45220. }
  45221. exports.PostScriptCompiler = PostScriptCompiler;
  45222. /***/ }),
  45223. /* 56 */
  45224. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45225. Object.defineProperty(exports, "__esModule", ({
  45226. value: true
  45227. }));
  45228. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45229. var _util = __w_pdfjs_require__(2);
  45230. var _primitives = __w_pdfjs_require__(3);
  45231. var _core_utils = __w_pdfjs_require__(4);
  45232. class PostScriptParser {
  45233. constructor(lexer) {
  45234. this.lexer = lexer;
  45235. this.operators = [];
  45236. this.token = null;
  45237. this.prev = null;
  45238. }
  45239. nextToken() {
  45240. this.prev = this.token;
  45241. this.token = this.lexer.getToken();
  45242. }
  45243. accept(type) {
  45244. if (this.token.type === type) {
  45245. this.nextToken();
  45246. return true;
  45247. }
  45248. return false;
  45249. }
  45250. expect(type) {
  45251. if (this.accept(type)) {
  45252. return true;
  45253. }
  45254. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45255. }
  45256. parse() {
  45257. this.nextToken();
  45258. this.expect(PostScriptTokenTypes.LBRACE);
  45259. this.parseBlock();
  45260. this.expect(PostScriptTokenTypes.RBRACE);
  45261. return this.operators;
  45262. }
  45263. parseBlock() {
  45264. while (true) {
  45265. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45266. this.operators.push(this.prev.value);
  45267. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45268. this.operators.push(this.prev.value);
  45269. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45270. this.parseCondition();
  45271. } else {
  45272. return;
  45273. }
  45274. }
  45275. }
  45276. parseCondition() {
  45277. const conditionLocation = this.operators.length;
  45278. this.operators.push(null, null);
  45279. this.parseBlock();
  45280. this.expect(PostScriptTokenTypes.RBRACE);
  45281. if (this.accept(PostScriptTokenTypes.IF)) {
  45282. this.operators[conditionLocation] = this.operators.length;
  45283. this.operators[conditionLocation + 1] = "jz";
  45284. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45285. const jumpLocation = this.operators.length;
  45286. this.operators.push(null, null);
  45287. const endOfTrue = this.operators.length;
  45288. this.parseBlock();
  45289. this.expect(PostScriptTokenTypes.RBRACE);
  45290. this.expect(PostScriptTokenTypes.IFELSE);
  45291. this.operators[jumpLocation] = this.operators.length;
  45292. this.operators[jumpLocation + 1] = "j";
  45293. this.operators[conditionLocation] = endOfTrue;
  45294. this.operators[conditionLocation + 1] = "jz";
  45295. } else {
  45296. throw new _util.FormatError("PS Function: error parsing conditional.");
  45297. }
  45298. }
  45299. }
  45300. exports.PostScriptParser = PostScriptParser;
  45301. const PostScriptTokenTypes = {
  45302. LBRACE: 0,
  45303. RBRACE: 1,
  45304. NUMBER: 2,
  45305. OPERATOR: 3,
  45306. IF: 4,
  45307. IFELSE: 5
  45308. };
  45309. class PostScriptToken {
  45310. static get opCache() {
  45311. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45312. }
  45313. constructor(type, value) {
  45314. this.type = type;
  45315. this.value = value;
  45316. }
  45317. static getOperator(op) {
  45318. const opValue = PostScriptToken.opCache[op];
  45319. if (opValue) {
  45320. return opValue;
  45321. }
  45322. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45323. }
  45324. static get LBRACE() {
  45325. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45326. }
  45327. static get RBRACE() {
  45328. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45329. }
  45330. static get IF() {
  45331. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45332. }
  45333. static get IFELSE() {
  45334. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45335. }
  45336. }
  45337. class PostScriptLexer {
  45338. constructor(stream) {
  45339. this.stream = stream;
  45340. this.nextChar();
  45341. this.strBuf = [];
  45342. }
  45343. nextChar() {
  45344. return this.currentChar = this.stream.getByte();
  45345. }
  45346. getToken() {
  45347. let comment = false;
  45348. let ch = this.currentChar;
  45349. while (true) {
  45350. if (ch < 0) {
  45351. return _primitives.EOF;
  45352. }
  45353. if (comment) {
  45354. if (ch === 0x0a || ch === 0x0d) {
  45355. comment = false;
  45356. }
  45357. } else if (ch === 0x25) {
  45358. comment = true;
  45359. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45360. break;
  45361. }
  45362. ch = this.nextChar();
  45363. }
  45364. switch (ch | 0) {
  45365. case 0x30:
  45366. case 0x31:
  45367. case 0x32:
  45368. case 0x33:
  45369. case 0x34:
  45370. case 0x35:
  45371. case 0x36:
  45372. case 0x37:
  45373. case 0x38:
  45374. case 0x39:
  45375. case 0x2b:
  45376. case 0x2d:
  45377. case 0x2e:
  45378. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45379. case 0x7b:
  45380. this.nextChar();
  45381. return PostScriptToken.LBRACE;
  45382. case 0x7d:
  45383. this.nextChar();
  45384. return PostScriptToken.RBRACE;
  45385. }
  45386. const strBuf = this.strBuf;
  45387. strBuf.length = 0;
  45388. strBuf[0] = String.fromCharCode(ch);
  45389. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45390. strBuf.push(String.fromCharCode(ch));
  45391. }
  45392. const str = strBuf.join("");
  45393. switch (str.toLowerCase()) {
  45394. case "if":
  45395. return PostScriptToken.IF;
  45396. case "ifelse":
  45397. return PostScriptToken.IFELSE;
  45398. default:
  45399. return PostScriptToken.getOperator(str);
  45400. }
  45401. }
  45402. getNumber() {
  45403. let ch = this.currentChar;
  45404. const strBuf = this.strBuf;
  45405. strBuf.length = 0;
  45406. strBuf[0] = String.fromCharCode(ch);
  45407. while ((ch = this.nextChar()) >= 0) {
  45408. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45409. strBuf.push(String.fromCharCode(ch));
  45410. } else {
  45411. break;
  45412. }
  45413. }
  45414. const value = parseFloat(strBuf.join(""));
  45415. if (isNaN(value)) {
  45416. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45417. }
  45418. return value;
  45419. }
  45420. }
  45421. exports.PostScriptLexer = PostScriptLexer;
  45422. /***/ }),
  45423. /* 57 */
  45424. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45425. Object.defineProperty(exports, "__esModule", ({
  45426. value: true
  45427. }));
  45428. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45429. var _util = __w_pdfjs_require__(2);
  45430. var _primitives = __w_pdfjs_require__(3);
  45431. class BaseLocalCache {
  45432. constructor(options) {
  45433. if (this.constructor === BaseLocalCache) {
  45434. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45435. }
  45436. this._onlyRefs = (options && options.onlyRefs) === true;
  45437. if (!this._onlyRefs) {
  45438. this._nameRefMap = new Map();
  45439. this._imageMap = new Map();
  45440. }
  45441. this._imageCache = new _primitives.RefSetCache();
  45442. }
  45443. getByName(name) {
  45444. if (this._onlyRefs) {
  45445. (0, _util.unreachable)("Should not call `getByName` method.");
  45446. }
  45447. const ref = this._nameRefMap.get(name);
  45448. if (ref) {
  45449. return this.getByRef(ref);
  45450. }
  45451. return this._imageMap.get(name) || null;
  45452. }
  45453. getByRef(ref) {
  45454. return this._imageCache.get(ref) || null;
  45455. }
  45456. set(name, ref, data) {
  45457. (0, _util.unreachable)("Abstract method `set` called.");
  45458. }
  45459. }
  45460. class LocalImageCache extends BaseLocalCache {
  45461. set(name, ref = null, data) {
  45462. if (typeof name !== "string") {
  45463. throw new Error('LocalImageCache.set - expected "name" argument.');
  45464. }
  45465. if (ref) {
  45466. if (this._imageCache.has(ref)) {
  45467. return;
  45468. }
  45469. this._nameRefMap.set(name, ref);
  45470. this._imageCache.put(ref, data);
  45471. return;
  45472. }
  45473. if (this._imageMap.has(name)) {
  45474. return;
  45475. }
  45476. this._imageMap.set(name, data);
  45477. }
  45478. }
  45479. exports.LocalImageCache = LocalImageCache;
  45480. class LocalColorSpaceCache extends BaseLocalCache {
  45481. set(name = null, ref = null, data) {
  45482. if (typeof name !== "string" && !ref) {
  45483. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45484. }
  45485. if (ref) {
  45486. if (this._imageCache.has(ref)) {
  45487. return;
  45488. }
  45489. if (name !== null) {
  45490. this._nameRefMap.set(name, ref);
  45491. }
  45492. this._imageCache.put(ref, data);
  45493. return;
  45494. }
  45495. if (this._imageMap.has(name)) {
  45496. return;
  45497. }
  45498. this._imageMap.set(name, data);
  45499. }
  45500. }
  45501. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45502. class LocalFunctionCache extends BaseLocalCache {
  45503. constructor(options) {
  45504. super({
  45505. onlyRefs: true
  45506. });
  45507. }
  45508. set(name = null, ref, data) {
  45509. if (!ref) {
  45510. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45511. }
  45512. if (this._imageCache.has(ref)) {
  45513. return;
  45514. }
  45515. this._imageCache.put(ref, data);
  45516. }
  45517. }
  45518. exports.LocalFunctionCache = LocalFunctionCache;
  45519. class LocalGStateCache extends BaseLocalCache {
  45520. set(name, ref = null, data) {
  45521. if (typeof name !== "string") {
  45522. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45523. }
  45524. if (ref) {
  45525. if (this._imageCache.has(ref)) {
  45526. return;
  45527. }
  45528. this._nameRefMap.set(name, ref);
  45529. this._imageCache.put(ref, data);
  45530. return;
  45531. }
  45532. if (this._imageMap.has(name)) {
  45533. return;
  45534. }
  45535. this._imageMap.set(name, data);
  45536. }
  45537. }
  45538. exports.LocalGStateCache = LocalGStateCache;
  45539. class LocalTilingPatternCache extends BaseLocalCache {
  45540. constructor(options) {
  45541. super({
  45542. onlyRefs: true
  45543. });
  45544. }
  45545. set(name = null, ref, data) {
  45546. if (!ref) {
  45547. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45548. }
  45549. if (this._imageCache.has(ref)) {
  45550. return;
  45551. }
  45552. this._imageCache.put(ref, data);
  45553. }
  45554. }
  45555. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45556. class GlobalImageCache {
  45557. static get NUM_PAGES_THRESHOLD() {
  45558. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45559. }
  45560. static get MIN_IMAGES_TO_CACHE() {
  45561. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45562. }
  45563. static get MAX_BYTE_SIZE() {
  45564. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45565. }
  45566. constructor() {
  45567. this._refCache = new _primitives.RefSetCache();
  45568. this._imageCache = new _primitives.RefSetCache();
  45569. }
  45570. get _byteSize() {
  45571. let byteSize = 0;
  45572. for (const imageData of this._imageCache) {
  45573. byteSize += imageData.byteSize;
  45574. }
  45575. return byteSize;
  45576. }
  45577. get _cacheLimitReached() {
  45578. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45579. return false;
  45580. }
  45581. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45582. return false;
  45583. }
  45584. return true;
  45585. }
  45586. shouldCache(ref, pageIndex) {
  45587. const pageIndexSet = this._refCache.get(ref);
  45588. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45589. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45590. return false;
  45591. }
  45592. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  45593. return false;
  45594. }
  45595. return true;
  45596. }
  45597. addPageIndex(ref, pageIndex) {
  45598. let pageIndexSet = this._refCache.get(ref);
  45599. if (!pageIndexSet) {
  45600. pageIndexSet = new Set();
  45601. this._refCache.put(ref, pageIndexSet);
  45602. }
  45603. pageIndexSet.add(pageIndex);
  45604. }
  45605. addByteSize(ref, byteSize) {
  45606. const imageData = this._imageCache.get(ref);
  45607. if (!imageData) {
  45608. return;
  45609. }
  45610. if (imageData.byteSize) {
  45611. return;
  45612. }
  45613. imageData.byteSize = byteSize;
  45614. }
  45615. getData(ref, pageIndex) {
  45616. const pageIndexSet = this._refCache.get(ref);
  45617. if (!pageIndexSet) {
  45618. return null;
  45619. }
  45620. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45621. return null;
  45622. }
  45623. const imageData = this._imageCache.get(ref);
  45624. if (!imageData) {
  45625. return null;
  45626. }
  45627. pageIndexSet.add(pageIndex);
  45628. return imageData;
  45629. }
  45630. setData(ref, data) {
  45631. if (!this._refCache.has(ref)) {
  45632. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  45633. }
  45634. if (this._imageCache.has(ref)) {
  45635. return;
  45636. }
  45637. if (this._cacheLimitReached) {
  45638. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  45639. return;
  45640. }
  45641. this._imageCache.put(ref, data);
  45642. }
  45643. clear(onlyData = false) {
  45644. if (!onlyData) {
  45645. this._refCache.clear();
  45646. }
  45647. this._imageCache.clear();
  45648. }
  45649. }
  45650. exports.GlobalImageCache = GlobalImageCache;
  45651. /***/ }),
  45652. /* 58 */
  45653. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45654. Object.defineProperty(exports, "__esModule", ({
  45655. value: true
  45656. }));
  45657. exports.bidi = bidi;
  45658. var _util = __w_pdfjs_require__(2);
  45659. 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"];
  45660. 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"];
  45661. function isOdd(i) {
  45662. return (i & 1) !== 0;
  45663. }
  45664. function isEven(i) {
  45665. return (i & 1) === 0;
  45666. }
  45667. function findUnequal(arr, start, value) {
  45668. let j, jj;
  45669. for (j = start, jj = arr.length; j < jj; ++j) {
  45670. if (arr[j] !== value) {
  45671. return j;
  45672. }
  45673. }
  45674. return j;
  45675. }
  45676. function setValues(arr, start, end, value) {
  45677. for (let j = start; j < end; ++j) {
  45678. arr[j] = value;
  45679. }
  45680. }
  45681. function reverseValues(arr, start, end) {
  45682. for (let i = start, j = end - 1; i < j; ++i, --j) {
  45683. const temp = arr[i];
  45684. arr[i] = arr[j];
  45685. arr[j] = temp;
  45686. }
  45687. }
  45688. function createBidiText(str, isLTR, vertical = false) {
  45689. let dir = "ltr";
  45690. if (vertical) {
  45691. dir = "ttb";
  45692. } else if (!isLTR) {
  45693. dir = "rtl";
  45694. }
  45695. return {
  45696. str,
  45697. dir
  45698. };
  45699. }
  45700. const chars = [];
  45701. const types = [];
  45702. function bidi(str, startLevel = -1, vertical = false) {
  45703. let isLTR = true;
  45704. const strLength = str.length;
  45705. if (strLength === 0 || vertical) {
  45706. return createBidiText(str, isLTR, vertical);
  45707. }
  45708. chars.length = strLength;
  45709. types.length = strLength;
  45710. let numBidi = 0;
  45711. let i, ii;
  45712. for (i = 0; i < strLength; ++i) {
  45713. chars[i] = str.charAt(i);
  45714. const charCode = str.charCodeAt(i);
  45715. let charType = "L";
  45716. if (charCode <= 0x00ff) {
  45717. charType = baseTypes[charCode];
  45718. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  45719. charType = "R";
  45720. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  45721. charType = arabicTypes[charCode & 0xff];
  45722. if (!charType) {
  45723. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  45724. }
  45725. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  45726. charType = "AL";
  45727. }
  45728. if (charType === "R" || charType === "AL" || charType === "AN") {
  45729. numBidi++;
  45730. }
  45731. types[i] = charType;
  45732. }
  45733. if (numBidi === 0) {
  45734. isLTR = true;
  45735. return createBidiText(str, isLTR);
  45736. }
  45737. if (startLevel === -1) {
  45738. if (numBidi / strLength < 0.3 && strLength > 4) {
  45739. isLTR = true;
  45740. startLevel = 0;
  45741. } else {
  45742. isLTR = false;
  45743. startLevel = 1;
  45744. }
  45745. }
  45746. const levels = [];
  45747. for (i = 0; i < strLength; ++i) {
  45748. levels[i] = startLevel;
  45749. }
  45750. const e = isOdd(startLevel) ? "R" : "L";
  45751. const sor = e;
  45752. const eor = sor;
  45753. let lastType = sor;
  45754. for (i = 0; i < strLength; ++i) {
  45755. if (types[i] === "NSM") {
  45756. types[i] = lastType;
  45757. } else {
  45758. lastType = types[i];
  45759. }
  45760. }
  45761. lastType = sor;
  45762. let t;
  45763. for (i = 0; i < strLength; ++i) {
  45764. t = types[i];
  45765. if (t === "EN") {
  45766. types[i] = lastType === "AL" ? "AN" : "EN";
  45767. } else if (t === "R" || t === "L" || t === "AL") {
  45768. lastType = t;
  45769. }
  45770. }
  45771. for (i = 0; i < strLength; ++i) {
  45772. t = types[i];
  45773. if (t === "AL") {
  45774. types[i] = "R";
  45775. }
  45776. }
  45777. for (i = 1; i < strLength - 1; ++i) {
  45778. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  45779. types[i] = "EN";
  45780. }
  45781. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  45782. types[i] = types[i - 1];
  45783. }
  45784. }
  45785. for (i = 0; i < strLength; ++i) {
  45786. if (types[i] === "EN") {
  45787. for (let j = i - 1; j >= 0; --j) {
  45788. if (types[j] !== "ET") {
  45789. break;
  45790. }
  45791. types[j] = "EN";
  45792. }
  45793. for (let j = i + 1; j < strLength; ++j) {
  45794. if (types[j] !== "ET") {
  45795. break;
  45796. }
  45797. types[j] = "EN";
  45798. }
  45799. }
  45800. }
  45801. for (i = 0; i < strLength; ++i) {
  45802. t = types[i];
  45803. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  45804. types[i] = "ON";
  45805. }
  45806. }
  45807. lastType = sor;
  45808. for (i = 0; i < strLength; ++i) {
  45809. t = types[i];
  45810. if (t === "EN") {
  45811. types[i] = lastType === "L" ? "L" : "EN";
  45812. } else if (t === "R" || t === "L") {
  45813. lastType = t;
  45814. }
  45815. }
  45816. for (i = 0; i < strLength; ++i) {
  45817. if (types[i] === "ON") {
  45818. const end = findUnequal(types, i + 1, "ON");
  45819. let before = sor;
  45820. if (i > 0) {
  45821. before = types[i - 1];
  45822. }
  45823. let after = eor;
  45824. if (end + 1 < strLength) {
  45825. after = types[end + 1];
  45826. }
  45827. if (before !== "L") {
  45828. before = "R";
  45829. }
  45830. if (after !== "L") {
  45831. after = "R";
  45832. }
  45833. if (before === after) {
  45834. setValues(types, i, end, before);
  45835. }
  45836. i = end - 1;
  45837. }
  45838. }
  45839. for (i = 0; i < strLength; ++i) {
  45840. if (types[i] === "ON") {
  45841. types[i] = e;
  45842. }
  45843. }
  45844. for (i = 0; i < strLength; ++i) {
  45845. t = types[i];
  45846. if (isEven(levels[i])) {
  45847. if (t === "R") {
  45848. levels[i] += 1;
  45849. } else if (t === "AN" || t === "EN") {
  45850. levels[i] += 2;
  45851. }
  45852. } else {
  45853. if (t === "L" || t === "AN" || t === "EN") {
  45854. levels[i] += 1;
  45855. }
  45856. }
  45857. }
  45858. let highestLevel = -1;
  45859. let lowestOddLevel = 99;
  45860. let level;
  45861. for (i = 0, ii = levels.length; i < ii; ++i) {
  45862. level = levels[i];
  45863. if (highestLevel < level) {
  45864. highestLevel = level;
  45865. }
  45866. if (lowestOddLevel > level && isOdd(level)) {
  45867. lowestOddLevel = level;
  45868. }
  45869. }
  45870. for (level = highestLevel; level >= lowestOddLevel; --level) {
  45871. let start = -1;
  45872. for (i = 0, ii = levels.length; i < ii; ++i) {
  45873. if (levels[i] < level) {
  45874. if (start >= 0) {
  45875. reverseValues(chars, start, i);
  45876. start = -1;
  45877. }
  45878. } else if (start < 0) {
  45879. start = i;
  45880. }
  45881. }
  45882. if (start >= 0) {
  45883. reverseValues(chars, start, levels.length);
  45884. }
  45885. }
  45886. for (i = 0, ii = chars.length; i < ii; ++i) {
  45887. const ch = chars[i];
  45888. if (ch === "<" || ch === ">") {
  45889. chars[i] = "";
  45890. }
  45891. }
  45892. return createBidiText(chars.join(""), isLTR);
  45893. }
  45894. /***/ }),
  45895. /* 59 */
  45896. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45897. Object.defineProperty(exports, "__esModule", ({
  45898. value: true
  45899. }));
  45900. exports.MurmurHash3_64 = void 0;
  45901. var _util = __w_pdfjs_require__(2);
  45902. const SEED = 0xc3d2e1f0;
  45903. const MASK_HIGH = 0xffff0000;
  45904. const MASK_LOW = 0xffff;
  45905. class MurmurHash3_64 {
  45906. constructor(seed) {
  45907. this.h1 = seed ? seed & 0xffffffff : SEED;
  45908. this.h2 = seed ? seed & 0xffffffff : SEED;
  45909. }
  45910. update(input) {
  45911. let data, length;
  45912. if (typeof input === "string") {
  45913. data = new Uint8Array(input.length * 2);
  45914. length = 0;
  45915. for (let i = 0, ii = input.length; i < ii; i++) {
  45916. const code = input.charCodeAt(i);
  45917. if (code <= 0xff) {
  45918. data[length++] = code;
  45919. } else {
  45920. data[length++] = code >>> 8;
  45921. data[length++] = code & 0xff;
  45922. }
  45923. }
  45924. } else if ((0, _util.isArrayBuffer)(input)) {
  45925. data = input.slice();
  45926. length = data.byteLength;
  45927. } else {
  45928. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45929. }
  45930. const blockCounts = length >> 2;
  45931. const tailLength = length - blockCounts * 4;
  45932. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45933. let k1 = 0,
  45934. k2 = 0;
  45935. let h1 = this.h1,
  45936. h2 = this.h2;
  45937. const C1 = 0xcc9e2d51,
  45938. C2 = 0x1b873593;
  45939. const C1_LOW = C1 & MASK_LOW,
  45940. C2_LOW = C2 & MASK_LOW;
  45941. for (let i = 0; i < blockCounts; i++) {
  45942. if (i & 1) {
  45943. k1 = dataUint32[i];
  45944. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45945. k1 = k1 << 15 | k1 >>> 17;
  45946. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45947. h1 ^= k1;
  45948. h1 = h1 << 13 | h1 >>> 19;
  45949. h1 = h1 * 5 + 0xe6546b64;
  45950. } else {
  45951. k2 = dataUint32[i];
  45952. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45953. k2 = k2 << 15 | k2 >>> 17;
  45954. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45955. h2 ^= k2;
  45956. h2 = h2 << 13 | h2 >>> 19;
  45957. h2 = h2 * 5 + 0xe6546b64;
  45958. }
  45959. }
  45960. k1 = 0;
  45961. switch (tailLength) {
  45962. case 3:
  45963. k1 ^= data[blockCounts * 4 + 2] << 16;
  45964. case 2:
  45965. k1 ^= data[blockCounts * 4 + 1] << 8;
  45966. case 1:
  45967. k1 ^= data[blockCounts * 4];
  45968. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45969. k1 = k1 << 15 | k1 >>> 17;
  45970. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45971. if (blockCounts & 1) {
  45972. h1 ^= k1;
  45973. } else {
  45974. h2 ^= k1;
  45975. }
  45976. }
  45977. this.h1 = h1;
  45978. this.h2 = h2;
  45979. }
  45980. hexdigest() {
  45981. let h1 = this.h1,
  45982. h2 = this.h2;
  45983. h1 ^= h2 >>> 1;
  45984. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45985. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45986. h1 ^= h2 >>> 1;
  45987. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45988. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45989. h1 ^= h2 >>> 1;
  45990. const hex1 = (h1 >>> 0).toString(16),
  45991. hex2 = (h2 >>> 0).toString(16);
  45992. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45993. }
  45994. }
  45995. exports.MurmurHash3_64 = MurmurHash3_64;
  45996. /***/ }),
  45997. /* 60 */
  45998. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45999. Object.defineProperty(exports, "__esModule", ({
  46000. value: true
  46001. }));
  46002. exports.OperatorList = void 0;
  46003. var _util = __w_pdfjs_require__(2);
  46004. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  46005. let state = parentState;
  46006. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  46007. const item = pattern[i];
  46008. state = state[item] || (state[item] = []);
  46009. }
  46010. state[pattern.at(-1)] = {
  46011. checkFn,
  46012. iterateFn,
  46013. processFn
  46014. };
  46015. }
  46016. const InitialState = [];
  46017. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46018. const fnArray = context.fnArray;
  46019. const iFirstSave = context.iCurr - 3;
  46020. const pos = (i - iFirstSave) % 4;
  46021. switch (pos) {
  46022. case 0:
  46023. return fnArray[i] === _util.OPS.save;
  46024. case 1:
  46025. return fnArray[i] === _util.OPS.transform;
  46026. case 2:
  46027. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46028. case 3:
  46029. return fnArray[i] === _util.OPS.restore;
  46030. }
  46031. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46032. }, function foundInlineImageGroup(context, i) {
  46033. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46034. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46035. const MAX_WIDTH = 1000;
  46036. const IMAGE_PADDING = 1;
  46037. const fnArray = context.fnArray,
  46038. argsArray = context.argsArray;
  46039. const curr = context.iCurr;
  46040. const iFirstSave = curr - 3;
  46041. const iFirstTransform = curr - 2;
  46042. const iFirstPIIXO = curr - 1;
  46043. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46044. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46045. return i - (i - iFirstSave) % 4;
  46046. }
  46047. let maxX = 0;
  46048. const map = [];
  46049. let maxLineHeight = 0;
  46050. let currentX = IMAGE_PADDING,
  46051. currentY = IMAGE_PADDING;
  46052. for (let q = 0; q < count; q++) {
  46053. const transform = argsArray[iFirstTransform + (q << 2)];
  46054. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46055. if (currentX + img.width > MAX_WIDTH) {
  46056. maxX = Math.max(maxX, currentX);
  46057. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46058. currentX = 0;
  46059. maxLineHeight = 0;
  46060. }
  46061. map.push({
  46062. transform,
  46063. x: currentX,
  46064. y: currentY,
  46065. w: img.width,
  46066. h: img.height
  46067. });
  46068. currentX += img.width + 2 * IMAGE_PADDING;
  46069. maxLineHeight = Math.max(maxLineHeight, img.height);
  46070. }
  46071. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46072. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46073. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  46074. const imgRowSize = imgWidth << 2;
  46075. for (let q = 0; q < count; q++) {
  46076. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46077. const rowSize = map[q].w << 2;
  46078. let dataOffset = 0;
  46079. let offset = map[q].x + map[q].y * imgWidth << 2;
  46080. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46081. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46082. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46083. dataOffset += rowSize;
  46084. offset += imgRowSize;
  46085. }
  46086. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46087. while (offset >= 0) {
  46088. data[offset - 4] = data[offset];
  46089. data[offset - 3] = data[offset + 1];
  46090. data[offset - 2] = data[offset + 2];
  46091. data[offset - 1] = data[offset + 3];
  46092. data[offset + rowSize] = data[offset + rowSize - 4];
  46093. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46094. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46095. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46096. offset -= imgRowSize;
  46097. }
  46098. }
  46099. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46100. argsArray.splice(iFirstSave, count * 4, [{
  46101. width: imgWidth,
  46102. height: imgHeight,
  46103. kind: _util.ImageKind.RGBA_32BPP,
  46104. data: imgData
  46105. }, map]);
  46106. return iFirstSave + 1;
  46107. });
  46108. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46109. const fnArray = context.fnArray;
  46110. const iFirstSave = context.iCurr - 3;
  46111. const pos = (i - iFirstSave) % 4;
  46112. switch (pos) {
  46113. case 0:
  46114. return fnArray[i] === _util.OPS.save;
  46115. case 1:
  46116. return fnArray[i] === _util.OPS.transform;
  46117. case 2:
  46118. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46119. case 3:
  46120. return fnArray[i] === _util.OPS.restore;
  46121. }
  46122. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46123. }, function foundImageMaskGroup(context, i) {
  46124. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46125. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46126. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46127. const fnArray = context.fnArray,
  46128. argsArray = context.argsArray;
  46129. const curr = context.iCurr;
  46130. const iFirstSave = curr - 3;
  46131. const iFirstTransform = curr - 2;
  46132. const iFirstPIMXO = curr - 1;
  46133. let count = Math.floor((i - iFirstSave) / 4);
  46134. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46135. return i - (i - iFirstSave) % 4;
  46136. }
  46137. let isSameImage = false;
  46138. let iTransform, transformArgs;
  46139. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46140. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46141. firstTransformArg1 = argsArray[iFirstTransform][1],
  46142. firstTransformArg2 = argsArray[iFirstTransform][2],
  46143. firstTransformArg3 = argsArray[iFirstTransform][3];
  46144. if (firstTransformArg1 === firstTransformArg2) {
  46145. isSameImage = true;
  46146. iTransform = iFirstTransform + 4;
  46147. let iPIMXO = iFirstPIMXO + 4;
  46148. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46149. transformArgs = argsArray[iTransform];
  46150. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46151. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46152. isSameImage = false;
  46153. } else {
  46154. count = q;
  46155. }
  46156. break;
  46157. }
  46158. }
  46159. }
  46160. if (isSameImage) {
  46161. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46162. const positions = new Float32Array(count * 2);
  46163. iTransform = iFirstTransform;
  46164. for (let q = 0; q < count; q++, iTransform += 4) {
  46165. transformArgs = argsArray[iTransform];
  46166. positions[q << 1] = transformArgs[4];
  46167. positions[(q << 1) + 1] = transformArgs[5];
  46168. }
  46169. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46170. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46171. } else {
  46172. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46173. const images = [];
  46174. for (let q = 0; q < count; q++) {
  46175. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46176. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46177. images.push({
  46178. data: maskParams.data,
  46179. width: maskParams.width,
  46180. height: maskParams.height,
  46181. interpolate: maskParams.interpolate,
  46182. count: maskParams.count,
  46183. transform: transformArgs
  46184. });
  46185. }
  46186. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46187. argsArray.splice(iFirstSave, count * 4, [images]);
  46188. }
  46189. return iFirstSave + 1;
  46190. });
  46191. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46192. const argsArray = context.argsArray;
  46193. const iFirstTransform = context.iCurr - 2;
  46194. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46195. }, function iterateImageGroup(context, i) {
  46196. const fnArray = context.fnArray,
  46197. argsArray = context.argsArray;
  46198. const iFirstSave = context.iCurr - 3;
  46199. const pos = (i - iFirstSave) % 4;
  46200. switch (pos) {
  46201. case 0:
  46202. return fnArray[i] === _util.OPS.save;
  46203. case 1:
  46204. if (fnArray[i] !== _util.OPS.transform) {
  46205. return false;
  46206. }
  46207. const iFirstTransform = context.iCurr - 2;
  46208. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46209. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46210. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46211. return false;
  46212. }
  46213. return true;
  46214. case 2:
  46215. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46216. return false;
  46217. }
  46218. const iFirstPIXO = context.iCurr - 1;
  46219. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46220. if (argsArray[i][0] !== firstPIXOArg0) {
  46221. return false;
  46222. }
  46223. return true;
  46224. case 3:
  46225. return fnArray[i] === _util.OPS.restore;
  46226. }
  46227. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46228. }, function (context, i) {
  46229. const MIN_IMAGES_IN_BLOCK = 3;
  46230. const MAX_IMAGES_IN_BLOCK = 1000;
  46231. const fnArray = context.fnArray,
  46232. argsArray = context.argsArray;
  46233. const curr = context.iCurr;
  46234. const iFirstSave = curr - 3;
  46235. const iFirstTransform = curr - 2;
  46236. const iFirstPIXO = curr - 1;
  46237. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46238. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46239. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46240. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46241. if (count < MIN_IMAGES_IN_BLOCK) {
  46242. return i - (i - iFirstSave) % 4;
  46243. }
  46244. const positions = new Float32Array(count * 2);
  46245. let iTransform = iFirstTransform;
  46246. for (let q = 0; q < count; q++, iTransform += 4) {
  46247. const transformArgs = argsArray[iTransform];
  46248. positions[q << 1] = transformArgs[4];
  46249. positions[(q << 1) + 1] = transformArgs[5];
  46250. }
  46251. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46252. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46253. argsArray.splice(iFirstSave, count * 4, args);
  46254. return iFirstSave + 1;
  46255. });
  46256. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46257. const fnArray = context.fnArray,
  46258. argsArray = context.argsArray;
  46259. const iFirstSave = context.iCurr - 4;
  46260. const pos = (i - iFirstSave) % 5;
  46261. switch (pos) {
  46262. case 0:
  46263. return fnArray[i] === _util.OPS.beginText;
  46264. case 1:
  46265. return fnArray[i] === _util.OPS.setFont;
  46266. case 2:
  46267. return fnArray[i] === _util.OPS.setTextMatrix;
  46268. case 3:
  46269. if (fnArray[i] !== _util.OPS.showText) {
  46270. return false;
  46271. }
  46272. const iFirstSetFont = context.iCurr - 3;
  46273. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46274. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46275. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46276. return false;
  46277. }
  46278. return true;
  46279. case 4:
  46280. return fnArray[i] === _util.OPS.endText;
  46281. }
  46282. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46283. }, function (context, i) {
  46284. const MIN_CHARS_IN_BLOCK = 3;
  46285. const MAX_CHARS_IN_BLOCK = 1000;
  46286. const fnArray = context.fnArray,
  46287. argsArray = context.argsArray;
  46288. const curr = context.iCurr;
  46289. const iFirstBeginText = curr - 4;
  46290. const iFirstSetFont = curr - 3;
  46291. const iFirstSetTextMatrix = curr - 2;
  46292. const iFirstShowText = curr - 1;
  46293. const iFirstEndText = curr;
  46294. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46295. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46296. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46297. if (count < MIN_CHARS_IN_BLOCK) {
  46298. return i - (i - iFirstBeginText) % 5;
  46299. }
  46300. let iFirst = iFirstBeginText;
  46301. 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) {
  46302. count++;
  46303. iFirst -= 5;
  46304. }
  46305. let iEndText = iFirst + 4;
  46306. for (let q = 1; q < count; q++) {
  46307. fnArray.splice(iEndText, 3);
  46308. argsArray.splice(iEndText, 3);
  46309. iEndText += 2;
  46310. }
  46311. return iEndText + 1;
  46312. });
  46313. class NullOptimizer {
  46314. constructor(queue) {
  46315. this.queue = queue;
  46316. }
  46317. _optimize() {}
  46318. push(fn, args) {
  46319. this.queue.fnArray.push(fn);
  46320. this.queue.argsArray.push(args);
  46321. this._optimize();
  46322. }
  46323. flush() {}
  46324. reset() {}
  46325. }
  46326. class QueueOptimizer extends NullOptimizer {
  46327. constructor(queue) {
  46328. super(queue);
  46329. this.state = null;
  46330. this.context = {
  46331. iCurr: 0,
  46332. fnArray: queue.fnArray,
  46333. argsArray: queue.argsArray
  46334. };
  46335. this.match = null;
  46336. this.lastProcessed = 0;
  46337. }
  46338. _optimize() {
  46339. const fnArray = this.queue.fnArray;
  46340. let i = this.lastProcessed,
  46341. ii = fnArray.length;
  46342. let state = this.state;
  46343. let match = this.match;
  46344. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46345. this.lastProcessed = ii;
  46346. return;
  46347. }
  46348. const context = this.context;
  46349. while (i < ii) {
  46350. if (match) {
  46351. const iterate = (0, match.iterateFn)(context, i);
  46352. if (iterate) {
  46353. i++;
  46354. continue;
  46355. }
  46356. i = (0, match.processFn)(context, i + 1);
  46357. ii = fnArray.length;
  46358. match = null;
  46359. state = null;
  46360. if (i >= ii) {
  46361. break;
  46362. }
  46363. }
  46364. state = (state || InitialState)[fnArray[i]];
  46365. if (!state || Array.isArray(state)) {
  46366. i++;
  46367. continue;
  46368. }
  46369. context.iCurr = i;
  46370. i++;
  46371. if (state.checkFn && !(0, state.checkFn)(context)) {
  46372. state = null;
  46373. continue;
  46374. }
  46375. match = state;
  46376. state = null;
  46377. }
  46378. this.state = state;
  46379. this.match = match;
  46380. this.lastProcessed = i;
  46381. }
  46382. flush() {
  46383. while (this.match) {
  46384. const length = this.queue.fnArray.length;
  46385. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46386. this.match = null;
  46387. this.state = null;
  46388. this._optimize();
  46389. }
  46390. }
  46391. reset() {
  46392. this.state = null;
  46393. this.match = null;
  46394. this.lastProcessed = 0;
  46395. }
  46396. }
  46397. class OperatorList {
  46398. static get CHUNK_SIZE() {
  46399. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46400. }
  46401. static get CHUNK_SIZE_ABOUT() {
  46402. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46403. }
  46404. constructor(intent = 0, streamSink) {
  46405. this._streamSink = streamSink;
  46406. this.fnArray = [];
  46407. this.argsArray = [];
  46408. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46409. this.optimizer = new QueueOptimizer(this);
  46410. } else {
  46411. this.optimizer = new NullOptimizer(this);
  46412. }
  46413. this.dependencies = new Set();
  46414. this._totalLength = 0;
  46415. this.weight = 0;
  46416. this._resolved = streamSink ? null : Promise.resolve();
  46417. }
  46418. get length() {
  46419. return this.argsArray.length;
  46420. }
  46421. get ready() {
  46422. return this._resolved || this._streamSink.ready;
  46423. }
  46424. get totalLength() {
  46425. return this._totalLength + this.length;
  46426. }
  46427. addOp(fn, args) {
  46428. this.optimizer.push(fn, args);
  46429. this.weight++;
  46430. if (this._streamSink) {
  46431. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46432. this.flush();
  46433. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46434. this.flush();
  46435. }
  46436. }
  46437. }
  46438. addImageOps(fn, args, optionalContent) {
  46439. if (optionalContent !== undefined) {
  46440. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46441. }
  46442. this.addOp(fn, args);
  46443. if (optionalContent !== undefined) {
  46444. this.addOp(_util.OPS.endMarkedContent, []);
  46445. }
  46446. }
  46447. addDependency(dependency) {
  46448. if (this.dependencies.has(dependency)) {
  46449. return;
  46450. }
  46451. this.dependencies.add(dependency);
  46452. this.addOp(_util.OPS.dependency, [dependency]);
  46453. }
  46454. addDependencies(dependencies) {
  46455. for (const dependency of dependencies) {
  46456. this.addDependency(dependency);
  46457. }
  46458. }
  46459. addOpList(opList) {
  46460. if (!(opList instanceof OperatorList)) {
  46461. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46462. return;
  46463. }
  46464. for (const dependency of opList.dependencies) {
  46465. this.dependencies.add(dependency);
  46466. }
  46467. for (let i = 0, ii = opList.length; i < ii; i++) {
  46468. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46469. }
  46470. }
  46471. getIR() {
  46472. return {
  46473. fnArray: this.fnArray,
  46474. argsArray: this.argsArray,
  46475. length: this.length
  46476. };
  46477. }
  46478. get _transfers() {
  46479. const transfers = [];
  46480. const {
  46481. fnArray,
  46482. argsArray,
  46483. length
  46484. } = this;
  46485. for (let i = 0; i < length; i++) {
  46486. switch (fnArray[i]) {
  46487. case _util.OPS.paintInlineImageXObject:
  46488. case _util.OPS.paintInlineImageXObjectGroup:
  46489. case _util.OPS.paintImageMaskXObject:
  46490. const arg = argsArray[i][0];
  46491. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46492. transfers.push(arg.data.buffer);
  46493. }
  46494. break;
  46495. }
  46496. }
  46497. return transfers;
  46498. }
  46499. flush(lastChunk = false, separateAnnots = null) {
  46500. this.optimizer.flush();
  46501. const length = this.length;
  46502. this._totalLength += length;
  46503. this._streamSink.enqueue({
  46504. fnArray: this.fnArray,
  46505. argsArray: this.argsArray,
  46506. lastChunk,
  46507. separateAnnots,
  46508. length
  46509. }, 1, this._transfers);
  46510. this.dependencies.clear();
  46511. this.fnArray.length = 0;
  46512. this.argsArray.length = 0;
  46513. this.weight = 0;
  46514. this.optimizer.reset();
  46515. }
  46516. }
  46517. exports.OperatorList = OperatorList;
  46518. /***/ }),
  46519. /* 61 */
  46520. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46521. Object.defineProperty(exports, "__esModule", ({
  46522. value: true
  46523. }));
  46524. exports.PDFImage = void 0;
  46525. var _util = __w_pdfjs_require__(2);
  46526. var _image_utils = __w_pdfjs_require__(62);
  46527. var _base_stream = __w_pdfjs_require__(5);
  46528. var _colorspace = __w_pdfjs_require__(12);
  46529. var _decode_stream = __w_pdfjs_require__(17);
  46530. var _jpeg_stream = __w_pdfjs_require__(25);
  46531. var _jpx = __w_pdfjs_require__(28);
  46532. var _primitives = __w_pdfjs_require__(3);
  46533. function decodeAndClamp(value, addend, coefficient, max) {
  46534. value = addend + value * coefficient;
  46535. if (value < 0) {
  46536. value = 0;
  46537. } else if (value > max) {
  46538. value = max;
  46539. }
  46540. return value;
  46541. }
  46542. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46543. const length = w2 * h2;
  46544. let dest;
  46545. if (bpc <= 8) {
  46546. dest = new Uint8Array(length);
  46547. } else if (bpc <= 16) {
  46548. dest = new Uint16Array(length);
  46549. } else {
  46550. dest = new Uint32Array(length);
  46551. }
  46552. const xRatio = w1 / w2;
  46553. const yRatio = h1 / h2;
  46554. let i,
  46555. j,
  46556. py,
  46557. newIndex = 0,
  46558. oldIndex;
  46559. const xScaled = new Uint16Array(w2);
  46560. const w1Scanline = w1;
  46561. for (i = 0; i < w2; i++) {
  46562. xScaled[i] = Math.floor(i * xRatio);
  46563. }
  46564. for (i = 0; i < h2; i++) {
  46565. py = Math.floor(i * yRatio) * w1Scanline;
  46566. for (j = 0; j < w2; j++) {
  46567. oldIndex = py + xScaled[j];
  46568. dest[newIndex++] = src[oldIndex];
  46569. }
  46570. }
  46571. return dest;
  46572. }
  46573. class PDFImage {
  46574. constructor({
  46575. xref,
  46576. res,
  46577. image,
  46578. isInline = false,
  46579. smask = null,
  46580. mask = null,
  46581. isMask = false,
  46582. pdfFunctionFactory,
  46583. localColorSpaceCache
  46584. }) {
  46585. this.image = image;
  46586. const dict = image.dict;
  46587. const filter = dict.get("F", "Filter");
  46588. let filterName;
  46589. if (filter instanceof _primitives.Name) {
  46590. filterName = filter.name;
  46591. } else if (Array.isArray(filter)) {
  46592. const filterZero = xref.fetchIfRef(filter[0]);
  46593. if (filterZero instanceof _primitives.Name) {
  46594. filterName = filterZero.name;
  46595. }
  46596. }
  46597. switch (filterName) {
  46598. case "JPXDecode":
  46599. const jpxImage = new _jpx.JpxImage();
  46600. jpxImage.parseImageProperties(image.stream);
  46601. image.stream.reset();
  46602. image.width = jpxImage.width;
  46603. image.height = jpxImage.height;
  46604. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46605. image.numComps = jpxImage.componentsCount;
  46606. break;
  46607. case "JBIG2Decode":
  46608. image.bitsPerComponent = 1;
  46609. image.numComps = 1;
  46610. break;
  46611. }
  46612. let width = dict.get("W", "Width");
  46613. let height = dict.get("H", "Height");
  46614. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46615. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46616. width = image.width;
  46617. height = image.height;
  46618. }
  46619. if (width < 1 || height < 1) {
  46620. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46621. }
  46622. this.width = width;
  46623. this.height = height;
  46624. this.interpolate = dict.get("I", "Interpolate");
  46625. this.imageMask = dict.get("IM", "ImageMask") || false;
  46626. this.matte = dict.get("Matte") || false;
  46627. let bitsPerComponent = image.bitsPerComponent;
  46628. if (!bitsPerComponent) {
  46629. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  46630. if (!bitsPerComponent) {
  46631. if (this.imageMask) {
  46632. bitsPerComponent = 1;
  46633. } else {
  46634. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  46635. }
  46636. }
  46637. }
  46638. this.bpc = bitsPerComponent;
  46639. if (!this.imageMask) {
  46640. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  46641. if (!colorSpace) {
  46642. (0, _util.info)("JPX images (which do not require color spaces)");
  46643. switch (image.numComps) {
  46644. case 1:
  46645. colorSpace = _primitives.Name.get("DeviceGray");
  46646. break;
  46647. case 3:
  46648. colorSpace = _primitives.Name.get("DeviceRGB");
  46649. break;
  46650. case 4:
  46651. colorSpace = _primitives.Name.get("DeviceCMYK");
  46652. break;
  46653. default:
  46654. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  46655. }
  46656. }
  46657. this.colorSpace = _colorspace.ColorSpace.parse({
  46658. cs: colorSpace,
  46659. xref,
  46660. resources: isInline ? res : null,
  46661. pdfFunctionFactory,
  46662. localColorSpaceCache
  46663. });
  46664. this.numComps = this.colorSpace.numComps;
  46665. }
  46666. this.decode = dict.getArray("D", "Decode");
  46667. this.needsDecode = false;
  46668. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  46669. this.needsDecode = true;
  46670. const max = (1 << bitsPerComponent) - 1;
  46671. this.decodeCoefficients = [];
  46672. this.decodeAddends = [];
  46673. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  46674. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  46675. const dmin = this.decode[i];
  46676. const dmax = this.decode[i + 1];
  46677. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  46678. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  46679. }
  46680. }
  46681. if (smask) {
  46682. this.smask = new PDFImage({
  46683. xref,
  46684. res,
  46685. image: smask,
  46686. isInline,
  46687. pdfFunctionFactory,
  46688. localColorSpaceCache
  46689. });
  46690. } else if (mask) {
  46691. if (mask instanceof _base_stream.BaseStream) {
  46692. const maskDict = mask.dict,
  46693. imageMask = maskDict.get("IM", "ImageMask");
  46694. if (!imageMask) {
  46695. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  46696. } else {
  46697. this.mask = new PDFImage({
  46698. xref,
  46699. res,
  46700. image: mask,
  46701. isInline,
  46702. isMask: true,
  46703. pdfFunctionFactory,
  46704. localColorSpaceCache
  46705. });
  46706. }
  46707. } else {
  46708. this.mask = mask;
  46709. }
  46710. }
  46711. }
  46712. static async buildImage({
  46713. xref,
  46714. res,
  46715. image,
  46716. isInline = false,
  46717. pdfFunctionFactory,
  46718. localColorSpaceCache
  46719. }) {
  46720. const imageData = image;
  46721. let smaskData = null;
  46722. let maskData = null;
  46723. const smask = image.dict.get("SMask");
  46724. const mask = image.dict.get("Mask");
  46725. if (smask) {
  46726. if (smask instanceof _base_stream.BaseStream) {
  46727. smaskData = smask;
  46728. } else {
  46729. (0, _util.warn)("Unsupported /SMask format.");
  46730. }
  46731. } else if (mask) {
  46732. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  46733. maskData = mask;
  46734. } else {
  46735. (0, _util.warn)("Unsupported /Mask format.");
  46736. }
  46737. }
  46738. return new PDFImage({
  46739. xref,
  46740. res,
  46741. image: imageData,
  46742. isInline,
  46743. smask: smaskData,
  46744. mask: maskData,
  46745. pdfFunctionFactory,
  46746. localColorSpaceCache
  46747. });
  46748. }
  46749. static createRawMask({
  46750. imgArray,
  46751. width,
  46752. height,
  46753. imageIsFromDecodeStream,
  46754. inverseDecode,
  46755. interpolate
  46756. }) {
  46757. const computedLength = (width + 7 >> 3) * height;
  46758. const actualLength = imgArray.byteLength;
  46759. const haveFullData = computedLength === actualLength;
  46760. let data, i;
  46761. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46762. data = imgArray;
  46763. } else if (!inverseDecode) {
  46764. data = new Uint8Array(imgArray);
  46765. } else {
  46766. data = new Uint8Array(computedLength);
  46767. data.set(imgArray);
  46768. data.fill(0xff, actualLength);
  46769. }
  46770. if (inverseDecode) {
  46771. for (i = 0; i < actualLength; i++) {
  46772. data[i] ^= 0xff;
  46773. }
  46774. }
  46775. return {
  46776. data,
  46777. width,
  46778. height,
  46779. interpolate
  46780. };
  46781. }
  46782. static createMask({
  46783. imgArray,
  46784. width,
  46785. height,
  46786. imageIsFromDecodeStream,
  46787. inverseDecode,
  46788. interpolate,
  46789. isOffscreenCanvasSupported = true
  46790. }) {
  46791. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  46792. if (isSingleOpaquePixel) {
  46793. return {
  46794. isSingleOpaquePixel
  46795. };
  46796. }
  46797. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  46798. const canvas = new OffscreenCanvas(width, height);
  46799. const ctx = canvas.getContext("2d");
  46800. const imgData = ctx.createImageData(width, height);
  46801. (0, _image_utils.applyMaskImageData)({
  46802. src: imgArray,
  46803. dest: imgData.data,
  46804. width,
  46805. height,
  46806. inverseDecode
  46807. });
  46808. ctx.putImageData(imgData, 0, 0);
  46809. const bitmap = canvas.transferToImageBitmap();
  46810. return {
  46811. data: null,
  46812. width,
  46813. height,
  46814. interpolate,
  46815. bitmap
  46816. };
  46817. }
  46818. return this.createRawMask({
  46819. imgArray,
  46820. width,
  46821. height,
  46822. inverseDecode,
  46823. imageIsFromDecodeStream,
  46824. interpolate
  46825. });
  46826. }
  46827. get drawWidth() {
  46828. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46829. }
  46830. get drawHeight() {
  46831. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46832. }
  46833. decodeBuffer(buffer) {
  46834. const bpc = this.bpc;
  46835. const numComps = this.numComps;
  46836. const decodeAddends = this.decodeAddends;
  46837. const decodeCoefficients = this.decodeCoefficients;
  46838. const max = (1 << bpc) - 1;
  46839. let i, ii;
  46840. if (bpc === 1) {
  46841. for (i = 0, ii = buffer.length; i < ii; i++) {
  46842. buffer[i] = +!buffer[i];
  46843. }
  46844. return;
  46845. }
  46846. let index = 0;
  46847. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46848. for (let j = 0; j < numComps; j++) {
  46849. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46850. index++;
  46851. }
  46852. }
  46853. }
  46854. getComponents(buffer) {
  46855. const bpc = this.bpc;
  46856. if (bpc === 8) {
  46857. return buffer;
  46858. }
  46859. const width = this.width;
  46860. const height = this.height;
  46861. const numComps = this.numComps;
  46862. const length = width * height * numComps;
  46863. let bufferPos = 0;
  46864. let output;
  46865. if (bpc <= 8) {
  46866. output = new Uint8Array(length);
  46867. } else if (bpc <= 16) {
  46868. output = new Uint16Array(length);
  46869. } else {
  46870. output = new Uint32Array(length);
  46871. }
  46872. const rowComps = width * numComps;
  46873. const max = (1 << bpc) - 1;
  46874. let i = 0,
  46875. ii,
  46876. buf;
  46877. if (bpc === 1) {
  46878. let mask, loop1End, loop2End;
  46879. for (let j = 0; j < height; j++) {
  46880. loop1End = i + (rowComps & ~7);
  46881. loop2End = i + rowComps;
  46882. while (i < loop1End) {
  46883. buf = buffer[bufferPos++];
  46884. output[i] = buf >> 7 & 1;
  46885. output[i + 1] = buf >> 6 & 1;
  46886. output[i + 2] = buf >> 5 & 1;
  46887. output[i + 3] = buf >> 4 & 1;
  46888. output[i + 4] = buf >> 3 & 1;
  46889. output[i + 5] = buf >> 2 & 1;
  46890. output[i + 6] = buf >> 1 & 1;
  46891. output[i + 7] = buf & 1;
  46892. i += 8;
  46893. }
  46894. if (i < loop2End) {
  46895. buf = buffer[bufferPos++];
  46896. mask = 128;
  46897. while (i < loop2End) {
  46898. output[i++] = +!!(buf & mask);
  46899. mask >>= 1;
  46900. }
  46901. }
  46902. }
  46903. } else {
  46904. let bits = 0;
  46905. buf = 0;
  46906. for (i = 0, ii = length; i < ii; ++i) {
  46907. if (i % rowComps === 0) {
  46908. buf = 0;
  46909. bits = 0;
  46910. }
  46911. while (bits < bpc) {
  46912. buf = buf << 8 | buffer[bufferPos++];
  46913. bits += 8;
  46914. }
  46915. const remainingBits = bits - bpc;
  46916. let value = buf >> remainingBits;
  46917. if (value < 0) {
  46918. value = 0;
  46919. } else if (value > max) {
  46920. value = max;
  46921. }
  46922. output[i] = value;
  46923. buf &= (1 << remainingBits) - 1;
  46924. bits = remainingBits;
  46925. }
  46926. }
  46927. return output;
  46928. }
  46929. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46930. const smask = this.smask;
  46931. const mask = this.mask;
  46932. let alphaBuf, sw, sh, i, ii, j;
  46933. if (smask) {
  46934. sw = smask.width;
  46935. sh = smask.height;
  46936. alphaBuf = new Uint8ClampedArray(sw * sh);
  46937. smask.fillGrayBuffer(alphaBuf);
  46938. if (sw !== width || sh !== height) {
  46939. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46940. }
  46941. } else if (mask) {
  46942. if (mask instanceof PDFImage) {
  46943. sw = mask.width;
  46944. sh = mask.height;
  46945. alphaBuf = new Uint8ClampedArray(sw * sh);
  46946. mask.numComps = 1;
  46947. mask.fillGrayBuffer(alphaBuf);
  46948. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46949. alphaBuf[i] = 255 - alphaBuf[i];
  46950. }
  46951. if (sw !== width || sh !== height) {
  46952. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46953. }
  46954. } else if (Array.isArray(mask)) {
  46955. alphaBuf = new Uint8ClampedArray(width * height);
  46956. const numComps = this.numComps;
  46957. for (i = 0, ii = width * height; i < ii; ++i) {
  46958. let opacity = 0;
  46959. const imageOffset = i * numComps;
  46960. for (j = 0; j < numComps; ++j) {
  46961. const color = image[imageOffset + j];
  46962. const maskOffset = j * 2;
  46963. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46964. opacity = 255;
  46965. break;
  46966. }
  46967. }
  46968. alphaBuf[i] = opacity;
  46969. }
  46970. } else {
  46971. throw new _util.FormatError("Unknown mask format.");
  46972. }
  46973. }
  46974. if (alphaBuf) {
  46975. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46976. rgbaBuf[j] = alphaBuf[i];
  46977. }
  46978. } else {
  46979. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46980. rgbaBuf[j] = 255;
  46981. }
  46982. }
  46983. }
  46984. undoPreblend(buffer, width, height) {
  46985. const matte = this.smask && this.smask.matte;
  46986. if (!matte) {
  46987. return;
  46988. }
  46989. const matteRgb = this.colorSpace.getRgb(matte, 0);
  46990. const matteR = matteRgb[0];
  46991. const matteG = matteRgb[1];
  46992. const matteB = matteRgb[2];
  46993. const length = width * height * 4;
  46994. for (let i = 0; i < length; i += 4) {
  46995. const alpha = buffer[i + 3];
  46996. if (alpha === 0) {
  46997. buffer[i] = 255;
  46998. buffer[i + 1] = 255;
  46999. buffer[i + 2] = 255;
  47000. continue;
  47001. }
  47002. const k = 255 / alpha;
  47003. buffer[i] = (buffer[i] - matteR) * k + matteR;
  47004. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  47005. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  47006. }
  47007. }
  47008. createImageData(forceRGBA = false) {
  47009. const drawWidth = this.drawWidth;
  47010. const drawHeight = this.drawHeight;
  47011. const imgData = {
  47012. width: drawWidth,
  47013. height: drawHeight,
  47014. interpolate: this.interpolate,
  47015. kind: 0,
  47016. data: null
  47017. };
  47018. const numComps = this.numComps;
  47019. const originalWidth = this.width;
  47020. const originalHeight = this.height;
  47021. const bpc = this.bpc;
  47022. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47023. if (!forceRGBA) {
  47024. let kind;
  47025. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47026. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47027. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47028. kind = _util.ImageKind.RGB_24BPP;
  47029. }
  47030. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47031. imgData.kind = kind;
  47032. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  47033. if (this.needsDecode) {
  47034. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47035. const buffer = imgData.data;
  47036. for (let i = 0, ii = buffer.length; i < ii; i++) {
  47037. buffer[i] ^= 0xff;
  47038. }
  47039. }
  47040. return imgData;
  47041. }
  47042. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47043. let imageLength = originalHeight * rowBytes;
  47044. switch (this.colorSpace.name) {
  47045. case "DeviceGray":
  47046. imageLength *= 3;
  47047. case "DeviceRGB":
  47048. case "DeviceCMYK":
  47049. imgData.kind = _util.ImageKind.RGB_24BPP;
  47050. imgData.data = this.getImageBytes(imageLength, {
  47051. drawWidth,
  47052. drawHeight,
  47053. forceRGB: true
  47054. });
  47055. return imgData;
  47056. }
  47057. }
  47058. }
  47059. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  47060. internal: true
  47061. });
  47062. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47063. const comps = this.getComponents(imgArray);
  47064. let alpha01, maybeUndoPreblend;
  47065. if (!forceRGBA && !this.smask && !this.mask) {
  47066. imgData.kind = _util.ImageKind.RGB_24BPP;
  47067. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47068. alpha01 = 0;
  47069. maybeUndoPreblend = false;
  47070. } else {
  47071. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47072. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47073. alpha01 = 1;
  47074. maybeUndoPreblend = true;
  47075. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47076. }
  47077. if (this.needsDecode) {
  47078. this.decodeBuffer(comps);
  47079. }
  47080. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47081. if (maybeUndoPreblend) {
  47082. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47083. }
  47084. return imgData;
  47085. }
  47086. fillGrayBuffer(buffer) {
  47087. const numComps = this.numComps;
  47088. if (numComps !== 1) {
  47089. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47090. }
  47091. const width = this.width;
  47092. const height = this.height;
  47093. const bpc = this.bpc;
  47094. const rowBytes = width * numComps * bpc + 7 >> 3;
  47095. const imgArray = this.getImageBytes(height * rowBytes, {
  47096. internal: true
  47097. });
  47098. const comps = this.getComponents(imgArray);
  47099. let i, length;
  47100. if (bpc === 1) {
  47101. length = width * height;
  47102. if (this.needsDecode) {
  47103. for (i = 0; i < length; ++i) {
  47104. buffer[i] = comps[i] - 1 & 255;
  47105. }
  47106. } else {
  47107. for (i = 0; i < length; ++i) {
  47108. buffer[i] = -comps[i] & 255;
  47109. }
  47110. }
  47111. return;
  47112. }
  47113. if (this.needsDecode) {
  47114. this.decodeBuffer(comps);
  47115. }
  47116. length = width * height;
  47117. const scale = 255 / ((1 << bpc) - 1);
  47118. for (i = 0; i < length; ++i) {
  47119. buffer[i] = scale * comps[i];
  47120. }
  47121. }
  47122. getImageBytes(length, {
  47123. drawWidth,
  47124. drawHeight,
  47125. forceRGB = false,
  47126. internal = false
  47127. }) {
  47128. this.image.reset();
  47129. this.image.drawWidth = drawWidth || this.width;
  47130. this.image.drawHeight = drawHeight || this.height;
  47131. this.image.forceRGB = !!forceRGB;
  47132. const imageBytes = this.image.getBytes(length);
  47133. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47134. return imageBytes;
  47135. }
  47136. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47137. return new Uint8Array(imageBytes);
  47138. }
  47139. }
  47140. exports.PDFImage = PDFImage;
  47141. /***/ }),
  47142. /* 62 */
  47143. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47144. Object.defineProperty(exports, "__esModule", ({
  47145. value: true
  47146. }));
  47147. exports.applyMaskImageData = applyMaskImageData;
  47148. var _util = __w_pdfjs_require__(2);
  47149. function applyMaskImageData({
  47150. src,
  47151. srcPos = 0,
  47152. dest,
  47153. destPos = 0,
  47154. width,
  47155. height,
  47156. inverseDecode = false
  47157. }) {
  47158. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47159. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47160. const widthInSource = width >> 3;
  47161. const widthRemainder = width & 7;
  47162. const srcLength = src.length;
  47163. dest = new Uint32Array(dest.buffer);
  47164. for (let i = 0; i < height; i++) {
  47165. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47166. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47167. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47168. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47169. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47170. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47171. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47172. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47173. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47174. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47175. }
  47176. if (widthRemainder === 0) {
  47177. continue;
  47178. }
  47179. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47180. for (let j = 0; j < widthRemainder; j++) {
  47181. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47182. }
  47183. }
  47184. return {
  47185. srcPos,
  47186. destPos
  47187. };
  47188. }
  47189. /***/ }),
  47190. /* 63 */
  47191. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47192. Object.defineProperty(exports, "__esModule", ({
  47193. value: true
  47194. }));
  47195. exports.incrementalUpdate = incrementalUpdate;
  47196. exports.writeDict = writeDict;
  47197. exports.writeObject = writeObject;
  47198. var _util = __w_pdfjs_require__(2);
  47199. var _primitives = __w_pdfjs_require__(3);
  47200. var _core_utils = __w_pdfjs_require__(4);
  47201. var _xml_parser = __w_pdfjs_require__(64);
  47202. var _base_stream = __w_pdfjs_require__(5);
  47203. var _crypto = __w_pdfjs_require__(65);
  47204. function writeObject(ref, obj, buffer, transform) {
  47205. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47206. if (obj instanceof _primitives.Dict) {
  47207. writeDict(obj, buffer, transform);
  47208. } else if (obj instanceof _base_stream.BaseStream) {
  47209. writeStream(obj, buffer, transform);
  47210. }
  47211. buffer.push("\nendobj\n");
  47212. }
  47213. function writeDict(dict, buffer, transform) {
  47214. buffer.push("<<");
  47215. for (const key of dict.getKeys()) {
  47216. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47217. writeValue(dict.getRaw(key), buffer, transform);
  47218. }
  47219. buffer.push(">>");
  47220. }
  47221. function writeStream(stream, buffer, transform) {
  47222. writeDict(stream.dict, buffer, transform);
  47223. buffer.push(" stream\n");
  47224. let string = stream.getString();
  47225. if (transform !== null) {
  47226. string = transform.encryptString(string);
  47227. }
  47228. buffer.push(string, "\nendstream\n");
  47229. }
  47230. function writeArray(array, buffer, transform) {
  47231. buffer.push("[");
  47232. let first = true;
  47233. for (const val of array) {
  47234. if (!first) {
  47235. buffer.push(" ");
  47236. } else {
  47237. first = false;
  47238. }
  47239. writeValue(val, buffer, transform);
  47240. }
  47241. buffer.push("]");
  47242. }
  47243. function writeValue(value, buffer, transform) {
  47244. if (value instanceof _primitives.Name) {
  47245. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47246. } else if (value instanceof _primitives.Ref) {
  47247. buffer.push(`${value.num} ${value.gen} R`);
  47248. } else if (Array.isArray(value)) {
  47249. writeArray(value, buffer, transform);
  47250. } else if (typeof value === "string") {
  47251. if (transform !== null) {
  47252. value = transform.encryptString(value);
  47253. }
  47254. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47255. } else if (typeof value === "number") {
  47256. buffer.push((0, _core_utils.numberToString)(value));
  47257. } else if (typeof value === "boolean") {
  47258. buffer.push(value.toString());
  47259. } else if (value instanceof _primitives.Dict) {
  47260. writeDict(value, buffer, transform);
  47261. } else if (value instanceof _base_stream.BaseStream) {
  47262. writeStream(value, buffer, transform);
  47263. } else if (value === null) {
  47264. buffer.push("null");
  47265. } else {
  47266. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47267. }
  47268. }
  47269. function writeInt(number, size, offset, buffer) {
  47270. for (let i = size + offset - 1; i > offset - 1; i--) {
  47271. buffer[i] = number & 0xff;
  47272. number >>= 8;
  47273. }
  47274. return offset + size;
  47275. }
  47276. function writeString(string, offset, buffer) {
  47277. for (let i = 0, len = string.length; i < len; i++) {
  47278. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47279. }
  47280. }
  47281. function computeMD5(filesize, xrefInfo) {
  47282. const time = Math.floor(Date.now() / 1000);
  47283. const filename = xrefInfo.filename || "";
  47284. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47285. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47286. for (const value of Object.values(xrefInfo.info)) {
  47287. md5Buffer.push(value);
  47288. md5BufferLen += value.length;
  47289. }
  47290. const array = new Uint8Array(md5BufferLen);
  47291. let offset = 0;
  47292. for (const str of md5Buffer) {
  47293. writeString(str, offset, array);
  47294. offset += str.length;
  47295. }
  47296. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47297. }
  47298. function writeXFADataForAcroform(str, newRefs) {
  47299. const xml = new _xml_parser.SimpleXMLParser({
  47300. hasAttributes: true
  47301. }).parseFromString(str);
  47302. for (const {
  47303. xfa
  47304. } of newRefs) {
  47305. if (!xfa) {
  47306. continue;
  47307. }
  47308. const {
  47309. path,
  47310. value
  47311. } = xfa;
  47312. if (!path) {
  47313. continue;
  47314. }
  47315. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47316. if (node) {
  47317. if (Array.isArray(value)) {
  47318. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47319. } else {
  47320. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47321. }
  47322. } else {
  47323. (0, _util.warn)(`Node not found for path: ${path}`);
  47324. }
  47325. }
  47326. const buffer = [];
  47327. xml.documentElement.dump(buffer);
  47328. return buffer.join("");
  47329. }
  47330. function updateXFA({
  47331. xfaData,
  47332. xfaDatasetsRef,
  47333. hasXfaDatasetsEntry,
  47334. acroFormRef,
  47335. acroForm,
  47336. newRefs,
  47337. xref,
  47338. xrefInfo
  47339. }) {
  47340. if (xref === null) {
  47341. return;
  47342. }
  47343. if (!hasXfaDatasetsEntry) {
  47344. if (!acroFormRef) {
  47345. (0, _util.warn)("XFA - Cannot save it");
  47346. return;
  47347. }
  47348. const oldXfa = acroForm.get("XFA");
  47349. const newXfa = oldXfa.slice();
  47350. newXfa.splice(2, 0, "datasets");
  47351. newXfa.splice(3, 0, xfaDatasetsRef);
  47352. acroForm.set("XFA", newXfa);
  47353. const encrypt = xref.encrypt;
  47354. let transform = null;
  47355. if (encrypt) {
  47356. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47357. }
  47358. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  47359. writeDict(acroForm, buffer, transform);
  47360. buffer.push("\n");
  47361. acroForm.set("XFA", oldXfa);
  47362. newRefs.push({
  47363. ref: acroFormRef,
  47364. data: buffer.join("")
  47365. });
  47366. }
  47367. if (xfaData === null) {
  47368. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47369. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47370. }
  47371. const encrypt = xref.encrypt;
  47372. if (encrypt) {
  47373. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47374. xfaData = transform.encryptString(xfaData);
  47375. }
  47376. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47377. newRefs.push({
  47378. ref: xfaDatasetsRef,
  47379. data
  47380. });
  47381. }
  47382. function incrementalUpdate({
  47383. originalData,
  47384. xrefInfo,
  47385. newRefs,
  47386. xref = null,
  47387. hasXfa = false,
  47388. xfaDatasetsRef = null,
  47389. hasXfaDatasetsEntry = false,
  47390. acroFormRef = null,
  47391. acroForm = null,
  47392. xfaData = null
  47393. }) {
  47394. if (hasXfa) {
  47395. updateXFA({
  47396. xfaData,
  47397. xfaDatasetsRef,
  47398. hasXfaDatasetsEntry,
  47399. acroFormRef,
  47400. acroForm,
  47401. newRefs,
  47402. xref,
  47403. xrefInfo
  47404. });
  47405. }
  47406. const newXref = new _primitives.Dict(null);
  47407. const refForXrefTable = xrefInfo.newRef;
  47408. let buffer, baseOffset;
  47409. const lastByte = originalData.at(-1);
  47410. if (lastByte === 0x0a || lastByte === 0x0d) {
  47411. buffer = [];
  47412. baseOffset = originalData.length;
  47413. } else {
  47414. buffer = ["\n"];
  47415. baseOffset = originalData.length + 1;
  47416. }
  47417. newXref.set("Size", refForXrefTable.num + 1);
  47418. newXref.set("Prev", xrefInfo.startXRef);
  47419. newXref.set("Type", _primitives.Name.get("XRef"));
  47420. if (xrefInfo.rootRef !== null) {
  47421. newXref.set("Root", xrefInfo.rootRef);
  47422. }
  47423. if (xrefInfo.infoRef !== null) {
  47424. newXref.set("Info", xrefInfo.infoRef);
  47425. }
  47426. if (xrefInfo.encryptRef !== null) {
  47427. newXref.set("Encrypt", xrefInfo.encryptRef);
  47428. }
  47429. newRefs.push({
  47430. ref: refForXrefTable,
  47431. data: ""
  47432. });
  47433. newRefs = newRefs.sort((a, b) => {
  47434. return a.ref.num - b.ref.num;
  47435. });
  47436. const xrefTableData = [[0, 1, 0xffff]];
  47437. const indexes = [0, 1];
  47438. let maxOffset = 0;
  47439. for (const {
  47440. ref,
  47441. data
  47442. } of newRefs) {
  47443. maxOffset = Math.max(maxOffset, baseOffset);
  47444. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47445. baseOffset += data.length;
  47446. indexes.push(ref.num, 1);
  47447. buffer.push(data);
  47448. }
  47449. newXref.set("Index", indexes);
  47450. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47451. const md5 = computeMD5(baseOffset, xrefInfo);
  47452. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47453. }
  47454. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47455. const sizes = [1, offsetSize, 2];
  47456. const structSize = sizes[0] + sizes[1] + sizes[2];
  47457. const tableLength = structSize * xrefTableData.length;
  47458. newXref.set("W", sizes);
  47459. newXref.set("Length", tableLength);
  47460. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47461. writeDict(newXref, buffer, null);
  47462. buffer.push(" stream\n");
  47463. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47464. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47465. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47466. array.set(originalData);
  47467. let offset = originalData.length;
  47468. for (const str of buffer) {
  47469. writeString(str, offset, array);
  47470. offset += str.length;
  47471. }
  47472. for (const [type, objOffset, gen] of xrefTableData) {
  47473. offset = writeInt(type, sizes[0], offset, array);
  47474. offset = writeInt(objOffset, sizes[1], offset, array);
  47475. offset = writeInt(gen, sizes[2], offset, array);
  47476. }
  47477. writeString(footer, offset, array);
  47478. return array;
  47479. }
  47480. /***/ }),
  47481. /* 64 */
  47482. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47483. Object.defineProperty(exports, "__esModule", ({
  47484. value: true
  47485. }));
  47486. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47487. var _core_utils = __w_pdfjs_require__(4);
  47488. const XMLParserErrorCode = {
  47489. NoError: 0,
  47490. EndOfDocument: -1,
  47491. UnterminatedCdat: -2,
  47492. UnterminatedXmlDeclaration: -3,
  47493. UnterminatedDoctypeDeclaration: -4,
  47494. UnterminatedComment: -5,
  47495. MalformedElement: -6,
  47496. OutOfMemory: -7,
  47497. UnterminatedAttributeValue: -8,
  47498. UnterminatedElement: -9,
  47499. ElementNeverBegun: -10
  47500. };
  47501. exports.XMLParserErrorCode = XMLParserErrorCode;
  47502. function isWhitespace(s, index) {
  47503. const ch = s[index];
  47504. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47505. }
  47506. function isWhitespaceString(s) {
  47507. for (let i = 0, ii = s.length; i < ii; i++) {
  47508. if (!isWhitespace(s, i)) {
  47509. return false;
  47510. }
  47511. }
  47512. return true;
  47513. }
  47514. class XMLParserBase {
  47515. _resolveEntities(s) {
  47516. return s.replace(/&([^;]+);/g, (all, entity) => {
  47517. if (entity.substring(0, 2) === "#x") {
  47518. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47519. } else if (entity.substring(0, 1) === "#") {
  47520. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47521. }
  47522. switch (entity) {
  47523. case "lt":
  47524. return "<";
  47525. case "gt":
  47526. return ">";
  47527. case "amp":
  47528. return "&";
  47529. case "quot":
  47530. return '"';
  47531. case "apos":
  47532. return "'";
  47533. }
  47534. return this.onResolveEntity(entity);
  47535. });
  47536. }
  47537. _parseContent(s, start) {
  47538. const attributes = [];
  47539. let pos = start;
  47540. function skipWs() {
  47541. while (pos < s.length && isWhitespace(s, pos)) {
  47542. ++pos;
  47543. }
  47544. }
  47545. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47546. ++pos;
  47547. }
  47548. const name = s.substring(start, pos);
  47549. skipWs();
  47550. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47551. skipWs();
  47552. let attrName = "",
  47553. attrValue = "";
  47554. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47555. attrName += s[pos];
  47556. ++pos;
  47557. }
  47558. skipWs();
  47559. if (s[pos] !== "=") {
  47560. return null;
  47561. }
  47562. ++pos;
  47563. skipWs();
  47564. const attrEndChar = s[pos];
  47565. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47566. return null;
  47567. }
  47568. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47569. if (attrEndIndex < 0) {
  47570. return null;
  47571. }
  47572. attrValue = s.substring(pos, attrEndIndex);
  47573. attributes.push({
  47574. name: attrName,
  47575. value: this._resolveEntities(attrValue)
  47576. });
  47577. pos = attrEndIndex + 1;
  47578. skipWs();
  47579. }
  47580. return {
  47581. name,
  47582. attributes,
  47583. parsed: pos - start
  47584. };
  47585. }
  47586. _parseProcessingInstruction(s, start) {
  47587. let pos = start;
  47588. function skipWs() {
  47589. while (pos < s.length && isWhitespace(s, pos)) {
  47590. ++pos;
  47591. }
  47592. }
  47593. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47594. ++pos;
  47595. }
  47596. const name = s.substring(start, pos);
  47597. skipWs();
  47598. const attrStart = pos;
  47599. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47600. ++pos;
  47601. }
  47602. const value = s.substring(attrStart, pos);
  47603. return {
  47604. name,
  47605. value,
  47606. parsed: pos - start
  47607. };
  47608. }
  47609. parseXml(s) {
  47610. let i = 0;
  47611. while (i < s.length) {
  47612. const ch = s[i];
  47613. let j = i;
  47614. if (ch === "<") {
  47615. ++j;
  47616. const ch2 = s[j];
  47617. let q;
  47618. switch (ch2) {
  47619. case "/":
  47620. ++j;
  47621. q = s.indexOf(">", j);
  47622. if (q < 0) {
  47623. this.onError(XMLParserErrorCode.UnterminatedElement);
  47624. return;
  47625. }
  47626. this.onEndElement(s.substring(j, q));
  47627. j = q + 1;
  47628. break;
  47629. case "?":
  47630. ++j;
  47631. const pi = this._parseProcessingInstruction(s, j);
  47632. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47633. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47634. return;
  47635. }
  47636. this.onPi(pi.name, pi.value);
  47637. j += pi.parsed + 2;
  47638. break;
  47639. case "!":
  47640. if (s.substring(j + 1, j + 3) === "--") {
  47641. q = s.indexOf("-->", j + 3);
  47642. if (q < 0) {
  47643. this.onError(XMLParserErrorCode.UnterminatedComment);
  47644. return;
  47645. }
  47646. this.onComment(s.substring(j + 3, q));
  47647. j = q + 3;
  47648. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47649. q = s.indexOf("]]>", j + 8);
  47650. if (q < 0) {
  47651. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47652. return;
  47653. }
  47654. this.onCdata(s.substring(j + 8, q));
  47655. j = q + 3;
  47656. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47657. const q2 = s.indexOf("[", j + 8);
  47658. let complexDoctype = false;
  47659. q = s.indexOf(">", j + 8);
  47660. if (q < 0) {
  47661. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47662. return;
  47663. }
  47664. if (q2 > 0 && q > q2) {
  47665. q = s.indexOf("]>", j + 8);
  47666. if (q < 0) {
  47667. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47668. return;
  47669. }
  47670. complexDoctype = true;
  47671. }
  47672. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47673. this.onDoctype(doctypeContent);
  47674. j = q + (complexDoctype ? 2 : 1);
  47675. } else {
  47676. this.onError(XMLParserErrorCode.MalformedElement);
  47677. return;
  47678. }
  47679. break;
  47680. default:
  47681. const content = this._parseContent(s, j);
  47682. if (content === null) {
  47683. this.onError(XMLParserErrorCode.MalformedElement);
  47684. return;
  47685. }
  47686. let isClosed = false;
  47687. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47688. isClosed = true;
  47689. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47690. this.onError(XMLParserErrorCode.UnterminatedElement);
  47691. return;
  47692. }
  47693. this.onBeginElement(content.name, content.attributes, isClosed);
  47694. j += content.parsed + (isClosed ? 2 : 1);
  47695. break;
  47696. }
  47697. } else {
  47698. while (j < s.length && s[j] !== "<") {
  47699. j++;
  47700. }
  47701. const text = s.substring(i, j);
  47702. this.onText(this._resolveEntities(text));
  47703. }
  47704. i = j;
  47705. }
  47706. }
  47707. onResolveEntity(name) {
  47708. return `&${name};`;
  47709. }
  47710. onPi(name, value) {}
  47711. onComment(text) {}
  47712. onCdata(text) {}
  47713. onDoctype(doctypeContent) {}
  47714. onText(text) {}
  47715. onBeginElement(name, attributes, isEmpty) {}
  47716. onEndElement(name) {}
  47717. onError(code) {}
  47718. }
  47719. exports.XMLParserBase = XMLParserBase;
  47720. class SimpleDOMNode {
  47721. constructor(nodeName, nodeValue) {
  47722. this.nodeName = nodeName;
  47723. this.nodeValue = nodeValue;
  47724. Object.defineProperty(this, "parentNode", {
  47725. value: null,
  47726. writable: true
  47727. });
  47728. }
  47729. get firstChild() {
  47730. return this.childNodes && this.childNodes[0];
  47731. }
  47732. get nextSibling() {
  47733. const childNodes = this.parentNode.childNodes;
  47734. if (!childNodes) {
  47735. return undefined;
  47736. }
  47737. const index = childNodes.indexOf(this);
  47738. if (index === -1) {
  47739. return undefined;
  47740. }
  47741. return childNodes[index + 1];
  47742. }
  47743. get textContent() {
  47744. if (!this.childNodes) {
  47745. return this.nodeValue || "";
  47746. }
  47747. return this.childNodes.map(function (child) {
  47748. return child.textContent;
  47749. }).join("");
  47750. }
  47751. get children() {
  47752. return this.childNodes || [];
  47753. }
  47754. hasChildNodes() {
  47755. return this.childNodes && this.childNodes.length > 0;
  47756. }
  47757. searchNode(paths, pos) {
  47758. if (pos >= paths.length) {
  47759. return this;
  47760. }
  47761. const component = paths[pos];
  47762. const stack = [];
  47763. let node = this;
  47764. while (true) {
  47765. if (component.name === node.nodeName) {
  47766. if (component.pos === 0) {
  47767. const res = node.searchNode(paths, pos + 1);
  47768. if (res !== null) {
  47769. return res;
  47770. }
  47771. } else if (stack.length === 0) {
  47772. return null;
  47773. } else {
  47774. const [parent] = stack.pop();
  47775. let siblingPos = 0;
  47776. for (const child of parent.childNodes) {
  47777. if (component.name === child.nodeName) {
  47778. if (siblingPos === component.pos) {
  47779. return child.searchNode(paths, pos + 1);
  47780. }
  47781. siblingPos++;
  47782. }
  47783. }
  47784. return node.searchNode(paths, pos + 1);
  47785. }
  47786. }
  47787. if (node.childNodes && node.childNodes.length !== 0) {
  47788. stack.push([node, 0]);
  47789. node = node.childNodes[0];
  47790. } else if (stack.length === 0) {
  47791. return null;
  47792. } else {
  47793. while (stack.length !== 0) {
  47794. const [parent, currentPos] = stack.pop();
  47795. const newPos = currentPos + 1;
  47796. if (newPos < parent.childNodes.length) {
  47797. stack.push([parent, newPos]);
  47798. node = parent.childNodes[newPos];
  47799. break;
  47800. }
  47801. }
  47802. if (stack.length === 0) {
  47803. return null;
  47804. }
  47805. }
  47806. }
  47807. }
  47808. dump(buffer) {
  47809. if (this.nodeName === "#text") {
  47810. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47811. return;
  47812. }
  47813. buffer.push(`<${this.nodeName}`);
  47814. if (this.attributes) {
  47815. for (const attribute of this.attributes) {
  47816. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47817. }
  47818. }
  47819. if (this.hasChildNodes()) {
  47820. buffer.push(">");
  47821. for (const child of this.childNodes) {
  47822. child.dump(buffer);
  47823. }
  47824. buffer.push(`</${this.nodeName}>`);
  47825. } else if (this.nodeValue) {
  47826. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47827. } else {
  47828. buffer.push("/>");
  47829. }
  47830. }
  47831. }
  47832. exports.SimpleDOMNode = SimpleDOMNode;
  47833. class SimpleXMLParser extends XMLParserBase {
  47834. constructor({
  47835. hasAttributes = false,
  47836. lowerCaseName = false
  47837. }) {
  47838. super();
  47839. this._currentFragment = null;
  47840. this._stack = null;
  47841. this._errorCode = XMLParserErrorCode.NoError;
  47842. this._hasAttributes = hasAttributes;
  47843. this._lowerCaseName = lowerCaseName;
  47844. }
  47845. parseFromString(data) {
  47846. this._currentFragment = [];
  47847. this._stack = [];
  47848. this._errorCode = XMLParserErrorCode.NoError;
  47849. this.parseXml(data);
  47850. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47851. return undefined;
  47852. }
  47853. const [documentElement] = this._currentFragment;
  47854. if (!documentElement) {
  47855. return undefined;
  47856. }
  47857. return {
  47858. documentElement
  47859. };
  47860. }
  47861. onText(text) {
  47862. if (isWhitespaceString(text)) {
  47863. return;
  47864. }
  47865. const node = new SimpleDOMNode("#text", text);
  47866. this._currentFragment.push(node);
  47867. }
  47868. onCdata(text) {
  47869. const node = new SimpleDOMNode("#text", text);
  47870. this._currentFragment.push(node);
  47871. }
  47872. onBeginElement(name, attributes, isEmpty) {
  47873. if (this._lowerCaseName) {
  47874. name = name.toLowerCase();
  47875. }
  47876. const node = new SimpleDOMNode(name);
  47877. node.childNodes = [];
  47878. if (this._hasAttributes) {
  47879. node.attributes = attributes;
  47880. }
  47881. this._currentFragment.push(node);
  47882. if (isEmpty) {
  47883. return;
  47884. }
  47885. this._stack.push(this._currentFragment);
  47886. this._currentFragment = node.childNodes;
  47887. }
  47888. onEndElement(name) {
  47889. this._currentFragment = this._stack.pop() || [];
  47890. const lastElement = this._currentFragment.at(-1);
  47891. if (!lastElement) {
  47892. return null;
  47893. }
  47894. for (const childNode of lastElement.childNodes) {
  47895. childNode.parentNode = lastElement;
  47896. }
  47897. return lastElement;
  47898. }
  47899. onError(code) {
  47900. this._errorCode = code;
  47901. }
  47902. }
  47903. exports.SimpleXMLParser = SimpleXMLParser;
  47904. /***/ }),
  47905. /* 65 */
  47906. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47907. Object.defineProperty(exports, "__esModule", ({
  47908. value: true
  47909. }));
  47910. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  47911. exports.calculateSHA384 = calculateSHA384;
  47912. exports.calculateSHA512 = void 0;
  47913. var _util = __w_pdfjs_require__(2);
  47914. var _primitives = __w_pdfjs_require__(3);
  47915. var _decrypt_stream = __w_pdfjs_require__(66);
  47916. class ARCFourCipher {
  47917. constructor(key) {
  47918. this.a = 0;
  47919. this.b = 0;
  47920. const s = new Uint8Array(256);
  47921. const keyLength = key.length;
  47922. for (let i = 0; i < 256; ++i) {
  47923. s[i] = i;
  47924. }
  47925. for (let i = 0, j = 0; i < 256; ++i) {
  47926. const tmp = s[i];
  47927. j = j + tmp + key[i % keyLength] & 0xff;
  47928. s[i] = s[j];
  47929. s[j] = tmp;
  47930. }
  47931. this.s = s;
  47932. }
  47933. encryptBlock(data) {
  47934. let a = this.a,
  47935. b = this.b;
  47936. const s = this.s;
  47937. const n = data.length;
  47938. const output = new Uint8Array(n);
  47939. for (let i = 0; i < n; ++i) {
  47940. a = a + 1 & 0xff;
  47941. const tmp = s[a];
  47942. b = b + tmp & 0xff;
  47943. const tmp2 = s[b];
  47944. s[a] = tmp2;
  47945. s[b] = tmp;
  47946. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  47947. }
  47948. this.a = a;
  47949. this.b = b;
  47950. return output;
  47951. }
  47952. decryptBlock(data) {
  47953. return this.encryptBlock(data);
  47954. }
  47955. encrypt(data) {
  47956. return this.encryptBlock(data);
  47957. }
  47958. }
  47959. exports.ARCFourCipher = ARCFourCipher;
  47960. const calculateMD5 = function calculateMD5Closure() {
  47961. 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]);
  47962. 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]);
  47963. function hash(data, offset, length) {
  47964. let h0 = 1732584193,
  47965. h1 = -271733879,
  47966. h2 = -1732584194,
  47967. h3 = 271733878;
  47968. const paddedLength = length + 72 & ~63;
  47969. const padded = new Uint8Array(paddedLength);
  47970. let i, j;
  47971. for (i = 0; i < length; ++i) {
  47972. padded[i] = data[offset++];
  47973. }
  47974. padded[i++] = 0x80;
  47975. const n = paddedLength - 8;
  47976. while (i < n) {
  47977. padded[i++] = 0;
  47978. }
  47979. padded[i++] = length << 3 & 0xff;
  47980. padded[i++] = length >> 5 & 0xff;
  47981. padded[i++] = length >> 13 & 0xff;
  47982. padded[i++] = length >> 21 & 0xff;
  47983. padded[i++] = length >>> 29 & 0xff;
  47984. padded[i++] = 0;
  47985. padded[i++] = 0;
  47986. padded[i++] = 0;
  47987. const w = new Int32Array(16);
  47988. for (i = 0; i < paddedLength;) {
  47989. for (j = 0; j < 16; ++j, i += 4) {
  47990. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  47991. }
  47992. let a = h0,
  47993. b = h1,
  47994. c = h2,
  47995. d = h3,
  47996. f,
  47997. g;
  47998. for (j = 0; j < 64; ++j) {
  47999. if (j < 16) {
  48000. f = b & c | ~b & d;
  48001. g = j;
  48002. } else if (j < 32) {
  48003. f = d & b | ~d & c;
  48004. g = 5 * j + 1 & 15;
  48005. } else if (j < 48) {
  48006. f = b ^ c ^ d;
  48007. g = 3 * j + 5 & 15;
  48008. } else {
  48009. f = c ^ (b | ~d);
  48010. g = 7 * j & 15;
  48011. }
  48012. const tmp = d,
  48013. rotateArg = a + f + k[j] + w[g] | 0,
  48014. rotate = r[j];
  48015. d = c;
  48016. c = b;
  48017. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48018. a = tmp;
  48019. }
  48020. h0 = h0 + a | 0;
  48021. h1 = h1 + b | 0;
  48022. h2 = h2 + c | 0;
  48023. h3 = h3 + d | 0;
  48024. }
  48025. 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]);
  48026. }
  48027. return hash;
  48028. }();
  48029. exports.calculateMD5 = calculateMD5;
  48030. class Word64 {
  48031. constructor(highInteger, lowInteger) {
  48032. this.high = highInteger | 0;
  48033. this.low = lowInteger | 0;
  48034. }
  48035. and(word) {
  48036. this.high &= word.high;
  48037. this.low &= word.low;
  48038. }
  48039. xor(word) {
  48040. this.high ^= word.high;
  48041. this.low ^= word.low;
  48042. }
  48043. or(word) {
  48044. this.high |= word.high;
  48045. this.low |= word.low;
  48046. }
  48047. shiftRight(places) {
  48048. if (places >= 32) {
  48049. this.low = this.high >>> places - 32 | 0;
  48050. this.high = 0;
  48051. } else {
  48052. this.low = this.low >>> places | this.high << 32 - places;
  48053. this.high = this.high >>> places | 0;
  48054. }
  48055. }
  48056. shiftLeft(places) {
  48057. if (places >= 32) {
  48058. this.high = this.low << places - 32;
  48059. this.low = 0;
  48060. } else {
  48061. this.high = this.high << places | this.low >>> 32 - places;
  48062. this.low <<= places;
  48063. }
  48064. }
  48065. rotateRight(places) {
  48066. let low, high;
  48067. if (places & 32) {
  48068. high = this.low;
  48069. low = this.high;
  48070. } else {
  48071. low = this.low;
  48072. high = this.high;
  48073. }
  48074. places &= 31;
  48075. this.low = low >>> places | high << 32 - places;
  48076. this.high = high >>> places | low << 32 - places;
  48077. }
  48078. not() {
  48079. this.high = ~this.high;
  48080. this.low = ~this.low;
  48081. }
  48082. add(word) {
  48083. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48084. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48085. if (lowAdd > 0xffffffff) {
  48086. highAdd += 1;
  48087. }
  48088. this.low = lowAdd | 0;
  48089. this.high = highAdd | 0;
  48090. }
  48091. copyTo(bytes, offset) {
  48092. bytes[offset] = this.high >>> 24 & 0xff;
  48093. bytes[offset + 1] = this.high >> 16 & 0xff;
  48094. bytes[offset + 2] = this.high >> 8 & 0xff;
  48095. bytes[offset + 3] = this.high & 0xff;
  48096. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48097. bytes[offset + 5] = this.low >> 16 & 0xff;
  48098. bytes[offset + 6] = this.low >> 8 & 0xff;
  48099. bytes[offset + 7] = this.low & 0xff;
  48100. }
  48101. assign(word) {
  48102. this.high = word.high;
  48103. this.low = word.low;
  48104. }
  48105. }
  48106. const calculateSHA256 = function calculateSHA256Closure() {
  48107. function rotr(x, n) {
  48108. return x >>> n | x << 32 - n;
  48109. }
  48110. function ch(x, y, z) {
  48111. return x & y ^ ~x & z;
  48112. }
  48113. function maj(x, y, z) {
  48114. return x & y ^ x & z ^ y & z;
  48115. }
  48116. function sigma(x) {
  48117. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48118. }
  48119. function sigmaPrime(x) {
  48120. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48121. }
  48122. function littleSigma(x) {
  48123. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48124. }
  48125. function littleSigmaPrime(x) {
  48126. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48127. }
  48128. 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];
  48129. function hash(data, offset, length) {
  48130. let h0 = 0x6a09e667,
  48131. h1 = 0xbb67ae85,
  48132. h2 = 0x3c6ef372,
  48133. h3 = 0xa54ff53a,
  48134. h4 = 0x510e527f,
  48135. h5 = 0x9b05688c,
  48136. h6 = 0x1f83d9ab,
  48137. h7 = 0x5be0cd19;
  48138. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48139. const padded = new Uint8Array(paddedLength);
  48140. let i, j;
  48141. for (i = 0; i < length; ++i) {
  48142. padded[i] = data[offset++];
  48143. }
  48144. padded[i++] = 0x80;
  48145. const n = paddedLength - 8;
  48146. while (i < n) {
  48147. padded[i++] = 0;
  48148. }
  48149. padded[i++] = 0;
  48150. padded[i++] = 0;
  48151. padded[i++] = 0;
  48152. padded[i++] = length >>> 29 & 0xff;
  48153. padded[i++] = length >> 21 & 0xff;
  48154. padded[i++] = length >> 13 & 0xff;
  48155. padded[i++] = length >> 5 & 0xff;
  48156. padded[i++] = length << 3 & 0xff;
  48157. const w = new Uint32Array(64);
  48158. for (i = 0; i < paddedLength;) {
  48159. for (j = 0; j < 16; ++j) {
  48160. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48161. i += 4;
  48162. }
  48163. for (j = 16; j < 64; ++j) {
  48164. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48165. }
  48166. let a = h0,
  48167. b = h1,
  48168. c = h2,
  48169. d = h3,
  48170. e = h4,
  48171. f = h5,
  48172. g = h6,
  48173. h = h7,
  48174. t1,
  48175. t2;
  48176. for (j = 0; j < 64; ++j) {
  48177. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48178. t2 = sigma(a) + maj(a, b, c);
  48179. h = g;
  48180. g = f;
  48181. f = e;
  48182. e = d + t1 | 0;
  48183. d = c;
  48184. c = b;
  48185. b = a;
  48186. a = t1 + t2 | 0;
  48187. }
  48188. h0 = h0 + a | 0;
  48189. h1 = h1 + b | 0;
  48190. h2 = h2 + c | 0;
  48191. h3 = h3 + d | 0;
  48192. h4 = h4 + e | 0;
  48193. h5 = h5 + f | 0;
  48194. h6 = h6 + g | 0;
  48195. h7 = h7 + h | 0;
  48196. }
  48197. 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]);
  48198. }
  48199. return hash;
  48200. }();
  48201. exports.calculateSHA256 = calculateSHA256;
  48202. const calculateSHA512 = function calculateSHA512Closure() {
  48203. function ch(result, x, y, z, tmp) {
  48204. result.assign(x);
  48205. result.and(y);
  48206. tmp.assign(x);
  48207. tmp.not();
  48208. tmp.and(z);
  48209. result.xor(tmp);
  48210. }
  48211. function maj(result, x, y, z, tmp) {
  48212. result.assign(x);
  48213. result.and(y);
  48214. tmp.assign(x);
  48215. tmp.and(z);
  48216. result.xor(tmp);
  48217. tmp.assign(y);
  48218. tmp.and(z);
  48219. result.xor(tmp);
  48220. }
  48221. function sigma(result, x, tmp) {
  48222. result.assign(x);
  48223. result.rotateRight(28);
  48224. tmp.assign(x);
  48225. tmp.rotateRight(34);
  48226. result.xor(tmp);
  48227. tmp.assign(x);
  48228. tmp.rotateRight(39);
  48229. result.xor(tmp);
  48230. }
  48231. function sigmaPrime(result, x, tmp) {
  48232. result.assign(x);
  48233. result.rotateRight(14);
  48234. tmp.assign(x);
  48235. tmp.rotateRight(18);
  48236. result.xor(tmp);
  48237. tmp.assign(x);
  48238. tmp.rotateRight(41);
  48239. result.xor(tmp);
  48240. }
  48241. function littleSigma(result, x, tmp) {
  48242. result.assign(x);
  48243. result.rotateRight(1);
  48244. tmp.assign(x);
  48245. tmp.rotateRight(8);
  48246. result.xor(tmp);
  48247. tmp.assign(x);
  48248. tmp.shiftRight(7);
  48249. result.xor(tmp);
  48250. }
  48251. function littleSigmaPrime(result, x, tmp) {
  48252. result.assign(x);
  48253. result.rotateRight(19);
  48254. tmp.assign(x);
  48255. tmp.rotateRight(61);
  48256. result.xor(tmp);
  48257. tmp.assign(x);
  48258. tmp.shiftRight(6);
  48259. result.xor(tmp);
  48260. }
  48261. 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)];
  48262. function hash(data, offset, length, mode384 = false) {
  48263. let h0, h1, h2, h3, h4, h5, h6, h7;
  48264. if (!mode384) {
  48265. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48266. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48267. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48268. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48269. h4 = new Word64(0x510e527f, 0xade682d1);
  48270. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48271. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48272. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48273. } else {
  48274. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48275. h1 = new Word64(0x629a292a, 0x367cd507);
  48276. h2 = new Word64(0x9159015a, 0x3070dd17);
  48277. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48278. h4 = new Word64(0x67332667, 0xffc00b31);
  48279. h5 = new Word64(0x8eb44a87, 0x68581511);
  48280. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48281. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48282. }
  48283. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48284. const padded = new Uint8Array(paddedLength);
  48285. let i, j;
  48286. for (i = 0; i < length; ++i) {
  48287. padded[i] = data[offset++];
  48288. }
  48289. padded[i++] = 0x80;
  48290. const n = paddedLength - 16;
  48291. while (i < n) {
  48292. padded[i++] = 0;
  48293. }
  48294. padded[i++] = 0;
  48295. padded[i++] = 0;
  48296. padded[i++] = 0;
  48297. padded[i++] = 0;
  48298. padded[i++] = 0;
  48299. padded[i++] = 0;
  48300. padded[i++] = 0;
  48301. padded[i++] = 0;
  48302. padded[i++] = 0;
  48303. padded[i++] = 0;
  48304. padded[i++] = 0;
  48305. padded[i++] = length >>> 29 & 0xff;
  48306. padded[i++] = length >> 21 & 0xff;
  48307. padded[i++] = length >> 13 & 0xff;
  48308. padded[i++] = length >> 5 & 0xff;
  48309. padded[i++] = length << 3 & 0xff;
  48310. const w = new Array(80);
  48311. for (i = 0; i < 80; i++) {
  48312. w[i] = new Word64(0, 0);
  48313. }
  48314. let a = new Word64(0, 0),
  48315. b = new Word64(0, 0),
  48316. c = new Word64(0, 0);
  48317. let d = new Word64(0, 0),
  48318. e = new Word64(0, 0),
  48319. f = new Word64(0, 0);
  48320. let g = new Word64(0, 0),
  48321. h = new Word64(0, 0);
  48322. const t1 = new Word64(0, 0),
  48323. t2 = new Word64(0, 0);
  48324. const tmp1 = new Word64(0, 0),
  48325. tmp2 = new Word64(0, 0);
  48326. let tmp3;
  48327. for (i = 0; i < paddedLength;) {
  48328. for (j = 0; j < 16; ++j) {
  48329. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48330. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48331. i += 8;
  48332. }
  48333. for (j = 16; j < 80; ++j) {
  48334. tmp3 = w[j];
  48335. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48336. tmp3.add(w[j - 7]);
  48337. littleSigma(tmp1, w[j - 15], tmp2);
  48338. tmp3.add(tmp1);
  48339. tmp3.add(w[j - 16]);
  48340. }
  48341. a.assign(h0);
  48342. b.assign(h1);
  48343. c.assign(h2);
  48344. d.assign(h3);
  48345. e.assign(h4);
  48346. f.assign(h5);
  48347. g.assign(h6);
  48348. h.assign(h7);
  48349. for (j = 0; j < 80; ++j) {
  48350. t1.assign(h);
  48351. sigmaPrime(tmp1, e, tmp2);
  48352. t1.add(tmp1);
  48353. ch(tmp1, e, f, g, tmp2);
  48354. t1.add(tmp1);
  48355. t1.add(k[j]);
  48356. t1.add(w[j]);
  48357. sigma(t2, a, tmp2);
  48358. maj(tmp1, a, b, c, tmp2);
  48359. t2.add(tmp1);
  48360. tmp3 = h;
  48361. h = g;
  48362. g = f;
  48363. f = e;
  48364. d.add(t1);
  48365. e = d;
  48366. d = c;
  48367. c = b;
  48368. b = a;
  48369. tmp3.assign(t1);
  48370. tmp3.add(t2);
  48371. a = tmp3;
  48372. }
  48373. h0.add(a);
  48374. h1.add(b);
  48375. h2.add(c);
  48376. h3.add(d);
  48377. h4.add(e);
  48378. h5.add(f);
  48379. h6.add(g);
  48380. h7.add(h);
  48381. }
  48382. let result;
  48383. if (!mode384) {
  48384. result = new Uint8Array(64);
  48385. h0.copyTo(result, 0);
  48386. h1.copyTo(result, 8);
  48387. h2.copyTo(result, 16);
  48388. h3.copyTo(result, 24);
  48389. h4.copyTo(result, 32);
  48390. h5.copyTo(result, 40);
  48391. h6.copyTo(result, 48);
  48392. h7.copyTo(result, 56);
  48393. } else {
  48394. result = new Uint8Array(48);
  48395. h0.copyTo(result, 0);
  48396. h1.copyTo(result, 8);
  48397. h2.copyTo(result, 16);
  48398. h3.copyTo(result, 24);
  48399. h4.copyTo(result, 32);
  48400. h5.copyTo(result, 40);
  48401. }
  48402. return result;
  48403. }
  48404. return hash;
  48405. }();
  48406. exports.calculateSHA512 = calculateSHA512;
  48407. function calculateSHA384(data, offset, length) {
  48408. return calculateSHA512(data, offset, length, true);
  48409. }
  48410. class NullCipher {
  48411. decryptBlock(data) {
  48412. return data;
  48413. }
  48414. encrypt(data) {
  48415. return data;
  48416. }
  48417. }
  48418. class AESBaseCipher {
  48419. constructor() {
  48420. if (this.constructor === AESBaseCipher) {
  48421. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48422. }
  48423. 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]);
  48424. 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]);
  48425. 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]);
  48426. this._mixCol = new Uint8Array(256);
  48427. for (let i = 0; i < 256; i++) {
  48428. if (i < 128) {
  48429. this._mixCol[i] = i << 1;
  48430. } else {
  48431. this._mixCol[i] = i << 1 ^ 0x1b;
  48432. }
  48433. }
  48434. this.buffer = new Uint8Array(16);
  48435. this.bufferPosition = 0;
  48436. }
  48437. _expandKey(cipherKey) {
  48438. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48439. }
  48440. _decrypt(input, key) {
  48441. let t, u, v;
  48442. const state = new Uint8Array(16);
  48443. state.set(input);
  48444. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48445. state[j] ^= key[k];
  48446. }
  48447. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48448. t = state[13];
  48449. state[13] = state[9];
  48450. state[9] = state[5];
  48451. state[5] = state[1];
  48452. state[1] = t;
  48453. t = state[14];
  48454. u = state[10];
  48455. state[14] = state[6];
  48456. state[10] = state[2];
  48457. state[6] = t;
  48458. state[2] = u;
  48459. t = state[15];
  48460. u = state[11];
  48461. v = state[7];
  48462. state[15] = state[3];
  48463. state[11] = t;
  48464. state[7] = u;
  48465. state[3] = v;
  48466. for (let j = 0; j < 16; ++j) {
  48467. state[j] = this._inv_s[state[j]];
  48468. }
  48469. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48470. state[j] ^= key[k];
  48471. }
  48472. for (let j = 0; j < 16; j += 4) {
  48473. const s0 = this._mix[state[j]];
  48474. const s1 = this._mix[state[j + 1]];
  48475. const s2 = this._mix[state[j + 2]];
  48476. const s3 = this._mix[state[j + 3]];
  48477. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48478. state[j] = t >>> 24 & 0xff;
  48479. state[j + 1] = t >> 16 & 0xff;
  48480. state[j + 2] = t >> 8 & 0xff;
  48481. state[j + 3] = t & 0xff;
  48482. }
  48483. }
  48484. t = state[13];
  48485. state[13] = state[9];
  48486. state[9] = state[5];
  48487. state[5] = state[1];
  48488. state[1] = t;
  48489. t = state[14];
  48490. u = state[10];
  48491. state[14] = state[6];
  48492. state[10] = state[2];
  48493. state[6] = t;
  48494. state[2] = u;
  48495. t = state[15];
  48496. u = state[11];
  48497. v = state[7];
  48498. state[15] = state[3];
  48499. state[11] = t;
  48500. state[7] = u;
  48501. state[3] = v;
  48502. for (let j = 0; j < 16; ++j) {
  48503. state[j] = this._inv_s[state[j]];
  48504. state[j] ^= key[j];
  48505. }
  48506. return state;
  48507. }
  48508. _encrypt(input, key) {
  48509. const s = this._s;
  48510. let t, u, v;
  48511. const state = new Uint8Array(16);
  48512. state.set(input);
  48513. for (let j = 0; j < 16; ++j) {
  48514. state[j] ^= key[j];
  48515. }
  48516. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48517. for (let j = 0; j < 16; ++j) {
  48518. state[j] = s[state[j]];
  48519. }
  48520. v = state[1];
  48521. state[1] = state[5];
  48522. state[5] = state[9];
  48523. state[9] = state[13];
  48524. state[13] = v;
  48525. v = state[2];
  48526. u = state[6];
  48527. state[2] = state[10];
  48528. state[6] = state[14];
  48529. state[10] = v;
  48530. state[14] = u;
  48531. v = state[3];
  48532. u = state[7];
  48533. t = state[11];
  48534. state[3] = state[15];
  48535. state[7] = v;
  48536. state[11] = u;
  48537. state[15] = t;
  48538. for (let j = 0; j < 16; j += 4) {
  48539. const s0 = state[j + 0];
  48540. const s1 = state[j + 1];
  48541. const s2 = state[j + 2];
  48542. const s3 = state[j + 3];
  48543. t = s0 ^ s1 ^ s2 ^ s3;
  48544. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48545. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48546. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48547. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48548. }
  48549. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48550. state[j] ^= key[k];
  48551. }
  48552. }
  48553. for (let j = 0; j < 16; ++j) {
  48554. state[j] = s[state[j]];
  48555. }
  48556. v = state[1];
  48557. state[1] = state[5];
  48558. state[5] = state[9];
  48559. state[9] = state[13];
  48560. state[13] = v;
  48561. v = state[2];
  48562. u = state[6];
  48563. state[2] = state[10];
  48564. state[6] = state[14];
  48565. state[10] = v;
  48566. state[14] = u;
  48567. v = state[3];
  48568. u = state[7];
  48569. t = state[11];
  48570. state[3] = state[15];
  48571. state[7] = v;
  48572. state[11] = u;
  48573. state[15] = t;
  48574. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48575. state[j] ^= key[k];
  48576. }
  48577. return state;
  48578. }
  48579. _decryptBlock2(data, finalize) {
  48580. const sourceLength = data.length;
  48581. let buffer = this.buffer,
  48582. bufferLength = this.bufferPosition;
  48583. const result = [];
  48584. let iv = this.iv;
  48585. for (let i = 0; i < sourceLength; ++i) {
  48586. buffer[bufferLength] = data[i];
  48587. ++bufferLength;
  48588. if (bufferLength < 16) {
  48589. continue;
  48590. }
  48591. const plain = this._decrypt(buffer, this._key);
  48592. for (let j = 0; j < 16; ++j) {
  48593. plain[j] ^= iv[j];
  48594. }
  48595. iv = buffer;
  48596. result.push(plain);
  48597. buffer = new Uint8Array(16);
  48598. bufferLength = 0;
  48599. }
  48600. this.buffer = buffer;
  48601. this.bufferLength = bufferLength;
  48602. this.iv = iv;
  48603. if (result.length === 0) {
  48604. return new Uint8Array(0);
  48605. }
  48606. let outputLength = 16 * result.length;
  48607. if (finalize) {
  48608. const lastBlock = result.at(-1);
  48609. let psLen = lastBlock[15];
  48610. if (psLen <= 16) {
  48611. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  48612. if (lastBlock[i] !== psLen) {
  48613. psLen = 0;
  48614. break;
  48615. }
  48616. }
  48617. outputLength -= psLen;
  48618. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  48619. }
  48620. }
  48621. const output = new Uint8Array(outputLength);
  48622. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48623. output.set(result[i], j);
  48624. }
  48625. return output;
  48626. }
  48627. decryptBlock(data, finalize, iv = null) {
  48628. const sourceLength = data.length;
  48629. const buffer = this.buffer;
  48630. let bufferLength = this.bufferPosition;
  48631. if (iv) {
  48632. this.iv = iv;
  48633. } else {
  48634. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  48635. buffer[bufferLength] = data[i];
  48636. }
  48637. if (bufferLength < 16) {
  48638. this.bufferLength = bufferLength;
  48639. return new Uint8Array(0);
  48640. }
  48641. this.iv = buffer;
  48642. data = data.subarray(16);
  48643. }
  48644. this.buffer = new Uint8Array(16);
  48645. this.bufferLength = 0;
  48646. this.decryptBlock = this._decryptBlock2;
  48647. return this.decryptBlock(data, finalize);
  48648. }
  48649. encrypt(data, iv) {
  48650. const sourceLength = data.length;
  48651. let buffer = this.buffer,
  48652. bufferLength = this.bufferPosition;
  48653. const result = [];
  48654. if (!iv) {
  48655. iv = new Uint8Array(16);
  48656. }
  48657. for (let i = 0; i < sourceLength; ++i) {
  48658. buffer[bufferLength] = data[i];
  48659. ++bufferLength;
  48660. if (bufferLength < 16) {
  48661. continue;
  48662. }
  48663. for (let j = 0; j < 16; ++j) {
  48664. buffer[j] ^= iv[j];
  48665. }
  48666. const cipher = this._encrypt(buffer, this._key);
  48667. iv = cipher;
  48668. result.push(cipher);
  48669. buffer = new Uint8Array(16);
  48670. bufferLength = 0;
  48671. }
  48672. this.buffer = buffer;
  48673. this.bufferLength = bufferLength;
  48674. this.iv = iv;
  48675. if (result.length === 0) {
  48676. return new Uint8Array(0);
  48677. }
  48678. const outputLength = 16 * result.length;
  48679. const output = new Uint8Array(outputLength);
  48680. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48681. output.set(result[i], j);
  48682. }
  48683. return output;
  48684. }
  48685. }
  48686. class AES128Cipher extends AESBaseCipher {
  48687. constructor(key) {
  48688. super();
  48689. this._cyclesOfRepetition = 10;
  48690. this._keySize = 160;
  48691. 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]);
  48692. this._key = this._expandKey(key);
  48693. }
  48694. _expandKey(cipherKey) {
  48695. const b = 176;
  48696. const s = this._s;
  48697. const rcon = this._rcon;
  48698. const result = new Uint8Array(b);
  48699. result.set(cipherKey);
  48700. for (let j = 16, i = 1; j < b; ++i) {
  48701. let t1 = result[j - 3];
  48702. let t2 = result[j - 2];
  48703. let t3 = result[j - 1];
  48704. let t4 = result[j - 4];
  48705. t1 = s[t1];
  48706. t2 = s[t2];
  48707. t3 = s[t3];
  48708. t4 = s[t4];
  48709. t1 ^= rcon[i];
  48710. for (let n = 0; n < 4; ++n) {
  48711. result[j] = t1 ^= result[j - 16];
  48712. j++;
  48713. result[j] = t2 ^= result[j - 16];
  48714. j++;
  48715. result[j] = t3 ^= result[j - 16];
  48716. j++;
  48717. result[j] = t4 ^= result[j - 16];
  48718. j++;
  48719. }
  48720. }
  48721. return result;
  48722. }
  48723. }
  48724. exports.AES128Cipher = AES128Cipher;
  48725. class AES256Cipher extends AESBaseCipher {
  48726. constructor(key) {
  48727. super();
  48728. this._cyclesOfRepetition = 14;
  48729. this._keySize = 224;
  48730. this._key = this._expandKey(key);
  48731. }
  48732. _expandKey(cipherKey) {
  48733. const b = 240;
  48734. const s = this._s;
  48735. const result = new Uint8Array(b);
  48736. result.set(cipherKey);
  48737. let r = 1;
  48738. let t1, t2, t3, t4;
  48739. for (let j = 32, i = 1; j < b; ++i) {
  48740. if (j % 32 === 16) {
  48741. t1 = s[t1];
  48742. t2 = s[t2];
  48743. t3 = s[t3];
  48744. t4 = s[t4];
  48745. } else if (j % 32 === 0) {
  48746. t1 = result[j - 3];
  48747. t2 = result[j - 2];
  48748. t3 = result[j - 1];
  48749. t4 = result[j - 4];
  48750. t1 = s[t1];
  48751. t2 = s[t2];
  48752. t3 = s[t3];
  48753. t4 = s[t4];
  48754. t1 ^= r;
  48755. if ((r <<= 1) >= 256) {
  48756. r = (r ^ 0x1b) & 0xff;
  48757. }
  48758. }
  48759. for (let n = 0; n < 4; ++n) {
  48760. result[j] = t1 ^= result[j - 32];
  48761. j++;
  48762. result[j] = t2 ^= result[j - 32];
  48763. j++;
  48764. result[j] = t3 ^= result[j - 32];
  48765. j++;
  48766. result[j] = t4 ^= result[j - 32];
  48767. j++;
  48768. }
  48769. }
  48770. return result;
  48771. }
  48772. }
  48773. exports.AES256Cipher = AES256Cipher;
  48774. class PDF17 {
  48775. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48776. const hashData = new Uint8Array(password.length + 56);
  48777. hashData.set(password, 0);
  48778. hashData.set(ownerValidationSalt, password.length);
  48779. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48780. const result = calculateSHA256(hashData, 0, hashData.length);
  48781. return (0, _util.isArrayEqual)(result, ownerPassword);
  48782. }
  48783. checkUserPassword(password, userValidationSalt, userPassword) {
  48784. const hashData = new Uint8Array(password.length + 8);
  48785. hashData.set(password, 0);
  48786. hashData.set(userValidationSalt, password.length);
  48787. const result = calculateSHA256(hashData, 0, hashData.length);
  48788. return (0, _util.isArrayEqual)(result, userPassword);
  48789. }
  48790. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48791. const hashData = new Uint8Array(password.length + 56);
  48792. hashData.set(password, 0);
  48793. hashData.set(ownerKeySalt, password.length);
  48794. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48795. const key = calculateSHA256(hashData, 0, hashData.length);
  48796. const cipher = new AES256Cipher(key);
  48797. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48798. }
  48799. getUserKey(password, userKeySalt, userEncryption) {
  48800. const hashData = new Uint8Array(password.length + 8);
  48801. hashData.set(password, 0);
  48802. hashData.set(userKeySalt, password.length);
  48803. const key = calculateSHA256(hashData, 0, hashData.length);
  48804. const cipher = new AES256Cipher(key);
  48805. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48806. }
  48807. }
  48808. exports.PDF17 = PDF17;
  48809. const PDF20 = function PDF20Closure() {
  48810. function calculatePDF20Hash(password, input, userBytes) {
  48811. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  48812. let e = [0];
  48813. let i = 0;
  48814. while (i < 64 || e.at(-1) > i - 32) {
  48815. const combinedLength = password.length + k.length + userBytes.length,
  48816. combinedArray = new Uint8Array(combinedLength);
  48817. let writeOffset = 0;
  48818. combinedArray.set(password, writeOffset);
  48819. writeOffset += password.length;
  48820. combinedArray.set(k, writeOffset);
  48821. writeOffset += k.length;
  48822. combinedArray.set(userBytes, writeOffset);
  48823. const k1 = new Uint8Array(combinedLength * 64);
  48824. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  48825. k1.set(combinedArray, pos);
  48826. }
  48827. const cipher = new AES128Cipher(k.subarray(0, 16));
  48828. e = cipher.encrypt(k1, k.subarray(16, 32));
  48829. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  48830. if (remainder === 0) {
  48831. k = calculateSHA256(e, 0, e.length);
  48832. } else if (remainder === 1) {
  48833. k = calculateSHA384(e, 0, e.length);
  48834. } else if (remainder === 2) {
  48835. k = calculateSHA512(e, 0, e.length);
  48836. }
  48837. i++;
  48838. }
  48839. return k.subarray(0, 32);
  48840. }
  48841. class PDF20 {
  48842. hash(password, concatBytes, userBytes) {
  48843. return calculatePDF20Hash(password, concatBytes, userBytes);
  48844. }
  48845. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48846. const hashData = new Uint8Array(password.length + 56);
  48847. hashData.set(password, 0);
  48848. hashData.set(ownerValidationSalt, password.length);
  48849. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48850. const result = calculatePDF20Hash(password, hashData, userBytes);
  48851. return (0, _util.isArrayEqual)(result, ownerPassword);
  48852. }
  48853. checkUserPassword(password, userValidationSalt, userPassword) {
  48854. const hashData = new Uint8Array(password.length + 8);
  48855. hashData.set(password, 0);
  48856. hashData.set(userValidationSalt, password.length);
  48857. const result = calculatePDF20Hash(password, hashData, []);
  48858. return (0, _util.isArrayEqual)(result, userPassword);
  48859. }
  48860. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48861. const hashData = new Uint8Array(password.length + 56);
  48862. hashData.set(password, 0);
  48863. hashData.set(ownerKeySalt, password.length);
  48864. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48865. const key = calculatePDF20Hash(password, hashData, userBytes);
  48866. const cipher = new AES256Cipher(key);
  48867. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48868. }
  48869. getUserKey(password, userKeySalt, userEncryption) {
  48870. const hashData = new Uint8Array(password.length + 8);
  48871. hashData.set(password, 0);
  48872. hashData.set(userKeySalt, password.length);
  48873. const key = calculatePDF20Hash(password, hashData, []);
  48874. const cipher = new AES256Cipher(key);
  48875. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48876. }
  48877. }
  48878. return PDF20;
  48879. }();
  48880. exports.PDF20 = PDF20;
  48881. class CipherTransform {
  48882. constructor(stringCipherConstructor, streamCipherConstructor) {
  48883. this.StringCipherConstructor = stringCipherConstructor;
  48884. this.StreamCipherConstructor = streamCipherConstructor;
  48885. }
  48886. createStream(stream, length) {
  48887. const cipher = new this.StreamCipherConstructor();
  48888. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  48889. return cipher.decryptBlock(data, finalize);
  48890. });
  48891. }
  48892. decryptString(s) {
  48893. const cipher = new this.StringCipherConstructor();
  48894. let data = (0, _util.stringToBytes)(s);
  48895. data = cipher.decryptBlock(data, true);
  48896. return (0, _util.bytesToString)(data);
  48897. }
  48898. encryptString(s) {
  48899. const cipher = new this.StringCipherConstructor();
  48900. if (cipher instanceof AESBaseCipher) {
  48901. const strLen = s.length;
  48902. const pad = 16 - strLen % 16;
  48903. s += String.fromCharCode(pad).repeat(pad);
  48904. const iv = new Uint8Array(16);
  48905. if (typeof crypto !== "undefined") {
  48906. crypto.getRandomValues(iv);
  48907. } else {
  48908. for (let i = 0; i < 16; i++) {
  48909. iv[i] = Math.floor(256 * Math.random());
  48910. }
  48911. }
  48912. let data = (0, _util.stringToBytes)(s);
  48913. data = cipher.encrypt(data, iv);
  48914. const buf = new Uint8Array(16 + data.length);
  48915. buf.set(iv);
  48916. buf.set(data, 16);
  48917. return (0, _util.bytesToString)(buf);
  48918. }
  48919. let data = (0, _util.stringToBytes)(s);
  48920. data = cipher.encrypt(data);
  48921. return (0, _util.bytesToString)(data);
  48922. }
  48923. }
  48924. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  48925. 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]);
  48926. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  48927. if (password) {
  48928. const passwordLength = Math.min(127, password.length);
  48929. password = password.subarray(0, passwordLength);
  48930. } else {
  48931. password = [];
  48932. }
  48933. let pdfAlgorithm;
  48934. if (revision === 6) {
  48935. pdfAlgorithm = new PDF20();
  48936. } else {
  48937. pdfAlgorithm = new PDF17();
  48938. }
  48939. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  48940. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  48941. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  48942. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  48943. }
  48944. return null;
  48945. }
  48946. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  48947. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  48948. const hashData = new Uint8Array(hashDataSize);
  48949. let i = 0,
  48950. j,
  48951. n;
  48952. if (password) {
  48953. n = Math.min(32, password.length);
  48954. for (; i < n; ++i) {
  48955. hashData[i] = password[i];
  48956. }
  48957. }
  48958. j = 0;
  48959. while (i < 32) {
  48960. hashData[i++] = defaultPasswordBytes[j++];
  48961. }
  48962. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  48963. hashData[i++] = ownerPassword[j];
  48964. }
  48965. hashData[i++] = flags & 0xff;
  48966. hashData[i++] = flags >> 8 & 0xff;
  48967. hashData[i++] = flags >> 16 & 0xff;
  48968. hashData[i++] = flags >>> 24 & 0xff;
  48969. for (j = 0, n = fileId.length; j < n; ++j) {
  48970. hashData[i++] = fileId[j];
  48971. }
  48972. if (revision >= 4 && !encryptMetadata) {
  48973. hashData[i++] = 0xff;
  48974. hashData[i++] = 0xff;
  48975. hashData[i++] = 0xff;
  48976. hashData[i++] = 0xff;
  48977. }
  48978. let hash = calculateMD5(hashData, 0, i);
  48979. const keyLengthInBytes = keyLength >> 3;
  48980. if (revision >= 3) {
  48981. for (j = 0; j < 50; ++j) {
  48982. hash = calculateMD5(hash, 0, keyLengthInBytes);
  48983. }
  48984. }
  48985. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  48986. let cipher, checkData;
  48987. if (revision >= 3) {
  48988. for (i = 0; i < 32; ++i) {
  48989. hashData[i] = defaultPasswordBytes[i];
  48990. }
  48991. for (j = 0, n = fileId.length; j < n; ++j) {
  48992. hashData[i++] = fileId[j];
  48993. }
  48994. cipher = new ARCFourCipher(encryptionKey);
  48995. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  48996. n = encryptionKey.length;
  48997. const derivedKey = new Uint8Array(n);
  48998. for (j = 1; j <= 19; ++j) {
  48999. for (let k = 0; k < n; ++k) {
  49000. derivedKey[k] = encryptionKey[k] ^ j;
  49001. }
  49002. cipher = new ARCFourCipher(derivedKey);
  49003. checkData = cipher.encryptBlock(checkData);
  49004. }
  49005. for (j = 0, n = checkData.length; j < n; ++j) {
  49006. if (userPassword[j] !== checkData[j]) {
  49007. return null;
  49008. }
  49009. }
  49010. } else {
  49011. cipher = new ARCFourCipher(encryptionKey);
  49012. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49013. for (j = 0, n = checkData.length; j < n; ++j) {
  49014. if (userPassword[j] !== checkData[j]) {
  49015. return null;
  49016. }
  49017. }
  49018. }
  49019. return encryptionKey;
  49020. }
  49021. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49022. const hashData = new Uint8Array(32);
  49023. let i = 0;
  49024. const n = Math.min(32, password.length);
  49025. for (; i < n; ++i) {
  49026. hashData[i] = password[i];
  49027. }
  49028. let j = 0;
  49029. while (i < 32) {
  49030. hashData[i++] = defaultPasswordBytes[j++];
  49031. }
  49032. let hash = calculateMD5(hashData, 0, i);
  49033. const keyLengthInBytes = keyLength >> 3;
  49034. if (revision >= 3) {
  49035. for (j = 0; j < 50; ++j) {
  49036. hash = calculateMD5(hash, 0, hash.length);
  49037. }
  49038. }
  49039. let cipher, userPassword;
  49040. if (revision >= 3) {
  49041. userPassword = ownerPassword;
  49042. const derivedKey = new Uint8Array(keyLengthInBytes);
  49043. for (j = 19; j >= 0; j--) {
  49044. for (let k = 0; k < keyLengthInBytes; ++k) {
  49045. derivedKey[k] = hash[k] ^ j;
  49046. }
  49047. cipher = new ARCFourCipher(derivedKey);
  49048. userPassword = cipher.encryptBlock(userPassword);
  49049. }
  49050. } else {
  49051. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49052. userPassword = cipher.encryptBlock(ownerPassword);
  49053. }
  49054. return userPassword;
  49055. }
  49056. const identityName = _primitives.Name.get("Identity");
  49057. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49058. const key = new Uint8Array(encryptionKey.length + 9);
  49059. const n = encryptionKey.length;
  49060. let i;
  49061. for (i = 0; i < n; ++i) {
  49062. key[i] = encryptionKey[i];
  49063. }
  49064. key[i++] = num & 0xff;
  49065. key[i++] = num >> 8 & 0xff;
  49066. key[i++] = num >> 16 & 0xff;
  49067. key[i++] = gen & 0xff;
  49068. key[i++] = gen >> 8 & 0xff;
  49069. if (isAes) {
  49070. key[i++] = 0x73;
  49071. key[i++] = 0x41;
  49072. key[i++] = 0x6c;
  49073. key[i++] = 0x54;
  49074. }
  49075. const hash = calculateMD5(key, 0, i);
  49076. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49077. }
  49078. function buildCipherConstructor(cf, name, num, gen, key) {
  49079. if (!(name instanceof _primitives.Name)) {
  49080. throw new _util.FormatError("Invalid crypt filter name.");
  49081. }
  49082. const cryptFilter = cf.get(name.name);
  49083. let cfm;
  49084. if (cryptFilter !== null && cryptFilter !== undefined) {
  49085. cfm = cryptFilter.get("CFM");
  49086. }
  49087. if (!cfm || cfm.name === "None") {
  49088. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49089. return new NullCipher();
  49090. };
  49091. }
  49092. if (cfm.name === "V2") {
  49093. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49094. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49095. };
  49096. }
  49097. if (cfm.name === "AESV2") {
  49098. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49099. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49100. };
  49101. }
  49102. if (cfm.name === "AESV3") {
  49103. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49104. return new AES256Cipher(key);
  49105. };
  49106. }
  49107. throw new _util.FormatError("Unknown crypto method");
  49108. }
  49109. class CipherTransformFactory {
  49110. constructor(dict, fileId, password) {
  49111. const filter = dict.get("Filter");
  49112. if (!(0, _primitives.isName)(filter, "Standard")) {
  49113. throw new _util.FormatError("unknown encryption method");
  49114. }
  49115. this.filterName = filter.name;
  49116. this.dict = dict;
  49117. const algorithm = dict.get("V");
  49118. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49119. throw new _util.FormatError("unsupported encryption algorithm");
  49120. }
  49121. this.algorithm = algorithm;
  49122. let keyLength = dict.get("Length");
  49123. if (!keyLength) {
  49124. if (algorithm <= 3) {
  49125. keyLength = 40;
  49126. } else {
  49127. const cfDict = dict.get("CF");
  49128. const streamCryptoName = dict.get("StmF");
  49129. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49130. cfDict.suppressEncryption = true;
  49131. const handlerDict = cfDict.get(streamCryptoName.name);
  49132. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49133. if (keyLength < 40) {
  49134. keyLength <<= 3;
  49135. }
  49136. }
  49137. }
  49138. }
  49139. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49140. throw new _util.FormatError("invalid key length");
  49141. }
  49142. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49143. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49144. const flags = dict.get("P");
  49145. const revision = dict.get("R");
  49146. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49147. this.encryptMetadata = encryptMetadata;
  49148. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49149. let passwordBytes;
  49150. if (password) {
  49151. if (revision === 6) {
  49152. try {
  49153. password = (0, _util.utf8StringToString)(password);
  49154. } catch (ex) {
  49155. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49156. }
  49157. }
  49158. passwordBytes = (0, _util.stringToBytes)(password);
  49159. }
  49160. let encryptionKey;
  49161. if (algorithm !== 5) {
  49162. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49163. } else {
  49164. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49165. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49166. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49167. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49168. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49169. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49170. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49171. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49172. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49173. }
  49174. if (!encryptionKey && !password) {
  49175. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49176. } else if (!encryptionKey && password) {
  49177. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49178. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49179. }
  49180. if (!encryptionKey) {
  49181. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49182. }
  49183. this.encryptionKey = encryptionKey;
  49184. if (algorithm >= 4) {
  49185. const cf = dict.get("CF");
  49186. if (cf instanceof _primitives.Dict) {
  49187. cf.suppressEncryption = true;
  49188. }
  49189. this.cf = cf;
  49190. this.stmf = dict.get("StmF") || identityName;
  49191. this.strf = dict.get("StrF") || identityName;
  49192. this.eff = dict.get("EFF") || this.stmf;
  49193. }
  49194. }
  49195. createCipherTransform(num, gen) {
  49196. if (this.algorithm === 4 || this.algorithm === 5) {
  49197. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49198. }
  49199. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49200. const cipherConstructor = function buildCipherCipherConstructor() {
  49201. return new ARCFourCipher(key);
  49202. };
  49203. return new CipherTransform(cipherConstructor, cipherConstructor);
  49204. }
  49205. }
  49206. return CipherTransformFactory;
  49207. }();
  49208. exports.CipherTransformFactory = CipherTransformFactory;
  49209. /***/ }),
  49210. /* 66 */
  49211. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49212. Object.defineProperty(exports, "__esModule", ({
  49213. value: true
  49214. }));
  49215. exports.DecryptStream = void 0;
  49216. var _decode_stream = __w_pdfjs_require__(17);
  49217. const chunkSize = 512;
  49218. class DecryptStream extends _decode_stream.DecodeStream {
  49219. constructor(str, maybeLength, decrypt) {
  49220. super(maybeLength);
  49221. this.str = str;
  49222. this.dict = str.dict;
  49223. this.decrypt = decrypt;
  49224. this.nextChunk = null;
  49225. this.initialized = false;
  49226. }
  49227. readBlock() {
  49228. let chunk;
  49229. if (this.initialized) {
  49230. chunk = this.nextChunk;
  49231. } else {
  49232. chunk = this.str.getBytes(chunkSize);
  49233. this.initialized = true;
  49234. }
  49235. if (!chunk || chunk.length === 0) {
  49236. this.eof = true;
  49237. return;
  49238. }
  49239. this.nextChunk = this.str.getBytes(chunkSize);
  49240. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49241. const decrypt = this.decrypt;
  49242. chunk = decrypt(chunk, !hasMoreData);
  49243. const bufferLength = this.bufferLength,
  49244. newLength = bufferLength + chunk.length,
  49245. buffer = this.ensureBuffer(newLength);
  49246. buffer.set(chunk, bufferLength);
  49247. this.bufferLength = newLength;
  49248. }
  49249. }
  49250. exports.DecryptStream = DecryptStream;
  49251. /***/ }),
  49252. /* 67 */
  49253. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49254. Object.defineProperty(exports, "__esModule", ({
  49255. value: true
  49256. }));
  49257. exports.Catalog = void 0;
  49258. var _core_utils = __w_pdfjs_require__(4);
  49259. var _util = __w_pdfjs_require__(2);
  49260. var _primitives = __w_pdfjs_require__(3);
  49261. var _name_number_tree = __w_pdfjs_require__(68);
  49262. var _base_stream = __w_pdfjs_require__(5);
  49263. var _cleanup_helper = __w_pdfjs_require__(69);
  49264. var _colorspace = __w_pdfjs_require__(12);
  49265. var _file_spec = __w_pdfjs_require__(70);
  49266. var _image_utils = __w_pdfjs_require__(57);
  49267. var _metadata_parser = __w_pdfjs_require__(71);
  49268. var _struct_tree = __w_pdfjs_require__(72);
  49269. function fetchDestination(dest) {
  49270. if (dest instanceof _primitives.Dict) {
  49271. dest = dest.get("D");
  49272. }
  49273. return Array.isArray(dest) ? dest : null;
  49274. }
  49275. class Catalog {
  49276. constructor(pdfManager, xref) {
  49277. this.pdfManager = pdfManager;
  49278. this.xref = xref;
  49279. this._catDict = xref.getCatalogObj();
  49280. if (!(this._catDict instanceof _primitives.Dict)) {
  49281. throw new _util.FormatError("Catalog object is not a dictionary.");
  49282. }
  49283. this.toplevelPagesDict;
  49284. this._actualNumPages = null;
  49285. this.fontCache = new _primitives.RefSetCache();
  49286. this.builtInCMapCache = new Map();
  49287. this.standardFontDataCache = new Map();
  49288. this.globalImageCache = new _image_utils.GlobalImageCache();
  49289. this.pageKidsCountCache = new _primitives.RefSetCache();
  49290. this.pageIndexCache = new _primitives.RefSetCache();
  49291. this.nonBlendModesSet = new _primitives.RefSet();
  49292. }
  49293. get version() {
  49294. const version = this._catDict.get("Version");
  49295. if (version instanceof _primitives.Name) {
  49296. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  49297. return (0, _util.shadow)(this, "version", version.name);
  49298. }
  49299. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  49300. }
  49301. return (0, _util.shadow)(this, "version", null);
  49302. }
  49303. get lang() {
  49304. const lang = this._catDict.get("Lang");
  49305. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49306. }
  49307. get needsRendering() {
  49308. const needsRendering = this._catDict.get("NeedsRendering");
  49309. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49310. }
  49311. get collection() {
  49312. let collection = null;
  49313. try {
  49314. const obj = this._catDict.get("Collection");
  49315. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49316. collection = obj;
  49317. }
  49318. } catch (ex) {
  49319. if (ex instanceof _core_utils.MissingDataException) {
  49320. throw ex;
  49321. }
  49322. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49323. }
  49324. return (0, _util.shadow)(this, "collection", collection);
  49325. }
  49326. get acroForm() {
  49327. let acroForm = null;
  49328. try {
  49329. const obj = this._catDict.get("AcroForm");
  49330. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49331. acroForm = obj;
  49332. }
  49333. } catch (ex) {
  49334. if (ex instanceof _core_utils.MissingDataException) {
  49335. throw ex;
  49336. }
  49337. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49338. }
  49339. return (0, _util.shadow)(this, "acroForm", acroForm);
  49340. }
  49341. get acroFormRef() {
  49342. const value = this._catDict.getRaw("AcroForm");
  49343. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49344. }
  49345. get metadata() {
  49346. const streamRef = this._catDict.getRaw("Metadata");
  49347. if (!(streamRef instanceof _primitives.Ref)) {
  49348. return (0, _util.shadow)(this, "metadata", null);
  49349. }
  49350. let metadata = null;
  49351. try {
  49352. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49353. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49354. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49355. const type = stream.dict.get("Type");
  49356. const subtype = stream.dict.get("Subtype");
  49357. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49358. const data = (0, _util.stringToUTF8String)(stream.getString());
  49359. if (data) {
  49360. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49361. }
  49362. }
  49363. }
  49364. } catch (ex) {
  49365. if (ex instanceof _core_utils.MissingDataException) {
  49366. throw ex;
  49367. }
  49368. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49369. }
  49370. return (0, _util.shadow)(this, "metadata", metadata);
  49371. }
  49372. get markInfo() {
  49373. let markInfo = null;
  49374. try {
  49375. markInfo = this._readMarkInfo();
  49376. } catch (ex) {
  49377. if (ex instanceof _core_utils.MissingDataException) {
  49378. throw ex;
  49379. }
  49380. (0, _util.warn)("Unable to read mark info.");
  49381. }
  49382. return (0, _util.shadow)(this, "markInfo", markInfo);
  49383. }
  49384. _readMarkInfo() {
  49385. const obj = this._catDict.get("MarkInfo");
  49386. if (!(obj instanceof _primitives.Dict)) {
  49387. return null;
  49388. }
  49389. const markInfo = {
  49390. Marked: false,
  49391. UserProperties: false,
  49392. Suspects: false
  49393. };
  49394. for (const key in markInfo) {
  49395. const value = obj.get(key);
  49396. if (typeof value === "boolean") {
  49397. markInfo[key] = value;
  49398. }
  49399. }
  49400. return markInfo;
  49401. }
  49402. get structTreeRoot() {
  49403. let structTree = null;
  49404. try {
  49405. structTree = this._readStructTreeRoot();
  49406. } catch (ex) {
  49407. if (ex instanceof _core_utils.MissingDataException) {
  49408. throw ex;
  49409. }
  49410. (0, _util.warn)("Unable read to structTreeRoot info.");
  49411. }
  49412. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49413. }
  49414. _readStructTreeRoot() {
  49415. const obj = this._catDict.get("StructTreeRoot");
  49416. if (!(obj instanceof _primitives.Dict)) {
  49417. return null;
  49418. }
  49419. const root = new _struct_tree.StructTreeRoot(obj);
  49420. root.init();
  49421. return root;
  49422. }
  49423. get toplevelPagesDict() {
  49424. const pagesObj = this._catDict.get("Pages");
  49425. if (!(pagesObj instanceof _primitives.Dict)) {
  49426. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49427. }
  49428. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49429. }
  49430. get documentOutline() {
  49431. let obj = null;
  49432. try {
  49433. obj = this._readDocumentOutline();
  49434. } catch (ex) {
  49435. if (ex instanceof _core_utils.MissingDataException) {
  49436. throw ex;
  49437. }
  49438. (0, _util.warn)("Unable to read document outline.");
  49439. }
  49440. return (0, _util.shadow)(this, "documentOutline", obj);
  49441. }
  49442. _readDocumentOutline() {
  49443. let obj = this._catDict.get("Outlines");
  49444. if (!(obj instanceof _primitives.Dict)) {
  49445. return null;
  49446. }
  49447. obj = obj.getRaw("First");
  49448. if (!(obj instanceof _primitives.Ref)) {
  49449. return null;
  49450. }
  49451. const root = {
  49452. items: []
  49453. };
  49454. const queue = [{
  49455. obj,
  49456. parent: root
  49457. }];
  49458. const processed = new _primitives.RefSet();
  49459. processed.put(obj);
  49460. const xref = this.xref,
  49461. blackColor = new Uint8ClampedArray(3);
  49462. while (queue.length > 0) {
  49463. const i = queue.shift();
  49464. const outlineDict = xref.fetchIfRef(i.obj);
  49465. if (outlineDict === null) {
  49466. continue;
  49467. }
  49468. if (!outlineDict.has("Title")) {
  49469. throw new _util.FormatError("Invalid outline item encountered.");
  49470. }
  49471. const data = {
  49472. url: null,
  49473. dest: null,
  49474. action: null
  49475. };
  49476. Catalog.parseDestDictionary({
  49477. destDict: outlineDict,
  49478. resultObj: data,
  49479. docBaseUrl: this.pdfManager.docBaseUrl,
  49480. docAttachments: this.attachments
  49481. });
  49482. const title = outlineDict.get("Title");
  49483. const flags = outlineDict.get("F") || 0;
  49484. const color = outlineDict.getArray("C");
  49485. const count = outlineDict.get("Count");
  49486. let rgbColor = blackColor;
  49487. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49488. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49489. }
  49490. const outlineItem = {
  49491. action: data.action,
  49492. attachment: data.attachment,
  49493. dest: data.dest,
  49494. url: data.url,
  49495. unsafeUrl: data.unsafeUrl,
  49496. newWindow: data.newWindow,
  49497. setOCGState: data.setOCGState,
  49498. title: (0, _util.stringToPDFString)(title),
  49499. color: rgbColor,
  49500. count: Number.isInteger(count) ? count : undefined,
  49501. bold: !!(flags & 2),
  49502. italic: !!(flags & 1),
  49503. items: []
  49504. };
  49505. i.parent.items.push(outlineItem);
  49506. obj = outlineDict.getRaw("First");
  49507. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49508. queue.push({
  49509. obj,
  49510. parent: outlineItem
  49511. });
  49512. processed.put(obj);
  49513. }
  49514. obj = outlineDict.getRaw("Next");
  49515. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49516. queue.push({
  49517. obj,
  49518. parent: i.parent
  49519. });
  49520. processed.put(obj);
  49521. }
  49522. }
  49523. return root.items.length > 0 ? root.items : null;
  49524. }
  49525. get permissions() {
  49526. let permissions = null;
  49527. try {
  49528. permissions = this._readPermissions();
  49529. } catch (ex) {
  49530. if (ex instanceof _core_utils.MissingDataException) {
  49531. throw ex;
  49532. }
  49533. (0, _util.warn)("Unable to read permissions.");
  49534. }
  49535. return (0, _util.shadow)(this, "permissions", permissions);
  49536. }
  49537. _readPermissions() {
  49538. const encrypt = this.xref.trailer.get("Encrypt");
  49539. if (!(encrypt instanceof _primitives.Dict)) {
  49540. return null;
  49541. }
  49542. let flags = encrypt.get("P");
  49543. if (typeof flags !== "number") {
  49544. return null;
  49545. }
  49546. flags += 2 ** 32;
  49547. const permissions = [];
  49548. for (const key in _util.PermissionFlag) {
  49549. const value = _util.PermissionFlag[key];
  49550. if (flags & value) {
  49551. permissions.push(value);
  49552. }
  49553. }
  49554. return permissions;
  49555. }
  49556. get optionalContentConfig() {
  49557. let config = null;
  49558. try {
  49559. const properties = this._catDict.get("OCProperties");
  49560. if (!properties) {
  49561. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49562. }
  49563. const defaultConfig = properties.get("D");
  49564. if (!defaultConfig) {
  49565. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49566. }
  49567. const groupsData = properties.get("OCGs");
  49568. if (!Array.isArray(groupsData)) {
  49569. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49570. }
  49571. const groups = [];
  49572. const groupRefs = [];
  49573. for (const groupRef of groupsData) {
  49574. if (!(groupRef instanceof _primitives.Ref)) {
  49575. continue;
  49576. }
  49577. groupRefs.push(groupRef);
  49578. const group = this.xref.fetchIfRef(groupRef);
  49579. groups.push({
  49580. id: groupRef.toString(),
  49581. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  49582. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  49583. });
  49584. }
  49585. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  49586. config.groups = groups;
  49587. } catch (ex) {
  49588. if (ex instanceof _core_utils.MissingDataException) {
  49589. throw ex;
  49590. }
  49591. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  49592. }
  49593. return (0, _util.shadow)(this, "optionalContentConfig", config);
  49594. }
  49595. _readOptionalContentConfig(config, contentGroupRefs) {
  49596. function parseOnOff(refs) {
  49597. const onParsed = [];
  49598. if (Array.isArray(refs)) {
  49599. for (const value of refs) {
  49600. if (!(value instanceof _primitives.Ref)) {
  49601. continue;
  49602. }
  49603. if (contentGroupRefs.includes(value)) {
  49604. onParsed.push(value.toString());
  49605. }
  49606. }
  49607. }
  49608. return onParsed;
  49609. }
  49610. function parseOrder(refs, nestedLevels = 0) {
  49611. if (!Array.isArray(refs)) {
  49612. return null;
  49613. }
  49614. const order = [];
  49615. for (const value of refs) {
  49616. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  49617. parsedOrderRefs.put(value);
  49618. order.push(value.toString());
  49619. continue;
  49620. }
  49621. const nestedOrder = parseNestedOrder(value, nestedLevels);
  49622. if (nestedOrder) {
  49623. order.push(nestedOrder);
  49624. }
  49625. }
  49626. if (nestedLevels > 0) {
  49627. return order;
  49628. }
  49629. const hiddenGroups = [];
  49630. for (const groupRef of contentGroupRefs) {
  49631. if (parsedOrderRefs.has(groupRef)) {
  49632. continue;
  49633. }
  49634. hiddenGroups.push(groupRef.toString());
  49635. }
  49636. if (hiddenGroups.length) {
  49637. order.push({
  49638. name: null,
  49639. order: hiddenGroups
  49640. });
  49641. }
  49642. return order;
  49643. }
  49644. function parseNestedOrder(ref, nestedLevels) {
  49645. if (++nestedLevels > MAX_NESTED_LEVELS) {
  49646. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  49647. return null;
  49648. }
  49649. const value = xref.fetchIfRef(ref);
  49650. if (!Array.isArray(value)) {
  49651. return null;
  49652. }
  49653. const nestedName = xref.fetchIfRef(value[0]);
  49654. if (typeof nestedName !== "string") {
  49655. return null;
  49656. }
  49657. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  49658. if (!nestedOrder || !nestedOrder.length) {
  49659. return null;
  49660. }
  49661. return {
  49662. name: (0, _util.stringToPDFString)(nestedName),
  49663. order: nestedOrder
  49664. };
  49665. }
  49666. const xref = this.xref,
  49667. parsedOrderRefs = new _primitives.RefSet(),
  49668. MAX_NESTED_LEVELS = 10;
  49669. return {
  49670. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  49671. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  49672. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  49673. on: parseOnOff(config.get("ON")),
  49674. off: parseOnOff(config.get("OFF")),
  49675. order: parseOrder(config.get("Order")),
  49676. groups: null
  49677. };
  49678. }
  49679. setActualNumPages(num = null) {
  49680. this._actualNumPages = num;
  49681. }
  49682. get hasActualNumPages() {
  49683. return this._actualNumPages !== null;
  49684. }
  49685. get _pagesCount() {
  49686. const obj = this.toplevelPagesDict.get("Count");
  49687. if (!Number.isInteger(obj)) {
  49688. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  49689. }
  49690. return (0, _util.shadow)(this, "_pagesCount", obj);
  49691. }
  49692. get numPages() {
  49693. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  49694. }
  49695. get destinations() {
  49696. const obj = this._readDests(),
  49697. dests = Object.create(null);
  49698. if (obj instanceof _name_number_tree.NameTree) {
  49699. for (const [key, value] of obj.getAll()) {
  49700. const dest = fetchDestination(value);
  49701. if (dest) {
  49702. dests[(0, _util.stringToPDFString)(key)] = dest;
  49703. }
  49704. }
  49705. } else if (obj instanceof _primitives.Dict) {
  49706. obj.forEach(function (key, value) {
  49707. const dest = fetchDestination(value);
  49708. if (dest) {
  49709. dests[key] = dest;
  49710. }
  49711. });
  49712. }
  49713. return (0, _util.shadow)(this, "destinations", dests);
  49714. }
  49715. getDestination(id) {
  49716. const obj = this._readDests();
  49717. if (obj instanceof _name_number_tree.NameTree) {
  49718. const dest = fetchDestination(obj.get(id));
  49719. if (dest) {
  49720. return dest;
  49721. }
  49722. const allDest = this.destinations[id];
  49723. if (allDest) {
  49724. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  49725. return allDest;
  49726. }
  49727. } else if (obj instanceof _primitives.Dict) {
  49728. const dest = fetchDestination(obj.get(id));
  49729. if (dest) {
  49730. return dest;
  49731. }
  49732. }
  49733. return null;
  49734. }
  49735. _readDests() {
  49736. const obj = this._catDict.get("Names");
  49737. if (obj && obj.has("Dests")) {
  49738. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  49739. } else if (this._catDict.has("Dests")) {
  49740. return this._catDict.get("Dests");
  49741. }
  49742. return undefined;
  49743. }
  49744. get pageLabels() {
  49745. let obj = null;
  49746. try {
  49747. obj = this._readPageLabels();
  49748. } catch (ex) {
  49749. if (ex instanceof _core_utils.MissingDataException) {
  49750. throw ex;
  49751. }
  49752. (0, _util.warn)("Unable to read page labels.");
  49753. }
  49754. return (0, _util.shadow)(this, "pageLabels", obj);
  49755. }
  49756. _readPageLabels() {
  49757. const obj = this._catDict.getRaw("PageLabels");
  49758. if (!obj) {
  49759. return null;
  49760. }
  49761. const pageLabels = new Array(this.numPages);
  49762. let style = null,
  49763. prefix = "";
  49764. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  49765. const nums = numberTree.getAll();
  49766. let currentLabel = "",
  49767. currentIndex = 1;
  49768. for (let i = 0, ii = this.numPages; i < ii; i++) {
  49769. const labelDict = nums.get(i);
  49770. if (labelDict !== undefined) {
  49771. if (!(labelDict instanceof _primitives.Dict)) {
  49772. throw new _util.FormatError("PageLabel is not a dictionary.");
  49773. }
  49774. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  49775. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  49776. }
  49777. if (labelDict.has("S")) {
  49778. const s = labelDict.get("S");
  49779. if (!(s instanceof _primitives.Name)) {
  49780. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  49781. }
  49782. style = s.name;
  49783. } else {
  49784. style = null;
  49785. }
  49786. if (labelDict.has("P")) {
  49787. const p = labelDict.get("P");
  49788. if (typeof p !== "string") {
  49789. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  49790. }
  49791. prefix = (0, _util.stringToPDFString)(p);
  49792. } else {
  49793. prefix = "";
  49794. }
  49795. if (labelDict.has("St")) {
  49796. const st = labelDict.get("St");
  49797. if (!(Number.isInteger(st) && st >= 1)) {
  49798. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  49799. }
  49800. currentIndex = st;
  49801. } else {
  49802. currentIndex = 1;
  49803. }
  49804. }
  49805. switch (style) {
  49806. case "D":
  49807. currentLabel = currentIndex;
  49808. break;
  49809. case "R":
  49810. case "r":
  49811. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  49812. break;
  49813. case "A":
  49814. case "a":
  49815. const LIMIT = 26;
  49816. const A_UPPER_CASE = 0x41,
  49817. A_LOWER_CASE = 0x61;
  49818. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  49819. const letterIndex = currentIndex - 1;
  49820. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  49821. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  49822. break;
  49823. default:
  49824. if (style) {
  49825. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  49826. }
  49827. currentLabel = "";
  49828. }
  49829. pageLabels[i] = prefix + currentLabel;
  49830. currentIndex++;
  49831. }
  49832. return pageLabels;
  49833. }
  49834. get pageLayout() {
  49835. const obj = this._catDict.get("PageLayout");
  49836. let pageLayout = "";
  49837. if (obj instanceof _primitives.Name) {
  49838. switch (obj.name) {
  49839. case "SinglePage":
  49840. case "OneColumn":
  49841. case "TwoColumnLeft":
  49842. case "TwoColumnRight":
  49843. case "TwoPageLeft":
  49844. case "TwoPageRight":
  49845. pageLayout = obj.name;
  49846. }
  49847. }
  49848. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  49849. }
  49850. get pageMode() {
  49851. const obj = this._catDict.get("PageMode");
  49852. let pageMode = "UseNone";
  49853. if (obj instanceof _primitives.Name) {
  49854. switch (obj.name) {
  49855. case "UseNone":
  49856. case "UseOutlines":
  49857. case "UseThumbs":
  49858. case "FullScreen":
  49859. case "UseOC":
  49860. case "UseAttachments":
  49861. pageMode = obj.name;
  49862. }
  49863. }
  49864. return (0, _util.shadow)(this, "pageMode", pageMode);
  49865. }
  49866. get viewerPreferences() {
  49867. const obj = this._catDict.get("ViewerPreferences");
  49868. if (!(obj instanceof _primitives.Dict)) {
  49869. return (0, _util.shadow)(this, "viewerPreferences", null);
  49870. }
  49871. let prefs = null;
  49872. for (const key of obj.getKeys()) {
  49873. const value = obj.get(key);
  49874. let prefValue;
  49875. switch (key) {
  49876. case "HideToolbar":
  49877. case "HideMenubar":
  49878. case "HideWindowUI":
  49879. case "FitWindow":
  49880. case "CenterWindow":
  49881. case "DisplayDocTitle":
  49882. case "PickTrayByPDFSize":
  49883. if (typeof value === "boolean") {
  49884. prefValue = value;
  49885. }
  49886. break;
  49887. case "NonFullScreenPageMode":
  49888. if (value instanceof _primitives.Name) {
  49889. switch (value.name) {
  49890. case "UseNone":
  49891. case "UseOutlines":
  49892. case "UseThumbs":
  49893. case "UseOC":
  49894. prefValue = value.name;
  49895. break;
  49896. default:
  49897. prefValue = "UseNone";
  49898. }
  49899. }
  49900. break;
  49901. case "Direction":
  49902. if (value instanceof _primitives.Name) {
  49903. switch (value.name) {
  49904. case "L2R":
  49905. case "R2L":
  49906. prefValue = value.name;
  49907. break;
  49908. default:
  49909. prefValue = "L2R";
  49910. }
  49911. }
  49912. break;
  49913. case "ViewArea":
  49914. case "ViewClip":
  49915. case "PrintArea":
  49916. case "PrintClip":
  49917. if (value instanceof _primitives.Name) {
  49918. switch (value.name) {
  49919. case "MediaBox":
  49920. case "CropBox":
  49921. case "BleedBox":
  49922. case "TrimBox":
  49923. case "ArtBox":
  49924. prefValue = value.name;
  49925. break;
  49926. default:
  49927. prefValue = "CropBox";
  49928. }
  49929. }
  49930. break;
  49931. case "PrintScaling":
  49932. if (value instanceof _primitives.Name) {
  49933. switch (value.name) {
  49934. case "None":
  49935. case "AppDefault":
  49936. prefValue = value.name;
  49937. break;
  49938. default:
  49939. prefValue = "AppDefault";
  49940. }
  49941. }
  49942. break;
  49943. case "Duplex":
  49944. if (value instanceof _primitives.Name) {
  49945. switch (value.name) {
  49946. case "Simplex":
  49947. case "DuplexFlipShortEdge":
  49948. case "DuplexFlipLongEdge":
  49949. prefValue = value.name;
  49950. break;
  49951. default:
  49952. prefValue = "None";
  49953. }
  49954. }
  49955. break;
  49956. case "PrintPageRange":
  49957. if (Array.isArray(value) && value.length % 2 === 0) {
  49958. const isValid = value.every((page, i, arr) => {
  49959. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  49960. });
  49961. if (isValid) {
  49962. prefValue = value;
  49963. }
  49964. }
  49965. break;
  49966. case "NumCopies":
  49967. if (Number.isInteger(value) && value > 0) {
  49968. prefValue = value;
  49969. }
  49970. break;
  49971. default:
  49972. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  49973. continue;
  49974. }
  49975. if (prefValue === undefined) {
  49976. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  49977. continue;
  49978. }
  49979. if (!prefs) {
  49980. prefs = Object.create(null);
  49981. }
  49982. prefs[key] = prefValue;
  49983. }
  49984. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  49985. }
  49986. get openAction() {
  49987. const obj = this._catDict.get("OpenAction");
  49988. const openAction = Object.create(null);
  49989. if (obj instanceof _primitives.Dict) {
  49990. const destDict = new _primitives.Dict(this.xref);
  49991. destDict.set("A", obj);
  49992. const resultObj = {
  49993. url: null,
  49994. dest: null,
  49995. action: null
  49996. };
  49997. Catalog.parseDestDictionary({
  49998. destDict,
  49999. resultObj
  50000. });
  50001. if (Array.isArray(resultObj.dest)) {
  50002. openAction.dest = resultObj.dest;
  50003. } else if (resultObj.action) {
  50004. openAction.action = resultObj.action;
  50005. }
  50006. } else if (Array.isArray(obj)) {
  50007. openAction.dest = obj;
  50008. }
  50009. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  50010. }
  50011. get attachments() {
  50012. const obj = this._catDict.get("Names");
  50013. let attachments = null;
  50014. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  50015. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  50016. for (const [key, value] of nameTree.getAll()) {
  50017. const fs = new _file_spec.FileSpec(value, this.xref);
  50018. if (!attachments) {
  50019. attachments = Object.create(null);
  50020. }
  50021. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  50022. }
  50023. }
  50024. return (0, _util.shadow)(this, "attachments", attachments);
  50025. }
  50026. get xfaImages() {
  50027. const obj = this._catDict.get("Names");
  50028. let xfaImages = null;
  50029. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  50030. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  50031. for (const [key, value] of nameTree.getAll()) {
  50032. if (!xfaImages) {
  50033. xfaImages = new _primitives.Dict(this.xref);
  50034. }
  50035. xfaImages.set((0, _util.stringToPDFString)(key), value);
  50036. }
  50037. }
  50038. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  50039. }
  50040. _collectJavaScript() {
  50041. const obj = this._catDict.get("Names");
  50042. let javaScript = null;
  50043. function appendIfJavaScriptDict(name, jsDict) {
  50044. if (!(jsDict instanceof _primitives.Dict)) {
  50045. return;
  50046. }
  50047. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  50048. return;
  50049. }
  50050. let js = jsDict.get("JS");
  50051. if (js instanceof _base_stream.BaseStream) {
  50052. js = js.getString();
  50053. } else if (typeof js !== "string") {
  50054. return;
  50055. }
  50056. if (javaScript === null) {
  50057. javaScript = new Map();
  50058. }
  50059. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  50060. javaScript.set(name, js);
  50061. }
  50062. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  50063. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  50064. for (const [key, value] of nameTree.getAll()) {
  50065. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  50066. }
  50067. }
  50068. const openAction = this._catDict.get("OpenAction");
  50069. if (openAction) {
  50070. appendIfJavaScriptDict("OpenAction", openAction);
  50071. }
  50072. return javaScript;
  50073. }
  50074. get javaScript() {
  50075. const javaScript = this._collectJavaScript();
  50076. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  50077. }
  50078. get jsActions() {
  50079. const javaScript = this._collectJavaScript();
  50080. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  50081. if (javaScript) {
  50082. if (!actions) {
  50083. actions = Object.create(null);
  50084. }
  50085. for (const [key, val] of javaScript) {
  50086. if (key in actions) {
  50087. actions[key].push(val);
  50088. } else {
  50089. actions[key] = [val];
  50090. }
  50091. }
  50092. }
  50093. return (0, _util.shadow)(this, "jsActions", actions);
  50094. }
  50095. async fontFallback(id, handler) {
  50096. const translatedFonts = await Promise.all(this.fontCache);
  50097. for (const translatedFont of translatedFonts) {
  50098. if (translatedFont.loadedName === id) {
  50099. translatedFont.fallback(handler);
  50100. return;
  50101. }
  50102. }
  50103. }
  50104. async cleanup(manuallyTriggered = false) {
  50105. (0, _cleanup_helper.clearGlobalCaches)();
  50106. this.globalImageCache.clear(manuallyTriggered);
  50107. this.pageKidsCountCache.clear();
  50108. this.pageIndexCache.clear();
  50109. this.nonBlendModesSet.clear();
  50110. const translatedFonts = await Promise.all(this.fontCache);
  50111. for (const {
  50112. dict
  50113. } of translatedFonts) {
  50114. delete dict.cacheKey;
  50115. }
  50116. this.fontCache.clear();
  50117. this.builtInCMapCache.clear();
  50118. this.standardFontDataCache.clear();
  50119. }
  50120. async getPageDict(pageIndex) {
  50121. const nodesToVisit = [this.toplevelPagesDict];
  50122. const visitedNodes = new _primitives.RefSet();
  50123. const pagesRef = this._catDict.getRaw("Pages");
  50124. if (pagesRef instanceof _primitives.Ref) {
  50125. visitedNodes.put(pagesRef);
  50126. }
  50127. const xref = this.xref,
  50128. pageKidsCountCache = this.pageKidsCountCache,
  50129. pageIndexCache = this.pageIndexCache;
  50130. let currentPageIndex = 0;
  50131. while (nodesToVisit.length) {
  50132. const currentNode = nodesToVisit.pop();
  50133. if (currentNode instanceof _primitives.Ref) {
  50134. const count = pageKidsCountCache.get(currentNode);
  50135. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50136. currentPageIndex += count;
  50137. continue;
  50138. }
  50139. if (visitedNodes.has(currentNode)) {
  50140. throw new _util.FormatError("Pages tree contains circular reference.");
  50141. }
  50142. visitedNodes.put(currentNode);
  50143. const obj = await xref.fetchAsync(currentNode);
  50144. if (obj instanceof _primitives.Dict) {
  50145. let type = obj.getRaw("Type");
  50146. if (type instanceof _primitives.Ref) {
  50147. type = await xref.fetchAsync(type);
  50148. }
  50149. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50150. if (!pageKidsCountCache.has(currentNode)) {
  50151. pageKidsCountCache.put(currentNode, 1);
  50152. }
  50153. if (!pageIndexCache.has(currentNode)) {
  50154. pageIndexCache.put(currentNode, currentPageIndex);
  50155. }
  50156. if (currentPageIndex === pageIndex) {
  50157. return [obj, currentNode];
  50158. }
  50159. currentPageIndex++;
  50160. continue;
  50161. }
  50162. }
  50163. nodesToVisit.push(obj);
  50164. continue;
  50165. }
  50166. if (!(currentNode instanceof _primitives.Dict)) {
  50167. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50168. }
  50169. const {
  50170. objId
  50171. } = currentNode;
  50172. let count = currentNode.getRaw("Count");
  50173. if (count instanceof _primitives.Ref) {
  50174. count = await xref.fetchAsync(count);
  50175. }
  50176. if (Number.isInteger(count) && count >= 0) {
  50177. if (objId && !pageKidsCountCache.has(objId)) {
  50178. pageKidsCountCache.put(objId, count);
  50179. }
  50180. if (currentPageIndex + count <= pageIndex) {
  50181. currentPageIndex += count;
  50182. continue;
  50183. }
  50184. }
  50185. let kids = currentNode.getRaw("Kids");
  50186. if (kids instanceof _primitives.Ref) {
  50187. kids = await xref.fetchAsync(kids);
  50188. }
  50189. if (!Array.isArray(kids)) {
  50190. let type = currentNode.getRaw("Type");
  50191. if (type instanceof _primitives.Ref) {
  50192. type = await xref.fetchAsync(type);
  50193. }
  50194. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50195. if (currentPageIndex === pageIndex) {
  50196. return [currentNode, null];
  50197. }
  50198. currentPageIndex++;
  50199. continue;
  50200. }
  50201. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50202. }
  50203. for (let last = kids.length - 1; last >= 0; last--) {
  50204. nodesToVisit.push(kids[last]);
  50205. }
  50206. }
  50207. throw new Error(`Page index ${pageIndex} not found.`);
  50208. }
  50209. async getAllPageDicts(recoveryMode = false) {
  50210. const queue = [{
  50211. currentNode: this.toplevelPagesDict,
  50212. posInKids: 0
  50213. }];
  50214. const visitedNodes = new _primitives.RefSet();
  50215. const pagesRef = this._catDict.getRaw("Pages");
  50216. if (pagesRef instanceof _primitives.Ref) {
  50217. visitedNodes.put(pagesRef);
  50218. }
  50219. const map = new Map(),
  50220. xref = this.xref,
  50221. pageIndexCache = this.pageIndexCache;
  50222. let pageIndex = 0;
  50223. function addPageDict(pageDict, pageRef) {
  50224. if (pageRef && !pageIndexCache.has(pageRef)) {
  50225. pageIndexCache.put(pageRef, pageIndex);
  50226. }
  50227. map.set(pageIndex++, [pageDict, pageRef]);
  50228. }
  50229. function addPageError(error) {
  50230. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50231. throw error;
  50232. }
  50233. map.set(pageIndex++, [error, null]);
  50234. }
  50235. while (queue.length > 0) {
  50236. const queueItem = queue.at(-1);
  50237. const {
  50238. currentNode,
  50239. posInKids
  50240. } = queueItem;
  50241. let kids = currentNode.getRaw("Kids");
  50242. if (kids instanceof _primitives.Ref) {
  50243. try {
  50244. kids = await xref.fetchAsync(kids);
  50245. } catch (ex) {
  50246. addPageError(ex);
  50247. break;
  50248. }
  50249. }
  50250. if (!Array.isArray(kids)) {
  50251. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50252. break;
  50253. }
  50254. if (posInKids >= kids.length) {
  50255. queue.pop();
  50256. continue;
  50257. }
  50258. const kidObj = kids[posInKids];
  50259. let obj;
  50260. if (kidObj instanceof _primitives.Ref) {
  50261. if (visitedNodes.has(kidObj)) {
  50262. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50263. break;
  50264. }
  50265. visitedNodes.put(kidObj);
  50266. try {
  50267. obj = await xref.fetchAsync(kidObj);
  50268. } catch (ex) {
  50269. addPageError(ex);
  50270. break;
  50271. }
  50272. } else {
  50273. obj = kidObj;
  50274. }
  50275. if (!(obj instanceof _primitives.Dict)) {
  50276. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50277. break;
  50278. }
  50279. let type = obj.getRaw("Type");
  50280. if (type instanceof _primitives.Ref) {
  50281. try {
  50282. type = await xref.fetchAsync(type);
  50283. } catch (ex) {
  50284. addPageError(ex);
  50285. break;
  50286. }
  50287. }
  50288. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50289. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50290. } else {
  50291. queue.push({
  50292. currentNode: obj,
  50293. posInKids: 0
  50294. });
  50295. }
  50296. queueItem.posInKids++;
  50297. }
  50298. return map;
  50299. }
  50300. getPageIndex(pageRef) {
  50301. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50302. if (cachedPageIndex !== undefined) {
  50303. return Promise.resolve(cachedPageIndex);
  50304. }
  50305. const xref = this.xref;
  50306. function pagesBeforeRef(kidRef) {
  50307. let total = 0,
  50308. parentRef;
  50309. return xref.fetchAsync(kidRef).then(function (node) {
  50310. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50311. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50312. }
  50313. if (!node) {
  50314. return null;
  50315. }
  50316. if (!(node instanceof _primitives.Dict)) {
  50317. throw new _util.FormatError("Node must be a dictionary.");
  50318. }
  50319. parentRef = node.getRaw("Parent");
  50320. return node.getAsync("Parent");
  50321. }).then(function (parent) {
  50322. if (!parent) {
  50323. return null;
  50324. }
  50325. if (!(parent instanceof _primitives.Dict)) {
  50326. throw new _util.FormatError("Parent must be a dictionary.");
  50327. }
  50328. return parent.getAsync("Kids");
  50329. }).then(function (kids) {
  50330. if (!kids) {
  50331. return null;
  50332. }
  50333. const kidPromises = [];
  50334. let found = false;
  50335. for (const kid of kids) {
  50336. if (!(kid instanceof _primitives.Ref)) {
  50337. throw new _util.FormatError("Kid must be a reference.");
  50338. }
  50339. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50340. found = true;
  50341. break;
  50342. }
  50343. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50344. if (!(obj instanceof _primitives.Dict)) {
  50345. throw new _util.FormatError("Kid node must be a dictionary.");
  50346. }
  50347. if (obj.has("Count")) {
  50348. total += obj.get("Count");
  50349. } else {
  50350. total++;
  50351. }
  50352. }));
  50353. }
  50354. if (!found) {
  50355. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50356. }
  50357. return Promise.all(kidPromises).then(function () {
  50358. return [total, parentRef];
  50359. });
  50360. });
  50361. }
  50362. let total = 0;
  50363. const next = ref => pagesBeforeRef(ref).then(args => {
  50364. if (!args) {
  50365. this.pageIndexCache.put(pageRef, total);
  50366. return total;
  50367. }
  50368. const [count, parentRef] = args;
  50369. total += count;
  50370. return next(parentRef);
  50371. });
  50372. return next(pageRef);
  50373. }
  50374. get baseUrl() {
  50375. const uri = this._catDict.get("URI");
  50376. if (uri instanceof _primitives.Dict) {
  50377. const base = uri.get("Base");
  50378. if (typeof base === "string") {
  50379. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50380. tryConvertEncoding: true
  50381. });
  50382. if (absoluteUrl) {
  50383. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50384. }
  50385. }
  50386. }
  50387. return (0, _util.shadow)(this, "baseUrl", null);
  50388. }
  50389. static parseDestDictionary(params) {
  50390. const destDict = params.destDict;
  50391. if (!(destDict instanceof _primitives.Dict)) {
  50392. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50393. return;
  50394. }
  50395. const resultObj = params.resultObj;
  50396. if (typeof resultObj !== "object") {
  50397. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50398. return;
  50399. }
  50400. const docBaseUrl = params.docBaseUrl || null;
  50401. const docAttachments = params.docAttachments || null;
  50402. let action = destDict.get("A"),
  50403. url,
  50404. dest;
  50405. if (!(action instanceof _primitives.Dict)) {
  50406. if (destDict.has("Dest")) {
  50407. action = destDict.get("Dest");
  50408. } else {
  50409. action = destDict.get("AA");
  50410. if (action instanceof _primitives.Dict) {
  50411. if (action.has("D")) {
  50412. action = action.get("D");
  50413. } else if (action.has("U")) {
  50414. action = action.get("U");
  50415. }
  50416. }
  50417. }
  50418. }
  50419. if (action instanceof _primitives.Dict) {
  50420. const actionType = action.get("S");
  50421. if (!(actionType instanceof _primitives.Name)) {
  50422. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50423. return;
  50424. }
  50425. const actionName = actionType.name;
  50426. switch (actionName) {
  50427. case "ResetForm":
  50428. const flags = action.get("Flags");
  50429. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50430. const fields = [];
  50431. const refs = [];
  50432. for (const obj of action.get("Fields") || []) {
  50433. if (obj instanceof _primitives.Ref) {
  50434. refs.push(obj.toString());
  50435. } else if (typeof obj === "string") {
  50436. fields.push((0, _util.stringToPDFString)(obj));
  50437. }
  50438. }
  50439. resultObj.resetForm = {
  50440. fields,
  50441. refs,
  50442. include
  50443. };
  50444. break;
  50445. case "URI":
  50446. url = action.get("URI");
  50447. if (url instanceof _primitives.Name) {
  50448. url = "/" + url.name;
  50449. }
  50450. break;
  50451. case "GoTo":
  50452. dest = action.get("D");
  50453. break;
  50454. case "Launch":
  50455. case "GoToR":
  50456. const urlDict = action.get("F");
  50457. if (urlDict instanceof _primitives.Dict) {
  50458. url = urlDict.get("F") || null;
  50459. } else if (typeof urlDict === "string") {
  50460. url = urlDict;
  50461. }
  50462. let remoteDest = action.get("D");
  50463. if (remoteDest) {
  50464. if (remoteDest instanceof _primitives.Name) {
  50465. remoteDest = remoteDest.name;
  50466. }
  50467. if (typeof url === "string") {
  50468. const baseUrl = url.split("#")[0];
  50469. if (typeof remoteDest === "string") {
  50470. url = baseUrl + "#" + remoteDest;
  50471. } else if (Array.isArray(remoteDest)) {
  50472. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50473. }
  50474. }
  50475. }
  50476. const newWindow = action.get("NewWindow");
  50477. if (typeof newWindow === "boolean") {
  50478. resultObj.newWindow = newWindow;
  50479. }
  50480. break;
  50481. case "GoToE":
  50482. const target = action.get("T");
  50483. let attachment;
  50484. if (docAttachments && target instanceof _primitives.Dict) {
  50485. const relationship = target.get("R");
  50486. const name = target.get("N");
  50487. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  50488. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  50489. }
  50490. }
  50491. if (attachment) {
  50492. resultObj.attachment = attachment;
  50493. } else {
  50494. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  50495. }
  50496. break;
  50497. case "Named":
  50498. const namedAction = action.get("N");
  50499. if (namedAction instanceof _primitives.Name) {
  50500. resultObj.action = namedAction.name;
  50501. }
  50502. break;
  50503. case "SetOCGState":
  50504. const state = action.get("State");
  50505. const preserveRB = action.get("PreserveRB");
  50506. if (!Array.isArray(state) || state.length === 0) {
  50507. break;
  50508. }
  50509. const stateArr = [];
  50510. for (const elem of state) {
  50511. if (elem instanceof _primitives.Name) {
  50512. switch (elem.name) {
  50513. case "ON":
  50514. case "OFF":
  50515. case "Toggle":
  50516. stateArr.push(elem.name);
  50517. break;
  50518. }
  50519. } else if (elem instanceof _primitives.Ref) {
  50520. stateArr.push(elem.toString());
  50521. }
  50522. }
  50523. if (stateArr.length !== state.length) {
  50524. break;
  50525. }
  50526. resultObj.setOCGState = {
  50527. state: stateArr,
  50528. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  50529. };
  50530. break;
  50531. case "JavaScript":
  50532. const jsAction = action.get("JS");
  50533. let js;
  50534. if (jsAction instanceof _base_stream.BaseStream) {
  50535. js = jsAction.getString();
  50536. } else if (typeof jsAction === "string") {
  50537. js = jsAction;
  50538. }
  50539. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50540. if (jsURL) {
  50541. url = jsURL.url;
  50542. resultObj.newWindow = jsURL.newWindow;
  50543. break;
  50544. }
  50545. default:
  50546. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50547. break;
  50548. }
  50549. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50550. break;
  50551. }
  50552. } else if (destDict.has("Dest")) {
  50553. dest = destDict.get("Dest");
  50554. }
  50555. if (typeof url === "string") {
  50556. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50557. addDefaultProtocol: true,
  50558. tryConvertEncoding: true
  50559. });
  50560. if (absoluteUrl) {
  50561. resultObj.url = absoluteUrl.href;
  50562. }
  50563. resultObj.unsafeUrl = url;
  50564. }
  50565. if (dest) {
  50566. if (dest instanceof _primitives.Name) {
  50567. dest = dest.name;
  50568. }
  50569. if (typeof dest === "string") {
  50570. resultObj.dest = (0, _util.stringToPDFString)(dest);
  50571. } else if (Array.isArray(dest)) {
  50572. resultObj.dest = dest;
  50573. }
  50574. }
  50575. }
  50576. }
  50577. exports.Catalog = Catalog;
  50578. /***/ }),
  50579. /* 68 */
  50580. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50581. Object.defineProperty(exports, "__esModule", ({
  50582. value: true
  50583. }));
  50584. exports.NumberTree = exports.NameTree = void 0;
  50585. var _primitives = __w_pdfjs_require__(3);
  50586. var _util = __w_pdfjs_require__(2);
  50587. class NameOrNumberTree {
  50588. constructor(root, xref, type) {
  50589. if (this.constructor === NameOrNumberTree) {
  50590. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  50591. }
  50592. this.root = root;
  50593. this.xref = xref;
  50594. this._type = type;
  50595. }
  50596. getAll() {
  50597. const map = new Map();
  50598. if (!this.root) {
  50599. return map;
  50600. }
  50601. const xref = this.xref;
  50602. const processed = new _primitives.RefSet();
  50603. processed.put(this.root);
  50604. const queue = [this.root];
  50605. while (queue.length > 0) {
  50606. const obj = xref.fetchIfRef(queue.shift());
  50607. if (!(obj instanceof _primitives.Dict)) {
  50608. continue;
  50609. }
  50610. if (obj.has("Kids")) {
  50611. const kids = obj.get("Kids");
  50612. if (!Array.isArray(kids)) {
  50613. continue;
  50614. }
  50615. for (const kid of kids) {
  50616. if (processed.has(kid)) {
  50617. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  50618. }
  50619. queue.push(kid);
  50620. processed.put(kid);
  50621. }
  50622. continue;
  50623. }
  50624. const entries = obj.get(this._type);
  50625. if (!Array.isArray(entries)) {
  50626. continue;
  50627. }
  50628. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  50629. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  50630. }
  50631. }
  50632. return map;
  50633. }
  50634. get(key) {
  50635. if (!this.root) {
  50636. return null;
  50637. }
  50638. const xref = this.xref;
  50639. let kidsOrEntries = xref.fetchIfRef(this.root);
  50640. let loopCount = 0;
  50641. const MAX_LEVELS = 10;
  50642. while (kidsOrEntries.has("Kids")) {
  50643. if (++loopCount > MAX_LEVELS) {
  50644. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  50645. return null;
  50646. }
  50647. const kids = kidsOrEntries.get("Kids");
  50648. if (!Array.isArray(kids)) {
  50649. return null;
  50650. }
  50651. let l = 0,
  50652. r = kids.length - 1;
  50653. while (l <= r) {
  50654. const m = l + r >> 1;
  50655. const kid = xref.fetchIfRef(kids[m]);
  50656. const limits = kid.get("Limits");
  50657. if (key < xref.fetchIfRef(limits[0])) {
  50658. r = m - 1;
  50659. } else if (key > xref.fetchIfRef(limits[1])) {
  50660. l = m + 1;
  50661. } else {
  50662. kidsOrEntries = kid;
  50663. break;
  50664. }
  50665. }
  50666. if (l > r) {
  50667. return null;
  50668. }
  50669. }
  50670. const entries = kidsOrEntries.get(this._type);
  50671. if (Array.isArray(entries)) {
  50672. let l = 0,
  50673. r = entries.length - 2;
  50674. while (l <= r) {
  50675. const tmp = l + r >> 1,
  50676. m = tmp + (tmp & 1);
  50677. const currentKey = xref.fetchIfRef(entries[m]);
  50678. if (key < currentKey) {
  50679. r = m - 2;
  50680. } else if (key > currentKey) {
  50681. l = m + 2;
  50682. } else {
  50683. return xref.fetchIfRef(entries[m + 1]);
  50684. }
  50685. }
  50686. }
  50687. return null;
  50688. }
  50689. }
  50690. class NameTree extends NameOrNumberTree {
  50691. constructor(root, xref) {
  50692. super(root, xref, "Names");
  50693. }
  50694. }
  50695. exports.NameTree = NameTree;
  50696. class NumberTree extends NameOrNumberTree {
  50697. constructor(root, xref) {
  50698. super(root, xref, "Nums");
  50699. }
  50700. }
  50701. exports.NumberTree = NumberTree;
  50702. /***/ }),
  50703. /* 69 */
  50704. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50705. Object.defineProperty(exports, "__esModule", ({
  50706. value: true
  50707. }));
  50708. exports.clearGlobalCaches = clearGlobalCaches;
  50709. var _primitives = __w_pdfjs_require__(3);
  50710. var _unicode = __w_pdfjs_require__(38);
  50711. function clearGlobalCaches() {
  50712. (0, _primitives.clearPrimitiveCaches)();
  50713. (0, _unicode.clearUnicodeCaches)();
  50714. }
  50715. /***/ }),
  50716. /* 70 */
  50717. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50718. Object.defineProperty(exports, "__esModule", ({
  50719. value: true
  50720. }));
  50721. exports.FileSpec = void 0;
  50722. var _util = __w_pdfjs_require__(2);
  50723. var _base_stream = __w_pdfjs_require__(5);
  50724. var _primitives = __w_pdfjs_require__(3);
  50725. function pickPlatformItem(dict) {
  50726. if (dict.has("UF")) {
  50727. return dict.get("UF");
  50728. } else if (dict.has("F")) {
  50729. return dict.get("F");
  50730. } else if (dict.has("Unix")) {
  50731. return dict.get("Unix");
  50732. } else if (dict.has("Mac")) {
  50733. return dict.get("Mac");
  50734. } else if (dict.has("DOS")) {
  50735. return dict.get("DOS");
  50736. }
  50737. return null;
  50738. }
  50739. class FileSpec {
  50740. constructor(root, xref) {
  50741. if (!(root instanceof _primitives.Dict)) {
  50742. return;
  50743. }
  50744. this.xref = xref;
  50745. this.root = root;
  50746. if (root.has("FS")) {
  50747. this.fs = root.get("FS");
  50748. }
  50749. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  50750. if (root.has("RF")) {
  50751. (0, _util.warn)("Related file specifications are not supported");
  50752. }
  50753. this.contentAvailable = true;
  50754. if (!root.has("EF")) {
  50755. this.contentAvailable = false;
  50756. (0, _util.warn)("Non-embedded file specifications are not supported");
  50757. }
  50758. }
  50759. get filename() {
  50760. if (!this._filename && this.root) {
  50761. const filename = pickPlatformItem(this.root) || "unnamed";
  50762. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  50763. }
  50764. return this._filename;
  50765. }
  50766. get content() {
  50767. if (!this.contentAvailable) {
  50768. return null;
  50769. }
  50770. if (!this.contentRef && this.root) {
  50771. this.contentRef = pickPlatformItem(this.root.get("EF"));
  50772. }
  50773. let content = null;
  50774. if (this.contentRef) {
  50775. const fileObj = this.xref.fetchIfRef(this.contentRef);
  50776. if (fileObj instanceof _base_stream.BaseStream) {
  50777. content = fileObj.getBytes();
  50778. } else {
  50779. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  50780. }
  50781. } else {
  50782. (0, _util.warn)("Embedded file specification does not have a content");
  50783. }
  50784. return content;
  50785. }
  50786. get serializable() {
  50787. return {
  50788. filename: this.filename,
  50789. content: this.content
  50790. };
  50791. }
  50792. }
  50793. exports.FileSpec = FileSpec;
  50794. /***/ }),
  50795. /* 71 */
  50796. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50797. Object.defineProperty(exports, "__esModule", ({
  50798. value: true
  50799. }));
  50800. exports.MetadataParser = void 0;
  50801. var _xml_parser = __w_pdfjs_require__(64);
  50802. class MetadataParser {
  50803. constructor(data) {
  50804. data = this._repair(data);
  50805. const parser = new _xml_parser.SimpleXMLParser({
  50806. lowerCaseName: true
  50807. });
  50808. const xmlDocument = parser.parseFromString(data);
  50809. this._metadataMap = new Map();
  50810. this._data = data;
  50811. if (xmlDocument) {
  50812. this._parse(xmlDocument);
  50813. }
  50814. }
  50815. _repair(data) {
  50816. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  50817. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  50818. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  50819. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  50820. switch (name) {
  50821. case "amp":
  50822. return "&";
  50823. case "apos":
  50824. return "'";
  50825. case "gt":
  50826. return ">";
  50827. case "lt":
  50828. return "<";
  50829. case "quot":
  50830. return '"';
  50831. }
  50832. throw new Error(`_repair: ${name} isn't defined.`);
  50833. });
  50834. const charBuf = [];
  50835. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  50836. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  50837. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  50838. charBuf.push(String.fromCharCode(code));
  50839. } else {
  50840. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  50841. }
  50842. }
  50843. return ">" + charBuf.join("");
  50844. });
  50845. }
  50846. _getSequence(entry) {
  50847. const name = entry.nodeName;
  50848. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  50849. return null;
  50850. }
  50851. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  50852. }
  50853. _parseArray(entry) {
  50854. if (!entry.hasChildNodes()) {
  50855. return;
  50856. }
  50857. const [seqNode] = entry.childNodes;
  50858. const sequence = this._getSequence(seqNode) || [];
  50859. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  50860. }
  50861. _parse(xmlDocument) {
  50862. let rdf = xmlDocument.documentElement;
  50863. if (rdf.nodeName !== "rdf:rdf") {
  50864. rdf = rdf.firstChild;
  50865. while (rdf && rdf.nodeName !== "rdf:rdf") {
  50866. rdf = rdf.nextSibling;
  50867. }
  50868. }
  50869. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  50870. return;
  50871. }
  50872. for (const desc of rdf.childNodes) {
  50873. if (desc.nodeName !== "rdf:description") {
  50874. continue;
  50875. }
  50876. for (const entry of desc.childNodes) {
  50877. const name = entry.nodeName;
  50878. switch (name) {
  50879. case "#text":
  50880. continue;
  50881. case "dc:creator":
  50882. case "dc:subject":
  50883. this._parseArray(entry);
  50884. continue;
  50885. }
  50886. this._metadataMap.set(name, entry.textContent.trim());
  50887. }
  50888. }
  50889. }
  50890. get serializable() {
  50891. return {
  50892. parsedData: this._metadataMap,
  50893. rawData: this._data
  50894. };
  50895. }
  50896. }
  50897. exports.MetadataParser = MetadataParser;
  50898. /***/ }),
  50899. /* 72 */
  50900. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50901. Object.defineProperty(exports, "__esModule", ({
  50902. value: true
  50903. }));
  50904. exports.StructTreeRoot = exports.StructTreePage = void 0;
  50905. var _primitives = __w_pdfjs_require__(3);
  50906. var _util = __w_pdfjs_require__(2);
  50907. var _name_number_tree = __w_pdfjs_require__(68);
  50908. const MAX_DEPTH = 40;
  50909. const StructElementType = {
  50910. PAGE_CONTENT: "PAGE_CONTENT",
  50911. STREAM_CONTENT: "STREAM_CONTENT",
  50912. OBJECT: "OBJECT",
  50913. ELEMENT: "ELEMENT"
  50914. };
  50915. class StructTreeRoot {
  50916. constructor(rootDict) {
  50917. this.dict = rootDict;
  50918. this.roleMap = new Map();
  50919. }
  50920. init() {
  50921. this.readRoleMap();
  50922. }
  50923. readRoleMap() {
  50924. const roleMapDict = this.dict.get("RoleMap");
  50925. if (!(roleMapDict instanceof _primitives.Dict)) {
  50926. return;
  50927. }
  50928. roleMapDict.forEach((key, value) => {
  50929. if (!(value instanceof _primitives.Name)) {
  50930. return;
  50931. }
  50932. this.roleMap.set(key, value.name);
  50933. });
  50934. }
  50935. }
  50936. exports.StructTreeRoot = StructTreeRoot;
  50937. class StructElementNode {
  50938. constructor(tree, dict) {
  50939. this.tree = tree;
  50940. this.dict = dict;
  50941. this.kids = [];
  50942. this.parseKids();
  50943. }
  50944. get role() {
  50945. const nameObj = this.dict.get("S");
  50946. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  50947. const {
  50948. root
  50949. } = this.tree;
  50950. if (root.roleMap.has(name)) {
  50951. return root.roleMap.get(name);
  50952. }
  50953. return name;
  50954. }
  50955. parseKids() {
  50956. let pageObjId = null;
  50957. const objRef = this.dict.getRaw("Pg");
  50958. if (objRef instanceof _primitives.Ref) {
  50959. pageObjId = objRef.toString();
  50960. }
  50961. const kids = this.dict.get("K");
  50962. if (Array.isArray(kids)) {
  50963. for (const kid of kids) {
  50964. const element = this.parseKid(pageObjId, kid);
  50965. if (element) {
  50966. this.kids.push(element);
  50967. }
  50968. }
  50969. } else {
  50970. const element = this.parseKid(pageObjId, kids);
  50971. if (element) {
  50972. this.kids.push(element);
  50973. }
  50974. }
  50975. }
  50976. parseKid(pageObjId, kid) {
  50977. if (Number.isInteger(kid)) {
  50978. if (this.tree.pageDict.objId !== pageObjId) {
  50979. return null;
  50980. }
  50981. return new StructElement({
  50982. type: StructElementType.PAGE_CONTENT,
  50983. mcid: kid,
  50984. pageObjId
  50985. });
  50986. }
  50987. let kidDict = null;
  50988. if (kid instanceof _primitives.Ref) {
  50989. kidDict = this.dict.xref.fetch(kid);
  50990. } else if (kid instanceof _primitives.Dict) {
  50991. kidDict = kid;
  50992. }
  50993. if (!kidDict) {
  50994. return null;
  50995. }
  50996. const pageRef = kidDict.getRaw("Pg");
  50997. if (pageRef instanceof _primitives.Ref) {
  50998. pageObjId = pageRef.toString();
  50999. }
  51000. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  51001. if (type === "MCR") {
  51002. if (this.tree.pageDict.objId !== pageObjId) {
  51003. return null;
  51004. }
  51005. return new StructElement({
  51006. type: StructElementType.STREAM_CONTENT,
  51007. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  51008. pageObjId,
  51009. mcid: kidDict.get("MCID")
  51010. });
  51011. }
  51012. if (type === "OBJR") {
  51013. if (this.tree.pageDict.objId !== pageObjId) {
  51014. return null;
  51015. }
  51016. return new StructElement({
  51017. type: StructElementType.OBJECT,
  51018. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  51019. pageObjId
  51020. });
  51021. }
  51022. return new StructElement({
  51023. type: StructElementType.ELEMENT,
  51024. dict: kidDict
  51025. });
  51026. }
  51027. }
  51028. class StructElement {
  51029. constructor({
  51030. type,
  51031. dict = null,
  51032. mcid = null,
  51033. pageObjId = null,
  51034. refObjId = null
  51035. }) {
  51036. this.type = type;
  51037. this.dict = dict;
  51038. this.mcid = mcid;
  51039. this.pageObjId = pageObjId;
  51040. this.refObjId = refObjId;
  51041. this.parentNode = null;
  51042. }
  51043. }
  51044. class StructTreePage {
  51045. constructor(structTreeRoot, pageDict) {
  51046. this.root = structTreeRoot;
  51047. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  51048. this.pageDict = pageDict;
  51049. this.nodes = [];
  51050. }
  51051. parse() {
  51052. if (!this.root || !this.rootDict) {
  51053. return;
  51054. }
  51055. const parentTree = this.rootDict.get("ParentTree");
  51056. if (!parentTree) {
  51057. return;
  51058. }
  51059. const id = this.pageDict.get("StructParents");
  51060. if (!Number.isInteger(id)) {
  51061. return;
  51062. }
  51063. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  51064. const parentArray = numberTree.get(id);
  51065. if (!Array.isArray(parentArray)) {
  51066. return;
  51067. }
  51068. const map = new Map();
  51069. for (const ref of parentArray) {
  51070. if (ref instanceof _primitives.Ref) {
  51071. this.addNode(this.rootDict.xref.fetch(ref), map);
  51072. }
  51073. }
  51074. }
  51075. addNode(dict, map, level = 0) {
  51076. if (level > MAX_DEPTH) {
  51077. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  51078. return null;
  51079. }
  51080. if (map.has(dict)) {
  51081. return map.get(dict);
  51082. }
  51083. const element = new StructElementNode(this, dict);
  51084. map.set(dict, element);
  51085. const parent = dict.get("P");
  51086. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  51087. if (!this.addTopLevelNode(dict, element)) {
  51088. map.delete(dict);
  51089. }
  51090. return element;
  51091. }
  51092. const parentNode = this.addNode(parent, map, level + 1);
  51093. if (!parentNode) {
  51094. return element;
  51095. }
  51096. let save = false;
  51097. for (const kid of parentNode.kids) {
  51098. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  51099. kid.parentNode = element;
  51100. save = true;
  51101. }
  51102. }
  51103. if (!save) {
  51104. map.delete(dict);
  51105. }
  51106. return element;
  51107. }
  51108. addTopLevelNode(dict, element) {
  51109. const obj = this.rootDict.get("K");
  51110. if (!obj) {
  51111. return false;
  51112. }
  51113. if (obj instanceof _primitives.Dict) {
  51114. if (obj.objId !== dict.objId) {
  51115. return false;
  51116. }
  51117. this.nodes[0] = element;
  51118. return true;
  51119. }
  51120. if (!Array.isArray(obj)) {
  51121. return true;
  51122. }
  51123. let save = false;
  51124. for (let i = 0; i < obj.length; i++) {
  51125. const kidRef = obj[i];
  51126. if (kidRef && kidRef.toString() === dict.objId) {
  51127. this.nodes[i] = element;
  51128. save = true;
  51129. }
  51130. }
  51131. return save;
  51132. }
  51133. get serializable() {
  51134. function nodeToSerializable(node, parent, level = 0) {
  51135. if (level > MAX_DEPTH) {
  51136. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51137. return;
  51138. }
  51139. const obj = Object.create(null);
  51140. obj.role = node.role;
  51141. obj.children = [];
  51142. parent.children.push(obj);
  51143. const alt = node.dict.get("Alt");
  51144. if (typeof alt === "string") {
  51145. obj.alt = (0, _util.stringToPDFString)(alt);
  51146. }
  51147. const lang = node.dict.get("Lang");
  51148. if (typeof lang === "string") {
  51149. obj.lang = (0, _util.stringToPDFString)(lang);
  51150. }
  51151. for (const kid of node.kids) {
  51152. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51153. if (kidElement) {
  51154. nodeToSerializable(kidElement, obj, level + 1);
  51155. continue;
  51156. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51157. obj.children.push({
  51158. type: "content",
  51159. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51160. });
  51161. } else if (kid.type === StructElementType.OBJECT) {
  51162. obj.children.push({
  51163. type: "object",
  51164. id: kid.refObjId
  51165. });
  51166. }
  51167. }
  51168. }
  51169. const root = Object.create(null);
  51170. root.children = [];
  51171. root.role = "Root";
  51172. for (const child of this.nodes) {
  51173. if (!child) {
  51174. continue;
  51175. }
  51176. nodeToSerializable(child, root);
  51177. }
  51178. return root;
  51179. }
  51180. }
  51181. exports.StructTreePage = StructTreePage;
  51182. /***/ }),
  51183. /* 73 */
  51184. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51185. Object.defineProperty(exports, "__esModule", ({
  51186. value: true
  51187. }));
  51188. exports.ObjectLoader = void 0;
  51189. var _primitives = __w_pdfjs_require__(3);
  51190. var _base_stream = __w_pdfjs_require__(5);
  51191. var _core_utils = __w_pdfjs_require__(4);
  51192. var _util = __w_pdfjs_require__(2);
  51193. function mayHaveChildren(value) {
  51194. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51195. }
  51196. function addChildren(node, nodesToVisit) {
  51197. if (node instanceof _primitives.Dict) {
  51198. node = node.getRawValues();
  51199. } else if (node instanceof _base_stream.BaseStream) {
  51200. node = node.dict.getRawValues();
  51201. } else if (!Array.isArray(node)) {
  51202. return;
  51203. }
  51204. for (const rawValue of node) {
  51205. if (mayHaveChildren(rawValue)) {
  51206. nodesToVisit.push(rawValue);
  51207. }
  51208. }
  51209. }
  51210. class ObjectLoader {
  51211. constructor(dict, keys, xref) {
  51212. this.dict = dict;
  51213. this.keys = keys;
  51214. this.xref = xref;
  51215. this.refSet = null;
  51216. }
  51217. async load() {
  51218. if (this.xref.stream.isDataLoaded) {
  51219. return undefined;
  51220. }
  51221. const {
  51222. keys,
  51223. dict
  51224. } = this;
  51225. this.refSet = new _primitives.RefSet();
  51226. const nodesToVisit = [];
  51227. for (const key of keys) {
  51228. const rawValue = dict.getRaw(key);
  51229. if (rawValue !== undefined) {
  51230. nodesToVisit.push(rawValue);
  51231. }
  51232. }
  51233. return this._walk(nodesToVisit);
  51234. }
  51235. async _walk(nodesToVisit) {
  51236. const nodesToRevisit = [];
  51237. const pendingRequests = [];
  51238. while (nodesToVisit.length) {
  51239. let currentNode = nodesToVisit.pop();
  51240. if (currentNode instanceof _primitives.Ref) {
  51241. if (this.refSet.has(currentNode)) {
  51242. continue;
  51243. }
  51244. try {
  51245. this.refSet.put(currentNode);
  51246. currentNode = this.xref.fetch(currentNode);
  51247. } catch (ex) {
  51248. if (!(ex instanceof _core_utils.MissingDataException)) {
  51249. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51250. this.refSet = null;
  51251. const {
  51252. manager
  51253. } = this.xref.stream;
  51254. return manager.requestAllChunks();
  51255. }
  51256. nodesToRevisit.push(currentNode);
  51257. pendingRequests.push({
  51258. begin: ex.begin,
  51259. end: ex.end
  51260. });
  51261. }
  51262. }
  51263. if (currentNode instanceof _base_stream.BaseStream) {
  51264. const baseStreams = currentNode.getBaseStreams();
  51265. if (baseStreams) {
  51266. let foundMissingData = false;
  51267. for (const stream of baseStreams) {
  51268. if (stream.isDataLoaded) {
  51269. continue;
  51270. }
  51271. foundMissingData = true;
  51272. pendingRequests.push({
  51273. begin: stream.start,
  51274. end: stream.end
  51275. });
  51276. }
  51277. if (foundMissingData) {
  51278. nodesToRevisit.push(currentNode);
  51279. }
  51280. }
  51281. }
  51282. addChildren(currentNode, nodesToVisit);
  51283. }
  51284. if (pendingRequests.length) {
  51285. await this.xref.stream.manager.requestRanges(pendingRequests);
  51286. for (const node of nodesToRevisit) {
  51287. if (node instanceof _primitives.Ref) {
  51288. this.refSet.remove(node);
  51289. }
  51290. }
  51291. return this._walk(nodesToRevisit);
  51292. }
  51293. this.refSet = null;
  51294. return undefined;
  51295. }
  51296. }
  51297. exports.ObjectLoader = ObjectLoader;
  51298. /***/ }),
  51299. /* 74 */
  51300. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51301. Object.defineProperty(exports, "__esModule", ({
  51302. value: true
  51303. }));
  51304. exports.XFAFactory = void 0;
  51305. var _xfa_object = __w_pdfjs_require__(75);
  51306. var _bind = __w_pdfjs_require__(79);
  51307. var _data = __w_pdfjs_require__(85);
  51308. var _fonts = __w_pdfjs_require__(83);
  51309. var _utils = __w_pdfjs_require__(76);
  51310. var _util = __w_pdfjs_require__(2);
  51311. var _parser = __w_pdfjs_require__(86);
  51312. var _xhtml = __w_pdfjs_require__(96);
  51313. class XFAFactory {
  51314. constructor(data) {
  51315. try {
  51316. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51317. const binder = new _bind.Binder(this.root);
  51318. this.form = binder.bind();
  51319. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51320. this.form[_xfa_object.$globalData].template = this.form;
  51321. } catch (e) {
  51322. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51323. }
  51324. }
  51325. isValid() {
  51326. return this.root && this.form;
  51327. }
  51328. _createPagesHelper() {
  51329. const iterator = this.form[_xfa_object.$toPages]();
  51330. return new Promise((resolve, reject) => {
  51331. const nextIteration = () => {
  51332. try {
  51333. const value = iterator.next();
  51334. if (value.done) {
  51335. resolve(value.value);
  51336. } else {
  51337. setTimeout(nextIteration, 0);
  51338. }
  51339. } catch (e) {
  51340. reject(e);
  51341. }
  51342. };
  51343. setTimeout(nextIteration, 0);
  51344. });
  51345. }
  51346. async _createPages() {
  51347. try {
  51348. this.pages = await this._createPagesHelper();
  51349. this.dims = this.pages.children.map(c => {
  51350. const {
  51351. width,
  51352. height
  51353. } = c.attributes.style;
  51354. return [0, 0, parseInt(width), parseInt(height)];
  51355. });
  51356. } catch (e) {
  51357. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51358. }
  51359. }
  51360. getBoundingBox(pageIndex) {
  51361. return this.dims[pageIndex];
  51362. }
  51363. async getNumPages() {
  51364. if (!this.pages) {
  51365. await this._createPages();
  51366. }
  51367. return this.dims.length;
  51368. }
  51369. setImages(images) {
  51370. this.form[_xfa_object.$globalData].images = images;
  51371. }
  51372. setFonts(fonts) {
  51373. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51374. const missingFonts = [];
  51375. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51376. typeface = (0, _utils.stripQuotes)(typeface);
  51377. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51378. if (!font) {
  51379. missingFonts.push(typeface);
  51380. }
  51381. }
  51382. if (missingFonts.length > 0) {
  51383. return missingFonts;
  51384. }
  51385. return null;
  51386. }
  51387. appendFonts(fonts, reallyMissingFonts) {
  51388. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51389. }
  51390. async getPages() {
  51391. if (!this.pages) {
  51392. await this._createPages();
  51393. }
  51394. const pages = this.pages;
  51395. this.pages = null;
  51396. return pages;
  51397. }
  51398. serializeData(storage) {
  51399. return this.dataHandler.serialize(storage);
  51400. }
  51401. static _createDocument(data) {
  51402. if (!data["/xdp:xdp"]) {
  51403. return data["xdp:xdp"];
  51404. }
  51405. return Object.values(data).join("");
  51406. }
  51407. static getRichTextAsHtml(rc) {
  51408. if (!rc || typeof rc !== "string") {
  51409. return null;
  51410. }
  51411. try {
  51412. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51413. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51414. const newRoot = _xhtml.XhtmlNamespace.body({});
  51415. newRoot[_xfa_object.$appendChild](root);
  51416. root = newRoot;
  51417. }
  51418. const result = root[_xfa_object.$toHTML]();
  51419. if (!result.success) {
  51420. return null;
  51421. }
  51422. const {
  51423. html
  51424. } = result;
  51425. const {
  51426. attributes
  51427. } = html;
  51428. if (attributes) {
  51429. if (attributes.class) {
  51430. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51431. }
  51432. attributes.dir = "auto";
  51433. }
  51434. return {
  51435. html,
  51436. str: root[_xfa_object.$text]()
  51437. };
  51438. } catch (e) {
  51439. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51440. }
  51441. return null;
  51442. }
  51443. }
  51444. exports.XFAFactory = XFAFactory;
  51445. /***/ }),
  51446. /* 75 */
  51447. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51448. Object.defineProperty(exports, "__esModule", ({
  51449. value: true
  51450. }));
  51451. 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;
  51452. var _utils = __w_pdfjs_require__(76);
  51453. var _util = __w_pdfjs_require__(2);
  51454. var _core_utils = __w_pdfjs_require__(4);
  51455. var _namespaces = __w_pdfjs_require__(77);
  51456. var _som = __w_pdfjs_require__(78);
  51457. const $acceptWhitespace = Symbol();
  51458. exports.$acceptWhitespace = $acceptWhitespace;
  51459. const $addHTML = Symbol();
  51460. exports.$addHTML = $addHTML;
  51461. const $appendChild = Symbol();
  51462. exports.$appendChild = $appendChild;
  51463. const $childrenToHTML = Symbol();
  51464. exports.$childrenToHTML = $childrenToHTML;
  51465. const $clean = Symbol();
  51466. exports.$clean = $clean;
  51467. const $cleanPage = Symbol();
  51468. exports.$cleanPage = $cleanPage;
  51469. const $cleanup = Symbol();
  51470. exports.$cleanup = $cleanup;
  51471. const $clone = Symbol();
  51472. exports.$clone = $clone;
  51473. const $consumed = Symbol();
  51474. exports.$consumed = $consumed;
  51475. const $content = Symbol("content");
  51476. exports.$content = $content;
  51477. const $data = Symbol("data");
  51478. exports.$data = $data;
  51479. const $dump = Symbol();
  51480. exports.$dump = $dump;
  51481. const $extra = Symbol("extra");
  51482. exports.$extra = $extra;
  51483. const $finalize = Symbol();
  51484. exports.$finalize = $finalize;
  51485. const $flushHTML = Symbol();
  51486. exports.$flushHTML = $flushHTML;
  51487. const $getAttributeIt = Symbol();
  51488. exports.$getAttributeIt = $getAttributeIt;
  51489. const $getAttributes = Symbol();
  51490. exports.$getAttributes = $getAttributes;
  51491. const $getAvailableSpace = Symbol();
  51492. exports.$getAvailableSpace = $getAvailableSpace;
  51493. const $getChildrenByClass = Symbol();
  51494. exports.$getChildrenByClass = $getChildrenByClass;
  51495. const $getChildrenByName = Symbol();
  51496. exports.$getChildrenByName = $getChildrenByName;
  51497. const $getChildrenByNameIt = Symbol();
  51498. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51499. const $getDataValue = Symbol();
  51500. exports.$getDataValue = $getDataValue;
  51501. const $getExtra = Symbol();
  51502. exports.$getExtra = $getExtra;
  51503. const $getRealChildrenByNameIt = Symbol();
  51504. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51505. const $getChildren = Symbol();
  51506. exports.$getChildren = $getChildren;
  51507. const $getContainedChildren = Symbol();
  51508. exports.$getContainedChildren = $getContainedChildren;
  51509. const $getNextPage = Symbol();
  51510. exports.$getNextPage = $getNextPage;
  51511. const $getSubformParent = Symbol();
  51512. exports.$getSubformParent = $getSubformParent;
  51513. const $getParent = Symbol();
  51514. exports.$getParent = $getParent;
  51515. const $getTemplateRoot = Symbol();
  51516. exports.$getTemplateRoot = $getTemplateRoot;
  51517. const $globalData = Symbol();
  51518. exports.$globalData = $globalData;
  51519. const $hasSettableValue = Symbol();
  51520. exports.$hasSettableValue = $hasSettableValue;
  51521. const $ids = Symbol();
  51522. exports.$ids = $ids;
  51523. const $indexOf = Symbol();
  51524. exports.$indexOf = $indexOf;
  51525. const $insertAt = Symbol();
  51526. exports.$insertAt = $insertAt;
  51527. const $isCDATAXml = Symbol();
  51528. exports.$isCDATAXml = $isCDATAXml;
  51529. const $isBindable = Symbol();
  51530. exports.$isBindable = $isBindable;
  51531. const $isDataValue = Symbol();
  51532. exports.$isDataValue = $isDataValue;
  51533. const $isDescendent = Symbol();
  51534. exports.$isDescendent = $isDescendent;
  51535. const $isNsAgnostic = Symbol();
  51536. exports.$isNsAgnostic = $isNsAgnostic;
  51537. const $isSplittable = Symbol();
  51538. exports.$isSplittable = $isSplittable;
  51539. const $isThereMoreWidth = Symbol();
  51540. exports.$isThereMoreWidth = $isThereMoreWidth;
  51541. const $isTransparent = Symbol();
  51542. exports.$isTransparent = $isTransparent;
  51543. const $isUsable = Symbol();
  51544. exports.$isUsable = $isUsable;
  51545. const $lastAttribute = Symbol();
  51546. const $namespaceId = Symbol("namespaceId");
  51547. exports.$namespaceId = $namespaceId;
  51548. const $nodeName = Symbol("nodeName");
  51549. exports.$nodeName = $nodeName;
  51550. const $nsAttributes = Symbol();
  51551. exports.$nsAttributes = $nsAttributes;
  51552. const $onChild = Symbol();
  51553. exports.$onChild = $onChild;
  51554. const $onChildCheck = Symbol();
  51555. exports.$onChildCheck = $onChildCheck;
  51556. const $onText = Symbol();
  51557. exports.$onText = $onText;
  51558. const $pushGlyphs = Symbol();
  51559. exports.$pushGlyphs = $pushGlyphs;
  51560. const $popPara = Symbol();
  51561. exports.$popPara = $popPara;
  51562. const $pushPara = Symbol();
  51563. exports.$pushPara = $pushPara;
  51564. const $removeChild = Symbol();
  51565. exports.$removeChild = $removeChild;
  51566. const $root = Symbol("root");
  51567. exports.$root = $root;
  51568. const $resolvePrototypes = Symbol();
  51569. exports.$resolvePrototypes = $resolvePrototypes;
  51570. const $searchNode = Symbol();
  51571. exports.$searchNode = $searchNode;
  51572. const $setId = Symbol();
  51573. exports.$setId = $setId;
  51574. const $setSetAttributes = Symbol();
  51575. exports.$setSetAttributes = $setSetAttributes;
  51576. const $setValue = Symbol();
  51577. exports.$setValue = $setValue;
  51578. const $tabIndex = Symbol();
  51579. exports.$tabIndex = $tabIndex;
  51580. const $text = Symbol();
  51581. exports.$text = $text;
  51582. const $toPages = Symbol();
  51583. exports.$toPages = $toPages;
  51584. const $toHTML = Symbol();
  51585. exports.$toHTML = $toHTML;
  51586. const $toString = Symbol();
  51587. exports.$toString = $toString;
  51588. const $toStyle = Symbol();
  51589. exports.$toStyle = $toStyle;
  51590. const $uid = Symbol("uid");
  51591. exports.$uid = $uid;
  51592. const _applyPrototype = Symbol();
  51593. const _attributes = Symbol();
  51594. const _attributeNames = Symbol();
  51595. const _children = Symbol("_children");
  51596. const _cloneAttribute = Symbol();
  51597. const _dataValue = Symbol();
  51598. const _defaultValue = Symbol();
  51599. const _filteredChildrenGenerator = Symbol();
  51600. const _getPrototype = Symbol();
  51601. const _getUnsetAttributes = Symbol();
  51602. const _hasChildren = Symbol();
  51603. const _max = Symbol();
  51604. const _options = Symbol();
  51605. const _parent = Symbol("parent");
  51606. const _resolvePrototypesHelper = Symbol();
  51607. const _setAttributes = Symbol();
  51608. const _validator = Symbol();
  51609. let uid = 0;
  51610. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51611. class XFAObject {
  51612. constructor(nsId, name, hasChildren = false) {
  51613. this[$namespaceId] = nsId;
  51614. this[$nodeName] = name;
  51615. this[_hasChildren] = hasChildren;
  51616. this[_parent] = null;
  51617. this[_children] = [];
  51618. this[$uid] = `${name}${uid++}`;
  51619. this[$globalData] = null;
  51620. }
  51621. [$onChild](child) {
  51622. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  51623. return false;
  51624. }
  51625. const name = child[$nodeName];
  51626. const node = this[name];
  51627. if (node instanceof XFAObjectArray) {
  51628. if (node.push(child)) {
  51629. this[$appendChild](child);
  51630. return true;
  51631. }
  51632. } else {
  51633. if (node !== null) {
  51634. this[$removeChild](node);
  51635. }
  51636. this[name] = child;
  51637. this[$appendChild](child);
  51638. return true;
  51639. }
  51640. let id = "";
  51641. if (this.id) {
  51642. id = ` (id: ${this.id})`;
  51643. } else if (this.name) {
  51644. id = ` (name: ${this.name} ${this.h.value})`;
  51645. }
  51646. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  51647. return false;
  51648. }
  51649. [$onChildCheck](child) {
  51650. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  51651. }
  51652. [$isNsAgnostic]() {
  51653. return false;
  51654. }
  51655. [$acceptWhitespace]() {
  51656. return false;
  51657. }
  51658. [$isCDATAXml]() {
  51659. return false;
  51660. }
  51661. [$isBindable]() {
  51662. return false;
  51663. }
  51664. [$popPara]() {
  51665. if (this.para) {
  51666. this[$getTemplateRoot]()[$extra].paraStack.pop();
  51667. }
  51668. }
  51669. [$pushPara]() {
  51670. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  51671. }
  51672. [$setId](ids) {
  51673. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  51674. ids.set(this.id, this);
  51675. }
  51676. }
  51677. [$getTemplateRoot]() {
  51678. return this[$globalData].template;
  51679. }
  51680. [$isSplittable]() {
  51681. return false;
  51682. }
  51683. [$isThereMoreWidth]() {
  51684. return false;
  51685. }
  51686. [$appendChild](child) {
  51687. child[_parent] = this;
  51688. this[_children].push(child);
  51689. if (!child[$globalData] && this[$globalData]) {
  51690. child[$globalData] = this[$globalData];
  51691. }
  51692. }
  51693. [$removeChild](child) {
  51694. const i = this[_children].indexOf(child);
  51695. this[_children].splice(i, 1);
  51696. }
  51697. [$hasSettableValue]() {
  51698. return this.hasOwnProperty("value");
  51699. }
  51700. [$setValue](_) {}
  51701. [$onText](_) {}
  51702. [$finalize]() {}
  51703. [$clean](builder) {
  51704. delete this[_hasChildren];
  51705. if (this[$cleanup]) {
  51706. builder.clean(this[$cleanup]);
  51707. delete this[$cleanup];
  51708. }
  51709. }
  51710. [$indexOf](child) {
  51711. return this[_children].indexOf(child);
  51712. }
  51713. [$insertAt](i, child) {
  51714. child[_parent] = this;
  51715. this[_children].splice(i, 0, child);
  51716. if (!child[$globalData] && this[$globalData]) {
  51717. child[$globalData] = this[$globalData];
  51718. }
  51719. }
  51720. [$isTransparent]() {
  51721. return !this.name;
  51722. }
  51723. [$lastAttribute]() {
  51724. return "";
  51725. }
  51726. [$text]() {
  51727. if (this[_children].length === 0) {
  51728. return this[$content];
  51729. }
  51730. return this[_children].map(c => c[$text]()).join("");
  51731. }
  51732. get [_attributeNames]() {
  51733. const proto = Object.getPrototypeOf(this);
  51734. if (!proto._attributes) {
  51735. const attributes = proto._attributes = new Set();
  51736. for (const name of Object.getOwnPropertyNames(this)) {
  51737. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  51738. break;
  51739. }
  51740. attributes.add(name);
  51741. }
  51742. }
  51743. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  51744. }
  51745. [$isDescendent](parent) {
  51746. let node = this;
  51747. while (node) {
  51748. if (node === parent) {
  51749. return true;
  51750. }
  51751. node = node[$getParent]();
  51752. }
  51753. return false;
  51754. }
  51755. [$getParent]() {
  51756. return this[_parent];
  51757. }
  51758. [$getSubformParent]() {
  51759. return this[$getParent]();
  51760. }
  51761. [$getChildren](name = null) {
  51762. if (!name) {
  51763. return this[_children];
  51764. }
  51765. return this[name];
  51766. }
  51767. [$dump]() {
  51768. const dumped = Object.create(null);
  51769. if (this[$content]) {
  51770. dumped.$content = this[$content];
  51771. }
  51772. for (const name of Object.getOwnPropertyNames(this)) {
  51773. const value = this[name];
  51774. if (value === null) {
  51775. continue;
  51776. }
  51777. if (value instanceof XFAObject) {
  51778. dumped[name] = value[$dump]();
  51779. } else if (value instanceof XFAObjectArray) {
  51780. if (!value.isEmpty()) {
  51781. dumped[name] = value.dump();
  51782. }
  51783. } else {
  51784. dumped[name] = value;
  51785. }
  51786. }
  51787. return dumped;
  51788. }
  51789. [$toStyle]() {
  51790. return null;
  51791. }
  51792. [$toHTML]() {
  51793. return _utils.HTMLResult.EMPTY;
  51794. }
  51795. *[$getContainedChildren]() {
  51796. for (const node of this[$getChildren]()) {
  51797. yield node;
  51798. }
  51799. }
  51800. *[_filteredChildrenGenerator](filter, include) {
  51801. for (const node of this[$getContainedChildren]()) {
  51802. if (!filter || include === filter.has(node[$nodeName])) {
  51803. const availableSpace = this[$getAvailableSpace]();
  51804. const res = node[$toHTML](availableSpace);
  51805. if (!res.success) {
  51806. this[$extra].failingNode = node;
  51807. }
  51808. yield res;
  51809. }
  51810. }
  51811. }
  51812. [$flushHTML]() {
  51813. return null;
  51814. }
  51815. [$addHTML](html, bbox) {
  51816. this[$extra].children.push(html);
  51817. }
  51818. [$getAvailableSpace]() {}
  51819. [$childrenToHTML]({
  51820. filter = null,
  51821. include = true
  51822. }) {
  51823. if (!this[$extra].generator) {
  51824. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  51825. } else {
  51826. const availableSpace = this[$getAvailableSpace]();
  51827. const res = this[$extra].failingNode[$toHTML](availableSpace);
  51828. if (!res.success) {
  51829. return res;
  51830. }
  51831. if (res.html) {
  51832. this[$addHTML](res.html, res.bbox);
  51833. }
  51834. delete this[$extra].failingNode;
  51835. }
  51836. while (true) {
  51837. const gen = this[$extra].generator.next();
  51838. if (gen.done) {
  51839. break;
  51840. }
  51841. const res = gen.value;
  51842. if (!res.success) {
  51843. return res;
  51844. }
  51845. if (res.html) {
  51846. this[$addHTML](res.html, res.bbox);
  51847. }
  51848. }
  51849. this[$extra].generator = null;
  51850. return _utils.HTMLResult.EMPTY;
  51851. }
  51852. [$setSetAttributes](attributes) {
  51853. this[_setAttributes] = new Set(Object.keys(attributes));
  51854. }
  51855. [_getUnsetAttributes](protoAttributes) {
  51856. const allAttr = this[_attributeNames];
  51857. const setAttr = this[_setAttributes];
  51858. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  51859. }
  51860. [$resolvePrototypes](ids, ancestors = new Set()) {
  51861. for (const child of this[_children]) {
  51862. child[_resolvePrototypesHelper](ids, ancestors);
  51863. }
  51864. }
  51865. [_resolvePrototypesHelper](ids, ancestors) {
  51866. const proto = this[_getPrototype](ids, ancestors);
  51867. if (proto) {
  51868. this[_applyPrototype](proto, ids, ancestors);
  51869. } else {
  51870. this[$resolvePrototypes](ids, ancestors);
  51871. }
  51872. }
  51873. [_getPrototype](ids, ancestors) {
  51874. const {
  51875. use,
  51876. usehref
  51877. } = this;
  51878. if (!use && !usehref) {
  51879. return null;
  51880. }
  51881. let proto = null;
  51882. let somExpression = null;
  51883. let id = null;
  51884. let ref = use;
  51885. if (usehref) {
  51886. ref = usehref;
  51887. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  51888. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  51889. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  51890. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  51891. } else if (usehref.startsWith("#")) {
  51892. id = usehref.slice(1);
  51893. } else if (usehref.startsWith(".#")) {
  51894. id = usehref.slice(2);
  51895. }
  51896. } else if (use.startsWith("#")) {
  51897. id = use.slice(1);
  51898. } else {
  51899. somExpression = use;
  51900. }
  51901. this.use = this.usehref = "";
  51902. if (id) {
  51903. proto = ids.get(id);
  51904. } else {
  51905. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  51906. if (proto) {
  51907. proto = proto[0];
  51908. }
  51909. }
  51910. if (!proto) {
  51911. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  51912. return null;
  51913. }
  51914. if (proto[$nodeName] !== this[$nodeName]) {
  51915. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  51916. return null;
  51917. }
  51918. if (ancestors.has(proto)) {
  51919. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51920. return null;
  51921. }
  51922. ancestors.add(proto);
  51923. const protoProto = proto[_getPrototype](ids, ancestors);
  51924. if (protoProto) {
  51925. proto[_applyPrototype](protoProto, ids, ancestors);
  51926. }
  51927. proto[$resolvePrototypes](ids, ancestors);
  51928. ancestors.delete(proto);
  51929. return proto;
  51930. }
  51931. [_applyPrototype](proto, ids, ancestors) {
  51932. if (ancestors.has(proto)) {
  51933. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51934. return;
  51935. }
  51936. if (!this[$content] && proto[$content]) {
  51937. this[$content] = proto[$content];
  51938. }
  51939. const newAncestors = new Set(ancestors);
  51940. newAncestors.add(proto);
  51941. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  51942. this[unsetAttrName] = proto[unsetAttrName];
  51943. if (this[_setAttributes]) {
  51944. this[_setAttributes].add(unsetAttrName);
  51945. }
  51946. }
  51947. for (const name of Object.getOwnPropertyNames(this)) {
  51948. if (this[_attributeNames].has(name)) {
  51949. continue;
  51950. }
  51951. const value = this[name];
  51952. const protoValue = proto[name];
  51953. if (value instanceof XFAObjectArray) {
  51954. for (const child of value[_children]) {
  51955. child[_resolvePrototypesHelper](ids, ancestors);
  51956. }
  51957. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  51958. const child = proto[_children][i][$clone]();
  51959. if (value.push(child)) {
  51960. child[_parent] = this;
  51961. this[_children].push(child);
  51962. child[_resolvePrototypesHelper](ids, ancestors);
  51963. } else {
  51964. break;
  51965. }
  51966. }
  51967. continue;
  51968. }
  51969. if (value !== null) {
  51970. value[$resolvePrototypes](ids, ancestors);
  51971. if (protoValue) {
  51972. value[_applyPrototype](protoValue, ids, ancestors);
  51973. }
  51974. continue;
  51975. }
  51976. if (protoValue !== null) {
  51977. const child = protoValue[$clone]();
  51978. child[_parent] = this;
  51979. this[name] = child;
  51980. this[_children].push(child);
  51981. child[_resolvePrototypesHelper](ids, ancestors);
  51982. }
  51983. }
  51984. }
  51985. static [_cloneAttribute](obj) {
  51986. if (Array.isArray(obj)) {
  51987. return obj.map(x => XFAObject[_cloneAttribute](x));
  51988. }
  51989. if (typeof obj === "object" && obj !== null) {
  51990. return Object.assign({}, obj);
  51991. }
  51992. return obj;
  51993. }
  51994. [$clone]() {
  51995. const clone = Object.create(Object.getPrototypeOf(this));
  51996. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  51997. try {
  51998. clone[$symbol] = this[$symbol];
  51999. } catch (_) {
  52000. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  52001. }
  52002. }
  52003. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  52004. clone[_children] = [];
  52005. for (const name of Object.getOwnPropertyNames(this)) {
  52006. if (this[_attributeNames].has(name)) {
  52007. clone[name] = XFAObject[_cloneAttribute](this[name]);
  52008. continue;
  52009. }
  52010. const value = this[name];
  52011. if (value instanceof XFAObjectArray) {
  52012. clone[name] = new XFAObjectArray(value[_max]);
  52013. } else {
  52014. clone[name] = null;
  52015. }
  52016. }
  52017. for (const child of this[_children]) {
  52018. const name = child[$nodeName];
  52019. const clonedChild = child[$clone]();
  52020. clone[_children].push(clonedChild);
  52021. clonedChild[_parent] = clone;
  52022. if (clone[name] === null) {
  52023. clone[name] = clonedChild;
  52024. } else {
  52025. clone[name][_children].push(clonedChild);
  52026. }
  52027. }
  52028. return clone;
  52029. }
  52030. [$getChildren](name = null) {
  52031. if (!name) {
  52032. return this[_children];
  52033. }
  52034. return this[_children].filter(c => c[$nodeName] === name);
  52035. }
  52036. [$getChildrenByClass](name) {
  52037. return this[name];
  52038. }
  52039. [$getChildrenByName](name, allTransparent, first = true) {
  52040. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  52041. }
  52042. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  52043. if (name === "parent") {
  52044. yield this[_parent];
  52045. return;
  52046. }
  52047. for (const child of this[_children]) {
  52048. if (child[$nodeName] === name) {
  52049. yield child;
  52050. }
  52051. if (child.name === name) {
  52052. yield child;
  52053. }
  52054. if (allTransparent || child[$isTransparent]()) {
  52055. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  52056. }
  52057. }
  52058. if (first && this[_attributeNames].has(name)) {
  52059. yield new XFAAttribute(this, name, this[name]);
  52060. }
  52061. }
  52062. }
  52063. exports.XFAObject = XFAObject;
  52064. class XFAObjectArray {
  52065. constructor(max = Infinity) {
  52066. this[_max] = max;
  52067. this[_children] = [];
  52068. }
  52069. push(child) {
  52070. const len = this[_children].length;
  52071. if (len <= this[_max]) {
  52072. this[_children].push(child);
  52073. return true;
  52074. }
  52075. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  52076. return false;
  52077. }
  52078. isEmpty() {
  52079. return this[_children].length === 0;
  52080. }
  52081. dump() {
  52082. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  52083. }
  52084. [$clone]() {
  52085. const clone = new XFAObjectArray(this[_max]);
  52086. clone[_children] = this[_children].map(c => c[$clone]());
  52087. return clone;
  52088. }
  52089. get children() {
  52090. return this[_children];
  52091. }
  52092. clear() {
  52093. this[_children].length = 0;
  52094. }
  52095. }
  52096. exports.XFAObjectArray = XFAObjectArray;
  52097. class XFAAttribute {
  52098. constructor(node, name, value) {
  52099. this[_parent] = node;
  52100. this[$nodeName] = name;
  52101. this[$content] = value;
  52102. this[$consumed] = false;
  52103. this[$uid] = `attribute${uid++}`;
  52104. }
  52105. [$getParent]() {
  52106. return this[_parent];
  52107. }
  52108. [$isDataValue]() {
  52109. return true;
  52110. }
  52111. [$getDataValue]() {
  52112. return this[$content].trim();
  52113. }
  52114. [$setValue](value) {
  52115. value = value.value || "";
  52116. this[$content] = value.toString();
  52117. }
  52118. [$text]() {
  52119. return this[$content];
  52120. }
  52121. [$isDescendent](parent) {
  52122. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  52123. }
  52124. }
  52125. exports.XFAAttribute = XFAAttribute;
  52126. class XmlObject extends XFAObject {
  52127. constructor(nsId, name, attributes = {}) {
  52128. super(nsId, name);
  52129. this[$content] = "";
  52130. this[_dataValue] = null;
  52131. if (name !== "#text") {
  52132. const map = new Map();
  52133. this[_attributes] = map;
  52134. for (const [attrName, value] of Object.entries(attributes)) {
  52135. map.set(attrName, new XFAAttribute(this, attrName, value));
  52136. }
  52137. if (attributes.hasOwnProperty($nsAttributes)) {
  52138. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52139. if (dataNode !== undefined) {
  52140. if (dataNode === "dataGroup") {
  52141. this[_dataValue] = false;
  52142. } else if (dataNode === "dataValue") {
  52143. this[_dataValue] = true;
  52144. }
  52145. }
  52146. }
  52147. }
  52148. this[$consumed] = false;
  52149. }
  52150. [$toString](buf) {
  52151. const tagName = this[$nodeName];
  52152. if (tagName === "#text") {
  52153. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52154. return;
  52155. }
  52156. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52157. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52158. buf.push(`<${prefix}${utf8TagName}`);
  52159. for (const [name, value] of this[_attributes].entries()) {
  52160. const utf8Name = (0, _util.utf8StringToString)(name);
  52161. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52162. }
  52163. if (this[_dataValue] !== null) {
  52164. if (this[_dataValue]) {
  52165. buf.push(` xfa:dataNode="dataValue"`);
  52166. } else {
  52167. buf.push(` xfa:dataNode="dataGroup"`);
  52168. }
  52169. }
  52170. if (!this[$content] && this[_children].length === 0) {
  52171. buf.push("/>");
  52172. return;
  52173. }
  52174. buf.push(">");
  52175. if (this[$content]) {
  52176. if (typeof this[$content] === "string") {
  52177. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52178. } else {
  52179. this[$content][$toString](buf);
  52180. }
  52181. } else {
  52182. for (const child of this[_children]) {
  52183. child[$toString](buf);
  52184. }
  52185. }
  52186. buf.push(`</${prefix}${utf8TagName}>`);
  52187. }
  52188. [$onChild](child) {
  52189. if (this[$content]) {
  52190. const node = new XmlObject(this[$namespaceId], "#text");
  52191. this[$appendChild](node);
  52192. node[$content] = this[$content];
  52193. this[$content] = "";
  52194. }
  52195. this[$appendChild](child);
  52196. return true;
  52197. }
  52198. [$onText](str) {
  52199. this[$content] += str;
  52200. }
  52201. [$finalize]() {
  52202. if (this[$content] && this[_children].length > 0) {
  52203. const node = new XmlObject(this[$namespaceId], "#text");
  52204. this[$appendChild](node);
  52205. node[$content] = this[$content];
  52206. delete this[$content];
  52207. }
  52208. }
  52209. [$toHTML]() {
  52210. if (this[$nodeName] === "#text") {
  52211. return _utils.HTMLResult.success({
  52212. name: "#text",
  52213. value: this[$content]
  52214. });
  52215. }
  52216. return _utils.HTMLResult.EMPTY;
  52217. }
  52218. [$getChildren](name = null) {
  52219. if (!name) {
  52220. return this[_children];
  52221. }
  52222. return this[_children].filter(c => c[$nodeName] === name);
  52223. }
  52224. [$getAttributes]() {
  52225. return this[_attributes];
  52226. }
  52227. [$getChildrenByClass](name) {
  52228. const value = this[_attributes].get(name);
  52229. if (value !== undefined) {
  52230. return value;
  52231. }
  52232. return this[$getChildren](name);
  52233. }
  52234. *[$getChildrenByNameIt](name, allTransparent) {
  52235. const value = this[_attributes].get(name);
  52236. if (value) {
  52237. yield value;
  52238. }
  52239. for (const child of this[_children]) {
  52240. if (child[$nodeName] === name) {
  52241. yield child;
  52242. }
  52243. if (allTransparent) {
  52244. yield* child[$getChildrenByNameIt](name, allTransparent);
  52245. }
  52246. }
  52247. }
  52248. *[$getAttributeIt](name, skipConsumed) {
  52249. const value = this[_attributes].get(name);
  52250. if (value && (!skipConsumed || !value[$consumed])) {
  52251. yield value;
  52252. }
  52253. for (const child of this[_children]) {
  52254. yield* child[$getAttributeIt](name, skipConsumed);
  52255. }
  52256. }
  52257. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52258. for (const child of this[_children]) {
  52259. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52260. yield child;
  52261. }
  52262. if (allTransparent) {
  52263. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52264. }
  52265. }
  52266. }
  52267. [$isDataValue]() {
  52268. if (this[_dataValue] === null) {
  52269. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52270. }
  52271. return this[_dataValue];
  52272. }
  52273. [$getDataValue]() {
  52274. if (this[_dataValue] === null) {
  52275. if (this[_children].length === 0) {
  52276. return this[$content].trim();
  52277. }
  52278. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52279. return this[_children][0][$text]().trim();
  52280. }
  52281. return null;
  52282. }
  52283. return this[$content].trim();
  52284. }
  52285. [$setValue](value) {
  52286. value = value.value || "";
  52287. this[$content] = value.toString();
  52288. }
  52289. [$dump](hasNS = false) {
  52290. const dumped = Object.create(null);
  52291. if (hasNS) {
  52292. dumped.$ns = this[$namespaceId];
  52293. }
  52294. if (this[$content]) {
  52295. dumped.$content = this[$content];
  52296. }
  52297. dumped.$name = this[$nodeName];
  52298. dumped.children = [];
  52299. for (const child of this[_children]) {
  52300. dumped.children.push(child[$dump](hasNS));
  52301. }
  52302. dumped.attributes = Object.create(null);
  52303. for (const [name, value] of this[_attributes]) {
  52304. dumped.attributes[name] = value[$content];
  52305. }
  52306. return dumped;
  52307. }
  52308. }
  52309. exports.XmlObject = XmlObject;
  52310. class ContentObject extends XFAObject {
  52311. constructor(nsId, name) {
  52312. super(nsId, name);
  52313. this[$content] = "";
  52314. }
  52315. [$onText](text) {
  52316. this[$content] += text;
  52317. }
  52318. [$finalize]() {}
  52319. }
  52320. exports.ContentObject = ContentObject;
  52321. class OptionObject extends ContentObject {
  52322. constructor(nsId, name, options) {
  52323. super(nsId, name);
  52324. this[_options] = options;
  52325. }
  52326. [$finalize]() {
  52327. this[$content] = (0, _utils.getKeyword)({
  52328. data: this[$content],
  52329. defaultValue: this[_options][0],
  52330. validate: k => this[_options].includes(k)
  52331. });
  52332. }
  52333. [$clean](builder) {
  52334. super[$clean](builder);
  52335. delete this[_options];
  52336. }
  52337. }
  52338. exports.OptionObject = OptionObject;
  52339. class StringObject extends ContentObject {
  52340. [$finalize]() {
  52341. this[$content] = this[$content].trim();
  52342. }
  52343. }
  52344. exports.StringObject = StringObject;
  52345. class IntegerObject extends ContentObject {
  52346. constructor(nsId, name, defaultValue, validator) {
  52347. super(nsId, name);
  52348. this[_defaultValue] = defaultValue;
  52349. this[_validator] = validator;
  52350. }
  52351. [$finalize]() {
  52352. this[$content] = (0, _utils.getInteger)({
  52353. data: this[$content],
  52354. defaultValue: this[_defaultValue],
  52355. validate: this[_validator]
  52356. });
  52357. }
  52358. [$clean](builder) {
  52359. super[$clean](builder);
  52360. delete this[_defaultValue];
  52361. delete this[_validator];
  52362. }
  52363. }
  52364. exports.IntegerObject = IntegerObject;
  52365. class Option01 extends IntegerObject {
  52366. constructor(nsId, name) {
  52367. super(nsId, name, 0, n => n === 1);
  52368. }
  52369. }
  52370. exports.Option01 = Option01;
  52371. class Option10 extends IntegerObject {
  52372. constructor(nsId, name) {
  52373. super(nsId, name, 1, n => n === 0);
  52374. }
  52375. }
  52376. exports.Option10 = Option10;
  52377. /***/ }),
  52378. /* 76 */
  52379. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52380. Object.defineProperty(exports, "__esModule", ({
  52381. value: true
  52382. }));
  52383. exports.HTMLResult = void 0;
  52384. exports.getBBox = getBBox;
  52385. exports.getColor = getColor;
  52386. exports.getFloat = getFloat;
  52387. exports.getInteger = getInteger;
  52388. exports.getKeyword = getKeyword;
  52389. exports.getMeasurement = getMeasurement;
  52390. exports.getRatio = getRatio;
  52391. exports.getRelevant = getRelevant;
  52392. exports.getStringOption = getStringOption;
  52393. exports.stripQuotes = stripQuotes;
  52394. var _util = __w_pdfjs_require__(2);
  52395. const dimConverters = {
  52396. pt: x => x,
  52397. cm: x => x / 2.54 * 72,
  52398. mm: x => x / (10 * 2.54) * 72,
  52399. in: x => x * 72,
  52400. px: x => x
  52401. };
  52402. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52403. function stripQuotes(str) {
  52404. if (str.startsWith("'") || str.startsWith('"')) {
  52405. return str.slice(1, str.length - 1);
  52406. }
  52407. return str;
  52408. }
  52409. function getInteger({
  52410. data,
  52411. defaultValue,
  52412. validate
  52413. }) {
  52414. if (!data) {
  52415. return defaultValue;
  52416. }
  52417. data = data.trim();
  52418. const n = parseInt(data, 10);
  52419. if (!isNaN(n) && validate(n)) {
  52420. return n;
  52421. }
  52422. return defaultValue;
  52423. }
  52424. function getFloat({
  52425. data,
  52426. defaultValue,
  52427. validate
  52428. }) {
  52429. if (!data) {
  52430. return defaultValue;
  52431. }
  52432. data = data.trim();
  52433. const n = parseFloat(data);
  52434. if (!isNaN(n) && validate(n)) {
  52435. return n;
  52436. }
  52437. return defaultValue;
  52438. }
  52439. function getKeyword({
  52440. data,
  52441. defaultValue,
  52442. validate
  52443. }) {
  52444. if (!data) {
  52445. return defaultValue;
  52446. }
  52447. data = data.trim();
  52448. if (validate(data)) {
  52449. return data;
  52450. }
  52451. return defaultValue;
  52452. }
  52453. function getStringOption(data, options) {
  52454. return getKeyword({
  52455. data,
  52456. defaultValue: options[0],
  52457. validate: k => options.includes(k)
  52458. });
  52459. }
  52460. function getMeasurement(str, def = "0") {
  52461. def = def || "0";
  52462. if (!str) {
  52463. return getMeasurement(def);
  52464. }
  52465. const match = str.trim().match(measurementPattern);
  52466. if (!match) {
  52467. return getMeasurement(def);
  52468. }
  52469. const [, valueStr, unit] = match;
  52470. const value = parseFloat(valueStr);
  52471. if (isNaN(value)) {
  52472. return getMeasurement(def);
  52473. }
  52474. if (value === 0) {
  52475. return 0;
  52476. }
  52477. const conv = dimConverters[unit];
  52478. if (conv) {
  52479. return conv(value);
  52480. }
  52481. return value;
  52482. }
  52483. function getRatio(data) {
  52484. if (!data) {
  52485. return {
  52486. num: 1,
  52487. den: 1
  52488. };
  52489. }
  52490. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52491. if (ratio.length === 1) {
  52492. ratio.push(1);
  52493. }
  52494. if (ratio.length === 0) {
  52495. return {
  52496. num: 1,
  52497. den: 1
  52498. };
  52499. }
  52500. const [num, den] = ratio;
  52501. return {
  52502. num,
  52503. den
  52504. };
  52505. }
  52506. function getRelevant(data) {
  52507. if (!data) {
  52508. return [];
  52509. }
  52510. return data.trim().split(/\s+/).map(e => {
  52511. return {
  52512. excluded: e[0] === "-",
  52513. viewname: e.substring(1)
  52514. };
  52515. });
  52516. }
  52517. function getColor(data, def = [0, 0, 0]) {
  52518. let [r, g, b] = def;
  52519. if (!data) {
  52520. return {
  52521. r,
  52522. g,
  52523. b
  52524. };
  52525. }
  52526. 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);
  52527. if (color.length < 3) {
  52528. return {
  52529. r,
  52530. g,
  52531. b
  52532. };
  52533. }
  52534. [r, g, b] = color;
  52535. return {
  52536. r,
  52537. g,
  52538. b
  52539. };
  52540. }
  52541. function getBBox(data) {
  52542. const def = -1;
  52543. if (!data) {
  52544. return {
  52545. x: def,
  52546. y: def,
  52547. width: def,
  52548. height: def
  52549. };
  52550. }
  52551. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52552. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52553. return {
  52554. x: def,
  52555. y: def,
  52556. width: def,
  52557. height: def
  52558. };
  52559. }
  52560. const [x, y, width, height] = bbox;
  52561. return {
  52562. x,
  52563. y,
  52564. width,
  52565. height
  52566. };
  52567. }
  52568. class HTMLResult {
  52569. static get FAILURE() {
  52570. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  52571. }
  52572. static get EMPTY() {
  52573. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  52574. }
  52575. constructor(success, html, bbox, breakNode) {
  52576. this.success = success;
  52577. this.html = html;
  52578. this.bbox = bbox;
  52579. this.breakNode = breakNode;
  52580. }
  52581. isBreak() {
  52582. return !!this.breakNode;
  52583. }
  52584. static breakNode(node) {
  52585. return new HTMLResult(false, null, null, node);
  52586. }
  52587. static success(html, bbox = null) {
  52588. return new HTMLResult(true, html, bbox, null);
  52589. }
  52590. }
  52591. exports.HTMLResult = HTMLResult;
  52592. /***/ }),
  52593. /* 77 */
  52594. /***/ ((__unused_webpack_module, exports) => {
  52595. Object.defineProperty(exports, "__esModule", ({
  52596. value: true
  52597. }));
  52598. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  52599. const $buildXFAObject = Symbol();
  52600. exports.$buildXFAObject = $buildXFAObject;
  52601. const NamespaceIds = {
  52602. config: {
  52603. id: 0,
  52604. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  52605. },
  52606. connectionSet: {
  52607. id: 1,
  52608. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  52609. },
  52610. datasets: {
  52611. id: 2,
  52612. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  52613. },
  52614. form: {
  52615. id: 3,
  52616. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  52617. },
  52618. localeSet: {
  52619. id: 4,
  52620. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  52621. },
  52622. pdf: {
  52623. id: 5,
  52624. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  52625. },
  52626. signature: {
  52627. id: 6,
  52628. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  52629. },
  52630. sourceSet: {
  52631. id: 7,
  52632. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  52633. },
  52634. stylesheet: {
  52635. id: 8,
  52636. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  52637. },
  52638. template: {
  52639. id: 9,
  52640. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  52641. },
  52642. xdc: {
  52643. id: 10,
  52644. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  52645. },
  52646. xdp: {
  52647. id: 11,
  52648. check: ns => ns === "http://ns.adobe.com/xdp/"
  52649. },
  52650. xfdf: {
  52651. id: 12,
  52652. check: ns => ns === "http://ns.adobe.com/xfdf/"
  52653. },
  52654. xhtml: {
  52655. id: 13,
  52656. check: ns => ns === "http://www.w3.org/1999/xhtml"
  52657. },
  52658. xmpmeta: {
  52659. id: 14,
  52660. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  52661. }
  52662. };
  52663. exports.NamespaceIds = NamespaceIds;
  52664. /***/ }),
  52665. /* 78 */
  52666. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52667. Object.defineProperty(exports, "__esModule", ({
  52668. value: true
  52669. }));
  52670. exports.createDataNode = createDataNode;
  52671. exports.searchNode = searchNode;
  52672. var _xfa_object = __w_pdfjs_require__(75);
  52673. var _namespaces = __w_pdfjs_require__(77);
  52674. var _util = __w_pdfjs_require__(2);
  52675. const namePattern = /^[^.[]+/;
  52676. const indexPattern = /^[^\]]+/;
  52677. const operators = {
  52678. dot: 0,
  52679. dotDot: 1,
  52680. dotHash: 2,
  52681. dotBracket: 3,
  52682. dotParen: 4
  52683. };
  52684. 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]]);
  52685. const somCache = new WeakMap();
  52686. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52687. function parseIndex(index) {
  52688. index = index.trim();
  52689. if (index === "*") {
  52690. return Infinity;
  52691. }
  52692. return parseInt(index, 10) || 0;
  52693. }
  52694. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  52695. let match = expr.match(namePattern);
  52696. if (!match) {
  52697. return null;
  52698. }
  52699. let [name] = match;
  52700. const parsed = [{
  52701. name,
  52702. cacheName: "." + name,
  52703. index: 0,
  52704. js: null,
  52705. formCalc: null,
  52706. operator: operators.dot
  52707. }];
  52708. let pos = name.length;
  52709. while (pos < expr.length) {
  52710. const spos = pos;
  52711. const char = expr.charAt(pos++);
  52712. if (char === "[") {
  52713. match = expr.slice(pos).match(indexPattern);
  52714. if (!match) {
  52715. (0, _util.warn)("XFA - Invalid index in SOM expression");
  52716. return null;
  52717. }
  52718. parsed.at(-1).index = parseIndex(match[0]);
  52719. pos += match[0].length + 1;
  52720. continue;
  52721. }
  52722. let operator;
  52723. switch (expr.charAt(pos)) {
  52724. case ".":
  52725. if (!dotDotAllowed) {
  52726. return null;
  52727. }
  52728. pos++;
  52729. operator = operators.dotDot;
  52730. break;
  52731. case "#":
  52732. pos++;
  52733. operator = operators.dotHash;
  52734. break;
  52735. case "[":
  52736. if (noExpr) {
  52737. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  52738. return null;
  52739. }
  52740. operator = operators.dotBracket;
  52741. break;
  52742. case "(":
  52743. if (noExpr) {
  52744. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  52745. return null;
  52746. }
  52747. operator = operators.dotParen;
  52748. break;
  52749. default:
  52750. operator = operators.dot;
  52751. break;
  52752. }
  52753. match = expr.slice(pos).match(namePattern);
  52754. if (!match) {
  52755. break;
  52756. }
  52757. [name] = match;
  52758. pos += name.length;
  52759. parsed.push({
  52760. name,
  52761. cacheName: expr.slice(spos, pos),
  52762. operator,
  52763. index: 0,
  52764. js: null,
  52765. formCalc: null
  52766. });
  52767. }
  52768. return parsed;
  52769. }
  52770. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  52771. const parsed = parseExpression(expr, dotDotAllowed);
  52772. if (!parsed) {
  52773. return null;
  52774. }
  52775. const fn = shortcuts.get(parsed[0].name);
  52776. let i = 0;
  52777. let isQualified;
  52778. if (fn) {
  52779. isQualified = true;
  52780. root = [fn(root, container)];
  52781. i = 1;
  52782. } else {
  52783. isQualified = container === null;
  52784. root = [container || root];
  52785. }
  52786. for (let ii = parsed.length; i < ii; i++) {
  52787. const {
  52788. name,
  52789. cacheName,
  52790. operator,
  52791. index
  52792. } = parsed[i];
  52793. const nodes = [];
  52794. for (const node of root) {
  52795. if (!(node instanceof _xfa_object.XFAObject)) {
  52796. continue;
  52797. }
  52798. let children, cached;
  52799. if (useCache) {
  52800. cached = somCache.get(node);
  52801. if (!cached) {
  52802. cached = new Map();
  52803. somCache.set(node, cached);
  52804. }
  52805. children = cached.get(cacheName);
  52806. }
  52807. if (!children) {
  52808. switch (operator) {
  52809. case operators.dot:
  52810. children = node[_xfa_object.$getChildrenByName](name, false);
  52811. break;
  52812. case operators.dotDot:
  52813. children = node[_xfa_object.$getChildrenByName](name, true);
  52814. break;
  52815. case operators.dotHash:
  52816. children = node[_xfa_object.$getChildrenByClass](name);
  52817. if (children instanceof _xfa_object.XFAObjectArray) {
  52818. children = children.children;
  52819. } else {
  52820. children = [children];
  52821. }
  52822. break;
  52823. default:
  52824. break;
  52825. }
  52826. if (useCache) {
  52827. cached.set(cacheName, children);
  52828. }
  52829. }
  52830. if (children.length > 0) {
  52831. nodes.push(children);
  52832. }
  52833. }
  52834. if (nodes.length === 0 && !isQualified && i === 0) {
  52835. const parent = container[_xfa_object.$getParent]();
  52836. container = parent;
  52837. if (!container) {
  52838. return null;
  52839. }
  52840. i = -1;
  52841. root = [container];
  52842. continue;
  52843. }
  52844. if (isFinite(index)) {
  52845. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52846. } else {
  52847. root = nodes.flat();
  52848. }
  52849. }
  52850. if (root.length === 0) {
  52851. return null;
  52852. }
  52853. return root;
  52854. }
  52855. function createNodes(root, path) {
  52856. let node = null;
  52857. for (const {
  52858. name,
  52859. index
  52860. } of path) {
  52861. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  52862. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  52863. node = new _xfa_object.XmlObject(nsId, name);
  52864. root[_xfa_object.$appendChild](node);
  52865. }
  52866. root = node;
  52867. }
  52868. return node;
  52869. }
  52870. function createDataNode(root, container, expr) {
  52871. const parsed = parseExpression(expr);
  52872. if (!parsed) {
  52873. return null;
  52874. }
  52875. if (parsed.some(x => x.operator === operators.dotDot)) {
  52876. return null;
  52877. }
  52878. const fn = shortcuts.get(parsed[0].name);
  52879. let i = 0;
  52880. if (fn) {
  52881. root = fn(root, container);
  52882. i = 1;
  52883. } else {
  52884. root = container || root;
  52885. }
  52886. for (let ii = parsed.length; i < ii; i++) {
  52887. const {
  52888. name,
  52889. operator,
  52890. index
  52891. } = parsed[i];
  52892. if (!isFinite(index)) {
  52893. parsed[i].index = 0;
  52894. return createNodes(root, parsed.slice(i));
  52895. }
  52896. let children;
  52897. switch (operator) {
  52898. case operators.dot:
  52899. children = root[_xfa_object.$getChildrenByName](name, false);
  52900. break;
  52901. case operators.dotDot:
  52902. children = root[_xfa_object.$getChildrenByName](name, true);
  52903. break;
  52904. case operators.dotHash:
  52905. children = root[_xfa_object.$getChildrenByClass](name);
  52906. if (children instanceof _xfa_object.XFAObjectArray) {
  52907. children = children.children;
  52908. } else {
  52909. children = [children];
  52910. }
  52911. break;
  52912. default:
  52913. break;
  52914. }
  52915. if (children.length === 0) {
  52916. return createNodes(root, parsed.slice(i));
  52917. }
  52918. if (index < children.length) {
  52919. const child = children[index];
  52920. if (!(child instanceof _xfa_object.XFAObject)) {
  52921. (0, _util.warn)(`XFA - Cannot create a node.`);
  52922. return null;
  52923. }
  52924. root = child;
  52925. } else {
  52926. parsed[i].index = index - children.length;
  52927. return createNodes(root, parsed.slice(i));
  52928. }
  52929. }
  52930. return null;
  52931. }
  52932. /***/ }),
  52933. /* 79 */
  52934. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52935. Object.defineProperty(exports, "__esModule", ({
  52936. value: true
  52937. }));
  52938. exports.Binder = void 0;
  52939. var _xfa_object = __w_pdfjs_require__(75);
  52940. var _template = __w_pdfjs_require__(80);
  52941. var _som = __w_pdfjs_require__(78);
  52942. var _namespaces = __w_pdfjs_require__(77);
  52943. var _util = __w_pdfjs_require__(2);
  52944. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52945. function createText(content) {
  52946. const node = new _template.Text({});
  52947. node[_xfa_object.$content] = content;
  52948. return node;
  52949. }
  52950. class Binder {
  52951. constructor(root) {
  52952. this.root = root;
  52953. this.datasets = root.datasets;
  52954. if (root.datasets && root.datasets.data) {
  52955. this.data = root.datasets.data;
  52956. } else {
  52957. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  52958. }
  52959. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  52960. this.root.form = this.form = root.template[_xfa_object.$clone]();
  52961. }
  52962. _isConsumeData() {
  52963. return !this.emptyMerge && this._mergeMode;
  52964. }
  52965. _isMatchTemplate() {
  52966. return !this._isConsumeData();
  52967. }
  52968. bind() {
  52969. this._bindElement(this.form, this.data);
  52970. return this.form;
  52971. }
  52972. getData() {
  52973. return this.data;
  52974. }
  52975. _bindValue(formNode, data, picture) {
  52976. formNode[_xfa_object.$data] = data;
  52977. if (formNode[_xfa_object.$hasSettableValue]()) {
  52978. if (data[_xfa_object.$isDataValue]()) {
  52979. const value = data[_xfa_object.$getDataValue]();
  52980. formNode[_xfa_object.$setValue](createText(value));
  52981. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  52982. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  52983. formNode[_xfa_object.$setValue](createText(value));
  52984. } else if (this._isConsumeData()) {
  52985. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52986. }
  52987. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  52988. this._bindElement(formNode, data);
  52989. } else {
  52990. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52991. }
  52992. }
  52993. _findDataByNameToConsume(name, isValue, dataNode, global) {
  52994. if (!name) {
  52995. return null;
  52996. }
  52997. let generator, match;
  52998. for (let i = 0; i < 3; i++) {
  52999. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  53000. while (true) {
  53001. match = generator.next().value;
  53002. if (!match) {
  53003. break;
  53004. }
  53005. if (isValue === match[_xfa_object.$isDataValue]()) {
  53006. return match;
  53007. }
  53008. }
  53009. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  53010. break;
  53011. }
  53012. dataNode = dataNode[_xfa_object.$getParent]();
  53013. }
  53014. if (!global) {
  53015. return null;
  53016. }
  53017. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  53018. match = generator.next().value;
  53019. if (match) {
  53020. return match;
  53021. }
  53022. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  53023. match = generator.next().value;
  53024. if (match && match[_xfa_object.$isDataValue]()) {
  53025. return match;
  53026. }
  53027. return null;
  53028. }
  53029. _setProperties(formNode, dataNode) {
  53030. if (!formNode.hasOwnProperty("setProperty")) {
  53031. return;
  53032. }
  53033. for (const {
  53034. ref,
  53035. target,
  53036. connection
  53037. } of formNode.setProperty.children) {
  53038. if (connection) {
  53039. continue;
  53040. }
  53041. if (!ref) {
  53042. continue;
  53043. }
  53044. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53045. if (!nodes) {
  53046. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53047. continue;
  53048. }
  53049. const [node] = nodes;
  53050. if (!node[_xfa_object.$isDescendent](this.data)) {
  53051. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  53052. continue;
  53053. }
  53054. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  53055. if (!targetNodes) {
  53056. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  53057. continue;
  53058. }
  53059. const [targetNode] = targetNodes;
  53060. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  53061. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  53062. continue;
  53063. }
  53064. const targetParent = targetNode[_xfa_object.$getParent]();
  53065. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  53066. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  53067. continue;
  53068. }
  53069. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  53070. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  53071. continue;
  53072. }
  53073. const content = node[_xfa_object.$text]();
  53074. const name = targetNode[_xfa_object.$nodeName];
  53075. if (targetNode instanceof _xfa_object.XFAAttribute) {
  53076. const attrs = Object.create(null);
  53077. attrs[name] = content;
  53078. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  53079. targetParent[name] = obj[name];
  53080. continue;
  53081. }
  53082. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  53083. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  53084. continue;
  53085. }
  53086. targetNode[_xfa_object.$data] = node;
  53087. targetNode[_xfa_object.$content] = content;
  53088. targetNode[_xfa_object.$finalize]();
  53089. }
  53090. }
  53091. _bindItems(formNode, dataNode) {
  53092. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  53093. return;
  53094. }
  53095. for (const item of formNode.items.children) {
  53096. formNode[_xfa_object.$removeChild](item);
  53097. }
  53098. formNode.items.clear();
  53099. const labels = new _template.Items({});
  53100. const values = new _template.Items({});
  53101. formNode[_xfa_object.$appendChild](labels);
  53102. formNode.items.push(labels);
  53103. formNode[_xfa_object.$appendChild](values);
  53104. formNode.items.push(values);
  53105. for (const {
  53106. ref,
  53107. labelRef,
  53108. valueRef,
  53109. connection
  53110. } of formNode.bindItems.children) {
  53111. if (connection) {
  53112. continue;
  53113. }
  53114. if (!ref) {
  53115. continue;
  53116. }
  53117. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53118. if (!nodes) {
  53119. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53120. continue;
  53121. }
  53122. for (const node of nodes) {
  53123. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  53124. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  53125. continue;
  53126. }
  53127. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  53128. if (!labelNodes) {
  53129. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  53130. continue;
  53131. }
  53132. const [labelNode] = labelNodes;
  53133. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53134. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53135. continue;
  53136. }
  53137. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53138. if (!valueNodes) {
  53139. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53140. continue;
  53141. }
  53142. const [valueNode] = valueNodes;
  53143. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53144. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53145. continue;
  53146. }
  53147. const label = createText(labelNode[_xfa_object.$text]());
  53148. const value = createText(valueNode[_xfa_object.$text]());
  53149. labels[_xfa_object.$appendChild](label);
  53150. labels.text.push(label);
  53151. values[_xfa_object.$appendChild](value);
  53152. values.text.push(value);
  53153. }
  53154. }
  53155. }
  53156. _bindOccurrences(formNode, matches, picture) {
  53157. let baseClone;
  53158. if (matches.length > 1) {
  53159. baseClone = formNode[_xfa_object.$clone]();
  53160. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53161. baseClone.occur = null;
  53162. }
  53163. this._bindValue(formNode, matches[0], picture);
  53164. this._setProperties(formNode, matches[0]);
  53165. this._bindItems(formNode, matches[0]);
  53166. if (matches.length === 1) {
  53167. return;
  53168. }
  53169. const parent = formNode[_xfa_object.$getParent]();
  53170. const name = formNode[_xfa_object.$nodeName];
  53171. const pos = parent[_xfa_object.$indexOf](formNode);
  53172. for (let i = 1, ii = matches.length; i < ii; i++) {
  53173. const match = matches[i];
  53174. const clone = baseClone[_xfa_object.$clone]();
  53175. parent[name].push(clone);
  53176. parent[_xfa_object.$insertAt](pos + i, clone);
  53177. this._bindValue(clone, match, picture);
  53178. this._setProperties(clone, match);
  53179. this._bindItems(clone, match);
  53180. }
  53181. }
  53182. _createOccurrences(formNode) {
  53183. if (!this.emptyMerge) {
  53184. return;
  53185. }
  53186. const {
  53187. occur
  53188. } = formNode;
  53189. if (!occur || occur.initial <= 1) {
  53190. return;
  53191. }
  53192. const parent = formNode[_xfa_object.$getParent]();
  53193. const name = formNode[_xfa_object.$nodeName];
  53194. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53195. return;
  53196. }
  53197. let currentNumber;
  53198. if (formNode.name) {
  53199. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53200. } else {
  53201. currentNumber = parent[name].children.length;
  53202. }
  53203. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53204. const ii = occur.initial - currentNumber;
  53205. if (ii) {
  53206. const nodeClone = formNode[_xfa_object.$clone]();
  53207. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53208. nodeClone.occur = null;
  53209. parent[name].push(nodeClone);
  53210. parent[_xfa_object.$insertAt](pos, nodeClone);
  53211. for (let i = 1; i < ii; i++) {
  53212. const clone = nodeClone[_xfa_object.$clone]();
  53213. parent[name].push(clone);
  53214. parent[_xfa_object.$insertAt](pos + i, clone);
  53215. }
  53216. }
  53217. }
  53218. _getOccurInfo(formNode) {
  53219. const {
  53220. name,
  53221. occur
  53222. } = formNode;
  53223. if (!occur || !name) {
  53224. return [1, 1];
  53225. }
  53226. const max = occur.max === -1 ? Infinity : occur.max;
  53227. return [occur.min, max];
  53228. }
  53229. _setAndBind(formNode, dataNode) {
  53230. this._setProperties(formNode, dataNode);
  53231. this._bindItems(formNode, dataNode);
  53232. this._bindElement(formNode, dataNode);
  53233. }
  53234. _bindElement(formNode, dataNode) {
  53235. const uselessNodes = [];
  53236. this._createOccurrences(formNode);
  53237. for (const child of formNode[_xfa_object.$getChildren]()) {
  53238. if (child[_xfa_object.$data]) {
  53239. continue;
  53240. }
  53241. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53242. this._mergeMode = child.mergeMode === "consumeData";
  53243. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53244. if (dataChildren.length > 0) {
  53245. this._bindOccurrences(child, [dataChildren[0]], null);
  53246. } else if (this.emptyMerge) {
  53247. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53248. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53249. dataNode[_xfa_object.$appendChild](dataChild);
  53250. this._bindElement(child, dataChild);
  53251. }
  53252. continue;
  53253. }
  53254. if (!child[_xfa_object.$isBindable]()) {
  53255. continue;
  53256. }
  53257. let global = false;
  53258. let picture = null;
  53259. let ref = null;
  53260. let match = null;
  53261. if (child.bind) {
  53262. switch (child.bind.match) {
  53263. case "none":
  53264. this._setAndBind(child, dataNode);
  53265. continue;
  53266. case "global":
  53267. global = true;
  53268. break;
  53269. case "dataRef":
  53270. if (!child.bind.ref) {
  53271. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53272. this._setAndBind(child, dataNode);
  53273. continue;
  53274. }
  53275. ref = child.bind.ref;
  53276. break;
  53277. default:
  53278. break;
  53279. }
  53280. if (child.bind.picture) {
  53281. picture = child.bind.picture[_xfa_object.$content];
  53282. }
  53283. }
  53284. const [min, max] = this._getOccurInfo(child);
  53285. if (ref) {
  53286. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53287. if (match === null) {
  53288. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53289. if (!match) {
  53290. continue;
  53291. }
  53292. if (this._isConsumeData()) {
  53293. match[_xfa_object.$consumed] = true;
  53294. }
  53295. this._setAndBind(child, match);
  53296. continue;
  53297. } else {
  53298. if (this._isConsumeData()) {
  53299. match = match.filter(node => !node[_xfa_object.$consumed]);
  53300. }
  53301. if (match.length > max) {
  53302. match = match.slice(0, max);
  53303. } else if (match.length === 0) {
  53304. match = null;
  53305. }
  53306. if (match && this._isConsumeData()) {
  53307. match.forEach(node => {
  53308. node[_xfa_object.$consumed] = true;
  53309. });
  53310. }
  53311. }
  53312. } else {
  53313. if (!child.name) {
  53314. this._setAndBind(child, dataNode);
  53315. continue;
  53316. }
  53317. if (this._isConsumeData()) {
  53318. const matches = [];
  53319. while (matches.length < max) {
  53320. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53321. if (!found) {
  53322. break;
  53323. }
  53324. found[_xfa_object.$consumed] = true;
  53325. matches.push(found);
  53326. }
  53327. match = matches.length > 0 ? matches : null;
  53328. } else {
  53329. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53330. if (!match) {
  53331. if (min === 0) {
  53332. uselessNodes.push(child);
  53333. continue;
  53334. }
  53335. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53336. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53337. if (this.emptyMerge) {
  53338. match[_xfa_object.$consumed] = true;
  53339. }
  53340. dataNode[_xfa_object.$appendChild](match);
  53341. this._setAndBind(child, match);
  53342. continue;
  53343. }
  53344. if (this.emptyMerge) {
  53345. match[_xfa_object.$consumed] = true;
  53346. }
  53347. match = [match];
  53348. }
  53349. }
  53350. if (match) {
  53351. this._bindOccurrences(child, match, picture);
  53352. } else if (min > 0) {
  53353. this._setAndBind(child, dataNode);
  53354. } else {
  53355. uselessNodes.push(child);
  53356. }
  53357. }
  53358. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53359. }
  53360. }
  53361. exports.Binder = Binder;
  53362. /***/ }),
  53363. /* 80 */
  53364. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53365. Object.defineProperty(exports, "__esModule", ({
  53366. value: true
  53367. }));
  53368. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53369. var _xfa_object = __w_pdfjs_require__(75);
  53370. var _namespaces = __w_pdfjs_require__(77);
  53371. var _layout = __w_pdfjs_require__(81);
  53372. var _html_utils = __w_pdfjs_require__(82);
  53373. var _utils = __w_pdfjs_require__(76);
  53374. var _util = __w_pdfjs_require__(2);
  53375. var _fonts = __w_pdfjs_require__(83);
  53376. var _core_utils = __w_pdfjs_require__(4);
  53377. var _som = __w_pdfjs_require__(78);
  53378. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53379. const SVG_NS = "http://www.w3.org/2000/svg";
  53380. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53381. const MAX_EMPTY_PAGES = 3;
  53382. const DEFAULT_TAB_INDEX = 5000;
  53383. const HEADING_PATTERN = /^H(\d+)$/;
  53384. 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"]);
  53385. 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"]];
  53386. function getBorderDims(node) {
  53387. if (!node || !node.border) {
  53388. return {
  53389. w: 0,
  53390. h: 0
  53391. };
  53392. }
  53393. const borderExtra = node.border[_xfa_object.$getExtra]();
  53394. if (!borderExtra) {
  53395. return {
  53396. w: 0,
  53397. h: 0
  53398. };
  53399. }
  53400. return {
  53401. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53402. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53403. };
  53404. }
  53405. function hasMargin(node) {
  53406. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53407. }
  53408. function _setValue(templateNode, value) {
  53409. if (!templateNode.value) {
  53410. const nodeValue = new Value({});
  53411. templateNode[_xfa_object.$appendChild](nodeValue);
  53412. templateNode.value = nodeValue;
  53413. }
  53414. templateNode.value[_xfa_object.$setValue](value);
  53415. }
  53416. function* getContainedChildren(node) {
  53417. for (const child of node[_xfa_object.$getChildren]()) {
  53418. if (child instanceof SubformSet) {
  53419. yield* child[_xfa_object.$getContainedChildren]();
  53420. continue;
  53421. }
  53422. yield child;
  53423. }
  53424. }
  53425. function isRequired(node) {
  53426. return node.validate && node.validate.nullTest === "error";
  53427. }
  53428. function setTabIndex(node) {
  53429. while (node) {
  53430. if (!node.traversal) {
  53431. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53432. return;
  53433. }
  53434. if (node[_xfa_object.$tabIndex]) {
  53435. return;
  53436. }
  53437. let next = null;
  53438. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53439. if (child.operation === "next") {
  53440. next = child;
  53441. break;
  53442. }
  53443. }
  53444. if (!next || !next.ref) {
  53445. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53446. return;
  53447. }
  53448. const root = node[_xfa_object.$getTemplateRoot]();
  53449. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53450. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53451. if (!ref) {
  53452. return;
  53453. }
  53454. node = ref[0];
  53455. }
  53456. }
  53457. function applyAssist(obj, attributes) {
  53458. const assist = obj.assist;
  53459. if (assist) {
  53460. const assistTitle = assist[_xfa_object.$toHTML]();
  53461. if (assistTitle) {
  53462. attributes.title = assistTitle;
  53463. }
  53464. const role = assist.role;
  53465. const match = role.match(HEADING_PATTERN);
  53466. if (match) {
  53467. const ariaRole = "heading";
  53468. const ariaLevel = match[1];
  53469. attributes.role = ariaRole;
  53470. attributes["aria-level"] = ariaLevel;
  53471. }
  53472. }
  53473. if (obj.layout === "table") {
  53474. attributes.role = "table";
  53475. } else if (obj.layout === "row") {
  53476. attributes.role = "row";
  53477. } else {
  53478. const parent = obj[_xfa_object.$getParent]();
  53479. if (parent.layout === "row") {
  53480. if (parent.assist && parent.assist.role === "TH") {
  53481. attributes.role = "columnheader";
  53482. } else {
  53483. attributes.role = "cell";
  53484. }
  53485. }
  53486. }
  53487. }
  53488. function ariaLabel(obj) {
  53489. if (!obj.assist) {
  53490. return null;
  53491. }
  53492. const assist = obj.assist;
  53493. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53494. return assist.speak[_xfa_object.$content];
  53495. }
  53496. if (assist.toolTip) {
  53497. return assist.toolTip[_xfa_object.$content];
  53498. }
  53499. return null;
  53500. }
  53501. function valueToHtml(value) {
  53502. return _utils.HTMLResult.success({
  53503. name: "div",
  53504. attributes: {
  53505. class: ["xfaRich"],
  53506. style: Object.create(null)
  53507. },
  53508. children: [{
  53509. name: "span",
  53510. attributes: {
  53511. style: Object.create(null)
  53512. },
  53513. value
  53514. }]
  53515. });
  53516. }
  53517. function setFirstUnsplittable(node) {
  53518. const root = node[_xfa_object.$getTemplateRoot]();
  53519. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53520. root[_xfa_object.$extra].firstUnsplittable = node;
  53521. root[_xfa_object.$extra].noLayoutFailure = true;
  53522. }
  53523. }
  53524. function unsetFirstUnsplittable(node) {
  53525. const root = node[_xfa_object.$getTemplateRoot]();
  53526. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53527. root[_xfa_object.$extra].noLayoutFailure = false;
  53528. }
  53529. }
  53530. function handleBreak(node) {
  53531. if (node[_xfa_object.$extra]) {
  53532. return false;
  53533. }
  53534. node[_xfa_object.$extra] = Object.create(null);
  53535. if (node.targetType === "auto") {
  53536. return false;
  53537. }
  53538. const root = node[_xfa_object.$getTemplateRoot]();
  53539. let target = null;
  53540. if (node.target) {
  53541. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53542. if (!target) {
  53543. return false;
  53544. }
  53545. target = target[0];
  53546. }
  53547. const {
  53548. currentPageArea,
  53549. currentContentArea
  53550. } = root[_xfa_object.$extra];
  53551. if (node.targetType === "pageArea") {
  53552. if (!(target instanceof PageArea)) {
  53553. target = null;
  53554. }
  53555. if (node.startNew) {
  53556. node[_xfa_object.$extra].target = target || currentPageArea;
  53557. return true;
  53558. } else if (target && target !== currentPageArea) {
  53559. node[_xfa_object.$extra].target = target;
  53560. return true;
  53561. }
  53562. return false;
  53563. }
  53564. if (!(target instanceof ContentArea)) {
  53565. target = null;
  53566. }
  53567. const pageArea = target && target[_xfa_object.$getParent]();
  53568. let index;
  53569. let nextPageArea = pageArea;
  53570. if (node.startNew) {
  53571. if (target) {
  53572. const contentAreas = pageArea.contentArea.children;
  53573. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  53574. const indexForTarget = contentAreas.indexOf(target);
  53575. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  53576. nextPageArea = null;
  53577. }
  53578. index = indexForTarget - 1;
  53579. } else {
  53580. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  53581. }
  53582. } else if (target && target !== currentContentArea) {
  53583. const contentAreas = pageArea.contentArea.children;
  53584. index = contentAreas.indexOf(target) - 1;
  53585. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  53586. } else {
  53587. return false;
  53588. }
  53589. node[_xfa_object.$extra].target = nextPageArea;
  53590. node[_xfa_object.$extra].index = index;
  53591. return true;
  53592. }
  53593. function handleOverflow(node, extraNode, space) {
  53594. const root = node[_xfa_object.$getTemplateRoot]();
  53595. const saved = root[_xfa_object.$extra].noLayoutFailure;
  53596. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  53597. extraNode[_xfa_object.$getSubformParent] = () => node;
  53598. root[_xfa_object.$extra].noLayoutFailure = true;
  53599. const res = extraNode[_xfa_object.$toHTML](space);
  53600. node[_xfa_object.$addHTML](res.html, res.bbox);
  53601. root[_xfa_object.$extra].noLayoutFailure = saved;
  53602. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  53603. }
  53604. class AppearanceFilter extends _xfa_object.StringObject {
  53605. constructor(attributes) {
  53606. super(TEMPLATE_NS_ID, "appearanceFilter");
  53607. this.id = attributes.id || "";
  53608. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53609. this.use = attributes.use || "";
  53610. this.usehref = attributes.usehref || "";
  53611. }
  53612. }
  53613. class Arc extends _xfa_object.XFAObject {
  53614. constructor(attributes) {
  53615. super(TEMPLATE_NS_ID, "arc", true);
  53616. this.circular = (0, _utils.getInteger)({
  53617. data: attributes.circular,
  53618. defaultValue: 0,
  53619. validate: x => x === 1
  53620. });
  53621. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53622. this.id = attributes.id || "";
  53623. this.startAngle = (0, _utils.getFloat)({
  53624. data: attributes.startAngle,
  53625. defaultValue: 0,
  53626. validate: x => true
  53627. });
  53628. this.sweepAngle = (0, _utils.getFloat)({
  53629. data: attributes.sweepAngle,
  53630. defaultValue: 360,
  53631. validate: x => true
  53632. });
  53633. this.use = attributes.use || "";
  53634. this.usehref = attributes.usehref || "";
  53635. this.edge = null;
  53636. this.fill = null;
  53637. }
  53638. [_xfa_object.$toHTML]() {
  53639. const edge = this.edge || new Edge({});
  53640. const edgeStyle = edge[_xfa_object.$toStyle]();
  53641. const style = Object.create(null);
  53642. if (this.fill && this.fill.presence === "visible") {
  53643. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53644. } else {
  53645. style.fill = "transparent";
  53646. }
  53647. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  53648. style.stroke = edgeStyle.color;
  53649. let arc;
  53650. const attributes = {
  53651. xmlns: SVG_NS,
  53652. style: {
  53653. width: "100%",
  53654. height: "100%",
  53655. overflow: "visible"
  53656. }
  53657. };
  53658. if (this.sweepAngle === 360) {
  53659. arc = {
  53660. name: "ellipse",
  53661. attributes: {
  53662. xmlns: SVG_NS,
  53663. cx: "50%",
  53664. cy: "50%",
  53665. rx: "50%",
  53666. ry: "50%",
  53667. style
  53668. }
  53669. };
  53670. } else {
  53671. const startAngle = this.startAngle * Math.PI / 180;
  53672. const sweepAngle = this.sweepAngle * Math.PI / 180;
  53673. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  53674. 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))];
  53675. arc = {
  53676. name: "path",
  53677. attributes: {
  53678. xmlns: SVG_NS,
  53679. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  53680. vectorEffect: "non-scaling-stroke",
  53681. style
  53682. }
  53683. };
  53684. Object.assign(attributes, {
  53685. viewBox: "0 0 100 100",
  53686. preserveAspectRatio: "none"
  53687. });
  53688. }
  53689. const svg = {
  53690. name: "svg",
  53691. children: [arc],
  53692. attributes
  53693. };
  53694. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53695. if (hasMargin(parent)) {
  53696. return _utils.HTMLResult.success({
  53697. name: "div",
  53698. attributes: {
  53699. style: {
  53700. display: "inline",
  53701. width: "100%",
  53702. height: "100%"
  53703. }
  53704. },
  53705. children: [svg]
  53706. });
  53707. }
  53708. svg.attributes.style.position = "absolute";
  53709. return _utils.HTMLResult.success(svg);
  53710. }
  53711. }
  53712. class Area extends _xfa_object.XFAObject {
  53713. constructor(attributes) {
  53714. super(TEMPLATE_NS_ID, "area", true);
  53715. this.colSpan = (0, _utils.getInteger)({
  53716. data: attributes.colSpan,
  53717. defaultValue: 1,
  53718. validate: n => n >= 1 || n === -1
  53719. });
  53720. this.id = attributes.id || "";
  53721. this.name = attributes.name || "";
  53722. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53723. this.use = attributes.use || "";
  53724. this.usehref = attributes.usehref || "";
  53725. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53726. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53727. this.desc = null;
  53728. this.extras = null;
  53729. this.area = new _xfa_object.XFAObjectArray();
  53730. this.draw = new _xfa_object.XFAObjectArray();
  53731. this.exObject = new _xfa_object.XFAObjectArray();
  53732. this.exclGroup = new _xfa_object.XFAObjectArray();
  53733. this.field = new _xfa_object.XFAObjectArray();
  53734. this.subform = new _xfa_object.XFAObjectArray();
  53735. this.subformSet = new _xfa_object.XFAObjectArray();
  53736. }
  53737. *[_xfa_object.$getContainedChildren]() {
  53738. yield* getContainedChildren(this);
  53739. }
  53740. [_xfa_object.$isTransparent]() {
  53741. return true;
  53742. }
  53743. [_xfa_object.$isBindable]() {
  53744. return true;
  53745. }
  53746. [_xfa_object.$addHTML](html, bbox) {
  53747. const [x, y, w, h] = bbox;
  53748. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  53749. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  53750. this[_xfa_object.$extra].children.push(html);
  53751. }
  53752. [_xfa_object.$getAvailableSpace]() {
  53753. return this[_xfa_object.$extra].availableSpace;
  53754. }
  53755. [_xfa_object.$toHTML](availableSpace) {
  53756. const style = (0, _html_utils.toStyle)(this, "position");
  53757. const attributes = {
  53758. style,
  53759. id: this[_xfa_object.$uid],
  53760. class: ["xfaArea"]
  53761. };
  53762. if ((0, _html_utils.isPrintOnly)(this)) {
  53763. attributes.class.push("xfaPrintOnly");
  53764. }
  53765. if (this.name) {
  53766. attributes.xfaName = this.name;
  53767. }
  53768. const children = [];
  53769. this[_xfa_object.$extra] = {
  53770. children,
  53771. width: 0,
  53772. height: 0,
  53773. availableSpace
  53774. };
  53775. const result = this[_xfa_object.$childrenToHTML]({
  53776. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  53777. include: true
  53778. });
  53779. if (!result.success) {
  53780. if (result.isBreak()) {
  53781. return result;
  53782. }
  53783. delete this[_xfa_object.$extra];
  53784. return _utils.HTMLResult.FAILURE;
  53785. }
  53786. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  53787. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  53788. const html = {
  53789. name: "div",
  53790. attributes,
  53791. children
  53792. };
  53793. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  53794. delete this[_xfa_object.$extra];
  53795. return _utils.HTMLResult.success(html, bbox);
  53796. }
  53797. }
  53798. class Assist extends _xfa_object.XFAObject {
  53799. constructor(attributes) {
  53800. super(TEMPLATE_NS_ID, "assist", true);
  53801. this.id = attributes.id || "";
  53802. this.role = attributes.role || "";
  53803. this.use = attributes.use || "";
  53804. this.usehref = attributes.usehref || "";
  53805. this.speak = null;
  53806. this.toolTip = null;
  53807. }
  53808. [_xfa_object.$toHTML]() {
  53809. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  53810. }
  53811. }
  53812. class Barcode extends _xfa_object.XFAObject {
  53813. constructor(attributes) {
  53814. super(TEMPLATE_NS_ID, "barcode", true);
  53815. this.charEncoding = (0, _utils.getKeyword)({
  53816. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  53817. defaultValue: "",
  53818. 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}/)
  53819. });
  53820. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  53821. this.dataColumnCount = (0, _utils.getInteger)({
  53822. data: attributes.dataColumnCount,
  53823. defaultValue: -1,
  53824. validate: x => x >= 0
  53825. });
  53826. this.dataLength = (0, _utils.getInteger)({
  53827. data: attributes.dataLength,
  53828. defaultValue: -1,
  53829. validate: x => x >= 0
  53830. });
  53831. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  53832. this.dataRowCount = (0, _utils.getInteger)({
  53833. data: attributes.dataRowCount,
  53834. defaultValue: -1,
  53835. validate: x => x >= 0
  53836. });
  53837. this.endChar = attributes.endChar || "";
  53838. this.errorCorrectionLevel = (0, _utils.getInteger)({
  53839. data: attributes.errorCorrectionLevel,
  53840. defaultValue: -1,
  53841. validate: x => x >= 0 && x <= 8
  53842. });
  53843. this.id = attributes.id || "";
  53844. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  53845. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  53846. this.printCheckDigit = (0, _utils.getInteger)({
  53847. data: attributes.printCheckDigit,
  53848. defaultValue: 0,
  53849. validate: x => x === 1
  53850. });
  53851. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  53852. this.startChar = attributes.startChar || "";
  53853. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  53854. this.truncate = (0, _utils.getInteger)({
  53855. data: attributes.truncate,
  53856. defaultValue: 0,
  53857. validate: x => x === 1
  53858. });
  53859. 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"]);
  53860. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  53861. this.use = attributes.use || "";
  53862. this.usehref = attributes.usehref || "";
  53863. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  53864. this.encrypt = null;
  53865. this.extras = null;
  53866. }
  53867. }
  53868. class Bind extends _xfa_object.XFAObject {
  53869. constructor(attributes) {
  53870. super(TEMPLATE_NS_ID, "bind", true);
  53871. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  53872. this.ref = attributes.ref || "";
  53873. this.picture = null;
  53874. }
  53875. }
  53876. class BindItems extends _xfa_object.XFAObject {
  53877. constructor(attributes) {
  53878. super(TEMPLATE_NS_ID, "bindItems");
  53879. this.connection = attributes.connection || "";
  53880. this.labelRef = attributes.labelRef || "";
  53881. this.ref = attributes.ref || "";
  53882. this.valueRef = attributes.valueRef || "";
  53883. }
  53884. }
  53885. exports.BindItems = BindItems;
  53886. class Bookend extends _xfa_object.XFAObject {
  53887. constructor(attributes) {
  53888. super(TEMPLATE_NS_ID, "bookend");
  53889. this.id = attributes.id || "";
  53890. this.leader = attributes.leader || "";
  53891. this.trailer = attributes.trailer || "";
  53892. this.use = attributes.use || "";
  53893. this.usehref = attributes.usehref || "";
  53894. }
  53895. }
  53896. class BooleanElement extends _xfa_object.Option01 {
  53897. constructor(attributes) {
  53898. super(TEMPLATE_NS_ID, "boolean");
  53899. this.id = attributes.id || "";
  53900. this.name = attributes.name || "";
  53901. this.use = attributes.use || "";
  53902. this.usehref = attributes.usehref || "";
  53903. }
  53904. [_xfa_object.$toHTML](availableSpace) {
  53905. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  53906. }
  53907. }
  53908. class Border extends _xfa_object.XFAObject {
  53909. constructor(attributes) {
  53910. super(TEMPLATE_NS_ID, "border", true);
  53911. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  53912. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53913. this.id = attributes.id || "";
  53914. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53915. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53916. this.use = attributes.use || "";
  53917. this.usehref = attributes.usehref || "";
  53918. this.corner = new _xfa_object.XFAObjectArray(4);
  53919. this.edge = new _xfa_object.XFAObjectArray(4);
  53920. this.extras = null;
  53921. this.fill = null;
  53922. this.margin = null;
  53923. }
  53924. [_xfa_object.$getExtra]() {
  53925. if (!this[_xfa_object.$extra]) {
  53926. const edges = this.edge.children.slice();
  53927. if (edges.length < 4) {
  53928. const defaultEdge = edges.at(-1) || new Edge({});
  53929. for (let i = edges.length; i < 4; i++) {
  53930. edges.push(defaultEdge);
  53931. }
  53932. }
  53933. const widths = edges.map(edge => edge.thickness);
  53934. const insets = [0, 0, 0, 0];
  53935. if (this.margin) {
  53936. insets[0] = this.margin.topInset;
  53937. insets[1] = this.margin.rightInset;
  53938. insets[2] = this.margin.bottomInset;
  53939. insets[3] = this.margin.leftInset;
  53940. }
  53941. this[_xfa_object.$extra] = {
  53942. widths,
  53943. insets,
  53944. edges
  53945. };
  53946. }
  53947. return this[_xfa_object.$extra];
  53948. }
  53949. [_xfa_object.$toStyle]() {
  53950. const {
  53951. edges
  53952. } = this[_xfa_object.$getExtra]();
  53953. const edgeStyles = edges.map(node => {
  53954. const style = node[_xfa_object.$toStyle]();
  53955. style.color = style.color || "#000000";
  53956. return style;
  53957. });
  53958. const style = Object.create(null);
  53959. if (this.margin) {
  53960. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  53961. }
  53962. if (this.fill && this.fill.presence === "visible") {
  53963. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53964. }
  53965. if (this.corner.children.some(node => node.radius !== 0)) {
  53966. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  53967. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  53968. const last = cornerStyles.at(-1);
  53969. for (let i = cornerStyles.length; i < 4; i++) {
  53970. cornerStyles.push(last);
  53971. }
  53972. }
  53973. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  53974. }
  53975. switch (this.presence) {
  53976. case "invisible":
  53977. case "hidden":
  53978. style.borderStyle = "";
  53979. break;
  53980. case "inactive":
  53981. style.borderStyle = "none";
  53982. break;
  53983. default:
  53984. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  53985. break;
  53986. }
  53987. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  53988. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  53989. return style;
  53990. }
  53991. }
  53992. class Break extends _xfa_object.XFAObject {
  53993. constructor(attributes) {
  53994. super(TEMPLATE_NS_ID, "break", true);
  53995. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53996. this.afterTarget = attributes.afterTarget || "";
  53997. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53998. this.beforeTarget = attributes.beforeTarget || "";
  53999. this.bookendLeader = attributes.bookendLeader || "";
  54000. this.bookendTrailer = attributes.bookendTrailer || "";
  54001. this.id = attributes.id || "";
  54002. this.overflowLeader = attributes.overflowLeader || "";
  54003. this.overflowTarget = attributes.overflowTarget || "";
  54004. this.overflowTrailer = attributes.overflowTrailer || "";
  54005. this.startNew = (0, _utils.getInteger)({
  54006. data: attributes.startNew,
  54007. defaultValue: 0,
  54008. validate: x => x === 1
  54009. });
  54010. this.use = attributes.use || "";
  54011. this.usehref = attributes.usehref || "";
  54012. this.extras = null;
  54013. }
  54014. }
  54015. class BreakAfter extends _xfa_object.XFAObject {
  54016. constructor(attributes) {
  54017. super(TEMPLATE_NS_ID, "breakAfter", true);
  54018. this.id = attributes.id || "";
  54019. this.leader = attributes.leader || "";
  54020. this.startNew = (0, _utils.getInteger)({
  54021. data: attributes.startNew,
  54022. defaultValue: 0,
  54023. validate: x => x === 1
  54024. });
  54025. this.target = attributes.target || "";
  54026. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54027. this.trailer = attributes.trailer || "";
  54028. this.use = attributes.use || "";
  54029. this.usehref = attributes.usehref || "";
  54030. this.script = null;
  54031. }
  54032. }
  54033. class BreakBefore extends _xfa_object.XFAObject {
  54034. constructor(attributes) {
  54035. super(TEMPLATE_NS_ID, "breakBefore", true);
  54036. this.id = attributes.id || "";
  54037. this.leader = attributes.leader || "";
  54038. this.startNew = (0, _utils.getInteger)({
  54039. data: attributes.startNew,
  54040. defaultValue: 0,
  54041. validate: x => x === 1
  54042. });
  54043. this.target = attributes.target || "";
  54044. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54045. this.trailer = attributes.trailer || "";
  54046. this.use = attributes.use || "";
  54047. this.usehref = attributes.usehref || "";
  54048. this.script = null;
  54049. }
  54050. [_xfa_object.$toHTML](availableSpace) {
  54051. this[_xfa_object.$extra] = {};
  54052. return _utils.HTMLResult.FAILURE;
  54053. }
  54054. }
  54055. class Button extends _xfa_object.XFAObject {
  54056. constructor(attributes) {
  54057. super(TEMPLATE_NS_ID, "button", true);
  54058. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  54059. this.id = attributes.id || "";
  54060. this.use = attributes.use || "";
  54061. this.usehref = attributes.usehref || "";
  54062. this.extras = null;
  54063. }
  54064. [_xfa_object.$toHTML](availableSpace) {
  54065. const parent = this[_xfa_object.$getParent]();
  54066. const grandpa = parent[_xfa_object.$getParent]();
  54067. const htmlButton = {
  54068. name: "button",
  54069. attributes: {
  54070. id: this[_xfa_object.$uid],
  54071. class: ["xfaButton"],
  54072. style: {}
  54073. },
  54074. children: []
  54075. };
  54076. for (const event of grandpa.event.children) {
  54077. if (event.activity !== "click" || !event.script) {
  54078. continue;
  54079. }
  54080. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  54081. if (!jsURL) {
  54082. continue;
  54083. }
  54084. const href = (0, _html_utils.fixURL)(jsURL.url);
  54085. if (!href) {
  54086. continue;
  54087. }
  54088. htmlButton.children.push({
  54089. name: "a",
  54090. attributes: {
  54091. id: "link" + this[_xfa_object.$uid],
  54092. href,
  54093. newWindow: jsURL.newWindow,
  54094. class: ["xfaLink"],
  54095. style: {}
  54096. },
  54097. children: []
  54098. });
  54099. }
  54100. return _utils.HTMLResult.success(htmlButton);
  54101. }
  54102. }
  54103. class Calculate extends _xfa_object.XFAObject {
  54104. constructor(attributes) {
  54105. super(TEMPLATE_NS_ID, "calculate", true);
  54106. this.id = attributes.id || "";
  54107. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  54108. this.use = attributes.use || "";
  54109. this.usehref = attributes.usehref || "";
  54110. this.extras = null;
  54111. this.message = null;
  54112. this.script = null;
  54113. }
  54114. }
  54115. class Caption extends _xfa_object.XFAObject {
  54116. constructor(attributes) {
  54117. super(TEMPLATE_NS_ID, "caption", true);
  54118. this.id = attributes.id || "";
  54119. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  54120. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54121. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  54122. this.use = attributes.use || "";
  54123. this.usehref = attributes.usehref || "";
  54124. this.extras = null;
  54125. this.font = null;
  54126. this.margin = null;
  54127. this.para = null;
  54128. this.value = null;
  54129. }
  54130. [_xfa_object.$setValue](value) {
  54131. _setValue(this, value);
  54132. }
  54133. [_xfa_object.$getExtra](availableSpace) {
  54134. if (!this[_xfa_object.$extra]) {
  54135. let {
  54136. width,
  54137. height
  54138. } = availableSpace;
  54139. switch (this.placement) {
  54140. case "left":
  54141. case "right":
  54142. case "inline":
  54143. width = this.reserve <= 0 ? width : this.reserve;
  54144. break;
  54145. case "top":
  54146. case "bottom":
  54147. height = this.reserve <= 0 ? height : this.reserve;
  54148. break;
  54149. }
  54150. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54151. width,
  54152. height
  54153. });
  54154. }
  54155. return this[_xfa_object.$extra];
  54156. }
  54157. [_xfa_object.$toHTML](availableSpace) {
  54158. if (!this.value) {
  54159. return _utils.HTMLResult.EMPTY;
  54160. }
  54161. this[_xfa_object.$pushPara]();
  54162. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54163. if (!value) {
  54164. this[_xfa_object.$popPara]();
  54165. return _utils.HTMLResult.EMPTY;
  54166. }
  54167. const savedReserve = this.reserve;
  54168. if (this.reserve <= 0) {
  54169. const {
  54170. w,
  54171. h
  54172. } = this[_xfa_object.$getExtra](availableSpace);
  54173. switch (this.placement) {
  54174. case "left":
  54175. case "right":
  54176. case "inline":
  54177. this.reserve = w;
  54178. break;
  54179. case "top":
  54180. case "bottom":
  54181. this.reserve = h;
  54182. break;
  54183. }
  54184. }
  54185. const children = [];
  54186. if (typeof value === "string") {
  54187. children.push({
  54188. name: "#text",
  54189. value
  54190. });
  54191. } else {
  54192. children.push(value);
  54193. }
  54194. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54195. switch (this.placement) {
  54196. case "left":
  54197. case "right":
  54198. if (this.reserve > 0) {
  54199. style.width = (0, _html_utils.measureToString)(this.reserve);
  54200. }
  54201. break;
  54202. case "top":
  54203. case "bottom":
  54204. if (this.reserve > 0) {
  54205. style.height = (0, _html_utils.measureToString)(this.reserve);
  54206. }
  54207. break;
  54208. }
  54209. (0, _html_utils.setPara)(this, null, value);
  54210. this[_xfa_object.$popPara]();
  54211. this.reserve = savedReserve;
  54212. return _utils.HTMLResult.success({
  54213. name: "div",
  54214. attributes: {
  54215. style,
  54216. class: ["xfaCaption"]
  54217. },
  54218. children
  54219. });
  54220. }
  54221. }
  54222. class Certificate extends _xfa_object.StringObject {
  54223. constructor(attributes) {
  54224. super(TEMPLATE_NS_ID, "certificate");
  54225. this.id = attributes.id || "";
  54226. this.name = attributes.name || "";
  54227. this.use = attributes.use || "";
  54228. this.usehref = attributes.usehref || "";
  54229. }
  54230. }
  54231. class Certificates extends _xfa_object.XFAObject {
  54232. constructor(attributes) {
  54233. super(TEMPLATE_NS_ID, "certificates", true);
  54234. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54235. this.id = attributes.id || "";
  54236. this.url = attributes.url || "";
  54237. this.urlPolicy = attributes.urlPolicy || "";
  54238. this.use = attributes.use || "";
  54239. this.usehref = attributes.usehref || "";
  54240. this.encryption = null;
  54241. this.issuers = null;
  54242. this.keyUsage = null;
  54243. this.oids = null;
  54244. this.signing = null;
  54245. this.subjectDNs = null;
  54246. }
  54247. }
  54248. class CheckButton extends _xfa_object.XFAObject {
  54249. constructor(attributes) {
  54250. super(TEMPLATE_NS_ID, "checkButton", true);
  54251. this.id = attributes.id || "";
  54252. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54253. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54254. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54255. this.use = attributes.use || "";
  54256. this.usehref = attributes.usehref || "";
  54257. this.border = null;
  54258. this.extras = null;
  54259. this.margin = null;
  54260. }
  54261. [_xfa_object.$toHTML](availableSpace) {
  54262. const style = (0, _html_utils.toStyle)("margin");
  54263. const size = (0, _html_utils.measureToString)(this.size);
  54264. style.width = style.height = size;
  54265. let type;
  54266. let className;
  54267. let groupId;
  54268. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54269. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54270. const exportedValue = {
  54271. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54272. off: (items[1] !== undefined ? items[1] : "off").toString()
  54273. };
  54274. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54275. const checked = value === exportedValue.on || undefined;
  54276. const container = field[_xfa_object.$getSubformParent]();
  54277. const fieldId = field[_xfa_object.$uid];
  54278. let dataId;
  54279. if (container instanceof ExclGroup) {
  54280. groupId = container[_xfa_object.$uid];
  54281. type = "radio";
  54282. className = "xfaRadio";
  54283. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54284. } else {
  54285. type = "checkbox";
  54286. className = "xfaCheckbox";
  54287. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54288. }
  54289. const input = {
  54290. name: "input",
  54291. attributes: {
  54292. class: [className],
  54293. style,
  54294. fieldId,
  54295. dataId,
  54296. type,
  54297. checked,
  54298. xfaOn: exportedValue.on,
  54299. xfaOff: exportedValue.off,
  54300. "aria-label": ariaLabel(field),
  54301. "aria-required": false
  54302. }
  54303. };
  54304. if (groupId) {
  54305. input.attributes.name = groupId;
  54306. }
  54307. if (isRequired(field)) {
  54308. input.attributes["aria-required"] = true;
  54309. input.attributes.required = true;
  54310. }
  54311. return _utils.HTMLResult.success({
  54312. name: "label",
  54313. attributes: {
  54314. class: ["xfaLabel"]
  54315. },
  54316. children: [input]
  54317. });
  54318. }
  54319. }
  54320. class ChoiceList extends _xfa_object.XFAObject {
  54321. constructor(attributes) {
  54322. super(TEMPLATE_NS_ID, "choiceList", true);
  54323. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54324. this.id = attributes.id || "";
  54325. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54326. this.textEntry = (0, _utils.getInteger)({
  54327. data: attributes.textEntry,
  54328. defaultValue: 0,
  54329. validate: x => x === 1
  54330. });
  54331. this.use = attributes.use || "";
  54332. this.usehref = attributes.usehref || "";
  54333. this.border = null;
  54334. this.extras = null;
  54335. this.margin = null;
  54336. }
  54337. [_xfa_object.$toHTML](availableSpace) {
  54338. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54339. const ui = this[_xfa_object.$getParent]();
  54340. const field = ui[_xfa_object.$getParent]();
  54341. const fontSize = field.font && field.font.size || 10;
  54342. const optionStyle = {
  54343. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54344. };
  54345. const children = [];
  54346. if (field.items.children.length > 0) {
  54347. const items = field.items;
  54348. let displayedIndex = 0;
  54349. let saveIndex = 0;
  54350. if (items.children.length === 2) {
  54351. displayedIndex = items.children[0].save;
  54352. saveIndex = 1 - displayedIndex;
  54353. }
  54354. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54355. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54356. let selected = false;
  54357. const value = field.value && field.value[_xfa_object.$text]() || "";
  54358. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54359. const option = {
  54360. name: "option",
  54361. attributes: {
  54362. value: values[i] || displayed[i],
  54363. style: optionStyle
  54364. },
  54365. value: displayed[i]
  54366. };
  54367. if (values[i] === value) {
  54368. option.attributes.selected = selected = true;
  54369. }
  54370. children.push(option);
  54371. }
  54372. if (!selected) {
  54373. children.splice(0, 0, {
  54374. name: "option",
  54375. attributes: {
  54376. hidden: true,
  54377. selected: true
  54378. },
  54379. value: " "
  54380. });
  54381. }
  54382. }
  54383. const selectAttributes = {
  54384. class: ["xfaSelect"],
  54385. fieldId: field[_xfa_object.$uid],
  54386. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54387. style,
  54388. "aria-label": ariaLabel(field),
  54389. "aria-required": false
  54390. };
  54391. if (isRequired(field)) {
  54392. selectAttributes["aria-required"] = true;
  54393. selectAttributes.required = true;
  54394. }
  54395. if (this.open === "multiSelect") {
  54396. selectAttributes.multiple = true;
  54397. }
  54398. return _utils.HTMLResult.success({
  54399. name: "label",
  54400. attributes: {
  54401. class: ["xfaLabel"]
  54402. },
  54403. children: [{
  54404. name: "select",
  54405. children,
  54406. attributes: selectAttributes
  54407. }]
  54408. });
  54409. }
  54410. }
  54411. class Color extends _xfa_object.XFAObject {
  54412. constructor(attributes) {
  54413. super(TEMPLATE_NS_ID, "color", true);
  54414. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54415. this.id = attributes.id || "";
  54416. this.use = attributes.use || "";
  54417. this.usehref = attributes.usehref || "";
  54418. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54419. this.extras = null;
  54420. }
  54421. [_xfa_object.$hasSettableValue]() {
  54422. return false;
  54423. }
  54424. [_xfa_object.$toStyle]() {
  54425. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54426. }
  54427. }
  54428. class Comb extends _xfa_object.XFAObject {
  54429. constructor(attributes) {
  54430. super(TEMPLATE_NS_ID, "comb");
  54431. this.id = attributes.id || "";
  54432. this.numberOfCells = (0, _utils.getInteger)({
  54433. data: attributes.numberOfCells,
  54434. defaultValue: 0,
  54435. validate: x => x >= 0
  54436. });
  54437. this.use = attributes.use || "";
  54438. this.usehref = attributes.usehref || "";
  54439. }
  54440. }
  54441. class Connect extends _xfa_object.XFAObject {
  54442. constructor(attributes) {
  54443. super(TEMPLATE_NS_ID, "connect", true);
  54444. this.connection = attributes.connection || "";
  54445. this.id = attributes.id || "";
  54446. this.ref = attributes.ref || "";
  54447. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54448. this.use = attributes.use || "";
  54449. this.usehref = attributes.usehref || "";
  54450. this.picture = null;
  54451. }
  54452. }
  54453. class ContentArea extends _xfa_object.XFAObject {
  54454. constructor(attributes) {
  54455. super(TEMPLATE_NS_ID, "contentArea", true);
  54456. this.h = (0, _utils.getMeasurement)(attributes.h);
  54457. this.id = attributes.id || "";
  54458. this.name = attributes.name || "";
  54459. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54460. this.use = attributes.use || "";
  54461. this.usehref = attributes.usehref || "";
  54462. this.w = (0, _utils.getMeasurement)(attributes.w);
  54463. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54464. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54465. this.desc = null;
  54466. this.extras = null;
  54467. }
  54468. [_xfa_object.$toHTML](availableSpace) {
  54469. const left = (0, _html_utils.measureToString)(this.x);
  54470. const top = (0, _html_utils.measureToString)(this.y);
  54471. const style = {
  54472. left,
  54473. top,
  54474. width: (0, _html_utils.measureToString)(this.w),
  54475. height: (0, _html_utils.measureToString)(this.h)
  54476. };
  54477. const classNames = ["xfaContentarea"];
  54478. if ((0, _html_utils.isPrintOnly)(this)) {
  54479. classNames.push("xfaPrintOnly");
  54480. }
  54481. return _utils.HTMLResult.success({
  54482. name: "div",
  54483. children: [],
  54484. attributes: {
  54485. style,
  54486. class: classNames,
  54487. id: this[_xfa_object.$uid]
  54488. }
  54489. });
  54490. }
  54491. }
  54492. class Corner extends _xfa_object.XFAObject {
  54493. constructor(attributes) {
  54494. super(TEMPLATE_NS_ID, "corner", true);
  54495. this.id = attributes.id || "";
  54496. this.inverted = (0, _utils.getInteger)({
  54497. data: attributes.inverted,
  54498. defaultValue: 0,
  54499. validate: x => x === 1
  54500. });
  54501. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54502. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54503. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54504. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54505. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54506. this.use = attributes.use || "";
  54507. this.usehref = attributes.usehref || "";
  54508. this.color = null;
  54509. this.extras = null;
  54510. }
  54511. [_xfa_object.$toStyle]() {
  54512. const style = (0, _html_utils.toStyle)(this, "visibility");
  54513. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54514. return style;
  54515. }
  54516. }
  54517. class DateElement extends _xfa_object.ContentObject {
  54518. constructor(attributes) {
  54519. super(TEMPLATE_NS_ID, "date");
  54520. this.id = attributes.id || "";
  54521. this.name = attributes.name || "";
  54522. this.use = attributes.use || "";
  54523. this.usehref = attributes.usehref || "";
  54524. }
  54525. [_xfa_object.$finalize]() {
  54526. const date = this[_xfa_object.$content].trim();
  54527. this[_xfa_object.$content] = date ? new Date(date) : null;
  54528. }
  54529. [_xfa_object.$toHTML](availableSpace) {
  54530. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54531. }
  54532. }
  54533. class DateTime extends _xfa_object.ContentObject {
  54534. constructor(attributes) {
  54535. super(TEMPLATE_NS_ID, "dateTime");
  54536. this.id = attributes.id || "";
  54537. this.name = attributes.name || "";
  54538. this.use = attributes.use || "";
  54539. this.usehref = attributes.usehref || "";
  54540. }
  54541. [_xfa_object.$finalize]() {
  54542. const date = this[_xfa_object.$content].trim();
  54543. this[_xfa_object.$content] = date ? new Date(date) : null;
  54544. }
  54545. [_xfa_object.$toHTML](availableSpace) {
  54546. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54547. }
  54548. }
  54549. class DateTimeEdit extends _xfa_object.XFAObject {
  54550. constructor(attributes) {
  54551. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54552. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54553. this.id = attributes.id || "";
  54554. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54555. this.use = attributes.use || "";
  54556. this.usehref = attributes.usehref || "";
  54557. this.border = null;
  54558. this.comb = null;
  54559. this.extras = null;
  54560. this.margin = null;
  54561. }
  54562. [_xfa_object.$toHTML](availableSpace) {
  54563. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54564. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54565. const html = {
  54566. name: "input",
  54567. attributes: {
  54568. type: "text",
  54569. fieldId: field[_xfa_object.$uid],
  54570. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54571. class: ["xfaTextfield"],
  54572. style,
  54573. "aria-label": ariaLabel(field),
  54574. "aria-required": false
  54575. }
  54576. };
  54577. if (isRequired(field)) {
  54578. html.attributes["aria-required"] = true;
  54579. html.attributes.required = true;
  54580. }
  54581. return _utils.HTMLResult.success({
  54582. name: "label",
  54583. attributes: {
  54584. class: ["xfaLabel"]
  54585. },
  54586. children: [html]
  54587. });
  54588. }
  54589. }
  54590. class Decimal extends _xfa_object.ContentObject {
  54591. constructor(attributes) {
  54592. super(TEMPLATE_NS_ID, "decimal");
  54593. this.fracDigits = (0, _utils.getInteger)({
  54594. data: attributes.fracDigits,
  54595. defaultValue: 2,
  54596. validate: x => true
  54597. });
  54598. this.id = attributes.id || "";
  54599. this.leadDigits = (0, _utils.getInteger)({
  54600. data: attributes.leadDigits,
  54601. defaultValue: -1,
  54602. validate: x => true
  54603. });
  54604. this.name = attributes.name || "";
  54605. this.use = attributes.use || "";
  54606. this.usehref = attributes.usehref || "";
  54607. }
  54608. [_xfa_object.$finalize]() {
  54609. const number = parseFloat(this[_xfa_object.$content].trim());
  54610. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54611. }
  54612. [_xfa_object.$toHTML](availableSpace) {
  54613. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54614. }
  54615. }
  54616. class DefaultUi extends _xfa_object.XFAObject {
  54617. constructor(attributes) {
  54618. super(TEMPLATE_NS_ID, "defaultUi", true);
  54619. this.id = attributes.id || "";
  54620. this.use = attributes.use || "";
  54621. this.usehref = attributes.usehref || "";
  54622. this.extras = null;
  54623. }
  54624. }
  54625. class Desc extends _xfa_object.XFAObject {
  54626. constructor(attributes) {
  54627. super(TEMPLATE_NS_ID, "desc", true);
  54628. this.id = attributes.id || "";
  54629. this.use = attributes.use || "";
  54630. this.usehref = attributes.usehref || "";
  54631. this.boolean = new _xfa_object.XFAObjectArray();
  54632. this.date = new _xfa_object.XFAObjectArray();
  54633. this.dateTime = new _xfa_object.XFAObjectArray();
  54634. this.decimal = new _xfa_object.XFAObjectArray();
  54635. this.exData = new _xfa_object.XFAObjectArray();
  54636. this.float = new _xfa_object.XFAObjectArray();
  54637. this.image = new _xfa_object.XFAObjectArray();
  54638. this.integer = new _xfa_object.XFAObjectArray();
  54639. this.text = new _xfa_object.XFAObjectArray();
  54640. this.time = new _xfa_object.XFAObjectArray();
  54641. }
  54642. }
  54643. class DigestMethod extends _xfa_object.OptionObject {
  54644. constructor(attributes) {
  54645. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  54646. this.id = attributes.id || "";
  54647. this.use = attributes.use || "";
  54648. this.usehref = attributes.usehref || "";
  54649. }
  54650. }
  54651. class DigestMethods extends _xfa_object.XFAObject {
  54652. constructor(attributes) {
  54653. super(TEMPLATE_NS_ID, "digestMethods", true);
  54654. this.id = attributes.id || "";
  54655. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54656. this.use = attributes.use || "";
  54657. this.usehref = attributes.usehref || "";
  54658. this.digestMethod = new _xfa_object.XFAObjectArray();
  54659. }
  54660. }
  54661. class Draw extends _xfa_object.XFAObject {
  54662. constructor(attributes) {
  54663. super(TEMPLATE_NS_ID, "draw", true);
  54664. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54665. this.colSpan = (0, _utils.getInteger)({
  54666. data: attributes.colSpan,
  54667. defaultValue: 1,
  54668. validate: n => n >= 1 || n === -1
  54669. });
  54670. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54671. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54672. this.id = attributes.id || "";
  54673. this.locale = attributes.locale || "";
  54674. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54675. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54676. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54677. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54678. this.name = attributes.name || "";
  54679. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54680. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54681. this.rotate = (0, _utils.getInteger)({
  54682. data: attributes.rotate,
  54683. defaultValue: 0,
  54684. validate: x => x % 90 === 0
  54685. });
  54686. this.use = attributes.use || "";
  54687. this.usehref = attributes.usehref || "";
  54688. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54689. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54690. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54691. this.assist = null;
  54692. this.border = null;
  54693. this.caption = null;
  54694. this.desc = null;
  54695. this.extras = null;
  54696. this.font = null;
  54697. this.keep = null;
  54698. this.margin = null;
  54699. this.para = null;
  54700. this.traversal = null;
  54701. this.ui = null;
  54702. this.value = null;
  54703. this.setProperty = new _xfa_object.XFAObjectArray();
  54704. }
  54705. [_xfa_object.$setValue](value) {
  54706. _setValue(this, value);
  54707. }
  54708. [_xfa_object.$toHTML](availableSpace) {
  54709. setTabIndex(this);
  54710. if (this.presence === "hidden" || this.presence === "inactive") {
  54711. return _utils.HTMLResult.EMPTY;
  54712. }
  54713. (0, _html_utils.fixDimensions)(this);
  54714. this[_xfa_object.$pushPara]();
  54715. const savedW = this.w;
  54716. const savedH = this.h;
  54717. const {
  54718. w,
  54719. h,
  54720. isBroken
  54721. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54722. if (w && this.w === "") {
  54723. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54724. this[_xfa_object.$popPara]();
  54725. return _utils.HTMLResult.FAILURE;
  54726. }
  54727. this.w = w;
  54728. }
  54729. if (h && this.h === "") {
  54730. this.h = h;
  54731. }
  54732. setFirstUnsplittable(this);
  54733. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54734. this.w = savedW;
  54735. this.h = savedH;
  54736. this[_xfa_object.$popPara]();
  54737. return _utils.HTMLResult.FAILURE;
  54738. }
  54739. unsetFirstUnsplittable(this);
  54740. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  54741. (0, _html_utils.setMinMaxDimensions)(this, style);
  54742. if (style.margin) {
  54743. style.padding = style.margin;
  54744. delete style.margin;
  54745. }
  54746. const classNames = ["xfaDraw"];
  54747. if (this.font) {
  54748. classNames.push("xfaFont");
  54749. }
  54750. if ((0, _html_utils.isPrintOnly)(this)) {
  54751. classNames.push("xfaPrintOnly");
  54752. }
  54753. const attributes = {
  54754. style,
  54755. id: this[_xfa_object.$uid],
  54756. class: classNames
  54757. };
  54758. if (this.name) {
  54759. attributes.xfaName = this.name;
  54760. }
  54761. const html = {
  54762. name: "div",
  54763. attributes,
  54764. children: []
  54765. };
  54766. applyAssist(this, attributes);
  54767. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54768. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  54769. if (value === null) {
  54770. this.w = savedW;
  54771. this.h = savedH;
  54772. this[_xfa_object.$popPara]();
  54773. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54774. }
  54775. html.children.push(value);
  54776. (0, _html_utils.setPara)(this, style, value);
  54777. this.w = savedW;
  54778. this.h = savedH;
  54779. this[_xfa_object.$popPara]();
  54780. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54781. }
  54782. }
  54783. class Edge extends _xfa_object.XFAObject {
  54784. constructor(attributes) {
  54785. super(TEMPLATE_NS_ID, "edge", true);
  54786. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  54787. this.id = attributes.id || "";
  54788. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54789. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54790. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54791. this.use = attributes.use || "";
  54792. this.usehref = attributes.usehref || "";
  54793. this.color = null;
  54794. this.extras = null;
  54795. }
  54796. [_xfa_object.$toStyle]() {
  54797. const style = (0, _html_utils.toStyle)(this, "visibility");
  54798. Object.assign(style, {
  54799. linecap: this.cap,
  54800. width: (0, _html_utils.measureToString)(this.thickness),
  54801. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  54802. style: ""
  54803. });
  54804. if (this.presence !== "visible") {
  54805. style.style = "none";
  54806. } else {
  54807. switch (this.stroke) {
  54808. case "solid":
  54809. style.style = "solid";
  54810. break;
  54811. case "dashDot":
  54812. style.style = "dashed";
  54813. break;
  54814. case "dashDotDot":
  54815. style.style = "dashed";
  54816. break;
  54817. case "dashed":
  54818. style.style = "dashed";
  54819. break;
  54820. case "dotted":
  54821. style.style = "dotted";
  54822. break;
  54823. case "embossed":
  54824. style.style = "ridge";
  54825. break;
  54826. case "etched":
  54827. style.style = "groove";
  54828. break;
  54829. case "lowered":
  54830. style.style = "inset";
  54831. break;
  54832. case "raised":
  54833. style.style = "outset";
  54834. break;
  54835. }
  54836. }
  54837. return style;
  54838. }
  54839. }
  54840. class Encoding extends _xfa_object.OptionObject {
  54841. constructor(attributes) {
  54842. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  54843. this.id = attributes.id || "";
  54844. this.use = attributes.use || "";
  54845. this.usehref = attributes.usehref || "";
  54846. }
  54847. }
  54848. class Encodings extends _xfa_object.XFAObject {
  54849. constructor(attributes) {
  54850. super(TEMPLATE_NS_ID, "encodings", true);
  54851. this.id = attributes.id || "";
  54852. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54853. this.use = attributes.use || "";
  54854. this.usehref = attributes.usehref || "";
  54855. this.encoding = new _xfa_object.XFAObjectArray();
  54856. }
  54857. }
  54858. class Encrypt extends _xfa_object.XFAObject {
  54859. constructor(attributes) {
  54860. super(TEMPLATE_NS_ID, "encrypt", true);
  54861. this.id = attributes.id || "";
  54862. this.use = attributes.use || "";
  54863. this.usehref = attributes.usehref || "";
  54864. this.certificate = null;
  54865. }
  54866. }
  54867. class EncryptData extends _xfa_object.XFAObject {
  54868. constructor(attributes) {
  54869. super(TEMPLATE_NS_ID, "encryptData", true);
  54870. this.id = attributes.id || "";
  54871. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  54872. this.target = attributes.target || "";
  54873. this.use = attributes.use || "";
  54874. this.usehref = attributes.usehref || "";
  54875. this.filter = null;
  54876. this.manifest = null;
  54877. }
  54878. }
  54879. class Encryption extends _xfa_object.XFAObject {
  54880. constructor(attributes) {
  54881. super(TEMPLATE_NS_ID, "encryption", true);
  54882. this.id = attributes.id || "";
  54883. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54884. this.use = attributes.use || "";
  54885. this.usehref = attributes.usehref || "";
  54886. this.certificate = new _xfa_object.XFAObjectArray();
  54887. }
  54888. }
  54889. class EncryptionMethod extends _xfa_object.OptionObject {
  54890. constructor(attributes) {
  54891. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  54892. this.id = attributes.id || "";
  54893. this.use = attributes.use || "";
  54894. this.usehref = attributes.usehref || "";
  54895. }
  54896. }
  54897. class EncryptionMethods extends _xfa_object.XFAObject {
  54898. constructor(attributes) {
  54899. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  54900. this.id = attributes.id || "";
  54901. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54902. this.use = attributes.use || "";
  54903. this.usehref = attributes.usehref || "";
  54904. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54905. }
  54906. }
  54907. class Event extends _xfa_object.XFAObject {
  54908. constructor(attributes) {
  54909. super(TEMPLATE_NS_ID, "event", true);
  54910. 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"]);
  54911. this.id = attributes.id || "";
  54912. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  54913. this.name = attributes.name || "";
  54914. this.ref = attributes.ref || "";
  54915. this.use = attributes.use || "";
  54916. this.usehref = attributes.usehref || "";
  54917. this.extras = null;
  54918. this.encryptData = null;
  54919. this.execute = null;
  54920. this.script = null;
  54921. this.signData = null;
  54922. this.submit = null;
  54923. }
  54924. }
  54925. class ExData extends _xfa_object.ContentObject {
  54926. constructor(attributes) {
  54927. super(TEMPLATE_NS_ID, "exData");
  54928. this.contentType = attributes.contentType || "";
  54929. this.href = attributes.href || "";
  54930. this.id = attributes.id || "";
  54931. this.maxLength = (0, _utils.getInteger)({
  54932. data: attributes.maxLength,
  54933. defaultValue: -1,
  54934. validate: x => x >= -1
  54935. });
  54936. this.name = attributes.name || "";
  54937. this.rid = attributes.rid || "";
  54938. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  54939. this.use = attributes.use || "";
  54940. this.usehref = attributes.usehref || "";
  54941. }
  54942. [_xfa_object.$isCDATAXml]() {
  54943. return this.contentType === "text/html";
  54944. }
  54945. [_xfa_object.$onChild](child) {
  54946. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54947. this[_xfa_object.$content] = child;
  54948. return true;
  54949. }
  54950. if (this.contentType === "text/xml") {
  54951. this[_xfa_object.$content] = child;
  54952. return true;
  54953. }
  54954. return false;
  54955. }
  54956. [_xfa_object.$toHTML](availableSpace) {
  54957. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  54958. return _utils.HTMLResult.EMPTY;
  54959. }
  54960. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54961. }
  54962. }
  54963. class ExObject extends _xfa_object.XFAObject {
  54964. constructor(attributes) {
  54965. super(TEMPLATE_NS_ID, "exObject", true);
  54966. this.archive = attributes.archive || "";
  54967. this.classId = attributes.classId || "";
  54968. this.codeBase = attributes.codeBase || "";
  54969. this.codeType = attributes.codeType || "";
  54970. this.id = attributes.id || "";
  54971. this.name = attributes.name || "";
  54972. this.use = attributes.use || "";
  54973. this.usehref = attributes.usehref || "";
  54974. this.extras = null;
  54975. this.boolean = new _xfa_object.XFAObjectArray();
  54976. this.date = new _xfa_object.XFAObjectArray();
  54977. this.dateTime = new _xfa_object.XFAObjectArray();
  54978. this.decimal = new _xfa_object.XFAObjectArray();
  54979. this.exData = new _xfa_object.XFAObjectArray();
  54980. this.exObject = new _xfa_object.XFAObjectArray();
  54981. this.float = new _xfa_object.XFAObjectArray();
  54982. this.image = new _xfa_object.XFAObjectArray();
  54983. this.integer = new _xfa_object.XFAObjectArray();
  54984. this.text = new _xfa_object.XFAObjectArray();
  54985. this.time = new _xfa_object.XFAObjectArray();
  54986. }
  54987. }
  54988. class ExclGroup extends _xfa_object.XFAObject {
  54989. constructor(attributes) {
  54990. super(TEMPLATE_NS_ID, "exclGroup", true);
  54991. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54992. this.accessKey = attributes.accessKey || "";
  54993. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54994. this.colSpan = (0, _utils.getInteger)({
  54995. data: attributes.colSpan,
  54996. defaultValue: 1,
  54997. validate: n => n >= 1 || n === -1
  54998. });
  54999. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55000. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55001. this.id = attributes.id || "";
  55002. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55003. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55004. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55005. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55006. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55007. this.name = attributes.name || "";
  55008. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55009. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55010. this.use = attributes.use || "";
  55011. this.usehref = attributes.usehref || "";
  55012. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55013. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55014. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55015. this.assist = null;
  55016. this.bind = null;
  55017. this.border = null;
  55018. this.calculate = null;
  55019. this.caption = null;
  55020. this.desc = null;
  55021. this.extras = null;
  55022. this.margin = null;
  55023. this.para = null;
  55024. this.traversal = null;
  55025. this.validate = null;
  55026. this.connect = new _xfa_object.XFAObjectArray();
  55027. this.event = new _xfa_object.XFAObjectArray();
  55028. this.field = new _xfa_object.XFAObjectArray();
  55029. this.setProperty = new _xfa_object.XFAObjectArray();
  55030. }
  55031. [_xfa_object.$isBindable]() {
  55032. return true;
  55033. }
  55034. [_xfa_object.$hasSettableValue]() {
  55035. return true;
  55036. }
  55037. [_xfa_object.$setValue](value) {
  55038. for (const field of this.field.children) {
  55039. if (!field.value) {
  55040. const nodeValue = new Value({});
  55041. field[_xfa_object.$appendChild](nodeValue);
  55042. field.value = nodeValue;
  55043. }
  55044. field.value[_xfa_object.$setValue](value);
  55045. }
  55046. }
  55047. [_xfa_object.$isThereMoreWidth]() {
  55048. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55049. }
  55050. [_xfa_object.$isSplittable]() {
  55051. const parent = this[_xfa_object.$getSubformParent]();
  55052. if (!parent[_xfa_object.$isSplittable]()) {
  55053. return false;
  55054. }
  55055. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55056. return this[_xfa_object.$extra]._isSplittable;
  55057. }
  55058. if (this.layout === "position" || this.layout.includes("row")) {
  55059. this[_xfa_object.$extra]._isSplittable = false;
  55060. return false;
  55061. }
  55062. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55063. return false;
  55064. }
  55065. this[_xfa_object.$extra]._isSplittable = true;
  55066. return true;
  55067. }
  55068. [_xfa_object.$flushHTML]() {
  55069. return (0, _layout.flushHTML)(this);
  55070. }
  55071. [_xfa_object.$addHTML](html, bbox) {
  55072. (0, _layout.addHTML)(this, html, bbox);
  55073. }
  55074. [_xfa_object.$getAvailableSpace]() {
  55075. return (0, _layout.getAvailableSpace)(this);
  55076. }
  55077. [_xfa_object.$toHTML](availableSpace) {
  55078. setTabIndex(this);
  55079. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55080. return _utils.HTMLResult.EMPTY;
  55081. }
  55082. (0, _html_utils.fixDimensions)(this);
  55083. const children = [];
  55084. const attributes = {
  55085. id: this[_xfa_object.$uid],
  55086. class: []
  55087. };
  55088. (0, _html_utils.setAccess)(this, attributes.class);
  55089. if (!this[_xfa_object.$extra]) {
  55090. this[_xfa_object.$extra] = Object.create(null);
  55091. }
  55092. Object.assign(this[_xfa_object.$extra], {
  55093. children,
  55094. attributes,
  55095. attempt: 0,
  55096. line: null,
  55097. numberInLine: 0,
  55098. availableSpace: {
  55099. width: Math.min(this.w || Infinity, availableSpace.width),
  55100. height: Math.min(this.h || Infinity, availableSpace.height)
  55101. },
  55102. width: 0,
  55103. height: 0,
  55104. prevHeight: 0,
  55105. currentWidth: 0
  55106. });
  55107. const isSplittable = this[_xfa_object.$isSplittable]();
  55108. if (!isSplittable) {
  55109. setFirstUnsplittable(this);
  55110. }
  55111. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55112. return _utils.HTMLResult.FAILURE;
  55113. }
  55114. const filter = new Set(["field"]);
  55115. if (this.layout.includes("row")) {
  55116. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55117. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55118. this[_xfa_object.$extra].columnWidths = columnWidths;
  55119. this[_xfa_object.$extra].currentColumn = 0;
  55120. }
  55121. }
  55122. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55123. const classNames = ["xfaExclgroup"];
  55124. const cl = (0, _html_utils.layoutClass)(this);
  55125. if (cl) {
  55126. classNames.push(cl);
  55127. }
  55128. if ((0, _html_utils.isPrintOnly)(this)) {
  55129. classNames.push("xfaPrintOnly");
  55130. }
  55131. attributes.style = style;
  55132. attributes.class = classNames;
  55133. if (this.name) {
  55134. attributes.xfaName = this.name;
  55135. }
  55136. this[_xfa_object.$pushPara]();
  55137. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55138. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55139. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55140. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55141. this[_xfa_object.$extra].numberInLine = 0;
  55142. }
  55143. const result = this[_xfa_object.$childrenToHTML]({
  55144. filter,
  55145. include: true
  55146. });
  55147. if (result.success) {
  55148. break;
  55149. }
  55150. if (result.isBreak()) {
  55151. this[_xfa_object.$popPara]();
  55152. return result;
  55153. }
  55154. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55155. this[_xfa_object.$extra].attempt = maxRun;
  55156. break;
  55157. }
  55158. }
  55159. this[_xfa_object.$popPara]();
  55160. if (!isSplittable) {
  55161. unsetFirstUnsplittable(this);
  55162. }
  55163. if (this[_xfa_object.$extra].attempt === maxRun) {
  55164. if (!isSplittable) {
  55165. delete this[_xfa_object.$extra];
  55166. }
  55167. return _utils.HTMLResult.FAILURE;
  55168. }
  55169. let marginH = 0;
  55170. let marginV = 0;
  55171. if (this.margin) {
  55172. marginH = this.margin.leftInset + this.margin.rightInset;
  55173. marginV = this.margin.topInset + this.margin.bottomInset;
  55174. }
  55175. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55176. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55177. const bbox = [this.x, this.y, width, height];
  55178. if (this.w === "") {
  55179. style.width = (0, _html_utils.measureToString)(width);
  55180. }
  55181. if (this.h === "") {
  55182. style.height = (0, _html_utils.measureToString)(height);
  55183. }
  55184. const html = {
  55185. name: "div",
  55186. attributes,
  55187. children
  55188. };
  55189. applyAssist(this, attributes);
  55190. delete this[_xfa_object.$extra];
  55191. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55192. }
  55193. }
  55194. class Execute extends _xfa_object.XFAObject {
  55195. constructor(attributes) {
  55196. super(TEMPLATE_NS_ID, "execute");
  55197. this.connection = attributes.connection || "";
  55198. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55199. this.id = attributes.id || "";
  55200. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55201. this.use = attributes.use || "";
  55202. this.usehref = attributes.usehref || "";
  55203. }
  55204. }
  55205. class Extras extends _xfa_object.XFAObject {
  55206. constructor(attributes) {
  55207. super(TEMPLATE_NS_ID, "extras", true);
  55208. this.id = attributes.id || "";
  55209. this.name = attributes.name || "";
  55210. this.use = attributes.use || "";
  55211. this.usehref = attributes.usehref || "";
  55212. this.boolean = new _xfa_object.XFAObjectArray();
  55213. this.date = new _xfa_object.XFAObjectArray();
  55214. this.dateTime = new _xfa_object.XFAObjectArray();
  55215. this.decimal = new _xfa_object.XFAObjectArray();
  55216. this.exData = new _xfa_object.XFAObjectArray();
  55217. this.extras = new _xfa_object.XFAObjectArray();
  55218. this.float = new _xfa_object.XFAObjectArray();
  55219. this.image = new _xfa_object.XFAObjectArray();
  55220. this.integer = new _xfa_object.XFAObjectArray();
  55221. this.text = new _xfa_object.XFAObjectArray();
  55222. this.time = new _xfa_object.XFAObjectArray();
  55223. }
  55224. }
  55225. class Field extends _xfa_object.XFAObject {
  55226. constructor(attributes) {
  55227. super(TEMPLATE_NS_ID, "field", true);
  55228. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55229. this.accessKey = attributes.accessKey || "";
  55230. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55231. this.colSpan = (0, _utils.getInteger)({
  55232. data: attributes.colSpan,
  55233. defaultValue: 1,
  55234. validate: n => n >= 1 || n === -1
  55235. });
  55236. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55237. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55238. this.id = attributes.id || "";
  55239. this.locale = attributes.locale || "";
  55240. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55241. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55242. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55243. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55244. this.name = attributes.name || "";
  55245. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55246. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55247. this.rotate = (0, _utils.getInteger)({
  55248. data: attributes.rotate,
  55249. defaultValue: 0,
  55250. validate: x => x % 90 === 0
  55251. });
  55252. this.use = attributes.use || "";
  55253. this.usehref = attributes.usehref || "";
  55254. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55255. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55256. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55257. this.assist = null;
  55258. this.bind = null;
  55259. this.border = null;
  55260. this.calculate = null;
  55261. this.caption = null;
  55262. this.desc = null;
  55263. this.extras = null;
  55264. this.font = null;
  55265. this.format = null;
  55266. this.items = new _xfa_object.XFAObjectArray(2);
  55267. this.keep = null;
  55268. this.margin = null;
  55269. this.para = null;
  55270. this.traversal = null;
  55271. this.ui = null;
  55272. this.validate = null;
  55273. this.value = null;
  55274. this.bindItems = new _xfa_object.XFAObjectArray();
  55275. this.connect = new _xfa_object.XFAObjectArray();
  55276. this.event = new _xfa_object.XFAObjectArray();
  55277. this.setProperty = new _xfa_object.XFAObjectArray();
  55278. }
  55279. [_xfa_object.$isBindable]() {
  55280. return true;
  55281. }
  55282. [_xfa_object.$setValue](value) {
  55283. _setValue(this, value);
  55284. }
  55285. [_xfa_object.$toHTML](availableSpace) {
  55286. setTabIndex(this);
  55287. if (!this.ui) {
  55288. this.ui = new Ui({});
  55289. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55290. this[_xfa_object.$appendChild](this.ui);
  55291. let node;
  55292. switch (this.items.children.length) {
  55293. case 0:
  55294. node = new TextEdit({});
  55295. this.ui.textEdit = node;
  55296. break;
  55297. case 1:
  55298. node = new CheckButton({});
  55299. this.ui.checkButton = node;
  55300. break;
  55301. case 2:
  55302. node = new ChoiceList({});
  55303. this.ui.choiceList = node;
  55304. break;
  55305. }
  55306. this.ui[_xfa_object.$appendChild](node);
  55307. }
  55308. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55309. return _utils.HTMLResult.EMPTY;
  55310. }
  55311. if (this.caption) {
  55312. delete this.caption[_xfa_object.$extra];
  55313. }
  55314. this[_xfa_object.$pushPara]();
  55315. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55316. const savedW = this.w;
  55317. const savedH = this.h;
  55318. let marginH = 0;
  55319. let marginV = 0;
  55320. if (this.margin) {
  55321. marginH = this.margin.leftInset + this.margin.rightInset;
  55322. marginV = this.margin.topInset + this.margin.bottomInset;
  55323. }
  55324. let borderDims = null;
  55325. if (this.w === "" || this.h === "") {
  55326. let width = null;
  55327. let height = null;
  55328. let uiW = 0;
  55329. let uiH = 0;
  55330. if (this.ui.checkButton) {
  55331. uiW = uiH = this.ui.checkButton.size;
  55332. } else {
  55333. const {
  55334. w,
  55335. h
  55336. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55337. if (w !== null) {
  55338. uiW = w;
  55339. uiH = h;
  55340. } else {
  55341. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55342. }
  55343. }
  55344. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55345. uiW += borderDims.w;
  55346. uiH += borderDims.h;
  55347. if (this.caption) {
  55348. const {
  55349. w,
  55350. h,
  55351. isBroken
  55352. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55353. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55354. this[_xfa_object.$popPara]();
  55355. return _utils.HTMLResult.FAILURE;
  55356. }
  55357. width = w;
  55358. height = h;
  55359. switch (this.caption.placement) {
  55360. case "left":
  55361. case "right":
  55362. case "inline":
  55363. width += uiW;
  55364. break;
  55365. case "top":
  55366. case "bottom":
  55367. height += uiH;
  55368. break;
  55369. }
  55370. } else {
  55371. width = uiW;
  55372. height = uiH;
  55373. }
  55374. if (width && this.w === "") {
  55375. width += marginH;
  55376. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55377. }
  55378. if (height && this.h === "") {
  55379. height += marginV;
  55380. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55381. }
  55382. }
  55383. this[_xfa_object.$popPara]();
  55384. (0, _html_utils.fixDimensions)(this);
  55385. setFirstUnsplittable(this);
  55386. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55387. this.w = savedW;
  55388. this.h = savedH;
  55389. this[_xfa_object.$popPara]();
  55390. return _utils.HTMLResult.FAILURE;
  55391. }
  55392. unsetFirstUnsplittable(this);
  55393. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55394. (0, _html_utils.setMinMaxDimensions)(this, style);
  55395. const classNames = ["xfaField"];
  55396. if (this.font) {
  55397. classNames.push("xfaFont");
  55398. }
  55399. if ((0, _html_utils.isPrintOnly)(this)) {
  55400. classNames.push("xfaPrintOnly");
  55401. }
  55402. const attributes = {
  55403. style,
  55404. id: this[_xfa_object.$uid],
  55405. class: classNames
  55406. };
  55407. if (style.margin) {
  55408. style.padding = style.margin;
  55409. delete style.margin;
  55410. }
  55411. (0, _html_utils.setAccess)(this, classNames);
  55412. if (this.name) {
  55413. attributes.xfaName = this.name;
  55414. }
  55415. const children = [];
  55416. const html = {
  55417. name: "div",
  55418. attributes,
  55419. children
  55420. };
  55421. applyAssist(this, attributes);
  55422. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55423. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55424. const ui = this.ui[_xfa_object.$toHTML]().html;
  55425. if (!ui) {
  55426. Object.assign(style, borderStyle);
  55427. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55428. }
  55429. if (this[_xfa_object.$tabIndex]) {
  55430. if (ui.children && ui.children[0]) {
  55431. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55432. } else {
  55433. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55434. }
  55435. }
  55436. if (!ui.attributes.style) {
  55437. ui.attributes.style = Object.create(null);
  55438. }
  55439. let aElement = null;
  55440. if (this.ui.button) {
  55441. if (ui.children.length === 1) {
  55442. [aElement] = ui.children.splice(0, 1);
  55443. }
  55444. Object.assign(ui.attributes.style, borderStyle);
  55445. } else {
  55446. Object.assign(style, borderStyle);
  55447. }
  55448. children.push(ui);
  55449. if (this.value) {
  55450. if (this.ui.imageEdit) {
  55451. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55452. } else if (!this.ui.button) {
  55453. let value = "";
  55454. if (this.value.exData) {
  55455. value = this.value.exData[_xfa_object.$text]();
  55456. } else if (this.value.text) {
  55457. value = this.value.text[_xfa_object.$getExtra]();
  55458. } else {
  55459. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55460. if (htmlValue !== null) {
  55461. value = htmlValue.children[0].value;
  55462. }
  55463. }
  55464. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55465. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55466. }
  55467. if (value) {
  55468. if (this.ui.numericEdit) {
  55469. value = parseFloat(value);
  55470. value = isNaN(value) ? "" : value.toString();
  55471. }
  55472. if (ui.children[0].name === "textarea") {
  55473. ui.children[0].attributes.textContent = value;
  55474. } else {
  55475. ui.children[0].attributes.value = value;
  55476. }
  55477. }
  55478. }
  55479. }
  55480. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55481. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55482. let captionHeight = 0;
  55483. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55484. captionHeight = this.caption.reserve;
  55485. if (captionHeight <= 0) {
  55486. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55487. }
  55488. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55489. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55490. } else {
  55491. ui.children[0].attributes.style.height = "100%";
  55492. }
  55493. }
  55494. if (aElement) {
  55495. ui.children.push(aElement);
  55496. }
  55497. if (!caption) {
  55498. if (ui.attributes.class) {
  55499. ui.attributes.class.push("xfaLeft");
  55500. }
  55501. this.w = savedW;
  55502. this.h = savedH;
  55503. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55504. }
  55505. if (this.ui.button) {
  55506. if (style.padding) {
  55507. delete style.padding;
  55508. }
  55509. if (caption.name === "div") {
  55510. caption.name = "span";
  55511. }
  55512. ui.children.push(caption);
  55513. return _utils.HTMLResult.success(html, bbox);
  55514. } else if (this.ui.checkButton) {
  55515. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55516. }
  55517. if (!ui.attributes.class) {
  55518. ui.attributes.class = [];
  55519. }
  55520. ui.children.splice(0, 0, caption);
  55521. switch (this.caption.placement) {
  55522. case "left":
  55523. ui.attributes.class.push("xfaLeft");
  55524. break;
  55525. case "right":
  55526. ui.attributes.class.push("xfaRight");
  55527. break;
  55528. case "top":
  55529. ui.attributes.class.push("xfaTop");
  55530. break;
  55531. case "bottom":
  55532. ui.attributes.class.push("xfaBottom");
  55533. break;
  55534. case "inline":
  55535. ui.attributes.class.push("xfaLeft");
  55536. break;
  55537. }
  55538. this.w = savedW;
  55539. this.h = savedH;
  55540. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55541. }
  55542. }
  55543. exports.Field = Field;
  55544. class Fill extends _xfa_object.XFAObject {
  55545. constructor(attributes) {
  55546. super(TEMPLATE_NS_ID, "fill", true);
  55547. this.id = attributes.id || "";
  55548. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55549. this.use = attributes.use || "";
  55550. this.usehref = attributes.usehref || "";
  55551. this.color = null;
  55552. this.extras = null;
  55553. this.linear = null;
  55554. this.pattern = null;
  55555. this.radial = null;
  55556. this.solid = null;
  55557. this.stipple = null;
  55558. }
  55559. [_xfa_object.$toStyle]() {
  55560. const parent = this[_xfa_object.$getParent]();
  55561. const grandpa = parent[_xfa_object.$getParent]();
  55562. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55563. const style = Object.create(null);
  55564. let propName = "color";
  55565. let altPropName = propName;
  55566. if (parent instanceof Border) {
  55567. propName = "background-color";
  55568. altPropName = "background";
  55569. if (ggrandpa instanceof Ui) {
  55570. style.backgroundColor = "white";
  55571. }
  55572. }
  55573. if (parent instanceof Rectangle || parent instanceof Arc) {
  55574. propName = altPropName = "fill";
  55575. style.fill = "white";
  55576. }
  55577. for (const name of Object.getOwnPropertyNames(this)) {
  55578. if (name === "extras" || name === "color") {
  55579. continue;
  55580. }
  55581. const obj = this[name];
  55582. if (!(obj instanceof _xfa_object.XFAObject)) {
  55583. continue;
  55584. }
  55585. const color = obj[_xfa_object.$toStyle](this.color);
  55586. if (color) {
  55587. style[color.startsWith("#") ? propName : altPropName] = color;
  55588. }
  55589. return style;
  55590. }
  55591. if (this.color && this.color.value) {
  55592. const color = this.color[_xfa_object.$toStyle]();
  55593. style[color.startsWith("#") ? propName : altPropName] = color;
  55594. }
  55595. return style;
  55596. }
  55597. }
  55598. class Filter extends _xfa_object.XFAObject {
  55599. constructor(attributes) {
  55600. super(TEMPLATE_NS_ID, "filter", true);
  55601. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  55602. this.id = attributes.id || "";
  55603. this.name = attributes.name || "";
  55604. this.use = attributes.use || "";
  55605. this.usehref = attributes.usehref || "";
  55606. this.version = (0, _utils.getInteger)({
  55607. data: this.version,
  55608. defaultValue: 5,
  55609. validate: x => x >= 1 && x <= 5
  55610. });
  55611. this.appearanceFilter = null;
  55612. this.certificates = null;
  55613. this.digestMethods = null;
  55614. this.encodings = null;
  55615. this.encryptionMethods = null;
  55616. this.handler = null;
  55617. this.lockDocument = null;
  55618. this.mdp = null;
  55619. this.reasons = null;
  55620. this.timeStamp = null;
  55621. }
  55622. }
  55623. class Float extends _xfa_object.ContentObject {
  55624. constructor(attributes) {
  55625. super(TEMPLATE_NS_ID, "float");
  55626. this.id = attributes.id || "";
  55627. this.name = attributes.name || "";
  55628. this.use = attributes.use || "";
  55629. this.usehref = attributes.usehref || "";
  55630. }
  55631. [_xfa_object.$finalize]() {
  55632. const number = parseFloat(this[_xfa_object.$content].trim());
  55633. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55634. }
  55635. [_xfa_object.$toHTML](availableSpace) {
  55636. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55637. }
  55638. }
  55639. class Font extends _xfa_object.XFAObject {
  55640. constructor(attributes) {
  55641. super(TEMPLATE_NS_ID, "font", true);
  55642. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  55643. this.fontHorizontalScale = (0, _utils.getFloat)({
  55644. data: attributes.fontHorizontalScale,
  55645. defaultValue: 100,
  55646. validate: x => x >= 0
  55647. });
  55648. this.fontVerticalScale = (0, _utils.getFloat)({
  55649. data: attributes.fontVerticalScale,
  55650. defaultValue: 100,
  55651. validate: x => x >= 0
  55652. });
  55653. this.id = attributes.id || "";
  55654. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  55655. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  55656. this.lineThrough = (0, _utils.getInteger)({
  55657. data: attributes.lineThrough,
  55658. defaultValue: 0,
  55659. validate: x => x === 1 || x === 2
  55660. });
  55661. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  55662. this.overline = (0, _utils.getInteger)({
  55663. data: attributes.overline,
  55664. defaultValue: 0,
  55665. validate: x => x === 1 || x === 2
  55666. });
  55667. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  55668. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  55669. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  55670. this.typeface = attributes.typeface || "Courier";
  55671. this.underline = (0, _utils.getInteger)({
  55672. data: attributes.underline,
  55673. defaultValue: 0,
  55674. validate: x => x === 1 || x === 2
  55675. });
  55676. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  55677. this.use = attributes.use || "";
  55678. this.usehref = attributes.usehref || "";
  55679. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  55680. this.extras = null;
  55681. this.fill = null;
  55682. }
  55683. [_xfa_object.$clean](builder) {
  55684. super[_xfa_object.$clean](builder);
  55685. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  55686. }
  55687. [_xfa_object.$toStyle]() {
  55688. const style = (0, _html_utils.toStyle)(this, "fill");
  55689. const color = style.color;
  55690. if (color) {
  55691. if (color === "#000000") {
  55692. delete style.color;
  55693. } else if (!color.startsWith("#")) {
  55694. style.background = color;
  55695. style.backgroundClip = "text";
  55696. style.color = "transparent";
  55697. }
  55698. }
  55699. if (this.baselineShift) {
  55700. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  55701. }
  55702. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  55703. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  55704. if (this.lineThrough !== 0) {
  55705. style.textDecoration = "line-through";
  55706. if (this.lineThrough === 2) {
  55707. style.textDecorationStyle = "double";
  55708. }
  55709. }
  55710. if (this.overline !== 0) {
  55711. style.textDecoration = "overline";
  55712. if (this.overline === 2) {
  55713. style.textDecorationStyle = "double";
  55714. }
  55715. }
  55716. style.fontStyle = this.posture;
  55717. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  55718. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  55719. if (this.underline !== 0) {
  55720. style.textDecoration = "underline";
  55721. if (this.underline === 2) {
  55722. style.textDecorationStyle = "double";
  55723. }
  55724. }
  55725. style.fontWeight = this.weight;
  55726. return style;
  55727. }
  55728. }
  55729. class Format extends _xfa_object.XFAObject {
  55730. constructor(attributes) {
  55731. super(TEMPLATE_NS_ID, "format", true);
  55732. this.id = attributes.id || "";
  55733. this.use = attributes.use || "";
  55734. this.usehref = attributes.usehref || "";
  55735. this.extras = null;
  55736. this.picture = null;
  55737. }
  55738. }
  55739. class Handler extends _xfa_object.StringObject {
  55740. constructor(attributes) {
  55741. super(TEMPLATE_NS_ID, "handler");
  55742. this.id = attributes.id || "";
  55743. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55744. this.use = attributes.use || "";
  55745. this.usehref = attributes.usehref || "";
  55746. }
  55747. }
  55748. class Hyphenation extends _xfa_object.XFAObject {
  55749. constructor(attributes) {
  55750. super(TEMPLATE_NS_ID, "hyphenation");
  55751. this.excludeAllCaps = (0, _utils.getInteger)({
  55752. data: attributes.excludeAllCaps,
  55753. defaultValue: 0,
  55754. validate: x => x === 1
  55755. });
  55756. this.excludeInitialCap = (0, _utils.getInteger)({
  55757. data: attributes.excludeInitialCap,
  55758. defaultValue: 0,
  55759. validate: x => x === 1
  55760. });
  55761. this.hyphenate = (0, _utils.getInteger)({
  55762. data: attributes.hyphenate,
  55763. defaultValue: 0,
  55764. validate: x => x === 1
  55765. });
  55766. this.id = attributes.id || "";
  55767. this.pushCharacterCount = (0, _utils.getInteger)({
  55768. data: attributes.pushCharacterCount,
  55769. defaultValue: 3,
  55770. validate: x => x >= 0
  55771. });
  55772. this.remainCharacterCount = (0, _utils.getInteger)({
  55773. data: attributes.remainCharacterCount,
  55774. defaultValue: 3,
  55775. validate: x => x >= 0
  55776. });
  55777. this.use = attributes.use || "";
  55778. this.usehref = attributes.usehref || "";
  55779. this.wordCharacterCount = (0, _utils.getInteger)({
  55780. data: attributes.wordCharacterCount,
  55781. defaultValue: 7,
  55782. validate: x => x >= 0
  55783. });
  55784. }
  55785. }
  55786. class Image extends _xfa_object.StringObject {
  55787. constructor(attributes) {
  55788. super(TEMPLATE_NS_ID, "image");
  55789. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  55790. this.contentType = attributes.contentType || "";
  55791. this.href = attributes.href || "";
  55792. this.id = attributes.id || "";
  55793. this.name = attributes.name || "";
  55794. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  55795. this.use = attributes.use || "";
  55796. this.usehref = attributes.usehref || "";
  55797. }
  55798. [_xfa_object.$toHTML]() {
  55799. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  55800. return _utils.HTMLResult.EMPTY;
  55801. }
  55802. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  55803. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  55804. return _utils.HTMLResult.EMPTY;
  55805. }
  55806. if (!buffer && this.transferEncoding === "base64") {
  55807. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  55808. }
  55809. if (!buffer) {
  55810. return _utils.HTMLResult.EMPTY;
  55811. }
  55812. if (!this.contentType) {
  55813. for (const [header, type] of IMAGES_HEADERS) {
  55814. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  55815. this.contentType = type;
  55816. break;
  55817. }
  55818. }
  55819. if (!this.contentType) {
  55820. return _utils.HTMLResult.EMPTY;
  55821. }
  55822. }
  55823. const blob = new Blob([buffer], {
  55824. type: this.contentType
  55825. });
  55826. let style;
  55827. switch (this.aspect) {
  55828. case "fit":
  55829. case "actual":
  55830. break;
  55831. case "height":
  55832. style = {
  55833. height: "100%",
  55834. objectFit: "fill"
  55835. };
  55836. break;
  55837. case "none":
  55838. style = {
  55839. width: "100%",
  55840. height: "100%",
  55841. objectFit: "fill"
  55842. };
  55843. break;
  55844. case "width":
  55845. style = {
  55846. width: "100%",
  55847. objectFit: "fill"
  55848. };
  55849. break;
  55850. }
  55851. const parent = this[_xfa_object.$getParent]();
  55852. return _utils.HTMLResult.success({
  55853. name: "img",
  55854. attributes: {
  55855. class: ["xfaImage"],
  55856. style,
  55857. src: URL.createObjectURL(blob),
  55858. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  55859. }
  55860. });
  55861. }
  55862. }
  55863. class ImageEdit extends _xfa_object.XFAObject {
  55864. constructor(attributes) {
  55865. super(TEMPLATE_NS_ID, "imageEdit", true);
  55866. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  55867. this.id = attributes.id || "";
  55868. this.use = attributes.use || "";
  55869. this.usehref = attributes.usehref || "";
  55870. this.border = null;
  55871. this.extras = null;
  55872. this.margin = null;
  55873. }
  55874. [_xfa_object.$toHTML](availableSpace) {
  55875. if (this.data === "embed") {
  55876. return _utils.HTMLResult.success({
  55877. name: "div",
  55878. children: [],
  55879. attributes: {}
  55880. });
  55881. }
  55882. return _utils.HTMLResult.EMPTY;
  55883. }
  55884. }
  55885. class Integer extends _xfa_object.ContentObject {
  55886. constructor(attributes) {
  55887. super(TEMPLATE_NS_ID, "integer");
  55888. this.id = attributes.id || "";
  55889. this.name = attributes.name || "";
  55890. this.use = attributes.use || "";
  55891. this.usehref = attributes.usehref || "";
  55892. }
  55893. [_xfa_object.$finalize]() {
  55894. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  55895. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55896. }
  55897. [_xfa_object.$toHTML](availableSpace) {
  55898. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55899. }
  55900. }
  55901. class Issuers extends _xfa_object.XFAObject {
  55902. constructor(attributes) {
  55903. super(TEMPLATE_NS_ID, "issuers", true);
  55904. this.id = attributes.id || "";
  55905. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55906. this.use = attributes.use || "";
  55907. this.usehref = attributes.usehref || "";
  55908. this.certificate = new _xfa_object.XFAObjectArray();
  55909. }
  55910. }
  55911. class Items extends _xfa_object.XFAObject {
  55912. constructor(attributes) {
  55913. super(TEMPLATE_NS_ID, "items", true);
  55914. this.id = attributes.id || "";
  55915. this.name = attributes.name || "";
  55916. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55917. this.ref = attributes.ref || "";
  55918. this.save = (0, _utils.getInteger)({
  55919. data: attributes.save,
  55920. defaultValue: 0,
  55921. validate: x => x === 1
  55922. });
  55923. this.use = attributes.use || "";
  55924. this.usehref = attributes.usehref || "";
  55925. this.boolean = new _xfa_object.XFAObjectArray();
  55926. this.date = new _xfa_object.XFAObjectArray();
  55927. this.dateTime = new _xfa_object.XFAObjectArray();
  55928. this.decimal = new _xfa_object.XFAObjectArray();
  55929. this.exData = new _xfa_object.XFAObjectArray();
  55930. this.float = new _xfa_object.XFAObjectArray();
  55931. this.image = new _xfa_object.XFAObjectArray();
  55932. this.integer = new _xfa_object.XFAObjectArray();
  55933. this.text = new _xfa_object.XFAObjectArray();
  55934. this.time = new _xfa_object.XFAObjectArray();
  55935. }
  55936. [_xfa_object.$toHTML]() {
  55937. const output = [];
  55938. for (const child of this[_xfa_object.$getChildren]()) {
  55939. output.push(child[_xfa_object.$text]());
  55940. }
  55941. return _utils.HTMLResult.success(output);
  55942. }
  55943. }
  55944. exports.Items = Items;
  55945. class Keep extends _xfa_object.XFAObject {
  55946. constructor(attributes) {
  55947. super(TEMPLATE_NS_ID, "keep", true);
  55948. this.id = attributes.id || "";
  55949. const options = ["none", "contentArea", "pageArea"];
  55950. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  55951. this.next = (0, _utils.getStringOption)(attributes.next, options);
  55952. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  55953. this.use = attributes.use || "";
  55954. this.usehref = attributes.usehref || "";
  55955. this.extras = null;
  55956. }
  55957. }
  55958. class KeyUsage extends _xfa_object.XFAObject {
  55959. constructor(attributes) {
  55960. super(TEMPLATE_NS_ID, "keyUsage");
  55961. const options = ["", "yes", "no"];
  55962. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  55963. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  55964. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  55965. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  55966. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  55967. this.id = attributes.id || "";
  55968. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  55969. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  55970. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  55971. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  55972. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55973. this.use = attributes.use || "";
  55974. this.usehref = attributes.usehref || "";
  55975. }
  55976. }
  55977. class Line extends _xfa_object.XFAObject {
  55978. constructor(attributes) {
  55979. super(TEMPLATE_NS_ID, "line", true);
  55980. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55981. this.id = attributes.id || "";
  55982. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  55983. this.use = attributes.use || "";
  55984. this.usehref = attributes.usehref || "";
  55985. this.edge = null;
  55986. }
  55987. [_xfa_object.$toHTML]() {
  55988. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55989. const edge = this.edge || new Edge({});
  55990. const edgeStyle = edge[_xfa_object.$toStyle]();
  55991. const style = Object.create(null);
  55992. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  55993. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  55994. style.stroke = edgeStyle.color;
  55995. let x1, y1, x2, y2;
  55996. let width = "100%";
  55997. let height = "100%";
  55998. if (parent.w <= thickness) {
  55999. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  56000. width = style.strokeWidth;
  56001. } else if (parent.h <= thickness) {
  56002. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  56003. height = style.strokeWidth;
  56004. } else {
  56005. if (this.slope === "\\") {
  56006. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  56007. } else {
  56008. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  56009. }
  56010. }
  56011. const line = {
  56012. name: "line",
  56013. attributes: {
  56014. xmlns: SVG_NS,
  56015. x1,
  56016. y1,
  56017. x2,
  56018. y2,
  56019. style
  56020. }
  56021. };
  56022. const svg = {
  56023. name: "svg",
  56024. children: [line],
  56025. attributes: {
  56026. xmlns: SVG_NS,
  56027. width,
  56028. height,
  56029. style: {
  56030. overflow: "visible"
  56031. }
  56032. }
  56033. };
  56034. if (hasMargin(parent)) {
  56035. return _utils.HTMLResult.success({
  56036. name: "div",
  56037. attributes: {
  56038. style: {
  56039. display: "inline",
  56040. width: "100%",
  56041. height: "100%"
  56042. }
  56043. },
  56044. children: [svg]
  56045. });
  56046. }
  56047. svg.attributes.style.position = "absolute";
  56048. return _utils.HTMLResult.success(svg);
  56049. }
  56050. }
  56051. class Linear extends _xfa_object.XFAObject {
  56052. constructor(attributes) {
  56053. super(TEMPLATE_NS_ID, "linear", true);
  56054. this.id = attributes.id || "";
  56055. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  56056. this.use = attributes.use || "";
  56057. this.usehref = attributes.usehref || "";
  56058. this.color = null;
  56059. this.extras = null;
  56060. }
  56061. [_xfa_object.$toStyle](startColor) {
  56062. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56063. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  56064. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56065. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  56066. }
  56067. }
  56068. class LockDocument extends _xfa_object.ContentObject {
  56069. constructor(attributes) {
  56070. super(TEMPLATE_NS_ID, "lockDocument");
  56071. this.id = attributes.id || "";
  56072. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56073. this.use = attributes.use || "";
  56074. this.usehref = attributes.usehref || "";
  56075. }
  56076. [_xfa_object.$finalize]() {
  56077. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  56078. }
  56079. }
  56080. class Manifest extends _xfa_object.XFAObject {
  56081. constructor(attributes) {
  56082. super(TEMPLATE_NS_ID, "manifest", true);
  56083. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  56084. this.id = attributes.id || "";
  56085. this.name = attributes.name || "";
  56086. this.use = attributes.use || "";
  56087. this.usehref = attributes.usehref || "";
  56088. this.extras = null;
  56089. this.ref = new _xfa_object.XFAObjectArray();
  56090. }
  56091. }
  56092. class Margin extends _xfa_object.XFAObject {
  56093. constructor(attributes) {
  56094. super(TEMPLATE_NS_ID, "margin", true);
  56095. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  56096. this.id = attributes.id || "";
  56097. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  56098. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  56099. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  56100. this.use = attributes.use || "";
  56101. this.usehref = attributes.usehref || "";
  56102. this.extras = null;
  56103. }
  56104. [_xfa_object.$toStyle]() {
  56105. return {
  56106. 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)
  56107. };
  56108. }
  56109. }
  56110. class Mdp extends _xfa_object.XFAObject {
  56111. constructor(attributes) {
  56112. super(TEMPLATE_NS_ID, "mdp");
  56113. this.id = attributes.id || "";
  56114. this.permissions = (0, _utils.getInteger)({
  56115. data: attributes.permissions,
  56116. defaultValue: 2,
  56117. validate: x => x === 1 || x === 3
  56118. });
  56119. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  56120. this.use = attributes.use || "";
  56121. this.usehref = attributes.usehref || "";
  56122. }
  56123. }
  56124. class Medium extends _xfa_object.XFAObject {
  56125. constructor(attributes) {
  56126. super(TEMPLATE_NS_ID, "medium");
  56127. this.id = attributes.id || "";
  56128. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  56129. this.long = (0, _utils.getMeasurement)(attributes.long);
  56130. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  56131. this.short = (0, _utils.getMeasurement)(attributes.short);
  56132. this.stock = attributes.stock || "";
  56133. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56134. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56135. this.use = attributes.use || "";
  56136. this.usehref = attributes.usehref || "";
  56137. }
  56138. }
  56139. class Message extends _xfa_object.XFAObject {
  56140. constructor(attributes) {
  56141. super(TEMPLATE_NS_ID, "message", true);
  56142. this.id = attributes.id || "";
  56143. this.use = attributes.use || "";
  56144. this.usehref = attributes.usehref || "";
  56145. this.text = new _xfa_object.XFAObjectArray();
  56146. }
  56147. }
  56148. class NumericEdit extends _xfa_object.XFAObject {
  56149. constructor(attributes) {
  56150. super(TEMPLATE_NS_ID, "numericEdit", true);
  56151. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56152. this.id = attributes.id || "";
  56153. this.use = attributes.use || "";
  56154. this.usehref = attributes.usehref || "";
  56155. this.border = null;
  56156. this.comb = null;
  56157. this.extras = null;
  56158. this.margin = null;
  56159. }
  56160. [_xfa_object.$toHTML](availableSpace) {
  56161. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56162. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56163. const html = {
  56164. name: "input",
  56165. attributes: {
  56166. type: "text",
  56167. fieldId: field[_xfa_object.$uid],
  56168. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56169. class: ["xfaTextfield"],
  56170. style,
  56171. "aria-label": ariaLabel(field),
  56172. "aria-required": false
  56173. }
  56174. };
  56175. if (isRequired(field)) {
  56176. html.attributes["aria-required"] = true;
  56177. html.attributes.required = true;
  56178. }
  56179. return _utils.HTMLResult.success({
  56180. name: "label",
  56181. attributes: {
  56182. class: ["xfaLabel"]
  56183. },
  56184. children: [html]
  56185. });
  56186. }
  56187. }
  56188. class Occur extends _xfa_object.XFAObject {
  56189. constructor(attributes) {
  56190. super(TEMPLATE_NS_ID, "occur", true);
  56191. this.id = attributes.id || "";
  56192. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56193. data: attributes.initial,
  56194. defaultValue: "",
  56195. validate: x => true
  56196. }) : "";
  56197. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56198. data: attributes.max,
  56199. defaultValue: 1,
  56200. validate: x => true
  56201. }) : "";
  56202. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56203. data: attributes.min,
  56204. defaultValue: 1,
  56205. validate: x => true
  56206. }) : "";
  56207. this.use = attributes.use || "";
  56208. this.usehref = attributes.usehref || "";
  56209. this.extras = null;
  56210. }
  56211. [_xfa_object.$clean]() {
  56212. const parent = this[_xfa_object.$getParent]();
  56213. const originalMin = this.min;
  56214. if (this.min === "") {
  56215. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56216. }
  56217. if (this.max === "") {
  56218. if (originalMin === "") {
  56219. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56220. } else {
  56221. this.max = this.min;
  56222. }
  56223. }
  56224. if (this.max !== -1 && this.max < this.min) {
  56225. this.max = this.min;
  56226. }
  56227. if (this.initial === "") {
  56228. this.initial = parent instanceof Template ? 1 : this.min;
  56229. }
  56230. }
  56231. }
  56232. class Oid extends _xfa_object.StringObject {
  56233. constructor(attributes) {
  56234. super(TEMPLATE_NS_ID, "oid");
  56235. this.id = attributes.id || "";
  56236. this.name = attributes.name || "";
  56237. this.use = attributes.use || "";
  56238. this.usehref = attributes.usehref || "";
  56239. }
  56240. }
  56241. class Oids extends _xfa_object.XFAObject {
  56242. constructor(attributes) {
  56243. super(TEMPLATE_NS_ID, "oids", true);
  56244. this.id = attributes.id || "";
  56245. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56246. this.use = attributes.use || "";
  56247. this.usehref = attributes.usehref || "";
  56248. this.oid = new _xfa_object.XFAObjectArray();
  56249. }
  56250. }
  56251. class Overflow extends _xfa_object.XFAObject {
  56252. constructor(attributes) {
  56253. super(TEMPLATE_NS_ID, "overflow");
  56254. this.id = attributes.id || "";
  56255. this.leader = attributes.leader || "";
  56256. this.target = attributes.target || "";
  56257. this.trailer = attributes.trailer || "";
  56258. this.use = attributes.use || "";
  56259. this.usehref = attributes.usehref || "";
  56260. }
  56261. [_xfa_object.$getExtra]() {
  56262. if (!this[_xfa_object.$extra]) {
  56263. const parent = this[_xfa_object.$getParent]();
  56264. const root = this[_xfa_object.$getTemplateRoot]();
  56265. const target = root[_xfa_object.$searchNode](this.target, parent);
  56266. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56267. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56268. this[_xfa_object.$extra] = {
  56269. target: target && target[0] || null,
  56270. leader: leader && leader[0] || null,
  56271. trailer: trailer && trailer[0] || null,
  56272. addLeader: false,
  56273. addTrailer: false
  56274. };
  56275. }
  56276. return this[_xfa_object.$extra];
  56277. }
  56278. }
  56279. class PageArea extends _xfa_object.XFAObject {
  56280. constructor(attributes) {
  56281. super(TEMPLATE_NS_ID, "pageArea", true);
  56282. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56283. this.id = attributes.id || "";
  56284. this.initialNumber = (0, _utils.getInteger)({
  56285. data: attributes.initialNumber,
  56286. defaultValue: 1,
  56287. validate: x => true
  56288. });
  56289. this.name = attributes.name || "";
  56290. this.numbered = (0, _utils.getInteger)({
  56291. data: attributes.numbered,
  56292. defaultValue: 1,
  56293. validate: x => true
  56294. });
  56295. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56296. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56297. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56298. this.use = attributes.use || "";
  56299. this.usehref = attributes.usehref || "";
  56300. this.desc = null;
  56301. this.extras = null;
  56302. this.medium = null;
  56303. this.occur = null;
  56304. this.area = new _xfa_object.XFAObjectArray();
  56305. this.contentArea = new _xfa_object.XFAObjectArray();
  56306. this.draw = new _xfa_object.XFAObjectArray();
  56307. this.exclGroup = new _xfa_object.XFAObjectArray();
  56308. this.field = new _xfa_object.XFAObjectArray();
  56309. this.subform = new _xfa_object.XFAObjectArray();
  56310. }
  56311. [_xfa_object.$isUsable]() {
  56312. if (!this[_xfa_object.$extra]) {
  56313. this[_xfa_object.$extra] = {
  56314. numberOfUse: 0
  56315. };
  56316. return true;
  56317. }
  56318. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56319. }
  56320. [_xfa_object.$cleanPage]() {
  56321. delete this[_xfa_object.$extra];
  56322. }
  56323. [_xfa_object.$getNextPage]() {
  56324. if (!this[_xfa_object.$extra]) {
  56325. this[_xfa_object.$extra] = {
  56326. numberOfUse: 0
  56327. };
  56328. }
  56329. const parent = this[_xfa_object.$getParent]();
  56330. if (parent.relation === "orderedOccurrence") {
  56331. if (this[_xfa_object.$isUsable]()) {
  56332. this[_xfa_object.$extra].numberOfUse += 1;
  56333. return this;
  56334. }
  56335. }
  56336. return parent[_xfa_object.$getNextPage]();
  56337. }
  56338. [_xfa_object.$getAvailableSpace]() {
  56339. return this[_xfa_object.$extra].space || {
  56340. width: 0,
  56341. height: 0
  56342. };
  56343. }
  56344. [_xfa_object.$toHTML]() {
  56345. if (!this[_xfa_object.$extra]) {
  56346. this[_xfa_object.$extra] = {
  56347. numberOfUse: 1
  56348. };
  56349. }
  56350. const children = [];
  56351. this[_xfa_object.$extra].children = children;
  56352. const style = Object.create(null);
  56353. if (this.medium && this.medium.short && this.medium.long) {
  56354. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56355. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56356. this[_xfa_object.$extra].space = {
  56357. width: this.medium.short,
  56358. height: this.medium.long
  56359. };
  56360. if (this.medium.orientation === "landscape") {
  56361. const x = style.width;
  56362. style.width = style.height;
  56363. style.height = x;
  56364. this[_xfa_object.$extra].space = {
  56365. width: this.medium.long,
  56366. height: this.medium.short
  56367. };
  56368. }
  56369. } else {
  56370. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56371. }
  56372. this[_xfa_object.$childrenToHTML]({
  56373. filter: new Set(["area", "draw", "field", "subform"]),
  56374. include: true
  56375. });
  56376. this[_xfa_object.$childrenToHTML]({
  56377. filter: new Set(["contentArea"]),
  56378. include: true
  56379. });
  56380. return _utils.HTMLResult.success({
  56381. name: "div",
  56382. children,
  56383. attributes: {
  56384. class: ["xfaPage"],
  56385. id: this[_xfa_object.$uid],
  56386. style,
  56387. xfaName: this.name
  56388. }
  56389. });
  56390. }
  56391. }
  56392. class PageSet extends _xfa_object.XFAObject {
  56393. constructor(attributes) {
  56394. super(TEMPLATE_NS_ID, "pageSet", true);
  56395. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56396. this.id = attributes.id || "";
  56397. this.name = attributes.name || "";
  56398. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56399. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56400. this.use = attributes.use || "";
  56401. this.usehref = attributes.usehref || "";
  56402. this.extras = null;
  56403. this.occur = null;
  56404. this.pageArea = new _xfa_object.XFAObjectArray();
  56405. this.pageSet = new _xfa_object.XFAObjectArray();
  56406. }
  56407. [_xfa_object.$cleanPage]() {
  56408. for (const page of this.pageArea.children) {
  56409. page[_xfa_object.$cleanPage]();
  56410. }
  56411. for (const page of this.pageSet.children) {
  56412. page[_xfa_object.$cleanPage]();
  56413. }
  56414. }
  56415. [_xfa_object.$isUsable]() {
  56416. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56417. }
  56418. [_xfa_object.$getNextPage]() {
  56419. if (!this[_xfa_object.$extra]) {
  56420. this[_xfa_object.$extra] = {
  56421. numberOfUse: 1,
  56422. pageIndex: -1,
  56423. pageSetIndex: -1
  56424. };
  56425. }
  56426. if (this.relation === "orderedOccurrence") {
  56427. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56428. this[_xfa_object.$extra].pageIndex += 1;
  56429. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56430. return pageArea[_xfa_object.$getNextPage]();
  56431. }
  56432. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56433. this[_xfa_object.$extra].pageSetIndex += 1;
  56434. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56435. }
  56436. if (this[_xfa_object.$isUsable]()) {
  56437. this[_xfa_object.$extra].numberOfUse += 1;
  56438. this[_xfa_object.$extra].pageIndex = -1;
  56439. this[_xfa_object.$extra].pageSetIndex = -1;
  56440. return this[_xfa_object.$getNextPage]();
  56441. }
  56442. const parent = this[_xfa_object.$getParent]();
  56443. if (parent instanceof PageSet) {
  56444. return parent[_xfa_object.$getNextPage]();
  56445. }
  56446. this[_xfa_object.$cleanPage]();
  56447. return this[_xfa_object.$getNextPage]();
  56448. }
  56449. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56450. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56451. const position = pageNumber === 0 ? "first" : "rest";
  56452. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56453. if (page) {
  56454. return page;
  56455. }
  56456. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56457. if (page) {
  56458. return page;
  56459. }
  56460. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56461. if (page) {
  56462. return page;
  56463. }
  56464. return this.pageArea.children[0];
  56465. }
  56466. }
  56467. class Para extends _xfa_object.XFAObject {
  56468. constructor(attributes) {
  56469. super(TEMPLATE_NS_ID, "para", true);
  56470. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56471. this.id = attributes.id || "";
  56472. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56473. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56474. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56475. this.orphans = (0, _utils.getInteger)({
  56476. data: attributes.orphans,
  56477. defaultValue: 0,
  56478. validate: x => x >= 0
  56479. });
  56480. this.preserve = attributes.preserve || "";
  56481. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56482. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56483. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56484. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56485. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56486. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56487. this.use = attributes.use || "";
  56488. this.usehref = attributes.usehref || "";
  56489. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56490. this.widows = (0, _utils.getInteger)({
  56491. data: attributes.widows,
  56492. defaultValue: 0,
  56493. validate: x => x >= 0
  56494. });
  56495. this.hyphenation = null;
  56496. }
  56497. [_xfa_object.$toStyle]() {
  56498. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56499. if (this.marginLeft !== "") {
  56500. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56501. }
  56502. if (this.marginRight !== "") {
  56503. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56504. }
  56505. if (this.spaceAbove !== "") {
  56506. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56507. }
  56508. if (this.spaceBelow !== "") {
  56509. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56510. }
  56511. if (this.textIndent !== "") {
  56512. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56513. (0, _html_utils.fixTextIndent)(style);
  56514. }
  56515. if (this.lineHeight > 0) {
  56516. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56517. }
  56518. if (this.tabDefault !== "") {
  56519. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56520. }
  56521. if (this.tabStops.length > 0) {}
  56522. if (this.hyphenatation) {
  56523. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56524. }
  56525. return style;
  56526. }
  56527. }
  56528. class PasswordEdit extends _xfa_object.XFAObject {
  56529. constructor(attributes) {
  56530. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56531. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56532. this.id = attributes.id || "";
  56533. this.passwordChar = attributes.passwordChar || "*";
  56534. this.use = attributes.use || "";
  56535. this.usehref = attributes.usehref || "";
  56536. this.border = null;
  56537. this.extras = null;
  56538. this.margin = null;
  56539. }
  56540. }
  56541. class Pattern extends _xfa_object.XFAObject {
  56542. constructor(attributes) {
  56543. super(TEMPLATE_NS_ID, "pattern", true);
  56544. this.id = attributes.id || "";
  56545. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56546. this.use = attributes.use || "";
  56547. this.usehref = attributes.usehref || "";
  56548. this.color = null;
  56549. this.extras = null;
  56550. }
  56551. [_xfa_object.$toStyle](startColor) {
  56552. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56553. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56554. const width = 5;
  56555. const cmd = "repeating-linear-gradient";
  56556. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56557. switch (this.type) {
  56558. case "crossHatch":
  56559. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56560. case "crossDiagonal":
  56561. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56562. case "diagonalLeft":
  56563. return `${cmd}(45deg,${colors})`;
  56564. case "diagonalRight":
  56565. return `${cmd}(-45deg,${colors})`;
  56566. case "horizontal":
  56567. return `${cmd}(to top,${colors})`;
  56568. case "vertical":
  56569. return `${cmd}(to right,${colors})`;
  56570. }
  56571. return "";
  56572. }
  56573. }
  56574. class Picture extends _xfa_object.StringObject {
  56575. constructor(attributes) {
  56576. super(TEMPLATE_NS_ID, "picture");
  56577. this.id = attributes.id || "";
  56578. this.use = attributes.use || "";
  56579. this.usehref = attributes.usehref || "";
  56580. }
  56581. }
  56582. class Proto extends _xfa_object.XFAObject {
  56583. constructor(attributes) {
  56584. super(TEMPLATE_NS_ID, "proto", true);
  56585. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  56586. this.arc = new _xfa_object.XFAObjectArray();
  56587. this.area = new _xfa_object.XFAObjectArray();
  56588. this.assist = new _xfa_object.XFAObjectArray();
  56589. this.barcode = new _xfa_object.XFAObjectArray();
  56590. this.bindItems = new _xfa_object.XFAObjectArray();
  56591. this.bookend = new _xfa_object.XFAObjectArray();
  56592. this.boolean = new _xfa_object.XFAObjectArray();
  56593. this.border = new _xfa_object.XFAObjectArray();
  56594. this.break = new _xfa_object.XFAObjectArray();
  56595. this.breakAfter = new _xfa_object.XFAObjectArray();
  56596. this.breakBefore = new _xfa_object.XFAObjectArray();
  56597. this.button = new _xfa_object.XFAObjectArray();
  56598. this.calculate = new _xfa_object.XFAObjectArray();
  56599. this.caption = new _xfa_object.XFAObjectArray();
  56600. this.certificate = new _xfa_object.XFAObjectArray();
  56601. this.certificates = new _xfa_object.XFAObjectArray();
  56602. this.checkButton = new _xfa_object.XFAObjectArray();
  56603. this.choiceList = new _xfa_object.XFAObjectArray();
  56604. this.color = new _xfa_object.XFAObjectArray();
  56605. this.comb = new _xfa_object.XFAObjectArray();
  56606. this.connect = new _xfa_object.XFAObjectArray();
  56607. this.contentArea = new _xfa_object.XFAObjectArray();
  56608. this.corner = new _xfa_object.XFAObjectArray();
  56609. this.date = new _xfa_object.XFAObjectArray();
  56610. this.dateTime = new _xfa_object.XFAObjectArray();
  56611. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  56612. this.decimal = new _xfa_object.XFAObjectArray();
  56613. this.defaultUi = new _xfa_object.XFAObjectArray();
  56614. this.desc = new _xfa_object.XFAObjectArray();
  56615. this.digestMethod = new _xfa_object.XFAObjectArray();
  56616. this.digestMethods = new _xfa_object.XFAObjectArray();
  56617. this.draw = new _xfa_object.XFAObjectArray();
  56618. this.edge = new _xfa_object.XFAObjectArray();
  56619. this.encoding = new _xfa_object.XFAObjectArray();
  56620. this.encodings = new _xfa_object.XFAObjectArray();
  56621. this.encrypt = new _xfa_object.XFAObjectArray();
  56622. this.encryptData = new _xfa_object.XFAObjectArray();
  56623. this.encryption = new _xfa_object.XFAObjectArray();
  56624. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  56625. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  56626. this.event = new _xfa_object.XFAObjectArray();
  56627. this.exData = new _xfa_object.XFAObjectArray();
  56628. this.exObject = new _xfa_object.XFAObjectArray();
  56629. this.exclGroup = new _xfa_object.XFAObjectArray();
  56630. this.execute = new _xfa_object.XFAObjectArray();
  56631. this.extras = new _xfa_object.XFAObjectArray();
  56632. this.field = new _xfa_object.XFAObjectArray();
  56633. this.fill = new _xfa_object.XFAObjectArray();
  56634. this.filter = new _xfa_object.XFAObjectArray();
  56635. this.float = new _xfa_object.XFAObjectArray();
  56636. this.font = new _xfa_object.XFAObjectArray();
  56637. this.format = new _xfa_object.XFAObjectArray();
  56638. this.handler = new _xfa_object.XFAObjectArray();
  56639. this.hyphenation = new _xfa_object.XFAObjectArray();
  56640. this.image = new _xfa_object.XFAObjectArray();
  56641. this.imageEdit = new _xfa_object.XFAObjectArray();
  56642. this.integer = new _xfa_object.XFAObjectArray();
  56643. this.issuers = new _xfa_object.XFAObjectArray();
  56644. this.items = new _xfa_object.XFAObjectArray();
  56645. this.keep = new _xfa_object.XFAObjectArray();
  56646. this.keyUsage = new _xfa_object.XFAObjectArray();
  56647. this.line = new _xfa_object.XFAObjectArray();
  56648. this.linear = new _xfa_object.XFAObjectArray();
  56649. this.lockDocument = new _xfa_object.XFAObjectArray();
  56650. this.manifest = new _xfa_object.XFAObjectArray();
  56651. this.margin = new _xfa_object.XFAObjectArray();
  56652. this.mdp = new _xfa_object.XFAObjectArray();
  56653. this.medium = new _xfa_object.XFAObjectArray();
  56654. this.message = new _xfa_object.XFAObjectArray();
  56655. this.numericEdit = new _xfa_object.XFAObjectArray();
  56656. this.occur = new _xfa_object.XFAObjectArray();
  56657. this.oid = new _xfa_object.XFAObjectArray();
  56658. this.oids = new _xfa_object.XFAObjectArray();
  56659. this.overflow = new _xfa_object.XFAObjectArray();
  56660. this.pageArea = new _xfa_object.XFAObjectArray();
  56661. this.pageSet = new _xfa_object.XFAObjectArray();
  56662. this.para = new _xfa_object.XFAObjectArray();
  56663. this.passwordEdit = new _xfa_object.XFAObjectArray();
  56664. this.pattern = new _xfa_object.XFAObjectArray();
  56665. this.picture = new _xfa_object.XFAObjectArray();
  56666. this.radial = new _xfa_object.XFAObjectArray();
  56667. this.reason = new _xfa_object.XFAObjectArray();
  56668. this.reasons = new _xfa_object.XFAObjectArray();
  56669. this.rectangle = new _xfa_object.XFAObjectArray();
  56670. this.ref = new _xfa_object.XFAObjectArray();
  56671. this.script = new _xfa_object.XFAObjectArray();
  56672. this.setProperty = new _xfa_object.XFAObjectArray();
  56673. this.signData = new _xfa_object.XFAObjectArray();
  56674. this.signature = new _xfa_object.XFAObjectArray();
  56675. this.signing = new _xfa_object.XFAObjectArray();
  56676. this.solid = new _xfa_object.XFAObjectArray();
  56677. this.speak = new _xfa_object.XFAObjectArray();
  56678. this.stipple = new _xfa_object.XFAObjectArray();
  56679. this.subform = new _xfa_object.XFAObjectArray();
  56680. this.subformSet = new _xfa_object.XFAObjectArray();
  56681. this.subjectDN = new _xfa_object.XFAObjectArray();
  56682. this.subjectDNs = new _xfa_object.XFAObjectArray();
  56683. this.submit = new _xfa_object.XFAObjectArray();
  56684. this.text = new _xfa_object.XFAObjectArray();
  56685. this.textEdit = new _xfa_object.XFAObjectArray();
  56686. this.time = new _xfa_object.XFAObjectArray();
  56687. this.timeStamp = new _xfa_object.XFAObjectArray();
  56688. this.toolTip = new _xfa_object.XFAObjectArray();
  56689. this.traversal = new _xfa_object.XFAObjectArray();
  56690. this.traverse = new _xfa_object.XFAObjectArray();
  56691. this.ui = new _xfa_object.XFAObjectArray();
  56692. this.validate = new _xfa_object.XFAObjectArray();
  56693. this.value = new _xfa_object.XFAObjectArray();
  56694. this.variables = new _xfa_object.XFAObjectArray();
  56695. }
  56696. }
  56697. class Radial extends _xfa_object.XFAObject {
  56698. constructor(attributes) {
  56699. super(TEMPLATE_NS_ID, "radial", true);
  56700. this.id = attributes.id || "";
  56701. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  56702. this.use = attributes.use || "";
  56703. this.usehref = attributes.usehref || "";
  56704. this.color = null;
  56705. this.extras = null;
  56706. }
  56707. [_xfa_object.$toStyle](startColor) {
  56708. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56709. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56710. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  56711. return `radial-gradient(circle at center, ${colors})`;
  56712. }
  56713. }
  56714. class Reason extends _xfa_object.StringObject {
  56715. constructor(attributes) {
  56716. super(TEMPLATE_NS_ID, "reason");
  56717. this.id = attributes.id || "";
  56718. this.name = attributes.name || "";
  56719. this.use = attributes.use || "";
  56720. this.usehref = attributes.usehref || "";
  56721. }
  56722. }
  56723. class Reasons extends _xfa_object.XFAObject {
  56724. constructor(attributes) {
  56725. super(TEMPLATE_NS_ID, "reasons", true);
  56726. this.id = attributes.id || "";
  56727. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56728. this.use = attributes.use || "";
  56729. this.usehref = attributes.usehref || "";
  56730. this.reason = new _xfa_object.XFAObjectArray();
  56731. }
  56732. }
  56733. class Rectangle extends _xfa_object.XFAObject {
  56734. constructor(attributes) {
  56735. super(TEMPLATE_NS_ID, "rectangle", true);
  56736. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56737. this.id = attributes.id || "";
  56738. this.use = attributes.use || "";
  56739. this.usehref = attributes.usehref || "";
  56740. this.corner = new _xfa_object.XFAObjectArray(4);
  56741. this.edge = new _xfa_object.XFAObjectArray(4);
  56742. this.fill = null;
  56743. }
  56744. [_xfa_object.$toHTML]() {
  56745. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  56746. const edgeStyle = edge[_xfa_object.$toStyle]();
  56747. const style = Object.create(null);
  56748. if (this.fill && this.fill.presence === "visible") {
  56749. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  56750. } else {
  56751. style.fill = "transparent";
  56752. }
  56753. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  56754. style.stroke = edgeStyle.color;
  56755. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  56756. const cornerStyle = corner[_xfa_object.$toStyle]();
  56757. const rect = {
  56758. name: "rect",
  56759. attributes: {
  56760. xmlns: SVG_NS,
  56761. width: "100%",
  56762. height: "100%",
  56763. x: 0,
  56764. y: 0,
  56765. rx: cornerStyle.radius,
  56766. ry: cornerStyle.radius,
  56767. style
  56768. }
  56769. };
  56770. const svg = {
  56771. name: "svg",
  56772. children: [rect],
  56773. attributes: {
  56774. xmlns: SVG_NS,
  56775. style: {
  56776. overflow: "visible"
  56777. },
  56778. width: "100%",
  56779. height: "100%"
  56780. }
  56781. };
  56782. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56783. if (hasMargin(parent)) {
  56784. return _utils.HTMLResult.success({
  56785. name: "div",
  56786. attributes: {
  56787. style: {
  56788. display: "inline",
  56789. width: "100%",
  56790. height: "100%"
  56791. }
  56792. },
  56793. children: [svg]
  56794. });
  56795. }
  56796. svg.attributes.style.position = "absolute";
  56797. return _utils.HTMLResult.success(svg);
  56798. }
  56799. }
  56800. class RefElement extends _xfa_object.StringObject {
  56801. constructor(attributes) {
  56802. super(TEMPLATE_NS_ID, "ref");
  56803. this.id = attributes.id || "";
  56804. this.use = attributes.use || "";
  56805. this.usehref = attributes.usehref || "";
  56806. }
  56807. }
  56808. class Script extends _xfa_object.StringObject {
  56809. constructor(attributes) {
  56810. super(TEMPLATE_NS_ID, "script");
  56811. this.binding = attributes.binding || "";
  56812. this.contentType = attributes.contentType || "";
  56813. this.id = attributes.id || "";
  56814. this.name = attributes.name || "";
  56815. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  56816. this.use = attributes.use || "";
  56817. this.usehref = attributes.usehref || "";
  56818. }
  56819. }
  56820. class SetProperty extends _xfa_object.XFAObject {
  56821. constructor(attributes) {
  56822. super(TEMPLATE_NS_ID, "setProperty");
  56823. this.connection = attributes.connection || "";
  56824. this.ref = attributes.ref || "";
  56825. this.target = attributes.target || "";
  56826. }
  56827. }
  56828. exports.SetProperty = SetProperty;
  56829. class SignData extends _xfa_object.XFAObject {
  56830. constructor(attributes) {
  56831. super(TEMPLATE_NS_ID, "signData", true);
  56832. this.id = attributes.id || "";
  56833. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  56834. this.ref = attributes.ref || "";
  56835. this.target = attributes.target || "";
  56836. this.use = attributes.use || "";
  56837. this.usehref = attributes.usehref || "";
  56838. this.filter = null;
  56839. this.manifest = null;
  56840. }
  56841. }
  56842. class Signature extends _xfa_object.XFAObject {
  56843. constructor(attributes) {
  56844. super(TEMPLATE_NS_ID, "signature", true);
  56845. this.id = attributes.id || "";
  56846. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  56847. this.use = attributes.use || "";
  56848. this.usehref = attributes.usehref || "";
  56849. this.border = null;
  56850. this.extras = null;
  56851. this.filter = null;
  56852. this.manifest = null;
  56853. this.margin = null;
  56854. }
  56855. }
  56856. class Signing extends _xfa_object.XFAObject {
  56857. constructor(attributes) {
  56858. super(TEMPLATE_NS_ID, "signing", true);
  56859. this.id = attributes.id || "";
  56860. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56861. this.use = attributes.use || "";
  56862. this.usehref = attributes.usehref || "";
  56863. this.certificate = new _xfa_object.XFAObjectArray();
  56864. }
  56865. }
  56866. class Solid extends _xfa_object.XFAObject {
  56867. constructor(attributes) {
  56868. super(TEMPLATE_NS_ID, "solid", true);
  56869. this.id = attributes.id || "";
  56870. this.use = attributes.use || "";
  56871. this.usehref = attributes.usehref || "";
  56872. this.extras = null;
  56873. }
  56874. [_xfa_object.$toStyle](startColor) {
  56875. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56876. }
  56877. }
  56878. class Speak extends _xfa_object.StringObject {
  56879. constructor(attributes) {
  56880. super(TEMPLATE_NS_ID, "speak");
  56881. this.disable = (0, _utils.getInteger)({
  56882. data: attributes.disable,
  56883. defaultValue: 0,
  56884. validate: x => x === 1
  56885. });
  56886. this.id = attributes.id || "";
  56887. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  56888. this.rid = attributes.rid || "";
  56889. this.use = attributes.use || "";
  56890. this.usehref = attributes.usehref || "";
  56891. }
  56892. }
  56893. class Stipple extends _xfa_object.XFAObject {
  56894. constructor(attributes) {
  56895. super(TEMPLATE_NS_ID, "stipple", true);
  56896. this.id = attributes.id || "";
  56897. this.rate = (0, _utils.getInteger)({
  56898. data: attributes.rate,
  56899. defaultValue: 50,
  56900. validate: x => x >= 0 && x <= 100
  56901. });
  56902. this.use = attributes.use || "";
  56903. this.usehref = attributes.usehref || "";
  56904. this.color = null;
  56905. this.extras = null;
  56906. }
  56907. [_xfa_object.$toStyle](bgColor) {
  56908. const alpha = this.rate / 100;
  56909. 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));
  56910. }
  56911. }
  56912. class Subform extends _xfa_object.XFAObject {
  56913. constructor(attributes) {
  56914. super(TEMPLATE_NS_ID, "subform", true);
  56915. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  56916. this.allowMacro = (0, _utils.getInteger)({
  56917. data: attributes.allowMacro,
  56918. defaultValue: 0,
  56919. validate: x => x === 1
  56920. });
  56921. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  56922. this.colSpan = (0, _utils.getInteger)({
  56923. data: attributes.colSpan,
  56924. defaultValue: 1,
  56925. validate: n => n >= 1 || n === -1
  56926. });
  56927. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  56928. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  56929. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56930. this.id = attributes.id || "";
  56931. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  56932. this.locale = attributes.locale || "";
  56933. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  56934. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  56935. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  56936. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  56937. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  56938. this.name = attributes.name || "";
  56939. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56940. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56941. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  56942. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  56943. this.use = attributes.use || "";
  56944. this.usehref = attributes.usehref || "";
  56945. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  56946. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56947. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56948. this.assist = null;
  56949. this.bind = null;
  56950. this.bookend = null;
  56951. this.border = null;
  56952. this.break = null;
  56953. this.calculate = null;
  56954. this.desc = null;
  56955. this.extras = null;
  56956. this.keep = null;
  56957. this.margin = null;
  56958. this.occur = null;
  56959. this.overflow = null;
  56960. this.pageSet = null;
  56961. this.para = null;
  56962. this.traversal = null;
  56963. this.validate = null;
  56964. this.variables = null;
  56965. this.area = new _xfa_object.XFAObjectArray();
  56966. this.breakAfter = new _xfa_object.XFAObjectArray();
  56967. this.breakBefore = new _xfa_object.XFAObjectArray();
  56968. this.connect = new _xfa_object.XFAObjectArray();
  56969. this.draw = new _xfa_object.XFAObjectArray();
  56970. this.event = new _xfa_object.XFAObjectArray();
  56971. this.exObject = new _xfa_object.XFAObjectArray();
  56972. this.exclGroup = new _xfa_object.XFAObjectArray();
  56973. this.field = new _xfa_object.XFAObjectArray();
  56974. this.proto = new _xfa_object.XFAObjectArray();
  56975. this.setProperty = new _xfa_object.XFAObjectArray();
  56976. this.subform = new _xfa_object.XFAObjectArray();
  56977. this.subformSet = new _xfa_object.XFAObjectArray();
  56978. }
  56979. [_xfa_object.$getSubformParent]() {
  56980. const parent = this[_xfa_object.$getParent]();
  56981. if (parent instanceof SubformSet) {
  56982. return parent[_xfa_object.$getSubformParent]();
  56983. }
  56984. return parent;
  56985. }
  56986. [_xfa_object.$isBindable]() {
  56987. return true;
  56988. }
  56989. [_xfa_object.$isThereMoreWidth]() {
  56990. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  56991. }
  56992. *[_xfa_object.$getContainedChildren]() {
  56993. yield* getContainedChildren(this);
  56994. }
  56995. [_xfa_object.$flushHTML]() {
  56996. return (0, _layout.flushHTML)(this);
  56997. }
  56998. [_xfa_object.$addHTML](html, bbox) {
  56999. (0, _layout.addHTML)(this, html, bbox);
  57000. }
  57001. [_xfa_object.$getAvailableSpace]() {
  57002. return (0, _layout.getAvailableSpace)(this);
  57003. }
  57004. [_xfa_object.$isSplittable]() {
  57005. const parent = this[_xfa_object.$getSubformParent]();
  57006. if (!parent[_xfa_object.$isSplittable]()) {
  57007. return false;
  57008. }
  57009. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  57010. return this[_xfa_object.$extra]._isSplittable;
  57011. }
  57012. if (this.layout === "position" || this.layout.includes("row")) {
  57013. this[_xfa_object.$extra]._isSplittable = false;
  57014. return false;
  57015. }
  57016. if (this.keep && this.keep.intact !== "none") {
  57017. this[_xfa_object.$extra]._isSplittable = false;
  57018. return false;
  57019. }
  57020. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  57021. return false;
  57022. }
  57023. this[_xfa_object.$extra]._isSplittable = true;
  57024. return true;
  57025. }
  57026. [_xfa_object.$toHTML](availableSpace) {
  57027. setTabIndex(this);
  57028. if (this.break) {
  57029. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  57030. const node = new BreakAfter({
  57031. targetType: this.break.after,
  57032. target: this.break.afterTarget,
  57033. startNew: this.break.startNew.toString()
  57034. });
  57035. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57036. this[_xfa_object.$appendChild](node);
  57037. this.breakAfter.push(node);
  57038. }
  57039. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  57040. const node = new BreakBefore({
  57041. targetType: this.break.before,
  57042. target: this.break.beforeTarget,
  57043. startNew: this.break.startNew.toString()
  57044. });
  57045. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57046. this[_xfa_object.$appendChild](node);
  57047. this.breakBefore.push(node);
  57048. }
  57049. if (this.break.overflowTarget !== "") {
  57050. const node = new Overflow({
  57051. target: this.break.overflowTarget,
  57052. leader: this.break.overflowLeader,
  57053. trailer: this.break.overflowTrailer
  57054. });
  57055. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57056. this[_xfa_object.$appendChild](node);
  57057. this.overflow.push(node);
  57058. }
  57059. this[_xfa_object.$removeChild](this.break);
  57060. this.break = null;
  57061. }
  57062. if (this.presence === "hidden" || this.presence === "inactive") {
  57063. return _utils.HTMLResult.EMPTY;
  57064. }
  57065. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  57066. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  57067. }
  57068. if (this.breakBefore.children.length >= 1) {
  57069. const breakBefore = this.breakBefore.children[0];
  57070. if (handleBreak(breakBefore)) {
  57071. return _utils.HTMLResult.breakNode(breakBefore);
  57072. }
  57073. }
  57074. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  57075. return _utils.HTMLResult.EMPTY;
  57076. }
  57077. (0, _html_utils.fixDimensions)(this);
  57078. const children = [];
  57079. const attributes = {
  57080. id: this[_xfa_object.$uid],
  57081. class: []
  57082. };
  57083. (0, _html_utils.setAccess)(this, attributes.class);
  57084. if (!this[_xfa_object.$extra]) {
  57085. this[_xfa_object.$extra] = Object.create(null);
  57086. }
  57087. Object.assign(this[_xfa_object.$extra], {
  57088. children,
  57089. line: null,
  57090. attributes,
  57091. attempt: 0,
  57092. numberInLine: 0,
  57093. availableSpace: {
  57094. width: Math.min(this.w || Infinity, availableSpace.width),
  57095. height: Math.min(this.h || Infinity, availableSpace.height)
  57096. },
  57097. width: 0,
  57098. height: 0,
  57099. prevHeight: 0,
  57100. currentWidth: 0
  57101. });
  57102. const root = this[_xfa_object.$getTemplateRoot]();
  57103. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  57104. const isSplittable = this[_xfa_object.$isSplittable]();
  57105. if (!isSplittable) {
  57106. setFirstUnsplittable(this);
  57107. }
  57108. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57109. return _utils.HTMLResult.FAILURE;
  57110. }
  57111. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  57112. if (this.layout.includes("row")) {
  57113. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  57114. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  57115. this[_xfa_object.$extra].columnWidths = columnWidths;
  57116. this[_xfa_object.$extra].currentColumn = 0;
  57117. }
  57118. }
  57119. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  57120. const classNames = ["xfaSubform"];
  57121. const cl = (0, _html_utils.layoutClass)(this);
  57122. if (cl) {
  57123. classNames.push(cl);
  57124. }
  57125. attributes.style = style;
  57126. attributes.class = classNames;
  57127. if (this.name) {
  57128. attributes.xfaName = this.name;
  57129. }
  57130. if (this.overflow) {
  57131. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57132. if (overflowExtra.addLeader) {
  57133. overflowExtra.addLeader = false;
  57134. handleOverflow(this, overflowExtra.leader, availableSpace);
  57135. }
  57136. }
  57137. this[_xfa_object.$pushPara]();
  57138. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57139. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57140. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57141. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57142. this[_xfa_object.$extra].numberInLine = 0;
  57143. }
  57144. const result = this[_xfa_object.$childrenToHTML]({
  57145. filter,
  57146. include: true
  57147. });
  57148. if (result.success) {
  57149. break;
  57150. }
  57151. if (result.isBreak()) {
  57152. this[_xfa_object.$popPara]();
  57153. return result;
  57154. }
  57155. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57156. this[_xfa_object.$extra].attempt = maxRun;
  57157. break;
  57158. }
  57159. }
  57160. this[_xfa_object.$popPara]();
  57161. if (!isSplittable) {
  57162. unsetFirstUnsplittable(this);
  57163. }
  57164. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57165. if (this[_xfa_object.$extra].attempt === maxRun) {
  57166. if (this.overflow) {
  57167. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57168. }
  57169. if (!isSplittable) {
  57170. delete this[_xfa_object.$extra];
  57171. }
  57172. return _utils.HTMLResult.FAILURE;
  57173. }
  57174. if (this.overflow) {
  57175. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57176. if (overflowExtra.addTrailer) {
  57177. overflowExtra.addTrailer = false;
  57178. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57179. }
  57180. }
  57181. let marginH = 0;
  57182. let marginV = 0;
  57183. if (this.margin) {
  57184. marginH = this.margin.leftInset + this.margin.rightInset;
  57185. marginV = this.margin.topInset + this.margin.bottomInset;
  57186. }
  57187. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57188. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57189. const bbox = [this.x, this.y, width, height];
  57190. if (this.w === "") {
  57191. style.width = (0, _html_utils.measureToString)(width);
  57192. }
  57193. if (this.h === "") {
  57194. style.height = (0, _html_utils.measureToString)(height);
  57195. }
  57196. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57197. return _utils.HTMLResult.EMPTY;
  57198. }
  57199. const html = {
  57200. name: "div",
  57201. attributes,
  57202. children
  57203. };
  57204. applyAssist(this, attributes);
  57205. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57206. if (this.breakAfter.children.length >= 1) {
  57207. const breakAfter = this.breakAfter.children[0];
  57208. if (handleBreak(breakAfter)) {
  57209. this[_xfa_object.$extra].afterBreakAfter = result;
  57210. return _utils.HTMLResult.breakNode(breakAfter);
  57211. }
  57212. }
  57213. delete this[_xfa_object.$extra];
  57214. return result;
  57215. }
  57216. }
  57217. class SubformSet extends _xfa_object.XFAObject {
  57218. constructor(attributes) {
  57219. super(TEMPLATE_NS_ID, "subformSet", true);
  57220. this.id = attributes.id || "";
  57221. this.name = attributes.name || "";
  57222. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57223. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57224. this.use = attributes.use || "";
  57225. this.usehref = attributes.usehref || "";
  57226. this.bookend = null;
  57227. this.break = null;
  57228. this.desc = null;
  57229. this.extras = null;
  57230. this.occur = null;
  57231. this.overflow = null;
  57232. this.breakAfter = new _xfa_object.XFAObjectArray();
  57233. this.breakBefore = new _xfa_object.XFAObjectArray();
  57234. this.subform = new _xfa_object.XFAObjectArray();
  57235. this.subformSet = new _xfa_object.XFAObjectArray();
  57236. }
  57237. *[_xfa_object.$getContainedChildren]() {
  57238. yield* getContainedChildren(this);
  57239. }
  57240. [_xfa_object.$getSubformParent]() {
  57241. let parent = this[_xfa_object.$getParent]();
  57242. while (!(parent instanceof Subform)) {
  57243. parent = parent[_xfa_object.$getParent]();
  57244. }
  57245. return parent;
  57246. }
  57247. [_xfa_object.$isBindable]() {
  57248. return true;
  57249. }
  57250. }
  57251. class SubjectDN extends _xfa_object.ContentObject {
  57252. constructor(attributes) {
  57253. super(TEMPLATE_NS_ID, "subjectDN");
  57254. this.delimiter = attributes.delimiter || ",";
  57255. this.id = attributes.id || "";
  57256. this.name = attributes.name || "";
  57257. this.use = attributes.use || "";
  57258. this.usehref = attributes.usehref || "";
  57259. }
  57260. [_xfa_object.$finalize]() {
  57261. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57262. kv = kv.split("=", 2);
  57263. kv[0] = kv[0].trim();
  57264. return kv;
  57265. }));
  57266. }
  57267. }
  57268. class SubjectDNs extends _xfa_object.XFAObject {
  57269. constructor(attributes) {
  57270. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57271. this.id = attributes.id || "";
  57272. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57273. this.use = attributes.use || "";
  57274. this.usehref = attributes.usehref || "";
  57275. this.subjectDN = new _xfa_object.XFAObjectArray();
  57276. }
  57277. }
  57278. class Submit extends _xfa_object.XFAObject {
  57279. constructor(attributes) {
  57280. super(TEMPLATE_NS_ID, "submit", true);
  57281. this.embedPDF = (0, _utils.getInteger)({
  57282. data: attributes.embedPDF,
  57283. defaultValue: 0,
  57284. validate: x => x === 1
  57285. });
  57286. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57287. this.id = attributes.id || "";
  57288. this.target = attributes.target || "";
  57289. this.textEncoding = (0, _utils.getKeyword)({
  57290. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57291. defaultValue: "",
  57292. 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}/)
  57293. });
  57294. this.use = attributes.use || "";
  57295. this.usehref = attributes.usehref || "";
  57296. this.xdpContent = attributes.xdpContent || "";
  57297. this.encrypt = null;
  57298. this.encryptData = new _xfa_object.XFAObjectArray();
  57299. this.signData = new _xfa_object.XFAObjectArray();
  57300. }
  57301. }
  57302. class Template extends _xfa_object.XFAObject {
  57303. constructor(attributes) {
  57304. super(TEMPLATE_NS_ID, "template", true);
  57305. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57306. this.extras = null;
  57307. this.subform = new _xfa_object.XFAObjectArray();
  57308. }
  57309. [_xfa_object.$finalize]() {
  57310. if (this.subform.children.length === 0) {
  57311. (0, _util.warn)("XFA - No subforms in template node.");
  57312. }
  57313. if (this.subform.children.length >= 2) {
  57314. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57315. }
  57316. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57317. }
  57318. [_xfa_object.$isSplittable]() {
  57319. return true;
  57320. }
  57321. [_xfa_object.$searchNode](expr, container) {
  57322. if (expr.startsWith("#")) {
  57323. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57324. }
  57325. return (0, _som.searchNode)(this, container, expr, true, true);
  57326. }
  57327. *[_xfa_object.$toPages]() {
  57328. if (!this.subform.children.length) {
  57329. return _utils.HTMLResult.success({
  57330. name: "div",
  57331. children: []
  57332. });
  57333. }
  57334. this[_xfa_object.$extra] = {
  57335. overflowNode: null,
  57336. firstUnsplittable: null,
  57337. currentContentArea: null,
  57338. currentPageArea: null,
  57339. noLayoutFailure: false,
  57340. pageNumber: 1,
  57341. pagePosition: "first",
  57342. oddOrEven: "odd",
  57343. blankOrNotBlank: "nonBlank",
  57344. paraStack: []
  57345. };
  57346. const root = this.subform.children[0];
  57347. root.pageSet[_xfa_object.$cleanPage]();
  57348. const pageAreas = root.pageSet.pageArea.children;
  57349. const mainHtml = {
  57350. name: "div",
  57351. children: []
  57352. };
  57353. let pageArea = null;
  57354. let breakBefore = null;
  57355. let breakBeforeTarget = null;
  57356. if (root.breakBefore.children.length >= 1) {
  57357. breakBefore = root.breakBefore.children[0];
  57358. breakBeforeTarget = breakBefore.target;
  57359. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57360. breakBefore = root.subform.children[0].breakBefore.children[0];
  57361. breakBeforeTarget = breakBefore.target;
  57362. } else if (root.break && root.break.beforeTarget) {
  57363. breakBefore = root.break;
  57364. breakBeforeTarget = breakBefore.beforeTarget;
  57365. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57366. breakBefore = root.subform.children[0].break;
  57367. breakBeforeTarget = breakBefore.beforeTarget;
  57368. }
  57369. if (breakBefore) {
  57370. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57371. if (target instanceof PageArea) {
  57372. pageArea = target;
  57373. breakBefore[_xfa_object.$extra] = {};
  57374. }
  57375. }
  57376. if (!pageArea) {
  57377. pageArea = pageAreas[0];
  57378. }
  57379. pageArea[_xfa_object.$extra] = {
  57380. numberOfUse: 1
  57381. };
  57382. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57383. pageAreaParent[_xfa_object.$extra] = {
  57384. numberOfUse: 1,
  57385. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57386. pageSetIndex: 0
  57387. };
  57388. let targetPageArea;
  57389. let leader = null;
  57390. let trailer = null;
  57391. let hasSomething = true;
  57392. let hasSomethingCounter = 0;
  57393. let startIndex = 0;
  57394. while (true) {
  57395. if (!hasSomething) {
  57396. mainHtml.children.pop();
  57397. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57398. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57399. return mainHtml;
  57400. }
  57401. } else {
  57402. hasSomethingCounter = 0;
  57403. }
  57404. targetPageArea = null;
  57405. this[_xfa_object.$extra].currentPageArea = pageArea;
  57406. const page = pageArea[_xfa_object.$toHTML]().html;
  57407. mainHtml.children.push(page);
  57408. if (leader) {
  57409. this[_xfa_object.$extra].noLayoutFailure = true;
  57410. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57411. leader = null;
  57412. }
  57413. if (trailer) {
  57414. this[_xfa_object.$extra].noLayoutFailure = true;
  57415. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57416. trailer = null;
  57417. }
  57418. const contentAreas = pageArea.contentArea.children;
  57419. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57420. hasSomething = false;
  57421. this[_xfa_object.$extra].firstUnsplittable = null;
  57422. this[_xfa_object.$extra].noLayoutFailure = false;
  57423. const flush = index => {
  57424. const html = root[_xfa_object.$flushHTML]();
  57425. if (html) {
  57426. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57427. htmlContentAreas[index].children.push(html);
  57428. }
  57429. };
  57430. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57431. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57432. const space = {
  57433. width: contentArea.w,
  57434. height: contentArea.h
  57435. };
  57436. startIndex = 0;
  57437. if (leader) {
  57438. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57439. leader = null;
  57440. }
  57441. if (trailer) {
  57442. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57443. trailer = null;
  57444. }
  57445. const html = root[_xfa_object.$toHTML](space);
  57446. if (html.success) {
  57447. if (html.html) {
  57448. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57449. htmlContentAreas[i].children.push(html.html);
  57450. } else if (!hasSomething && mainHtml.children.length > 1) {
  57451. mainHtml.children.pop();
  57452. }
  57453. return mainHtml;
  57454. }
  57455. if (html.isBreak()) {
  57456. const node = html.breakNode;
  57457. flush(i);
  57458. if (node.targetType === "auto") {
  57459. continue;
  57460. }
  57461. if (node.leader) {
  57462. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57463. leader = leader ? leader[0] : null;
  57464. }
  57465. if (node.trailer) {
  57466. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57467. trailer = trailer ? trailer[0] : null;
  57468. }
  57469. if (node.targetType === "pageArea") {
  57470. targetPageArea = node[_xfa_object.$extra].target;
  57471. i = Infinity;
  57472. } else if (!node[_xfa_object.$extra].target) {
  57473. i = node[_xfa_object.$extra].index;
  57474. } else {
  57475. targetPageArea = node[_xfa_object.$extra].target;
  57476. startIndex = node[_xfa_object.$extra].index + 1;
  57477. i = Infinity;
  57478. }
  57479. continue;
  57480. }
  57481. if (this[_xfa_object.$extra].overflowNode) {
  57482. const node = this[_xfa_object.$extra].overflowNode;
  57483. this[_xfa_object.$extra].overflowNode = null;
  57484. const overflowExtra = node[_xfa_object.$getExtra]();
  57485. const target = overflowExtra.target;
  57486. overflowExtra.addLeader = overflowExtra.leader !== null;
  57487. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57488. flush(i);
  57489. const currentIndex = i;
  57490. i = Infinity;
  57491. if (target instanceof PageArea) {
  57492. targetPageArea = target;
  57493. } else if (target instanceof ContentArea) {
  57494. const index = contentAreas.indexOf(target);
  57495. if (index !== -1) {
  57496. if (index > currentIndex) {
  57497. i = index - 1;
  57498. } else {
  57499. startIndex = index;
  57500. }
  57501. } else {
  57502. targetPageArea = target[_xfa_object.$getParent]();
  57503. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57504. }
  57505. }
  57506. continue;
  57507. }
  57508. flush(i);
  57509. }
  57510. this[_xfa_object.$extra].pageNumber += 1;
  57511. if (targetPageArea) {
  57512. if (targetPageArea[_xfa_object.$isUsable]()) {
  57513. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57514. } else {
  57515. targetPageArea = null;
  57516. }
  57517. }
  57518. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57519. yield null;
  57520. }
  57521. }
  57522. }
  57523. exports.Template = Template;
  57524. class Text extends _xfa_object.ContentObject {
  57525. constructor(attributes) {
  57526. super(TEMPLATE_NS_ID, "text");
  57527. this.id = attributes.id || "";
  57528. this.maxChars = (0, _utils.getInteger)({
  57529. data: attributes.maxChars,
  57530. defaultValue: 0,
  57531. validate: x => x >= 0
  57532. });
  57533. this.name = attributes.name || "";
  57534. this.rid = attributes.rid || "";
  57535. this.use = attributes.use || "";
  57536. this.usehref = attributes.usehref || "";
  57537. }
  57538. [_xfa_object.$acceptWhitespace]() {
  57539. return true;
  57540. }
  57541. [_xfa_object.$onChild](child) {
  57542. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57543. this[_xfa_object.$content] = child;
  57544. return true;
  57545. }
  57546. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57547. return false;
  57548. }
  57549. [_xfa_object.$onText](str) {
  57550. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57551. return;
  57552. }
  57553. super[_xfa_object.$onText](str);
  57554. }
  57555. [_xfa_object.$finalize]() {
  57556. if (typeof this[_xfa_object.$content] === "string") {
  57557. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57558. }
  57559. }
  57560. [_xfa_object.$getExtra]() {
  57561. if (typeof this[_xfa_object.$content] === "string") {
  57562. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57563. if (line) {
  57564. acc.push(line);
  57565. }
  57566. return acc;
  57567. }, []).join("\n");
  57568. }
  57569. return this[_xfa_object.$content][_xfa_object.$text]();
  57570. }
  57571. [_xfa_object.$toHTML](availableSpace) {
  57572. if (typeof this[_xfa_object.$content] === "string") {
  57573. const html = valueToHtml(this[_xfa_object.$content]).html;
  57574. if (this[_xfa_object.$content].includes("\u2029")) {
  57575. html.name = "div";
  57576. html.children = [];
  57577. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  57578. acc.push({
  57579. name: "span",
  57580. value: line
  57581. }, {
  57582. name: "br"
  57583. });
  57584. return acc;
  57585. }, [])).forEach(lines => {
  57586. html.children.push({
  57587. name: "p",
  57588. children: lines
  57589. });
  57590. });
  57591. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  57592. html.name = "div";
  57593. html.children = [];
  57594. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  57595. html.children.push({
  57596. name: "span",
  57597. value: line
  57598. }, {
  57599. name: "br"
  57600. });
  57601. });
  57602. }
  57603. return _utils.HTMLResult.success(html);
  57604. }
  57605. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  57606. }
  57607. }
  57608. exports.Text = Text;
  57609. class TextEdit extends _xfa_object.XFAObject {
  57610. constructor(attributes) {
  57611. super(TEMPLATE_NS_ID, "textEdit", true);
  57612. this.allowRichText = (0, _utils.getInteger)({
  57613. data: attributes.allowRichText,
  57614. defaultValue: 0,
  57615. validate: x => x === 1
  57616. });
  57617. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  57618. this.id = attributes.id || "";
  57619. this.multiLine = (0, _utils.getInteger)({
  57620. data: attributes.multiLine,
  57621. defaultValue: "",
  57622. validate: x => x === 0 || x === 1
  57623. });
  57624. this.use = attributes.use || "";
  57625. this.usehref = attributes.usehref || "";
  57626. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  57627. this.border = null;
  57628. this.comb = null;
  57629. this.extras = null;
  57630. this.margin = null;
  57631. }
  57632. [_xfa_object.$toHTML](availableSpace) {
  57633. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  57634. let html;
  57635. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57636. if (this.multiLine === "") {
  57637. this.multiLine = field instanceof Draw ? 1 : 0;
  57638. }
  57639. if (this.multiLine === 1) {
  57640. html = {
  57641. name: "textarea",
  57642. attributes: {
  57643. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57644. fieldId: field[_xfa_object.$uid],
  57645. class: ["xfaTextfield"],
  57646. style,
  57647. "aria-label": ariaLabel(field),
  57648. "aria-required": false
  57649. }
  57650. };
  57651. } else {
  57652. html = {
  57653. name: "input",
  57654. attributes: {
  57655. type: "text",
  57656. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57657. fieldId: field[_xfa_object.$uid],
  57658. class: ["xfaTextfield"],
  57659. style,
  57660. "aria-label": ariaLabel(field),
  57661. "aria-required": false
  57662. }
  57663. };
  57664. }
  57665. if (isRequired(field)) {
  57666. html.attributes["aria-required"] = true;
  57667. html.attributes.required = true;
  57668. }
  57669. return _utils.HTMLResult.success({
  57670. name: "label",
  57671. attributes: {
  57672. class: ["xfaLabel"]
  57673. },
  57674. children: [html]
  57675. });
  57676. }
  57677. }
  57678. class Time extends _xfa_object.StringObject {
  57679. constructor(attributes) {
  57680. super(TEMPLATE_NS_ID, "time");
  57681. this.id = attributes.id || "";
  57682. this.name = attributes.name || "";
  57683. this.use = attributes.use || "";
  57684. this.usehref = attributes.usehref || "";
  57685. }
  57686. [_xfa_object.$finalize]() {
  57687. const date = this[_xfa_object.$content].trim();
  57688. this[_xfa_object.$content] = date ? new Date(date) : null;
  57689. }
  57690. [_xfa_object.$toHTML](availableSpace) {
  57691. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57692. }
  57693. }
  57694. class TimeStamp extends _xfa_object.XFAObject {
  57695. constructor(attributes) {
  57696. super(TEMPLATE_NS_ID, "timeStamp");
  57697. this.id = attributes.id || "";
  57698. this.server = attributes.server || "";
  57699. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57700. this.use = attributes.use || "";
  57701. this.usehref = attributes.usehref || "";
  57702. }
  57703. }
  57704. class ToolTip extends _xfa_object.StringObject {
  57705. constructor(attributes) {
  57706. super(TEMPLATE_NS_ID, "toolTip");
  57707. this.id = attributes.id || "";
  57708. this.rid = attributes.rid || "";
  57709. this.use = attributes.use || "";
  57710. this.usehref = attributes.usehref || "";
  57711. }
  57712. }
  57713. class Traversal extends _xfa_object.XFAObject {
  57714. constructor(attributes) {
  57715. super(TEMPLATE_NS_ID, "traversal", true);
  57716. this.id = attributes.id || "";
  57717. this.use = attributes.use || "";
  57718. this.usehref = attributes.usehref || "";
  57719. this.extras = null;
  57720. this.traverse = new _xfa_object.XFAObjectArray();
  57721. }
  57722. }
  57723. class Traverse extends _xfa_object.XFAObject {
  57724. constructor(attributes) {
  57725. super(TEMPLATE_NS_ID, "traverse", true);
  57726. this.id = attributes.id || "";
  57727. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  57728. this.ref = attributes.ref || "";
  57729. this.use = attributes.use || "";
  57730. this.usehref = attributes.usehref || "";
  57731. this.extras = null;
  57732. this.script = null;
  57733. }
  57734. get name() {
  57735. return this.operation;
  57736. }
  57737. [_xfa_object.$isTransparent]() {
  57738. return false;
  57739. }
  57740. }
  57741. class Ui extends _xfa_object.XFAObject {
  57742. constructor(attributes) {
  57743. super(TEMPLATE_NS_ID, "ui", true);
  57744. this.id = attributes.id || "";
  57745. this.use = attributes.use || "";
  57746. this.usehref = attributes.usehref || "";
  57747. this.extras = null;
  57748. this.picture = null;
  57749. this.barcode = null;
  57750. this.button = null;
  57751. this.checkButton = null;
  57752. this.choiceList = null;
  57753. this.dateTimeEdit = null;
  57754. this.defaultUi = null;
  57755. this.imageEdit = null;
  57756. this.numericEdit = null;
  57757. this.passwordEdit = null;
  57758. this.signature = null;
  57759. this.textEdit = null;
  57760. }
  57761. [_xfa_object.$getExtra]() {
  57762. if (this[_xfa_object.$extra] === undefined) {
  57763. for (const name of Object.getOwnPropertyNames(this)) {
  57764. if (name === "extras" || name === "picture") {
  57765. continue;
  57766. }
  57767. const obj = this[name];
  57768. if (!(obj instanceof _xfa_object.XFAObject)) {
  57769. continue;
  57770. }
  57771. this[_xfa_object.$extra] = obj;
  57772. return obj;
  57773. }
  57774. this[_xfa_object.$extra] = null;
  57775. }
  57776. return this[_xfa_object.$extra];
  57777. }
  57778. [_xfa_object.$toHTML](availableSpace) {
  57779. const obj = this[_xfa_object.$getExtra]();
  57780. if (obj) {
  57781. return obj[_xfa_object.$toHTML](availableSpace);
  57782. }
  57783. return _utils.HTMLResult.EMPTY;
  57784. }
  57785. }
  57786. class Validate extends _xfa_object.XFAObject {
  57787. constructor(attributes) {
  57788. super(TEMPLATE_NS_ID, "validate", true);
  57789. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  57790. this.id = attributes.id || "";
  57791. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  57792. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  57793. this.use = attributes.use || "";
  57794. this.usehref = attributes.usehref || "";
  57795. this.extras = null;
  57796. this.message = null;
  57797. this.picture = null;
  57798. this.script = null;
  57799. }
  57800. }
  57801. class Value extends _xfa_object.XFAObject {
  57802. constructor(attributes) {
  57803. super(TEMPLATE_NS_ID, "value", true);
  57804. this.id = attributes.id || "";
  57805. this.override = (0, _utils.getInteger)({
  57806. data: attributes.override,
  57807. defaultValue: 0,
  57808. validate: x => x === 1
  57809. });
  57810. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57811. this.use = attributes.use || "";
  57812. this.usehref = attributes.usehref || "";
  57813. this.arc = null;
  57814. this.boolean = null;
  57815. this.date = null;
  57816. this.dateTime = null;
  57817. this.decimal = null;
  57818. this.exData = null;
  57819. this.float = null;
  57820. this.image = null;
  57821. this.integer = null;
  57822. this.line = null;
  57823. this.rectangle = null;
  57824. this.text = null;
  57825. this.time = null;
  57826. }
  57827. [_xfa_object.$setValue](value) {
  57828. const parent = this[_xfa_object.$getParent]();
  57829. if (parent instanceof Field) {
  57830. if (parent.ui && parent.ui.imageEdit) {
  57831. if (!this.image) {
  57832. this.image = new Image({});
  57833. this[_xfa_object.$appendChild](this.image);
  57834. }
  57835. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  57836. return;
  57837. }
  57838. }
  57839. const valueName = value[_xfa_object.$nodeName];
  57840. if (this[valueName] !== null) {
  57841. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  57842. return;
  57843. }
  57844. for (const name of Object.getOwnPropertyNames(this)) {
  57845. const obj = this[name];
  57846. if (obj instanceof _xfa_object.XFAObject) {
  57847. this[name] = null;
  57848. this[_xfa_object.$removeChild](obj);
  57849. }
  57850. }
  57851. this[value[_xfa_object.$nodeName]] = value;
  57852. this[_xfa_object.$appendChild](value);
  57853. }
  57854. [_xfa_object.$text]() {
  57855. if (this.exData) {
  57856. if (typeof this.exData[_xfa_object.$content] === "string") {
  57857. return this.exData[_xfa_object.$content].trim();
  57858. }
  57859. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  57860. }
  57861. for (const name of Object.getOwnPropertyNames(this)) {
  57862. if (name === "image") {
  57863. continue;
  57864. }
  57865. const obj = this[name];
  57866. if (obj instanceof _xfa_object.XFAObject) {
  57867. return (obj[_xfa_object.$content] || "").toString().trim();
  57868. }
  57869. }
  57870. return null;
  57871. }
  57872. [_xfa_object.$toHTML](availableSpace) {
  57873. for (const name of Object.getOwnPropertyNames(this)) {
  57874. const obj = this[name];
  57875. if (!(obj instanceof _xfa_object.XFAObject)) {
  57876. continue;
  57877. }
  57878. return obj[_xfa_object.$toHTML](availableSpace);
  57879. }
  57880. return _utils.HTMLResult.EMPTY;
  57881. }
  57882. }
  57883. exports.Value = Value;
  57884. class Variables extends _xfa_object.XFAObject {
  57885. constructor(attributes) {
  57886. super(TEMPLATE_NS_ID, "variables", true);
  57887. this.id = attributes.id || "";
  57888. this.use = attributes.use || "";
  57889. this.usehref = attributes.usehref || "";
  57890. this.boolean = new _xfa_object.XFAObjectArray();
  57891. this.date = new _xfa_object.XFAObjectArray();
  57892. this.dateTime = new _xfa_object.XFAObjectArray();
  57893. this.decimal = new _xfa_object.XFAObjectArray();
  57894. this.exData = new _xfa_object.XFAObjectArray();
  57895. this.float = new _xfa_object.XFAObjectArray();
  57896. this.image = new _xfa_object.XFAObjectArray();
  57897. this.integer = new _xfa_object.XFAObjectArray();
  57898. this.manifest = new _xfa_object.XFAObjectArray();
  57899. this.script = new _xfa_object.XFAObjectArray();
  57900. this.text = new _xfa_object.XFAObjectArray();
  57901. this.time = new _xfa_object.XFAObjectArray();
  57902. }
  57903. [_xfa_object.$isTransparent]() {
  57904. return true;
  57905. }
  57906. }
  57907. class TemplateNamespace {
  57908. static [_namespaces.$buildXFAObject](name, attributes) {
  57909. if (TemplateNamespace.hasOwnProperty(name)) {
  57910. const node = TemplateNamespace[name](attributes);
  57911. node[_xfa_object.$setSetAttributes](attributes);
  57912. return node;
  57913. }
  57914. return undefined;
  57915. }
  57916. static appearanceFilter(attrs) {
  57917. return new AppearanceFilter(attrs);
  57918. }
  57919. static arc(attrs) {
  57920. return new Arc(attrs);
  57921. }
  57922. static area(attrs) {
  57923. return new Area(attrs);
  57924. }
  57925. static assist(attrs) {
  57926. return new Assist(attrs);
  57927. }
  57928. static barcode(attrs) {
  57929. return new Barcode(attrs);
  57930. }
  57931. static bind(attrs) {
  57932. return new Bind(attrs);
  57933. }
  57934. static bindItems(attrs) {
  57935. return new BindItems(attrs);
  57936. }
  57937. static bookend(attrs) {
  57938. return new Bookend(attrs);
  57939. }
  57940. static boolean(attrs) {
  57941. return new BooleanElement(attrs);
  57942. }
  57943. static border(attrs) {
  57944. return new Border(attrs);
  57945. }
  57946. static break(attrs) {
  57947. return new Break(attrs);
  57948. }
  57949. static breakAfter(attrs) {
  57950. return new BreakAfter(attrs);
  57951. }
  57952. static breakBefore(attrs) {
  57953. return new BreakBefore(attrs);
  57954. }
  57955. static button(attrs) {
  57956. return new Button(attrs);
  57957. }
  57958. static calculate(attrs) {
  57959. return new Calculate(attrs);
  57960. }
  57961. static caption(attrs) {
  57962. return new Caption(attrs);
  57963. }
  57964. static certificate(attrs) {
  57965. return new Certificate(attrs);
  57966. }
  57967. static certificates(attrs) {
  57968. return new Certificates(attrs);
  57969. }
  57970. static checkButton(attrs) {
  57971. return new CheckButton(attrs);
  57972. }
  57973. static choiceList(attrs) {
  57974. return new ChoiceList(attrs);
  57975. }
  57976. static color(attrs) {
  57977. return new Color(attrs);
  57978. }
  57979. static comb(attrs) {
  57980. return new Comb(attrs);
  57981. }
  57982. static connect(attrs) {
  57983. return new Connect(attrs);
  57984. }
  57985. static contentArea(attrs) {
  57986. return new ContentArea(attrs);
  57987. }
  57988. static corner(attrs) {
  57989. return new Corner(attrs);
  57990. }
  57991. static date(attrs) {
  57992. return new DateElement(attrs);
  57993. }
  57994. static dateTime(attrs) {
  57995. return new DateTime(attrs);
  57996. }
  57997. static dateTimeEdit(attrs) {
  57998. return new DateTimeEdit(attrs);
  57999. }
  58000. static decimal(attrs) {
  58001. return new Decimal(attrs);
  58002. }
  58003. static defaultUi(attrs) {
  58004. return new DefaultUi(attrs);
  58005. }
  58006. static desc(attrs) {
  58007. return new Desc(attrs);
  58008. }
  58009. static digestMethod(attrs) {
  58010. return new DigestMethod(attrs);
  58011. }
  58012. static digestMethods(attrs) {
  58013. return new DigestMethods(attrs);
  58014. }
  58015. static draw(attrs) {
  58016. return new Draw(attrs);
  58017. }
  58018. static edge(attrs) {
  58019. return new Edge(attrs);
  58020. }
  58021. static encoding(attrs) {
  58022. return new Encoding(attrs);
  58023. }
  58024. static encodings(attrs) {
  58025. return new Encodings(attrs);
  58026. }
  58027. static encrypt(attrs) {
  58028. return new Encrypt(attrs);
  58029. }
  58030. static encryptData(attrs) {
  58031. return new EncryptData(attrs);
  58032. }
  58033. static encryption(attrs) {
  58034. return new Encryption(attrs);
  58035. }
  58036. static encryptionMethod(attrs) {
  58037. return new EncryptionMethod(attrs);
  58038. }
  58039. static encryptionMethods(attrs) {
  58040. return new EncryptionMethods(attrs);
  58041. }
  58042. static event(attrs) {
  58043. return new Event(attrs);
  58044. }
  58045. static exData(attrs) {
  58046. return new ExData(attrs);
  58047. }
  58048. static exObject(attrs) {
  58049. return new ExObject(attrs);
  58050. }
  58051. static exclGroup(attrs) {
  58052. return new ExclGroup(attrs);
  58053. }
  58054. static execute(attrs) {
  58055. return new Execute(attrs);
  58056. }
  58057. static extras(attrs) {
  58058. return new Extras(attrs);
  58059. }
  58060. static field(attrs) {
  58061. return new Field(attrs);
  58062. }
  58063. static fill(attrs) {
  58064. return new Fill(attrs);
  58065. }
  58066. static filter(attrs) {
  58067. return new Filter(attrs);
  58068. }
  58069. static float(attrs) {
  58070. return new Float(attrs);
  58071. }
  58072. static font(attrs) {
  58073. return new Font(attrs);
  58074. }
  58075. static format(attrs) {
  58076. return new Format(attrs);
  58077. }
  58078. static handler(attrs) {
  58079. return new Handler(attrs);
  58080. }
  58081. static hyphenation(attrs) {
  58082. return new Hyphenation(attrs);
  58083. }
  58084. static image(attrs) {
  58085. return new Image(attrs);
  58086. }
  58087. static imageEdit(attrs) {
  58088. return new ImageEdit(attrs);
  58089. }
  58090. static integer(attrs) {
  58091. return new Integer(attrs);
  58092. }
  58093. static issuers(attrs) {
  58094. return new Issuers(attrs);
  58095. }
  58096. static items(attrs) {
  58097. return new Items(attrs);
  58098. }
  58099. static keep(attrs) {
  58100. return new Keep(attrs);
  58101. }
  58102. static keyUsage(attrs) {
  58103. return new KeyUsage(attrs);
  58104. }
  58105. static line(attrs) {
  58106. return new Line(attrs);
  58107. }
  58108. static linear(attrs) {
  58109. return new Linear(attrs);
  58110. }
  58111. static lockDocument(attrs) {
  58112. return new LockDocument(attrs);
  58113. }
  58114. static manifest(attrs) {
  58115. return new Manifest(attrs);
  58116. }
  58117. static margin(attrs) {
  58118. return new Margin(attrs);
  58119. }
  58120. static mdp(attrs) {
  58121. return new Mdp(attrs);
  58122. }
  58123. static medium(attrs) {
  58124. return new Medium(attrs);
  58125. }
  58126. static message(attrs) {
  58127. return new Message(attrs);
  58128. }
  58129. static numericEdit(attrs) {
  58130. return new NumericEdit(attrs);
  58131. }
  58132. static occur(attrs) {
  58133. return new Occur(attrs);
  58134. }
  58135. static oid(attrs) {
  58136. return new Oid(attrs);
  58137. }
  58138. static oids(attrs) {
  58139. return new Oids(attrs);
  58140. }
  58141. static overflow(attrs) {
  58142. return new Overflow(attrs);
  58143. }
  58144. static pageArea(attrs) {
  58145. return new PageArea(attrs);
  58146. }
  58147. static pageSet(attrs) {
  58148. return new PageSet(attrs);
  58149. }
  58150. static para(attrs) {
  58151. return new Para(attrs);
  58152. }
  58153. static passwordEdit(attrs) {
  58154. return new PasswordEdit(attrs);
  58155. }
  58156. static pattern(attrs) {
  58157. return new Pattern(attrs);
  58158. }
  58159. static picture(attrs) {
  58160. return new Picture(attrs);
  58161. }
  58162. static proto(attrs) {
  58163. return new Proto(attrs);
  58164. }
  58165. static radial(attrs) {
  58166. return new Radial(attrs);
  58167. }
  58168. static reason(attrs) {
  58169. return new Reason(attrs);
  58170. }
  58171. static reasons(attrs) {
  58172. return new Reasons(attrs);
  58173. }
  58174. static rectangle(attrs) {
  58175. return new Rectangle(attrs);
  58176. }
  58177. static ref(attrs) {
  58178. return new RefElement(attrs);
  58179. }
  58180. static script(attrs) {
  58181. return new Script(attrs);
  58182. }
  58183. static setProperty(attrs) {
  58184. return new SetProperty(attrs);
  58185. }
  58186. static signData(attrs) {
  58187. return new SignData(attrs);
  58188. }
  58189. static signature(attrs) {
  58190. return new Signature(attrs);
  58191. }
  58192. static signing(attrs) {
  58193. return new Signing(attrs);
  58194. }
  58195. static solid(attrs) {
  58196. return new Solid(attrs);
  58197. }
  58198. static speak(attrs) {
  58199. return new Speak(attrs);
  58200. }
  58201. static stipple(attrs) {
  58202. return new Stipple(attrs);
  58203. }
  58204. static subform(attrs) {
  58205. return new Subform(attrs);
  58206. }
  58207. static subformSet(attrs) {
  58208. return new SubformSet(attrs);
  58209. }
  58210. static subjectDN(attrs) {
  58211. return new SubjectDN(attrs);
  58212. }
  58213. static subjectDNs(attrs) {
  58214. return new SubjectDNs(attrs);
  58215. }
  58216. static submit(attrs) {
  58217. return new Submit(attrs);
  58218. }
  58219. static template(attrs) {
  58220. return new Template(attrs);
  58221. }
  58222. static text(attrs) {
  58223. return new Text(attrs);
  58224. }
  58225. static textEdit(attrs) {
  58226. return new TextEdit(attrs);
  58227. }
  58228. static time(attrs) {
  58229. return new Time(attrs);
  58230. }
  58231. static timeStamp(attrs) {
  58232. return new TimeStamp(attrs);
  58233. }
  58234. static toolTip(attrs) {
  58235. return new ToolTip(attrs);
  58236. }
  58237. static traversal(attrs) {
  58238. return new Traversal(attrs);
  58239. }
  58240. static traverse(attrs) {
  58241. return new Traverse(attrs);
  58242. }
  58243. static ui(attrs) {
  58244. return new Ui(attrs);
  58245. }
  58246. static validate(attrs) {
  58247. return new Validate(attrs);
  58248. }
  58249. static value(attrs) {
  58250. return new Value(attrs);
  58251. }
  58252. static variables(attrs) {
  58253. return new Variables(attrs);
  58254. }
  58255. }
  58256. exports.TemplateNamespace = TemplateNamespace;
  58257. /***/ }),
  58258. /* 81 */
  58259. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58260. Object.defineProperty(exports, "__esModule", ({
  58261. value: true
  58262. }));
  58263. exports.addHTML = addHTML;
  58264. exports.checkDimensions = checkDimensions;
  58265. exports.flushHTML = flushHTML;
  58266. exports.getAvailableSpace = getAvailableSpace;
  58267. var _xfa_object = __w_pdfjs_require__(75);
  58268. var _html_utils = __w_pdfjs_require__(82);
  58269. function createLine(node, children) {
  58270. return {
  58271. name: "div",
  58272. attributes: {
  58273. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58274. },
  58275. children
  58276. };
  58277. }
  58278. function flushHTML(node) {
  58279. if (!node[_xfa_object.$extra]) {
  58280. return null;
  58281. }
  58282. const attributes = node[_xfa_object.$extra].attributes;
  58283. const html = {
  58284. name: "div",
  58285. attributes,
  58286. children: node[_xfa_object.$extra].children
  58287. };
  58288. if (node[_xfa_object.$extra].failingNode) {
  58289. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58290. if (htmlFromFailing) {
  58291. if (node.layout.endsWith("-tb")) {
  58292. html.children.push(createLine(node, [htmlFromFailing]));
  58293. } else {
  58294. html.children.push(htmlFromFailing);
  58295. }
  58296. }
  58297. }
  58298. if (html.children.length === 0) {
  58299. return null;
  58300. }
  58301. return html;
  58302. }
  58303. function addHTML(node, html, bbox) {
  58304. const extra = node[_xfa_object.$extra];
  58305. const availableSpace = extra.availableSpace;
  58306. const [x, y, w, h] = bbox;
  58307. switch (node.layout) {
  58308. case "position":
  58309. {
  58310. extra.width = Math.max(extra.width, x + w);
  58311. extra.height = Math.max(extra.height, y + h);
  58312. extra.children.push(html);
  58313. break;
  58314. }
  58315. case "lr-tb":
  58316. case "rl-tb":
  58317. if (!extra.line || extra.attempt === 1) {
  58318. extra.line = createLine(node, []);
  58319. extra.children.push(extra.line);
  58320. extra.numberInLine = 0;
  58321. }
  58322. extra.numberInLine += 1;
  58323. extra.line.children.push(html);
  58324. if (extra.attempt === 0) {
  58325. extra.currentWidth += w;
  58326. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58327. } else {
  58328. extra.currentWidth = w;
  58329. extra.prevHeight = extra.height;
  58330. extra.height += h;
  58331. extra.attempt = 0;
  58332. }
  58333. extra.width = Math.max(extra.width, extra.currentWidth);
  58334. break;
  58335. case "rl-row":
  58336. case "row":
  58337. {
  58338. extra.children.push(html);
  58339. extra.width += w;
  58340. extra.height = Math.max(extra.height, h);
  58341. const height = (0, _html_utils.measureToString)(extra.height);
  58342. for (const child of extra.children) {
  58343. child.attributes.style.height = height;
  58344. }
  58345. break;
  58346. }
  58347. case "table":
  58348. {
  58349. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58350. extra.height += h;
  58351. extra.children.push(html);
  58352. break;
  58353. }
  58354. case "tb":
  58355. {
  58356. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58357. extra.height += h;
  58358. extra.children.push(html);
  58359. break;
  58360. }
  58361. }
  58362. }
  58363. function getAvailableSpace(node) {
  58364. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58365. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58366. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58367. switch (node.layout) {
  58368. case "lr-tb":
  58369. case "rl-tb":
  58370. if (node[_xfa_object.$extra].attempt === 0) {
  58371. return {
  58372. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58373. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58374. };
  58375. }
  58376. return {
  58377. width: availableSpace.width - marginH,
  58378. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58379. };
  58380. case "rl-row":
  58381. case "row":
  58382. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58383. return {
  58384. width,
  58385. height: availableSpace.height - marginH
  58386. };
  58387. case "table":
  58388. case "tb":
  58389. return {
  58390. width: availableSpace.width - marginH,
  58391. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58392. };
  58393. case "position":
  58394. default:
  58395. return availableSpace;
  58396. }
  58397. }
  58398. function getTransformedBBox(node) {
  58399. let w = node.w === "" ? NaN : node.w;
  58400. let h = node.h === "" ? NaN : node.h;
  58401. let [centerX, centerY] = [0, 0];
  58402. switch (node.anchorType || "") {
  58403. case "bottomCenter":
  58404. [centerX, centerY] = [w / 2, h];
  58405. break;
  58406. case "bottomLeft":
  58407. [centerX, centerY] = [0, h];
  58408. break;
  58409. case "bottomRight":
  58410. [centerX, centerY] = [w, h];
  58411. break;
  58412. case "middleCenter":
  58413. [centerX, centerY] = [w / 2, h / 2];
  58414. break;
  58415. case "middleLeft":
  58416. [centerX, centerY] = [0, h / 2];
  58417. break;
  58418. case "middleRight":
  58419. [centerX, centerY] = [w, h / 2];
  58420. break;
  58421. case "topCenter":
  58422. [centerX, centerY] = [w / 2, 0];
  58423. break;
  58424. case "topRight":
  58425. [centerX, centerY] = [w, 0];
  58426. break;
  58427. }
  58428. let x, y;
  58429. switch (node.rotate || 0) {
  58430. case 0:
  58431. [x, y] = [-centerX, -centerY];
  58432. break;
  58433. case 90:
  58434. [x, y] = [-centerY, centerX];
  58435. [w, h] = [h, -w];
  58436. break;
  58437. case 180:
  58438. [x, y] = [centerX, centerY];
  58439. [w, h] = [-w, -h];
  58440. break;
  58441. case 270:
  58442. [x, y] = [centerY, -centerX];
  58443. [w, h] = [-h, w];
  58444. break;
  58445. }
  58446. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58447. }
  58448. function checkDimensions(node, space) {
  58449. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58450. return true;
  58451. }
  58452. if (node.w === 0 || node.h === 0) {
  58453. return true;
  58454. }
  58455. const ERROR = 2;
  58456. const parent = node[_xfa_object.$getSubformParent]();
  58457. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58458. const [, y, w, h] = getTransformedBBox(node);
  58459. switch (parent.layout) {
  58460. case "lr-tb":
  58461. case "rl-tb":
  58462. if (attempt === 0) {
  58463. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58464. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58465. return false;
  58466. }
  58467. if (node.w !== "") {
  58468. if (Math.round(w - space.width) <= ERROR) {
  58469. return true;
  58470. }
  58471. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58472. return space.height > ERROR;
  58473. }
  58474. return false;
  58475. }
  58476. return space.width > ERROR;
  58477. }
  58478. if (node.w !== "") {
  58479. return Math.round(w - space.width) <= ERROR;
  58480. }
  58481. return space.width > ERROR;
  58482. }
  58483. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58484. return true;
  58485. }
  58486. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58487. return false;
  58488. }
  58489. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58490. return space.height > ERROR;
  58491. }
  58492. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58493. return false;
  58494. }
  58495. return space.height > ERROR;
  58496. case "table":
  58497. case "tb":
  58498. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58499. return true;
  58500. }
  58501. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58502. return Math.round(h - space.height) <= ERROR;
  58503. }
  58504. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58505. return space.height > ERROR;
  58506. }
  58507. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58508. return false;
  58509. }
  58510. return space.height > ERROR;
  58511. case "position":
  58512. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58513. return true;
  58514. }
  58515. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58516. return true;
  58517. }
  58518. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58519. return h + y > area.h;
  58520. case "rl-row":
  58521. case "row":
  58522. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58523. return true;
  58524. }
  58525. if (node.h !== "") {
  58526. return Math.round(h - space.height) <= ERROR;
  58527. }
  58528. return true;
  58529. default:
  58530. return true;
  58531. }
  58532. }
  58533. /***/ }),
  58534. /* 82 */
  58535. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58536. Object.defineProperty(exports, "__esModule", ({
  58537. value: true
  58538. }));
  58539. exports.computeBbox = computeBbox;
  58540. exports.createWrapper = createWrapper;
  58541. exports.fixDimensions = fixDimensions;
  58542. exports.fixTextIndent = fixTextIndent;
  58543. exports.fixURL = fixURL;
  58544. exports.isPrintOnly = isPrintOnly;
  58545. exports.layoutClass = layoutClass;
  58546. exports.layoutNode = layoutNode;
  58547. exports.measureToString = measureToString;
  58548. exports.setAccess = setAccess;
  58549. exports.setFontFamily = setFontFamily;
  58550. exports.setMinMaxDimensions = setMinMaxDimensions;
  58551. exports.setPara = setPara;
  58552. exports.toStyle = toStyle;
  58553. var _xfa_object = __w_pdfjs_require__(75);
  58554. var _util = __w_pdfjs_require__(2);
  58555. var _utils = __w_pdfjs_require__(76);
  58556. var _fonts = __w_pdfjs_require__(83);
  58557. var _text = __w_pdfjs_require__(84);
  58558. function measureToString(m) {
  58559. if (typeof m === "string") {
  58560. return "0px";
  58561. }
  58562. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58563. }
  58564. const converters = {
  58565. anchorType(node, style) {
  58566. const parent = node[_xfa_object.$getSubformParent]();
  58567. if (!parent || parent.layout && parent.layout !== "position") {
  58568. return;
  58569. }
  58570. if (!("transform" in style)) {
  58571. style.transform = "";
  58572. }
  58573. switch (node.anchorType) {
  58574. case "bottomCenter":
  58575. style.transform += "translate(-50%, -100%)";
  58576. break;
  58577. case "bottomLeft":
  58578. style.transform += "translate(0,-100%)";
  58579. break;
  58580. case "bottomRight":
  58581. style.transform += "translate(-100%,-100%)";
  58582. break;
  58583. case "middleCenter":
  58584. style.transform += "translate(-50%,-50%)";
  58585. break;
  58586. case "middleLeft":
  58587. style.transform += "translate(0,-50%)";
  58588. break;
  58589. case "middleRight":
  58590. style.transform += "translate(-100%,-50%)";
  58591. break;
  58592. case "topCenter":
  58593. style.transform += "translate(-50%,0)";
  58594. break;
  58595. case "topRight":
  58596. style.transform += "translate(-100%,0)";
  58597. break;
  58598. }
  58599. },
  58600. dimensions(node, style) {
  58601. const parent = node[_xfa_object.$getSubformParent]();
  58602. let width = node.w;
  58603. const height = node.h;
  58604. if (parent.layout && parent.layout.includes("row")) {
  58605. const extra = parent[_xfa_object.$extra];
  58606. const colSpan = node.colSpan;
  58607. let w;
  58608. if (colSpan === -1) {
  58609. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  58610. extra.currentColumn = 0;
  58611. } else {
  58612. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  58613. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  58614. }
  58615. if (!isNaN(w)) {
  58616. width = node.w = w;
  58617. }
  58618. }
  58619. if (width !== "") {
  58620. style.width = measureToString(width);
  58621. } else {
  58622. style.width = "auto";
  58623. }
  58624. if (height !== "") {
  58625. style.height = measureToString(height);
  58626. } else {
  58627. style.height = "auto";
  58628. }
  58629. },
  58630. position(node, style) {
  58631. const parent = node[_xfa_object.$getSubformParent]();
  58632. if (parent && parent.layout && parent.layout !== "position") {
  58633. return;
  58634. }
  58635. style.position = "absolute";
  58636. style.left = measureToString(node.x);
  58637. style.top = measureToString(node.y);
  58638. },
  58639. rotate(node, style) {
  58640. if (node.rotate) {
  58641. if (!("transform" in style)) {
  58642. style.transform = "";
  58643. }
  58644. style.transform += `rotate(-${node.rotate}deg)`;
  58645. style.transformOrigin = "top left";
  58646. }
  58647. },
  58648. presence(node, style) {
  58649. switch (node.presence) {
  58650. case "invisible":
  58651. style.visibility = "hidden";
  58652. break;
  58653. case "hidden":
  58654. case "inactive":
  58655. style.display = "none";
  58656. break;
  58657. }
  58658. },
  58659. hAlign(node, style) {
  58660. if (node[_xfa_object.$nodeName] === "para") {
  58661. switch (node.hAlign) {
  58662. case "justifyAll":
  58663. style.textAlign = "justify-all";
  58664. break;
  58665. case "radix":
  58666. style.textAlign = "left";
  58667. break;
  58668. default:
  58669. style.textAlign = node.hAlign;
  58670. }
  58671. } else {
  58672. switch (node.hAlign) {
  58673. case "left":
  58674. style.alignSelf = "start";
  58675. break;
  58676. case "center":
  58677. style.alignSelf = "center";
  58678. break;
  58679. case "right":
  58680. style.alignSelf = "end";
  58681. break;
  58682. }
  58683. }
  58684. },
  58685. margin(node, style) {
  58686. if (node.margin) {
  58687. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  58688. }
  58689. }
  58690. };
  58691. function setMinMaxDimensions(node, style) {
  58692. const parent = node[_xfa_object.$getSubformParent]();
  58693. if (parent.layout === "position") {
  58694. if (node.minW > 0) {
  58695. style.minWidth = measureToString(node.minW);
  58696. }
  58697. if (node.maxW > 0) {
  58698. style.maxWidth = measureToString(node.maxW);
  58699. }
  58700. if (node.minH > 0) {
  58701. style.minHeight = measureToString(node.minH);
  58702. }
  58703. if (node.maxH > 0) {
  58704. style.maxHeight = measureToString(node.maxH);
  58705. }
  58706. }
  58707. }
  58708. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  58709. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  58710. if (typeof text === "string") {
  58711. measure.addString(text);
  58712. } else {
  58713. text[_xfa_object.$pushGlyphs](measure);
  58714. }
  58715. return measure.compute(width);
  58716. }
  58717. function layoutNode(node, availableSpace) {
  58718. let height = null;
  58719. let width = null;
  58720. let isBroken = false;
  58721. if ((!node.w || !node.h) && node.value) {
  58722. let marginH = 0;
  58723. let marginV = 0;
  58724. if (node.margin) {
  58725. marginH = node.margin.leftInset + node.margin.rightInset;
  58726. marginV = node.margin.topInset + node.margin.bottomInset;
  58727. }
  58728. let lineHeight = null;
  58729. let margin = null;
  58730. if (node.para) {
  58731. margin = Object.create(null);
  58732. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  58733. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  58734. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  58735. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  58736. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  58737. }
  58738. let font = node.font;
  58739. if (!font) {
  58740. const root = node[_xfa_object.$getTemplateRoot]();
  58741. let parent = node[_xfa_object.$getParent]();
  58742. while (parent && parent !== root) {
  58743. if (parent.font) {
  58744. font = parent.font;
  58745. break;
  58746. }
  58747. parent = parent[_xfa_object.$getParent]();
  58748. }
  58749. }
  58750. const maxWidth = (node.w || availableSpace.width) - marginH;
  58751. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  58752. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  58753. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  58754. width = res.width;
  58755. height = res.height;
  58756. isBroken = res.isBroken;
  58757. } else {
  58758. const text = node.value[_xfa_object.$text]();
  58759. if (text) {
  58760. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  58761. width = res.width;
  58762. height = res.height;
  58763. isBroken = res.isBroken;
  58764. }
  58765. }
  58766. if (width !== null && !node.w) {
  58767. width += marginH;
  58768. }
  58769. if (height !== null && !node.h) {
  58770. height += marginV;
  58771. }
  58772. }
  58773. return {
  58774. w: width,
  58775. h: height,
  58776. isBroken
  58777. };
  58778. }
  58779. function computeBbox(node, html, availableSpace) {
  58780. let bbox;
  58781. if (node.w !== "" && node.h !== "") {
  58782. bbox = [node.x, node.y, node.w, node.h];
  58783. } else {
  58784. if (!availableSpace) {
  58785. return null;
  58786. }
  58787. let width = node.w;
  58788. if (width === "") {
  58789. if (node.maxW === 0) {
  58790. const parent = node[_xfa_object.$getSubformParent]();
  58791. if (parent.layout === "position" && parent.w !== "") {
  58792. width = 0;
  58793. } else {
  58794. width = node.minW;
  58795. }
  58796. } else {
  58797. width = Math.min(node.maxW, availableSpace.width);
  58798. }
  58799. html.attributes.style.width = measureToString(width);
  58800. }
  58801. let height = node.h;
  58802. if (height === "") {
  58803. if (node.maxH === 0) {
  58804. const parent = node[_xfa_object.$getSubformParent]();
  58805. if (parent.layout === "position" && parent.h !== "") {
  58806. height = 0;
  58807. } else {
  58808. height = node.minH;
  58809. }
  58810. } else {
  58811. height = Math.min(node.maxH, availableSpace.height);
  58812. }
  58813. html.attributes.style.height = measureToString(height);
  58814. }
  58815. bbox = [node.x, node.y, width, height];
  58816. }
  58817. return bbox;
  58818. }
  58819. function fixDimensions(node) {
  58820. const parent = node[_xfa_object.$getSubformParent]();
  58821. if (parent.layout && parent.layout.includes("row")) {
  58822. const extra = parent[_xfa_object.$extra];
  58823. const colSpan = node.colSpan;
  58824. let width;
  58825. if (colSpan === -1) {
  58826. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  58827. } else {
  58828. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  58829. }
  58830. if (!isNaN(width)) {
  58831. node.w = width;
  58832. }
  58833. }
  58834. if (parent.layout && parent.layout !== "position") {
  58835. node.x = node.y = 0;
  58836. }
  58837. if (node.layout === "table") {
  58838. if (node.w === "" && Array.isArray(node.columnWidths)) {
  58839. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  58840. }
  58841. }
  58842. }
  58843. function layoutClass(node) {
  58844. switch (node.layout) {
  58845. case "position":
  58846. return "xfaPosition";
  58847. case "lr-tb":
  58848. return "xfaLrTb";
  58849. case "rl-row":
  58850. return "xfaRlRow";
  58851. case "rl-tb":
  58852. return "xfaRlTb";
  58853. case "row":
  58854. return "xfaRow";
  58855. case "table":
  58856. return "xfaTable";
  58857. case "tb":
  58858. return "xfaTb";
  58859. default:
  58860. return "xfaPosition";
  58861. }
  58862. }
  58863. function toStyle(node, ...names) {
  58864. const style = Object.create(null);
  58865. for (const name of names) {
  58866. const value = node[name];
  58867. if (value === null) {
  58868. continue;
  58869. }
  58870. if (converters.hasOwnProperty(name)) {
  58871. converters[name](node, style);
  58872. continue;
  58873. }
  58874. if (value instanceof _xfa_object.XFAObject) {
  58875. const newStyle = value[_xfa_object.$toStyle]();
  58876. if (newStyle) {
  58877. Object.assign(style, newStyle);
  58878. } else {
  58879. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  58880. }
  58881. }
  58882. }
  58883. return style;
  58884. }
  58885. function createWrapper(node, html) {
  58886. const {
  58887. attributes
  58888. } = html;
  58889. const {
  58890. style
  58891. } = attributes;
  58892. const wrapper = {
  58893. name: "div",
  58894. attributes: {
  58895. class: ["xfaWrapper"],
  58896. style: Object.create(null)
  58897. },
  58898. children: []
  58899. };
  58900. attributes.class.push("xfaWrapped");
  58901. if (node.border) {
  58902. const {
  58903. widths,
  58904. insets
  58905. } = node.border[_xfa_object.$extra];
  58906. let width, height;
  58907. let top = insets[0];
  58908. let left = insets[3];
  58909. const insetsH = insets[0] + insets[2];
  58910. const insetsW = insets[1] + insets[3];
  58911. switch (node.border.hand) {
  58912. case "even":
  58913. top -= widths[0] / 2;
  58914. left -= widths[3] / 2;
  58915. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  58916. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  58917. break;
  58918. case "left":
  58919. top -= widths[0];
  58920. left -= widths[3];
  58921. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  58922. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  58923. break;
  58924. case "right":
  58925. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  58926. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  58927. break;
  58928. }
  58929. const classNames = ["xfaBorder"];
  58930. if (isPrintOnly(node.border)) {
  58931. classNames.push("xfaPrintOnly");
  58932. }
  58933. const border = {
  58934. name: "div",
  58935. attributes: {
  58936. class: classNames,
  58937. style: {
  58938. top: `${top}px`,
  58939. left: `${left}px`,
  58940. width,
  58941. height
  58942. }
  58943. },
  58944. children: []
  58945. };
  58946. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  58947. if (style[key] !== undefined) {
  58948. border.attributes.style[key] = style[key];
  58949. delete style[key];
  58950. }
  58951. }
  58952. wrapper.children.push(border, html);
  58953. } else {
  58954. wrapper.children.push(html);
  58955. }
  58956. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  58957. if (style[key] !== undefined) {
  58958. wrapper.attributes.style[key] = style[key];
  58959. delete style[key];
  58960. }
  58961. }
  58962. if (style.position === "absolute") {
  58963. wrapper.attributes.style.position = "absolute";
  58964. } else {
  58965. wrapper.attributes.style.position = "relative";
  58966. }
  58967. delete style.position;
  58968. if (style.alignSelf) {
  58969. wrapper.attributes.style.alignSelf = style.alignSelf;
  58970. delete style.alignSelf;
  58971. }
  58972. return wrapper;
  58973. }
  58974. function fixTextIndent(styles) {
  58975. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  58976. if (indent >= 0) {
  58977. return;
  58978. }
  58979. const align = styles.textAlign === "right" ? "right" : "left";
  58980. const name = "padding" + (align === "left" ? "Left" : "Right");
  58981. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  58982. styles[name] = `${padding - indent}px`;
  58983. }
  58984. function setAccess(node, classNames) {
  58985. switch (node.access) {
  58986. case "nonInteractive":
  58987. classNames.push("xfaNonInteractive");
  58988. break;
  58989. case "readOnly":
  58990. classNames.push("xfaReadOnly");
  58991. break;
  58992. case "protected":
  58993. classNames.push("xfaDisabled");
  58994. break;
  58995. }
  58996. }
  58997. function isPrintOnly(node) {
  58998. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  58999. }
  59000. function getCurrentPara(node) {
  59001. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  59002. return stack.length ? stack.at(-1) : null;
  59003. }
  59004. function setPara(node, nodeStyle, value) {
  59005. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  59006. if (nodeStyle) {
  59007. if (node.h === "") {
  59008. nodeStyle.height = "auto";
  59009. }
  59010. if (node.w === "") {
  59011. nodeStyle.width = "auto";
  59012. }
  59013. }
  59014. const para = getCurrentPara(node);
  59015. if (para) {
  59016. const valueStyle = value.attributes.style;
  59017. valueStyle.display = "flex";
  59018. valueStyle.flexDirection = "column";
  59019. switch (para.vAlign) {
  59020. case "top":
  59021. valueStyle.justifyContent = "start";
  59022. break;
  59023. case "bottom":
  59024. valueStyle.justifyContent = "end";
  59025. break;
  59026. case "middle":
  59027. valueStyle.justifyContent = "center";
  59028. break;
  59029. }
  59030. const paraStyle = para[_xfa_object.$toStyle]();
  59031. for (const [key, val] of Object.entries(paraStyle)) {
  59032. if (!(key in valueStyle)) {
  59033. valueStyle[key] = val;
  59034. }
  59035. }
  59036. }
  59037. }
  59038. }
  59039. function setFontFamily(xfaFont, node, fontFinder, style) {
  59040. if (!fontFinder) {
  59041. delete style.fontFamily;
  59042. return;
  59043. }
  59044. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59045. style.fontFamily = `"${name}"`;
  59046. const typeface = fontFinder.find(name);
  59047. if (typeface) {
  59048. const {
  59049. fontFamily
  59050. } = typeface.regular.cssFontInfo;
  59051. if (fontFamily !== name) {
  59052. style.fontFamily = `"${fontFamily}"`;
  59053. }
  59054. const para = getCurrentPara(node);
  59055. if (para && para.lineHeight !== "") {
  59056. return;
  59057. }
  59058. if (style.lineHeight) {
  59059. return;
  59060. }
  59061. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59062. if (pdfFont) {
  59063. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  59064. }
  59065. }
  59066. }
  59067. function fixURL(str) {
  59068. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  59069. addDefaultProtocol: true,
  59070. tryConvertEncoding: true
  59071. });
  59072. return absoluteUrl ? absoluteUrl.href : null;
  59073. }
  59074. /***/ }),
  59075. /* 83 */
  59076. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59077. Object.defineProperty(exports, "__esModule", ({
  59078. value: true
  59079. }));
  59080. exports.FontFinder = void 0;
  59081. exports.getMetrics = getMetrics;
  59082. exports.selectFont = selectFont;
  59083. var _xfa_object = __w_pdfjs_require__(75);
  59084. var _utils = __w_pdfjs_require__(76);
  59085. var _util = __w_pdfjs_require__(2);
  59086. class FontFinder {
  59087. constructor(pdfFonts) {
  59088. this.fonts = new Map();
  59089. this.cache = new Map();
  59090. this.warned = new Set();
  59091. this.defaultFont = null;
  59092. this.add(pdfFonts);
  59093. }
  59094. add(pdfFonts, reallyMissingFonts = null) {
  59095. for (const pdfFont of pdfFonts) {
  59096. this.addPdfFont(pdfFont);
  59097. }
  59098. for (const pdfFont of this.fonts.values()) {
  59099. if (!pdfFont.regular) {
  59100. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  59101. }
  59102. }
  59103. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  59104. return;
  59105. }
  59106. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  59107. for (const missing of reallyMissingFonts) {
  59108. this.fonts.set(missing, myriad);
  59109. }
  59110. }
  59111. addPdfFont(pdfFont) {
  59112. const cssFontInfo = pdfFont.cssFontInfo;
  59113. const name = cssFontInfo.fontFamily;
  59114. let font = this.fonts.get(name);
  59115. if (!font) {
  59116. font = Object.create(null);
  59117. this.fonts.set(name, font);
  59118. if (!this.defaultFont) {
  59119. this.defaultFont = font;
  59120. }
  59121. }
  59122. let property = "";
  59123. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  59124. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  59125. property = fontWeight >= 700 ? "bolditalic" : "italic";
  59126. } else if (fontWeight >= 700) {
  59127. property = "bold";
  59128. }
  59129. if (!property) {
  59130. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  59131. property = "bold";
  59132. }
  59133. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59134. property += "italic";
  59135. }
  59136. }
  59137. if (!property) {
  59138. property = "regular";
  59139. }
  59140. font[property] = pdfFont;
  59141. }
  59142. getDefault() {
  59143. return this.defaultFont;
  59144. }
  59145. find(fontName, mustWarn = true) {
  59146. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59147. if (font) {
  59148. return font;
  59149. }
  59150. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59151. let name = fontName.replace(pattern, "");
  59152. font = this.fonts.get(name);
  59153. if (font) {
  59154. this.cache.set(fontName, font);
  59155. return font;
  59156. }
  59157. name = name.toLowerCase();
  59158. const maybe = [];
  59159. for (const [family, pdfFont] of this.fonts.entries()) {
  59160. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59161. maybe.push(pdfFont);
  59162. }
  59163. }
  59164. if (maybe.length === 0) {
  59165. for (const [, pdfFont] of this.fonts.entries()) {
  59166. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59167. maybe.push(pdfFont);
  59168. }
  59169. }
  59170. }
  59171. if (maybe.length === 0) {
  59172. name = name.replace(/psmt|mt/gi, "");
  59173. for (const [family, pdfFont] of this.fonts.entries()) {
  59174. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59175. maybe.push(pdfFont);
  59176. }
  59177. }
  59178. }
  59179. if (maybe.length === 0) {
  59180. for (const pdfFont of this.fonts.values()) {
  59181. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59182. maybe.push(pdfFont);
  59183. }
  59184. }
  59185. }
  59186. if (maybe.length >= 1) {
  59187. if (maybe.length !== 1 && mustWarn) {
  59188. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59189. }
  59190. this.cache.set(fontName, maybe[0]);
  59191. return maybe[0];
  59192. }
  59193. if (mustWarn && !this.warned.has(fontName)) {
  59194. this.warned.add(fontName);
  59195. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59196. }
  59197. return null;
  59198. }
  59199. }
  59200. exports.FontFinder = FontFinder;
  59201. function selectFont(xfaFont, typeface) {
  59202. if (xfaFont.posture === "italic") {
  59203. if (xfaFont.weight === "bold") {
  59204. return typeface.bolditalic;
  59205. }
  59206. return typeface.italic;
  59207. } else if (xfaFont.weight === "bold") {
  59208. return typeface.bold;
  59209. }
  59210. return typeface.regular;
  59211. }
  59212. function getMetrics(xfaFont, real = false) {
  59213. let pdfFont = null;
  59214. if (xfaFont) {
  59215. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59216. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59217. pdfFont = selectFont(xfaFont, typeface);
  59218. }
  59219. if (!pdfFont) {
  59220. return {
  59221. lineHeight: 12,
  59222. lineGap: 2,
  59223. lineNoGap: 10
  59224. };
  59225. }
  59226. const size = xfaFont.size || 10;
  59227. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59228. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59229. return {
  59230. lineHeight: lineHeight * size,
  59231. lineGap: lineGap * size,
  59232. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59233. };
  59234. }
  59235. /***/ }),
  59236. /* 84 */
  59237. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59238. Object.defineProperty(exports, "__esModule", ({
  59239. value: true
  59240. }));
  59241. exports.TextMeasure = void 0;
  59242. var _fonts = __w_pdfjs_require__(83);
  59243. const WIDTH_FACTOR = 1.02;
  59244. class FontInfo {
  59245. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59246. this.lineHeight = lineHeight;
  59247. this.paraMargin = margin || {
  59248. top: 0,
  59249. bottom: 0,
  59250. left: 0,
  59251. right: 0
  59252. };
  59253. if (!xfaFont) {
  59254. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59255. return;
  59256. }
  59257. this.xfaFont = {
  59258. typeface: xfaFont.typeface,
  59259. posture: xfaFont.posture,
  59260. weight: xfaFont.weight,
  59261. size: xfaFont.size,
  59262. letterSpacing: xfaFont.letterSpacing
  59263. };
  59264. const typeface = fontFinder.find(xfaFont.typeface);
  59265. if (!typeface) {
  59266. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59267. return;
  59268. }
  59269. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59270. if (!this.pdfFont) {
  59271. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59272. }
  59273. }
  59274. defaultFont(fontFinder) {
  59275. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59276. if (font && font.regular) {
  59277. const pdfFont = font.regular;
  59278. const info = pdfFont.cssFontInfo;
  59279. const xfaFont = {
  59280. typeface: info.fontFamily,
  59281. posture: "normal",
  59282. weight: "normal",
  59283. size: 10,
  59284. letterSpacing: 0
  59285. };
  59286. return [pdfFont, xfaFont];
  59287. }
  59288. const xfaFont = {
  59289. typeface: "Courier",
  59290. posture: "normal",
  59291. weight: "normal",
  59292. size: 10,
  59293. letterSpacing: 0
  59294. };
  59295. return [null, xfaFont];
  59296. }
  59297. }
  59298. class FontSelector {
  59299. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59300. this.fontFinder = fontFinder;
  59301. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59302. }
  59303. pushData(xfaFont, margin, lineHeight) {
  59304. const lastFont = this.stack.at(-1);
  59305. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59306. if (!xfaFont[name]) {
  59307. xfaFont[name] = lastFont.xfaFont[name];
  59308. }
  59309. }
  59310. for (const name of ["top", "bottom", "left", "right"]) {
  59311. if (isNaN(margin[name])) {
  59312. margin[name] = lastFont.paraMargin[name];
  59313. }
  59314. }
  59315. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59316. if (!fontInfo.pdfFont) {
  59317. fontInfo.pdfFont = lastFont.pdfFont;
  59318. }
  59319. this.stack.push(fontInfo);
  59320. }
  59321. popFont() {
  59322. this.stack.pop();
  59323. }
  59324. topFont() {
  59325. return this.stack.at(-1);
  59326. }
  59327. }
  59328. class TextMeasure {
  59329. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59330. this.glyphs = [];
  59331. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59332. this.extraHeight = 0;
  59333. }
  59334. pushData(xfaFont, margin, lineHeight) {
  59335. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59336. }
  59337. popFont(xfaFont) {
  59338. return this.fontSelector.popFont();
  59339. }
  59340. addPara() {
  59341. const lastFont = this.fontSelector.topFont();
  59342. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59343. }
  59344. addString(str) {
  59345. if (!str) {
  59346. return;
  59347. }
  59348. const lastFont = this.fontSelector.topFont();
  59349. const fontSize = lastFont.xfaFont.size;
  59350. if (lastFont.pdfFont) {
  59351. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59352. const pdfFont = lastFont.pdfFont;
  59353. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59354. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59355. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59356. const noGap = fontLineHeight - lineGap;
  59357. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59358. const scale = fontSize / 1000;
  59359. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59360. for (const line of str.split(/[\u2029\n]/)) {
  59361. const encodedLine = pdfFont.encodeString(line).join("");
  59362. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59363. for (const glyph of glyphs) {
  59364. const width = glyph.width || fallbackWidth;
  59365. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59366. }
  59367. this.glyphs.push([0, 0, 0, "\n", true]);
  59368. }
  59369. this.glyphs.pop();
  59370. return;
  59371. }
  59372. for (const line of str.split(/[\u2029\n]/)) {
  59373. for (const char of line.split("")) {
  59374. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59375. }
  59376. this.glyphs.push([0, 0, 0, "\n", true]);
  59377. }
  59378. this.glyphs.pop();
  59379. }
  59380. compute(maxWidth) {
  59381. let lastSpacePos = -1,
  59382. lastSpaceWidth = 0,
  59383. width = 0,
  59384. height = 0,
  59385. currentLineWidth = 0,
  59386. currentLineHeight = 0;
  59387. let isBroken = false;
  59388. let isFirstLine = true;
  59389. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59390. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59391. const isSpace = char === " ";
  59392. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59393. if (isEOL) {
  59394. width = Math.max(width, currentLineWidth);
  59395. currentLineWidth = 0;
  59396. height += currentLineHeight;
  59397. currentLineHeight = glyphHeight;
  59398. lastSpacePos = -1;
  59399. lastSpaceWidth = 0;
  59400. isFirstLine = false;
  59401. continue;
  59402. }
  59403. if (isSpace) {
  59404. if (currentLineWidth + glyphWidth > maxWidth) {
  59405. width = Math.max(width, currentLineWidth);
  59406. currentLineWidth = 0;
  59407. height += currentLineHeight;
  59408. currentLineHeight = glyphHeight;
  59409. lastSpacePos = -1;
  59410. lastSpaceWidth = 0;
  59411. isBroken = true;
  59412. isFirstLine = false;
  59413. } else {
  59414. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59415. lastSpaceWidth = currentLineWidth;
  59416. currentLineWidth += glyphWidth;
  59417. lastSpacePos = i;
  59418. }
  59419. continue;
  59420. }
  59421. if (currentLineWidth + glyphWidth > maxWidth) {
  59422. height += currentLineHeight;
  59423. currentLineHeight = glyphHeight;
  59424. if (lastSpacePos !== -1) {
  59425. i = lastSpacePos;
  59426. width = Math.max(width, lastSpaceWidth);
  59427. currentLineWidth = 0;
  59428. lastSpacePos = -1;
  59429. lastSpaceWidth = 0;
  59430. } else {
  59431. width = Math.max(width, currentLineWidth);
  59432. currentLineWidth = glyphWidth;
  59433. }
  59434. isBroken = true;
  59435. isFirstLine = false;
  59436. continue;
  59437. }
  59438. currentLineWidth += glyphWidth;
  59439. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59440. }
  59441. width = Math.max(width, currentLineWidth);
  59442. height += currentLineHeight + this.extraHeight;
  59443. return {
  59444. width: WIDTH_FACTOR * width,
  59445. height,
  59446. isBroken
  59447. };
  59448. }
  59449. }
  59450. exports.TextMeasure = TextMeasure;
  59451. /***/ }),
  59452. /* 85 */
  59453. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59454. Object.defineProperty(exports, "__esModule", ({
  59455. value: true
  59456. }));
  59457. exports.DataHandler = void 0;
  59458. var _xfa_object = __w_pdfjs_require__(75);
  59459. class DataHandler {
  59460. constructor(root, data) {
  59461. this.data = data;
  59462. this.dataset = root.datasets || null;
  59463. }
  59464. serialize(storage) {
  59465. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59466. while (stack.length > 0) {
  59467. const last = stack.at(-1);
  59468. const [i, children] = last;
  59469. if (i + 1 === children.length) {
  59470. stack.pop();
  59471. continue;
  59472. }
  59473. const child = children[++last[0]];
  59474. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59475. if (storageEntry) {
  59476. child[_xfa_object.$setValue](storageEntry);
  59477. } else {
  59478. const attributes = child[_xfa_object.$getAttributes]();
  59479. for (const value of attributes.values()) {
  59480. const entry = storage.get(value[_xfa_object.$uid]);
  59481. if (entry) {
  59482. value[_xfa_object.$setValue](entry);
  59483. break;
  59484. }
  59485. }
  59486. }
  59487. const nodes = child[_xfa_object.$getChildren]();
  59488. if (nodes.length > 0) {
  59489. stack.push([-1, nodes]);
  59490. }
  59491. }
  59492. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59493. if (this.dataset) {
  59494. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59495. if (child[_xfa_object.$nodeName] !== "data") {
  59496. child[_xfa_object.$toString](buf);
  59497. }
  59498. }
  59499. }
  59500. this.data[_xfa_object.$toString](buf);
  59501. buf.push("</xfa:datasets>");
  59502. return buf.join("");
  59503. }
  59504. }
  59505. exports.DataHandler = DataHandler;
  59506. /***/ }),
  59507. /* 86 */
  59508. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59509. Object.defineProperty(exports, "__esModule", ({
  59510. value: true
  59511. }));
  59512. exports.XFAParser = void 0;
  59513. var _xfa_object = __w_pdfjs_require__(75);
  59514. var _xml_parser = __w_pdfjs_require__(64);
  59515. var _builder = __w_pdfjs_require__(87);
  59516. var _util = __w_pdfjs_require__(2);
  59517. class XFAParser extends _xml_parser.XMLParserBase {
  59518. constructor(rootNameSpace = null, richText = false) {
  59519. super();
  59520. this._builder = new _builder.Builder(rootNameSpace);
  59521. this._stack = [];
  59522. this._globalData = {
  59523. usedTypefaces: new Set()
  59524. };
  59525. this._ids = new Map();
  59526. this._current = this._builder.buildRoot(this._ids);
  59527. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59528. this._whiteRegex = /^\s+$/;
  59529. this._nbsps = /\xa0+/g;
  59530. this._richText = richText;
  59531. }
  59532. parse(data) {
  59533. this.parseXml(data);
  59534. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59535. return undefined;
  59536. }
  59537. this._current[_xfa_object.$finalize]();
  59538. return this._current.element;
  59539. }
  59540. onText(text) {
  59541. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59542. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59543. this._current[_xfa_object.$onText](text, this._richText);
  59544. return;
  59545. }
  59546. if (this._whiteRegex.test(text)) {
  59547. return;
  59548. }
  59549. this._current[_xfa_object.$onText](text.trim());
  59550. }
  59551. onCdata(text) {
  59552. this._current[_xfa_object.$onText](text);
  59553. }
  59554. _mkAttributes(attributes, tagName) {
  59555. let namespace = null;
  59556. let prefixes = null;
  59557. const attributeObj = Object.create({});
  59558. for (const {
  59559. name,
  59560. value
  59561. } of attributes) {
  59562. if (name === "xmlns") {
  59563. if (!namespace) {
  59564. namespace = value;
  59565. } else {
  59566. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59567. }
  59568. } else if (name.startsWith("xmlns:")) {
  59569. const prefix = name.substring("xmlns:".length);
  59570. if (!prefixes) {
  59571. prefixes = [];
  59572. }
  59573. prefixes.push({
  59574. prefix,
  59575. value
  59576. });
  59577. } else {
  59578. const i = name.indexOf(":");
  59579. if (i === -1) {
  59580. attributeObj[name] = value;
  59581. } else {
  59582. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  59583. if (!nsAttrs) {
  59584. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  59585. }
  59586. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  59587. let attrs = nsAttrs[ns];
  59588. if (!attrs) {
  59589. attrs = nsAttrs[ns] = Object.create(null);
  59590. }
  59591. attrs[attrName] = value;
  59592. }
  59593. }
  59594. }
  59595. return [namespace, prefixes, attributeObj];
  59596. }
  59597. _getNameAndPrefix(name, nsAgnostic) {
  59598. const i = name.indexOf(":");
  59599. if (i === -1) {
  59600. return [name, null];
  59601. }
  59602. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  59603. }
  59604. onBeginElement(tagName, attributes, isEmpty) {
  59605. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  59606. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  59607. const node = this._builder.build({
  59608. nsPrefix,
  59609. name,
  59610. attributes: attributesObj,
  59611. namespace,
  59612. prefixes
  59613. });
  59614. node[_xfa_object.$globalData] = this._globalData;
  59615. if (isEmpty) {
  59616. node[_xfa_object.$finalize]();
  59617. if (this._current[_xfa_object.$onChild](node)) {
  59618. node[_xfa_object.$setId](this._ids);
  59619. }
  59620. node[_xfa_object.$clean](this._builder);
  59621. return;
  59622. }
  59623. this._stack.push(this._current);
  59624. this._current = node;
  59625. }
  59626. onEndElement(name) {
  59627. const node = this._current;
  59628. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  59629. const parser = new XFAParser();
  59630. parser._globalData = this._globalData;
  59631. const root = parser.parse(node[_xfa_object.$content]);
  59632. node[_xfa_object.$content] = null;
  59633. node[_xfa_object.$onChild](root);
  59634. }
  59635. node[_xfa_object.$finalize]();
  59636. this._current = this._stack.pop();
  59637. if (this._current[_xfa_object.$onChild](node)) {
  59638. node[_xfa_object.$setId](this._ids);
  59639. }
  59640. node[_xfa_object.$clean](this._builder);
  59641. }
  59642. onError(code) {
  59643. this._errorCode = code;
  59644. }
  59645. }
  59646. exports.XFAParser = XFAParser;
  59647. /***/ }),
  59648. /* 87 */
  59649. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59650. Object.defineProperty(exports, "__esModule", ({
  59651. value: true
  59652. }));
  59653. exports.Builder = void 0;
  59654. var _namespaces = __w_pdfjs_require__(77);
  59655. var _xfa_object = __w_pdfjs_require__(75);
  59656. var _setup = __w_pdfjs_require__(88);
  59657. var _template = __w_pdfjs_require__(80);
  59658. var _unknown = __w_pdfjs_require__(97);
  59659. var _util = __w_pdfjs_require__(2);
  59660. class Root extends _xfa_object.XFAObject {
  59661. constructor(ids) {
  59662. super(-1, "root", Object.create(null));
  59663. this.element = null;
  59664. this[_xfa_object.$ids] = ids;
  59665. }
  59666. [_xfa_object.$onChild](child) {
  59667. this.element = child;
  59668. return true;
  59669. }
  59670. [_xfa_object.$finalize]() {
  59671. super[_xfa_object.$finalize]();
  59672. if (this.element.template instanceof _template.Template) {
  59673. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  59674. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  59675. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  59676. }
  59677. }
  59678. }
  59679. class Empty extends _xfa_object.XFAObject {
  59680. constructor() {
  59681. super(-1, "", Object.create(null));
  59682. }
  59683. [_xfa_object.$onChild](_) {
  59684. return false;
  59685. }
  59686. }
  59687. class Builder {
  59688. constructor(rootNameSpace = null) {
  59689. this._namespaceStack = [];
  59690. this._nsAgnosticLevel = 0;
  59691. this._namespacePrefixes = new Map();
  59692. this._namespaces = new Map();
  59693. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  59694. id
  59695. }) => id));
  59696. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  59697. }
  59698. buildRoot(ids) {
  59699. return new Root(ids);
  59700. }
  59701. build({
  59702. nsPrefix,
  59703. name,
  59704. attributes,
  59705. namespace,
  59706. prefixes
  59707. }) {
  59708. const hasNamespaceDef = namespace !== null;
  59709. if (hasNamespaceDef) {
  59710. this._namespaceStack.push(this._currentNamespace);
  59711. this._currentNamespace = this._searchNamespace(namespace);
  59712. }
  59713. if (prefixes) {
  59714. this._addNamespacePrefix(prefixes);
  59715. }
  59716. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  59717. const dataTemplate = _setup.NamespaceSetUp.datasets;
  59718. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  59719. let xfaAttrs = null;
  59720. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  59721. const nsToUse = this._getNamespaceToUse(ns);
  59722. if (nsToUse === dataTemplate) {
  59723. xfaAttrs = {
  59724. xfa: attrs
  59725. };
  59726. break;
  59727. }
  59728. }
  59729. if (xfaAttrs) {
  59730. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  59731. } else {
  59732. delete attributes[_xfa_object.$nsAttributes];
  59733. }
  59734. }
  59735. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  59736. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  59737. if (node[_xfa_object.$isNsAgnostic]()) {
  59738. this._nsAgnosticLevel++;
  59739. }
  59740. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  59741. node[_xfa_object.$cleanup] = {
  59742. hasNamespace: hasNamespaceDef,
  59743. prefixes,
  59744. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  59745. };
  59746. }
  59747. return node;
  59748. }
  59749. isNsAgnostic() {
  59750. return this._nsAgnosticLevel > 0;
  59751. }
  59752. _searchNamespace(nsName) {
  59753. let ns = this._namespaces.get(nsName);
  59754. if (ns) {
  59755. return ns;
  59756. }
  59757. for (const [name, {
  59758. check
  59759. }] of Object.entries(_namespaces.NamespaceIds)) {
  59760. if (check(nsName)) {
  59761. ns = _setup.NamespaceSetUp[name];
  59762. if (ns) {
  59763. this._namespaces.set(nsName, ns);
  59764. return ns;
  59765. }
  59766. break;
  59767. }
  59768. }
  59769. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  59770. this._namespaces.set(nsName, ns);
  59771. return ns;
  59772. }
  59773. _addNamespacePrefix(prefixes) {
  59774. for (const {
  59775. prefix,
  59776. value
  59777. } of prefixes) {
  59778. const namespace = this._searchNamespace(value);
  59779. let prefixStack = this._namespacePrefixes.get(prefix);
  59780. if (!prefixStack) {
  59781. prefixStack = [];
  59782. this._namespacePrefixes.set(prefix, prefixStack);
  59783. }
  59784. prefixStack.push(namespace);
  59785. }
  59786. }
  59787. _getNamespaceToUse(prefix) {
  59788. if (!prefix) {
  59789. return this._currentNamespace;
  59790. }
  59791. const prefixStack = this._namespacePrefixes.get(prefix);
  59792. if (prefixStack && prefixStack.length > 0) {
  59793. return prefixStack.at(-1);
  59794. }
  59795. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  59796. return null;
  59797. }
  59798. clean(data) {
  59799. const {
  59800. hasNamespace,
  59801. prefixes,
  59802. nsAgnostic
  59803. } = data;
  59804. if (hasNamespace) {
  59805. this._currentNamespace = this._namespaceStack.pop();
  59806. }
  59807. if (prefixes) {
  59808. prefixes.forEach(({
  59809. prefix
  59810. }) => {
  59811. this._namespacePrefixes.get(prefix).pop();
  59812. });
  59813. }
  59814. if (nsAgnostic) {
  59815. this._nsAgnosticLevel--;
  59816. }
  59817. }
  59818. }
  59819. exports.Builder = Builder;
  59820. /***/ }),
  59821. /* 88 */
  59822. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59823. Object.defineProperty(exports, "__esModule", ({
  59824. value: true
  59825. }));
  59826. exports.NamespaceSetUp = void 0;
  59827. var _config = __w_pdfjs_require__(89);
  59828. var _connection_set = __w_pdfjs_require__(90);
  59829. var _datasets = __w_pdfjs_require__(91);
  59830. var _locale_set = __w_pdfjs_require__(92);
  59831. var _signature = __w_pdfjs_require__(93);
  59832. var _stylesheet = __w_pdfjs_require__(94);
  59833. var _template = __w_pdfjs_require__(80);
  59834. var _xdp = __w_pdfjs_require__(95);
  59835. var _xhtml = __w_pdfjs_require__(96);
  59836. const NamespaceSetUp = {
  59837. config: _config.ConfigNamespace,
  59838. connection: _connection_set.ConnectionSetNamespace,
  59839. datasets: _datasets.DatasetsNamespace,
  59840. localeSet: _locale_set.LocaleSetNamespace,
  59841. signature: _signature.SignatureNamespace,
  59842. stylesheet: _stylesheet.StylesheetNamespace,
  59843. template: _template.TemplateNamespace,
  59844. xdp: _xdp.XdpNamespace,
  59845. xhtml: _xhtml.XhtmlNamespace
  59846. };
  59847. exports.NamespaceSetUp = NamespaceSetUp;
  59848. /***/ }),
  59849. /* 89 */
  59850. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59851. Object.defineProperty(exports, "__esModule", ({
  59852. value: true
  59853. }));
  59854. exports.ConfigNamespace = void 0;
  59855. var _namespaces = __w_pdfjs_require__(77);
  59856. var _xfa_object = __w_pdfjs_require__(75);
  59857. var _utils = __w_pdfjs_require__(76);
  59858. var _util = __w_pdfjs_require__(2);
  59859. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  59860. class Acrobat extends _xfa_object.XFAObject {
  59861. constructor(attributes) {
  59862. super(CONFIG_NS_ID, "acrobat", true);
  59863. this.acrobat7 = null;
  59864. this.autoSave = null;
  59865. this.common = null;
  59866. this.validate = null;
  59867. this.validateApprovalSignatures = null;
  59868. this.submitUrl = new _xfa_object.XFAObjectArray();
  59869. }
  59870. }
  59871. class Acrobat7 extends _xfa_object.XFAObject {
  59872. constructor(attributes) {
  59873. super(CONFIG_NS_ID, "acrobat7", true);
  59874. this.dynamicRender = null;
  59875. }
  59876. }
  59877. class ADBE_JSConsole extends _xfa_object.OptionObject {
  59878. constructor(attributes) {
  59879. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  59880. }
  59881. }
  59882. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  59883. constructor(attributes) {
  59884. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  59885. }
  59886. }
  59887. class AddSilentPrint extends _xfa_object.Option01 {
  59888. constructor(attributes) {
  59889. super(CONFIG_NS_ID, "addSilentPrint");
  59890. }
  59891. }
  59892. class AddViewerPreferences extends _xfa_object.Option01 {
  59893. constructor(attributes) {
  59894. super(CONFIG_NS_ID, "addViewerPreferences");
  59895. }
  59896. }
  59897. class AdjustData extends _xfa_object.Option10 {
  59898. constructor(attributes) {
  59899. super(CONFIG_NS_ID, "adjustData");
  59900. }
  59901. }
  59902. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  59903. constructor(attributes) {
  59904. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  59905. }
  59906. }
  59907. class Agent extends _xfa_object.XFAObject {
  59908. constructor(attributes) {
  59909. super(CONFIG_NS_ID, "agent", true);
  59910. this.name = attributes.name ? attributes.name.trim() : "";
  59911. this.common = new _xfa_object.XFAObjectArray();
  59912. }
  59913. }
  59914. class AlwaysEmbed extends _xfa_object.ContentObject {
  59915. constructor(attributes) {
  59916. super(CONFIG_NS_ID, "alwaysEmbed");
  59917. }
  59918. }
  59919. class Amd extends _xfa_object.StringObject {
  59920. constructor(attributes) {
  59921. super(CONFIG_NS_ID, "amd");
  59922. }
  59923. }
  59924. class Area extends _xfa_object.XFAObject {
  59925. constructor(attributes) {
  59926. super(CONFIG_NS_ID, "area");
  59927. this.level = (0, _utils.getInteger)({
  59928. data: attributes.level,
  59929. defaultValue: 0,
  59930. validate: n => n >= 1 && n <= 3
  59931. });
  59932. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  59933. }
  59934. }
  59935. class Attributes extends _xfa_object.OptionObject {
  59936. constructor(attributes) {
  59937. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  59938. }
  59939. }
  59940. class AutoSave extends _xfa_object.OptionObject {
  59941. constructor(attributes) {
  59942. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  59943. }
  59944. }
  59945. class Base extends _xfa_object.StringObject {
  59946. constructor(attributes) {
  59947. super(CONFIG_NS_ID, "base");
  59948. }
  59949. }
  59950. class BatchOutput extends _xfa_object.XFAObject {
  59951. constructor(attributes) {
  59952. super(CONFIG_NS_ID, "batchOutput");
  59953. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  59954. }
  59955. }
  59956. class BehaviorOverride extends _xfa_object.ContentObject {
  59957. constructor(attributes) {
  59958. super(CONFIG_NS_ID, "behaviorOverride");
  59959. }
  59960. [_xfa_object.$finalize]() {
  59961. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  59962. }
  59963. }
  59964. class Cache extends _xfa_object.XFAObject {
  59965. constructor(attributes) {
  59966. super(CONFIG_NS_ID, "cache", true);
  59967. this.templateCache = null;
  59968. }
  59969. }
  59970. class Change extends _xfa_object.Option01 {
  59971. constructor(attributes) {
  59972. super(CONFIG_NS_ID, "change");
  59973. }
  59974. }
  59975. class Common extends _xfa_object.XFAObject {
  59976. constructor(attributes) {
  59977. super(CONFIG_NS_ID, "common", true);
  59978. this.data = null;
  59979. this.locale = null;
  59980. this.localeSet = null;
  59981. this.messaging = null;
  59982. this.suppressBanner = null;
  59983. this.template = null;
  59984. this.validationMessaging = null;
  59985. this.versionControl = null;
  59986. this.log = new _xfa_object.XFAObjectArray();
  59987. }
  59988. }
  59989. class Compress extends _xfa_object.XFAObject {
  59990. constructor(attributes) {
  59991. super(CONFIG_NS_ID, "compress");
  59992. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  59993. }
  59994. }
  59995. class CompressLogicalStructure extends _xfa_object.Option01 {
  59996. constructor(attributes) {
  59997. super(CONFIG_NS_ID, "compressLogicalStructure");
  59998. }
  59999. }
  60000. class CompressObjectStream extends _xfa_object.Option10 {
  60001. constructor(attributes) {
  60002. super(CONFIG_NS_ID, "compressObjectStream");
  60003. }
  60004. }
  60005. class Compression extends _xfa_object.XFAObject {
  60006. constructor(attributes) {
  60007. super(CONFIG_NS_ID, "compression", true);
  60008. this.compressLogicalStructure = null;
  60009. this.compressObjectStream = null;
  60010. this.level = null;
  60011. this.type = null;
  60012. }
  60013. }
  60014. class Config extends _xfa_object.XFAObject {
  60015. constructor(attributes) {
  60016. super(CONFIG_NS_ID, "config", true);
  60017. this.acrobat = null;
  60018. this.present = null;
  60019. this.trace = null;
  60020. this.agent = new _xfa_object.XFAObjectArray();
  60021. }
  60022. }
  60023. class Conformance extends _xfa_object.OptionObject {
  60024. constructor(attributes) {
  60025. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  60026. }
  60027. }
  60028. class ContentCopy extends _xfa_object.Option01 {
  60029. constructor(attributes) {
  60030. super(CONFIG_NS_ID, "contentCopy");
  60031. }
  60032. }
  60033. class Copies extends _xfa_object.IntegerObject {
  60034. constructor(attributes) {
  60035. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  60036. }
  60037. }
  60038. class Creator extends _xfa_object.StringObject {
  60039. constructor(attributes) {
  60040. super(CONFIG_NS_ID, "creator");
  60041. }
  60042. }
  60043. class CurrentPage extends _xfa_object.IntegerObject {
  60044. constructor(attributes) {
  60045. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  60046. }
  60047. }
  60048. class Data extends _xfa_object.XFAObject {
  60049. constructor(attributes) {
  60050. super(CONFIG_NS_ID, "data", true);
  60051. this.adjustData = null;
  60052. this.attributes = null;
  60053. this.incrementalLoad = null;
  60054. this.outputXSL = null;
  60055. this.range = null;
  60056. this.record = null;
  60057. this.startNode = null;
  60058. this.uri = null;
  60059. this.window = null;
  60060. this.xsl = null;
  60061. this.excludeNS = new _xfa_object.XFAObjectArray();
  60062. this.transform = new _xfa_object.XFAObjectArray();
  60063. }
  60064. }
  60065. class Debug extends _xfa_object.XFAObject {
  60066. constructor(attributes) {
  60067. super(CONFIG_NS_ID, "debug", true);
  60068. this.uri = null;
  60069. }
  60070. }
  60071. class DefaultTypeface extends _xfa_object.ContentObject {
  60072. constructor(attributes) {
  60073. super(CONFIG_NS_ID, "defaultTypeface");
  60074. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  60075. }
  60076. }
  60077. class Destination extends _xfa_object.OptionObject {
  60078. constructor(attributes) {
  60079. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  60080. }
  60081. }
  60082. class DocumentAssembly extends _xfa_object.Option01 {
  60083. constructor(attributes) {
  60084. super(CONFIG_NS_ID, "documentAssembly");
  60085. }
  60086. }
  60087. class Driver extends _xfa_object.XFAObject {
  60088. constructor(attributes) {
  60089. super(CONFIG_NS_ID, "driver", true);
  60090. this.name = attributes.name ? attributes.name.trim() : "";
  60091. this.fontInfo = null;
  60092. this.xdc = null;
  60093. }
  60094. }
  60095. class DuplexOption extends _xfa_object.OptionObject {
  60096. constructor(attributes) {
  60097. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  60098. }
  60099. }
  60100. class DynamicRender extends _xfa_object.OptionObject {
  60101. constructor(attributes) {
  60102. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  60103. }
  60104. }
  60105. class Embed extends _xfa_object.Option01 {
  60106. constructor(attributes) {
  60107. super(CONFIG_NS_ID, "embed");
  60108. }
  60109. }
  60110. class Encrypt extends _xfa_object.Option01 {
  60111. constructor(attributes) {
  60112. super(CONFIG_NS_ID, "encrypt");
  60113. }
  60114. }
  60115. class Encryption extends _xfa_object.XFAObject {
  60116. constructor(attributes) {
  60117. super(CONFIG_NS_ID, "encryption", true);
  60118. this.encrypt = null;
  60119. this.encryptionLevel = null;
  60120. this.permissions = null;
  60121. }
  60122. }
  60123. class EncryptionLevel extends _xfa_object.OptionObject {
  60124. constructor(attributes) {
  60125. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  60126. }
  60127. }
  60128. class Enforce extends _xfa_object.StringObject {
  60129. constructor(attributes) {
  60130. super(CONFIG_NS_ID, "enforce");
  60131. }
  60132. }
  60133. class Equate extends _xfa_object.XFAObject {
  60134. constructor(attributes) {
  60135. super(CONFIG_NS_ID, "equate");
  60136. this.force = (0, _utils.getInteger)({
  60137. data: attributes.force,
  60138. defaultValue: 1,
  60139. validate: n => n === 0
  60140. });
  60141. this.from = attributes.from || "";
  60142. this.to = attributes.to || "";
  60143. }
  60144. }
  60145. class EquateRange extends _xfa_object.XFAObject {
  60146. constructor(attributes) {
  60147. super(CONFIG_NS_ID, "equateRange");
  60148. this.from = attributes.from || "";
  60149. this.to = attributes.to || "";
  60150. this._unicodeRange = attributes.unicodeRange || "";
  60151. }
  60152. get unicodeRange() {
  60153. const ranges = [];
  60154. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60155. const unicodeRange = this._unicodeRange;
  60156. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60157. range = range.split("-", 2).map(x => {
  60158. const found = x.match(unicodeRegex);
  60159. if (!found) {
  60160. return 0;
  60161. }
  60162. return parseInt(found[1], 16);
  60163. });
  60164. if (range.length === 1) {
  60165. range.push(range[0]);
  60166. }
  60167. ranges.push(range);
  60168. }
  60169. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60170. }
  60171. }
  60172. class Exclude extends _xfa_object.ContentObject {
  60173. constructor(attributes) {
  60174. super(CONFIG_NS_ID, "exclude");
  60175. }
  60176. [_xfa_object.$finalize]() {
  60177. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60178. }
  60179. }
  60180. class ExcludeNS extends _xfa_object.StringObject {
  60181. constructor(attributes) {
  60182. super(CONFIG_NS_ID, "excludeNS");
  60183. }
  60184. }
  60185. class FlipLabel extends _xfa_object.OptionObject {
  60186. constructor(attributes) {
  60187. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60188. }
  60189. }
  60190. class FontInfo extends _xfa_object.XFAObject {
  60191. constructor(attributes) {
  60192. super(CONFIG_NS_ID, "fontInfo", true);
  60193. this.embed = null;
  60194. this.map = null;
  60195. this.subsetBelow = null;
  60196. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60197. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60198. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60199. }
  60200. }
  60201. class FormFieldFilling extends _xfa_object.Option01 {
  60202. constructor(attributes) {
  60203. super(CONFIG_NS_ID, "formFieldFilling");
  60204. }
  60205. }
  60206. class GroupParent extends _xfa_object.StringObject {
  60207. constructor(attributes) {
  60208. super(CONFIG_NS_ID, "groupParent");
  60209. }
  60210. }
  60211. class IfEmpty extends _xfa_object.OptionObject {
  60212. constructor(attributes) {
  60213. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60214. }
  60215. }
  60216. class IncludeXDPContent extends _xfa_object.StringObject {
  60217. constructor(attributes) {
  60218. super(CONFIG_NS_ID, "includeXDPContent");
  60219. }
  60220. }
  60221. class IncrementalLoad extends _xfa_object.OptionObject {
  60222. constructor(attributes) {
  60223. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60224. }
  60225. }
  60226. class IncrementalMerge extends _xfa_object.Option01 {
  60227. constructor(attributes) {
  60228. super(CONFIG_NS_ID, "incrementalMerge");
  60229. }
  60230. }
  60231. class Interactive extends _xfa_object.Option01 {
  60232. constructor(attributes) {
  60233. super(CONFIG_NS_ID, "interactive");
  60234. }
  60235. }
  60236. class Jog extends _xfa_object.OptionObject {
  60237. constructor(attributes) {
  60238. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60239. }
  60240. }
  60241. class LabelPrinter extends _xfa_object.XFAObject {
  60242. constructor(attributes) {
  60243. super(CONFIG_NS_ID, "labelPrinter", true);
  60244. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60245. this.batchOutput = null;
  60246. this.flipLabel = null;
  60247. this.fontInfo = null;
  60248. this.xdc = null;
  60249. }
  60250. }
  60251. class Layout extends _xfa_object.OptionObject {
  60252. constructor(attributes) {
  60253. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60254. }
  60255. }
  60256. class Level extends _xfa_object.IntegerObject {
  60257. constructor(attributes) {
  60258. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60259. }
  60260. }
  60261. class Linearized extends _xfa_object.Option01 {
  60262. constructor(attributes) {
  60263. super(CONFIG_NS_ID, "linearized");
  60264. }
  60265. }
  60266. class Locale extends _xfa_object.StringObject {
  60267. constructor(attributes) {
  60268. super(CONFIG_NS_ID, "locale");
  60269. }
  60270. }
  60271. class LocaleSet extends _xfa_object.StringObject {
  60272. constructor(attributes) {
  60273. super(CONFIG_NS_ID, "localeSet");
  60274. }
  60275. }
  60276. class Log extends _xfa_object.XFAObject {
  60277. constructor(attributes) {
  60278. super(CONFIG_NS_ID, "log", true);
  60279. this.mode = null;
  60280. this.threshold = null;
  60281. this.to = null;
  60282. this.uri = null;
  60283. }
  60284. }
  60285. class MapElement extends _xfa_object.XFAObject {
  60286. constructor(attributes) {
  60287. super(CONFIG_NS_ID, "map", true);
  60288. this.equate = new _xfa_object.XFAObjectArray();
  60289. this.equateRange = new _xfa_object.XFAObjectArray();
  60290. }
  60291. }
  60292. class MediumInfo extends _xfa_object.XFAObject {
  60293. constructor(attributes) {
  60294. super(CONFIG_NS_ID, "mediumInfo", true);
  60295. this.map = null;
  60296. }
  60297. }
  60298. class Message extends _xfa_object.XFAObject {
  60299. constructor(attributes) {
  60300. super(CONFIG_NS_ID, "message", true);
  60301. this.msgId = null;
  60302. this.severity = null;
  60303. }
  60304. }
  60305. class Messaging extends _xfa_object.XFAObject {
  60306. constructor(attributes) {
  60307. super(CONFIG_NS_ID, "messaging", true);
  60308. this.message = new _xfa_object.XFAObjectArray();
  60309. }
  60310. }
  60311. class Mode extends _xfa_object.OptionObject {
  60312. constructor(attributes) {
  60313. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60314. }
  60315. }
  60316. class ModifyAnnots extends _xfa_object.Option01 {
  60317. constructor(attributes) {
  60318. super(CONFIG_NS_ID, "modifyAnnots");
  60319. }
  60320. }
  60321. class MsgId extends _xfa_object.IntegerObject {
  60322. constructor(attributes) {
  60323. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60324. }
  60325. }
  60326. class NameAttr extends _xfa_object.StringObject {
  60327. constructor(attributes) {
  60328. super(CONFIG_NS_ID, "nameAttr");
  60329. }
  60330. }
  60331. class NeverEmbed extends _xfa_object.ContentObject {
  60332. constructor(attributes) {
  60333. super(CONFIG_NS_ID, "neverEmbed");
  60334. }
  60335. }
  60336. class NumberOfCopies extends _xfa_object.IntegerObject {
  60337. constructor(attributes) {
  60338. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60339. }
  60340. }
  60341. class OpenAction extends _xfa_object.XFAObject {
  60342. constructor(attributes) {
  60343. super(CONFIG_NS_ID, "openAction", true);
  60344. this.destination = null;
  60345. }
  60346. }
  60347. class Output extends _xfa_object.XFAObject {
  60348. constructor(attributes) {
  60349. super(CONFIG_NS_ID, "output", true);
  60350. this.to = null;
  60351. this.type = null;
  60352. this.uri = null;
  60353. }
  60354. }
  60355. class OutputBin extends _xfa_object.StringObject {
  60356. constructor(attributes) {
  60357. super(CONFIG_NS_ID, "outputBin");
  60358. }
  60359. }
  60360. class OutputXSL extends _xfa_object.XFAObject {
  60361. constructor(attributes) {
  60362. super(CONFIG_NS_ID, "outputXSL", true);
  60363. this.uri = null;
  60364. }
  60365. }
  60366. class Overprint extends _xfa_object.OptionObject {
  60367. constructor(attributes) {
  60368. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60369. }
  60370. }
  60371. class Packets extends _xfa_object.StringObject {
  60372. constructor(attributes) {
  60373. super(CONFIG_NS_ID, "packets");
  60374. }
  60375. [_xfa_object.$finalize]() {
  60376. if (this[_xfa_object.$content] === "*") {
  60377. return;
  60378. }
  60379. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60380. }
  60381. }
  60382. class PageOffset extends _xfa_object.XFAObject {
  60383. constructor(attributes) {
  60384. super(CONFIG_NS_ID, "pageOffset");
  60385. this.x = (0, _utils.getInteger)({
  60386. data: attributes.x,
  60387. defaultValue: "useXDCSetting",
  60388. validate: n => true
  60389. });
  60390. this.y = (0, _utils.getInteger)({
  60391. data: attributes.y,
  60392. defaultValue: "useXDCSetting",
  60393. validate: n => true
  60394. });
  60395. }
  60396. }
  60397. class PageRange extends _xfa_object.StringObject {
  60398. constructor(attributes) {
  60399. super(CONFIG_NS_ID, "pageRange");
  60400. }
  60401. [_xfa_object.$finalize]() {
  60402. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60403. const ranges = [];
  60404. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60405. ranges.push(numbers.slice(i, i + 2));
  60406. }
  60407. this[_xfa_object.$content] = ranges;
  60408. }
  60409. }
  60410. class Pagination extends _xfa_object.OptionObject {
  60411. constructor(attributes) {
  60412. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60413. }
  60414. }
  60415. class PaginationOverride extends _xfa_object.OptionObject {
  60416. constructor(attributes) {
  60417. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60418. }
  60419. }
  60420. class Part extends _xfa_object.IntegerObject {
  60421. constructor(attributes) {
  60422. super(CONFIG_NS_ID, "part", 1, n => false);
  60423. }
  60424. }
  60425. class Pcl extends _xfa_object.XFAObject {
  60426. constructor(attributes) {
  60427. super(CONFIG_NS_ID, "pcl", true);
  60428. this.name = attributes.name || "";
  60429. this.batchOutput = null;
  60430. this.fontInfo = null;
  60431. this.jog = null;
  60432. this.mediumInfo = null;
  60433. this.outputBin = null;
  60434. this.pageOffset = null;
  60435. this.staple = null;
  60436. this.xdc = null;
  60437. }
  60438. }
  60439. class Pdf extends _xfa_object.XFAObject {
  60440. constructor(attributes) {
  60441. super(CONFIG_NS_ID, "pdf", true);
  60442. this.name = attributes.name || "";
  60443. this.adobeExtensionLevel = null;
  60444. this.batchOutput = null;
  60445. this.compression = null;
  60446. this.creator = null;
  60447. this.encryption = null;
  60448. this.fontInfo = null;
  60449. this.interactive = null;
  60450. this.linearized = null;
  60451. this.openAction = null;
  60452. this.pdfa = null;
  60453. this.producer = null;
  60454. this.renderPolicy = null;
  60455. this.scriptModel = null;
  60456. this.silentPrint = null;
  60457. this.submitFormat = null;
  60458. this.tagged = null;
  60459. this.version = null;
  60460. this.viewerPreferences = null;
  60461. this.xdc = null;
  60462. }
  60463. }
  60464. class Pdfa extends _xfa_object.XFAObject {
  60465. constructor(attributes) {
  60466. super(CONFIG_NS_ID, "pdfa", true);
  60467. this.amd = null;
  60468. this.conformance = null;
  60469. this.includeXDPContent = null;
  60470. this.part = null;
  60471. }
  60472. }
  60473. class Permissions extends _xfa_object.XFAObject {
  60474. constructor(attributes) {
  60475. super(CONFIG_NS_ID, "permissions", true);
  60476. this.accessibleContent = null;
  60477. this.change = null;
  60478. this.contentCopy = null;
  60479. this.documentAssembly = null;
  60480. this.formFieldFilling = null;
  60481. this.modifyAnnots = null;
  60482. this.plaintextMetadata = null;
  60483. this.print = null;
  60484. this.printHighQuality = null;
  60485. }
  60486. }
  60487. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60488. constructor(attributes) {
  60489. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60490. }
  60491. }
  60492. class Picture extends _xfa_object.StringObject {
  60493. constructor(attributes) {
  60494. super(CONFIG_NS_ID, "picture");
  60495. }
  60496. }
  60497. class PlaintextMetadata extends _xfa_object.Option01 {
  60498. constructor(attributes) {
  60499. super(CONFIG_NS_ID, "plaintextMetadata");
  60500. }
  60501. }
  60502. class Presence extends _xfa_object.OptionObject {
  60503. constructor(attributes) {
  60504. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60505. }
  60506. }
  60507. class Present extends _xfa_object.XFAObject {
  60508. constructor(attributes) {
  60509. super(CONFIG_NS_ID, "present", true);
  60510. this.behaviorOverride = null;
  60511. this.cache = null;
  60512. this.common = null;
  60513. this.copies = null;
  60514. this.destination = null;
  60515. this.incrementalMerge = null;
  60516. this.layout = null;
  60517. this.output = null;
  60518. this.overprint = null;
  60519. this.pagination = null;
  60520. this.paginationOverride = null;
  60521. this.script = null;
  60522. this.validate = null;
  60523. this.xdp = null;
  60524. this.driver = new _xfa_object.XFAObjectArray();
  60525. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60526. this.pcl = new _xfa_object.XFAObjectArray();
  60527. this.pdf = new _xfa_object.XFAObjectArray();
  60528. this.ps = new _xfa_object.XFAObjectArray();
  60529. this.submitUrl = new _xfa_object.XFAObjectArray();
  60530. this.webClient = new _xfa_object.XFAObjectArray();
  60531. this.zpl = new _xfa_object.XFAObjectArray();
  60532. }
  60533. }
  60534. class Print extends _xfa_object.Option01 {
  60535. constructor(attributes) {
  60536. super(CONFIG_NS_ID, "print");
  60537. }
  60538. }
  60539. class PrintHighQuality extends _xfa_object.Option01 {
  60540. constructor(attributes) {
  60541. super(CONFIG_NS_ID, "printHighQuality");
  60542. }
  60543. }
  60544. class PrintScaling extends _xfa_object.OptionObject {
  60545. constructor(attributes) {
  60546. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60547. }
  60548. }
  60549. class PrinterName extends _xfa_object.StringObject {
  60550. constructor(attributes) {
  60551. super(CONFIG_NS_ID, "printerName");
  60552. }
  60553. }
  60554. class Producer extends _xfa_object.StringObject {
  60555. constructor(attributes) {
  60556. super(CONFIG_NS_ID, "producer");
  60557. }
  60558. }
  60559. class Ps extends _xfa_object.XFAObject {
  60560. constructor(attributes) {
  60561. super(CONFIG_NS_ID, "ps", true);
  60562. this.name = attributes.name || "";
  60563. this.batchOutput = null;
  60564. this.fontInfo = null;
  60565. this.jog = null;
  60566. this.mediumInfo = null;
  60567. this.outputBin = null;
  60568. this.staple = null;
  60569. this.xdc = null;
  60570. }
  60571. }
  60572. class Range extends _xfa_object.ContentObject {
  60573. constructor(attributes) {
  60574. super(CONFIG_NS_ID, "range");
  60575. }
  60576. [_xfa_object.$finalize]() {
  60577. 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 => {
  60578. if (range.length === 1) {
  60579. range.push(range[0]);
  60580. }
  60581. return range;
  60582. });
  60583. }
  60584. }
  60585. class Record extends _xfa_object.ContentObject {
  60586. constructor(attributes) {
  60587. super(CONFIG_NS_ID, "record");
  60588. }
  60589. [_xfa_object.$finalize]() {
  60590. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60591. const n = parseInt(this[_xfa_object.$content], 10);
  60592. if (!isNaN(n) && n >= 0) {
  60593. this[_xfa_object.$content] = n;
  60594. }
  60595. }
  60596. }
  60597. class Relevant extends _xfa_object.ContentObject {
  60598. constructor(attributes) {
  60599. super(CONFIG_NS_ID, "relevant");
  60600. }
  60601. [_xfa_object.$finalize]() {
  60602. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  60603. }
  60604. }
  60605. class Rename extends _xfa_object.ContentObject {
  60606. constructor(attributes) {
  60607. super(CONFIG_NS_ID, "rename");
  60608. }
  60609. [_xfa_object.$finalize]() {
  60610. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60611. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  60612. (0, _util.warn)("XFA - Rename: invalid XFA name");
  60613. }
  60614. }
  60615. }
  60616. class RenderPolicy extends _xfa_object.OptionObject {
  60617. constructor(attributes) {
  60618. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  60619. }
  60620. }
  60621. class RunScripts extends _xfa_object.OptionObject {
  60622. constructor(attributes) {
  60623. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  60624. }
  60625. }
  60626. class Script extends _xfa_object.XFAObject {
  60627. constructor(attributes) {
  60628. super(CONFIG_NS_ID, "script", true);
  60629. this.currentPage = null;
  60630. this.exclude = null;
  60631. this.runScripts = null;
  60632. }
  60633. }
  60634. class ScriptModel extends _xfa_object.OptionObject {
  60635. constructor(attributes) {
  60636. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  60637. }
  60638. }
  60639. class Severity extends _xfa_object.OptionObject {
  60640. constructor(attributes) {
  60641. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  60642. }
  60643. }
  60644. class SilentPrint extends _xfa_object.XFAObject {
  60645. constructor(attributes) {
  60646. super(CONFIG_NS_ID, "silentPrint", true);
  60647. this.addSilentPrint = null;
  60648. this.printerName = null;
  60649. }
  60650. }
  60651. class Staple extends _xfa_object.XFAObject {
  60652. constructor(attributes) {
  60653. super(CONFIG_NS_ID, "staple");
  60654. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  60655. }
  60656. }
  60657. class StartNode extends _xfa_object.StringObject {
  60658. constructor(attributes) {
  60659. super(CONFIG_NS_ID, "startNode");
  60660. }
  60661. }
  60662. class StartPage extends _xfa_object.IntegerObject {
  60663. constructor(attributes) {
  60664. super(CONFIG_NS_ID, "startPage", 0, n => true);
  60665. }
  60666. }
  60667. class SubmitFormat extends _xfa_object.OptionObject {
  60668. constructor(attributes) {
  60669. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  60670. }
  60671. }
  60672. class SubmitUrl extends _xfa_object.StringObject {
  60673. constructor(attributes) {
  60674. super(CONFIG_NS_ID, "submitUrl");
  60675. }
  60676. }
  60677. class SubsetBelow extends _xfa_object.IntegerObject {
  60678. constructor(attributes) {
  60679. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  60680. }
  60681. }
  60682. class SuppressBanner extends _xfa_object.Option01 {
  60683. constructor(attributes) {
  60684. super(CONFIG_NS_ID, "suppressBanner");
  60685. }
  60686. }
  60687. class Tagged extends _xfa_object.Option01 {
  60688. constructor(attributes) {
  60689. super(CONFIG_NS_ID, "tagged");
  60690. }
  60691. }
  60692. class Template extends _xfa_object.XFAObject {
  60693. constructor(attributes) {
  60694. super(CONFIG_NS_ID, "template", true);
  60695. this.base = null;
  60696. this.relevant = null;
  60697. this.startPage = null;
  60698. this.uri = null;
  60699. this.xsl = null;
  60700. }
  60701. }
  60702. class Threshold extends _xfa_object.OptionObject {
  60703. constructor(attributes) {
  60704. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  60705. }
  60706. }
  60707. class To extends _xfa_object.OptionObject {
  60708. constructor(attributes) {
  60709. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  60710. }
  60711. }
  60712. class TemplateCache extends _xfa_object.XFAObject {
  60713. constructor(attributes) {
  60714. super(CONFIG_NS_ID, "templateCache");
  60715. this.maxEntries = (0, _utils.getInteger)({
  60716. data: attributes.maxEntries,
  60717. defaultValue: 5,
  60718. validate: n => n >= 0
  60719. });
  60720. }
  60721. }
  60722. class Trace extends _xfa_object.XFAObject {
  60723. constructor(attributes) {
  60724. super(CONFIG_NS_ID, "trace", true);
  60725. this.area = new _xfa_object.XFAObjectArray();
  60726. }
  60727. }
  60728. class Transform extends _xfa_object.XFAObject {
  60729. constructor(attributes) {
  60730. super(CONFIG_NS_ID, "transform", true);
  60731. this.groupParent = null;
  60732. this.ifEmpty = null;
  60733. this.nameAttr = null;
  60734. this.picture = null;
  60735. this.presence = null;
  60736. this.rename = null;
  60737. this.whitespace = null;
  60738. }
  60739. }
  60740. class Type extends _xfa_object.OptionObject {
  60741. constructor(attributes) {
  60742. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  60743. }
  60744. }
  60745. class Uri extends _xfa_object.StringObject {
  60746. constructor(attributes) {
  60747. super(CONFIG_NS_ID, "uri");
  60748. }
  60749. }
  60750. class Validate extends _xfa_object.OptionObject {
  60751. constructor(attributes) {
  60752. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  60753. }
  60754. }
  60755. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  60756. constructor(attributes) {
  60757. super(CONFIG_NS_ID, "validateApprovalSignatures");
  60758. }
  60759. [_xfa_object.$finalize]() {
  60760. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  60761. }
  60762. }
  60763. class ValidationMessaging extends _xfa_object.OptionObject {
  60764. constructor(attributes) {
  60765. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  60766. }
  60767. }
  60768. class Version extends _xfa_object.OptionObject {
  60769. constructor(attributes) {
  60770. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  60771. }
  60772. }
  60773. class VersionControl extends _xfa_object.XFAObject {
  60774. constructor(attributes) {
  60775. super(CONFIG_NS_ID, "VersionControl");
  60776. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  60777. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  60778. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  60779. }
  60780. }
  60781. class ViewerPreferences extends _xfa_object.XFAObject {
  60782. constructor(attributes) {
  60783. super(CONFIG_NS_ID, "viewerPreferences", true);
  60784. this.ADBE_JSConsole = null;
  60785. this.ADBE_JSDebugger = null;
  60786. this.addViewerPreferences = null;
  60787. this.duplexOption = null;
  60788. this.enforce = null;
  60789. this.numberOfCopies = null;
  60790. this.pageRange = null;
  60791. this.pickTrayByPDFSize = null;
  60792. this.printScaling = null;
  60793. }
  60794. }
  60795. class WebClient extends _xfa_object.XFAObject {
  60796. constructor(attributes) {
  60797. super(CONFIG_NS_ID, "webClient", true);
  60798. this.name = attributes.name ? attributes.name.trim() : "";
  60799. this.fontInfo = null;
  60800. this.xdc = null;
  60801. }
  60802. }
  60803. class Whitespace extends _xfa_object.OptionObject {
  60804. constructor(attributes) {
  60805. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  60806. }
  60807. }
  60808. class Window extends _xfa_object.ContentObject {
  60809. constructor(attributes) {
  60810. super(CONFIG_NS_ID, "window");
  60811. }
  60812. [_xfa_object.$finalize]() {
  60813. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  60814. if (pair.some(x => isNaN(x))) {
  60815. this[_xfa_object.$content] = [0, 0];
  60816. return;
  60817. }
  60818. if (pair.length === 1) {
  60819. pair.push(pair[0]);
  60820. }
  60821. this[_xfa_object.$content] = pair;
  60822. }
  60823. }
  60824. class Xdc extends _xfa_object.XFAObject {
  60825. constructor(attributes) {
  60826. super(CONFIG_NS_ID, "xdc", true);
  60827. this.uri = new _xfa_object.XFAObjectArray();
  60828. this.xsl = new _xfa_object.XFAObjectArray();
  60829. }
  60830. }
  60831. class Xdp extends _xfa_object.XFAObject {
  60832. constructor(attributes) {
  60833. super(CONFIG_NS_ID, "xdp", true);
  60834. this.packets = null;
  60835. }
  60836. }
  60837. class Xsl extends _xfa_object.XFAObject {
  60838. constructor(attributes) {
  60839. super(CONFIG_NS_ID, "xsl", true);
  60840. this.debug = null;
  60841. this.uri = null;
  60842. }
  60843. }
  60844. class Zpl extends _xfa_object.XFAObject {
  60845. constructor(attributes) {
  60846. super(CONFIG_NS_ID, "zpl", true);
  60847. this.name = attributes.name ? attributes.name.trim() : "";
  60848. this.batchOutput = null;
  60849. this.flipLabel = null;
  60850. this.fontInfo = null;
  60851. this.xdc = null;
  60852. }
  60853. }
  60854. class ConfigNamespace {
  60855. static [_namespaces.$buildXFAObject](name, attributes) {
  60856. if (ConfigNamespace.hasOwnProperty(name)) {
  60857. return ConfigNamespace[name](attributes);
  60858. }
  60859. return undefined;
  60860. }
  60861. static acrobat(attrs) {
  60862. return new Acrobat(attrs);
  60863. }
  60864. static acrobat7(attrs) {
  60865. return new Acrobat7(attrs);
  60866. }
  60867. static ADBE_JSConsole(attrs) {
  60868. return new ADBE_JSConsole(attrs);
  60869. }
  60870. static ADBE_JSDebugger(attrs) {
  60871. return new ADBE_JSDebugger(attrs);
  60872. }
  60873. static addSilentPrint(attrs) {
  60874. return new AddSilentPrint(attrs);
  60875. }
  60876. static addViewerPreferences(attrs) {
  60877. return new AddViewerPreferences(attrs);
  60878. }
  60879. static adjustData(attrs) {
  60880. return new AdjustData(attrs);
  60881. }
  60882. static adobeExtensionLevel(attrs) {
  60883. return new AdobeExtensionLevel(attrs);
  60884. }
  60885. static agent(attrs) {
  60886. return new Agent(attrs);
  60887. }
  60888. static alwaysEmbed(attrs) {
  60889. return new AlwaysEmbed(attrs);
  60890. }
  60891. static amd(attrs) {
  60892. return new Amd(attrs);
  60893. }
  60894. static area(attrs) {
  60895. return new Area(attrs);
  60896. }
  60897. static attributes(attrs) {
  60898. return new Attributes(attrs);
  60899. }
  60900. static autoSave(attrs) {
  60901. return new AutoSave(attrs);
  60902. }
  60903. static base(attrs) {
  60904. return new Base(attrs);
  60905. }
  60906. static batchOutput(attrs) {
  60907. return new BatchOutput(attrs);
  60908. }
  60909. static behaviorOverride(attrs) {
  60910. return new BehaviorOverride(attrs);
  60911. }
  60912. static cache(attrs) {
  60913. return new Cache(attrs);
  60914. }
  60915. static change(attrs) {
  60916. return new Change(attrs);
  60917. }
  60918. static common(attrs) {
  60919. return new Common(attrs);
  60920. }
  60921. static compress(attrs) {
  60922. return new Compress(attrs);
  60923. }
  60924. static compressLogicalStructure(attrs) {
  60925. return new CompressLogicalStructure(attrs);
  60926. }
  60927. static compressObjectStream(attrs) {
  60928. return new CompressObjectStream(attrs);
  60929. }
  60930. static compression(attrs) {
  60931. return new Compression(attrs);
  60932. }
  60933. static config(attrs) {
  60934. return new Config(attrs);
  60935. }
  60936. static conformance(attrs) {
  60937. return new Conformance(attrs);
  60938. }
  60939. static contentCopy(attrs) {
  60940. return new ContentCopy(attrs);
  60941. }
  60942. static copies(attrs) {
  60943. return new Copies(attrs);
  60944. }
  60945. static creator(attrs) {
  60946. return new Creator(attrs);
  60947. }
  60948. static currentPage(attrs) {
  60949. return new CurrentPage(attrs);
  60950. }
  60951. static data(attrs) {
  60952. return new Data(attrs);
  60953. }
  60954. static debug(attrs) {
  60955. return new Debug(attrs);
  60956. }
  60957. static defaultTypeface(attrs) {
  60958. return new DefaultTypeface(attrs);
  60959. }
  60960. static destination(attrs) {
  60961. return new Destination(attrs);
  60962. }
  60963. static documentAssembly(attrs) {
  60964. return new DocumentAssembly(attrs);
  60965. }
  60966. static driver(attrs) {
  60967. return new Driver(attrs);
  60968. }
  60969. static duplexOption(attrs) {
  60970. return new DuplexOption(attrs);
  60971. }
  60972. static dynamicRender(attrs) {
  60973. return new DynamicRender(attrs);
  60974. }
  60975. static embed(attrs) {
  60976. return new Embed(attrs);
  60977. }
  60978. static encrypt(attrs) {
  60979. return new Encrypt(attrs);
  60980. }
  60981. static encryption(attrs) {
  60982. return new Encryption(attrs);
  60983. }
  60984. static encryptionLevel(attrs) {
  60985. return new EncryptionLevel(attrs);
  60986. }
  60987. static enforce(attrs) {
  60988. return new Enforce(attrs);
  60989. }
  60990. static equate(attrs) {
  60991. return new Equate(attrs);
  60992. }
  60993. static equateRange(attrs) {
  60994. return new EquateRange(attrs);
  60995. }
  60996. static exclude(attrs) {
  60997. return new Exclude(attrs);
  60998. }
  60999. static excludeNS(attrs) {
  61000. return new ExcludeNS(attrs);
  61001. }
  61002. static flipLabel(attrs) {
  61003. return new FlipLabel(attrs);
  61004. }
  61005. static fontInfo(attrs) {
  61006. return new FontInfo(attrs);
  61007. }
  61008. static formFieldFilling(attrs) {
  61009. return new FormFieldFilling(attrs);
  61010. }
  61011. static groupParent(attrs) {
  61012. return new GroupParent(attrs);
  61013. }
  61014. static ifEmpty(attrs) {
  61015. return new IfEmpty(attrs);
  61016. }
  61017. static includeXDPContent(attrs) {
  61018. return new IncludeXDPContent(attrs);
  61019. }
  61020. static incrementalLoad(attrs) {
  61021. return new IncrementalLoad(attrs);
  61022. }
  61023. static incrementalMerge(attrs) {
  61024. return new IncrementalMerge(attrs);
  61025. }
  61026. static interactive(attrs) {
  61027. return new Interactive(attrs);
  61028. }
  61029. static jog(attrs) {
  61030. return new Jog(attrs);
  61031. }
  61032. static labelPrinter(attrs) {
  61033. return new LabelPrinter(attrs);
  61034. }
  61035. static layout(attrs) {
  61036. return new Layout(attrs);
  61037. }
  61038. static level(attrs) {
  61039. return new Level(attrs);
  61040. }
  61041. static linearized(attrs) {
  61042. return new Linearized(attrs);
  61043. }
  61044. static locale(attrs) {
  61045. return new Locale(attrs);
  61046. }
  61047. static localeSet(attrs) {
  61048. return new LocaleSet(attrs);
  61049. }
  61050. static log(attrs) {
  61051. return new Log(attrs);
  61052. }
  61053. static map(attrs) {
  61054. return new MapElement(attrs);
  61055. }
  61056. static mediumInfo(attrs) {
  61057. return new MediumInfo(attrs);
  61058. }
  61059. static message(attrs) {
  61060. return new Message(attrs);
  61061. }
  61062. static messaging(attrs) {
  61063. return new Messaging(attrs);
  61064. }
  61065. static mode(attrs) {
  61066. return new Mode(attrs);
  61067. }
  61068. static modifyAnnots(attrs) {
  61069. return new ModifyAnnots(attrs);
  61070. }
  61071. static msgId(attrs) {
  61072. return new MsgId(attrs);
  61073. }
  61074. static nameAttr(attrs) {
  61075. return new NameAttr(attrs);
  61076. }
  61077. static neverEmbed(attrs) {
  61078. return new NeverEmbed(attrs);
  61079. }
  61080. static numberOfCopies(attrs) {
  61081. return new NumberOfCopies(attrs);
  61082. }
  61083. static openAction(attrs) {
  61084. return new OpenAction(attrs);
  61085. }
  61086. static output(attrs) {
  61087. return new Output(attrs);
  61088. }
  61089. static outputBin(attrs) {
  61090. return new OutputBin(attrs);
  61091. }
  61092. static outputXSL(attrs) {
  61093. return new OutputXSL(attrs);
  61094. }
  61095. static overprint(attrs) {
  61096. return new Overprint(attrs);
  61097. }
  61098. static packets(attrs) {
  61099. return new Packets(attrs);
  61100. }
  61101. static pageOffset(attrs) {
  61102. return new PageOffset(attrs);
  61103. }
  61104. static pageRange(attrs) {
  61105. return new PageRange(attrs);
  61106. }
  61107. static pagination(attrs) {
  61108. return new Pagination(attrs);
  61109. }
  61110. static paginationOverride(attrs) {
  61111. return new PaginationOverride(attrs);
  61112. }
  61113. static part(attrs) {
  61114. return new Part(attrs);
  61115. }
  61116. static pcl(attrs) {
  61117. return new Pcl(attrs);
  61118. }
  61119. static pdf(attrs) {
  61120. return new Pdf(attrs);
  61121. }
  61122. static pdfa(attrs) {
  61123. return new Pdfa(attrs);
  61124. }
  61125. static permissions(attrs) {
  61126. return new Permissions(attrs);
  61127. }
  61128. static pickTrayByPDFSize(attrs) {
  61129. return new PickTrayByPDFSize(attrs);
  61130. }
  61131. static picture(attrs) {
  61132. return new Picture(attrs);
  61133. }
  61134. static plaintextMetadata(attrs) {
  61135. return new PlaintextMetadata(attrs);
  61136. }
  61137. static presence(attrs) {
  61138. return new Presence(attrs);
  61139. }
  61140. static present(attrs) {
  61141. return new Present(attrs);
  61142. }
  61143. static print(attrs) {
  61144. return new Print(attrs);
  61145. }
  61146. static printHighQuality(attrs) {
  61147. return new PrintHighQuality(attrs);
  61148. }
  61149. static printScaling(attrs) {
  61150. return new PrintScaling(attrs);
  61151. }
  61152. static printerName(attrs) {
  61153. return new PrinterName(attrs);
  61154. }
  61155. static producer(attrs) {
  61156. return new Producer(attrs);
  61157. }
  61158. static ps(attrs) {
  61159. return new Ps(attrs);
  61160. }
  61161. static range(attrs) {
  61162. return new Range(attrs);
  61163. }
  61164. static record(attrs) {
  61165. return new Record(attrs);
  61166. }
  61167. static relevant(attrs) {
  61168. return new Relevant(attrs);
  61169. }
  61170. static rename(attrs) {
  61171. return new Rename(attrs);
  61172. }
  61173. static renderPolicy(attrs) {
  61174. return new RenderPolicy(attrs);
  61175. }
  61176. static runScripts(attrs) {
  61177. return new RunScripts(attrs);
  61178. }
  61179. static script(attrs) {
  61180. return new Script(attrs);
  61181. }
  61182. static scriptModel(attrs) {
  61183. return new ScriptModel(attrs);
  61184. }
  61185. static severity(attrs) {
  61186. return new Severity(attrs);
  61187. }
  61188. static silentPrint(attrs) {
  61189. return new SilentPrint(attrs);
  61190. }
  61191. static staple(attrs) {
  61192. return new Staple(attrs);
  61193. }
  61194. static startNode(attrs) {
  61195. return new StartNode(attrs);
  61196. }
  61197. static startPage(attrs) {
  61198. return new StartPage(attrs);
  61199. }
  61200. static submitFormat(attrs) {
  61201. return new SubmitFormat(attrs);
  61202. }
  61203. static submitUrl(attrs) {
  61204. return new SubmitUrl(attrs);
  61205. }
  61206. static subsetBelow(attrs) {
  61207. return new SubsetBelow(attrs);
  61208. }
  61209. static suppressBanner(attrs) {
  61210. return new SuppressBanner(attrs);
  61211. }
  61212. static tagged(attrs) {
  61213. return new Tagged(attrs);
  61214. }
  61215. static template(attrs) {
  61216. return new Template(attrs);
  61217. }
  61218. static templateCache(attrs) {
  61219. return new TemplateCache(attrs);
  61220. }
  61221. static threshold(attrs) {
  61222. return new Threshold(attrs);
  61223. }
  61224. static to(attrs) {
  61225. return new To(attrs);
  61226. }
  61227. static trace(attrs) {
  61228. return new Trace(attrs);
  61229. }
  61230. static transform(attrs) {
  61231. return new Transform(attrs);
  61232. }
  61233. static type(attrs) {
  61234. return new Type(attrs);
  61235. }
  61236. static uri(attrs) {
  61237. return new Uri(attrs);
  61238. }
  61239. static validate(attrs) {
  61240. return new Validate(attrs);
  61241. }
  61242. static validateApprovalSignatures(attrs) {
  61243. return new ValidateApprovalSignatures(attrs);
  61244. }
  61245. static validationMessaging(attrs) {
  61246. return new ValidationMessaging(attrs);
  61247. }
  61248. static version(attrs) {
  61249. return new Version(attrs);
  61250. }
  61251. static versionControl(attrs) {
  61252. return new VersionControl(attrs);
  61253. }
  61254. static viewerPreferences(attrs) {
  61255. return new ViewerPreferences(attrs);
  61256. }
  61257. static webClient(attrs) {
  61258. return new WebClient(attrs);
  61259. }
  61260. static whitespace(attrs) {
  61261. return new Whitespace(attrs);
  61262. }
  61263. static window(attrs) {
  61264. return new Window(attrs);
  61265. }
  61266. static xdc(attrs) {
  61267. return new Xdc(attrs);
  61268. }
  61269. static xdp(attrs) {
  61270. return new Xdp(attrs);
  61271. }
  61272. static xsl(attrs) {
  61273. return new Xsl(attrs);
  61274. }
  61275. static zpl(attrs) {
  61276. return new Zpl(attrs);
  61277. }
  61278. }
  61279. exports.ConfigNamespace = ConfigNamespace;
  61280. /***/ }),
  61281. /* 90 */
  61282. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61283. Object.defineProperty(exports, "__esModule", ({
  61284. value: true
  61285. }));
  61286. exports.ConnectionSetNamespace = void 0;
  61287. var _namespaces = __w_pdfjs_require__(77);
  61288. var _xfa_object = __w_pdfjs_require__(75);
  61289. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61290. class ConnectionSet extends _xfa_object.XFAObject {
  61291. constructor(attributes) {
  61292. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61293. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61294. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61295. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61296. }
  61297. }
  61298. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61299. constructor(attributes) {
  61300. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61301. this.id = attributes.id || "";
  61302. this.name = attributes.name || "";
  61303. this.use = attributes.use || "";
  61304. this.usehref = attributes.usehref || "";
  61305. }
  61306. }
  61307. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61308. constructor(attributes) {
  61309. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61310. this.id = attributes.id || "";
  61311. this.name = attributes.name || "";
  61312. this.use = attributes.use || "";
  61313. this.usehref = attributes.usehref || "";
  61314. }
  61315. }
  61316. class Operation extends _xfa_object.StringObject {
  61317. constructor(attributes) {
  61318. super(CONNECTION_SET_NS_ID, "operation");
  61319. this.id = attributes.id || "";
  61320. this.input = attributes.input || "";
  61321. this.name = attributes.name || "";
  61322. this.output = attributes.output || "";
  61323. this.use = attributes.use || "";
  61324. this.usehref = attributes.usehref || "";
  61325. }
  61326. }
  61327. class RootElement extends _xfa_object.StringObject {
  61328. constructor(attributes) {
  61329. super(CONNECTION_SET_NS_ID, "rootElement");
  61330. this.id = attributes.id || "";
  61331. this.name = attributes.name || "";
  61332. this.use = attributes.use || "";
  61333. this.usehref = attributes.usehref || "";
  61334. }
  61335. }
  61336. class SoapAction extends _xfa_object.StringObject {
  61337. constructor(attributes) {
  61338. super(CONNECTION_SET_NS_ID, "soapAction");
  61339. this.id = attributes.id || "";
  61340. this.name = attributes.name || "";
  61341. this.use = attributes.use || "";
  61342. this.usehref = attributes.usehref || "";
  61343. }
  61344. }
  61345. class SoapAddress extends _xfa_object.StringObject {
  61346. constructor(attributes) {
  61347. super(CONNECTION_SET_NS_ID, "soapAddress");
  61348. this.id = attributes.id || "";
  61349. this.name = attributes.name || "";
  61350. this.use = attributes.use || "";
  61351. this.usehref = attributes.usehref || "";
  61352. }
  61353. }
  61354. class Uri extends _xfa_object.StringObject {
  61355. constructor(attributes) {
  61356. super(CONNECTION_SET_NS_ID, "uri");
  61357. this.id = attributes.id || "";
  61358. this.name = attributes.name || "";
  61359. this.use = attributes.use || "";
  61360. this.usehref = attributes.usehref || "";
  61361. }
  61362. }
  61363. class WsdlAddress extends _xfa_object.StringObject {
  61364. constructor(attributes) {
  61365. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61366. this.id = attributes.id || "";
  61367. this.name = attributes.name || "";
  61368. this.use = attributes.use || "";
  61369. this.usehref = attributes.usehref || "";
  61370. }
  61371. }
  61372. class WsdlConnection extends _xfa_object.XFAObject {
  61373. constructor(attributes) {
  61374. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61375. this.dataDescription = attributes.dataDescription || "";
  61376. this.name = attributes.name || "";
  61377. this.effectiveInputPolicy = null;
  61378. this.effectiveOutputPolicy = null;
  61379. this.operation = null;
  61380. this.soapAction = null;
  61381. this.soapAddress = null;
  61382. this.wsdlAddress = null;
  61383. }
  61384. }
  61385. class XmlConnection extends _xfa_object.XFAObject {
  61386. constructor(attributes) {
  61387. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61388. this.dataDescription = attributes.dataDescription || "";
  61389. this.name = attributes.name || "";
  61390. this.uri = null;
  61391. }
  61392. }
  61393. class XsdConnection extends _xfa_object.XFAObject {
  61394. constructor(attributes) {
  61395. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61396. this.dataDescription = attributes.dataDescription || "";
  61397. this.name = attributes.name || "";
  61398. this.rootElement = null;
  61399. this.uri = null;
  61400. }
  61401. }
  61402. class ConnectionSetNamespace {
  61403. static [_namespaces.$buildXFAObject](name, attributes) {
  61404. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61405. return ConnectionSetNamespace[name](attributes);
  61406. }
  61407. return undefined;
  61408. }
  61409. static connectionSet(attrs) {
  61410. return new ConnectionSet(attrs);
  61411. }
  61412. static effectiveInputPolicy(attrs) {
  61413. return new EffectiveInputPolicy(attrs);
  61414. }
  61415. static effectiveOutputPolicy(attrs) {
  61416. return new EffectiveOutputPolicy(attrs);
  61417. }
  61418. static operation(attrs) {
  61419. return new Operation(attrs);
  61420. }
  61421. static rootElement(attrs) {
  61422. return new RootElement(attrs);
  61423. }
  61424. static soapAction(attrs) {
  61425. return new SoapAction(attrs);
  61426. }
  61427. static soapAddress(attrs) {
  61428. return new SoapAddress(attrs);
  61429. }
  61430. static uri(attrs) {
  61431. return new Uri(attrs);
  61432. }
  61433. static wsdlAddress(attrs) {
  61434. return new WsdlAddress(attrs);
  61435. }
  61436. static wsdlConnection(attrs) {
  61437. return new WsdlConnection(attrs);
  61438. }
  61439. static xmlConnection(attrs) {
  61440. return new XmlConnection(attrs);
  61441. }
  61442. static xsdConnection(attrs) {
  61443. return new XsdConnection(attrs);
  61444. }
  61445. }
  61446. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61447. /***/ }),
  61448. /* 91 */
  61449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61450. Object.defineProperty(exports, "__esModule", ({
  61451. value: true
  61452. }));
  61453. exports.DatasetsNamespace = void 0;
  61454. var _xfa_object = __w_pdfjs_require__(75);
  61455. var _namespaces = __w_pdfjs_require__(77);
  61456. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61457. class Data extends _xfa_object.XmlObject {
  61458. constructor(attributes) {
  61459. super(DATASETS_NS_ID, "data", attributes);
  61460. }
  61461. [_xfa_object.$isNsAgnostic]() {
  61462. return true;
  61463. }
  61464. }
  61465. class Datasets extends _xfa_object.XFAObject {
  61466. constructor(attributes) {
  61467. super(DATASETS_NS_ID, "datasets", true);
  61468. this.data = null;
  61469. this.Signature = null;
  61470. }
  61471. [_xfa_object.$onChild](child) {
  61472. const name = child[_xfa_object.$nodeName];
  61473. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61474. this[name] = child;
  61475. }
  61476. this[_xfa_object.$appendChild](child);
  61477. }
  61478. }
  61479. class DatasetsNamespace {
  61480. static [_namespaces.$buildXFAObject](name, attributes) {
  61481. if (DatasetsNamespace.hasOwnProperty(name)) {
  61482. return DatasetsNamespace[name](attributes);
  61483. }
  61484. return undefined;
  61485. }
  61486. static datasets(attributes) {
  61487. return new Datasets(attributes);
  61488. }
  61489. static data(attributes) {
  61490. return new Data(attributes);
  61491. }
  61492. }
  61493. exports.DatasetsNamespace = DatasetsNamespace;
  61494. /***/ }),
  61495. /* 92 */
  61496. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61497. Object.defineProperty(exports, "__esModule", ({
  61498. value: true
  61499. }));
  61500. exports.LocaleSetNamespace = void 0;
  61501. var _namespaces = __w_pdfjs_require__(77);
  61502. var _xfa_object = __w_pdfjs_require__(75);
  61503. var _utils = __w_pdfjs_require__(76);
  61504. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61505. class CalendarSymbols extends _xfa_object.XFAObject {
  61506. constructor(attributes) {
  61507. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61508. this.name = "gregorian";
  61509. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61510. this.eraNames = null;
  61511. this.meridiemNames = null;
  61512. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61513. }
  61514. }
  61515. class CurrencySymbol extends _xfa_object.StringObject {
  61516. constructor(attributes) {
  61517. super(LOCALE_SET_NS_ID, "currencySymbol");
  61518. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61519. }
  61520. }
  61521. class CurrencySymbols extends _xfa_object.XFAObject {
  61522. constructor(attributes) {
  61523. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61524. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61525. }
  61526. }
  61527. class DatePattern extends _xfa_object.StringObject {
  61528. constructor(attributes) {
  61529. super(LOCALE_SET_NS_ID, "datePattern");
  61530. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61531. }
  61532. }
  61533. class DatePatterns extends _xfa_object.XFAObject {
  61534. constructor(attributes) {
  61535. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61536. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61537. }
  61538. }
  61539. class DateTimeSymbols extends _xfa_object.ContentObject {
  61540. constructor(attributes) {
  61541. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61542. }
  61543. }
  61544. class Day extends _xfa_object.StringObject {
  61545. constructor(attributes) {
  61546. super(LOCALE_SET_NS_ID, "day");
  61547. }
  61548. }
  61549. class DayNames extends _xfa_object.XFAObject {
  61550. constructor(attributes) {
  61551. super(LOCALE_SET_NS_ID, "dayNames", true);
  61552. this.abbr = (0, _utils.getInteger)({
  61553. data: attributes.abbr,
  61554. defaultValue: 0,
  61555. validate: x => x === 1
  61556. });
  61557. this.day = new _xfa_object.XFAObjectArray(7);
  61558. }
  61559. }
  61560. class Era extends _xfa_object.StringObject {
  61561. constructor(attributes) {
  61562. super(LOCALE_SET_NS_ID, "era");
  61563. }
  61564. }
  61565. class EraNames extends _xfa_object.XFAObject {
  61566. constructor(attributes) {
  61567. super(LOCALE_SET_NS_ID, "eraNames", true);
  61568. this.era = new _xfa_object.XFAObjectArray(2);
  61569. }
  61570. }
  61571. class Locale extends _xfa_object.XFAObject {
  61572. constructor(attributes) {
  61573. super(LOCALE_SET_NS_ID, "locale", true);
  61574. this.desc = attributes.desc || "";
  61575. this.name = "isoname";
  61576. this.calendarSymbols = null;
  61577. this.currencySymbols = null;
  61578. this.datePatterns = null;
  61579. this.dateTimeSymbols = null;
  61580. this.numberPatterns = null;
  61581. this.numberSymbols = null;
  61582. this.timePatterns = null;
  61583. this.typeFaces = null;
  61584. }
  61585. }
  61586. class LocaleSet extends _xfa_object.XFAObject {
  61587. constructor(attributes) {
  61588. super(LOCALE_SET_NS_ID, "localeSet", true);
  61589. this.locale = new _xfa_object.XFAObjectArray();
  61590. }
  61591. }
  61592. class Meridiem extends _xfa_object.StringObject {
  61593. constructor(attributes) {
  61594. super(LOCALE_SET_NS_ID, "meridiem");
  61595. }
  61596. }
  61597. class MeridiemNames extends _xfa_object.XFAObject {
  61598. constructor(attributes) {
  61599. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  61600. this.meridiem = new _xfa_object.XFAObjectArray(2);
  61601. }
  61602. }
  61603. class Month extends _xfa_object.StringObject {
  61604. constructor(attributes) {
  61605. super(LOCALE_SET_NS_ID, "month");
  61606. }
  61607. }
  61608. class MonthNames extends _xfa_object.XFAObject {
  61609. constructor(attributes) {
  61610. super(LOCALE_SET_NS_ID, "monthNames", true);
  61611. this.abbr = (0, _utils.getInteger)({
  61612. data: attributes.abbr,
  61613. defaultValue: 0,
  61614. validate: x => x === 1
  61615. });
  61616. this.month = new _xfa_object.XFAObjectArray(12);
  61617. }
  61618. }
  61619. class NumberPattern extends _xfa_object.StringObject {
  61620. constructor(attributes) {
  61621. super(LOCALE_SET_NS_ID, "numberPattern");
  61622. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61623. }
  61624. }
  61625. class NumberPatterns extends _xfa_object.XFAObject {
  61626. constructor(attributes) {
  61627. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  61628. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  61629. }
  61630. }
  61631. class NumberSymbol extends _xfa_object.StringObject {
  61632. constructor(attributes) {
  61633. super(LOCALE_SET_NS_ID, "numberSymbol");
  61634. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  61635. }
  61636. }
  61637. class NumberSymbols extends _xfa_object.XFAObject {
  61638. constructor(attributes) {
  61639. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  61640. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  61641. }
  61642. }
  61643. class TimePattern extends _xfa_object.StringObject {
  61644. constructor(attributes) {
  61645. super(LOCALE_SET_NS_ID, "timePattern");
  61646. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61647. }
  61648. }
  61649. class TimePatterns extends _xfa_object.XFAObject {
  61650. constructor(attributes) {
  61651. super(LOCALE_SET_NS_ID, "timePatterns", true);
  61652. this.timePattern = new _xfa_object.XFAObjectArray(4);
  61653. }
  61654. }
  61655. class TypeFace extends _xfa_object.XFAObject {
  61656. constructor(attributes) {
  61657. super(LOCALE_SET_NS_ID, "typeFace", true);
  61658. this.name = attributes.name | "";
  61659. }
  61660. }
  61661. class TypeFaces extends _xfa_object.XFAObject {
  61662. constructor(attributes) {
  61663. super(LOCALE_SET_NS_ID, "typeFaces", true);
  61664. this.typeFace = new _xfa_object.XFAObjectArray();
  61665. }
  61666. }
  61667. class LocaleSetNamespace {
  61668. static [_namespaces.$buildXFAObject](name, attributes) {
  61669. if (LocaleSetNamespace.hasOwnProperty(name)) {
  61670. return LocaleSetNamespace[name](attributes);
  61671. }
  61672. return undefined;
  61673. }
  61674. static calendarSymbols(attrs) {
  61675. return new CalendarSymbols(attrs);
  61676. }
  61677. static currencySymbol(attrs) {
  61678. return new CurrencySymbol(attrs);
  61679. }
  61680. static currencySymbols(attrs) {
  61681. return new CurrencySymbols(attrs);
  61682. }
  61683. static datePattern(attrs) {
  61684. return new DatePattern(attrs);
  61685. }
  61686. static datePatterns(attrs) {
  61687. return new DatePatterns(attrs);
  61688. }
  61689. static dateTimeSymbols(attrs) {
  61690. return new DateTimeSymbols(attrs);
  61691. }
  61692. static day(attrs) {
  61693. return new Day(attrs);
  61694. }
  61695. static dayNames(attrs) {
  61696. return new DayNames(attrs);
  61697. }
  61698. static era(attrs) {
  61699. return new Era(attrs);
  61700. }
  61701. static eraNames(attrs) {
  61702. return new EraNames(attrs);
  61703. }
  61704. static locale(attrs) {
  61705. return new Locale(attrs);
  61706. }
  61707. static localeSet(attrs) {
  61708. return new LocaleSet(attrs);
  61709. }
  61710. static meridiem(attrs) {
  61711. return new Meridiem(attrs);
  61712. }
  61713. static meridiemNames(attrs) {
  61714. return new MeridiemNames(attrs);
  61715. }
  61716. static month(attrs) {
  61717. return new Month(attrs);
  61718. }
  61719. static monthNames(attrs) {
  61720. return new MonthNames(attrs);
  61721. }
  61722. static numberPattern(attrs) {
  61723. return new NumberPattern(attrs);
  61724. }
  61725. static numberPatterns(attrs) {
  61726. return new NumberPatterns(attrs);
  61727. }
  61728. static numberSymbol(attrs) {
  61729. return new NumberSymbol(attrs);
  61730. }
  61731. static numberSymbols(attrs) {
  61732. return new NumberSymbols(attrs);
  61733. }
  61734. static timePattern(attrs) {
  61735. return new TimePattern(attrs);
  61736. }
  61737. static timePatterns(attrs) {
  61738. return new TimePatterns(attrs);
  61739. }
  61740. static typeFace(attrs) {
  61741. return new TypeFace(attrs);
  61742. }
  61743. static typeFaces(attrs) {
  61744. return new TypeFaces(attrs);
  61745. }
  61746. }
  61747. exports.LocaleSetNamespace = LocaleSetNamespace;
  61748. /***/ }),
  61749. /* 93 */
  61750. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61751. Object.defineProperty(exports, "__esModule", ({
  61752. value: true
  61753. }));
  61754. exports.SignatureNamespace = void 0;
  61755. var _namespaces = __w_pdfjs_require__(77);
  61756. var _xfa_object = __w_pdfjs_require__(75);
  61757. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  61758. class Signature extends _xfa_object.XFAObject {
  61759. constructor(attributes) {
  61760. super(SIGNATURE_NS_ID, "signature", true);
  61761. }
  61762. }
  61763. class SignatureNamespace {
  61764. static [_namespaces.$buildXFAObject](name, attributes) {
  61765. if (SignatureNamespace.hasOwnProperty(name)) {
  61766. return SignatureNamespace[name](attributes);
  61767. }
  61768. return undefined;
  61769. }
  61770. static signature(attributes) {
  61771. return new Signature(attributes);
  61772. }
  61773. }
  61774. exports.SignatureNamespace = SignatureNamespace;
  61775. /***/ }),
  61776. /* 94 */
  61777. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61778. Object.defineProperty(exports, "__esModule", ({
  61779. value: true
  61780. }));
  61781. exports.StylesheetNamespace = void 0;
  61782. var _namespaces = __w_pdfjs_require__(77);
  61783. var _xfa_object = __w_pdfjs_require__(75);
  61784. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  61785. class Stylesheet extends _xfa_object.XFAObject {
  61786. constructor(attributes) {
  61787. super(STYLESHEET_NS_ID, "stylesheet", true);
  61788. }
  61789. }
  61790. class StylesheetNamespace {
  61791. static [_namespaces.$buildXFAObject](name, attributes) {
  61792. if (StylesheetNamespace.hasOwnProperty(name)) {
  61793. return StylesheetNamespace[name](attributes);
  61794. }
  61795. return undefined;
  61796. }
  61797. static stylesheet(attributes) {
  61798. return new Stylesheet(attributes);
  61799. }
  61800. }
  61801. exports.StylesheetNamespace = StylesheetNamespace;
  61802. /***/ }),
  61803. /* 95 */
  61804. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61805. Object.defineProperty(exports, "__esModule", ({
  61806. value: true
  61807. }));
  61808. exports.XdpNamespace = void 0;
  61809. var _namespaces = __w_pdfjs_require__(77);
  61810. var _xfa_object = __w_pdfjs_require__(75);
  61811. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  61812. class Xdp extends _xfa_object.XFAObject {
  61813. constructor(attributes) {
  61814. super(XDP_NS_ID, "xdp", true);
  61815. this.uuid = attributes.uuid || "";
  61816. this.timeStamp = attributes.timeStamp || "";
  61817. this.config = null;
  61818. this.connectionSet = null;
  61819. this.datasets = null;
  61820. this.localeSet = null;
  61821. this.stylesheet = new _xfa_object.XFAObjectArray();
  61822. this.template = null;
  61823. }
  61824. [_xfa_object.$onChildCheck](child) {
  61825. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  61826. return ns && child[_xfa_object.$namespaceId] === ns.id;
  61827. }
  61828. }
  61829. class XdpNamespace {
  61830. static [_namespaces.$buildXFAObject](name, attributes) {
  61831. if (XdpNamespace.hasOwnProperty(name)) {
  61832. return XdpNamespace[name](attributes);
  61833. }
  61834. return undefined;
  61835. }
  61836. static xdp(attributes) {
  61837. return new Xdp(attributes);
  61838. }
  61839. }
  61840. exports.XdpNamespace = XdpNamespace;
  61841. /***/ }),
  61842. /* 96 */
  61843. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61844. Object.defineProperty(exports, "__esModule", ({
  61845. value: true
  61846. }));
  61847. exports.XhtmlNamespace = void 0;
  61848. var _xfa_object = __w_pdfjs_require__(75);
  61849. var _namespaces = __w_pdfjs_require__(77);
  61850. var _html_utils = __w_pdfjs_require__(82);
  61851. var _utils = __w_pdfjs_require__(76);
  61852. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  61853. const $richText = Symbol();
  61854. 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"]);
  61855. 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) => {
  61856. value = original.fontSize = (0, _utils.getMeasurement)(value);
  61857. return (0, _html_utils.measureToString)(0.99 * value);
  61858. }], ["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))]]);
  61859. const spacesRegExp = /\s+/g;
  61860. const crlfRegExp = /[\r\n]+/g;
  61861. const crlfForRichTextRegExp = /\r\n?/g;
  61862. function mapStyle(styleStr, node, richText) {
  61863. const style = Object.create(null);
  61864. if (!styleStr) {
  61865. return style;
  61866. }
  61867. const original = Object.create(null);
  61868. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  61869. const mapping = StyleMapping.get(key);
  61870. if (mapping === "") {
  61871. continue;
  61872. }
  61873. let newValue = value;
  61874. if (mapping) {
  61875. if (typeof mapping === "string") {
  61876. newValue = mapping;
  61877. } else {
  61878. newValue = mapping(value, original);
  61879. }
  61880. }
  61881. if (key.endsWith("scale")) {
  61882. if (style.transform) {
  61883. style.transform = `${style[key]} ${newValue}`;
  61884. } else {
  61885. style.transform = newValue;
  61886. }
  61887. } else {
  61888. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  61889. }
  61890. }
  61891. if (style.fontFamily) {
  61892. (0, _html_utils.setFontFamily)({
  61893. typeface: style.fontFamily,
  61894. weight: style.fontWeight || "normal",
  61895. posture: style.fontStyle || "normal",
  61896. size: original.fontSize || 0
  61897. }, node, node[_xfa_object.$globalData].fontFinder, style);
  61898. }
  61899. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  61900. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  61901. const VERTICAL_FACTOR = 0.333;
  61902. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  61903. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  61904. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  61905. }
  61906. if (richText && style.fontSize) {
  61907. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  61908. }
  61909. (0, _html_utils.fixTextIndent)(style);
  61910. return style;
  61911. }
  61912. function checkStyle(node) {
  61913. if (!node.style) {
  61914. return "";
  61915. }
  61916. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  61917. if (key === "font-family") {
  61918. node[_xfa_object.$globalData].usedTypefaces.add(value);
  61919. }
  61920. return VALID_STYLES.has(key);
  61921. }).map(kv => kv.join(":")).join(";");
  61922. }
  61923. const NoWhites = new Set(["body", "html"]);
  61924. class XhtmlObject extends _xfa_object.XmlObject {
  61925. constructor(attributes, name) {
  61926. super(XHTML_NS_ID, name);
  61927. this[$richText] = false;
  61928. this.style = attributes.style || "";
  61929. }
  61930. [_xfa_object.$clean](builder) {
  61931. super[_xfa_object.$clean](builder);
  61932. this.style = checkStyle(this);
  61933. }
  61934. [_xfa_object.$acceptWhitespace]() {
  61935. return !NoWhites.has(this[_xfa_object.$nodeName]);
  61936. }
  61937. [_xfa_object.$onText](str, richText = false) {
  61938. if (!richText) {
  61939. str = str.replace(crlfRegExp, "");
  61940. if (!this.style.includes("xfa-spacerun:yes")) {
  61941. str = str.replace(spacesRegExp, " ");
  61942. }
  61943. } else {
  61944. this[$richText] = true;
  61945. }
  61946. if (str) {
  61947. this[_xfa_object.$content] += str;
  61948. }
  61949. }
  61950. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  61951. const xfaFont = Object.create(null);
  61952. const margin = {
  61953. top: NaN,
  61954. bottom: NaN,
  61955. left: NaN,
  61956. right: NaN
  61957. };
  61958. let lineHeight = null;
  61959. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  61960. switch (key) {
  61961. case "font-family":
  61962. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  61963. break;
  61964. case "font-size":
  61965. xfaFont.size = (0, _utils.getMeasurement)(value);
  61966. break;
  61967. case "font-weight":
  61968. xfaFont.weight = value;
  61969. break;
  61970. case "font-style":
  61971. xfaFont.posture = value;
  61972. break;
  61973. case "letter-spacing":
  61974. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  61975. break;
  61976. case "margin":
  61977. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  61978. switch (values.length) {
  61979. case 1:
  61980. margin.top = margin.bottom = margin.left = margin.right = values[0];
  61981. break;
  61982. case 2:
  61983. margin.top = margin.bottom = values[0];
  61984. margin.left = margin.right = values[1];
  61985. break;
  61986. case 3:
  61987. margin.top = values[0];
  61988. margin.bottom = values[2];
  61989. margin.left = margin.right = values[1];
  61990. break;
  61991. case 4:
  61992. margin.top = values[0];
  61993. margin.left = values[1];
  61994. margin.bottom = values[2];
  61995. margin.right = values[3];
  61996. break;
  61997. }
  61998. break;
  61999. case "margin-top":
  62000. margin.top = (0, _utils.getMeasurement)(value);
  62001. break;
  62002. case "margin-bottom":
  62003. margin.bottom = (0, _utils.getMeasurement)(value);
  62004. break;
  62005. case "margin-left":
  62006. margin.left = (0, _utils.getMeasurement)(value);
  62007. break;
  62008. case "margin-right":
  62009. margin.right = (0, _utils.getMeasurement)(value);
  62010. break;
  62011. case "line-height":
  62012. lineHeight = (0, _utils.getMeasurement)(value);
  62013. break;
  62014. }
  62015. }
  62016. measure.pushData(xfaFont, margin, lineHeight);
  62017. if (this[_xfa_object.$content]) {
  62018. measure.addString(this[_xfa_object.$content]);
  62019. } else {
  62020. for (const child of this[_xfa_object.$getChildren]()) {
  62021. if (child[_xfa_object.$nodeName] === "#text") {
  62022. measure.addString(child[_xfa_object.$content]);
  62023. continue;
  62024. }
  62025. child[_xfa_object.$pushGlyphs](measure);
  62026. }
  62027. }
  62028. if (mustPop) {
  62029. measure.popFont();
  62030. }
  62031. }
  62032. [_xfa_object.$toHTML](availableSpace) {
  62033. const children = [];
  62034. this[_xfa_object.$extra] = {
  62035. children
  62036. };
  62037. this[_xfa_object.$childrenToHTML]({});
  62038. if (children.length === 0 && !this[_xfa_object.$content]) {
  62039. return _utils.HTMLResult.EMPTY;
  62040. }
  62041. let value;
  62042. if (this[$richText]) {
  62043. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  62044. } else {
  62045. value = this[_xfa_object.$content] || undefined;
  62046. }
  62047. return _utils.HTMLResult.success({
  62048. name: this[_xfa_object.$nodeName],
  62049. attributes: {
  62050. href: this.href,
  62051. style: mapStyle(this.style, this, this[$richText])
  62052. },
  62053. children,
  62054. value
  62055. });
  62056. }
  62057. }
  62058. class A extends XhtmlObject {
  62059. constructor(attributes) {
  62060. super(attributes, "a");
  62061. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  62062. }
  62063. }
  62064. class B extends XhtmlObject {
  62065. constructor(attributes) {
  62066. super(attributes, "b");
  62067. }
  62068. [_xfa_object.$pushGlyphs](measure) {
  62069. measure.pushFont({
  62070. weight: "bold"
  62071. });
  62072. super[_xfa_object.$pushGlyphs](measure);
  62073. measure.popFont();
  62074. }
  62075. }
  62076. class Body extends XhtmlObject {
  62077. constructor(attributes) {
  62078. super(attributes, "body");
  62079. }
  62080. [_xfa_object.$toHTML](availableSpace) {
  62081. const res = super[_xfa_object.$toHTML](availableSpace);
  62082. const {
  62083. html
  62084. } = res;
  62085. if (!html) {
  62086. return _utils.HTMLResult.EMPTY;
  62087. }
  62088. html.name = "div";
  62089. html.attributes.class = ["xfaRich"];
  62090. return res;
  62091. }
  62092. }
  62093. class Br extends XhtmlObject {
  62094. constructor(attributes) {
  62095. super(attributes, "br");
  62096. }
  62097. [_xfa_object.$text]() {
  62098. return "\n";
  62099. }
  62100. [_xfa_object.$pushGlyphs](measure) {
  62101. measure.addString("\n");
  62102. }
  62103. [_xfa_object.$toHTML](availableSpace) {
  62104. return _utils.HTMLResult.success({
  62105. name: "br"
  62106. });
  62107. }
  62108. }
  62109. class Html extends XhtmlObject {
  62110. constructor(attributes) {
  62111. super(attributes, "html");
  62112. }
  62113. [_xfa_object.$toHTML](availableSpace) {
  62114. const children = [];
  62115. this[_xfa_object.$extra] = {
  62116. children
  62117. };
  62118. this[_xfa_object.$childrenToHTML]({});
  62119. if (children.length === 0) {
  62120. return _utils.HTMLResult.success({
  62121. name: "div",
  62122. attributes: {
  62123. class: ["xfaRich"],
  62124. style: {}
  62125. },
  62126. value: this[_xfa_object.$content] || ""
  62127. });
  62128. }
  62129. if (children.length === 1) {
  62130. const child = children[0];
  62131. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62132. return _utils.HTMLResult.success(child);
  62133. }
  62134. }
  62135. return _utils.HTMLResult.success({
  62136. name: "div",
  62137. attributes: {
  62138. class: ["xfaRich"],
  62139. style: {}
  62140. },
  62141. children
  62142. });
  62143. }
  62144. }
  62145. class I extends XhtmlObject {
  62146. constructor(attributes) {
  62147. super(attributes, "i");
  62148. }
  62149. [_xfa_object.$pushGlyphs](measure) {
  62150. measure.pushFont({
  62151. posture: "italic"
  62152. });
  62153. super[_xfa_object.$pushGlyphs](measure);
  62154. measure.popFont();
  62155. }
  62156. }
  62157. class Li extends XhtmlObject {
  62158. constructor(attributes) {
  62159. super(attributes, "li");
  62160. }
  62161. }
  62162. class Ol extends XhtmlObject {
  62163. constructor(attributes) {
  62164. super(attributes, "ol");
  62165. }
  62166. }
  62167. class P extends XhtmlObject {
  62168. constructor(attributes) {
  62169. super(attributes, "p");
  62170. }
  62171. [_xfa_object.$pushGlyphs](measure) {
  62172. super[_xfa_object.$pushGlyphs](measure, false);
  62173. measure.addString("\n");
  62174. measure.addPara();
  62175. measure.popFont();
  62176. }
  62177. [_xfa_object.$text]() {
  62178. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62179. if (siblings.at(-1) === this) {
  62180. return super[_xfa_object.$text]();
  62181. }
  62182. return super[_xfa_object.$text]() + "\n";
  62183. }
  62184. }
  62185. class Span extends XhtmlObject {
  62186. constructor(attributes) {
  62187. super(attributes, "span");
  62188. }
  62189. }
  62190. class Sub extends XhtmlObject {
  62191. constructor(attributes) {
  62192. super(attributes, "sub");
  62193. }
  62194. }
  62195. class Sup extends XhtmlObject {
  62196. constructor(attributes) {
  62197. super(attributes, "sup");
  62198. }
  62199. }
  62200. class Ul extends XhtmlObject {
  62201. constructor(attributes) {
  62202. super(attributes, "ul");
  62203. }
  62204. }
  62205. class XhtmlNamespace {
  62206. static [_namespaces.$buildXFAObject](name, attributes) {
  62207. if (XhtmlNamespace.hasOwnProperty(name)) {
  62208. return XhtmlNamespace[name](attributes);
  62209. }
  62210. return undefined;
  62211. }
  62212. static a(attributes) {
  62213. return new A(attributes);
  62214. }
  62215. static b(attributes) {
  62216. return new B(attributes);
  62217. }
  62218. static body(attributes) {
  62219. return new Body(attributes);
  62220. }
  62221. static br(attributes) {
  62222. return new Br(attributes);
  62223. }
  62224. static html(attributes) {
  62225. return new Html(attributes);
  62226. }
  62227. static i(attributes) {
  62228. return new I(attributes);
  62229. }
  62230. static li(attributes) {
  62231. return new Li(attributes);
  62232. }
  62233. static ol(attributes) {
  62234. return new Ol(attributes);
  62235. }
  62236. static p(attributes) {
  62237. return new P(attributes);
  62238. }
  62239. static span(attributes) {
  62240. return new Span(attributes);
  62241. }
  62242. static sub(attributes) {
  62243. return new Sub(attributes);
  62244. }
  62245. static sup(attributes) {
  62246. return new Sup(attributes);
  62247. }
  62248. static ul(attributes) {
  62249. return new Ul(attributes);
  62250. }
  62251. }
  62252. exports.XhtmlNamespace = XhtmlNamespace;
  62253. /***/ }),
  62254. /* 97 */
  62255. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62256. Object.defineProperty(exports, "__esModule", ({
  62257. value: true
  62258. }));
  62259. exports.UnknownNamespace = void 0;
  62260. var _namespaces = __w_pdfjs_require__(77);
  62261. var _xfa_object = __w_pdfjs_require__(75);
  62262. class UnknownNamespace {
  62263. constructor(nsId) {
  62264. this.namespaceId = nsId;
  62265. }
  62266. [_namespaces.$buildXFAObject](name, attributes) {
  62267. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62268. }
  62269. }
  62270. exports.UnknownNamespace = UnknownNamespace;
  62271. /***/ }),
  62272. /* 98 */
  62273. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62274. Object.defineProperty(exports, "__esModule", ({
  62275. value: true
  62276. }));
  62277. exports.DatasetReader = void 0;
  62278. var _util = __w_pdfjs_require__(2);
  62279. var _core_utils = __w_pdfjs_require__(4);
  62280. var _xml_parser = __w_pdfjs_require__(64);
  62281. function decodeString(str) {
  62282. try {
  62283. return (0, _util.stringToUTF8String)(str);
  62284. } catch (ex) {
  62285. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62286. return str;
  62287. }
  62288. }
  62289. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62290. constructor(options) {
  62291. super(options);
  62292. this.node = null;
  62293. }
  62294. onEndElement(name) {
  62295. const node = super.onEndElement(name);
  62296. if (node && name === "xfa:datasets") {
  62297. this.node = node;
  62298. throw new Error("Aborting DatasetXMLParser.");
  62299. }
  62300. }
  62301. }
  62302. class DatasetReader {
  62303. constructor(data) {
  62304. if (data.datasets) {
  62305. this.node = new _xml_parser.SimpleXMLParser({
  62306. hasAttributes: true
  62307. }).parseFromString(data.datasets).documentElement;
  62308. } else {
  62309. const parser = new DatasetXMLParser({
  62310. hasAttributes: true
  62311. });
  62312. try {
  62313. parser.parseFromString(data["xdp:xdp"]);
  62314. } catch (_) {}
  62315. this.node = parser.node;
  62316. }
  62317. }
  62318. getValue(path) {
  62319. if (!this.node || !path) {
  62320. return "";
  62321. }
  62322. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62323. if (!node) {
  62324. return "";
  62325. }
  62326. const first = node.firstChild;
  62327. if (first && first.nodeName === "value") {
  62328. return node.children.map(child => decodeString(child.textContent));
  62329. }
  62330. return decodeString(node.textContent);
  62331. }
  62332. }
  62333. exports.DatasetReader = DatasetReader;
  62334. /***/ }),
  62335. /* 99 */
  62336. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62337. Object.defineProperty(exports, "__esModule", ({
  62338. value: true
  62339. }));
  62340. exports.XRef = void 0;
  62341. var _util = __w_pdfjs_require__(2);
  62342. var _primitives = __w_pdfjs_require__(3);
  62343. var _core_utils = __w_pdfjs_require__(4);
  62344. var _parser = __w_pdfjs_require__(15);
  62345. var _base_stream = __w_pdfjs_require__(5);
  62346. var _crypto = __w_pdfjs_require__(65);
  62347. class XRef {
  62348. constructor(stream, pdfManager) {
  62349. this.stream = stream;
  62350. this.pdfManager = pdfManager;
  62351. this.entries = [];
  62352. this.xrefstms = Object.create(null);
  62353. this._cacheMap = new Map();
  62354. this._pendingRefs = new _primitives.RefSet();
  62355. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  62356. this._newRefNum = null;
  62357. }
  62358. getNewRef() {
  62359. if (this._newRefNum === null) {
  62360. this._newRefNum = this.entries.length || 1;
  62361. }
  62362. return _primitives.Ref.get(this._newRefNum++, 0);
  62363. }
  62364. resetNewRef() {
  62365. this._newRefNum = null;
  62366. }
  62367. setStartXRef(startXRef) {
  62368. this.startXRefQueue = [startXRef];
  62369. }
  62370. parse(recoveryMode = false) {
  62371. let trailerDict;
  62372. if (!recoveryMode) {
  62373. trailerDict = this.readXRef();
  62374. } else {
  62375. (0, _util.warn)("Indexing all PDF objects");
  62376. trailerDict = this.indexObjects();
  62377. }
  62378. trailerDict.assignXref(this);
  62379. this.trailer = trailerDict;
  62380. let encrypt;
  62381. try {
  62382. encrypt = trailerDict.get("Encrypt");
  62383. } catch (ex) {
  62384. if (ex instanceof _core_utils.MissingDataException) {
  62385. throw ex;
  62386. }
  62387. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62388. }
  62389. if (encrypt instanceof _primitives.Dict) {
  62390. const ids = trailerDict.get("ID");
  62391. const fileId = ids && ids.length ? ids[0] : "";
  62392. encrypt.suppressEncryption = true;
  62393. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62394. }
  62395. let root;
  62396. try {
  62397. root = trailerDict.get("Root");
  62398. } catch (ex) {
  62399. if (ex instanceof _core_utils.MissingDataException) {
  62400. throw ex;
  62401. }
  62402. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62403. }
  62404. if (root instanceof _primitives.Dict) {
  62405. try {
  62406. const pages = root.get("Pages");
  62407. if (pages instanceof _primitives.Dict) {
  62408. this.root = root;
  62409. return;
  62410. }
  62411. } catch (ex) {
  62412. if (ex instanceof _core_utils.MissingDataException) {
  62413. throw ex;
  62414. }
  62415. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62416. }
  62417. }
  62418. if (!recoveryMode) {
  62419. throw new _core_utils.XRefParseException();
  62420. }
  62421. throw new _util.InvalidPDFException("Invalid Root reference.");
  62422. }
  62423. processXRefTable(parser) {
  62424. if (!("tableState" in this)) {
  62425. this.tableState = {
  62426. entryNum: 0,
  62427. streamPos: parser.lexer.stream.pos,
  62428. parserBuf1: parser.buf1,
  62429. parserBuf2: parser.buf2
  62430. };
  62431. }
  62432. const obj = this.readXRefTable(parser);
  62433. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62434. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62435. }
  62436. let dict = parser.getObj();
  62437. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62438. dict = dict.dict;
  62439. }
  62440. if (!(dict instanceof _primitives.Dict)) {
  62441. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62442. }
  62443. delete this.tableState;
  62444. return dict;
  62445. }
  62446. readXRefTable(parser) {
  62447. const stream = parser.lexer.stream;
  62448. const tableState = this.tableState;
  62449. stream.pos = tableState.streamPos;
  62450. parser.buf1 = tableState.parserBuf1;
  62451. parser.buf2 = tableState.parserBuf2;
  62452. let obj;
  62453. while (true) {
  62454. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62455. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62456. break;
  62457. }
  62458. tableState.firstEntryNum = obj;
  62459. tableState.entryCount = parser.getObj();
  62460. }
  62461. let first = tableState.firstEntryNum;
  62462. const count = tableState.entryCount;
  62463. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62464. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62465. }
  62466. for (let i = tableState.entryNum; i < count; i++) {
  62467. tableState.streamPos = stream.pos;
  62468. tableState.entryNum = i;
  62469. tableState.parserBuf1 = parser.buf1;
  62470. tableState.parserBuf2 = parser.buf2;
  62471. const entry = {};
  62472. entry.offset = parser.getObj();
  62473. entry.gen = parser.getObj();
  62474. const type = parser.getObj();
  62475. if (type instanceof _primitives.Cmd) {
  62476. switch (type.cmd) {
  62477. case "f":
  62478. entry.free = true;
  62479. break;
  62480. case "n":
  62481. entry.uncompressed = true;
  62482. break;
  62483. }
  62484. }
  62485. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62486. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62487. }
  62488. if (i === 0 && entry.free && first === 1) {
  62489. first = 0;
  62490. }
  62491. if (!this.entries[i + first]) {
  62492. this.entries[i + first] = entry;
  62493. }
  62494. }
  62495. tableState.entryNum = 0;
  62496. tableState.streamPos = stream.pos;
  62497. tableState.parserBuf1 = parser.buf1;
  62498. tableState.parserBuf2 = parser.buf2;
  62499. delete tableState.firstEntryNum;
  62500. delete tableState.entryCount;
  62501. }
  62502. if (this.entries[0] && !this.entries[0].free) {
  62503. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62504. }
  62505. return obj;
  62506. }
  62507. processXRefStream(stream) {
  62508. if (!("streamState" in this)) {
  62509. const streamParameters = stream.dict;
  62510. const byteWidths = streamParameters.get("W");
  62511. let range = streamParameters.get("Index");
  62512. if (!range) {
  62513. range = [0, streamParameters.get("Size")];
  62514. }
  62515. this.streamState = {
  62516. entryRanges: range,
  62517. byteWidths,
  62518. entryNum: 0,
  62519. streamPos: stream.pos
  62520. };
  62521. }
  62522. this.readXRefStream(stream);
  62523. delete this.streamState;
  62524. return stream.dict;
  62525. }
  62526. readXRefStream(stream) {
  62527. const streamState = this.streamState;
  62528. stream.pos = streamState.streamPos;
  62529. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62530. const entryRanges = streamState.entryRanges;
  62531. while (entryRanges.length > 0) {
  62532. const [first, n] = entryRanges;
  62533. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62534. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62535. }
  62536. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62537. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62538. }
  62539. for (let i = streamState.entryNum; i < n; ++i) {
  62540. streamState.entryNum = i;
  62541. streamState.streamPos = stream.pos;
  62542. let type = 0,
  62543. offset = 0,
  62544. generation = 0;
  62545. for (let j = 0; j < typeFieldWidth; ++j) {
  62546. const typeByte = stream.getByte();
  62547. if (typeByte === -1) {
  62548. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62549. }
  62550. type = type << 8 | typeByte;
  62551. }
  62552. if (typeFieldWidth === 0) {
  62553. type = 1;
  62554. }
  62555. for (let j = 0; j < offsetFieldWidth; ++j) {
  62556. const offsetByte = stream.getByte();
  62557. if (offsetByte === -1) {
  62558. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62559. }
  62560. offset = offset << 8 | offsetByte;
  62561. }
  62562. for (let j = 0; j < generationFieldWidth; ++j) {
  62563. const generationByte = stream.getByte();
  62564. if (generationByte === -1) {
  62565. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  62566. }
  62567. generation = generation << 8 | generationByte;
  62568. }
  62569. const entry = {};
  62570. entry.offset = offset;
  62571. entry.gen = generation;
  62572. switch (type) {
  62573. case 0:
  62574. entry.free = true;
  62575. break;
  62576. case 1:
  62577. entry.uncompressed = true;
  62578. break;
  62579. case 2:
  62580. break;
  62581. default:
  62582. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  62583. }
  62584. if (!this.entries[first + i]) {
  62585. this.entries[first + i] = entry;
  62586. }
  62587. }
  62588. streamState.entryNum = 0;
  62589. streamState.streamPos = stream.pos;
  62590. entryRanges.splice(0, 2);
  62591. }
  62592. }
  62593. indexObjects() {
  62594. const TAB = 0x9,
  62595. LF = 0xa,
  62596. CR = 0xd,
  62597. SPACE = 0x20;
  62598. const PERCENT = 0x25,
  62599. LT = 0x3c;
  62600. function readToken(data, offset) {
  62601. let token = "",
  62602. ch = data[offset];
  62603. while (ch !== LF && ch !== CR && ch !== LT) {
  62604. if (++offset >= data.length) {
  62605. break;
  62606. }
  62607. token += String.fromCharCode(ch);
  62608. ch = data[offset];
  62609. }
  62610. return token;
  62611. }
  62612. function skipUntil(data, offset, what) {
  62613. const length = what.length,
  62614. dataLength = data.length;
  62615. let skipped = 0;
  62616. while (offset < dataLength) {
  62617. let i = 0;
  62618. while (i < length && data[offset + i] === what[i]) {
  62619. ++i;
  62620. }
  62621. if (i >= length) {
  62622. break;
  62623. }
  62624. offset++;
  62625. skipped++;
  62626. }
  62627. return skipped;
  62628. }
  62629. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  62630. const endobjRegExp = /\bendobj[\b\s]$/;
  62631. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  62632. const CHECK_CONTENT_LENGTH = 25;
  62633. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  62634. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  62635. const objBytes = new Uint8Array([111, 98, 106]);
  62636. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  62637. this.entries.length = 0;
  62638. this._cacheMap.clear();
  62639. const stream = this.stream;
  62640. stream.pos = 0;
  62641. const buffer = stream.getBytes(),
  62642. length = buffer.length;
  62643. let position = stream.start;
  62644. const trailers = [],
  62645. xrefStms = [];
  62646. while (position < length) {
  62647. let ch = buffer[position];
  62648. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  62649. ++position;
  62650. continue;
  62651. }
  62652. if (ch === PERCENT) {
  62653. do {
  62654. ++position;
  62655. if (position >= length) {
  62656. break;
  62657. }
  62658. ch = buffer[position];
  62659. } while (ch !== LF && ch !== CR);
  62660. continue;
  62661. }
  62662. const token = readToken(buffer, position);
  62663. let m;
  62664. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  62665. position += skipUntil(buffer, position, trailerBytes);
  62666. trailers.push(position);
  62667. position += skipUntil(buffer, position, startxrefBytes);
  62668. } else if (m = objRegExp.exec(token)) {
  62669. const num = m[1] | 0,
  62670. gen = m[2] | 0;
  62671. let contentLength,
  62672. startPos = position + token.length,
  62673. updateEntries = false;
  62674. if (!this.entries[num]) {
  62675. updateEntries = true;
  62676. } else if (this.entries[num].gen === gen) {
  62677. try {
  62678. const parser = new _parser.Parser({
  62679. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  62680. });
  62681. parser.getObj();
  62682. updateEntries = true;
  62683. } catch (ex) {
  62684. if (ex instanceof _core_utils.ParserEOFException) {
  62685. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  62686. } else {
  62687. updateEntries = true;
  62688. }
  62689. }
  62690. }
  62691. if (updateEntries) {
  62692. this.entries[num] = {
  62693. offset: position - stream.start,
  62694. gen,
  62695. uncompressed: true
  62696. };
  62697. }
  62698. while (startPos < buffer.length) {
  62699. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  62700. contentLength = endPos - position;
  62701. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  62702. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  62703. if (endobjRegExp.test(tokenStr)) {
  62704. break;
  62705. } else {
  62706. const objToken = nestedObjRegExp.exec(tokenStr);
  62707. if (objToken && objToken[1]) {
  62708. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  62709. contentLength -= objToken[1].length;
  62710. break;
  62711. }
  62712. }
  62713. startPos = endPos;
  62714. }
  62715. const content = buffer.subarray(position, position + contentLength);
  62716. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  62717. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  62718. xrefStms.push(position - stream.start);
  62719. this.xrefstms[position - stream.start] = 1;
  62720. }
  62721. position += contentLength;
  62722. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  62723. trailers.push(position);
  62724. position += skipUntil(buffer, position, startxrefBytes);
  62725. } else {
  62726. position += token.length + 1;
  62727. }
  62728. }
  62729. for (const xrefStm of xrefStms) {
  62730. this.startXRefQueue.push(xrefStm);
  62731. this.readXRef(true);
  62732. }
  62733. let trailerDict, trailerError;
  62734. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  62735. if (trailer === "generationFallback") {
  62736. if (!trailerError) {
  62737. break;
  62738. }
  62739. this._generationFallback = true;
  62740. continue;
  62741. }
  62742. stream.pos = trailer;
  62743. const parser = new _parser.Parser({
  62744. lexer: new _parser.Lexer(stream),
  62745. xref: this,
  62746. allowStreams: true,
  62747. recoveryMode: true
  62748. });
  62749. const obj = parser.getObj();
  62750. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62751. continue;
  62752. }
  62753. const dict = parser.getObj();
  62754. if (!(dict instanceof _primitives.Dict)) {
  62755. continue;
  62756. }
  62757. let validPagesDict = false;
  62758. try {
  62759. const rootDict = dict.get("Root");
  62760. if (!(rootDict instanceof _primitives.Dict)) {
  62761. continue;
  62762. }
  62763. const pagesDict = rootDict.get("Pages");
  62764. if (!(pagesDict instanceof _primitives.Dict)) {
  62765. continue;
  62766. }
  62767. const pagesCount = pagesDict.get("Count");
  62768. if (Number.isInteger(pagesCount)) {
  62769. validPagesDict = true;
  62770. }
  62771. } catch (ex) {
  62772. trailerError = ex;
  62773. continue;
  62774. }
  62775. if (validPagesDict && dict.has("ID")) {
  62776. return dict;
  62777. }
  62778. trailerDict = dict;
  62779. }
  62780. if (trailerDict) {
  62781. return trailerDict;
  62782. }
  62783. if (this.topDict) {
  62784. return this.topDict;
  62785. }
  62786. throw new _util.InvalidPDFException("Invalid PDF structure.");
  62787. }
  62788. readXRef(recoveryMode = false) {
  62789. const stream = this.stream;
  62790. const startXRefParsedCache = new Set();
  62791. try {
  62792. while (this.startXRefQueue.length) {
  62793. const startXRef = this.startXRefQueue[0];
  62794. if (startXRefParsedCache.has(startXRef)) {
  62795. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  62796. this.startXRefQueue.shift();
  62797. continue;
  62798. }
  62799. startXRefParsedCache.add(startXRef);
  62800. stream.pos = startXRef + stream.start;
  62801. const parser = new _parser.Parser({
  62802. lexer: new _parser.Lexer(stream),
  62803. xref: this,
  62804. allowStreams: true
  62805. });
  62806. let obj = parser.getObj();
  62807. let dict;
  62808. if ((0, _primitives.isCmd)(obj, "xref")) {
  62809. dict = this.processXRefTable(parser);
  62810. if (!this.topDict) {
  62811. this.topDict = dict;
  62812. }
  62813. obj = dict.get("XRefStm");
  62814. if (Number.isInteger(obj)) {
  62815. const pos = obj;
  62816. if (!(pos in this.xrefstms)) {
  62817. this.xrefstms[pos] = 1;
  62818. this.startXRefQueue.push(pos);
  62819. }
  62820. }
  62821. } else if (Number.isInteger(obj)) {
  62822. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  62823. throw new _util.FormatError("Invalid XRef stream");
  62824. }
  62825. dict = this.processXRefStream(obj);
  62826. if (!this.topDict) {
  62827. this.topDict = dict;
  62828. }
  62829. if (!dict) {
  62830. throw new _util.FormatError("Failed to read XRef stream");
  62831. }
  62832. } else {
  62833. throw new _util.FormatError("Invalid XRef stream header");
  62834. }
  62835. obj = dict.get("Prev");
  62836. if (Number.isInteger(obj)) {
  62837. this.startXRefQueue.push(obj);
  62838. } else if (obj instanceof _primitives.Ref) {
  62839. this.startXRefQueue.push(obj.num);
  62840. }
  62841. this.startXRefQueue.shift();
  62842. }
  62843. return this.topDict;
  62844. } catch (e) {
  62845. if (e instanceof _core_utils.MissingDataException) {
  62846. throw e;
  62847. }
  62848. (0, _util.info)("(while reading XRef): " + e);
  62849. this.startXRefQueue.shift();
  62850. }
  62851. if (recoveryMode) {
  62852. return undefined;
  62853. }
  62854. throw new _core_utils.XRefParseException();
  62855. }
  62856. getEntry(i) {
  62857. const xrefEntry = this.entries[i];
  62858. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  62859. return xrefEntry;
  62860. }
  62861. return null;
  62862. }
  62863. fetchIfRef(obj, suppressEncryption = false) {
  62864. if (obj instanceof _primitives.Ref) {
  62865. return this.fetch(obj, suppressEncryption);
  62866. }
  62867. return obj;
  62868. }
  62869. fetch(ref, suppressEncryption = false) {
  62870. if (!(ref instanceof _primitives.Ref)) {
  62871. throw new Error("ref object is not a reference");
  62872. }
  62873. const num = ref.num;
  62874. const cacheEntry = this._cacheMap.get(num);
  62875. if (cacheEntry !== undefined) {
  62876. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  62877. cacheEntry.objId = ref.toString();
  62878. }
  62879. return cacheEntry;
  62880. }
  62881. let xrefEntry = this.getEntry(num);
  62882. if (xrefEntry === null) {
  62883. this._cacheMap.set(num, xrefEntry);
  62884. return xrefEntry;
  62885. }
  62886. if (this._pendingRefs.has(ref)) {
  62887. this._pendingRefs.remove(ref);
  62888. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  62889. return _primitives.CIRCULAR_REF;
  62890. }
  62891. this._pendingRefs.put(ref);
  62892. try {
  62893. if (xrefEntry.uncompressed) {
  62894. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  62895. } else {
  62896. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  62897. }
  62898. this._pendingRefs.remove(ref);
  62899. } catch (ex) {
  62900. this._pendingRefs.remove(ref);
  62901. throw ex;
  62902. }
  62903. if (xrefEntry instanceof _primitives.Dict) {
  62904. xrefEntry.objId = ref.toString();
  62905. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  62906. xrefEntry.dict.objId = ref.toString();
  62907. }
  62908. return xrefEntry;
  62909. }
  62910. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  62911. const gen = ref.gen;
  62912. let num = ref.num;
  62913. if (xrefEntry.gen !== gen) {
  62914. const msg = `Inconsistent generation in XRef: ${ref}`;
  62915. if (this._generationFallback && xrefEntry.gen < gen) {
  62916. (0, _util.warn)(msg);
  62917. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  62918. }
  62919. throw new _core_utils.XRefEntryException(msg);
  62920. }
  62921. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  62922. const parser = new _parser.Parser({
  62923. lexer: new _parser.Lexer(stream),
  62924. xref: this,
  62925. allowStreams: true
  62926. });
  62927. const obj1 = parser.getObj();
  62928. const obj2 = parser.getObj();
  62929. const obj3 = parser.getObj();
  62930. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  62931. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62932. }
  62933. if (obj3.cmd !== "obj") {
  62934. if (obj3.cmd.startsWith("obj")) {
  62935. num = parseInt(obj3.cmd.substring(3), 10);
  62936. if (!Number.isNaN(num)) {
  62937. return num;
  62938. }
  62939. }
  62940. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62941. }
  62942. if (this.encrypt && !suppressEncryption) {
  62943. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  62944. } else {
  62945. xrefEntry = parser.getObj();
  62946. }
  62947. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  62948. this._cacheMap.set(num, xrefEntry);
  62949. }
  62950. return xrefEntry;
  62951. }
  62952. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  62953. const tableOffset = xrefEntry.offset;
  62954. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  62955. if (!(stream instanceof _base_stream.BaseStream)) {
  62956. throw new _util.FormatError("bad ObjStm stream");
  62957. }
  62958. const first = stream.dict.get("First");
  62959. const n = stream.dict.get("N");
  62960. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62961. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  62962. }
  62963. let parser = new _parser.Parser({
  62964. lexer: new _parser.Lexer(stream),
  62965. xref: this,
  62966. allowStreams: true
  62967. });
  62968. const nums = new Array(n);
  62969. const offsets = new Array(n);
  62970. for (let i = 0; i < n; ++i) {
  62971. const num = parser.getObj();
  62972. if (!Number.isInteger(num)) {
  62973. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  62974. }
  62975. const offset = parser.getObj();
  62976. if (!Number.isInteger(offset)) {
  62977. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  62978. }
  62979. nums[i] = num;
  62980. offsets[i] = offset;
  62981. }
  62982. const start = (stream.start || 0) + first;
  62983. const entries = new Array(n);
  62984. for (let i = 0; i < n; ++i) {
  62985. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  62986. if (length < 0) {
  62987. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  62988. }
  62989. parser = new _parser.Parser({
  62990. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  62991. xref: this,
  62992. allowStreams: true
  62993. });
  62994. const obj = parser.getObj();
  62995. entries[i] = obj;
  62996. if (obj instanceof _base_stream.BaseStream) {
  62997. continue;
  62998. }
  62999. const num = nums[i],
  63000. entry = this.entries[num];
  63001. if (entry && entry.offset === tableOffset && entry.gen === i) {
  63002. this._cacheMap.set(num, obj);
  63003. }
  63004. }
  63005. xrefEntry = entries[xrefEntry.gen];
  63006. if (xrefEntry === undefined) {
  63007. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  63008. }
  63009. return xrefEntry;
  63010. }
  63011. async fetchIfRefAsync(obj, suppressEncryption) {
  63012. if (obj instanceof _primitives.Ref) {
  63013. return this.fetchAsync(obj, suppressEncryption);
  63014. }
  63015. return obj;
  63016. }
  63017. async fetchAsync(ref, suppressEncryption) {
  63018. try {
  63019. return this.fetch(ref, suppressEncryption);
  63020. } catch (ex) {
  63021. if (!(ex instanceof _core_utils.MissingDataException)) {
  63022. throw ex;
  63023. }
  63024. await this.pdfManager.requestRange(ex.begin, ex.end);
  63025. return this.fetchAsync(ref, suppressEncryption);
  63026. }
  63027. }
  63028. getCatalogObj() {
  63029. return this.root;
  63030. }
  63031. }
  63032. exports.XRef = XRef;
  63033. /***/ }),
  63034. /* 100 */
  63035. /***/ ((__unused_webpack_module, exports) => {
  63036. Object.defineProperty(exports, "__esModule", ({
  63037. value: true
  63038. }));
  63039. exports.isNodeJS = void 0;
  63040. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  63041. exports.isNodeJS = isNodeJS;
  63042. /***/ }),
  63043. /* 101 */
  63044. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63045. Object.defineProperty(exports, "__esModule", ({
  63046. value: true
  63047. }));
  63048. exports.MessageHandler = void 0;
  63049. var _util = __w_pdfjs_require__(2);
  63050. const CallbackKind = {
  63051. UNKNOWN: 0,
  63052. DATA: 1,
  63053. ERROR: 2
  63054. };
  63055. const StreamKind = {
  63056. UNKNOWN: 0,
  63057. CANCEL: 1,
  63058. CANCEL_COMPLETE: 2,
  63059. CLOSE: 3,
  63060. ENQUEUE: 4,
  63061. ERROR: 5,
  63062. PULL: 6,
  63063. PULL_COMPLETE: 7,
  63064. START_COMPLETE: 8
  63065. };
  63066. function wrapReason(reason) {
  63067. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  63068. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  63069. }
  63070. switch (reason.name) {
  63071. case "AbortException":
  63072. return new _util.AbortException(reason.message);
  63073. case "MissingPDFException":
  63074. return new _util.MissingPDFException(reason.message);
  63075. case "PasswordException":
  63076. return new _util.PasswordException(reason.message, reason.code);
  63077. case "UnexpectedResponseException":
  63078. return new _util.UnexpectedResponseException(reason.message, reason.status);
  63079. case "UnknownErrorException":
  63080. return new _util.UnknownErrorException(reason.message, reason.details);
  63081. default:
  63082. return new _util.UnknownErrorException(reason.message, reason.toString());
  63083. }
  63084. }
  63085. class MessageHandler {
  63086. constructor(sourceName, targetName, comObj) {
  63087. this.sourceName = sourceName;
  63088. this.targetName = targetName;
  63089. this.comObj = comObj;
  63090. this.callbackId = 1;
  63091. this.streamId = 1;
  63092. this.streamSinks = Object.create(null);
  63093. this.streamControllers = Object.create(null);
  63094. this.callbackCapabilities = Object.create(null);
  63095. this.actionHandler = Object.create(null);
  63096. this._onComObjOnMessage = event => {
  63097. const data = event.data;
  63098. if (data.targetName !== this.sourceName) {
  63099. return;
  63100. }
  63101. if (data.stream) {
  63102. this._processStreamMessage(data);
  63103. return;
  63104. }
  63105. if (data.callback) {
  63106. const callbackId = data.callbackId;
  63107. const capability = this.callbackCapabilities[callbackId];
  63108. if (!capability) {
  63109. throw new Error(`Cannot resolve callback ${callbackId}`);
  63110. }
  63111. delete this.callbackCapabilities[callbackId];
  63112. if (data.callback === CallbackKind.DATA) {
  63113. capability.resolve(data.data);
  63114. } else if (data.callback === CallbackKind.ERROR) {
  63115. capability.reject(wrapReason(data.reason));
  63116. } else {
  63117. throw new Error("Unexpected callback case");
  63118. }
  63119. return;
  63120. }
  63121. const action = this.actionHandler[data.action];
  63122. if (!action) {
  63123. throw new Error(`Unknown action from worker: ${data.action}`);
  63124. }
  63125. if (data.callbackId) {
  63126. const cbSourceName = this.sourceName;
  63127. const cbTargetName = data.sourceName;
  63128. new Promise(function (resolve) {
  63129. resolve(action(data.data));
  63130. }).then(function (result) {
  63131. comObj.postMessage({
  63132. sourceName: cbSourceName,
  63133. targetName: cbTargetName,
  63134. callback: CallbackKind.DATA,
  63135. callbackId: data.callbackId,
  63136. data: result
  63137. });
  63138. }, function (reason) {
  63139. comObj.postMessage({
  63140. sourceName: cbSourceName,
  63141. targetName: cbTargetName,
  63142. callback: CallbackKind.ERROR,
  63143. callbackId: data.callbackId,
  63144. reason: wrapReason(reason)
  63145. });
  63146. });
  63147. return;
  63148. }
  63149. if (data.streamId) {
  63150. this._createStreamSink(data);
  63151. return;
  63152. }
  63153. action(data.data);
  63154. };
  63155. comObj.addEventListener("message", this._onComObjOnMessage);
  63156. }
  63157. on(actionName, handler) {
  63158. const ah = this.actionHandler;
  63159. if (ah[actionName]) {
  63160. throw new Error(`There is already an actionName called "${actionName}"`);
  63161. }
  63162. ah[actionName] = handler;
  63163. }
  63164. send(actionName, data, transfers) {
  63165. this.comObj.postMessage({
  63166. sourceName: this.sourceName,
  63167. targetName: this.targetName,
  63168. action: actionName,
  63169. data
  63170. }, transfers);
  63171. }
  63172. sendWithPromise(actionName, data, transfers) {
  63173. const callbackId = this.callbackId++;
  63174. const capability = (0, _util.createPromiseCapability)();
  63175. this.callbackCapabilities[callbackId] = capability;
  63176. try {
  63177. this.comObj.postMessage({
  63178. sourceName: this.sourceName,
  63179. targetName: this.targetName,
  63180. action: actionName,
  63181. callbackId,
  63182. data
  63183. }, transfers);
  63184. } catch (ex) {
  63185. capability.reject(ex);
  63186. }
  63187. return capability.promise;
  63188. }
  63189. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63190. const streamId = this.streamId++,
  63191. sourceName = this.sourceName,
  63192. targetName = this.targetName,
  63193. comObj = this.comObj;
  63194. return new ReadableStream({
  63195. start: controller => {
  63196. const startCapability = (0, _util.createPromiseCapability)();
  63197. this.streamControllers[streamId] = {
  63198. controller,
  63199. startCall: startCapability,
  63200. pullCall: null,
  63201. cancelCall: null,
  63202. isClosed: false
  63203. };
  63204. comObj.postMessage({
  63205. sourceName,
  63206. targetName,
  63207. action: actionName,
  63208. streamId,
  63209. data,
  63210. desiredSize: controller.desiredSize
  63211. }, transfers);
  63212. return startCapability.promise;
  63213. },
  63214. pull: controller => {
  63215. const pullCapability = (0, _util.createPromiseCapability)();
  63216. this.streamControllers[streamId].pullCall = pullCapability;
  63217. comObj.postMessage({
  63218. sourceName,
  63219. targetName,
  63220. stream: StreamKind.PULL,
  63221. streamId,
  63222. desiredSize: controller.desiredSize
  63223. });
  63224. return pullCapability.promise;
  63225. },
  63226. cancel: reason => {
  63227. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63228. const cancelCapability = (0, _util.createPromiseCapability)();
  63229. this.streamControllers[streamId].cancelCall = cancelCapability;
  63230. this.streamControllers[streamId].isClosed = true;
  63231. comObj.postMessage({
  63232. sourceName,
  63233. targetName,
  63234. stream: StreamKind.CANCEL,
  63235. streamId,
  63236. reason: wrapReason(reason)
  63237. });
  63238. return cancelCapability.promise;
  63239. }
  63240. }, queueingStrategy);
  63241. }
  63242. _createStreamSink(data) {
  63243. const streamId = data.streamId,
  63244. sourceName = this.sourceName,
  63245. targetName = data.sourceName,
  63246. comObj = this.comObj;
  63247. const self = this,
  63248. action = this.actionHandler[data.action];
  63249. const streamSink = {
  63250. enqueue(chunk, size = 1, transfers) {
  63251. if (this.isCancelled) {
  63252. return;
  63253. }
  63254. const lastDesiredSize = this.desiredSize;
  63255. this.desiredSize -= size;
  63256. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63257. this.sinkCapability = (0, _util.createPromiseCapability)();
  63258. this.ready = this.sinkCapability.promise;
  63259. }
  63260. comObj.postMessage({
  63261. sourceName,
  63262. targetName,
  63263. stream: StreamKind.ENQUEUE,
  63264. streamId,
  63265. chunk
  63266. }, transfers);
  63267. },
  63268. close() {
  63269. if (this.isCancelled) {
  63270. return;
  63271. }
  63272. this.isCancelled = true;
  63273. comObj.postMessage({
  63274. sourceName,
  63275. targetName,
  63276. stream: StreamKind.CLOSE,
  63277. streamId
  63278. });
  63279. delete self.streamSinks[streamId];
  63280. },
  63281. error(reason) {
  63282. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63283. if (this.isCancelled) {
  63284. return;
  63285. }
  63286. this.isCancelled = true;
  63287. comObj.postMessage({
  63288. sourceName,
  63289. targetName,
  63290. stream: StreamKind.ERROR,
  63291. streamId,
  63292. reason: wrapReason(reason)
  63293. });
  63294. },
  63295. sinkCapability: (0, _util.createPromiseCapability)(),
  63296. onPull: null,
  63297. onCancel: null,
  63298. isCancelled: false,
  63299. desiredSize: data.desiredSize,
  63300. ready: null
  63301. };
  63302. streamSink.sinkCapability.resolve();
  63303. streamSink.ready = streamSink.sinkCapability.promise;
  63304. this.streamSinks[streamId] = streamSink;
  63305. new Promise(function (resolve) {
  63306. resolve(action(data.data, streamSink));
  63307. }).then(function () {
  63308. comObj.postMessage({
  63309. sourceName,
  63310. targetName,
  63311. stream: StreamKind.START_COMPLETE,
  63312. streamId,
  63313. success: true
  63314. });
  63315. }, function (reason) {
  63316. comObj.postMessage({
  63317. sourceName,
  63318. targetName,
  63319. stream: StreamKind.START_COMPLETE,
  63320. streamId,
  63321. reason: wrapReason(reason)
  63322. });
  63323. });
  63324. }
  63325. _processStreamMessage(data) {
  63326. const streamId = data.streamId,
  63327. sourceName = this.sourceName,
  63328. targetName = data.sourceName,
  63329. comObj = this.comObj;
  63330. const streamController = this.streamControllers[streamId],
  63331. streamSink = this.streamSinks[streamId];
  63332. switch (data.stream) {
  63333. case StreamKind.START_COMPLETE:
  63334. if (data.success) {
  63335. streamController.startCall.resolve();
  63336. } else {
  63337. streamController.startCall.reject(wrapReason(data.reason));
  63338. }
  63339. break;
  63340. case StreamKind.PULL_COMPLETE:
  63341. if (data.success) {
  63342. streamController.pullCall.resolve();
  63343. } else {
  63344. streamController.pullCall.reject(wrapReason(data.reason));
  63345. }
  63346. break;
  63347. case StreamKind.PULL:
  63348. if (!streamSink) {
  63349. comObj.postMessage({
  63350. sourceName,
  63351. targetName,
  63352. stream: StreamKind.PULL_COMPLETE,
  63353. streamId,
  63354. success: true
  63355. });
  63356. break;
  63357. }
  63358. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63359. streamSink.sinkCapability.resolve();
  63360. }
  63361. streamSink.desiredSize = data.desiredSize;
  63362. new Promise(function (resolve) {
  63363. resolve(streamSink.onPull && streamSink.onPull());
  63364. }).then(function () {
  63365. comObj.postMessage({
  63366. sourceName,
  63367. targetName,
  63368. stream: StreamKind.PULL_COMPLETE,
  63369. streamId,
  63370. success: true
  63371. });
  63372. }, function (reason) {
  63373. comObj.postMessage({
  63374. sourceName,
  63375. targetName,
  63376. stream: StreamKind.PULL_COMPLETE,
  63377. streamId,
  63378. reason: wrapReason(reason)
  63379. });
  63380. });
  63381. break;
  63382. case StreamKind.ENQUEUE:
  63383. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63384. if (streamController.isClosed) {
  63385. break;
  63386. }
  63387. streamController.controller.enqueue(data.chunk);
  63388. break;
  63389. case StreamKind.CLOSE:
  63390. (0, _util.assert)(streamController, "close should have stream controller");
  63391. if (streamController.isClosed) {
  63392. break;
  63393. }
  63394. streamController.isClosed = true;
  63395. streamController.controller.close();
  63396. this._deleteStreamController(streamController, streamId);
  63397. break;
  63398. case StreamKind.ERROR:
  63399. (0, _util.assert)(streamController, "error should have stream controller");
  63400. streamController.controller.error(wrapReason(data.reason));
  63401. this._deleteStreamController(streamController, streamId);
  63402. break;
  63403. case StreamKind.CANCEL_COMPLETE:
  63404. if (data.success) {
  63405. streamController.cancelCall.resolve();
  63406. } else {
  63407. streamController.cancelCall.reject(wrapReason(data.reason));
  63408. }
  63409. this._deleteStreamController(streamController, streamId);
  63410. break;
  63411. case StreamKind.CANCEL:
  63412. if (!streamSink) {
  63413. break;
  63414. }
  63415. new Promise(function (resolve) {
  63416. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63417. }).then(function () {
  63418. comObj.postMessage({
  63419. sourceName,
  63420. targetName,
  63421. stream: StreamKind.CANCEL_COMPLETE,
  63422. streamId,
  63423. success: true
  63424. });
  63425. }, function (reason) {
  63426. comObj.postMessage({
  63427. sourceName,
  63428. targetName,
  63429. stream: StreamKind.CANCEL_COMPLETE,
  63430. streamId,
  63431. reason: wrapReason(reason)
  63432. });
  63433. });
  63434. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63435. streamSink.isCancelled = true;
  63436. delete this.streamSinks[streamId];
  63437. break;
  63438. default:
  63439. throw new Error("Unexpected stream case");
  63440. }
  63441. }
  63442. async _deleteStreamController(streamController, streamId) {
  63443. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63444. delete this.streamControllers[streamId];
  63445. }
  63446. destroy() {
  63447. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63448. }
  63449. }
  63450. exports.MessageHandler = MessageHandler;
  63451. /***/ }),
  63452. /* 102 */
  63453. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63454. Object.defineProperty(exports, "__esModule", ({
  63455. value: true
  63456. }));
  63457. exports.PDFWorkerStream = void 0;
  63458. var _util = __w_pdfjs_require__(2);
  63459. class PDFWorkerStream {
  63460. constructor(msgHandler) {
  63461. this._msgHandler = msgHandler;
  63462. this._contentLength = null;
  63463. this._fullRequestReader = null;
  63464. this._rangeRequestReaders = [];
  63465. }
  63466. getFullReader() {
  63467. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63468. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63469. return this._fullRequestReader;
  63470. }
  63471. getRangeReader(begin, end) {
  63472. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63473. this._rangeRequestReaders.push(reader);
  63474. return reader;
  63475. }
  63476. cancelAllRequests(reason) {
  63477. if (this._fullRequestReader) {
  63478. this._fullRequestReader.cancel(reason);
  63479. }
  63480. for (const reader of this._rangeRequestReaders.slice(0)) {
  63481. reader.cancel(reason);
  63482. }
  63483. }
  63484. }
  63485. exports.PDFWorkerStream = PDFWorkerStream;
  63486. class PDFWorkerStreamReader {
  63487. constructor(msgHandler) {
  63488. this._msgHandler = msgHandler;
  63489. this.onProgress = null;
  63490. this._contentLength = null;
  63491. this._isRangeSupported = false;
  63492. this._isStreamingSupported = false;
  63493. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63494. this._reader = readableStream.getReader();
  63495. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63496. this._isStreamingSupported = data.isStreamingSupported;
  63497. this._isRangeSupported = data.isRangeSupported;
  63498. this._contentLength = data.contentLength;
  63499. });
  63500. }
  63501. get headersReady() {
  63502. return this._headersReady;
  63503. }
  63504. get contentLength() {
  63505. return this._contentLength;
  63506. }
  63507. get isStreamingSupported() {
  63508. return this._isStreamingSupported;
  63509. }
  63510. get isRangeSupported() {
  63511. return this._isRangeSupported;
  63512. }
  63513. async read() {
  63514. const {
  63515. value,
  63516. done
  63517. } = await this._reader.read();
  63518. if (done) {
  63519. return {
  63520. value: undefined,
  63521. done: true
  63522. };
  63523. }
  63524. return {
  63525. value: value.buffer,
  63526. done: false
  63527. };
  63528. }
  63529. cancel(reason) {
  63530. this._reader.cancel(reason);
  63531. }
  63532. }
  63533. class PDFWorkerStreamRangeReader {
  63534. constructor(begin, end, msgHandler) {
  63535. this._msgHandler = msgHandler;
  63536. this.onProgress = null;
  63537. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63538. begin,
  63539. end
  63540. });
  63541. this._reader = readableStream.getReader();
  63542. }
  63543. get isStreamingSupported() {
  63544. return false;
  63545. }
  63546. async read() {
  63547. const {
  63548. value,
  63549. done
  63550. } = await this._reader.read();
  63551. if (done) {
  63552. return {
  63553. value: undefined,
  63554. done: true
  63555. };
  63556. }
  63557. return {
  63558. value: value.buffer,
  63559. done: false
  63560. };
  63561. }
  63562. cancel(reason) {
  63563. this._reader.cancel(reason);
  63564. }
  63565. }
  63566. /***/ })
  63567. /******/ ]);
  63568. /************************************************************************/
  63569. /******/ // The module cache
  63570. /******/ var __webpack_module_cache__ = {};
  63571. /******/
  63572. /******/ // The require function
  63573. /******/ function __w_pdfjs_require__(moduleId) {
  63574. /******/ // Check if module is in cache
  63575. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  63576. /******/ if (cachedModule !== undefined) {
  63577. /******/ return cachedModule.exports;
  63578. /******/ }
  63579. /******/ // Create a new module (and put it into the cache)
  63580. /******/ var module = __webpack_module_cache__[moduleId] = {
  63581. /******/ // no module.id needed
  63582. /******/ // no module.loaded needed
  63583. /******/ exports: {}
  63584. /******/ };
  63585. /******/
  63586. /******/ // Execute the module function
  63587. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  63588. /******/
  63589. /******/ // Return the exports of the module
  63590. /******/ return module.exports;
  63591. /******/ }
  63592. /******/
  63593. /************************************************************************/
  63594. /******/ /* webpack/runtime/define property getters */
  63595. /******/ (() => {
  63596. /******/ // define getter functions for harmony exports
  63597. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  63598. /******/ for(var key in definition) {
  63599. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  63600. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  63601. /******/ }
  63602. /******/ }
  63603. /******/ };
  63604. /******/ })();
  63605. /******/
  63606. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  63607. /******/ (() => {
  63608. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  63609. /******/ })();
  63610. /******/
  63611. /******/ /* webpack/runtime/make namespace object */
  63612. /******/ (() => {
  63613. /******/ // define __esModule on exports
  63614. /******/ __w_pdfjs_require__.r = (exports) => {
  63615. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  63616. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  63617. /******/ }
  63618. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  63619. /******/ };
  63620. /******/ })();
  63621. /******/
  63622. /************************************************************************/
  63623. var __webpack_exports__ = {};
  63624. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  63625. (() => {
  63626. var exports = __webpack_exports__;
  63627. Object.defineProperty(exports, "__esModule", ({
  63628. value: true
  63629. }));
  63630. Object.defineProperty(exports, "WorkerMessageHandler", ({
  63631. enumerable: true,
  63632. get: function () {
  63633. return _worker.WorkerMessageHandler;
  63634. }
  63635. }));
  63636. var _worker = __w_pdfjs_require__(1);
  63637. const pdfjsVersion = '3.0.279';
  63638. const pdfjsBuild = 'd0823066c';
  63639. })();
  63640. /******/ return __webpack_exports__;
  63641. /******/ })()
  63642. ;
  63643. });
  63644. //# sourceMappingURL=pdf.worker.js.map