pdf.worker.js 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478
  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 (data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function (data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function (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.1.81';
  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. 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. }).catch(function (e) {
  252. pdfManagerCapability.reject(e);
  253. cancelXHRs = null;
  254. });
  255. cancelXHRs = function (reason) {
  256. pdfStream.cancelAllRequests(reason);
  257. };
  258. return pdfManagerCapability.promise;
  259. }
  260. function setupDoc(data) {
  261. function onSuccess(doc) {
  262. ensureNotTerminated();
  263. handler.send("GetDoc", {
  264. pdfInfo: doc
  265. });
  266. }
  267. function onFailure(ex) {
  268. ensureNotTerminated();
  269. if (ex instanceof _util.PasswordException) {
  270. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  271. startWorkerTask(task);
  272. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  273. password
  274. }) {
  275. finishWorkerTask(task);
  276. pdfManager.updatePassword(password);
  277. pdfManagerReady();
  278. }).catch(function () {
  279. finishWorkerTask(task);
  280. handler.send("DocException", ex);
  281. });
  282. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  283. handler.send("DocException", ex);
  284. } else {
  285. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  286. }
  287. }
  288. function pdfManagerReady() {
  289. ensureNotTerminated();
  290. loadDocument(false).then(onSuccess, function (reason) {
  291. ensureNotTerminated();
  292. if (!(reason instanceof _core_utils.XRefParseException)) {
  293. onFailure(reason);
  294. return;
  295. }
  296. pdfManager.requestLoadedStream().then(function () {
  297. ensureNotTerminated();
  298. loadDocument(true).then(onSuccess, onFailure);
  299. });
  300. });
  301. }
  302. ensureNotTerminated();
  303. getPdfManager(data).then(function (newPdfManager) {
  304. if (terminated) {
  305. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  306. throw new Error("Worker was terminated");
  307. }
  308. pdfManager = newPdfManager;
  309. pdfManager.requestLoadedStream(true).then(stream => {
  310. handler.send("DataLoaded", {
  311. length: stream.bytes.byteLength
  312. });
  313. });
  314. }).then(pdfManagerReady, onFailure);
  315. }
  316. handler.on("GetPage", function (data) {
  317. return pdfManager.getPage(data.pageIndex).then(function (page) {
  318. 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]) {
  319. return {
  320. rotate,
  321. ref,
  322. userUnit,
  323. view
  324. };
  325. });
  326. });
  327. });
  328. handler.on("GetPageIndex", function (data) {
  329. const pageRef = _primitives.Ref.get(data.num, data.gen);
  330. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  331. });
  332. handler.on("GetDestinations", function (data) {
  333. return pdfManager.ensureCatalog("destinations");
  334. });
  335. handler.on("GetDestination", function (data) {
  336. return pdfManager.ensureCatalog("getDestination", [data.id]);
  337. });
  338. handler.on("GetPageLabels", function (data) {
  339. return pdfManager.ensureCatalog("pageLabels");
  340. });
  341. handler.on("GetPageLayout", function (data) {
  342. return pdfManager.ensureCatalog("pageLayout");
  343. });
  344. handler.on("GetPageMode", function (data) {
  345. return pdfManager.ensureCatalog("pageMode");
  346. });
  347. handler.on("GetViewerPreferences", function (data) {
  348. return pdfManager.ensureCatalog("viewerPreferences");
  349. });
  350. handler.on("GetOpenAction", function (data) {
  351. return pdfManager.ensureCatalog("openAction");
  352. });
  353. handler.on("GetAttachments", function (data) {
  354. return pdfManager.ensureCatalog("attachments");
  355. });
  356. handler.on("GetJavaScript", function (data) {
  357. return pdfManager.ensureCatalog("javaScript");
  358. });
  359. handler.on("GetDocJSActions", function (data) {
  360. return pdfManager.ensureCatalog("jsActions");
  361. });
  362. handler.on("GetPageJSActions", function ({
  363. pageIndex
  364. }) {
  365. return pdfManager.getPage(pageIndex).then(function (page) {
  366. return pdfManager.ensure(page, "jsActions");
  367. });
  368. });
  369. handler.on("GetOutline", function (data) {
  370. return pdfManager.ensureCatalog("documentOutline");
  371. });
  372. handler.on("GetOptionalContentConfig", function (data) {
  373. return pdfManager.ensureCatalog("optionalContentConfig");
  374. });
  375. handler.on("GetPermissions", function (data) {
  376. return pdfManager.ensureCatalog("permissions");
  377. });
  378. handler.on("GetMetadata", function (data) {
  379. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  380. });
  381. handler.on("GetMarkInfo", function (data) {
  382. return pdfManager.ensureCatalog("markInfo");
  383. });
  384. handler.on("GetData", function (data) {
  385. return pdfManager.requestLoadedStream().then(function (stream) {
  386. return stream.bytes;
  387. });
  388. });
  389. handler.on("GetAnnotations", function ({
  390. pageIndex,
  391. intent
  392. }) {
  393. return pdfManager.getPage(pageIndex).then(function (page) {
  394. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  395. startWorkerTask(task);
  396. return page.getAnnotationsData(handler, task, intent).then(data => {
  397. finishWorkerTask(task);
  398. return data;
  399. }, reason => {
  400. finishWorkerTask(task);
  401. });
  402. });
  403. });
  404. handler.on("GetFieldObjects", function (data) {
  405. return pdfManager.ensureDoc("fieldObjects");
  406. });
  407. handler.on("HasJSActions", function (data) {
  408. return pdfManager.ensureDoc("hasJSActions");
  409. });
  410. handler.on("GetCalculationOrderIds", function (data) {
  411. return pdfManager.ensureDoc("calculationOrderIds");
  412. });
  413. handler.on("SaveDocument", function ({
  414. isPureXfa,
  415. numPages,
  416. annotationStorage,
  417. filename
  418. }) {
  419. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  420. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  421. if (newAnnotationsByPage) {
  422. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  423. promises.push(pdfManager.getPage(pageIndex).then(page => {
  424. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  425. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  426. finishWorkerTask(task);
  427. });
  428. }));
  429. }
  430. }
  431. if (isPureXfa) {
  432. promises.push(pdfManager.serializeXfaData(annotationStorage));
  433. } else {
  434. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  435. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  436. const task = new WorkerTask(`Save: page ${pageIndex}`);
  437. return page.save(handler, task, annotationStorage).finally(function () {
  438. finishWorkerTask(task);
  439. });
  440. }));
  441. }
  442. }
  443. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  444. let newRefs = [];
  445. let xfaData = null;
  446. if (isPureXfa) {
  447. xfaData = refs[0];
  448. if (!xfaData) {
  449. return stream.bytes;
  450. }
  451. } else {
  452. newRefs = refs.flat(2);
  453. if (newRefs.length === 0) {
  454. return stream.bytes;
  455. }
  456. }
  457. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  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. hasXfaDatasetsEntry = true;
  466. }
  467. }
  468. if (xfaDatasetsRef === null) {
  469. xfaDatasetsRef = xref.getNewTemporaryRef();
  470. }
  471. } else if (xfa) {
  472. (0, _util.warn)("Unsupported XFA type.");
  473. }
  474. let newXrefInfo = Object.create(null);
  475. if (xref.trailer) {
  476. const infoObj = Object.create(null);
  477. const xrefInfo = xref.trailer.get("Info") || null;
  478. if (xrefInfo instanceof _primitives.Dict) {
  479. xrefInfo.forEach((key, value) => {
  480. if (typeof value === "string") {
  481. infoObj[key] = (0, _util.stringToPDFString)(value);
  482. }
  483. });
  484. }
  485. newXrefInfo = {
  486. rootRef: xref.trailer.getRaw("Root") || null,
  487. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  488. newRef: xref.getNewTemporaryRef(),
  489. infoRef: xref.trailer.getRaw("Info") || null,
  490. info: infoObj,
  491. fileIds: xref.trailer.get("ID") || null,
  492. startXRef,
  493. filename
  494. };
  495. }
  496. try {
  497. return (0, _writer.incrementalUpdate)({
  498. originalData: stream.bytes,
  499. xrefInfo: newXrefInfo,
  500. newRefs,
  501. xref,
  502. hasXfa: !!xfa,
  503. xfaDatasetsRef,
  504. hasXfaDatasetsEntry,
  505. needAppearances,
  506. acroFormRef,
  507. acroForm,
  508. xfaData
  509. });
  510. } finally {
  511. xref.resetNewTemporaryRef();
  512. }
  513. });
  514. });
  515. handler.on("GetOperatorList", function (data, sink) {
  516. const pageIndex = data.pageIndex;
  517. pdfManager.getPage(pageIndex).then(function (page) {
  518. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  519. startWorkerTask(task);
  520. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  521. page.getOperatorList({
  522. handler,
  523. sink,
  524. task,
  525. intent: data.intent,
  526. cacheKey: data.cacheKey,
  527. annotationStorage: data.annotationStorage
  528. }).then(function (operatorListInfo) {
  529. finishWorkerTask(task);
  530. if (start) {
  531. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  532. }
  533. sink.close();
  534. }, function (reason) {
  535. finishWorkerTask(task);
  536. if (task.terminated) {
  537. return;
  538. }
  539. sink.error(reason);
  540. });
  541. });
  542. });
  543. handler.on("GetTextContent", function (data, sink) {
  544. const pageIndex = data.pageIndex;
  545. pdfManager.getPage(pageIndex).then(function (page) {
  546. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  547. startWorkerTask(task);
  548. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  549. page.extractTextContent({
  550. handler,
  551. task,
  552. sink,
  553. includeMarkedContent: data.includeMarkedContent,
  554. combineTextItems: data.combineTextItems
  555. }).then(function () {
  556. finishWorkerTask(task);
  557. if (start) {
  558. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  559. }
  560. sink.close();
  561. }, function (reason) {
  562. finishWorkerTask(task);
  563. if (task.terminated) {
  564. return;
  565. }
  566. sink.error(reason);
  567. });
  568. });
  569. });
  570. handler.on("GetStructTree", function (data) {
  571. return pdfManager.getPage(data.pageIndex).then(function (page) {
  572. return pdfManager.ensure(page, "getStructTree");
  573. });
  574. });
  575. handler.on("FontFallback", function (data) {
  576. return pdfManager.fontFallback(data.id, handler);
  577. });
  578. handler.on("Cleanup", function (data) {
  579. return pdfManager.cleanup(true);
  580. });
  581. handler.on("Terminate", function (data) {
  582. terminated = true;
  583. const waitOn = [];
  584. if (pdfManager) {
  585. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  586. const cleanupPromise = pdfManager.cleanup();
  587. waitOn.push(cleanupPromise);
  588. pdfManager = null;
  589. } else {
  590. (0, _cleanup_helper.clearGlobalCaches)();
  591. }
  592. if (cancelXHRs) {
  593. cancelXHRs(new _util.AbortException("Worker was terminated."));
  594. }
  595. for (const task of WorkerTasks) {
  596. waitOn.push(task.finished);
  597. task.terminate();
  598. }
  599. return Promise.all(waitOn).then(function () {
  600. handler.destroy();
  601. handler = null;
  602. });
  603. });
  604. handler.on("Ready", function (data) {
  605. setupDoc(docParams);
  606. docParams = null;
  607. });
  608. return workerHandlerName;
  609. }
  610. static initializeFromPort(port) {
  611. const handler = new _message_handler.MessageHandler("worker", "main", port);
  612. WorkerMessageHandler.setup(handler, port);
  613. handler.send("ready", null);
  614. }
  615. }
  616. exports.WorkerMessageHandler = WorkerMessageHandler;
  617. function isMessagePort(maybePort) {
  618. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  619. }
  620. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  621. WorkerMessageHandler.initializeFromPort(self);
  622. }
  623. /***/ }),
  624. /* 2 */
  625. /***/ ((__unused_webpack_module, exports) => {
  626. Object.defineProperty(exports, "__esModule", ({
  627. value: true
  628. }));
  629. 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.BASELINE_FACTOR = 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;
  630. exports.arrayByteLength = arrayByteLength;
  631. exports.arraysToBytes = arraysToBytes;
  632. exports.assert = assert;
  633. exports.bytesToString = bytesToString;
  634. exports.createPromiseCapability = createPromiseCapability;
  635. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  636. exports.getModificationDate = getModificationDate;
  637. exports.getVerbosityLevel = getVerbosityLevel;
  638. exports.info = info;
  639. exports.isArrayBuffer = isArrayBuffer;
  640. exports.isArrayEqual = isArrayEqual;
  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.stringToUTF8String = stringToUTF8String;
  649. exports.unreachable = unreachable;
  650. exports.utf8StringToString = utf8StringToString;
  651. exports.warn = warn;
  652. ;
  653. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  654. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  655. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  656. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  657. const LINE_FACTOR = 1.35;
  658. exports.LINE_FACTOR = LINE_FACTOR;
  659. const LINE_DESCENT_FACTOR = 0.35;
  660. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  661. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  662. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  663. const RenderingIntentFlag = {
  664. ANY: 0x01,
  665. DISPLAY: 0x02,
  666. PRINT: 0x04,
  667. SAVE: 0x08,
  668. ANNOTATIONS_FORMS: 0x10,
  669. ANNOTATIONS_STORAGE: 0x20,
  670. ANNOTATIONS_DISABLE: 0x40,
  671. OPLIST: 0x100
  672. };
  673. exports.RenderingIntentFlag = RenderingIntentFlag;
  674. const AnnotationMode = {
  675. DISABLE: 0,
  676. ENABLE: 1,
  677. ENABLE_FORMS: 2,
  678. ENABLE_STORAGE: 3
  679. };
  680. exports.AnnotationMode = AnnotationMode;
  681. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  682. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  683. const AnnotationEditorType = {
  684. DISABLE: -1,
  685. NONE: 0,
  686. FREETEXT: 3,
  687. INK: 15
  688. };
  689. exports.AnnotationEditorType = AnnotationEditorType;
  690. const AnnotationEditorParamsType = {
  691. FREETEXT_SIZE: 1,
  692. FREETEXT_COLOR: 2,
  693. FREETEXT_OPACITY: 3,
  694. INK_COLOR: 11,
  695. INK_THICKNESS: 12,
  696. INK_OPACITY: 13
  697. };
  698. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  699. const PermissionFlag = {
  700. PRINT: 0x04,
  701. MODIFY_CONTENTS: 0x08,
  702. COPY: 0x10,
  703. MODIFY_ANNOTATIONS: 0x20,
  704. FILL_INTERACTIVE_FORMS: 0x100,
  705. COPY_FOR_ACCESSIBILITY: 0x200,
  706. ASSEMBLE: 0x400,
  707. PRINT_HIGH_QUALITY: 0x800
  708. };
  709. exports.PermissionFlag = PermissionFlag;
  710. const TextRenderingMode = {
  711. FILL: 0,
  712. STROKE: 1,
  713. FILL_STROKE: 2,
  714. INVISIBLE: 3,
  715. FILL_ADD_TO_PATH: 4,
  716. STROKE_ADD_TO_PATH: 5,
  717. FILL_STROKE_ADD_TO_PATH: 6,
  718. ADD_TO_PATH: 7,
  719. FILL_STROKE_MASK: 3,
  720. ADD_TO_PATH_FLAG: 4
  721. };
  722. exports.TextRenderingMode = TextRenderingMode;
  723. const ImageKind = {
  724. GRAYSCALE_1BPP: 1,
  725. RGB_24BPP: 2,
  726. RGBA_32BPP: 3
  727. };
  728. exports.ImageKind = ImageKind;
  729. const AnnotationType = {
  730. TEXT: 1,
  731. LINK: 2,
  732. FREETEXT: 3,
  733. LINE: 4,
  734. SQUARE: 5,
  735. CIRCLE: 6,
  736. POLYGON: 7,
  737. POLYLINE: 8,
  738. HIGHLIGHT: 9,
  739. UNDERLINE: 10,
  740. SQUIGGLY: 11,
  741. STRIKEOUT: 12,
  742. STAMP: 13,
  743. CARET: 14,
  744. INK: 15,
  745. POPUP: 16,
  746. FILEATTACHMENT: 17,
  747. SOUND: 18,
  748. MOVIE: 19,
  749. WIDGET: 20,
  750. SCREEN: 21,
  751. PRINTERMARK: 22,
  752. TRAPNET: 23,
  753. WATERMARK: 24,
  754. THREED: 25,
  755. REDACT: 26
  756. };
  757. exports.AnnotationType = AnnotationType;
  758. const AnnotationStateModelType = {
  759. MARKED: "Marked",
  760. REVIEW: "Review"
  761. };
  762. exports.AnnotationStateModelType = AnnotationStateModelType;
  763. const AnnotationMarkedState = {
  764. MARKED: "Marked",
  765. UNMARKED: "Unmarked"
  766. };
  767. exports.AnnotationMarkedState = AnnotationMarkedState;
  768. const AnnotationReviewState = {
  769. ACCEPTED: "Accepted",
  770. REJECTED: "Rejected",
  771. CANCELLED: "Cancelled",
  772. COMPLETED: "Completed",
  773. NONE: "None"
  774. };
  775. exports.AnnotationReviewState = AnnotationReviewState;
  776. const AnnotationReplyType = {
  777. GROUP: "Group",
  778. REPLY: "R"
  779. };
  780. exports.AnnotationReplyType = AnnotationReplyType;
  781. const AnnotationFlag = {
  782. INVISIBLE: 0x01,
  783. HIDDEN: 0x02,
  784. PRINT: 0x04,
  785. NOZOOM: 0x08,
  786. NOROTATE: 0x10,
  787. NOVIEW: 0x20,
  788. READONLY: 0x40,
  789. LOCKED: 0x80,
  790. TOGGLENOVIEW: 0x100,
  791. LOCKEDCONTENTS: 0x200
  792. };
  793. exports.AnnotationFlag = AnnotationFlag;
  794. const AnnotationFieldFlag = {
  795. READONLY: 0x0000001,
  796. REQUIRED: 0x0000002,
  797. NOEXPORT: 0x0000004,
  798. MULTILINE: 0x0001000,
  799. PASSWORD: 0x0002000,
  800. NOTOGGLETOOFF: 0x0004000,
  801. RADIO: 0x0008000,
  802. PUSHBUTTON: 0x0010000,
  803. COMBO: 0x0020000,
  804. EDIT: 0x0040000,
  805. SORT: 0x0080000,
  806. FILESELECT: 0x0100000,
  807. MULTISELECT: 0x0200000,
  808. DONOTSPELLCHECK: 0x0400000,
  809. DONOTSCROLL: 0x0800000,
  810. COMB: 0x1000000,
  811. RICHTEXT: 0x2000000,
  812. RADIOSINUNISON: 0x2000000,
  813. COMMITONSELCHANGE: 0x4000000
  814. };
  815. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  816. const AnnotationBorderStyleType = {
  817. SOLID: 1,
  818. DASHED: 2,
  819. BEVELED: 3,
  820. INSET: 4,
  821. UNDERLINE: 5
  822. };
  823. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  824. const AnnotationActionEventType = {
  825. E: "Mouse Enter",
  826. X: "Mouse Exit",
  827. D: "Mouse Down",
  828. U: "Mouse Up",
  829. Fo: "Focus",
  830. Bl: "Blur",
  831. PO: "PageOpen",
  832. PC: "PageClose",
  833. PV: "PageVisible",
  834. PI: "PageInvisible",
  835. K: "Keystroke",
  836. F: "Format",
  837. V: "Validate",
  838. C: "Calculate"
  839. };
  840. exports.AnnotationActionEventType = AnnotationActionEventType;
  841. const DocumentActionEventType = {
  842. WC: "WillClose",
  843. WS: "WillSave",
  844. DS: "DidSave",
  845. WP: "WillPrint",
  846. DP: "DidPrint"
  847. };
  848. exports.DocumentActionEventType = DocumentActionEventType;
  849. const PageActionEventType = {
  850. O: "PageOpen",
  851. C: "PageClose"
  852. };
  853. exports.PageActionEventType = PageActionEventType;
  854. const StreamType = {
  855. UNKNOWN: "UNKNOWN",
  856. FLATE: "FLATE",
  857. LZW: "LZW",
  858. DCT: "DCT",
  859. JPX: "JPX",
  860. JBIG: "JBIG",
  861. A85: "A85",
  862. AHX: "AHX",
  863. CCF: "CCF",
  864. RLX: "RLX"
  865. };
  866. exports.StreamType = StreamType;
  867. const FontType = {
  868. UNKNOWN: "UNKNOWN",
  869. TYPE1: "TYPE1",
  870. TYPE1STANDARD: "TYPE1STANDARD",
  871. TYPE1C: "TYPE1C",
  872. CIDFONTTYPE0: "CIDFONTTYPE0",
  873. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  874. TRUETYPE: "TRUETYPE",
  875. CIDFONTTYPE2: "CIDFONTTYPE2",
  876. TYPE3: "TYPE3",
  877. OPENTYPE: "OPENTYPE",
  878. TYPE0: "TYPE0",
  879. MMTYPE1: "MMTYPE1"
  880. };
  881. exports.FontType = FontType;
  882. const VerbosityLevel = {
  883. ERRORS: 0,
  884. WARNINGS: 1,
  885. INFOS: 5
  886. };
  887. exports.VerbosityLevel = VerbosityLevel;
  888. const CMapCompressionType = {
  889. NONE: 0,
  890. BINARY: 1
  891. };
  892. exports.CMapCompressionType = CMapCompressionType;
  893. const OPS = {
  894. dependency: 1,
  895. setLineWidth: 2,
  896. setLineCap: 3,
  897. setLineJoin: 4,
  898. setMiterLimit: 5,
  899. setDash: 6,
  900. setRenderingIntent: 7,
  901. setFlatness: 8,
  902. setGState: 9,
  903. save: 10,
  904. restore: 11,
  905. transform: 12,
  906. moveTo: 13,
  907. lineTo: 14,
  908. curveTo: 15,
  909. curveTo2: 16,
  910. curveTo3: 17,
  911. closePath: 18,
  912. rectangle: 19,
  913. stroke: 20,
  914. closeStroke: 21,
  915. fill: 22,
  916. eoFill: 23,
  917. fillStroke: 24,
  918. eoFillStroke: 25,
  919. closeFillStroke: 26,
  920. closeEOFillStroke: 27,
  921. endPath: 28,
  922. clip: 29,
  923. eoClip: 30,
  924. beginText: 31,
  925. endText: 32,
  926. setCharSpacing: 33,
  927. setWordSpacing: 34,
  928. setHScale: 35,
  929. setLeading: 36,
  930. setFont: 37,
  931. setTextRenderingMode: 38,
  932. setTextRise: 39,
  933. moveText: 40,
  934. setLeadingMoveText: 41,
  935. setTextMatrix: 42,
  936. nextLine: 43,
  937. showText: 44,
  938. showSpacedText: 45,
  939. nextLineShowText: 46,
  940. nextLineSetSpacingShowText: 47,
  941. setCharWidth: 48,
  942. setCharWidthAndBounds: 49,
  943. setStrokeColorSpace: 50,
  944. setFillColorSpace: 51,
  945. setStrokeColor: 52,
  946. setStrokeColorN: 53,
  947. setFillColor: 54,
  948. setFillColorN: 55,
  949. setStrokeGray: 56,
  950. setFillGray: 57,
  951. setStrokeRGBColor: 58,
  952. setFillRGBColor: 59,
  953. setStrokeCMYKColor: 60,
  954. setFillCMYKColor: 61,
  955. shadingFill: 62,
  956. beginInlineImage: 63,
  957. beginImageData: 64,
  958. endInlineImage: 65,
  959. paintXObject: 66,
  960. markPoint: 67,
  961. markPointProps: 68,
  962. beginMarkedContent: 69,
  963. beginMarkedContentProps: 70,
  964. endMarkedContent: 71,
  965. beginCompat: 72,
  966. endCompat: 73,
  967. paintFormXObjectBegin: 74,
  968. paintFormXObjectEnd: 75,
  969. beginGroup: 76,
  970. endGroup: 77,
  971. beginAnnotation: 80,
  972. endAnnotation: 81,
  973. paintImageMaskXObject: 83,
  974. paintImageMaskXObjectGroup: 84,
  975. paintImageXObject: 85,
  976. paintInlineImageXObject: 86,
  977. paintInlineImageXObjectGroup: 87,
  978. paintImageXObjectRepeat: 88,
  979. paintImageMaskXObjectRepeat: 89,
  980. paintSolidColorImageMask: 90,
  981. constructPath: 91
  982. };
  983. exports.OPS = OPS;
  984. const UNSUPPORTED_FEATURES = {
  985. forms: "forms",
  986. javaScript: "javaScript",
  987. signatures: "signatures",
  988. smask: "smask",
  989. shadingPattern: "shadingPattern",
  990. errorTilingPattern: "errorTilingPattern",
  991. errorExtGState: "errorExtGState",
  992. errorXObject: "errorXObject",
  993. errorFontLoadType3: "errorFontLoadType3",
  994. errorFontState: "errorFontState",
  995. errorFontMissing: "errorFontMissing",
  996. errorFontTranslate: "errorFontTranslate",
  997. errorColorSpace: "errorColorSpace",
  998. errorOperatorList: "errorOperatorList",
  999. errorFontToUnicode: "errorFontToUnicode",
  1000. errorFontLoadNative: "errorFontLoadNative",
  1001. errorFontBuildPath: "errorFontBuildPath",
  1002. errorFontGetPath: "errorFontGetPath",
  1003. errorMarkedContent: "errorMarkedContent",
  1004. errorContentSubStream: "errorContentSubStream"
  1005. };
  1006. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1007. const PasswordResponses = {
  1008. NEED_PASSWORD: 1,
  1009. INCORRECT_PASSWORD: 2
  1010. };
  1011. exports.PasswordResponses = PasswordResponses;
  1012. let verbosity = VerbosityLevel.WARNINGS;
  1013. function setVerbosityLevel(level) {
  1014. if (Number.isInteger(level)) {
  1015. verbosity = level;
  1016. }
  1017. }
  1018. function getVerbosityLevel() {
  1019. return verbosity;
  1020. }
  1021. function info(msg) {
  1022. if (verbosity >= VerbosityLevel.INFOS) {
  1023. console.log(`Info: ${msg}`);
  1024. }
  1025. }
  1026. function warn(msg) {
  1027. if (verbosity >= VerbosityLevel.WARNINGS) {
  1028. console.log(`Warning: ${msg}`);
  1029. }
  1030. }
  1031. function unreachable(msg) {
  1032. throw new Error(msg);
  1033. }
  1034. function assert(cond, msg) {
  1035. if (!cond) {
  1036. unreachable(msg);
  1037. }
  1038. }
  1039. function _isValidProtocol(url) {
  1040. if (!url) {
  1041. return false;
  1042. }
  1043. switch (url.protocol) {
  1044. case "http:":
  1045. case "https:":
  1046. case "ftp:":
  1047. case "mailto:":
  1048. case "tel:":
  1049. return true;
  1050. default:
  1051. return false;
  1052. }
  1053. }
  1054. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1055. if (!url) {
  1056. return null;
  1057. }
  1058. try {
  1059. if (options && typeof url === "string") {
  1060. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1061. const dots = url.match(/\./g);
  1062. if (dots && dots.length >= 2) {
  1063. url = `http://${url}`;
  1064. }
  1065. }
  1066. if (options.tryConvertEncoding) {
  1067. try {
  1068. url = stringToUTF8String(url);
  1069. } catch (ex) {}
  1070. }
  1071. }
  1072. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1073. if (_isValidProtocol(absoluteUrl)) {
  1074. return absoluteUrl;
  1075. }
  1076. } catch (ex) {}
  1077. return null;
  1078. }
  1079. function shadow(obj, prop, value, nonSerializable = false) {
  1080. Object.defineProperty(obj, prop, {
  1081. value,
  1082. enumerable: !nonSerializable,
  1083. configurable: true,
  1084. writable: false
  1085. });
  1086. return value;
  1087. }
  1088. const BaseException = function BaseExceptionClosure() {
  1089. function BaseException(message, name) {
  1090. if (this.constructor === BaseException) {
  1091. unreachable("Cannot initialize BaseException.");
  1092. }
  1093. this.message = message;
  1094. this.name = name;
  1095. }
  1096. BaseException.prototype = new Error();
  1097. BaseException.constructor = BaseException;
  1098. return BaseException;
  1099. }();
  1100. exports.BaseException = BaseException;
  1101. class PasswordException extends BaseException {
  1102. constructor(msg, code) {
  1103. super(msg, "PasswordException");
  1104. this.code = code;
  1105. }
  1106. }
  1107. exports.PasswordException = PasswordException;
  1108. class UnknownErrorException extends BaseException {
  1109. constructor(msg, details) {
  1110. super(msg, "UnknownErrorException");
  1111. this.details = details;
  1112. }
  1113. }
  1114. exports.UnknownErrorException = UnknownErrorException;
  1115. class InvalidPDFException extends BaseException {
  1116. constructor(msg) {
  1117. super(msg, "InvalidPDFException");
  1118. }
  1119. }
  1120. exports.InvalidPDFException = InvalidPDFException;
  1121. class MissingPDFException extends BaseException {
  1122. constructor(msg) {
  1123. super(msg, "MissingPDFException");
  1124. }
  1125. }
  1126. exports.MissingPDFException = MissingPDFException;
  1127. class UnexpectedResponseException extends BaseException {
  1128. constructor(msg, status) {
  1129. super(msg, "UnexpectedResponseException");
  1130. this.status = status;
  1131. }
  1132. }
  1133. exports.UnexpectedResponseException = UnexpectedResponseException;
  1134. class FormatError extends BaseException {
  1135. constructor(msg) {
  1136. super(msg, "FormatError");
  1137. }
  1138. }
  1139. exports.FormatError = FormatError;
  1140. class AbortException extends BaseException {
  1141. constructor(msg) {
  1142. super(msg, "AbortException");
  1143. }
  1144. }
  1145. exports.AbortException = AbortException;
  1146. function bytesToString(bytes) {
  1147. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1148. unreachable("Invalid argument for bytesToString");
  1149. }
  1150. const length = bytes.length;
  1151. const MAX_ARGUMENT_COUNT = 8192;
  1152. if (length < MAX_ARGUMENT_COUNT) {
  1153. return String.fromCharCode.apply(null, bytes);
  1154. }
  1155. const strBuf = [];
  1156. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1157. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1158. const chunk = bytes.subarray(i, chunkEnd);
  1159. strBuf.push(String.fromCharCode.apply(null, chunk));
  1160. }
  1161. return strBuf.join("");
  1162. }
  1163. function stringToBytes(str) {
  1164. if (typeof str !== "string") {
  1165. unreachable("Invalid argument for stringToBytes");
  1166. }
  1167. const length = str.length;
  1168. const bytes = new Uint8Array(length);
  1169. for (let i = 0; i < length; ++i) {
  1170. bytes[i] = str.charCodeAt(i) & 0xff;
  1171. }
  1172. return bytes;
  1173. }
  1174. function arrayByteLength(arr) {
  1175. if (arr.length !== undefined) {
  1176. return arr.length;
  1177. }
  1178. if (arr.byteLength !== undefined) {
  1179. return arr.byteLength;
  1180. }
  1181. unreachable("Invalid argument for arrayByteLength");
  1182. }
  1183. function arraysToBytes(arr) {
  1184. const length = arr.length;
  1185. if (length === 1 && arr[0] instanceof Uint8Array) {
  1186. return arr[0];
  1187. }
  1188. let resultLength = 0;
  1189. for (let i = 0; i < length; i++) {
  1190. resultLength += arrayByteLength(arr[i]);
  1191. }
  1192. let pos = 0;
  1193. const data = new Uint8Array(resultLength);
  1194. for (let i = 0; i < length; i++) {
  1195. let item = arr[i];
  1196. if (!(item instanceof Uint8Array)) {
  1197. if (typeof item === "string") {
  1198. item = stringToBytes(item);
  1199. } else {
  1200. item = new Uint8Array(item);
  1201. }
  1202. }
  1203. const itemLength = item.byteLength;
  1204. data.set(item, pos);
  1205. pos += itemLength;
  1206. }
  1207. return data;
  1208. }
  1209. function string32(value) {
  1210. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1211. }
  1212. function objectSize(obj) {
  1213. return Object.keys(obj).length;
  1214. }
  1215. function objectFromMap(map) {
  1216. const obj = Object.create(null);
  1217. for (const [key, value] of map) {
  1218. obj[key] = value;
  1219. }
  1220. return obj;
  1221. }
  1222. function isLittleEndian() {
  1223. const buffer8 = new Uint8Array(4);
  1224. buffer8[0] = 1;
  1225. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1226. return view32[0] === 1;
  1227. }
  1228. function isEvalSupported() {
  1229. try {
  1230. new Function("");
  1231. return true;
  1232. } catch (e) {
  1233. return false;
  1234. }
  1235. }
  1236. class FeatureTest {
  1237. static get isLittleEndian() {
  1238. return shadow(this, "isLittleEndian", isLittleEndian());
  1239. }
  1240. static get isEvalSupported() {
  1241. return shadow(this, "isEvalSupported", isEvalSupported());
  1242. }
  1243. static get isOffscreenCanvasSupported() {
  1244. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1245. }
  1246. }
  1247. exports.FeatureTest = FeatureTest;
  1248. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1249. class Util {
  1250. static makeHexColor(r, g, b) {
  1251. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1252. }
  1253. static scaleMinMax(transform, minMax) {
  1254. let temp;
  1255. if (transform[0]) {
  1256. if (transform[0] < 0) {
  1257. temp = minMax[0];
  1258. minMax[0] = minMax[1];
  1259. minMax[1] = temp;
  1260. }
  1261. minMax[0] *= transform[0];
  1262. minMax[1] *= transform[0];
  1263. if (transform[3] < 0) {
  1264. temp = minMax[2];
  1265. minMax[2] = minMax[3];
  1266. minMax[3] = temp;
  1267. }
  1268. minMax[2] *= transform[3];
  1269. minMax[3] *= transform[3];
  1270. } else {
  1271. temp = minMax[0];
  1272. minMax[0] = minMax[2];
  1273. minMax[2] = temp;
  1274. temp = minMax[1];
  1275. minMax[1] = minMax[3];
  1276. minMax[3] = temp;
  1277. if (transform[1] < 0) {
  1278. temp = minMax[2];
  1279. minMax[2] = minMax[3];
  1280. minMax[3] = temp;
  1281. }
  1282. minMax[2] *= transform[1];
  1283. minMax[3] *= transform[1];
  1284. if (transform[2] < 0) {
  1285. temp = minMax[0];
  1286. minMax[0] = minMax[1];
  1287. minMax[1] = temp;
  1288. }
  1289. minMax[0] *= transform[2];
  1290. minMax[1] *= transform[2];
  1291. }
  1292. minMax[0] += transform[4];
  1293. minMax[1] += transform[4];
  1294. minMax[2] += transform[5];
  1295. minMax[3] += transform[5];
  1296. }
  1297. static transform(m1, m2) {
  1298. 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]];
  1299. }
  1300. static applyTransform(p, m) {
  1301. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1302. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1303. return [xt, yt];
  1304. }
  1305. static applyInverseTransform(p, m) {
  1306. const d = m[0] * m[3] - m[1] * m[2];
  1307. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1308. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1309. return [xt, yt];
  1310. }
  1311. static getAxialAlignedBoundingBox(r, m) {
  1312. const p1 = Util.applyTransform(r, m);
  1313. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1314. const p3 = Util.applyTransform([r[0], r[3]], m);
  1315. const p4 = Util.applyTransform([r[2], r[1]], m);
  1316. 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])];
  1317. }
  1318. static inverseTransform(m) {
  1319. const d = m[0] * m[3] - m[1] * m[2];
  1320. 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];
  1321. }
  1322. static singularValueDecompose2dScale(m) {
  1323. const transpose = [m[0], m[2], m[1], m[3]];
  1324. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1325. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1326. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1327. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1328. const first = (a + d) / 2;
  1329. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1330. const sx = first + second || 1;
  1331. const sy = first - second || 1;
  1332. return [Math.sqrt(sx), Math.sqrt(sy)];
  1333. }
  1334. static normalizeRect(rect) {
  1335. const r = rect.slice(0);
  1336. if (rect[0] > rect[2]) {
  1337. r[0] = rect[2];
  1338. r[2] = rect[0];
  1339. }
  1340. if (rect[1] > rect[3]) {
  1341. r[1] = rect[3];
  1342. r[3] = rect[1];
  1343. }
  1344. return r;
  1345. }
  1346. static intersect(rect1, rect2) {
  1347. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1348. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1349. if (xLow > xHigh) {
  1350. return null;
  1351. }
  1352. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1353. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1354. if (yLow > yHigh) {
  1355. return null;
  1356. }
  1357. return [xLow, yLow, xHigh, yHigh];
  1358. }
  1359. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1360. const tvalues = [],
  1361. bounds = [[], []];
  1362. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1363. for (let i = 0; i < 2; ++i) {
  1364. if (i === 0) {
  1365. b = 6 * x0 - 12 * x1 + 6 * x2;
  1366. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1367. c = 3 * x1 - 3 * x0;
  1368. } else {
  1369. b = 6 * y0 - 12 * y1 + 6 * y2;
  1370. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1371. c = 3 * y1 - 3 * y0;
  1372. }
  1373. if (Math.abs(a) < 1e-12) {
  1374. if (Math.abs(b) < 1e-12) {
  1375. continue;
  1376. }
  1377. t = -c / b;
  1378. if (0 < t && t < 1) {
  1379. tvalues.push(t);
  1380. }
  1381. continue;
  1382. }
  1383. b2ac = b * b - 4 * c * a;
  1384. sqrtb2ac = Math.sqrt(b2ac);
  1385. if (b2ac < 0) {
  1386. continue;
  1387. }
  1388. t1 = (-b + sqrtb2ac) / (2 * a);
  1389. if (0 < t1 && t1 < 1) {
  1390. tvalues.push(t1);
  1391. }
  1392. t2 = (-b - sqrtb2ac) / (2 * a);
  1393. if (0 < t2 && t2 < 1) {
  1394. tvalues.push(t2);
  1395. }
  1396. }
  1397. let j = tvalues.length,
  1398. mt;
  1399. const jlen = j;
  1400. while (j--) {
  1401. t = tvalues[j];
  1402. mt = 1 - t;
  1403. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1404. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1405. }
  1406. bounds[0][jlen] = x0;
  1407. bounds[1][jlen] = y0;
  1408. bounds[0][jlen + 1] = x3;
  1409. bounds[1][jlen + 1] = y3;
  1410. bounds[0].length = bounds[1].length = jlen + 2;
  1411. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1412. }
  1413. }
  1414. exports.Util = Util;
  1415. 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];
  1416. function stringToPDFString(str) {
  1417. if (str[0] >= "\xEF") {
  1418. let encoding;
  1419. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1420. encoding = "utf-16be";
  1421. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1422. encoding = "utf-16le";
  1423. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1424. encoding = "utf-8";
  1425. }
  1426. if (encoding) {
  1427. try {
  1428. const decoder = new TextDecoder(encoding, {
  1429. fatal: true
  1430. });
  1431. const buffer = stringToBytes(str);
  1432. return decoder.decode(buffer);
  1433. } catch (ex) {
  1434. warn(`stringToPDFString: "${ex}".`);
  1435. }
  1436. }
  1437. }
  1438. const strBuf = [];
  1439. for (let i = 0, ii = str.length; i < ii; i++) {
  1440. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1441. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1442. }
  1443. return strBuf.join("");
  1444. }
  1445. function stringToUTF8String(str) {
  1446. return decodeURIComponent(escape(str));
  1447. }
  1448. function utf8StringToString(str) {
  1449. return unescape(encodeURIComponent(str));
  1450. }
  1451. function isArrayBuffer(v) {
  1452. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1453. }
  1454. function isArrayEqual(arr1, arr2) {
  1455. if (arr1.length !== arr2.length) {
  1456. return false;
  1457. }
  1458. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1459. if (arr1[i] !== arr2[i]) {
  1460. return false;
  1461. }
  1462. }
  1463. return true;
  1464. }
  1465. function getModificationDate(date = new Date()) {
  1466. 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")];
  1467. return buffer.join("");
  1468. }
  1469. function createPromiseCapability() {
  1470. const capability = Object.create(null);
  1471. let isSettled = false;
  1472. Object.defineProperty(capability, "settled", {
  1473. get() {
  1474. return isSettled;
  1475. }
  1476. });
  1477. capability.promise = new Promise(function (resolve, reject) {
  1478. capability.resolve = function (data) {
  1479. isSettled = true;
  1480. resolve(data);
  1481. };
  1482. capability.reject = function (reason) {
  1483. isSettled = true;
  1484. reject(reason);
  1485. };
  1486. });
  1487. return capability;
  1488. }
  1489. /***/ }),
  1490. /* 3 */
  1491. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1492. Object.defineProperty(exports, "__esModule", ({
  1493. value: true
  1494. }));
  1495. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1496. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1497. exports.isCmd = isCmd;
  1498. exports.isDict = isDict;
  1499. exports.isName = isName;
  1500. exports.isRefsEqual = isRefsEqual;
  1501. var _util = __w_pdfjs_require__(2);
  1502. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1503. exports.CIRCULAR_REF = CIRCULAR_REF;
  1504. const EOF = Symbol("EOF");
  1505. exports.EOF = EOF;
  1506. const Name = function NameClosure() {
  1507. let nameCache = Object.create(null);
  1508. class Name {
  1509. constructor(name) {
  1510. this.name = name;
  1511. }
  1512. static get(name) {
  1513. return nameCache[name] || (nameCache[name] = new Name(name));
  1514. }
  1515. static _clearCache() {
  1516. nameCache = Object.create(null);
  1517. }
  1518. }
  1519. return Name;
  1520. }();
  1521. exports.Name = Name;
  1522. const Cmd = function CmdClosure() {
  1523. let cmdCache = Object.create(null);
  1524. class Cmd {
  1525. constructor(cmd) {
  1526. this.cmd = cmd;
  1527. }
  1528. static get(cmd) {
  1529. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1530. }
  1531. static _clearCache() {
  1532. cmdCache = Object.create(null);
  1533. }
  1534. }
  1535. return Cmd;
  1536. }();
  1537. exports.Cmd = Cmd;
  1538. const nonSerializable = function nonSerializableClosure() {
  1539. return nonSerializable;
  1540. };
  1541. class Dict {
  1542. constructor(xref = null) {
  1543. this._map = Object.create(null);
  1544. this.xref = xref;
  1545. this.objId = null;
  1546. this.suppressEncryption = false;
  1547. this.__nonSerializable__ = nonSerializable;
  1548. }
  1549. assignXref(newXref) {
  1550. this.xref = newXref;
  1551. }
  1552. get size() {
  1553. return Object.keys(this._map).length;
  1554. }
  1555. get(key1, key2, key3) {
  1556. let value = this._map[key1];
  1557. if (value === undefined && key2 !== undefined) {
  1558. value = this._map[key2];
  1559. if (value === undefined && key3 !== undefined) {
  1560. value = this._map[key3];
  1561. }
  1562. }
  1563. if (value instanceof Ref && this.xref) {
  1564. return this.xref.fetch(value, this.suppressEncryption);
  1565. }
  1566. return value;
  1567. }
  1568. async getAsync(key1, key2, key3) {
  1569. let value = this._map[key1];
  1570. if (value === undefined && key2 !== undefined) {
  1571. value = this._map[key2];
  1572. if (value === undefined && key3 !== undefined) {
  1573. value = this._map[key3];
  1574. }
  1575. }
  1576. if (value instanceof Ref && this.xref) {
  1577. return this.xref.fetchAsync(value, this.suppressEncryption);
  1578. }
  1579. return value;
  1580. }
  1581. getArray(key1, key2, key3) {
  1582. let value = this._map[key1];
  1583. if (value === undefined && key2 !== undefined) {
  1584. value = this._map[key2];
  1585. if (value === undefined && key3 !== undefined) {
  1586. value = this._map[key3];
  1587. }
  1588. }
  1589. if (value instanceof Ref && this.xref) {
  1590. value = this.xref.fetch(value, this.suppressEncryption);
  1591. }
  1592. if (Array.isArray(value)) {
  1593. value = value.slice();
  1594. for (let i = 0, ii = value.length; i < ii; i++) {
  1595. if (value[i] instanceof Ref && this.xref) {
  1596. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1597. }
  1598. }
  1599. }
  1600. return value;
  1601. }
  1602. getRaw(key) {
  1603. return this._map[key];
  1604. }
  1605. getKeys() {
  1606. return Object.keys(this._map);
  1607. }
  1608. getRawValues() {
  1609. return Object.values(this._map);
  1610. }
  1611. set(key, value) {
  1612. this._map[key] = value;
  1613. }
  1614. has(key) {
  1615. return this._map[key] !== undefined;
  1616. }
  1617. forEach(callback) {
  1618. for (const key in this._map) {
  1619. callback(key, this.get(key));
  1620. }
  1621. }
  1622. static get empty() {
  1623. const emptyDict = new Dict(null);
  1624. emptyDict.set = (key, value) => {
  1625. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1626. };
  1627. return (0, _util.shadow)(this, "empty", emptyDict);
  1628. }
  1629. static merge({
  1630. xref,
  1631. dictArray,
  1632. mergeSubDicts = false
  1633. }) {
  1634. const mergedDict = new Dict(xref),
  1635. properties = new Map();
  1636. for (const dict of dictArray) {
  1637. if (!(dict instanceof Dict)) {
  1638. continue;
  1639. }
  1640. for (const [key, value] of Object.entries(dict._map)) {
  1641. let property = properties.get(key);
  1642. if (property === undefined) {
  1643. property = [];
  1644. properties.set(key, property);
  1645. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1646. continue;
  1647. }
  1648. property.push(value);
  1649. }
  1650. }
  1651. for (const [name, values] of properties) {
  1652. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1653. mergedDict._map[name] = values[0];
  1654. continue;
  1655. }
  1656. const subDict = new Dict(xref);
  1657. for (const dict of values) {
  1658. for (const [key, value] of Object.entries(dict._map)) {
  1659. if (subDict._map[key] === undefined) {
  1660. subDict._map[key] = value;
  1661. }
  1662. }
  1663. }
  1664. if (subDict.size > 0) {
  1665. mergedDict._map[name] = subDict;
  1666. }
  1667. }
  1668. properties.clear();
  1669. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1670. }
  1671. }
  1672. exports.Dict = Dict;
  1673. const Ref = function RefClosure() {
  1674. let refCache = Object.create(null);
  1675. class Ref {
  1676. constructor(num, gen) {
  1677. this.num = num;
  1678. this.gen = gen;
  1679. }
  1680. toString() {
  1681. if (this.gen === 0) {
  1682. return `${this.num}R`;
  1683. }
  1684. return `${this.num}R${this.gen}`;
  1685. }
  1686. static get(num, gen) {
  1687. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1688. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1689. }
  1690. static _clearCache() {
  1691. refCache = Object.create(null);
  1692. }
  1693. }
  1694. return Ref;
  1695. }();
  1696. exports.Ref = Ref;
  1697. class RefSet {
  1698. constructor(parent = null) {
  1699. this._set = new Set(parent && parent._set);
  1700. }
  1701. has(ref) {
  1702. return this._set.has(ref.toString());
  1703. }
  1704. put(ref) {
  1705. this._set.add(ref.toString());
  1706. }
  1707. remove(ref) {
  1708. this._set.delete(ref.toString());
  1709. }
  1710. [Symbol.iterator]() {
  1711. return this._set.values();
  1712. }
  1713. clear() {
  1714. this._set.clear();
  1715. }
  1716. }
  1717. exports.RefSet = RefSet;
  1718. class RefSetCache {
  1719. constructor() {
  1720. this._map = new Map();
  1721. }
  1722. get size() {
  1723. return this._map.size;
  1724. }
  1725. get(ref) {
  1726. return this._map.get(ref.toString());
  1727. }
  1728. has(ref) {
  1729. return this._map.has(ref.toString());
  1730. }
  1731. put(ref, obj) {
  1732. this._map.set(ref.toString(), obj);
  1733. }
  1734. putAlias(ref, aliasRef) {
  1735. this._map.set(ref.toString(), this.get(aliasRef));
  1736. }
  1737. [Symbol.iterator]() {
  1738. return this._map.values();
  1739. }
  1740. clear() {
  1741. this._map.clear();
  1742. }
  1743. }
  1744. exports.RefSetCache = RefSetCache;
  1745. function isName(v, name) {
  1746. return v instanceof Name && (name === undefined || v.name === name);
  1747. }
  1748. function isCmd(v, cmd) {
  1749. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1750. }
  1751. function isDict(v, type) {
  1752. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1753. }
  1754. function isRefsEqual(v1, v2) {
  1755. return v1.num === v2.num && v1.gen === v2.gen;
  1756. }
  1757. function clearPrimitiveCaches() {
  1758. Cmd._clearCache();
  1759. Name._clearCache();
  1760. Ref._clearCache();
  1761. }
  1762. /***/ }),
  1763. /* 4 */
  1764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1765. Object.defineProperty(exports, "__esModule", ({
  1766. value: true
  1767. }));
  1768. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  1769. exports.collectActions = collectActions;
  1770. exports.encodeToXmlString = encodeToXmlString;
  1771. exports.escapePDFName = escapePDFName;
  1772. exports.escapeString = escapeString;
  1773. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1774. exports.getInheritableProperty = getInheritableProperty;
  1775. exports.getLookupTableFactory = getLookupTableFactory;
  1776. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1777. exports.getRotationMatrix = getRotationMatrix;
  1778. exports.isAscii = isAscii;
  1779. exports.isWhiteSpace = isWhiteSpace;
  1780. exports.log2 = log2;
  1781. exports.numberToString = numberToString;
  1782. exports.parseXFAPath = parseXFAPath;
  1783. exports.readInt8 = readInt8;
  1784. exports.readUint16 = readUint16;
  1785. exports.readUint32 = readUint32;
  1786. exports.recoverJsURL = recoverJsURL;
  1787. exports.stringToUTF16HexString = stringToUTF16HexString;
  1788. exports.stringToUTF16String = stringToUTF16String;
  1789. exports.toRomanNumerals = toRomanNumerals;
  1790. exports.validateCSSFont = validateCSSFont;
  1791. var _util = __w_pdfjs_require__(2);
  1792. var _primitives = __w_pdfjs_require__(3);
  1793. var _base_stream = __w_pdfjs_require__(5);
  1794. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1795. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  1796. function getLookupTableFactory(initializer) {
  1797. let lookup;
  1798. return function () {
  1799. if (initializer) {
  1800. lookup = Object.create(null);
  1801. initializer(lookup);
  1802. initializer = null;
  1803. }
  1804. return lookup;
  1805. };
  1806. }
  1807. function getArrayLookupTableFactory(initializer) {
  1808. let lookup;
  1809. return function () {
  1810. if (initializer) {
  1811. let arr = initializer();
  1812. initializer = null;
  1813. lookup = Object.create(null);
  1814. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1815. lookup[arr[i]] = arr[i + 1];
  1816. }
  1817. arr = null;
  1818. }
  1819. return lookup;
  1820. };
  1821. }
  1822. class MissingDataException extends _util.BaseException {
  1823. constructor(begin, end) {
  1824. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1825. this.begin = begin;
  1826. this.end = end;
  1827. }
  1828. }
  1829. exports.MissingDataException = MissingDataException;
  1830. class ParserEOFException extends _util.BaseException {
  1831. constructor(msg) {
  1832. super(msg, "ParserEOFException");
  1833. }
  1834. }
  1835. exports.ParserEOFException = ParserEOFException;
  1836. class XRefEntryException extends _util.BaseException {
  1837. constructor(msg) {
  1838. super(msg, "XRefEntryException");
  1839. }
  1840. }
  1841. exports.XRefEntryException = XRefEntryException;
  1842. class XRefParseException extends _util.BaseException {
  1843. constructor(msg) {
  1844. super(msg, "XRefParseException");
  1845. }
  1846. }
  1847. exports.XRefParseException = XRefParseException;
  1848. class DocStats {
  1849. constructor(handler) {
  1850. this._handler = handler;
  1851. this._streamTypes = new Set();
  1852. this._fontTypes = new Set();
  1853. }
  1854. _send() {
  1855. const streamTypes = Object.create(null),
  1856. fontTypes = Object.create(null);
  1857. for (const type of this._streamTypes) {
  1858. streamTypes[type] = true;
  1859. }
  1860. for (const type of this._fontTypes) {
  1861. fontTypes[type] = true;
  1862. }
  1863. this._handler.send("DocStats", {
  1864. streamTypes,
  1865. fontTypes
  1866. });
  1867. }
  1868. addStreamType(type) {
  1869. if (this._streamTypes.has(type)) {
  1870. return;
  1871. }
  1872. this._streamTypes.add(type);
  1873. this._send();
  1874. }
  1875. addFontType(type) {
  1876. if (this._fontTypes.has(type)) {
  1877. return;
  1878. }
  1879. this._fontTypes.add(type);
  1880. this._send();
  1881. }
  1882. }
  1883. exports.DocStats = DocStats;
  1884. function getInheritableProperty({
  1885. dict,
  1886. key,
  1887. getArray = false,
  1888. stopWhenFound = true
  1889. }) {
  1890. let values;
  1891. const visited = new _primitives.RefSet();
  1892. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1893. if (dict.objId) {
  1894. visited.put(dict.objId);
  1895. }
  1896. const value = getArray ? dict.getArray(key) : dict.get(key);
  1897. if (value !== undefined) {
  1898. if (stopWhenFound) {
  1899. return value;
  1900. }
  1901. if (!values) {
  1902. values = [];
  1903. }
  1904. values.push(value);
  1905. }
  1906. dict = dict.get("Parent");
  1907. }
  1908. return values;
  1909. }
  1910. 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"];
  1911. function toRomanNumerals(number, lowerCase = false) {
  1912. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1913. const romanBuf = [];
  1914. let pos;
  1915. while (number >= 1000) {
  1916. number -= 1000;
  1917. romanBuf.push("M");
  1918. }
  1919. pos = number / 100 | 0;
  1920. number %= 100;
  1921. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1922. pos = number / 10 | 0;
  1923. number %= 10;
  1924. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1925. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1926. const romanStr = romanBuf.join("");
  1927. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1928. }
  1929. function log2(x) {
  1930. if (x <= 0) {
  1931. return 0;
  1932. }
  1933. return Math.ceil(Math.log2(x));
  1934. }
  1935. function readInt8(data, offset) {
  1936. return data[offset] << 24 >> 24;
  1937. }
  1938. function readUint16(data, offset) {
  1939. return data[offset] << 8 | data[offset + 1];
  1940. }
  1941. function readUint32(data, offset) {
  1942. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1943. }
  1944. function isWhiteSpace(ch) {
  1945. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1946. }
  1947. function parseXFAPath(path) {
  1948. const positionPattern = /(.+)\[(\d+)\]$/;
  1949. return path.split(".").map(component => {
  1950. const m = component.match(positionPattern);
  1951. if (m) {
  1952. return {
  1953. name: m[1],
  1954. pos: parseInt(m[2], 10)
  1955. };
  1956. }
  1957. return {
  1958. name: component,
  1959. pos: 0
  1960. };
  1961. });
  1962. }
  1963. function escapePDFName(str) {
  1964. const buffer = [];
  1965. let start = 0;
  1966. for (let i = 0, ii = str.length; i < ii; i++) {
  1967. const char = str.charCodeAt(i);
  1968. 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) {
  1969. if (start < i) {
  1970. buffer.push(str.substring(start, i));
  1971. }
  1972. buffer.push(`#${char.toString(16)}`);
  1973. start = i + 1;
  1974. }
  1975. }
  1976. if (buffer.length === 0) {
  1977. return str;
  1978. }
  1979. if (start < str.length) {
  1980. buffer.push(str.substring(start, str.length));
  1981. }
  1982. return buffer.join("");
  1983. }
  1984. function escapeString(str) {
  1985. return str.replace(/([()\\\n\r])/g, match => {
  1986. if (match === "\n") {
  1987. return "\\n";
  1988. } else if (match === "\r") {
  1989. return "\\r";
  1990. }
  1991. return `\\${match}`;
  1992. });
  1993. }
  1994. function _collectJS(entry, xref, list, parents) {
  1995. if (!entry) {
  1996. return;
  1997. }
  1998. let parent = null;
  1999. if (entry instanceof _primitives.Ref) {
  2000. if (parents.has(entry)) {
  2001. return;
  2002. }
  2003. parent = entry;
  2004. parents.put(parent);
  2005. entry = xref.fetch(entry);
  2006. }
  2007. if (Array.isArray(entry)) {
  2008. for (const element of entry) {
  2009. _collectJS(element, xref, list, parents);
  2010. }
  2011. } else if (entry instanceof _primitives.Dict) {
  2012. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2013. const js = entry.get("JS");
  2014. let code;
  2015. if (js instanceof _base_stream.BaseStream) {
  2016. code = js.getString();
  2017. } else if (typeof js === "string") {
  2018. code = js;
  2019. }
  2020. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2021. if (code) {
  2022. list.push(code);
  2023. }
  2024. }
  2025. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2026. }
  2027. if (parent) {
  2028. parents.remove(parent);
  2029. }
  2030. }
  2031. function collectActions(xref, dict, eventType) {
  2032. const actions = Object.create(null);
  2033. const additionalActionsDicts = getInheritableProperty({
  2034. dict,
  2035. key: "AA",
  2036. stopWhenFound: false
  2037. });
  2038. if (additionalActionsDicts) {
  2039. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2040. const additionalActions = additionalActionsDicts[i];
  2041. if (!(additionalActions instanceof _primitives.Dict)) {
  2042. continue;
  2043. }
  2044. for (const key of additionalActions.getKeys()) {
  2045. const action = eventType[key];
  2046. if (!action) {
  2047. continue;
  2048. }
  2049. const actionDict = additionalActions.getRaw(key);
  2050. const parents = new _primitives.RefSet();
  2051. const list = [];
  2052. _collectJS(actionDict, xref, list, parents);
  2053. if (list.length > 0) {
  2054. actions[action] = list;
  2055. }
  2056. }
  2057. }
  2058. }
  2059. if (dict.has("A")) {
  2060. const actionDict = dict.get("A");
  2061. const parents = new _primitives.RefSet();
  2062. const list = [];
  2063. _collectJS(actionDict, xref, list, parents);
  2064. if (list.length > 0) {
  2065. actions.Action = list;
  2066. }
  2067. }
  2068. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2069. }
  2070. const XMLEntities = {
  2071. 0x3c: "&lt;",
  2072. 0x3e: "&gt;",
  2073. 0x26: "&amp;",
  2074. 0x22: "&quot;",
  2075. 0x27: "&apos;"
  2076. };
  2077. function encodeToXmlString(str) {
  2078. const buffer = [];
  2079. let start = 0;
  2080. for (let i = 0, ii = str.length; i < ii; i++) {
  2081. const char = str.codePointAt(i);
  2082. if (0x20 <= char && char <= 0x7e) {
  2083. const entity = XMLEntities[char];
  2084. if (entity) {
  2085. if (start < i) {
  2086. buffer.push(str.substring(start, i));
  2087. }
  2088. buffer.push(entity);
  2089. start = i + 1;
  2090. }
  2091. } else {
  2092. if (start < i) {
  2093. buffer.push(str.substring(start, i));
  2094. }
  2095. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2096. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2097. i++;
  2098. }
  2099. start = i + 1;
  2100. }
  2101. }
  2102. if (buffer.length === 0) {
  2103. return str;
  2104. }
  2105. if (start < str.length) {
  2106. buffer.push(str.substring(start, str.length));
  2107. }
  2108. return buffer.join("");
  2109. }
  2110. function validateCSSFont(cssFontInfo) {
  2111. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2112. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2113. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2114. const {
  2115. fontFamily,
  2116. fontWeight,
  2117. italicAngle
  2118. } = cssFontInfo;
  2119. if (/^".*"$/.test(fontFamily)) {
  2120. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2121. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2122. return false;
  2123. }
  2124. } else if (/^'.*'$/.test(fontFamily)) {
  2125. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2126. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2127. return false;
  2128. }
  2129. } else {
  2130. for (const ident of fontFamily.split(/[ \t]+/)) {
  2131. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2132. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2133. return false;
  2134. }
  2135. }
  2136. }
  2137. const weight = fontWeight ? fontWeight.toString() : "";
  2138. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2139. const angle = parseFloat(italicAngle);
  2140. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2141. return true;
  2142. }
  2143. function recoverJsURL(str) {
  2144. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2145. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2146. const jsUrl = regex.exec(str);
  2147. if (jsUrl && jsUrl[2]) {
  2148. const url = jsUrl[2];
  2149. let newWindow = false;
  2150. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2151. newWindow = true;
  2152. }
  2153. return {
  2154. url,
  2155. newWindow
  2156. };
  2157. }
  2158. return null;
  2159. }
  2160. function numberToString(value) {
  2161. if (Number.isInteger(value)) {
  2162. return value.toString();
  2163. }
  2164. const roundedValue = Math.round(value * 100);
  2165. if (roundedValue % 100 === 0) {
  2166. return (roundedValue / 100).toString();
  2167. }
  2168. if (roundedValue % 10 === 0) {
  2169. return value.toFixed(1);
  2170. }
  2171. return value.toFixed(2);
  2172. }
  2173. function getNewAnnotationsMap(annotationStorage) {
  2174. if (!annotationStorage) {
  2175. return null;
  2176. }
  2177. const newAnnotationsByPage = new Map();
  2178. for (const [key, value] of annotationStorage) {
  2179. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2180. continue;
  2181. }
  2182. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2183. if (!annotations) {
  2184. annotations = [];
  2185. newAnnotationsByPage.set(value.pageIndex, annotations);
  2186. }
  2187. annotations.push(value);
  2188. }
  2189. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2190. }
  2191. function isAscii(str) {
  2192. return /^[\x00-\x7F]*$/.test(str);
  2193. }
  2194. function stringToUTF16HexString(str) {
  2195. const buf = [];
  2196. for (let i = 0, ii = str.length; i < ii; i++) {
  2197. const char = str.charCodeAt(i);
  2198. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  2199. }
  2200. return buf.join("");
  2201. }
  2202. function stringToUTF16String(str, bigEndian = false) {
  2203. const buf = [];
  2204. if (bigEndian) {
  2205. buf.push("\xFE\xFF");
  2206. }
  2207. for (let i = 0, ii = str.length; i < ii; i++) {
  2208. const char = str.charCodeAt(i);
  2209. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  2210. }
  2211. return buf.join("");
  2212. }
  2213. function getRotationMatrix(rotation, width, height) {
  2214. switch (rotation) {
  2215. case 90:
  2216. return [0, 1, -1, 0, width, 0];
  2217. case 180:
  2218. return [-1, 0, 0, -1, width, height];
  2219. case 270:
  2220. return [0, -1, 1, 0, 0, height];
  2221. default:
  2222. throw new Error("Invalid rotation");
  2223. }
  2224. }
  2225. /***/ }),
  2226. /* 5 */
  2227. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2228. Object.defineProperty(exports, "__esModule", ({
  2229. value: true
  2230. }));
  2231. exports.BaseStream = void 0;
  2232. var _util = __w_pdfjs_require__(2);
  2233. class BaseStream {
  2234. constructor() {
  2235. if (this.constructor === BaseStream) {
  2236. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2237. }
  2238. }
  2239. get length() {
  2240. (0, _util.unreachable)("Abstract getter `length` accessed");
  2241. }
  2242. get isEmpty() {
  2243. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2244. }
  2245. get isDataLoaded() {
  2246. return (0, _util.shadow)(this, "isDataLoaded", true);
  2247. }
  2248. getByte() {
  2249. (0, _util.unreachable)("Abstract method `getByte` called");
  2250. }
  2251. getBytes(length) {
  2252. (0, _util.unreachable)("Abstract method `getBytes` called");
  2253. }
  2254. peekByte() {
  2255. const peekedByte = this.getByte();
  2256. if (peekedByte !== -1) {
  2257. this.pos--;
  2258. }
  2259. return peekedByte;
  2260. }
  2261. peekBytes(length) {
  2262. const bytes = this.getBytes(length);
  2263. this.pos -= bytes.length;
  2264. return bytes;
  2265. }
  2266. getUint16() {
  2267. const b0 = this.getByte();
  2268. const b1 = this.getByte();
  2269. if (b0 === -1 || b1 === -1) {
  2270. return -1;
  2271. }
  2272. return (b0 << 8) + b1;
  2273. }
  2274. getInt32() {
  2275. const b0 = this.getByte();
  2276. const b1 = this.getByte();
  2277. const b2 = this.getByte();
  2278. const b3 = this.getByte();
  2279. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2280. }
  2281. getByteRange(begin, end) {
  2282. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2283. }
  2284. getString(length) {
  2285. return (0, _util.bytesToString)(this.getBytes(length));
  2286. }
  2287. skip(n) {
  2288. this.pos += n || 1;
  2289. }
  2290. reset() {
  2291. (0, _util.unreachable)("Abstract method `reset` called");
  2292. }
  2293. moveStart() {
  2294. (0, _util.unreachable)("Abstract method `moveStart` called");
  2295. }
  2296. makeSubStream(start, length, dict = null) {
  2297. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2298. }
  2299. getBaseStreams() {
  2300. return null;
  2301. }
  2302. }
  2303. exports.BaseStream = BaseStream;
  2304. /***/ }),
  2305. /* 6 */
  2306. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2307. Object.defineProperty(exports, "__esModule", ({
  2308. value: true
  2309. }));
  2310. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2311. var _util = __w_pdfjs_require__(2);
  2312. var _chunked_stream = __w_pdfjs_require__(7);
  2313. var _core_utils = __w_pdfjs_require__(4);
  2314. var _document = __w_pdfjs_require__(9);
  2315. var _stream = __w_pdfjs_require__(8);
  2316. function parseDocBaseUrl(url) {
  2317. if (url) {
  2318. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2319. if (absoluteUrl) {
  2320. return absoluteUrl.href;
  2321. }
  2322. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2323. }
  2324. return null;
  2325. }
  2326. class BasePdfManager {
  2327. constructor() {
  2328. if (this.constructor === BasePdfManager) {
  2329. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2330. }
  2331. }
  2332. get docId() {
  2333. return this._docId;
  2334. }
  2335. get password() {
  2336. return this._password;
  2337. }
  2338. get docBaseUrl() {
  2339. const catalog = this.pdfDocument.catalog;
  2340. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2341. }
  2342. ensureDoc(prop, args) {
  2343. return this.ensure(this.pdfDocument, prop, args);
  2344. }
  2345. ensureXRef(prop, args) {
  2346. return this.ensure(this.pdfDocument.xref, prop, args);
  2347. }
  2348. ensureCatalog(prop, args) {
  2349. return this.ensure(this.pdfDocument.catalog, prop, args);
  2350. }
  2351. getPage(pageIndex) {
  2352. return this.pdfDocument.getPage(pageIndex);
  2353. }
  2354. fontFallback(id, handler) {
  2355. return this.pdfDocument.fontFallback(id, handler);
  2356. }
  2357. loadXfaFonts(handler, task) {
  2358. return this.pdfDocument.loadXfaFonts(handler, task);
  2359. }
  2360. loadXfaImages() {
  2361. return this.pdfDocument.loadXfaImages();
  2362. }
  2363. serializeXfaData(annotationStorage) {
  2364. return this.pdfDocument.serializeXfaData(annotationStorage);
  2365. }
  2366. cleanup(manuallyTriggered = false) {
  2367. return this.pdfDocument.cleanup(manuallyTriggered);
  2368. }
  2369. async ensure(obj, prop, args) {
  2370. (0, _util.unreachable)("Abstract method `ensure` called");
  2371. }
  2372. requestRange(begin, end) {
  2373. (0, _util.unreachable)("Abstract method `requestRange` called");
  2374. }
  2375. requestLoadedStream(noFetch = false) {
  2376. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2377. }
  2378. sendProgressiveData(chunk) {
  2379. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2380. }
  2381. updatePassword(password) {
  2382. this._password = password;
  2383. }
  2384. terminate(reason) {
  2385. (0, _util.unreachable)("Abstract method `terminate` called");
  2386. }
  2387. }
  2388. class LocalPdfManager extends BasePdfManager {
  2389. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2390. super();
  2391. this._docId = docId;
  2392. this._password = password;
  2393. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2394. this.msgHandler = msgHandler;
  2395. this.evaluatorOptions = evaluatorOptions;
  2396. this.enableXfa = enableXfa;
  2397. const stream = new _stream.Stream(data);
  2398. this.pdfDocument = new _document.PDFDocument(this, stream);
  2399. this._loadedStreamPromise = Promise.resolve(stream);
  2400. }
  2401. async ensure(obj, prop, args) {
  2402. const value = obj[prop];
  2403. if (typeof value === "function") {
  2404. return value.apply(obj, args);
  2405. }
  2406. return value;
  2407. }
  2408. requestRange(begin, end) {
  2409. return Promise.resolve();
  2410. }
  2411. requestLoadedStream(noFetch = false) {
  2412. return this._loadedStreamPromise;
  2413. }
  2414. terminate(reason) {}
  2415. }
  2416. exports.LocalPdfManager = LocalPdfManager;
  2417. class NetworkPdfManager extends BasePdfManager {
  2418. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2419. super();
  2420. this._docId = docId;
  2421. this._password = args.password;
  2422. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2423. this.msgHandler = args.msgHandler;
  2424. this.evaluatorOptions = evaluatorOptions;
  2425. this.enableXfa = enableXfa;
  2426. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2427. msgHandler: args.msgHandler,
  2428. length: args.length,
  2429. disableAutoFetch: args.disableAutoFetch,
  2430. rangeChunkSize: args.rangeChunkSize
  2431. });
  2432. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2433. }
  2434. async ensure(obj, prop, args) {
  2435. try {
  2436. const value = obj[prop];
  2437. if (typeof value === "function") {
  2438. return value.apply(obj, args);
  2439. }
  2440. return value;
  2441. } catch (ex) {
  2442. if (!(ex instanceof _core_utils.MissingDataException)) {
  2443. throw ex;
  2444. }
  2445. await this.requestRange(ex.begin, ex.end);
  2446. return this.ensure(obj, prop, args);
  2447. }
  2448. }
  2449. requestRange(begin, end) {
  2450. return this.streamManager.requestRange(begin, end);
  2451. }
  2452. requestLoadedStream(noFetch = false) {
  2453. return this.streamManager.requestAllChunks(noFetch);
  2454. }
  2455. sendProgressiveData(chunk) {
  2456. this.streamManager.onReceiveData({
  2457. chunk
  2458. });
  2459. }
  2460. terminate(reason) {
  2461. this.streamManager.abort(reason);
  2462. }
  2463. }
  2464. exports.NetworkPdfManager = NetworkPdfManager;
  2465. /***/ }),
  2466. /* 7 */
  2467. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2468. Object.defineProperty(exports, "__esModule", ({
  2469. value: true
  2470. }));
  2471. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2472. var _util = __w_pdfjs_require__(2);
  2473. var _core_utils = __w_pdfjs_require__(4);
  2474. var _stream = __w_pdfjs_require__(8);
  2475. class ChunkedStream extends _stream.Stream {
  2476. constructor(length, chunkSize, manager) {
  2477. super(new Uint8Array(length), 0, length, null);
  2478. this.chunkSize = chunkSize;
  2479. this._loadedChunks = new Set();
  2480. this.numChunks = Math.ceil(length / chunkSize);
  2481. this.manager = manager;
  2482. this.progressiveDataLength = 0;
  2483. this.lastSuccessfulEnsureByteChunk = -1;
  2484. }
  2485. getMissingChunks() {
  2486. const chunks = [];
  2487. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2488. if (!this._loadedChunks.has(chunk)) {
  2489. chunks.push(chunk);
  2490. }
  2491. }
  2492. return chunks;
  2493. }
  2494. get numChunksLoaded() {
  2495. return this._loadedChunks.size;
  2496. }
  2497. get isDataLoaded() {
  2498. return this.numChunksLoaded === this.numChunks;
  2499. }
  2500. onReceiveData(begin, chunk) {
  2501. const chunkSize = this.chunkSize;
  2502. if (begin % chunkSize !== 0) {
  2503. throw new Error(`Bad begin offset: ${begin}`);
  2504. }
  2505. const end = begin + chunk.byteLength;
  2506. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2507. throw new Error(`Bad end offset: ${end}`);
  2508. }
  2509. this.bytes.set(new Uint8Array(chunk), begin);
  2510. const beginChunk = Math.floor(begin / chunkSize);
  2511. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2512. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2513. this._loadedChunks.add(curChunk);
  2514. }
  2515. }
  2516. onReceiveProgressiveData(data) {
  2517. let position = this.progressiveDataLength;
  2518. const beginChunk = Math.floor(position / this.chunkSize);
  2519. this.bytes.set(new Uint8Array(data), position);
  2520. position += data.byteLength;
  2521. this.progressiveDataLength = position;
  2522. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2523. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2524. this._loadedChunks.add(curChunk);
  2525. }
  2526. }
  2527. ensureByte(pos) {
  2528. if (pos < this.progressiveDataLength) {
  2529. return;
  2530. }
  2531. const chunk = Math.floor(pos / this.chunkSize);
  2532. if (chunk > this.numChunks) {
  2533. return;
  2534. }
  2535. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2536. return;
  2537. }
  2538. if (!this._loadedChunks.has(chunk)) {
  2539. throw new _core_utils.MissingDataException(pos, pos + 1);
  2540. }
  2541. this.lastSuccessfulEnsureByteChunk = chunk;
  2542. }
  2543. ensureRange(begin, end) {
  2544. if (begin >= end) {
  2545. return;
  2546. }
  2547. if (end <= this.progressiveDataLength) {
  2548. return;
  2549. }
  2550. const beginChunk = Math.floor(begin / this.chunkSize);
  2551. if (beginChunk > this.numChunks) {
  2552. return;
  2553. }
  2554. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2555. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2556. if (!this._loadedChunks.has(chunk)) {
  2557. throw new _core_utils.MissingDataException(begin, end);
  2558. }
  2559. }
  2560. }
  2561. nextEmptyChunk(beginChunk) {
  2562. const numChunks = this.numChunks;
  2563. for (let i = 0; i < numChunks; ++i) {
  2564. const chunk = (beginChunk + i) % numChunks;
  2565. if (!this._loadedChunks.has(chunk)) {
  2566. return chunk;
  2567. }
  2568. }
  2569. return null;
  2570. }
  2571. hasChunk(chunk) {
  2572. return this._loadedChunks.has(chunk);
  2573. }
  2574. getByte() {
  2575. const pos = this.pos;
  2576. if (pos >= this.end) {
  2577. return -1;
  2578. }
  2579. if (pos >= this.progressiveDataLength) {
  2580. this.ensureByte(pos);
  2581. }
  2582. return this.bytes[this.pos++];
  2583. }
  2584. getBytes(length) {
  2585. const bytes = this.bytes;
  2586. const pos = this.pos;
  2587. const strEnd = this.end;
  2588. if (!length) {
  2589. if (strEnd > this.progressiveDataLength) {
  2590. this.ensureRange(pos, strEnd);
  2591. }
  2592. return bytes.subarray(pos, strEnd);
  2593. }
  2594. let end = pos + length;
  2595. if (end > strEnd) {
  2596. end = strEnd;
  2597. }
  2598. if (end > this.progressiveDataLength) {
  2599. this.ensureRange(pos, end);
  2600. }
  2601. this.pos = end;
  2602. return bytes.subarray(pos, end);
  2603. }
  2604. getByteRange(begin, end) {
  2605. if (begin < 0) {
  2606. begin = 0;
  2607. }
  2608. if (end > this.end) {
  2609. end = this.end;
  2610. }
  2611. if (end > this.progressiveDataLength) {
  2612. this.ensureRange(begin, end);
  2613. }
  2614. return this.bytes.subarray(begin, end);
  2615. }
  2616. makeSubStream(start, length, dict = null) {
  2617. if (length) {
  2618. if (start + length > this.progressiveDataLength) {
  2619. this.ensureRange(start, start + length);
  2620. }
  2621. } else {
  2622. if (start >= this.progressiveDataLength) {
  2623. this.ensureByte(start);
  2624. }
  2625. }
  2626. function ChunkedStreamSubstream() {}
  2627. ChunkedStreamSubstream.prototype = Object.create(this);
  2628. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2629. const chunkSize = this.chunkSize;
  2630. const beginChunk = Math.floor(this.start / chunkSize);
  2631. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2632. const missingChunks = [];
  2633. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2634. if (!this._loadedChunks.has(chunk)) {
  2635. missingChunks.push(chunk);
  2636. }
  2637. }
  2638. return missingChunks;
  2639. };
  2640. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2641. get() {
  2642. if (this.numChunksLoaded === this.numChunks) {
  2643. return true;
  2644. }
  2645. return this.getMissingChunks().length === 0;
  2646. },
  2647. configurable: true
  2648. });
  2649. const subStream = new ChunkedStreamSubstream();
  2650. subStream.pos = subStream.start = start;
  2651. subStream.end = start + length || this.end;
  2652. subStream.dict = dict;
  2653. return subStream;
  2654. }
  2655. getBaseStreams() {
  2656. return [this];
  2657. }
  2658. }
  2659. exports.ChunkedStream = ChunkedStream;
  2660. class ChunkedStreamManager {
  2661. constructor(pdfNetworkStream, args) {
  2662. this.length = args.length;
  2663. this.chunkSize = args.rangeChunkSize;
  2664. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2665. this.pdfNetworkStream = pdfNetworkStream;
  2666. this.disableAutoFetch = args.disableAutoFetch;
  2667. this.msgHandler = args.msgHandler;
  2668. this.currRequestId = 0;
  2669. this._chunksNeededByRequest = new Map();
  2670. this._requestsByChunk = new Map();
  2671. this._promisesByRequest = new Map();
  2672. this.progressiveDataLength = 0;
  2673. this.aborted = false;
  2674. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2675. }
  2676. sendRequest(begin, end) {
  2677. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2678. if (!rangeReader.isStreamingSupported) {
  2679. rangeReader.onProgress = this.onProgress.bind(this);
  2680. }
  2681. let chunks = [],
  2682. loaded = 0;
  2683. return new Promise((resolve, reject) => {
  2684. const readChunk = chunk => {
  2685. try {
  2686. if (!chunk.done) {
  2687. const data = chunk.value;
  2688. chunks.push(data);
  2689. loaded += (0, _util.arrayByteLength)(data);
  2690. if (rangeReader.isStreamingSupported) {
  2691. this.onProgress({
  2692. loaded
  2693. });
  2694. }
  2695. rangeReader.read().then(readChunk, reject);
  2696. return;
  2697. }
  2698. const chunkData = (0, _util.arraysToBytes)(chunks);
  2699. chunks = null;
  2700. resolve(chunkData);
  2701. } catch (e) {
  2702. reject(e);
  2703. }
  2704. };
  2705. rangeReader.read().then(readChunk, reject);
  2706. }).then(data => {
  2707. if (this.aborted) {
  2708. return;
  2709. }
  2710. this.onReceiveData({
  2711. chunk: data,
  2712. begin
  2713. });
  2714. });
  2715. }
  2716. requestAllChunks(noFetch = false) {
  2717. if (!noFetch) {
  2718. const missingChunks = this.stream.getMissingChunks();
  2719. this._requestChunks(missingChunks);
  2720. }
  2721. return this._loadedStreamCapability.promise;
  2722. }
  2723. _requestChunks(chunks) {
  2724. const requestId = this.currRequestId++;
  2725. const chunksNeeded = new Set();
  2726. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2727. for (const chunk of chunks) {
  2728. if (!this.stream.hasChunk(chunk)) {
  2729. chunksNeeded.add(chunk);
  2730. }
  2731. }
  2732. if (chunksNeeded.size === 0) {
  2733. return Promise.resolve();
  2734. }
  2735. const capability = (0, _util.createPromiseCapability)();
  2736. this._promisesByRequest.set(requestId, capability);
  2737. const chunksToRequest = [];
  2738. for (const chunk of chunksNeeded) {
  2739. let requestIds = this._requestsByChunk.get(chunk);
  2740. if (!requestIds) {
  2741. requestIds = [];
  2742. this._requestsByChunk.set(chunk, requestIds);
  2743. chunksToRequest.push(chunk);
  2744. }
  2745. requestIds.push(requestId);
  2746. }
  2747. if (chunksToRequest.length > 0) {
  2748. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2749. for (const groupedChunk of groupedChunksToRequest) {
  2750. const begin = groupedChunk.beginChunk * this.chunkSize;
  2751. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2752. this.sendRequest(begin, end).catch(capability.reject);
  2753. }
  2754. }
  2755. return capability.promise.catch(reason => {
  2756. if (this.aborted) {
  2757. return;
  2758. }
  2759. throw reason;
  2760. });
  2761. }
  2762. getStream() {
  2763. return this.stream;
  2764. }
  2765. requestRange(begin, end) {
  2766. end = Math.min(end, this.length);
  2767. const beginChunk = this.getBeginChunk(begin);
  2768. const endChunk = this.getEndChunk(end);
  2769. const chunks = [];
  2770. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2771. chunks.push(chunk);
  2772. }
  2773. return this._requestChunks(chunks);
  2774. }
  2775. requestRanges(ranges = []) {
  2776. const chunksToRequest = [];
  2777. for (const range of ranges) {
  2778. const beginChunk = this.getBeginChunk(range.begin);
  2779. const endChunk = this.getEndChunk(range.end);
  2780. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2781. if (!chunksToRequest.includes(chunk)) {
  2782. chunksToRequest.push(chunk);
  2783. }
  2784. }
  2785. }
  2786. chunksToRequest.sort(function (a, b) {
  2787. return a - b;
  2788. });
  2789. return this._requestChunks(chunksToRequest);
  2790. }
  2791. groupChunks(chunks) {
  2792. const groupedChunks = [];
  2793. let beginChunk = -1;
  2794. let prevChunk = -1;
  2795. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2796. const chunk = chunks[i];
  2797. if (beginChunk < 0) {
  2798. beginChunk = chunk;
  2799. }
  2800. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2801. groupedChunks.push({
  2802. beginChunk,
  2803. endChunk: prevChunk + 1
  2804. });
  2805. beginChunk = chunk;
  2806. }
  2807. if (i + 1 === chunks.length) {
  2808. groupedChunks.push({
  2809. beginChunk,
  2810. endChunk: chunk + 1
  2811. });
  2812. }
  2813. prevChunk = chunk;
  2814. }
  2815. return groupedChunks;
  2816. }
  2817. onProgress(args) {
  2818. this.msgHandler.send("DocProgress", {
  2819. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2820. total: this.length
  2821. });
  2822. }
  2823. onReceiveData(args) {
  2824. const chunk = args.chunk;
  2825. const isProgressive = args.begin === undefined;
  2826. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2827. const end = begin + chunk.byteLength;
  2828. const beginChunk = Math.floor(begin / this.chunkSize);
  2829. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2830. if (isProgressive) {
  2831. this.stream.onReceiveProgressiveData(chunk);
  2832. this.progressiveDataLength = end;
  2833. } else {
  2834. this.stream.onReceiveData(begin, chunk);
  2835. }
  2836. if (this.stream.isDataLoaded) {
  2837. this._loadedStreamCapability.resolve(this.stream);
  2838. }
  2839. const loadedRequests = [];
  2840. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2841. const requestIds = this._requestsByChunk.get(curChunk);
  2842. if (!requestIds) {
  2843. continue;
  2844. }
  2845. this._requestsByChunk.delete(curChunk);
  2846. for (const requestId of requestIds) {
  2847. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2848. if (chunksNeeded.has(curChunk)) {
  2849. chunksNeeded.delete(curChunk);
  2850. }
  2851. if (chunksNeeded.size > 0) {
  2852. continue;
  2853. }
  2854. loadedRequests.push(requestId);
  2855. }
  2856. }
  2857. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2858. let nextEmptyChunk;
  2859. if (this.stream.numChunksLoaded === 1) {
  2860. const lastChunk = this.stream.numChunks - 1;
  2861. if (!this.stream.hasChunk(lastChunk)) {
  2862. nextEmptyChunk = lastChunk;
  2863. }
  2864. } else {
  2865. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2866. }
  2867. if (Number.isInteger(nextEmptyChunk)) {
  2868. this._requestChunks([nextEmptyChunk]);
  2869. }
  2870. }
  2871. for (const requestId of loadedRequests) {
  2872. const capability = this._promisesByRequest.get(requestId);
  2873. this._promisesByRequest.delete(requestId);
  2874. capability.resolve();
  2875. }
  2876. this.msgHandler.send("DocProgress", {
  2877. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2878. total: this.length
  2879. });
  2880. }
  2881. onError(err) {
  2882. this._loadedStreamCapability.reject(err);
  2883. }
  2884. getBeginChunk(begin) {
  2885. return Math.floor(begin / this.chunkSize);
  2886. }
  2887. getEndChunk(end) {
  2888. return Math.floor((end - 1) / this.chunkSize) + 1;
  2889. }
  2890. abort(reason) {
  2891. this.aborted = true;
  2892. if (this.pdfNetworkStream) {
  2893. this.pdfNetworkStream.cancelAllRequests(reason);
  2894. }
  2895. for (const capability of this._promisesByRequest.values()) {
  2896. capability.reject(reason);
  2897. }
  2898. }
  2899. }
  2900. exports.ChunkedStreamManager = ChunkedStreamManager;
  2901. /***/ }),
  2902. /* 8 */
  2903. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2904. Object.defineProperty(exports, "__esModule", ({
  2905. value: true
  2906. }));
  2907. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2908. var _base_stream = __w_pdfjs_require__(5);
  2909. var _util = __w_pdfjs_require__(2);
  2910. class Stream extends _base_stream.BaseStream {
  2911. constructor(arrayBuffer, start, length, dict) {
  2912. super();
  2913. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2914. this.start = start || 0;
  2915. this.pos = this.start;
  2916. this.end = start + length || this.bytes.length;
  2917. this.dict = dict;
  2918. }
  2919. get length() {
  2920. return this.end - this.start;
  2921. }
  2922. get isEmpty() {
  2923. return this.length === 0;
  2924. }
  2925. getByte() {
  2926. if (this.pos >= this.end) {
  2927. return -1;
  2928. }
  2929. return this.bytes[this.pos++];
  2930. }
  2931. getBytes(length) {
  2932. const bytes = this.bytes;
  2933. const pos = this.pos;
  2934. const strEnd = this.end;
  2935. if (!length) {
  2936. return bytes.subarray(pos, strEnd);
  2937. }
  2938. let end = pos + length;
  2939. if (end > strEnd) {
  2940. end = strEnd;
  2941. }
  2942. this.pos = end;
  2943. return bytes.subarray(pos, end);
  2944. }
  2945. getByteRange(begin, end) {
  2946. if (begin < 0) {
  2947. begin = 0;
  2948. }
  2949. if (end > this.end) {
  2950. end = this.end;
  2951. }
  2952. return this.bytes.subarray(begin, end);
  2953. }
  2954. reset() {
  2955. this.pos = this.start;
  2956. }
  2957. moveStart() {
  2958. this.start = this.pos;
  2959. }
  2960. makeSubStream(start, length, dict = null) {
  2961. return new Stream(this.bytes.buffer, start, length, dict);
  2962. }
  2963. }
  2964. exports.Stream = Stream;
  2965. class StringStream extends Stream {
  2966. constructor(str) {
  2967. super((0, _util.stringToBytes)(str));
  2968. }
  2969. }
  2970. exports.StringStream = StringStream;
  2971. class NullStream extends Stream {
  2972. constructor() {
  2973. super(new Uint8Array(0));
  2974. }
  2975. }
  2976. exports.NullStream = NullStream;
  2977. /***/ }),
  2978. /* 9 */
  2979. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2980. Object.defineProperty(exports, "__esModule", ({
  2981. value: true
  2982. }));
  2983. exports.Page = exports.PDFDocument = void 0;
  2984. var _annotation = __w_pdfjs_require__(10);
  2985. var _util = __w_pdfjs_require__(2);
  2986. var _core_utils = __w_pdfjs_require__(4);
  2987. var _primitives = __w_pdfjs_require__(3);
  2988. var _xfa_fonts = __w_pdfjs_require__(49);
  2989. var _base_stream = __w_pdfjs_require__(5);
  2990. var _crypto = __w_pdfjs_require__(65);
  2991. var _catalog = __w_pdfjs_require__(67);
  2992. var _cleanup_helper = __w_pdfjs_require__(69);
  2993. var _dataset_reader = __w_pdfjs_require__(98);
  2994. var _parser = __w_pdfjs_require__(15);
  2995. var _stream = __w_pdfjs_require__(8);
  2996. var _object_loader = __w_pdfjs_require__(73);
  2997. var _operator_list = __w_pdfjs_require__(60);
  2998. var _evaluator = __w_pdfjs_require__(13);
  2999. var _decode_stream = __w_pdfjs_require__(17);
  3000. var _struct_tree = __w_pdfjs_require__(72);
  3001. var _writer = __w_pdfjs_require__(63);
  3002. var _factory = __w_pdfjs_require__(74);
  3003. var _xref = __w_pdfjs_require__(99);
  3004. const DEFAULT_USER_UNIT = 1.0;
  3005. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  3006. class Page {
  3007. constructor({
  3008. pdfManager,
  3009. xref,
  3010. pageIndex,
  3011. pageDict,
  3012. ref,
  3013. globalIdFactory,
  3014. fontCache,
  3015. builtInCMapCache,
  3016. standardFontDataCache,
  3017. globalImageCache,
  3018. nonBlendModesSet,
  3019. xfaFactory
  3020. }) {
  3021. this.pdfManager = pdfManager;
  3022. this.pageIndex = pageIndex;
  3023. this.pageDict = pageDict;
  3024. this.xref = xref;
  3025. this.ref = ref;
  3026. this.fontCache = fontCache;
  3027. this.builtInCMapCache = builtInCMapCache;
  3028. this.standardFontDataCache = standardFontDataCache;
  3029. this.globalImageCache = globalImageCache;
  3030. this.nonBlendModesSet = nonBlendModesSet;
  3031. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3032. this.resourcesPromise = null;
  3033. this.xfaFactory = xfaFactory;
  3034. const idCounters = {
  3035. obj: 0
  3036. };
  3037. this._localIdFactory = class extends globalIdFactory {
  3038. static createObjId() {
  3039. return `p${pageIndex}_${++idCounters.obj}`;
  3040. }
  3041. static getPageObjId() {
  3042. return `page${ref.toString()}`;
  3043. }
  3044. };
  3045. }
  3046. _getInheritableProperty(key, getArray = false) {
  3047. const value = (0, _core_utils.getInheritableProperty)({
  3048. dict: this.pageDict,
  3049. key,
  3050. getArray,
  3051. stopWhenFound: false
  3052. });
  3053. if (!Array.isArray(value)) {
  3054. return value;
  3055. }
  3056. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3057. return value[0];
  3058. }
  3059. return _primitives.Dict.merge({
  3060. xref: this.xref,
  3061. dictArray: value
  3062. });
  3063. }
  3064. get content() {
  3065. return this.pageDict.getArray("Contents");
  3066. }
  3067. get resources() {
  3068. const resources = this._getInheritableProperty("Resources");
  3069. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3070. }
  3071. _getBoundingBox(name) {
  3072. if (this.xfaData) {
  3073. return this.xfaData.bbox;
  3074. }
  3075. const box = this._getInheritableProperty(name, true);
  3076. if (Array.isArray(box) && box.length === 4) {
  3077. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3078. return box;
  3079. }
  3080. (0, _util.warn)(`Empty /${name} entry.`);
  3081. }
  3082. return null;
  3083. }
  3084. get mediaBox() {
  3085. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3086. }
  3087. get cropBox() {
  3088. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3089. }
  3090. get userUnit() {
  3091. let obj = this.pageDict.get("UserUnit");
  3092. if (typeof obj !== "number" || obj <= 0) {
  3093. obj = DEFAULT_USER_UNIT;
  3094. }
  3095. return (0, _util.shadow)(this, "userUnit", obj);
  3096. }
  3097. get view() {
  3098. const {
  3099. cropBox,
  3100. mediaBox
  3101. } = this;
  3102. let view;
  3103. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3104. view = mediaBox;
  3105. } else {
  3106. const box = _util.Util.intersect(cropBox, mediaBox);
  3107. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3108. view = box;
  3109. } else {
  3110. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3111. }
  3112. }
  3113. return (0, _util.shadow)(this, "view", view || mediaBox);
  3114. }
  3115. get rotate() {
  3116. let rotate = this._getInheritableProperty("Rotate") || 0;
  3117. if (rotate % 90 !== 0) {
  3118. rotate = 0;
  3119. } else if (rotate >= 360) {
  3120. rotate %= 360;
  3121. } else if (rotate < 0) {
  3122. rotate = (rotate % 360 + 360) % 360;
  3123. }
  3124. return (0, _util.shadow)(this, "rotate", rotate);
  3125. }
  3126. _onSubStreamError(handler, reason, objId) {
  3127. if (this.evaluatorOptions.ignoreErrors) {
  3128. handler.send("UnsupportedFeature", {
  3129. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3130. });
  3131. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3132. return;
  3133. }
  3134. throw reason;
  3135. }
  3136. getContentStream(handler) {
  3137. return this.pdfManager.ensure(this, "content").then(content => {
  3138. if (content instanceof _base_stream.BaseStream) {
  3139. return content;
  3140. }
  3141. if (Array.isArray(content)) {
  3142. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3143. }
  3144. return new _stream.NullStream();
  3145. });
  3146. }
  3147. get xfaData() {
  3148. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3149. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3150. } : null);
  3151. }
  3152. async saveNewAnnotations(handler, task, annotations) {
  3153. if (this.xfaFactory) {
  3154. throw new Error("XFA: Cannot save new annotations.");
  3155. }
  3156. const partialEvaluator = new _evaluator.PartialEvaluator({
  3157. xref: this.xref,
  3158. handler,
  3159. pageIndex: this.pageIndex,
  3160. idFactory: this._localIdFactory,
  3161. fontCache: this.fontCache,
  3162. builtInCMapCache: this.builtInCMapCache,
  3163. standardFontDataCache: this.standardFontDataCache,
  3164. globalImageCache: this.globalImageCache,
  3165. options: this.evaluatorOptions
  3166. });
  3167. const pageDict = this.pageDict;
  3168. const annotationsArray = this.annotations.slice();
  3169. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3170. for (const {
  3171. ref
  3172. } of newData.annotations) {
  3173. annotationsArray.push(ref);
  3174. }
  3175. const savedDict = pageDict.get("Annots");
  3176. pageDict.set("Annots", annotationsArray);
  3177. const buffer = [];
  3178. let transform = null;
  3179. if (this.xref.encrypt) {
  3180. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3181. }
  3182. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3183. if (savedDict) {
  3184. pageDict.set("Annots", savedDict);
  3185. }
  3186. const objects = newData.dependencies;
  3187. objects.push({
  3188. ref: this.ref,
  3189. data: buffer.join("")
  3190. }, ...newData.annotations);
  3191. return objects;
  3192. }
  3193. save(handler, task, annotationStorage) {
  3194. const partialEvaluator = new _evaluator.PartialEvaluator({
  3195. xref: this.xref,
  3196. handler,
  3197. pageIndex: this.pageIndex,
  3198. idFactory: this._localIdFactory,
  3199. fontCache: this.fontCache,
  3200. builtInCMapCache: this.builtInCMapCache,
  3201. standardFontDataCache: this.standardFontDataCache,
  3202. globalImageCache: this.globalImageCache,
  3203. options: this.evaluatorOptions
  3204. });
  3205. return this._parsedAnnotations.then(function (annotations) {
  3206. const newRefsPromises = [];
  3207. for (const annotation of annotations) {
  3208. if (!annotation.mustBePrinted(annotationStorage)) {
  3209. continue;
  3210. }
  3211. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3212. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3213. return null;
  3214. }));
  3215. }
  3216. return Promise.all(newRefsPromises).then(function (newRefs) {
  3217. return newRefs.filter(newRef => !!newRef);
  3218. });
  3219. });
  3220. }
  3221. loadResources(keys) {
  3222. if (!this.resourcesPromise) {
  3223. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3224. }
  3225. return this.resourcesPromise.then(() => {
  3226. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3227. return objectLoader.load();
  3228. });
  3229. }
  3230. getOperatorList({
  3231. handler,
  3232. sink,
  3233. task,
  3234. intent,
  3235. cacheKey,
  3236. annotationStorage = null
  3237. }) {
  3238. const contentStreamPromise = this.getContentStream(handler);
  3239. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3240. const partialEvaluator = new _evaluator.PartialEvaluator({
  3241. xref: this.xref,
  3242. handler,
  3243. pageIndex: this.pageIndex,
  3244. idFactory: this._localIdFactory,
  3245. fontCache: this.fontCache,
  3246. builtInCMapCache: this.builtInCMapCache,
  3247. standardFontDataCache: this.standardFontDataCache,
  3248. globalImageCache: this.globalImageCache,
  3249. options: this.evaluatorOptions
  3250. });
  3251. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3252. let newAnnotationsPromise = Promise.resolve(null);
  3253. if (newAnnotationsByPage) {
  3254. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3255. if (newAnnotations) {
  3256. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3257. }
  3258. }
  3259. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3260. const pageListPromise = dataPromises.then(([contentStream]) => {
  3261. const opList = new _operator_list.OperatorList(intent, sink);
  3262. handler.send("StartRenderPage", {
  3263. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3264. pageIndex: this.pageIndex,
  3265. cacheKey
  3266. });
  3267. return partialEvaluator.getOperatorList({
  3268. stream: contentStream,
  3269. task,
  3270. resources: this.resources,
  3271. operatorList: opList
  3272. }).then(function () {
  3273. return opList;
  3274. });
  3275. });
  3276. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3277. if (newAnnotations) {
  3278. annotations = annotations.concat(newAnnotations);
  3279. }
  3280. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3281. pageOpList.flush(true);
  3282. return {
  3283. length: pageOpList.totalLength
  3284. };
  3285. }
  3286. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3287. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3288. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3289. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3290. const opListPromises = [];
  3291. for (const annotation of annotations) {
  3292. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3293. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3294. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3295. return {
  3296. opList: null,
  3297. separateForm: false,
  3298. separateCanvas: false
  3299. };
  3300. }));
  3301. }
  3302. }
  3303. return Promise.all(opListPromises).then(function (opLists) {
  3304. let form = false,
  3305. canvas = false;
  3306. for (const {
  3307. opList,
  3308. separateForm,
  3309. separateCanvas
  3310. } of opLists) {
  3311. pageOpList.addOpList(opList);
  3312. if (separateForm) {
  3313. form = separateForm;
  3314. }
  3315. if (separateCanvas) {
  3316. canvas = separateCanvas;
  3317. }
  3318. }
  3319. pageOpList.flush(true, {
  3320. form,
  3321. canvas
  3322. });
  3323. return {
  3324. length: pageOpList.totalLength
  3325. };
  3326. });
  3327. });
  3328. }
  3329. extractTextContent({
  3330. handler,
  3331. task,
  3332. includeMarkedContent,
  3333. sink,
  3334. combineTextItems
  3335. }) {
  3336. const contentStreamPromise = this.getContentStream(handler);
  3337. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3338. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3339. return dataPromises.then(([contentStream]) => {
  3340. const partialEvaluator = new _evaluator.PartialEvaluator({
  3341. xref: this.xref,
  3342. handler,
  3343. pageIndex: this.pageIndex,
  3344. idFactory: this._localIdFactory,
  3345. fontCache: this.fontCache,
  3346. builtInCMapCache: this.builtInCMapCache,
  3347. standardFontDataCache: this.standardFontDataCache,
  3348. globalImageCache: this.globalImageCache,
  3349. options: this.evaluatorOptions
  3350. });
  3351. return partialEvaluator.getTextContent({
  3352. stream: contentStream,
  3353. task,
  3354. resources: this.resources,
  3355. includeMarkedContent,
  3356. combineTextItems,
  3357. sink,
  3358. viewBox: this.view
  3359. });
  3360. });
  3361. }
  3362. async getStructTree() {
  3363. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3364. if (!structTreeRoot) {
  3365. return null;
  3366. }
  3367. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3368. return structTree.serializable;
  3369. }
  3370. _parseStructTree(structTreeRoot) {
  3371. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3372. tree.parse();
  3373. return tree;
  3374. }
  3375. async getAnnotationsData(handler, task, intent) {
  3376. const annotations = await this._parsedAnnotations;
  3377. if (annotations.length === 0) {
  3378. return [];
  3379. }
  3380. const textContentPromises = [];
  3381. const annotationsData = [];
  3382. let partialEvaluator;
  3383. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3384. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3385. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3386. for (const annotation of annotations) {
  3387. const isVisible = intentAny || intentDisplay && annotation.viewable;
  3388. if (isVisible || intentPrint && annotation.printable) {
  3389. annotationsData.push(annotation.data);
  3390. }
  3391. if (annotation.hasTextContent && isVisible) {
  3392. if (!partialEvaluator) {
  3393. partialEvaluator = new _evaluator.PartialEvaluator({
  3394. xref: this.xref,
  3395. handler,
  3396. pageIndex: this.pageIndex,
  3397. idFactory: this._localIdFactory,
  3398. fontCache: this.fontCache,
  3399. builtInCMapCache: this.builtInCMapCache,
  3400. standardFontDataCache: this.standardFontDataCache,
  3401. globalImageCache: this.globalImageCache,
  3402. options: this.evaluatorOptions
  3403. });
  3404. }
  3405. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  3406. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3407. }));
  3408. }
  3409. }
  3410. await Promise.all(textContentPromises);
  3411. return annotationsData;
  3412. }
  3413. get annotations() {
  3414. const annots = this._getInheritableProperty("Annots");
  3415. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3416. }
  3417. get _parsedAnnotations() {
  3418. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3419. const annotationPromises = [];
  3420. for (const annotationRef of this.annotations) {
  3421. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3422. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3423. return null;
  3424. }));
  3425. }
  3426. return Promise.all(annotationPromises).then(function (annotations) {
  3427. if (annotations.length === 0) {
  3428. return annotations;
  3429. }
  3430. const sortedAnnotations = [];
  3431. let popupAnnotations;
  3432. for (const annotation of annotations) {
  3433. if (!annotation) {
  3434. continue;
  3435. }
  3436. if (annotation instanceof _annotation.PopupAnnotation) {
  3437. if (!popupAnnotations) {
  3438. popupAnnotations = [];
  3439. }
  3440. popupAnnotations.push(annotation);
  3441. continue;
  3442. }
  3443. sortedAnnotations.push(annotation);
  3444. }
  3445. if (popupAnnotations) {
  3446. sortedAnnotations.push(...popupAnnotations);
  3447. }
  3448. return sortedAnnotations;
  3449. });
  3450. });
  3451. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3452. }
  3453. get jsActions() {
  3454. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3455. return (0, _util.shadow)(this, "jsActions", actions);
  3456. }
  3457. }
  3458. exports.Page = Page;
  3459. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3460. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3461. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3462. const FINGERPRINT_FIRST_BYTES = 1024;
  3463. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3464. function find(stream, signature, limit = 1024, backwards = false) {
  3465. const signatureLength = signature.length;
  3466. const scanBytes = stream.peekBytes(limit);
  3467. const scanLength = scanBytes.length - signatureLength;
  3468. if (scanLength <= 0) {
  3469. return false;
  3470. }
  3471. if (backwards) {
  3472. const signatureEnd = signatureLength - 1;
  3473. let pos = scanBytes.length - 1;
  3474. while (pos >= signatureEnd) {
  3475. let j = 0;
  3476. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3477. j++;
  3478. }
  3479. if (j >= signatureLength) {
  3480. stream.pos += pos - signatureEnd;
  3481. return true;
  3482. }
  3483. pos--;
  3484. }
  3485. } else {
  3486. let pos = 0;
  3487. while (pos <= scanLength) {
  3488. let j = 0;
  3489. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3490. j++;
  3491. }
  3492. if (j >= signatureLength) {
  3493. stream.pos += pos;
  3494. return true;
  3495. }
  3496. pos++;
  3497. }
  3498. }
  3499. return false;
  3500. }
  3501. class PDFDocument {
  3502. constructor(pdfManager, stream) {
  3503. if (stream.length <= 0) {
  3504. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3505. }
  3506. this.pdfManager = pdfManager;
  3507. this.stream = stream;
  3508. this.xref = new _xref.XRef(stream, pdfManager);
  3509. this._pagePromises = new Map();
  3510. this._version = null;
  3511. const idCounters = {
  3512. font: 0
  3513. };
  3514. this._globalIdFactory = class {
  3515. static getDocId() {
  3516. return `g_${pdfManager.docId}`;
  3517. }
  3518. static createFontId() {
  3519. return `f${++idCounters.font}`;
  3520. }
  3521. static createObjId() {
  3522. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3523. }
  3524. static getPageObjId() {
  3525. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3526. }
  3527. };
  3528. }
  3529. parse(recoveryMode) {
  3530. this.xref.parse(recoveryMode);
  3531. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3532. }
  3533. get linearization() {
  3534. let linearization = null;
  3535. try {
  3536. linearization = _parser.Linearization.create(this.stream);
  3537. } catch (err) {
  3538. if (err instanceof _core_utils.MissingDataException) {
  3539. throw err;
  3540. }
  3541. (0, _util.info)(err);
  3542. }
  3543. return (0, _util.shadow)(this, "linearization", linearization);
  3544. }
  3545. get startXRef() {
  3546. const stream = this.stream;
  3547. let startXRef = 0;
  3548. if (this.linearization) {
  3549. stream.reset();
  3550. if (find(stream, ENDOBJ_SIGNATURE)) {
  3551. startXRef = stream.pos + 6 - stream.start;
  3552. }
  3553. } else {
  3554. const step = 1024;
  3555. const startXRefLength = STARTXREF_SIGNATURE.length;
  3556. let found = false,
  3557. pos = stream.end;
  3558. while (!found && pos > 0) {
  3559. pos -= step - startXRefLength;
  3560. if (pos < 0) {
  3561. pos = 0;
  3562. }
  3563. stream.pos = pos;
  3564. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3565. }
  3566. if (found) {
  3567. stream.skip(9);
  3568. let ch;
  3569. do {
  3570. ch = stream.getByte();
  3571. } while ((0, _core_utils.isWhiteSpace)(ch));
  3572. let str = "";
  3573. while (ch >= 0x20 && ch <= 0x39) {
  3574. str += String.fromCharCode(ch);
  3575. ch = stream.getByte();
  3576. }
  3577. startXRef = parseInt(str, 10);
  3578. if (isNaN(startXRef)) {
  3579. startXRef = 0;
  3580. }
  3581. }
  3582. }
  3583. return (0, _util.shadow)(this, "startXRef", startXRef);
  3584. }
  3585. checkHeader() {
  3586. const stream = this.stream;
  3587. stream.reset();
  3588. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3589. return;
  3590. }
  3591. stream.moveStart();
  3592. stream.skip(PDF_HEADER_SIGNATURE.length);
  3593. let version = "",
  3594. ch;
  3595. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  3596. version += String.fromCharCode(ch);
  3597. }
  3598. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  3599. this._version = version;
  3600. } else {
  3601. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  3602. }
  3603. }
  3604. parseStartXRef() {
  3605. this.xref.setStartXRef(this.startXRef);
  3606. }
  3607. get numPages() {
  3608. let num = 0;
  3609. if (this.catalog.hasActualNumPages) {
  3610. num = this.catalog.numPages;
  3611. } else if (this.xfaFactory) {
  3612. num = this.xfaFactory.getNumPages();
  3613. } else if (this.linearization) {
  3614. num = this.linearization.numPages;
  3615. } else {
  3616. num = this.catalog.numPages;
  3617. }
  3618. return (0, _util.shadow)(this, "numPages", num);
  3619. }
  3620. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3621. const RECURSION_LIMIT = 10;
  3622. if (!Array.isArray(fields)) {
  3623. return false;
  3624. }
  3625. return fields.every(field => {
  3626. field = this.xref.fetchIfRef(field);
  3627. if (!(field instanceof _primitives.Dict)) {
  3628. return false;
  3629. }
  3630. if (field.has("Kids")) {
  3631. if (++recursionDepth > RECURSION_LIMIT) {
  3632. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3633. return false;
  3634. }
  3635. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3636. }
  3637. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3638. const rectangle = field.get("Rect");
  3639. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3640. return isSignature && isInvisible;
  3641. });
  3642. }
  3643. get _xfaStreams() {
  3644. const acroForm = this.catalog.acroForm;
  3645. if (!acroForm) {
  3646. return null;
  3647. }
  3648. const xfa = acroForm.get("XFA");
  3649. const entries = {
  3650. "xdp:xdp": "",
  3651. template: "",
  3652. datasets: "",
  3653. config: "",
  3654. connectionSet: "",
  3655. localeSet: "",
  3656. stylesheet: "",
  3657. "/xdp:xdp": ""
  3658. };
  3659. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3660. entries["xdp:xdp"] = xfa;
  3661. return entries;
  3662. }
  3663. if (!Array.isArray(xfa) || xfa.length === 0) {
  3664. return null;
  3665. }
  3666. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3667. let name;
  3668. if (i === 0) {
  3669. name = "xdp:xdp";
  3670. } else if (i === ii - 2) {
  3671. name = "/xdp:xdp";
  3672. } else {
  3673. name = xfa[i];
  3674. }
  3675. if (!entries.hasOwnProperty(name)) {
  3676. continue;
  3677. }
  3678. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3679. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3680. continue;
  3681. }
  3682. entries[name] = data;
  3683. }
  3684. return entries;
  3685. }
  3686. get xfaDatasets() {
  3687. const streams = this._xfaStreams;
  3688. if (!streams) {
  3689. return (0, _util.shadow)(this, "xfaDatasets", null);
  3690. }
  3691. for (const key of ["datasets", "xdp:xdp"]) {
  3692. const stream = streams[key];
  3693. if (!stream) {
  3694. continue;
  3695. }
  3696. try {
  3697. const str = (0, _util.stringToUTF8String)(stream.getString());
  3698. const data = {
  3699. [key]: str
  3700. };
  3701. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3702. } catch (_) {
  3703. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3704. break;
  3705. }
  3706. }
  3707. return (0, _util.shadow)(this, "xfaDatasets", null);
  3708. }
  3709. get xfaData() {
  3710. const streams = this._xfaStreams;
  3711. if (!streams) {
  3712. return null;
  3713. }
  3714. const data = Object.create(null);
  3715. for (const [key, stream] of Object.entries(streams)) {
  3716. if (!stream) {
  3717. continue;
  3718. }
  3719. try {
  3720. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3721. } catch (_) {
  3722. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3723. return null;
  3724. }
  3725. }
  3726. return data;
  3727. }
  3728. get xfaFactory() {
  3729. let data;
  3730. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3731. data = this.xfaData;
  3732. }
  3733. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3734. }
  3735. get isPureXfa() {
  3736. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3737. }
  3738. get htmlForXfa() {
  3739. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3740. }
  3741. async loadXfaImages() {
  3742. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3743. if (!xfaImagesDict) {
  3744. return;
  3745. }
  3746. const keys = xfaImagesDict.getKeys();
  3747. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3748. await objectLoader.load();
  3749. const xfaImages = new Map();
  3750. for (const key of keys) {
  3751. const stream = xfaImagesDict.get(key);
  3752. if (stream instanceof _base_stream.BaseStream) {
  3753. xfaImages.set(key, stream.getBytes());
  3754. }
  3755. }
  3756. this.xfaFactory.setImages(xfaImages);
  3757. }
  3758. async loadXfaFonts(handler, task) {
  3759. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3760. if (!acroForm) {
  3761. return;
  3762. }
  3763. const resources = await acroForm.getAsync("DR");
  3764. if (!(resources instanceof _primitives.Dict)) {
  3765. return;
  3766. }
  3767. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3768. await objectLoader.load();
  3769. const fontRes = resources.get("Font");
  3770. if (!(fontRes instanceof _primitives.Dict)) {
  3771. return;
  3772. }
  3773. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3774. options.useSystemFonts = false;
  3775. const partialEvaluator = new _evaluator.PartialEvaluator({
  3776. xref: this.xref,
  3777. handler,
  3778. pageIndex: -1,
  3779. idFactory: this._globalIdFactory,
  3780. fontCache: this.catalog.fontCache,
  3781. builtInCMapCache: this.catalog.builtInCMapCache,
  3782. standardFontDataCache: this.catalog.standardFontDataCache,
  3783. options
  3784. });
  3785. const operatorList = new _operator_list.OperatorList();
  3786. const pdfFonts = [];
  3787. const initialState = {
  3788. get font() {
  3789. return pdfFonts.at(-1);
  3790. },
  3791. set font(font) {
  3792. pdfFonts.push(font);
  3793. },
  3794. clone() {
  3795. return this;
  3796. }
  3797. };
  3798. const fonts = new Map();
  3799. fontRes.forEach((fontName, font) => {
  3800. fonts.set(fontName, font);
  3801. });
  3802. const promises = [];
  3803. for (const [fontName, font] of fonts) {
  3804. const descriptor = font.get("FontDescriptor");
  3805. if (!(descriptor instanceof _primitives.Dict)) {
  3806. continue;
  3807. }
  3808. let fontFamily = descriptor.get("FontFamily");
  3809. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3810. const fontWeight = descriptor.get("FontWeight");
  3811. const italicAngle = -descriptor.get("ItalicAngle");
  3812. const cssFontInfo = {
  3813. fontFamily,
  3814. fontWeight,
  3815. italicAngle
  3816. };
  3817. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3818. continue;
  3819. }
  3820. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3821. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3822. return null;
  3823. }));
  3824. }
  3825. await Promise.all(promises);
  3826. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3827. if (!missingFonts) {
  3828. return;
  3829. }
  3830. options.ignoreErrors = true;
  3831. promises.length = 0;
  3832. pdfFonts.length = 0;
  3833. const reallyMissingFonts = new Set();
  3834. for (const missing of missingFonts) {
  3835. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3836. reallyMissingFonts.add(missing);
  3837. }
  3838. }
  3839. if (reallyMissingFonts.size) {
  3840. missingFonts.push("PdfJS-Fallback");
  3841. }
  3842. for (const missing of missingFonts) {
  3843. if (reallyMissingFonts.has(missing)) {
  3844. continue;
  3845. }
  3846. for (const fontInfo of [{
  3847. name: "Regular",
  3848. fontWeight: 400,
  3849. italicAngle: 0
  3850. }, {
  3851. name: "Bold",
  3852. fontWeight: 700,
  3853. italicAngle: 0
  3854. }, {
  3855. name: "Italic",
  3856. fontWeight: 400,
  3857. italicAngle: 12
  3858. }, {
  3859. name: "BoldItalic",
  3860. fontWeight: 700,
  3861. italicAngle: 12
  3862. }]) {
  3863. const name = `${missing}-${fontInfo.name}`;
  3864. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3865. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3866. fontFamily: missing,
  3867. fontWeight: fontInfo.fontWeight,
  3868. italicAngle: fontInfo.italicAngle
  3869. }).catch(function (reason) {
  3870. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3871. return null;
  3872. }));
  3873. }
  3874. }
  3875. await Promise.all(promises);
  3876. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3877. }
  3878. async serializeXfaData(annotationStorage) {
  3879. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3880. }
  3881. get version() {
  3882. return this.catalog.version || this._version;
  3883. }
  3884. get formInfo() {
  3885. const formInfo = {
  3886. hasFields: false,
  3887. hasAcroForm: false,
  3888. hasXfa: false,
  3889. hasSignatures: false
  3890. };
  3891. const acroForm = this.catalog.acroForm;
  3892. if (!acroForm) {
  3893. return (0, _util.shadow)(this, "formInfo", formInfo);
  3894. }
  3895. try {
  3896. const fields = acroForm.get("Fields");
  3897. const hasFields = Array.isArray(fields) && fields.length > 0;
  3898. formInfo.hasFields = hasFields;
  3899. const xfa = acroForm.get("XFA");
  3900. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3901. const sigFlags = acroForm.get("SigFlags");
  3902. const hasSignatures = !!(sigFlags & 0x1);
  3903. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3904. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3905. formInfo.hasSignatures = hasSignatures;
  3906. } catch (ex) {
  3907. if (ex instanceof _core_utils.MissingDataException) {
  3908. throw ex;
  3909. }
  3910. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3911. }
  3912. return (0, _util.shadow)(this, "formInfo", formInfo);
  3913. }
  3914. get documentInfo() {
  3915. const docInfo = {
  3916. PDFFormatVersion: this.version,
  3917. Language: this.catalog.lang,
  3918. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3919. IsLinearized: !!this.linearization,
  3920. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3921. IsXFAPresent: this.formInfo.hasXfa,
  3922. IsCollectionPresent: !!this.catalog.collection,
  3923. IsSignaturesPresent: this.formInfo.hasSignatures
  3924. };
  3925. let infoDict;
  3926. try {
  3927. infoDict = this.xref.trailer.get("Info");
  3928. } catch (err) {
  3929. if (err instanceof _core_utils.MissingDataException) {
  3930. throw err;
  3931. }
  3932. (0, _util.info)("The document information dictionary is invalid.");
  3933. }
  3934. if (!(infoDict instanceof _primitives.Dict)) {
  3935. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3936. }
  3937. for (const key of infoDict.getKeys()) {
  3938. const value = infoDict.get(key);
  3939. switch (key) {
  3940. case "Title":
  3941. case "Author":
  3942. case "Subject":
  3943. case "Keywords":
  3944. case "Creator":
  3945. case "Producer":
  3946. case "CreationDate":
  3947. case "ModDate":
  3948. if (typeof value === "string") {
  3949. docInfo[key] = (0, _util.stringToPDFString)(value);
  3950. continue;
  3951. }
  3952. break;
  3953. case "Trapped":
  3954. if (value instanceof _primitives.Name) {
  3955. docInfo[key] = value;
  3956. continue;
  3957. }
  3958. break;
  3959. default:
  3960. let customValue;
  3961. switch (typeof value) {
  3962. case "string":
  3963. customValue = (0, _util.stringToPDFString)(value);
  3964. break;
  3965. case "number":
  3966. case "boolean":
  3967. customValue = value;
  3968. break;
  3969. default:
  3970. if (value instanceof _primitives.Name) {
  3971. customValue = value;
  3972. }
  3973. break;
  3974. }
  3975. if (customValue === undefined) {
  3976. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3977. continue;
  3978. }
  3979. if (!docInfo.Custom) {
  3980. docInfo.Custom = Object.create(null);
  3981. }
  3982. docInfo.Custom[key] = customValue;
  3983. continue;
  3984. }
  3985. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3986. }
  3987. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3988. }
  3989. get fingerprints() {
  3990. function validate(data) {
  3991. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3992. }
  3993. function hexString(hash) {
  3994. const buf = [];
  3995. for (const num of hash) {
  3996. const hex = num.toString(16);
  3997. buf.push(hex.padStart(2, "0"));
  3998. }
  3999. return buf.join("");
  4000. }
  4001. const idArray = this.xref.trailer.get("ID");
  4002. let hashOriginal, hashModified;
  4003. if (Array.isArray(idArray) && validate(idArray[0])) {
  4004. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  4005. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  4006. hashModified = (0, _util.stringToBytes)(idArray[1]);
  4007. }
  4008. } else {
  4009. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  4010. }
  4011. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  4012. }
  4013. async _getLinearizationPage(pageIndex) {
  4014. const {
  4015. catalog,
  4016. linearization,
  4017. xref
  4018. } = this;
  4019. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  4020. try {
  4021. const obj = await xref.fetchAsync(ref);
  4022. if (obj instanceof _primitives.Dict) {
  4023. let type = obj.getRaw("Type");
  4024. if (type instanceof _primitives.Ref) {
  4025. type = await xref.fetchAsync(type);
  4026. }
  4027. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  4028. if (!catalog.pageKidsCountCache.has(ref)) {
  4029. catalog.pageKidsCountCache.put(ref, 1);
  4030. }
  4031. if (!catalog.pageIndexCache.has(ref)) {
  4032. catalog.pageIndexCache.put(ref, 0);
  4033. }
  4034. return [obj, ref];
  4035. }
  4036. }
  4037. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  4038. } catch (reason) {
  4039. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4040. return catalog.getPageDict(pageIndex);
  4041. }
  4042. }
  4043. getPage(pageIndex) {
  4044. const cachedPromise = this._pagePromises.get(pageIndex);
  4045. if (cachedPromise) {
  4046. return cachedPromise;
  4047. }
  4048. const {
  4049. catalog,
  4050. linearization,
  4051. xfaFactory
  4052. } = this;
  4053. let promise;
  4054. if (xfaFactory) {
  4055. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4056. } else if (linearization && linearization.pageFirst === pageIndex) {
  4057. promise = this._getLinearizationPage(pageIndex);
  4058. } else {
  4059. promise = catalog.getPageDict(pageIndex);
  4060. }
  4061. promise = promise.then(([pageDict, ref]) => {
  4062. return new Page({
  4063. pdfManager: this.pdfManager,
  4064. xref: this.xref,
  4065. pageIndex,
  4066. pageDict,
  4067. ref,
  4068. globalIdFactory: this._globalIdFactory,
  4069. fontCache: catalog.fontCache,
  4070. builtInCMapCache: catalog.builtInCMapCache,
  4071. standardFontDataCache: catalog.standardFontDataCache,
  4072. globalImageCache: catalog.globalImageCache,
  4073. nonBlendModesSet: catalog.nonBlendModesSet,
  4074. xfaFactory
  4075. });
  4076. });
  4077. this._pagePromises.set(pageIndex, promise);
  4078. return promise;
  4079. }
  4080. async checkFirstPage(recoveryMode = false) {
  4081. if (recoveryMode) {
  4082. return;
  4083. }
  4084. try {
  4085. await this.getPage(0);
  4086. } catch (reason) {
  4087. if (reason instanceof _core_utils.XRefEntryException) {
  4088. this._pagePromises.delete(0);
  4089. await this.cleanup();
  4090. throw new _core_utils.XRefParseException();
  4091. }
  4092. }
  4093. }
  4094. async checkLastPage(recoveryMode = false) {
  4095. const {
  4096. catalog,
  4097. pdfManager
  4098. } = this;
  4099. catalog.setActualNumPages();
  4100. let numPages;
  4101. try {
  4102. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4103. if (this.xfaFactory) {
  4104. return;
  4105. } else if (this.linearization) {
  4106. numPages = this.linearization.numPages;
  4107. } else {
  4108. numPages = catalog.numPages;
  4109. }
  4110. if (!Number.isInteger(numPages)) {
  4111. throw new _util.FormatError("Page count is not an integer.");
  4112. } else if (numPages <= 1) {
  4113. return;
  4114. }
  4115. await this.getPage(numPages - 1);
  4116. } catch (reason) {
  4117. this._pagePromises.delete(numPages - 1);
  4118. await this.cleanup();
  4119. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4120. throw new _core_utils.XRefParseException();
  4121. }
  4122. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4123. let pagesTree;
  4124. try {
  4125. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4126. } catch (reasonAll) {
  4127. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4128. throw new _core_utils.XRefParseException();
  4129. }
  4130. catalog.setActualNumPages(1);
  4131. return;
  4132. }
  4133. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4134. let promise;
  4135. if (pageDict instanceof Error) {
  4136. promise = Promise.reject(pageDict);
  4137. promise.catch(() => {});
  4138. } else {
  4139. promise = Promise.resolve(new Page({
  4140. pdfManager,
  4141. xref: this.xref,
  4142. pageIndex,
  4143. pageDict,
  4144. ref,
  4145. globalIdFactory: this._globalIdFactory,
  4146. fontCache: catalog.fontCache,
  4147. builtInCMapCache: catalog.builtInCMapCache,
  4148. standardFontDataCache: catalog.standardFontDataCache,
  4149. globalImageCache: catalog.globalImageCache,
  4150. nonBlendModesSet: catalog.nonBlendModesSet,
  4151. xfaFactory: null
  4152. }));
  4153. }
  4154. this._pagePromises.set(pageIndex, promise);
  4155. }
  4156. catalog.setActualNumPages(pagesTree.size);
  4157. }
  4158. }
  4159. fontFallback(id, handler) {
  4160. return this.catalog.fontFallback(id, handler);
  4161. }
  4162. async cleanup(manuallyTriggered = false) {
  4163. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4164. }
  4165. _collectFieldObjects(name, fieldRef, promises) {
  4166. const field = this.xref.fetchIfRef(fieldRef);
  4167. if (field.has("T")) {
  4168. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4169. if (name === "") {
  4170. name = partName;
  4171. } else {
  4172. name = `${name}.${partName}`;
  4173. }
  4174. }
  4175. if (!promises.has(name)) {
  4176. promises.set(name, []);
  4177. }
  4178. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4179. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4180. return null;
  4181. }));
  4182. if (field.has("Kids")) {
  4183. const kids = field.get("Kids");
  4184. for (const kid of kids) {
  4185. this._collectFieldObjects(name, kid, promises);
  4186. }
  4187. }
  4188. }
  4189. get fieldObjects() {
  4190. if (!this.formInfo.hasFields) {
  4191. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4192. }
  4193. const allFields = Object.create(null);
  4194. const fieldPromises = new Map();
  4195. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4196. this._collectFieldObjects("", fieldRef, fieldPromises);
  4197. }
  4198. const allPromises = [];
  4199. for (const [name, promises] of fieldPromises) {
  4200. allPromises.push(Promise.all(promises).then(fields => {
  4201. fields = fields.filter(field => !!field);
  4202. if (fields.length > 0) {
  4203. allFields[name] = fields;
  4204. }
  4205. }));
  4206. }
  4207. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4208. }
  4209. get hasJSActions() {
  4210. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4211. return (0, _util.shadow)(this, "hasJSActions", promise);
  4212. }
  4213. async _parseHasJSActions() {
  4214. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4215. if (catalogJsActions) {
  4216. return true;
  4217. }
  4218. if (fieldObjects) {
  4219. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4220. }
  4221. return false;
  4222. }
  4223. get calculationOrderIds() {
  4224. const acroForm = this.catalog.acroForm;
  4225. if (!acroForm || !acroForm.has("CO")) {
  4226. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4227. }
  4228. const calculationOrder = acroForm.get("CO");
  4229. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4230. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4231. }
  4232. const ids = [];
  4233. for (const id of calculationOrder) {
  4234. if (id instanceof _primitives.Ref) {
  4235. ids.push(id.toString());
  4236. }
  4237. }
  4238. if (ids.length === 0) {
  4239. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4240. }
  4241. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4242. }
  4243. }
  4244. exports.PDFDocument = PDFDocument;
  4245. /***/ }),
  4246. /* 10 */
  4247. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4248. Object.defineProperty(exports, "__esModule", ({
  4249. value: true
  4250. }));
  4251. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  4252. exports.getQuadPoints = getQuadPoints;
  4253. var _util = __w_pdfjs_require__(2);
  4254. var _core_utils = __w_pdfjs_require__(4);
  4255. var _default_appearance = __w_pdfjs_require__(11);
  4256. var _primitives = __w_pdfjs_require__(3);
  4257. var _writer = __w_pdfjs_require__(63);
  4258. var _base_stream = __w_pdfjs_require__(5);
  4259. var _bidi = __w_pdfjs_require__(58);
  4260. var _catalog = __w_pdfjs_require__(67);
  4261. var _colorspace = __w_pdfjs_require__(12);
  4262. var _file_spec = __w_pdfjs_require__(70);
  4263. var _object_loader = __w_pdfjs_require__(73);
  4264. var _operator_list = __w_pdfjs_require__(60);
  4265. var _stream = __w_pdfjs_require__(8);
  4266. var _factory = __w_pdfjs_require__(74);
  4267. class AnnotationFactory {
  4268. static create(xref, ref, pdfManager, idFactory, collectFields) {
  4269. 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]));
  4270. }
  4271. static _create(xref, ref, pdfManager, idFactory, acroForm, attachments = null, xfaDatasets, collectFields, pageIndex = -1) {
  4272. const dict = xref.fetchIfRef(ref);
  4273. if (!(dict instanceof _primitives.Dict)) {
  4274. return undefined;
  4275. }
  4276. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  4277. let subtype = dict.get("Subtype");
  4278. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  4279. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  4280. const parameters = {
  4281. xref,
  4282. ref,
  4283. dict,
  4284. subtype,
  4285. id,
  4286. pdfManager,
  4287. acroForm: acroFormDict,
  4288. attachments,
  4289. xfaDatasets,
  4290. collectFields,
  4291. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  4292. pageIndex,
  4293. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  4294. };
  4295. switch (subtype) {
  4296. case "Link":
  4297. return new LinkAnnotation(parameters);
  4298. case "Text":
  4299. return new TextAnnotation(parameters);
  4300. case "Widget":
  4301. let fieldType = (0, _core_utils.getInheritableProperty)({
  4302. dict,
  4303. key: "FT"
  4304. });
  4305. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  4306. switch (fieldType) {
  4307. case "Tx":
  4308. return new TextWidgetAnnotation(parameters);
  4309. case "Btn":
  4310. return new ButtonWidgetAnnotation(parameters);
  4311. case "Ch":
  4312. return new ChoiceWidgetAnnotation(parameters);
  4313. case "Sig":
  4314. return new SignatureWidgetAnnotation(parameters);
  4315. }
  4316. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  4317. return new WidgetAnnotation(parameters);
  4318. case "Popup":
  4319. return new PopupAnnotation(parameters);
  4320. case "FreeText":
  4321. return new FreeTextAnnotation(parameters);
  4322. case "Line":
  4323. return new LineAnnotation(parameters);
  4324. case "Square":
  4325. return new SquareAnnotation(parameters);
  4326. case "Circle":
  4327. return new CircleAnnotation(parameters);
  4328. case "PolyLine":
  4329. return new PolylineAnnotation(parameters);
  4330. case "Polygon":
  4331. return new PolygonAnnotation(parameters);
  4332. case "Caret":
  4333. return new CaretAnnotation(parameters);
  4334. case "Ink":
  4335. return new InkAnnotation(parameters);
  4336. case "Highlight":
  4337. return new HighlightAnnotation(parameters);
  4338. case "Underline":
  4339. return new UnderlineAnnotation(parameters);
  4340. case "Squiggly":
  4341. return new SquigglyAnnotation(parameters);
  4342. case "StrikeOut":
  4343. return new StrikeOutAnnotation(parameters);
  4344. case "Stamp":
  4345. return new StampAnnotation(parameters);
  4346. case "FileAttachment":
  4347. return new FileAttachmentAnnotation(parameters);
  4348. default:
  4349. if (!collectFields) {
  4350. if (!subtype) {
  4351. (0, _util.warn)("Annotation is missing the required /Subtype.");
  4352. } else {
  4353. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  4354. }
  4355. }
  4356. return new Annotation(parameters);
  4357. }
  4358. }
  4359. static async _getPageIndex(xref, ref, pdfManager) {
  4360. try {
  4361. const annotDict = await xref.fetchIfRefAsync(ref);
  4362. if (!(annotDict instanceof _primitives.Dict)) {
  4363. return -1;
  4364. }
  4365. const pageRef = annotDict.getRaw("P");
  4366. if (!(pageRef instanceof _primitives.Ref)) {
  4367. return -1;
  4368. }
  4369. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  4370. return pageIndex;
  4371. } catch (ex) {
  4372. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  4373. return -1;
  4374. }
  4375. }
  4376. static async saveNewAnnotations(evaluator, task, annotations) {
  4377. const xref = evaluator.xref;
  4378. let baseFontRef;
  4379. const dependencies = [];
  4380. const promises = [];
  4381. for (const annotation of annotations) {
  4382. switch (annotation.annotationType) {
  4383. case _util.AnnotationEditorType.FREETEXT:
  4384. if (!baseFontRef) {
  4385. const baseFont = new _primitives.Dict(xref);
  4386. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  4387. baseFont.set("Type", _primitives.Name.get("Font"));
  4388. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  4389. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  4390. const buffer = [];
  4391. baseFontRef = xref.getNewTemporaryRef();
  4392. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  4393. dependencies.push({
  4394. ref: baseFontRef,
  4395. data: buffer.join("")
  4396. });
  4397. }
  4398. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  4399. evaluator,
  4400. task,
  4401. baseFontRef
  4402. }));
  4403. break;
  4404. case _util.AnnotationEditorType.INK:
  4405. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  4406. }
  4407. }
  4408. return {
  4409. annotations: await Promise.all(promises),
  4410. dependencies
  4411. };
  4412. }
  4413. static async printNewAnnotations(evaluator, task, annotations) {
  4414. if (!annotations) {
  4415. return null;
  4416. }
  4417. const xref = evaluator.xref;
  4418. const promises = [];
  4419. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  4420. for (const annotation of annotations) {
  4421. switch (annotation.annotationType) {
  4422. case _util.AnnotationEditorType.FREETEXT:
  4423. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  4424. evaluator,
  4425. task,
  4426. isOffscreenCanvasSupported
  4427. }));
  4428. break;
  4429. case _util.AnnotationEditorType.INK:
  4430. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  4431. isOffscreenCanvasSupported
  4432. }));
  4433. break;
  4434. }
  4435. }
  4436. return Promise.all(promises);
  4437. }
  4438. }
  4439. exports.AnnotationFactory = AnnotationFactory;
  4440. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  4441. if (!Array.isArray(color)) {
  4442. return defaultColor;
  4443. }
  4444. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  4445. switch (color.length) {
  4446. case 0:
  4447. return null;
  4448. case 1:
  4449. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  4450. return rgbColor;
  4451. case 3:
  4452. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  4453. return rgbColor;
  4454. case 4:
  4455. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  4456. return rgbColor;
  4457. default:
  4458. return defaultColor;
  4459. }
  4460. }
  4461. function getPdfColorArray(color) {
  4462. return Array.from(color, c => c / 255);
  4463. }
  4464. function getQuadPoints(dict, rect) {
  4465. const quadPoints = dict.getArray("QuadPoints");
  4466. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  4467. return null;
  4468. }
  4469. const quadPointsLists = [];
  4470. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  4471. let minX = Infinity,
  4472. maxX = -Infinity,
  4473. minY = Infinity,
  4474. maxY = -Infinity;
  4475. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  4476. const x = quadPoints[j];
  4477. const y = quadPoints[j + 1];
  4478. minX = Math.min(x, minX);
  4479. maxX = Math.max(x, maxX);
  4480. minY = Math.min(y, minY);
  4481. maxY = Math.max(y, maxY);
  4482. }
  4483. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  4484. return null;
  4485. }
  4486. quadPointsLists.push([{
  4487. x: minX,
  4488. y: maxY
  4489. }, {
  4490. x: maxX,
  4491. y: maxY
  4492. }, {
  4493. x: minX,
  4494. y: minY
  4495. }, {
  4496. x: maxX,
  4497. y: minY
  4498. }]);
  4499. }
  4500. return quadPointsLists;
  4501. }
  4502. function getTransformMatrix(rect, bbox, matrix) {
  4503. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  4504. if (minX === maxX || minY === maxY) {
  4505. return [1, 0, 0, 1, rect[0], rect[1]];
  4506. }
  4507. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  4508. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  4509. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  4510. }
  4511. class Annotation {
  4512. constructor(params) {
  4513. const {
  4514. dict,
  4515. xref
  4516. } = params;
  4517. this.setTitle(dict.get("T"));
  4518. this.setContents(dict.get("Contents"));
  4519. this.setModificationDate(dict.get("M"));
  4520. this.setFlags(dict.get("F"));
  4521. this.setRectangle(dict.getArray("Rect"));
  4522. this.setColor(dict.getArray("C"));
  4523. this.setBorderStyle(dict);
  4524. this.setAppearance(dict);
  4525. this.setOptionalContent(dict);
  4526. const MK = dict.get("MK");
  4527. this.setBorderAndBackgroundColors(MK);
  4528. this.setRotation(MK);
  4529. this._streams = [];
  4530. if (this.appearance) {
  4531. this._streams.push(this.appearance);
  4532. }
  4533. this.data = {
  4534. annotationFlags: this.flags,
  4535. borderStyle: this.borderStyle,
  4536. color: this.color,
  4537. backgroundColor: this.backgroundColor,
  4538. borderColor: this.borderColor,
  4539. rotation: this.rotation,
  4540. contentsObj: this._contents,
  4541. hasAppearance: !!this.appearance,
  4542. id: params.id,
  4543. modificationDate: this.modificationDate,
  4544. rect: this.rectangle,
  4545. subtype: params.subtype,
  4546. hasOwnCanvas: false
  4547. };
  4548. if (params.collectFields) {
  4549. const kids = dict.get("Kids");
  4550. if (Array.isArray(kids)) {
  4551. const kidIds = [];
  4552. for (const kid of kids) {
  4553. if (kid instanceof _primitives.Ref) {
  4554. kidIds.push(kid.toString());
  4555. }
  4556. }
  4557. if (kidIds.length !== 0) {
  4558. this.data.kidIds = kidIds;
  4559. }
  4560. }
  4561. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  4562. this.data.fieldName = this._constructFieldName(dict);
  4563. this.data.pageIndex = params.pageIndex;
  4564. }
  4565. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  4566. this._fallbackFontDict = null;
  4567. this._needAppearances = false;
  4568. }
  4569. _hasFlag(flags, flag) {
  4570. return !!(flags & flag);
  4571. }
  4572. _isViewable(flags) {
  4573. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4574. }
  4575. _isPrintable(flags) {
  4576. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4577. }
  4578. mustBeViewed(annotationStorage) {
  4579. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4580. if (storageEntry && storageEntry.hidden !== undefined) {
  4581. return !storageEntry.hidden;
  4582. }
  4583. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4584. }
  4585. mustBePrinted(annotationStorage) {
  4586. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4587. if (storageEntry && storageEntry.print !== undefined) {
  4588. return storageEntry.print;
  4589. }
  4590. return this.printable;
  4591. }
  4592. get viewable() {
  4593. if (this.data.quadPoints === null) {
  4594. return false;
  4595. }
  4596. if (this.flags === 0) {
  4597. return true;
  4598. }
  4599. return this._isViewable(this.flags);
  4600. }
  4601. get printable() {
  4602. if (this.data.quadPoints === null) {
  4603. return false;
  4604. }
  4605. if (this.flags === 0) {
  4606. return false;
  4607. }
  4608. return this._isPrintable(this.flags);
  4609. }
  4610. _parseStringHelper(data) {
  4611. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  4612. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  4613. return {
  4614. str,
  4615. dir
  4616. };
  4617. }
  4618. setDefaultAppearance(params) {
  4619. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  4620. dict: params.dict,
  4621. key: "DA"
  4622. }) || params.acroForm.get("DA");
  4623. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  4624. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  4625. }
  4626. setTitle(title) {
  4627. this._title = this._parseStringHelper(title);
  4628. }
  4629. setContents(contents) {
  4630. this._contents = this._parseStringHelper(contents);
  4631. }
  4632. setModificationDate(modificationDate) {
  4633. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  4634. }
  4635. setFlags(flags) {
  4636. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4637. }
  4638. hasFlag(flag) {
  4639. return this._hasFlag(this.flags, flag);
  4640. }
  4641. setRectangle(rectangle) {
  4642. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4643. this.rectangle = _util.Util.normalizeRect(rectangle);
  4644. } else {
  4645. this.rectangle = [0, 0, 0, 0];
  4646. }
  4647. }
  4648. setColor(color) {
  4649. this.color = getRgbColor(color);
  4650. }
  4651. setLineEndings(lineEndings) {
  4652. this.lineEndings = ["None", "None"];
  4653. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  4654. for (let i = 0; i < 2; i++) {
  4655. const obj = lineEndings[i];
  4656. if (obj instanceof _primitives.Name) {
  4657. switch (obj.name) {
  4658. case "None":
  4659. continue;
  4660. case "Square":
  4661. case "Circle":
  4662. case "Diamond":
  4663. case "OpenArrow":
  4664. case "ClosedArrow":
  4665. case "Butt":
  4666. case "ROpenArrow":
  4667. case "RClosedArrow":
  4668. case "Slash":
  4669. this.lineEndings[i] = obj.name;
  4670. continue;
  4671. }
  4672. }
  4673. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  4674. }
  4675. }
  4676. }
  4677. setRotation(mk) {
  4678. this.rotation = 0;
  4679. if (mk instanceof _primitives.Dict) {
  4680. let angle = mk.get("R") || 0;
  4681. if (Number.isInteger(angle) && angle !== 0) {
  4682. angle %= 360;
  4683. if (angle < 0) {
  4684. angle += 360;
  4685. }
  4686. if (angle % 90 === 0) {
  4687. this.rotation = angle;
  4688. }
  4689. }
  4690. }
  4691. }
  4692. setBorderAndBackgroundColors(mk) {
  4693. if (mk instanceof _primitives.Dict) {
  4694. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  4695. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  4696. } else {
  4697. this.borderColor = this.backgroundColor = null;
  4698. }
  4699. }
  4700. setBorderStyle(borderStyle) {
  4701. this.borderStyle = new AnnotationBorderStyle();
  4702. if (!(borderStyle instanceof _primitives.Dict)) {
  4703. return;
  4704. }
  4705. if (borderStyle.has("BS")) {
  4706. const dict = borderStyle.get("BS");
  4707. const dictType = dict.get("Type");
  4708. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4709. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4710. this.borderStyle.setStyle(dict.get("S"));
  4711. this.borderStyle.setDashArray(dict.getArray("D"));
  4712. }
  4713. } else if (borderStyle.has("Border")) {
  4714. const array = borderStyle.getArray("Border");
  4715. if (Array.isArray(array) && array.length >= 3) {
  4716. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4717. this.borderStyle.setVerticalCornerRadius(array[1]);
  4718. this.borderStyle.setWidth(array[2], this.rectangle);
  4719. if (array.length === 4) {
  4720. this.borderStyle.setDashArray(array[3], true);
  4721. }
  4722. }
  4723. } else {
  4724. this.borderStyle.setWidth(0);
  4725. }
  4726. }
  4727. setAppearance(dict) {
  4728. this.appearance = null;
  4729. const appearanceStates = dict.get("AP");
  4730. if (!(appearanceStates instanceof _primitives.Dict)) {
  4731. return;
  4732. }
  4733. const normalAppearanceState = appearanceStates.get("N");
  4734. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  4735. this.appearance = normalAppearanceState;
  4736. return;
  4737. }
  4738. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  4739. return;
  4740. }
  4741. const as = dict.get("AS");
  4742. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  4743. return;
  4744. }
  4745. this.appearance = normalAppearanceState.get(as.name);
  4746. }
  4747. setOptionalContent(dict) {
  4748. this.oc = null;
  4749. const oc = dict.get("OC");
  4750. if (oc instanceof _primitives.Name) {
  4751. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  4752. } else if (oc instanceof _primitives.Dict) {
  4753. this.oc = oc;
  4754. }
  4755. }
  4756. loadResources(keys, appearance) {
  4757. return appearance.dict.getAsync("Resources").then(resources => {
  4758. if (!resources) {
  4759. return undefined;
  4760. }
  4761. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4762. return objectLoader.load().then(function () {
  4763. return resources;
  4764. });
  4765. });
  4766. }
  4767. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  4768. const data = this.data;
  4769. let appearance = this.appearance;
  4770. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  4771. if (!appearance) {
  4772. if (!isUsingOwnCanvas) {
  4773. return {
  4774. opList: new _operator_list.OperatorList(),
  4775. separateForm: false,
  4776. separateCanvas: false
  4777. };
  4778. }
  4779. appearance = new _stream.StringStream("");
  4780. appearance.dict = new _primitives.Dict();
  4781. }
  4782. const appearanceDict = appearance.dict;
  4783. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  4784. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4785. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4786. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4787. const opList = new _operator_list.OperatorList();
  4788. let optionalContent;
  4789. if (this.oc) {
  4790. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  4791. }
  4792. if (optionalContent !== undefined) {
  4793. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  4794. }
  4795. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  4796. await evaluator.getOperatorList({
  4797. stream: appearance,
  4798. task,
  4799. resources,
  4800. operatorList: opList,
  4801. fallbackFontDict: this._fallbackFontDict
  4802. });
  4803. opList.addOp(_util.OPS.endAnnotation, []);
  4804. if (optionalContent !== undefined) {
  4805. opList.addOp(_util.OPS.endMarkedContent, []);
  4806. }
  4807. this.reset();
  4808. return {
  4809. opList,
  4810. separateForm: false,
  4811. separateCanvas: isUsingOwnCanvas
  4812. };
  4813. }
  4814. async save(evaluator, task, annotationStorage) {
  4815. return null;
  4816. }
  4817. get hasTextContent() {
  4818. return false;
  4819. }
  4820. async extractTextContent(evaluator, task, viewBox) {
  4821. if (!this.appearance) {
  4822. return;
  4823. }
  4824. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  4825. const text = [];
  4826. const buffer = [];
  4827. const sink = {
  4828. desiredSize: Math.Infinity,
  4829. ready: true,
  4830. enqueue(chunk, size) {
  4831. for (const item of chunk.items) {
  4832. buffer.push(item.str);
  4833. if (item.hasEOL) {
  4834. text.push(buffer.join(""));
  4835. buffer.length = 0;
  4836. }
  4837. }
  4838. }
  4839. };
  4840. await evaluator.getTextContent({
  4841. stream: this.appearance,
  4842. task,
  4843. resources,
  4844. includeMarkedContent: true,
  4845. combineTextItems: true,
  4846. sink,
  4847. viewBox
  4848. });
  4849. this.reset();
  4850. if (buffer.length) {
  4851. text.push(buffer.join(""));
  4852. }
  4853. if (text.length > 0) {
  4854. this.data.textContent = text;
  4855. }
  4856. }
  4857. getFieldObject() {
  4858. if (this.data.kidIds) {
  4859. return {
  4860. id: this.data.id,
  4861. actions: this.data.actions,
  4862. name: this.data.fieldName,
  4863. strokeColor: this.data.borderColor,
  4864. fillColor: this.data.backgroundColor,
  4865. type: "",
  4866. kidIds: this.data.kidIds,
  4867. page: this.data.pageIndex,
  4868. rotation: this.rotation
  4869. };
  4870. }
  4871. return null;
  4872. }
  4873. reset() {
  4874. for (const stream of this._streams) {
  4875. stream.reset();
  4876. }
  4877. }
  4878. _constructFieldName(dict) {
  4879. if (!dict.has("T") && !dict.has("Parent")) {
  4880. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4881. return "";
  4882. }
  4883. if (!dict.has("Parent")) {
  4884. return (0, _util.stringToPDFString)(dict.get("T"));
  4885. }
  4886. const fieldName = [];
  4887. if (dict.has("T")) {
  4888. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4889. }
  4890. let loopDict = dict;
  4891. const visited = new _primitives.RefSet();
  4892. if (dict.objId) {
  4893. visited.put(dict.objId);
  4894. }
  4895. while (loopDict.has("Parent")) {
  4896. loopDict = loopDict.get("Parent");
  4897. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4898. break;
  4899. }
  4900. if (loopDict.objId) {
  4901. visited.put(loopDict.objId);
  4902. }
  4903. if (loopDict.has("T")) {
  4904. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4905. }
  4906. }
  4907. return fieldName.join(".");
  4908. }
  4909. }
  4910. exports.Annotation = Annotation;
  4911. class AnnotationBorderStyle {
  4912. constructor() {
  4913. this.width = 1;
  4914. this.style = _util.AnnotationBorderStyleType.SOLID;
  4915. this.dashArray = [3];
  4916. this.horizontalCornerRadius = 0;
  4917. this.verticalCornerRadius = 0;
  4918. }
  4919. setWidth(width, rect = [0, 0, 0, 0]) {
  4920. if (width instanceof _primitives.Name) {
  4921. this.width = 0;
  4922. return;
  4923. }
  4924. if (typeof width === "number") {
  4925. if (width > 0) {
  4926. const maxWidth = (rect[2] - rect[0]) / 2;
  4927. const maxHeight = (rect[3] - rect[1]) / 2;
  4928. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4929. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4930. width = 1;
  4931. }
  4932. }
  4933. this.width = width;
  4934. }
  4935. }
  4936. setStyle(style) {
  4937. if (!(style instanceof _primitives.Name)) {
  4938. return;
  4939. }
  4940. switch (style.name) {
  4941. case "S":
  4942. this.style = _util.AnnotationBorderStyleType.SOLID;
  4943. break;
  4944. case "D":
  4945. this.style = _util.AnnotationBorderStyleType.DASHED;
  4946. break;
  4947. case "B":
  4948. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4949. break;
  4950. case "I":
  4951. this.style = _util.AnnotationBorderStyleType.INSET;
  4952. break;
  4953. case "U":
  4954. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4955. break;
  4956. default:
  4957. break;
  4958. }
  4959. }
  4960. setDashArray(dashArray, forceStyle = false) {
  4961. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4962. let isValid = true;
  4963. let allZeros = true;
  4964. for (const element of dashArray) {
  4965. const validNumber = +element >= 0;
  4966. if (!validNumber) {
  4967. isValid = false;
  4968. break;
  4969. } else if (element > 0) {
  4970. allZeros = false;
  4971. }
  4972. }
  4973. if (isValid && !allZeros) {
  4974. this.dashArray = dashArray;
  4975. if (forceStyle) {
  4976. this.setStyle(_primitives.Name.get("D"));
  4977. }
  4978. } else {
  4979. this.width = 0;
  4980. }
  4981. } else if (dashArray) {
  4982. this.width = 0;
  4983. }
  4984. }
  4985. setHorizontalCornerRadius(radius) {
  4986. if (Number.isInteger(radius)) {
  4987. this.horizontalCornerRadius = radius;
  4988. }
  4989. }
  4990. setVerticalCornerRadius(radius) {
  4991. if (Number.isInteger(radius)) {
  4992. this.verticalCornerRadius = radius;
  4993. }
  4994. }
  4995. }
  4996. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4997. class MarkupAnnotation extends Annotation {
  4998. constructor(params) {
  4999. super(params);
  5000. const {
  5001. dict
  5002. } = params;
  5003. if (dict.has("IRT")) {
  5004. const rawIRT = dict.getRaw("IRT");
  5005. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  5006. const rt = dict.get("RT");
  5007. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  5008. }
  5009. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  5010. const parent = dict.get("IRT");
  5011. this.setTitle(parent.get("T"));
  5012. this.data.titleObj = this._title;
  5013. this.setContents(parent.get("Contents"));
  5014. this.data.contentsObj = this._contents;
  5015. if (!parent.has("CreationDate")) {
  5016. this.data.creationDate = null;
  5017. } else {
  5018. this.setCreationDate(parent.get("CreationDate"));
  5019. this.data.creationDate = this.creationDate;
  5020. }
  5021. if (!parent.has("M")) {
  5022. this.data.modificationDate = null;
  5023. } else {
  5024. this.setModificationDate(parent.get("M"));
  5025. this.data.modificationDate = this.modificationDate;
  5026. }
  5027. this.data.hasPopup = parent.has("Popup");
  5028. if (!parent.has("C")) {
  5029. this.data.color = null;
  5030. } else {
  5031. this.setColor(parent.getArray("C"));
  5032. this.data.color = this.color;
  5033. }
  5034. } else {
  5035. this.data.titleObj = this._title;
  5036. this.setCreationDate(dict.get("CreationDate"));
  5037. this.data.creationDate = this.creationDate;
  5038. this.data.hasPopup = dict.has("Popup");
  5039. if (!dict.has("C")) {
  5040. this.data.color = null;
  5041. }
  5042. }
  5043. if (dict.has("RC")) {
  5044. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  5045. }
  5046. }
  5047. setCreationDate(creationDate) {
  5048. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  5049. }
  5050. _setDefaultAppearance({
  5051. xref,
  5052. extra,
  5053. strokeColor,
  5054. fillColor,
  5055. blendMode,
  5056. strokeAlpha,
  5057. fillAlpha,
  5058. pointsCallback
  5059. }) {
  5060. let minX = Number.MAX_VALUE;
  5061. let minY = Number.MAX_VALUE;
  5062. let maxX = Number.MIN_VALUE;
  5063. let maxY = Number.MIN_VALUE;
  5064. const buffer = ["q"];
  5065. if (extra) {
  5066. buffer.push(extra);
  5067. }
  5068. if (strokeColor) {
  5069. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  5070. }
  5071. if (fillColor) {
  5072. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  5073. }
  5074. let pointsArray = this.data.quadPoints;
  5075. if (!pointsArray) {
  5076. pointsArray = [[{
  5077. x: this.rectangle[0],
  5078. y: this.rectangle[3]
  5079. }, {
  5080. x: this.rectangle[2],
  5081. y: this.rectangle[3]
  5082. }, {
  5083. x: this.rectangle[0],
  5084. y: this.rectangle[1]
  5085. }, {
  5086. x: this.rectangle[2],
  5087. y: this.rectangle[1]
  5088. }]];
  5089. }
  5090. for (const points of pointsArray) {
  5091. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  5092. minX = Math.min(minX, mX);
  5093. maxX = Math.max(maxX, MX);
  5094. minY = Math.min(minY, mY);
  5095. maxY = Math.max(maxY, MY);
  5096. }
  5097. buffer.push("Q");
  5098. const formDict = new _primitives.Dict(xref);
  5099. const appearanceStreamDict = new _primitives.Dict(xref);
  5100. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5101. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  5102. appearanceStream.dict = appearanceStreamDict;
  5103. formDict.set("Fm0", appearanceStream);
  5104. const gsDict = new _primitives.Dict(xref);
  5105. if (blendMode) {
  5106. gsDict.set("BM", _primitives.Name.get(blendMode));
  5107. }
  5108. if (typeof strokeAlpha === "number") {
  5109. gsDict.set("CA", strokeAlpha);
  5110. }
  5111. if (typeof fillAlpha === "number") {
  5112. gsDict.set("ca", fillAlpha);
  5113. }
  5114. const stateDict = new _primitives.Dict(xref);
  5115. stateDict.set("GS0", gsDict);
  5116. const resources = new _primitives.Dict(xref);
  5117. resources.set("ExtGState", stateDict);
  5118. resources.set("XObject", formDict);
  5119. const appearanceDict = new _primitives.Dict(xref);
  5120. appearanceDict.set("Resources", resources);
  5121. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  5122. appearanceDict.set("BBox", bbox);
  5123. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  5124. this.appearance.dict = appearanceDict;
  5125. this._streams.push(this.appearance, appearanceStream);
  5126. }
  5127. static async createNewAnnotation(xref, annotation, dependencies, params) {
  5128. const annotationRef = xref.getNewTemporaryRef();
  5129. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5130. const buffer = [];
  5131. let annotationDict;
  5132. if (ap) {
  5133. const apRef = xref.getNewTemporaryRef();
  5134. annotationDict = this.createNewDict(annotation, xref, {
  5135. apRef
  5136. });
  5137. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  5138. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  5139. dependencies.push({
  5140. ref: apRef,
  5141. data: buffer.join("")
  5142. });
  5143. } else {
  5144. annotationDict = this.createNewDict(annotation, xref, {});
  5145. }
  5146. buffer.length = 0;
  5147. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  5148. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  5149. return {
  5150. ref: annotationRef,
  5151. data: buffer.join("")
  5152. };
  5153. }
  5154. static async createNewPrintAnnotation(xref, annotation, params) {
  5155. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5156. const annotationDict = this.createNewDict(annotation, xref, {
  5157. ap
  5158. });
  5159. return new this.prototype.constructor({
  5160. dict: annotationDict,
  5161. xref,
  5162. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  5163. });
  5164. }
  5165. }
  5166. exports.MarkupAnnotation = MarkupAnnotation;
  5167. class WidgetAnnotation extends Annotation {
  5168. constructor(params) {
  5169. super(params);
  5170. const {
  5171. dict,
  5172. xref
  5173. } = params;
  5174. const data = this.data;
  5175. this.ref = params.ref;
  5176. this._needAppearances = params.needAppearances;
  5177. data.annotationType = _util.AnnotationType.WIDGET;
  5178. if (data.fieldName === undefined) {
  5179. data.fieldName = this._constructFieldName(dict);
  5180. }
  5181. if (data.actions === undefined) {
  5182. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  5183. }
  5184. let fieldValue = (0, _core_utils.getInheritableProperty)({
  5185. dict,
  5186. key: "V",
  5187. getArray: true
  5188. });
  5189. data.fieldValue = this._decodeFormValue(fieldValue);
  5190. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  5191. dict,
  5192. key: "DV",
  5193. getArray: true
  5194. });
  5195. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  5196. if (fieldValue === undefined && params.xfaDatasets) {
  5197. const path = this._title.str;
  5198. if (path) {
  5199. this._hasValueFromXFA = true;
  5200. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  5201. }
  5202. }
  5203. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  5204. data.fieldValue = data.defaultFieldValue;
  5205. }
  5206. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  5207. this.setDefaultAppearance(params);
  5208. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  5209. const fieldType = (0, _core_utils.getInheritableProperty)({
  5210. dict,
  5211. key: "FT"
  5212. });
  5213. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  5214. const localResources = (0, _core_utils.getInheritableProperty)({
  5215. dict,
  5216. key: "DR"
  5217. });
  5218. const acroFormResources = params.acroForm.get("DR");
  5219. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  5220. this._fieldResources = {
  5221. localResources,
  5222. acroFormResources,
  5223. appearanceResources,
  5224. mergedResources: _primitives.Dict.merge({
  5225. xref,
  5226. dictArray: [localResources, appearanceResources, acroFormResources],
  5227. mergeSubDicts: true
  5228. })
  5229. };
  5230. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  5231. dict,
  5232. key: "Ff"
  5233. });
  5234. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  5235. data.fieldFlags = 0;
  5236. }
  5237. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  5238. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  5239. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  5240. }
  5241. _decodeFormValue(formValue) {
  5242. if (Array.isArray(formValue)) {
  5243. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  5244. } else if (formValue instanceof _primitives.Name) {
  5245. return (0, _util.stringToPDFString)(formValue.name);
  5246. } else if (typeof formValue === "string") {
  5247. return (0, _util.stringToPDFString)(formValue);
  5248. }
  5249. return null;
  5250. }
  5251. hasFieldFlag(flag) {
  5252. return !!(this.data.fieldFlags & flag);
  5253. }
  5254. getRotationMatrix(annotationStorage) {
  5255. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5256. let rotation = storageEntry && storageEntry.rotation;
  5257. if (rotation === undefined) {
  5258. rotation = this.rotation;
  5259. }
  5260. if (rotation === 0) {
  5261. return _util.IDENTITY_MATRIX;
  5262. }
  5263. const width = this.data.rect[2] - this.data.rect[0];
  5264. const height = this.data.rect[3] - this.data.rect[1];
  5265. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  5266. }
  5267. getBorderAndBackgroundAppearances(annotationStorage) {
  5268. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5269. let rotation = storageEntry && storageEntry.rotation;
  5270. if (rotation === undefined) {
  5271. rotation = this.rotation;
  5272. }
  5273. if (!this.backgroundColor && !this.borderColor) {
  5274. return "";
  5275. }
  5276. const width = this.data.rect[2] - this.data.rect[0];
  5277. const height = this.data.rect[3] - this.data.rect[1];
  5278. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  5279. let str = "";
  5280. if (this.backgroundColor) {
  5281. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  5282. }
  5283. if (this.borderColor) {
  5284. const borderWidth = this.borderStyle.width || 1;
  5285. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  5286. }
  5287. return str;
  5288. }
  5289. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5290. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  5291. return {
  5292. opList: new _operator_list.OperatorList(),
  5293. separateForm: true,
  5294. separateCanvas: false
  5295. };
  5296. }
  5297. if (!this._hasText) {
  5298. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5299. }
  5300. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  5301. if (this.appearance && content === null) {
  5302. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5303. }
  5304. const opList = new _operator_list.OperatorList();
  5305. if (!this._defaultAppearance || content === null) {
  5306. return {
  5307. opList,
  5308. separateForm: false,
  5309. separateCanvas: false
  5310. };
  5311. }
  5312. const matrix = [1, 0, 0, 1, 0, 0];
  5313. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5314. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  5315. let optionalContent;
  5316. if (this.oc) {
  5317. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  5318. }
  5319. if (optionalContent !== undefined) {
  5320. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  5321. }
  5322. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  5323. const stream = new _stream.StringStream(content);
  5324. await evaluator.getOperatorList({
  5325. stream,
  5326. task,
  5327. resources: this._fieldResources.mergedResources,
  5328. operatorList: opList
  5329. });
  5330. opList.addOp(_util.OPS.endAnnotation, []);
  5331. if (optionalContent !== undefined) {
  5332. opList.addOp(_util.OPS.endMarkedContent, []);
  5333. }
  5334. return {
  5335. opList,
  5336. separateForm: false,
  5337. separateCanvas: false
  5338. };
  5339. }
  5340. _getMKDict(rotation) {
  5341. const mk = new _primitives.Dict(null);
  5342. if (rotation) {
  5343. mk.set("R", rotation);
  5344. }
  5345. if (this.borderColor) {
  5346. mk.set("BC", getPdfColorArray(this.borderColor));
  5347. }
  5348. if (this.backgroundColor) {
  5349. mk.set("BG", getPdfColorArray(this.backgroundColor));
  5350. }
  5351. return mk.size > 0 ? mk : null;
  5352. }
  5353. async save(evaluator, task, annotationStorage) {
  5354. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5355. let value = storageEntry && storageEntry.value;
  5356. let rotation = storageEntry && storageEntry.rotation;
  5357. if (value === this.data.fieldValue || value === undefined) {
  5358. if (!this._hasValueFromXFA && rotation === undefined) {
  5359. return null;
  5360. }
  5361. value = value || this.data.fieldValue;
  5362. }
  5363. 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])) {
  5364. return null;
  5365. }
  5366. if (rotation === undefined) {
  5367. rotation = this.rotation;
  5368. }
  5369. let appearance = null;
  5370. if (!this._needAppearances) {
  5371. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  5372. if (appearance === null) {
  5373. return null;
  5374. }
  5375. } else {}
  5376. let needAppearances = false;
  5377. if (appearance && appearance.needAppearances) {
  5378. needAppearances = true;
  5379. appearance = null;
  5380. }
  5381. const {
  5382. xref
  5383. } = evaluator;
  5384. const originalDict = xref.fetchIfRef(this.ref);
  5385. if (!(originalDict instanceof _primitives.Dict)) {
  5386. return null;
  5387. }
  5388. const dict = new _primitives.Dict(xref);
  5389. for (const key of originalDict.getKeys()) {
  5390. if (key !== "AP") {
  5391. dict.set(key, originalDict.getRaw(key));
  5392. }
  5393. }
  5394. const xfa = {
  5395. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5396. value
  5397. };
  5398. const encoder = val => {
  5399. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  5400. };
  5401. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  5402. const maybeMK = this._getMKDict(rotation);
  5403. if (maybeMK) {
  5404. dict.set("MK", maybeMK);
  5405. }
  5406. const encrypt = xref.encrypt;
  5407. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  5408. const buffer = [];
  5409. const changes = [{
  5410. ref: this.ref,
  5411. data: "",
  5412. xfa,
  5413. needAppearances
  5414. }];
  5415. if (appearance !== null) {
  5416. const newRef = xref.getNewTemporaryRef();
  5417. const AP = new _primitives.Dict(xref);
  5418. dict.set("AP", AP);
  5419. AP.set("N", newRef);
  5420. let newTransform = null;
  5421. if (encrypt) {
  5422. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  5423. appearance = newTransform.encryptString(appearance);
  5424. }
  5425. const resources = this._getSaveFieldResources(xref);
  5426. const appearanceStream = new _stream.StringStream(appearance);
  5427. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  5428. appearanceDict.set("Length", appearance.length);
  5429. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  5430. appearanceDict.set("Resources", resources);
  5431. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  5432. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  5433. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  5434. appearanceDict.set("Matrix", rotationMatrix);
  5435. }
  5436. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  5437. changes.push({
  5438. ref: newRef,
  5439. data: buffer.join(""),
  5440. xfa: null,
  5441. needAppearances: false
  5442. });
  5443. buffer.length = 0;
  5444. }
  5445. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5446. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  5447. changes[0].data = buffer.join("");
  5448. return changes;
  5449. }
  5450. async _getAppearance(evaluator, task, intent, annotationStorage) {
  5451. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  5452. if (isPassword) {
  5453. return null;
  5454. }
  5455. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5456. let value, rotation;
  5457. if (storageEntry) {
  5458. value = storageEntry.formattedValue || storageEntry.value;
  5459. rotation = storageEntry.rotation;
  5460. }
  5461. if (rotation === undefined && value === undefined && !this._needAppearances) {
  5462. if (!this._hasValueFromXFA || this.appearance) {
  5463. return null;
  5464. }
  5465. }
  5466. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5467. if (value === undefined) {
  5468. value = this.data.fieldValue;
  5469. if (!value) {
  5470. return `/Tx BMC q ${colors}Q EMC`;
  5471. }
  5472. }
  5473. if (Array.isArray(value) && value.length === 1) {
  5474. value = value[0];
  5475. }
  5476. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  5477. value = value.trim();
  5478. if (value === "") {
  5479. return `/Tx BMC q ${colors}Q EMC`;
  5480. }
  5481. if (rotation === undefined) {
  5482. rotation = this.rotation;
  5483. }
  5484. let lineCount = -1;
  5485. let lines;
  5486. if (this.data.multiLine) {
  5487. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  5488. lineCount = lines.length;
  5489. } else {
  5490. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  5491. }
  5492. const defaultPadding = 1;
  5493. const defaultHPadding = 2;
  5494. let totalHeight = this.data.rect[3] - this.data.rect[1];
  5495. let totalWidth = this.data.rect[2] - this.data.rect[0];
  5496. if (rotation === 90 || rotation === 270) {
  5497. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  5498. }
  5499. if (!this._defaultAppearance) {
  5500. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  5501. }
  5502. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  5503. let defaultAppearance, fontSize, lineHeight;
  5504. const encodedLines = [];
  5505. let encodingError = false;
  5506. for (const line of lines) {
  5507. const encodedString = font.encodeString(line);
  5508. if (encodedString.length > 1) {
  5509. encodingError = true;
  5510. }
  5511. encodedLines.push(encodedString.join(""));
  5512. }
  5513. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  5514. return {
  5515. needAppearances: true
  5516. };
  5517. }
  5518. if (encodingError && this._isOffscreenCanvasSupported) {
  5519. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  5520. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  5521. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  5522. const newFont = resources.getRaw("Font");
  5523. if (this._fieldResources.mergedResources.has("Font")) {
  5524. const oldFont = this._fieldResources.mergedResources.get("Font");
  5525. for (const key of newFont.getKeys()) {
  5526. oldFont.set(key, newFont.getRaw(key));
  5527. }
  5528. } else {
  5529. this._fieldResources.mergedResources.set("Font", newFont);
  5530. }
  5531. const fontName = fakeUnicodeFont.fontName.name;
  5532. font = await WidgetAnnotation._getFontData(evaluator, task, {
  5533. fontName,
  5534. fontSize: 0
  5535. }, resources);
  5536. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  5537. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  5538. }
  5539. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  5540. this.data.defaultAppearanceData.fontSize = 0;
  5541. this.data.defaultAppearanceData.fontName = fontName;
  5542. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5543. this.data.defaultAppearanceData = savedDefaultAppearance;
  5544. } else {
  5545. if (!this._isOffscreenCanvasSupported) {
  5546. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  5547. }
  5548. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5549. }
  5550. let descent = font.descent;
  5551. if (isNaN(descent)) {
  5552. descent = _util.BASELINE_FACTOR * lineHeight;
  5553. } else {
  5554. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  5555. }
  5556. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  5557. const alignment = this.data.textAlignment;
  5558. if (this.data.multiLine) {
  5559. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5560. }
  5561. if (this.data.comb) {
  5562. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5563. }
  5564. const bottomPadding = defaultVPadding + descent;
  5565. if (alignment === 0 || alignment > 2) {
  5566. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC";
  5567. }
  5568. const prevInfo = {
  5569. shift: 0
  5570. };
  5571. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  5572. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  5573. }
  5574. static async _getFontData(evaluator, task, appearanceData, resources) {
  5575. const operatorList = new _operator_list.OperatorList();
  5576. const initialState = {
  5577. font: null,
  5578. clone() {
  5579. return this;
  5580. }
  5581. };
  5582. const {
  5583. fontName,
  5584. fontSize
  5585. } = appearanceData;
  5586. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  5587. return initialState.font;
  5588. }
  5589. _getTextWidth(text, font) {
  5590. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  5591. }
  5592. _computeFontSize(height, width, text, font, lineCount) {
  5593. let {
  5594. fontSize
  5595. } = this.data.defaultAppearanceData;
  5596. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  5597. numberOfLines = Math.round(height / lineHeight);
  5598. if (!fontSize) {
  5599. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  5600. if (lineCount === -1) {
  5601. const textWidth = this._getTextWidth(text, font);
  5602. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  5603. numberOfLines = 1;
  5604. } else {
  5605. const lines = text.split(/\r\n?|\n/);
  5606. const cachedLines = [];
  5607. for (const line of lines) {
  5608. const encoded = font.encodeString(line).join("");
  5609. const glyphs = font.charsToGlyphs(encoded);
  5610. const positions = font.getCharPositions(encoded);
  5611. cachedLines.push({
  5612. line: encoded,
  5613. glyphs,
  5614. positions
  5615. });
  5616. }
  5617. const isTooBig = fsize => {
  5618. let totalHeight = 0;
  5619. for (const cache of cachedLines) {
  5620. const chunks = this._splitLine(null, font, fsize, width, cache);
  5621. totalHeight += chunks.length * fsize;
  5622. if (totalHeight > height) {
  5623. return true;
  5624. }
  5625. }
  5626. return false;
  5627. };
  5628. numberOfLines = Math.max(numberOfLines, lineCount);
  5629. while (true) {
  5630. lineHeight = height / numberOfLines;
  5631. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  5632. if (isTooBig(fontSize)) {
  5633. numberOfLines++;
  5634. continue;
  5635. }
  5636. break;
  5637. }
  5638. }
  5639. const {
  5640. fontName,
  5641. fontColor
  5642. } = this.data.defaultAppearanceData;
  5643. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  5644. fontSize,
  5645. fontName,
  5646. fontColor
  5647. });
  5648. }
  5649. return [this._defaultAppearance, fontSize, height / numberOfLines];
  5650. }
  5651. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  5652. let shift;
  5653. if (alignment === 1) {
  5654. const width = this._getTextWidth(text, font) * fontSize;
  5655. shift = (totalWidth - width) / 2;
  5656. } else if (alignment === 2) {
  5657. const width = this._getTextWidth(text, font) * fontSize;
  5658. shift = totalWidth - width - hPadding;
  5659. } else {
  5660. shift = hPadding;
  5661. }
  5662. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  5663. prevInfo.shift = shift;
  5664. vPadding = (0, _core_utils.numberToString)(vPadding);
  5665. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  5666. }
  5667. _getSaveFieldResources(xref) {
  5668. const {
  5669. localResources,
  5670. appearanceResources,
  5671. acroFormResources
  5672. } = this._fieldResources;
  5673. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  5674. if (!fontName) {
  5675. return localResources || _primitives.Dict.empty;
  5676. }
  5677. for (const resources of [localResources, appearanceResources]) {
  5678. if (resources instanceof _primitives.Dict) {
  5679. const localFont = resources.get("Font");
  5680. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  5681. return resources;
  5682. }
  5683. }
  5684. }
  5685. if (acroFormResources instanceof _primitives.Dict) {
  5686. const acroFormFont = acroFormResources.get("Font");
  5687. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  5688. const subFontDict = new _primitives.Dict(xref);
  5689. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  5690. const subResourcesDict = new _primitives.Dict(xref);
  5691. subResourcesDict.set("Font", subFontDict);
  5692. return _primitives.Dict.merge({
  5693. xref,
  5694. dictArray: [subResourcesDict, localResources],
  5695. mergeSubDicts: true
  5696. });
  5697. }
  5698. }
  5699. return localResources || _primitives.Dict.empty;
  5700. }
  5701. getFieldObject() {
  5702. return null;
  5703. }
  5704. }
  5705. class TextWidgetAnnotation extends WidgetAnnotation {
  5706. constructor(params) {
  5707. super(params);
  5708. this._hasText = true;
  5709. const dict = params.dict;
  5710. if (typeof this.data.fieldValue !== "string") {
  5711. this.data.fieldValue = "";
  5712. }
  5713. let alignment = (0, _core_utils.getInheritableProperty)({
  5714. dict,
  5715. key: "Q"
  5716. });
  5717. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  5718. alignment = null;
  5719. }
  5720. this.data.textAlignment = alignment;
  5721. let maximumLength = (0, _core_utils.getInheritableProperty)({
  5722. dict,
  5723. key: "MaxLen"
  5724. });
  5725. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  5726. maximumLength = 0;
  5727. }
  5728. this.data.maxLen = maximumLength;
  5729. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  5730. 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;
  5731. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  5732. }
  5733. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5734. const combWidth = width / this.data.maxLen;
  5735. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5736. const buf = [];
  5737. const positions = font.getCharPositions(text);
  5738. for (const [start, end] of positions) {
  5739. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  5740. }
  5741. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  5742. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  5743. }
  5744. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5745. const buf = [];
  5746. const totalWidth = width - 2 * hPadding;
  5747. const prevInfo = {
  5748. shift: 0
  5749. };
  5750. for (let i = 0, ii = lines.length; i < ii; i++) {
  5751. const line = lines[i];
  5752. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  5753. for (let j = 0, jj = chunks.length; j < jj; j++) {
  5754. const chunk = chunks[j];
  5755. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  5756. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  5757. }
  5758. }
  5759. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5760. const renderedText = buf.join("\n");
  5761. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  5762. }
  5763. _splitLine(line, font, fontSize, width, cache = {}) {
  5764. line = cache.line || line;
  5765. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  5766. if (glyphs.length <= 1) {
  5767. return [line];
  5768. }
  5769. const positions = cache.positions || font.getCharPositions(line);
  5770. const scale = fontSize / 1000;
  5771. const chunks = [];
  5772. let lastSpacePosInStringStart = -1,
  5773. lastSpacePosInStringEnd = -1,
  5774. lastSpacePos = -1,
  5775. startChunk = 0,
  5776. currentWidth = 0;
  5777. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  5778. const [start, end] = positions[i];
  5779. const glyph = glyphs[i];
  5780. const glyphWidth = glyph.width * scale;
  5781. if (glyph.unicode === " ") {
  5782. if (currentWidth + glyphWidth > width) {
  5783. chunks.push(line.substring(startChunk, start));
  5784. startChunk = start;
  5785. currentWidth = glyphWidth;
  5786. lastSpacePosInStringStart = -1;
  5787. lastSpacePos = -1;
  5788. } else {
  5789. currentWidth += glyphWidth;
  5790. lastSpacePosInStringStart = start;
  5791. lastSpacePosInStringEnd = end;
  5792. lastSpacePos = i;
  5793. }
  5794. } else {
  5795. if (currentWidth + glyphWidth > width) {
  5796. if (lastSpacePosInStringStart !== -1) {
  5797. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  5798. startChunk = lastSpacePosInStringEnd;
  5799. i = lastSpacePos + 1;
  5800. lastSpacePosInStringStart = -1;
  5801. currentWidth = 0;
  5802. } else {
  5803. chunks.push(line.substring(startChunk, start));
  5804. startChunk = start;
  5805. currentWidth = glyphWidth;
  5806. }
  5807. } else {
  5808. currentWidth += glyphWidth;
  5809. }
  5810. }
  5811. }
  5812. if (startChunk < line.length) {
  5813. chunks.push(line.substring(startChunk, line.length));
  5814. }
  5815. return chunks;
  5816. }
  5817. getFieldObject() {
  5818. return {
  5819. id: this.data.id,
  5820. value: this.data.fieldValue,
  5821. defaultValue: this.data.defaultFieldValue || "",
  5822. multiline: this.data.multiLine,
  5823. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  5824. charLimit: this.data.maxLen,
  5825. comb: this.data.comb,
  5826. editable: !this.data.readOnly,
  5827. hidden: this.data.hidden,
  5828. name: this.data.fieldName,
  5829. rect: this.data.rect,
  5830. actions: this.data.actions,
  5831. page: this.data.pageIndex,
  5832. strokeColor: this.data.borderColor,
  5833. fillColor: this.data.backgroundColor,
  5834. rotation: this.rotation,
  5835. type: "text"
  5836. };
  5837. }
  5838. }
  5839. class ButtonWidgetAnnotation extends WidgetAnnotation {
  5840. constructor(params) {
  5841. super(params);
  5842. this.checkedAppearance = null;
  5843. this.uncheckedAppearance = null;
  5844. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5845. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5846. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5847. this.data.isTooltipOnly = false;
  5848. if (this.data.checkBox) {
  5849. this._processCheckBox(params);
  5850. } else if (this.data.radioButton) {
  5851. this._processRadioButton(params);
  5852. } else if (this.data.pushButton) {
  5853. this.data.hasOwnCanvas = true;
  5854. this._processPushButton(params);
  5855. } else {
  5856. (0, _util.warn)("Invalid field flags for button widget annotation");
  5857. }
  5858. }
  5859. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5860. if (this.data.pushButton) {
  5861. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  5862. }
  5863. let value = null;
  5864. let rotation = null;
  5865. if (annotationStorage) {
  5866. const storageEntry = annotationStorage.get(this.data.id);
  5867. value = storageEntry ? storageEntry.value : null;
  5868. rotation = storageEntry ? storageEntry.rotation : null;
  5869. }
  5870. if (value === null && this.appearance) {
  5871. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5872. }
  5873. if (value === null || value === undefined) {
  5874. if (this.data.checkBox) {
  5875. value = this.data.fieldValue === this.data.exportValue;
  5876. } else {
  5877. value = this.data.fieldValue === this.data.buttonValue;
  5878. }
  5879. }
  5880. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  5881. if (appearance) {
  5882. const savedAppearance = this.appearance;
  5883. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  5884. if (rotation) {
  5885. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  5886. }
  5887. this.appearance = appearance;
  5888. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5889. this.appearance = savedAppearance;
  5890. appearance.dict.set("Matrix", savedMatrix);
  5891. return operatorList;
  5892. }
  5893. return {
  5894. opList: new _operator_list.OperatorList(),
  5895. separateForm: false,
  5896. separateCanvas: false
  5897. };
  5898. }
  5899. async save(evaluator, task, annotationStorage) {
  5900. if (this.data.checkBox) {
  5901. return this._saveCheckbox(evaluator, task, annotationStorage);
  5902. }
  5903. if (this.data.radioButton) {
  5904. return this._saveRadioButton(evaluator, task, annotationStorage);
  5905. }
  5906. return null;
  5907. }
  5908. async _saveCheckbox(evaluator, task, annotationStorage) {
  5909. if (!annotationStorage) {
  5910. return null;
  5911. }
  5912. const storageEntry = annotationStorage.get(this.data.id);
  5913. let rotation = storageEntry && storageEntry.rotation;
  5914. let value = storageEntry && storageEntry.value;
  5915. if (rotation === undefined) {
  5916. if (value === undefined) {
  5917. return null;
  5918. }
  5919. const defaultValue = this.data.fieldValue === this.data.exportValue;
  5920. if (defaultValue === value) {
  5921. return null;
  5922. }
  5923. }
  5924. const dict = evaluator.xref.fetchIfRef(this.ref);
  5925. if (!(dict instanceof _primitives.Dict)) {
  5926. return null;
  5927. }
  5928. if (rotation === undefined) {
  5929. rotation = this.rotation;
  5930. }
  5931. if (value === undefined) {
  5932. value = this.data.fieldValue === this.data.exportValue;
  5933. }
  5934. const xfa = {
  5935. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5936. value: value ? this.data.exportValue : ""
  5937. };
  5938. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  5939. dict.set("V", name);
  5940. dict.set("AS", name);
  5941. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5942. const maybeMK = this._getMKDict(rotation);
  5943. if (maybeMK) {
  5944. dict.set("MK", maybeMK);
  5945. }
  5946. const encrypt = evaluator.xref.encrypt;
  5947. let originalTransform = null;
  5948. if (encrypt) {
  5949. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5950. }
  5951. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5952. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5953. buffer.push("\nendobj\n");
  5954. return [{
  5955. ref: this.ref,
  5956. data: buffer.join(""),
  5957. xfa
  5958. }];
  5959. }
  5960. async _saveRadioButton(evaluator, task, annotationStorage) {
  5961. if (!annotationStorage) {
  5962. return null;
  5963. }
  5964. const storageEntry = annotationStorage.get(this.data.id);
  5965. let rotation = storageEntry && storageEntry.rotation;
  5966. let value = storageEntry && storageEntry.value;
  5967. if (rotation === undefined) {
  5968. if (value === undefined) {
  5969. return null;
  5970. }
  5971. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  5972. if (defaultValue === value) {
  5973. return null;
  5974. }
  5975. }
  5976. const dict = evaluator.xref.fetchIfRef(this.ref);
  5977. if (!(dict instanceof _primitives.Dict)) {
  5978. return null;
  5979. }
  5980. if (value === undefined) {
  5981. value = this.data.fieldValue === this.data.buttonValue;
  5982. }
  5983. if (rotation === undefined) {
  5984. rotation = this.rotation;
  5985. }
  5986. const xfa = {
  5987. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5988. value: value ? this.data.buttonValue : ""
  5989. };
  5990. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  5991. let parentBuffer = null;
  5992. const encrypt = evaluator.xref.encrypt;
  5993. if (value) {
  5994. if (this.parent instanceof _primitives.Ref) {
  5995. const parent = evaluator.xref.fetch(this.parent);
  5996. let parentTransform = null;
  5997. if (encrypt) {
  5998. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  5999. }
  6000. parent.set("V", name);
  6001. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  6002. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  6003. parentBuffer.push("\nendobj\n");
  6004. } else if (this.parent instanceof _primitives.Dict) {
  6005. this.parent.set("V", name);
  6006. }
  6007. }
  6008. dict.set("AS", name);
  6009. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  6010. const maybeMK = this._getMKDict(rotation);
  6011. if (maybeMK) {
  6012. dict.set("MK", maybeMK);
  6013. }
  6014. let originalTransform = null;
  6015. if (encrypt) {
  6016. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6017. }
  6018. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  6019. (0, _writer.writeDict)(dict, buffer, originalTransform);
  6020. buffer.push("\nendobj\n");
  6021. const newRefs = [{
  6022. ref: this.ref,
  6023. data: buffer.join(""),
  6024. xfa
  6025. }];
  6026. if (parentBuffer !== null) {
  6027. newRefs.push({
  6028. ref: this.parent,
  6029. data: parentBuffer.join(""),
  6030. xfa: null
  6031. });
  6032. }
  6033. return newRefs;
  6034. }
  6035. _getDefaultCheckedAppearance(params, type) {
  6036. const width = this.data.rect[2] - this.data.rect[0];
  6037. const height = this.data.rect[3] - this.data.rect[1];
  6038. const bbox = [0, 0, width, height];
  6039. const FONT_RATIO = 0.8;
  6040. const fontSize = Math.min(width, height) * FONT_RATIO;
  6041. let metrics, char;
  6042. if (type === "check") {
  6043. metrics = {
  6044. width: 0.755 * fontSize,
  6045. height: 0.705 * fontSize
  6046. };
  6047. char = "\x33";
  6048. } else if (type === "disc") {
  6049. metrics = {
  6050. width: 0.791 * fontSize,
  6051. height: 0.705 * fontSize
  6052. };
  6053. char = "\x6C";
  6054. } else {
  6055. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  6056. }
  6057. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  6058. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  6059. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  6060. const appearanceStreamDict = new _primitives.Dict(params.xref);
  6061. appearanceStreamDict.set("FormType", 1);
  6062. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6063. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6064. appearanceStreamDict.set("BBox", bbox);
  6065. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  6066. appearanceStreamDict.set("Length", appearance.length);
  6067. const resources = new _primitives.Dict(params.xref);
  6068. const font = new _primitives.Dict(params.xref);
  6069. font.set("PdfJsZaDb", this.fallbackFontDict);
  6070. resources.set("Font", font);
  6071. appearanceStreamDict.set("Resources", resources);
  6072. this.checkedAppearance = new _stream.StringStream(appearance);
  6073. this.checkedAppearance.dict = appearanceStreamDict;
  6074. this._streams.push(this.checkedAppearance);
  6075. }
  6076. _processCheckBox(params) {
  6077. const customAppearance = params.dict.get("AP");
  6078. if (!(customAppearance instanceof _primitives.Dict)) {
  6079. return;
  6080. }
  6081. const normalAppearance = customAppearance.get("N");
  6082. if (!(normalAppearance instanceof _primitives.Dict)) {
  6083. return;
  6084. }
  6085. const asValue = this._decodeFormValue(params.dict.get("AS"));
  6086. if (typeof asValue === "string") {
  6087. this.data.fieldValue = asValue;
  6088. }
  6089. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  6090. const exportValues = normalAppearance.getKeys();
  6091. if (exportValues.length === 0) {
  6092. exportValues.push("Off", yes);
  6093. } else if (exportValues.length === 1) {
  6094. if (exportValues[0] === "Off") {
  6095. exportValues.push(yes);
  6096. } else {
  6097. exportValues.unshift("Off");
  6098. }
  6099. } else if (exportValues.includes(yes)) {
  6100. exportValues.length = 0;
  6101. exportValues.push("Off", yes);
  6102. } else {
  6103. const otherYes = exportValues.find(v => v !== "Off");
  6104. exportValues.length = 0;
  6105. exportValues.push("Off", otherYes);
  6106. }
  6107. if (!exportValues.includes(this.data.fieldValue)) {
  6108. this.data.fieldValue = "Off";
  6109. }
  6110. this.data.exportValue = exportValues[1];
  6111. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  6112. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6113. if (this.checkedAppearance) {
  6114. this._streams.push(this.checkedAppearance);
  6115. } else {
  6116. this._getDefaultCheckedAppearance(params, "check");
  6117. }
  6118. if (this.uncheckedAppearance) {
  6119. this._streams.push(this.uncheckedAppearance);
  6120. }
  6121. this._fallbackFontDict = this.fallbackFontDict;
  6122. }
  6123. _processRadioButton(params) {
  6124. this.data.fieldValue = this.data.buttonValue = null;
  6125. const fieldParent = params.dict.get("Parent");
  6126. if (fieldParent instanceof _primitives.Dict) {
  6127. this.parent = params.dict.getRaw("Parent");
  6128. const fieldParentValue = fieldParent.get("V");
  6129. if (fieldParentValue instanceof _primitives.Name) {
  6130. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  6131. }
  6132. }
  6133. const appearanceStates = params.dict.get("AP");
  6134. if (!(appearanceStates instanceof _primitives.Dict)) {
  6135. return;
  6136. }
  6137. const normalAppearance = appearanceStates.get("N");
  6138. if (!(normalAppearance instanceof _primitives.Dict)) {
  6139. return;
  6140. }
  6141. for (const key of normalAppearance.getKeys()) {
  6142. if (key !== "Off") {
  6143. this.data.buttonValue = this._decodeFormValue(key);
  6144. break;
  6145. }
  6146. }
  6147. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  6148. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6149. if (this.checkedAppearance) {
  6150. this._streams.push(this.checkedAppearance);
  6151. } else {
  6152. this._getDefaultCheckedAppearance(params, "disc");
  6153. }
  6154. if (this.uncheckedAppearance) {
  6155. this._streams.push(this.uncheckedAppearance);
  6156. }
  6157. this._fallbackFontDict = this.fallbackFontDict;
  6158. }
  6159. _processPushButton(params) {
  6160. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  6161. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  6162. return;
  6163. }
  6164. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  6165. _catalog.Catalog.parseDestDictionary({
  6166. destDict: params.dict,
  6167. resultObj: this.data,
  6168. docBaseUrl: params.pdfManager.docBaseUrl,
  6169. docAttachments: params.attachments
  6170. });
  6171. }
  6172. getFieldObject() {
  6173. let type = "button";
  6174. let exportValues;
  6175. if (this.data.checkBox) {
  6176. type = "checkbox";
  6177. exportValues = this.data.exportValue;
  6178. } else if (this.data.radioButton) {
  6179. type = "radiobutton";
  6180. exportValues = this.data.buttonValue;
  6181. }
  6182. return {
  6183. id: this.data.id,
  6184. value: this.data.fieldValue || "Off",
  6185. defaultValue: this.data.defaultFieldValue,
  6186. exportValues,
  6187. editable: !this.data.readOnly,
  6188. name: this.data.fieldName,
  6189. rect: this.data.rect,
  6190. hidden: this.data.hidden,
  6191. actions: this.data.actions,
  6192. page: this.data.pageIndex,
  6193. strokeColor: this.data.borderColor,
  6194. fillColor: this.data.backgroundColor,
  6195. rotation: this.rotation,
  6196. type
  6197. };
  6198. }
  6199. get fallbackFontDict() {
  6200. const dict = new _primitives.Dict();
  6201. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  6202. dict.set("Type", _primitives.Name.get("FallbackType"));
  6203. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  6204. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  6205. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  6206. }
  6207. }
  6208. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  6209. constructor(params) {
  6210. super(params);
  6211. const {
  6212. dict,
  6213. xref
  6214. } = params;
  6215. this.data.options = [];
  6216. const options = (0, _core_utils.getInheritableProperty)({
  6217. dict,
  6218. key: "Opt"
  6219. });
  6220. if (Array.isArray(options)) {
  6221. for (let i = 0, ii = options.length; i < ii; i++) {
  6222. const option = xref.fetchIfRef(options[i]);
  6223. const isOptionArray = Array.isArray(option);
  6224. this.data.options[i] = {
  6225. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  6226. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  6227. };
  6228. }
  6229. }
  6230. if (typeof this.data.fieldValue === "string") {
  6231. this.data.fieldValue = [this.data.fieldValue];
  6232. } else if (!this.data.fieldValue) {
  6233. this.data.fieldValue = [];
  6234. }
  6235. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  6236. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  6237. this._hasText = true;
  6238. }
  6239. getFieldObject() {
  6240. const type = this.data.combo ? "combobox" : "listbox";
  6241. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  6242. return {
  6243. id: this.data.id,
  6244. value,
  6245. defaultValue: this.data.defaultFieldValue,
  6246. editable: !this.data.readOnly,
  6247. name: this.data.fieldName,
  6248. rect: this.data.rect,
  6249. numItems: this.data.fieldValue.length,
  6250. multipleSelection: this.data.multiSelect,
  6251. hidden: this.data.hidden,
  6252. actions: this.data.actions,
  6253. items: this.data.options,
  6254. page: this.data.pageIndex,
  6255. strokeColor: this.data.borderColor,
  6256. fillColor: this.data.backgroundColor,
  6257. rotation: this.rotation,
  6258. type
  6259. };
  6260. }
  6261. async _getAppearance(evaluator, task, intent, annotationStorage) {
  6262. if (this.data.combo) {
  6263. return super._getAppearance(evaluator, task, intent, annotationStorage);
  6264. }
  6265. let exportedValue, rotation;
  6266. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  6267. if (storageEntry) {
  6268. rotation = storageEntry.rotation;
  6269. exportedValue = storageEntry.value;
  6270. }
  6271. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  6272. return null;
  6273. }
  6274. if (exportedValue === undefined) {
  6275. exportedValue = this.data.fieldValue;
  6276. } else if (!Array.isArray(exportedValue)) {
  6277. exportedValue = [exportedValue];
  6278. }
  6279. const defaultPadding = 1;
  6280. const defaultHPadding = 2;
  6281. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6282. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6283. if (rotation === 90 || rotation === 270) {
  6284. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6285. }
  6286. const lineCount = this.data.options.length;
  6287. const valueIndices = [];
  6288. for (let i = 0; i < lineCount; i++) {
  6289. const {
  6290. exportValue
  6291. } = this.data.options[i];
  6292. if (exportedValue.includes(exportValue)) {
  6293. valueIndices.push(i);
  6294. }
  6295. }
  6296. if (!this._defaultAppearance) {
  6297. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  6298. }
  6299. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  6300. let defaultAppearance;
  6301. let {
  6302. fontSize
  6303. } = this.data.defaultAppearanceData;
  6304. if (!fontSize) {
  6305. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  6306. let lineWidth = -1;
  6307. let value;
  6308. for (const {
  6309. displayValue
  6310. } of this.data.options) {
  6311. const width = this._getTextWidth(displayValue, font);
  6312. if (width > lineWidth) {
  6313. lineWidth = width;
  6314. value = displayValue;
  6315. }
  6316. }
  6317. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  6318. } else {
  6319. defaultAppearance = this._defaultAppearance;
  6320. }
  6321. const lineHeight = fontSize * _util.LINE_FACTOR;
  6322. const vPadding = (lineHeight - fontSize) / 2;
  6323. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  6324. let firstIndex;
  6325. if (valueIndices.length === 1) {
  6326. const valuePosition = valueIndices[0];
  6327. const indexInPage = valuePosition % numberOfVisibleLines;
  6328. firstIndex = valuePosition - indexInPage;
  6329. } else {
  6330. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  6331. }
  6332. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  6333. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  6334. if (valueIndices.length) {
  6335. buf.push("0.600006 0.756866 0.854904 rg");
  6336. for (const index of valueIndices) {
  6337. if (firstIndex <= index && index < end) {
  6338. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  6339. }
  6340. }
  6341. }
  6342. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  6343. const prevInfo = {
  6344. shift: 0
  6345. };
  6346. for (let i = firstIndex; i < end; i++) {
  6347. const {
  6348. displayValue
  6349. } = this.data.options[i];
  6350. const vpadding = i === firstIndex ? vPadding : 0;
  6351. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  6352. }
  6353. buf.push("ET Q EMC");
  6354. return buf.join("\n");
  6355. }
  6356. }
  6357. class SignatureWidgetAnnotation extends WidgetAnnotation {
  6358. constructor(params) {
  6359. super(params);
  6360. this.data.fieldValue = null;
  6361. }
  6362. getFieldObject() {
  6363. return {
  6364. id: this.data.id,
  6365. value: null,
  6366. page: this.data.pageIndex,
  6367. type: "signature"
  6368. };
  6369. }
  6370. }
  6371. class TextAnnotation extends MarkupAnnotation {
  6372. constructor(params) {
  6373. const DEFAULT_ICON_SIZE = 22;
  6374. super(params);
  6375. const {
  6376. dict
  6377. } = params;
  6378. this.data.annotationType = _util.AnnotationType.TEXT;
  6379. if (this.data.hasAppearance) {
  6380. this.data.name = "NoIcon";
  6381. } else {
  6382. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  6383. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  6384. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  6385. }
  6386. if (dict.has("State")) {
  6387. this.data.state = dict.get("State") || null;
  6388. this.data.stateModel = dict.get("StateModel") || null;
  6389. } else {
  6390. this.data.state = null;
  6391. this.data.stateModel = null;
  6392. }
  6393. }
  6394. }
  6395. class LinkAnnotation extends Annotation {
  6396. constructor(params) {
  6397. super(params);
  6398. this.data.annotationType = _util.AnnotationType.LINK;
  6399. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  6400. if (quadPoints) {
  6401. this.data.quadPoints = quadPoints;
  6402. }
  6403. this.data.borderColor = this.data.borderColor || this.data.color;
  6404. _catalog.Catalog.parseDestDictionary({
  6405. destDict: params.dict,
  6406. resultObj: this.data,
  6407. docBaseUrl: params.pdfManager.docBaseUrl,
  6408. docAttachments: params.attachments
  6409. });
  6410. }
  6411. }
  6412. class PopupAnnotation extends Annotation {
  6413. constructor(params) {
  6414. super(params);
  6415. const {
  6416. dict
  6417. } = params;
  6418. this.data.annotationType = _util.AnnotationType.POPUP;
  6419. let parentItem = dict.get("Parent");
  6420. if (!parentItem) {
  6421. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  6422. return;
  6423. }
  6424. const parentSubtype = parentItem.get("Subtype");
  6425. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  6426. const rawParent = dict.getRaw("Parent");
  6427. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  6428. const parentRect = parentItem.getArray("Rect");
  6429. if (Array.isArray(parentRect) && parentRect.length === 4) {
  6430. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  6431. } else {
  6432. this.data.parentRect = [0, 0, 0, 0];
  6433. }
  6434. const rt = parentItem.get("RT");
  6435. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  6436. parentItem = parentItem.get("IRT");
  6437. }
  6438. if (!parentItem.has("M")) {
  6439. this.data.modificationDate = null;
  6440. } else {
  6441. this.setModificationDate(parentItem.get("M"));
  6442. this.data.modificationDate = this.modificationDate;
  6443. }
  6444. if (!parentItem.has("C")) {
  6445. this.data.color = null;
  6446. } else {
  6447. this.setColor(parentItem.getArray("C"));
  6448. this.data.color = this.color;
  6449. }
  6450. if (!this.viewable) {
  6451. const parentFlags = parentItem.get("F");
  6452. if (this._isViewable(parentFlags)) {
  6453. this.setFlags(parentFlags);
  6454. }
  6455. }
  6456. this.setTitle(parentItem.get("T"));
  6457. this.data.titleObj = this._title;
  6458. this.setContents(parentItem.get("Contents"));
  6459. this.data.contentsObj = this._contents;
  6460. if (parentItem.has("RC")) {
  6461. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  6462. }
  6463. }
  6464. }
  6465. exports.PopupAnnotation = PopupAnnotation;
  6466. class FreeTextAnnotation extends MarkupAnnotation {
  6467. constructor(params) {
  6468. super(params);
  6469. const {
  6470. xref
  6471. } = params;
  6472. this.data.annotationType = _util.AnnotationType.FREETEXT;
  6473. this.setDefaultAppearance(params);
  6474. if (!this.appearance && this._isOffscreenCanvasSupported) {
  6475. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  6476. const fontData = this.data.defaultAppearanceData;
  6477. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor);
  6478. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  6479. } else if (!this._isOffscreenCanvasSupported) {
  6480. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  6481. }
  6482. }
  6483. get hasTextContent() {
  6484. return !!this.appearance;
  6485. }
  6486. static createNewDict(annotation, xref, {
  6487. apRef,
  6488. ap
  6489. }) {
  6490. const {
  6491. color,
  6492. fontSize,
  6493. rect,
  6494. rotation,
  6495. user,
  6496. value
  6497. } = annotation;
  6498. const freetext = new _primitives.Dict(xref);
  6499. freetext.set("Type", _primitives.Name.get("Annot"));
  6500. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  6501. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6502. freetext.set("Rect", rect);
  6503. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  6504. freetext.set("DA", da);
  6505. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  6506. freetext.set("F", 4);
  6507. freetext.set("Border", [0, 0, 0]);
  6508. freetext.set("Rotate", rotation);
  6509. if (user) {
  6510. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  6511. }
  6512. if (apRef || ap) {
  6513. const n = new _primitives.Dict(xref);
  6514. freetext.set("AP", n);
  6515. if (apRef) {
  6516. n.set("N", apRef);
  6517. } else {
  6518. n.set("N", ap);
  6519. }
  6520. }
  6521. return freetext;
  6522. }
  6523. static async createNewAppearanceStream(annotation, xref, params) {
  6524. const {
  6525. baseFontRef,
  6526. evaluator,
  6527. task
  6528. } = params;
  6529. const {
  6530. color,
  6531. fontSize,
  6532. rect,
  6533. rotation,
  6534. value
  6535. } = annotation;
  6536. const resources = new _primitives.Dict(xref);
  6537. const font = new _primitives.Dict(xref);
  6538. if (baseFontRef) {
  6539. font.set("Helv", baseFontRef);
  6540. } else {
  6541. const baseFont = new _primitives.Dict(xref);
  6542. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  6543. baseFont.set("Type", _primitives.Name.get("Font"));
  6544. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  6545. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  6546. font.set("Helv", baseFont);
  6547. }
  6548. resources.set("Font", font);
  6549. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  6550. fontName: "Helvetica",
  6551. fontSize
  6552. }, resources);
  6553. const [x1, y1, x2, y2] = rect;
  6554. let w = x2 - x1;
  6555. let h = y2 - y1;
  6556. if (rotation % 180 !== 0) {
  6557. [w, h] = [h, w];
  6558. }
  6559. const lines = value.split("\n");
  6560. const scale = fontSize / 1000;
  6561. let totalWidth = -Infinity;
  6562. const encodedLines = [];
  6563. for (let line of lines) {
  6564. const encoded = helv.encodeString(line);
  6565. if (encoded.length > 1) {
  6566. return null;
  6567. }
  6568. line = encoded.join("");
  6569. encodedLines.push(line);
  6570. let lineWidth = 0;
  6571. const glyphs = helv.charsToGlyphs(line);
  6572. for (const glyph of glyphs) {
  6573. lineWidth += glyph.width * scale;
  6574. }
  6575. totalWidth = Math.max(totalWidth, lineWidth);
  6576. }
  6577. let hscale = 1;
  6578. if (totalWidth > w) {
  6579. hscale = w / totalWidth;
  6580. }
  6581. let vscale = 1;
  6582. const lineHeight = _util.LINE_FACTOR * fontSize;
  6583. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  6584. const totalHeight = lineHeight * lines.length;
  6585. if (totalHeight > h) {
  6586. vscale = h / totalHeight;
  6587. }
  6588. const fscale = Math.min(hscale, vscale);
  6589. const newFontSize = fontSize * fscale;
  6590. 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`];
  6591. const vShift = (0, _core_utils.numberToString)(lineHeight);
  6592. for (const line of encodedLines) {
  6593. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  6594. }
  6595. buffer.push("ET", "Q");
  6596. const appearance = buffer.join("\n");
  6597. const appearanceStreamDict = new _primitives.Dict(xref);
  6598. appearanceStreamDict.set("FormType", 1);
  6599. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6600. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6601. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6602. appearanceStreamDict.set("Length", appearance.length);
  6603. appearanceStreamDict.set("Resources", resources);
  6604. if (rotation) {
  6605. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6606. appearanceStreamDict.set("Matrix", matrix);
  6607. }
  6608. const ap = new _stream.StringStream(appearance);
  6609. ap.dict = appearanceStreamDict;
  6610. return ap;
  6611. }
  6612. }
  6613. class LineAnnotation extends MarkupAnnotation {
  6614. constructor(params) {
  6615. super(params);
  6616. const {
  6617. dict,
  6618. xref
  6619. } = params;
  6620. this.data.annotationType = _util.AnnotationType.LINE;
  6621. const lineCoordinates = dict.getArray("L");
  6622. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  6623. this.setLineEndings(dict.getArray("LE"));
  6624. this.data.lineEndings = this.lineEndings;
  6625. if (!this.appearance) {
  6626. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6627. const strokeAlpha = dict.get("CA");
  6628. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6629. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6630. const fillAlpha = fillColor ? strokeAlpha : null;
  6631. const borderWidth = this.borderStyle.width || 1,
  6632. borderAdjust = 2 * borderWidth;
  6633. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  6634. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6635. this.rectangle = bbox;
  6636. }
  6637. this._setDefaultAppearance({
  6638. xref,
  6639. extra: `${borderWidth} w`,
  6640. strokeColor,
  6641. fillColor,
  6642. strokeAlpha,
  6643. fillAlpha,
  6644. pointsCallback: (buffer, points) => {
  6645. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  6646. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  6647. }
  6648. });
  6649. }
  6650. }
  6651. }
  6652. class SquareAnnotation extends MarkupAnnotation {
  6653. constructor(params) {
  6654. super(params);
  6655. const {
  6656. dict,
  6657. xref
  6658. } = params;
  6659. this.data.annotationType = _util.AnnotationType.SQUARE;
  6660. if (!this.appearance) {
  6661. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6662. const strokeAlpha = dict.get("CA");
  6663. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6664. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6665. const fillAlpha = fillColor ? strokeAlpha : null;
  6666. if (this.borderStyle.width === 0 && !fillColor) {
  6667. return;
  6668. }
  6669. this._setDefaultAppearance({
  6670. xref,
  6671. extra: `${this.borderStyle.width} w`,
  6672. strokeColor,
  6673. fillColor,
  6674. strokeAlpha,
  6675. fillAlpha,
  6676. pointsCallback: (buffer, points) => {
  6677. const x = points[2].x + this.borderStyle.width / 2;
  6678. const y = points[2].y + this.borderStyle.width / 2;
  6679. const width = points[3].x - points[2].x - this.borderStyle.width;
  6680. const height = points[1].y - points[3].y - this.borderStyle.width;
  6681. buffer.push(`${x} ${y} ${width} ${height} re`);
  6682. if (fillColor) {
  6683. buffer.push("B");
  6684. } else {
  6685. buffer.push("S");
  6686. }
  6687. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6688. }
  6689. });
  6690. }
  6691. }
  6692. }
  6693. class CircleAnnotation extends MarkupAnnotation {
  6694. constructor(params) {
  6695. super(params);
  6696. const {
  6697. dict,
  6698. xref
  6699. } = params;
  6700. this.data.annotationType = _util.AnnotationType.CIRCLE;
  6701. if (!this.appearance) {
  6702. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6703. const strokeAlpha = dict.get("CA");
  6704. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6705. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6706. const fillAlpha = fillColor ? strokeAlpha : null;
  6707. if (this.borderStyle.width === 0 && !fillColor) {
  6708. return;
  6709. }
  6710. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  6711. this._setDefaultAppearance({
  6712. xref,
  6713. extra: `${this.borderStyle.width} w`,
  6714. strokeColor,
  6715. fillColor,
  6716. strokeAlpha,
  6717. fillAlpha,
  6718. pointsCallback: (buffer, points) => {
  6719. const x0 = points[0].x + this.borderStyle.width / 2;
  6720. const y0 = points[0].y - this.borderStyle.width / 2;
  6721. const x1 = points[3].x - this.borderStyle.width / 2;
  6722. const y1 = points[3].y + this.borderStyle.width / 2;
  6723. const xMid = x0 + (x1 - x0) / 2;
  6724. const yMid = y0 + (y1 - y0) / 2;
  6725. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  6726. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  6727. 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");
  6728. if (fillColor) {
  6729. buffer.push("B");
  6730. } else {
  6731. buffer.push("S");
  6732. }
  6733. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6734. }
  6735. });
  6736. }
  6737. }
  6738. }
  6739. class PolylineAnnotation extends MarkupAnnotation {
  6740. constructor(params) {
  6741. super(params);
  6742. const {
  6743. dict,
  6744. xref
  6745. } = params;
  6746. this.data.annotationType = _util.AnnotationType.POLYLINE;
  6747. this.data.vertices = [];
  6748. if (!(this instanceof PolygonAnnotation)) {
  6749. this.setLineEndings(dict.getArray("LE"));
  6750. this.data.lineEndings = this.lineEndings;
  6751. }
  6752. const rawVertices = dict.getArray("Vertices");
  6753. if (!Array.isArray(rawVertices)) {
  6754. return;
  6755. }
  6756. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  6757. this.data.vertices.push({
  6758. x: rawVertices[i],
  6759. y: rawVertices[i + 1]
  6760. });
  6761. }
  6762. if (!this.appearance) {
  6763. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6764. const strokeAlpha = dict.get("CA");
  6765. const borderWidth = this.borderStyle.width || 1,
  6766. borderAdjust = 2 * borderWidth;
  6767. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6768. for (const vertex of this.data.vertices) {
  6769. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6770. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6771. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6772. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6773. }
  6774. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6775. this.rectangle = bbox;
  6776. }
  6777. this._setDefaultAppearance({
  6778. xref,
  6779. extra: `${borderWidth} w`,
  6780. strokeColor,
  6781. strokeAlpha,
  6782. pointsCallback: (buffer, points) => {
  6783. const vertices = this.data.vertices;
  6784. for (let i = 0, ii = vertices.length; i < ii; i++) {
  6785. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  6786. }
  6787. buffer.push("S");
  6788. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6789. }
  6790. });
  6791. }
  6792. }
  6793. }
  6794. class PolygonAnnotation extends PolylineAnnotation {
  6795. constructor(params) {
  6796. super(params);
  6797. this.data.annotationType = _util.AnnotationType.POLYGON;
  6798. }
  6799. }
  6800. class CaretAnnotation extends MarkupAnnotation {
  6801. constructor(params) {
  6802. super(params);
  6803. this.data.annotationType = _util.AnnotationType.CARET;
  6804. }
  6805. }
  6806. class InkAnnotation extends MarkupAnnotation {
  6807. constructor(params) {
  6808. super(params);
  6809. const {
  6810. dict,
  6811. xref
  6812. } = params;
  6813. this.data.annotationType = _util.AnnotationType.INK;
  6814. this.data.inkLists = [];
  6815. const rawInkLists = dict.getArray("InkList");
  6816. if (!Array.isArray(rawInkLists)) {
  6817. return;
  6818. }
  6819. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  6820. this.data.inkLists.push([]);
  6821. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  6822. this.data.inkLists[i].push({
  6823. x: xref.fetchIfRef(rawInkLists[i][j]),
  6824. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  6825. });
  6826. }
  6827. }
  6828. if (!this.appearance) {
  6829. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6830. const strokeAlpha = dict.get("CA");
  6831. const borderWidth = this.borderStyle.width || 1,
  6832. borderAdjust = 2 * borderWidth;
  6833. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6834. for (const inkLists of this.data.inkLists) {
  6835. for (const vertex of inkLists) {
  6836. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6837. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6838. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6839. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6840. }
  6841. }
  6842. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6843. this.rectangle = bbox;
  6844. }
  6845. this._setDefaultAppearance({
  6846. xref,
  6847. extra: `${borderWidth} w`,
  6848. strokeColor,
  6849. strokeAlpha,
  6850. pointsCallback: (buffer, points) => {
  6851. for (const inkList of this.data.inkLists) {
  6852. for (let i = 0, ii = inkList.length; i < ii; i++) {
  6853. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  6854. }
  6855. buffer.push("S");
  6856. }
  6857. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6858. }
  6859. });
  6860. }
  6861. }
  6862. static createNewDict(annotation, xref, {
  6863. apRef,
  6864. ap
  6865. }) {
  6866. const {
  6867. paths,
  6868. rect,
  6869. rotation
  6870. } = annotation;
  6871. const ink = new _primitives.Dict(xref);
  6872. ink.set("Type", _primitives.Name.get("Annot"));
  6873. ink.set("Subtype", _primitives.Name.get("Ink"));
  6874. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6875. ink.set("Rect", rect);
  6876. ink.set("InkList", paths.map(p => p.points));
  6877. ink.set("F", 4);
  6878. ink.set("Border", [0, 0, 0]);
  6879. ink.set("Rotate", rotation);
  6880. const n = new _primitives.Dict(xref);
  6881. ink.set("AP", n);
  6882. if (apRef) {
  6883. n.set("N", apRef);
  6884. } else {
  6885. n.set("N", ap);
  6886. }
  6887. return ink;
  6888. }
  6889. static async createNewAppearanceStream(annotation, xref, params) {
  6890. const {
  6891. color,
  6892. rect,
  6893. rotation,
  6894. paths,
  6895. thickness,
  6896. opacity
  6897. } = annotation;
  6898. const [x1, y1, x2, y2] = rect;
  6899. let w = x2 - x1;
  6900. let h = y2 - y1;
  6901. if (rotation % 180 !== 0) {
  6902. [w, h] = [h, w];
  6903. }
  6904. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  6905. if (opacity !== 1) {
  6906. appearanceBuffer.push("/R0 gs");
  6907. }
  6908. const buffer = [];
  6909. for (const {
  6910. bezier
  6911. } of paths) {
  6912. buffer.length = 0;
  6913. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  6914. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  6915. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  6916. buffer.push(`${curve} c`);
  6917. }
  6918. buffer.push("S");
  6919. appearanceBuffer.push(buffer.join("\n"));
  6920. }
  6921. const appearance = appearanceBuffer.join("\n");
  6922. const appearanceStreamDict = new _primitives.Dict(xref);
  6923. appearanceStreamDict.set("FormType", 1);
  6924. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6925. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6926. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6927. appearanceStreamDict.set("Length", appearance.length);
  6928. if (rotation) {
  6929. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6930. appearanceStreamDict.set("Matrix", matrix);
  6931. }
  6932. if (opacity !== 1) {
  6933. const resources = new _primitives.Dict(xref);
  6934. const extGState = new _primitives.Dict(xref);
  6935. const r0 = new _primitives.Dict(xref);
  6936. r0.set("CA", opacity);
  6937. r0.set("Type", _primitives.Name.get("ExtGState"));
  6938. extGState.set("R0", r0);
  6939. resources.set("ExtGState", extGState);
  6940. appearanceStreamDict.set("Resources", resources);
  6941. }
  6942. const ap = new _stream.StringStream(appearance);
  6943. ap.dict = appearanceStreamDict;
  6944. return ap;
  6945. }
  6946. }
  6947. class HighlightAnnotation extends MarkupAnnotation {
  6948. constructor(params) {
  6949. super(params);
  6950. const {
  6951. dict,
  6952. xref
  6953. } = params;
  6954. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  6955. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6956. if (quadPoints) {
  6957. const resources = this.appearance && this.appearance.dict.get("Resources");
  6958. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  6959. if (this.appearance) {
  6960. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  6961. }
  6962. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  6963. const fillAlpha = dict.get("CA");
  6964. this._setDefaultAppearance({
  6965. xref,
  6966. fillColor,
  6967. blendMode: "Multiply",
  6968. fillAlpha,
  6969. pointsCallback: (buffer, points) => {
  6970. 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");
  6971. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6972. }
  6973. });
  6974. }
  6975. } else {
  6976. this.data.hasPopup = false;
  6977. }
  6978. }
  6979. }
  6980. class UnderlineAnnotation extends MarkupAnnotation {
  6981. constructor(params) {
  6982. super(params);
  6983. const {
  6984. dict,
  6985. xref
  6986. } = params;
  6987. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  6988. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6989. if (quadPoints) {
  6990. if (!this.appearance) {
  6991. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6992. const strokeAlpha = dict.get("CA");
  6993. this._setDefaultAppearance({
  6994. xref,
  6995. extra: "[] 0 d 1 w",
  6996. strokeColor,
  6997. strokeAlpha,
  6998. pointsCallback: (buffer, points) => {
  6999. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  7000. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7001. }
  7002. });
  7003. }
  7004. } else {
  7005. this.data.hasPopup = false;
  7006. }
  7007. }
  7008. }
  7009. class SquigglyAnnotation extends MarkupAnnotation {
  7010. constructor(params) {
  7011. super(params);
  7012. const {
  7013. dict,
  7014. xref
  7015. } = params;
  7016. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  7017. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7018. if (quadPoints) {
  7019. if (!this.appearance) {
  7020. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7021. const strokeAlpha = dict.get("CA");
  7022. this._setDefaultAppearance({
  7023. xref,
  7024. extra: "[] 0 d 1 w",
  7025. strokeColor,
  7026. strokeAlpha,
  7027. pointsCallback: (buffer, points) => {
  7028. const dy = (points[0].y - points[2].y) / 6;
  7029. let shift = dy;
  7030. let x = points[2].x;
  7031. const y = points[2].y;
  7032. const xEnd = points[3].x;
  7033. buffer.push(`${x} ${y + shift} m`);
  7034. do {
  7035. x += 2;
  7036. shift = shift === 0 ? dy : 0;
  7037. buffer.push(`${x} ${y + shift} l`);
  7038. } while (x < xEnd);
  7039. buffer.push("S");
  7040. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  7041. }
  7042. });
  7043. }
  7044. } else {
  7045. this.data.hasPopup = false;
  7046. }
  7047. }
  7048. }
  7049. class StrikeOutAnnotation extends MarkupAnnotation {
  7050. constructor(params) {
  7051. super(params);
  7052. const {
  7053. dict,
  7054. xref
  7055. } = params;
  7056. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  7057. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7058. if (quadPoints) {
  7059. if (!this.appearance) {
  7060. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7061. const strokeAlpha = dict.get("CA");
  7062. this._setDefaultAppearance({
  7063. xref,
  7064. extra: "[] 0 d 1 w",
  7065. strokeColor,
  7066. strokeAlpha,
  7067. pointsCallback: (buffer, points) => {
  7068. 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");
  7069. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7070. }
  7071. });
  7072. }
  7073. } else {
  7074. this.data.hasPopup = false;
  7075. }
  7076. }
  7077. }
  7078. class StampAnnotation extends MarkupAnnotation {
  7079. constructor(params) {
  7080. super(params);
  7081. this.data.annotationType = _util.AnnotationType.STAMP;
  7082. }
  7083. }
  7084. class FileAttachmentAnnotation extends MarkupAnnotation {
  7085. constructor(params) {
  7086. super(params);
  7087. const file = new _file_spec.FileSpec(params.dict.get("FS"), params.xref);
  7088. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  7089. this.data.file = file.serializable;
  7090. }
  7091. }
  7092. /***/ }),
  7093. /* 11 */
  7094. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7095. Object.defineProperty(exports, "__esModule", ({
  7096. value: true
  7097. }));
  7098. exports.FakeUnicodeFont = void 0;
  7099. exports.createDefaultAppearance = createDefaultAppearance;
  7100. exports.getPdfColor = getPdfColor;
  7101. exports.parseDefaultAppearance = parseDefaultAppearance;
  7102. var _primitives = __w_pdfjs_require__(3);
  7103. var _core_utils = __w_pdfjs_require__(4);
  7104. var _util = __w_pdfjs_require__(2);
  7105. var _colorspace = __w_pdfjs_require__(12);
  7106. var _evaluator = __w_pdfjs_require__(13);
  7107. var _stream = __w_pdfjs_require__(8);
  7108. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  7109. constructor(str) {
  7110. super(new _stream.StringStream(str));
  7111. }
  7112. parse() {
  7113. const operation = {
  7114. fn: 0,
  7115. args: []
  7116. };
  7117. const result = {
  7118. fontSize: 0,
  7119. fontName: "",
  7120. fontColor: new Uint8ClampedArray(3)
  7121. };
  7122. try {
  7123. while (true) {
  7124. operation.args.length = 0;
  7125. if (!this.read(operation)) {
  7126. break;
  7127. }
  7128. if (this.savedStatesDepth !== 0) {
  7129. continue;
  7130. }
  7131. const {
  7132. fn,
  7133. args
  7134. } = operation;
  7135. switch (fn | 0) {
  7136. case _util.OPS.setFont:
  7137. const [fontName, fontSize] = args;
  7138. if (fontName instanceof _primitives.Name) {
  7139. result.fontName = fontName.name;
  7140. }
  7141. if (typeof fontSize === "number" && fontSize > 0) {
  7142. result.fontSize = fontSize;
  7143. }
  7144. break;
  7145. case _util.OPS.setFillRGBColor:
  7146. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  7147. break;
  7148. case _util.OPS.setFillGray:
  7149. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  7150. break;
  7151. case _util.OPS.setFillColorSpace:
  7152. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  7153. break;
  7154. }
  7155. }
  7156. } catch (reason) {
  7157. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  7158. }
  7159. return result;
  7160. }
  7161. }
  7162. function parseDefaultAppearance(str) {
  7163. return new DefaultAppearanceEvaluator(str).parse();
  7164. }
  7165. function getPdfColor(color, isFill) {
  7166. if (color[0] === color[1] && color[1] === color[2]) {
  7167. const gray = color[0] / 255;
  7168. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  7169. }
  7170. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  7171. }
  7172. function createDefaultAppearance({
  7173. fontSize,
  7174. fontName,
  7175. fontColor
  7176. }) {
  7177. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  7178. }
  7179. class FakeUnicodeFont {
  7180. constructor(xref, fontFamily) {
  7181. this.xref = xref;
  7182. this.widths = null;
  7183. this.firstChar = Infinity;
  7184. this.lastChar = -Infinity;
  7185. this.fontFamily = fontFamily;
  7186. const canvas = new OffscreenCanvas(1, 1);
  7187. this.ctxMeasure = canvas.getContext("2d");
  7188. if (!FakeUnicodeFont._fontNameId) {
  7189. FakeUnicodeFont._fontNameId = 1;
  7190. }
  7191. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  7192. }
  7193. get toUnicodeRef() {
  7194. if (!FakeUnicodeFont._toUnicodeRef) {
  7195. const toUnicode = `/CIDInit /ProcSet findresource begin
  7196. 12 dict begin
  7197. begincmap
  7198. /CIDSystemInfo
  7199. << /Registry (Adobe)
  7200. /Ordering (UCS) /Supplement 0 >> def
  7201. /CMapName /Adobe-Identity-UCS def
  7202. /CMapType 2 def
  7203. 1 begincodespacerange
  7204. <0000> <FFFF>
  7205. endcodespacerange
  7206. 1 beginbfrange
  7207. <0000> <FFFF> <0000>
  7208. endbfrange
  7209. endcmap CMapName currentdict /CMap defineresource pop end end`;
  7210. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  7211. const toUnicodeDict = new _primitives.Dict(this.xref);
  7212. toUnicodeStream.dict = toUnicodeDict;
  7213. toUnicodeDict.set("Length", toUnicode.length);
  7214. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  7215. }
  7216. return FakeUnicodeFont._toUnicodeRef;
  7217. }
  7218. get fontDescriptorRef() {
  7219. if (!FakeUnicodeFont._fontDescriptorRef) {
  7220. const fontDescriptor = new _primitives.Dict(this.xref);
  7221. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  7222. fontDescriptor.set("FontName", this.fontName);
  7223. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  7224. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  7225. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  7226. fontDescriptor.set("FontWeight", 400);
  7227. fontDescriptor.set("ItalicAngle", 0);
  7228. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  7229. }
  7230. return FakeUnicodeFont._fontDescriptorRef;
  7231. }
  7232. get descendantFontRef() {
  7233. const descendantFont = new _primitives.Dict(this.xref);
  7234. descendantFont.set("BaseFont", this.fontName);
  7235. descendantFont.set("Type", _primitives.Name.get("Font"));
  7236. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  7237. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  7238. descendantFont.set("FirstChar", this.firstChar);
  7239. descendantFont.set("LastChar", this.lastChar);
  7240. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  7241. descendantFont.set("DW", 1000);
  7242. const widths = [];
  7243. const chars = [...this.widths.entries()].sort();
  7244. let currentChar = null;
  7245. let currentWidths = null;
  7246. for (const [char, width] of chars) {
  7247. if (!currentChar) {
  7248. currentChar = char;
  7249. currentWidths = [width];
  7250. continue;
  7251. }
  7252. if (char === currentChar + currentWidths.length) {
  7253. currentWidths.push(width);
  7254. } else {
  7255. widths.push(currentChar, currentWidths);
  7256. currentChar = char;
  7257. currentWidths = [width];
  7258. }
  7259. }
  7260. if (currentChar) {
  7261. widths.push(currentChar, currentWidths);
  7262. }
  7263. descendantFont.set("W", widths);
  7264. const cidSystemInfo = new _primitives.Dict(this.xref);
  7265. cidSystemInfo.set("Ordering", "Identity");
  7266. cidSystemInfo.set("Registry", "Adobe");
  7267. cidSystemInfo.set("Supplement", 0);
  7268. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  7269. return this.xref.getNewPersistentRef(descendantFont);
  7270. }
  7271. get baseFontRef() {
  7272. const baseFont = new _primitives.Dict(this.xref);
  7273. baseFont.set("BaseFont", this.fontName);
  7274. baseFont.set("Type", _primitives.Name.get("Font"));
  7275. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  7276. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  7277. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  7278. baseFont.set("ToUnicode", this.toUnicodeRef);
  7279. return this.xref.getNewPersistentRef(baseFont);
  7280. }
  7281. get resources() {
  7282. const resources = new _primitives.Dict(this.xref);
  7283. const font = new _primitives.Dict(this.xref);
  7284. font.set(this.fontName.name, this.baseFontRef);
  7285. resources.set("Font", font);
  7286. return resources;
  7287. }
  7288. _createContext() {
  7289. this.widths = new Map();
  7290. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  7291. return this.ctxMeasure;
  7292. }
  7293. createFontResources(text) {
  7294. const ctx = this._createContext();
  7295. for (const line of text.split(/\r\n?|\n/)) {
  7296. for (const char of line.split("")) {
  7297. const code = char.charCodeAt(0);
  7298. if (this.widths.has(code)) {
  7299. continue;
  7300. }
  7301. const metrics = ctx.measureText(char);
  7302. const width = Math.ceil(metrics.width);
  7303. this.widths.set(code, width);
  7304. this.firstChar = Math.min(code, this.firstChar);
  7305. this.lastChar = Math.max(code, this.lastChar);
  7306. }
  7307. }
  7308. return this.resources;
  7309. }
  7310. createAppearance(text, rect, rotation, fontSize, bgColor) {
  7311. const ctx = this._createContext();
  7312. const lines = [];
  7313. let maxWidth = -Infinity;
  7314. for (const line of text.split(/\r\n?|\n/)) {
  7315. lines.push(line);
  7316. const lineWidth = ctx.measureText(line).width;
  7317. maxWidth = Math.max(maxWidth, lineWidth);
  7318. for (const char of line.split("")) {
  7319. const code = char.charCodeAt(0);
  7320. let width = this.widths.get(code);
  7321. if (width === undefined) {
  7322. const metrics = ctx.measureText(char);
  7323. width = Math.ceil(metrics.width);
  7324. this.widths.set(code, width);
  7325. this.firstChar = Math.min(code, this.firstChar);
  7326. this.lastChar = Math.max(code, this.lastChar);
  7327. }
  7328. }
  7329. }
  7330. maxWidth *= fontSize / 1000;
  7331. const [x1, y1, x2, y2] = rect;
  7332. let w = x2 - x1;
  7333. let h = y2 - y1;
  7334. if (rotation % 180 !== 0) {
  7335. [w, h] = [h, w];
  7336. }
  7337. let hscale = 1;
  7338. if (maxWidth > w) {
  7339. hscale = w / maxWidth;
  7340. }
  7341. let vscale = 1;
  7342. const lineHeight = _util.LINE_FACTOR * fontSize;
  7343. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  7344. const maxHeight = lineHeight * lines.length;
  7345. if (maxHeight > h) {
  7346. vscale = h / maxHeight;
  7347. }
  7348. const fscale = Math.min(hscale, vscale);
  7349. const newFontSize = fontSize * fscale;
  7350. 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 ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  7351. const vShift = (0, _core_utils.numberToString)(lineHeight);
  7352. for (const line of lines) {
  7353. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  7354. }
  7355. buffer.push("ET", "Q");
  7356. const appearance = buffer.join("\n");
  7357. const appearanceStreamDict = new _primitives.Dict(this.xref);
  7358. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  7359. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  7360. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  7361. appearanceStreamDict.set("Length", appearance.length);
  7362. appearanceStreamDict.set("Resources", this.resources);
  7363. if (rotation) {
  7364. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  7365. appearanceStreamDict.set("Matrix", matrix);
  7366. }
  7367. const ap = new _stream.StringStream(appearance);
  7368. ap.dict = appearanceStreamDict;
  7369. return ap;
  7370. }
  7371. }
  7372. exports.FakeUnicodeFont = FakeUnicodeFont;
  7373. /***/ }),
  7374. /* 12 */
  7375. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7376. Object.defineProperty(exports, "__esModule", ({
  7377. value: true
  7378. }));
  7379. exports.ColorSpace = void 0;
  7380. var _util = __w_pdfjs_require__(2);
  7381. var _primitives = __w_pdfjs_require__(3);
  7382. var _base_stream = __w_pdfjs_require__(5);
  7383. var _core_utils = __w_pdfjs_require__(4);
  7384. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  7385. const COMPONENTS = 3;
  7386. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  7387. const xRatio = w1 / w2;
  7388. const yRatio = h1 / h2;
  7389. let newIndex = 0,
  7390. oldIndex;
  7391. const xScaled = new Uint16Array(w2);
  7392. const w1Scanline = w1 * COMPONENTS;
  7393. for (let i = 0; i < w2; i++) {
  7394. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  7395. }
  7396. for (let i = 0; i < h2; i++) {
  7397. const py = Math.floor(i * yRatio) * w1Scanline;
  7398. for (let j = 0; j < w2; j++) {
  7399. oldIndex = py + xScaled[j];
  7400. dest[newIndex++] = src[oldIndex++];
  7401. dest[newIndex++] = src[oldIndex++];
  7402. dest[newIndex++] = src[oldIndex++];
  7403. newIndex += alpha01;
  7404. }
  7405. }
  7406. }
  7407. class ColorSpace {
  7408. constructor(name, numComps) {
  7409. if (this.constructor === ColorSpace) {
  7410. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  7411. }
  7412. this.name = name;
  7413. this.numComps = numComps;
  7414. }
  7415. getRgb(src, srcOffset) {
  7416. const rgb = new Uint8ClampedArray(3);
  7417. this.getRgbItem(src, srcOffset, rgb, 0);
  7418. return rgb;
  7419. }
  7420. getRgbItem(src, srcOffset, dest, destOffset) {
  7421. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  7422. }
  7423. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7424. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  7425. }
  7426. getOutputLength(inputLength, alpha01) {
  7427. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  7428. }
  7429. isPassthrough(bits) {
  7430. return false;
  7431. }
  7432. isDefaultDecode(decodeMap, bpc) {
  7433. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  7434. }
  7435. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  7436. const count = originalWidth * originalHeight;
  7437. let rgbBuf = null;
  7438. const numComponentColors = 1 << bpc;
  7439. const needsResizing = originalHeight !== height || originalWidth !== width;
  7440. if (this.isPassthrough(bpc)) {
  7441. rgbBuf = comps;
  7442. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  7443. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  7444. for (let i = 0; i < numComponentColors; i++) {
  7445. allColors[i] = i;
  7446. }
  7447. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  7448. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  7449. if (!needsResizing) {
  7450. let destPos = 0;
  7451. for (let i = 0; i < count; ++i) {
  7452. const key = comps[i] * 3;
  7453. dest[destPos++] = colorMap[key];
  7454. dest[destPos++] = colorMap[key + 1];
  7455. dest[destPos++] = colorMap[key + 2];
  7456. destPos += alpha01;
  7457. }
  7458. } else {
  7459. rgbBuf = new Uint8Array(count * 3);
  7460. let rgbPos = 0;
  7461. for (let i = 0; i < count; ++i) {
  7462. const key = comps[i] * 3;
  7463. rgbBuf[rgbPos++] = colorMap[key];
  7464. rgbBuf[rgbPos++] = colorMap[key + 1];
  7465. rgbBuf[rgbPos++] = colorMap[key + 2];
  7466. }
  7467. }
  7468. } else {
  7469. if (!needsResizing) {
  7470. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  7471. } else {
  7472. rgbBuf = new Uint8ClampedArray(count * 3);
  7473. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  7474. }
  7475. }
  7476. if (rgbBuf) {
  7477. if (needsResizing) {
  7478. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  7479. } else {
  7480. let destPos = 0,
  7481. rgbPos = 0;
  7482. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  7483. dest[destPos++] = rgbBuf[rgbPos++];
  7484. dest[destPos++] = rgbBuf[rgbPos++];
  7485. dest[destPos++] = rgbBuf[rgbPos++];
  7486. destPos += alpha01;
  7487. }
  7488. }
  7489. }
  7490. }
  7491. get usesZeroToOneRange() {
  7492. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  7493. }
  7494. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  7495. if (!localColorSpaceCache) {
  7496. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  7497. }
  7498. if (!parsedColorSpace) {
  7499. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  7500. }
  7501. let csName, csRef;
  7502. if (cacheKey instanceof _primitives.Ref) {
  7503. csRef = cacheKey;
  7504. cacheKey = xref.fetch(cacheKey);
  7505. }
  7506. if (cacheKey instanceof _primitives.Name) {
  7507. csName = cacheKey.name;
  7508. }
  7509. if (csName || csRef) {
  7510. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  7511. }
  7512. }
  7513. static getCached(cacheKey, xref, localColorSpaceCache) {
  7514. if (!localColorSpaceCache) {
  7515. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  7516. }
  7517. if (cacheKey instanceof _primitives.Ref) {
  7518. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  7519. if (localColorSpace) {
  7520. return localColorSpace;
  7521. }
  7522. try {
  7523. cacheKey = xref.fetch(cacheKey);
  7524. } catch (ex) {
  7525. if (ex instanceof _core_utils.MissingDataException) {
  7526. throw ex;
  7527. }
  7528. }
  7529. }
  7530. if (cacheKey instanceof _primitives.Name) {
  7531. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  7532. if (localColorSpace) {
  7533. return localColorSpace;
  7534. }
  7535. }
  7536. return null;
  7537. }
  7538. static async parseAsync({
  7539. cs,
  7540. xref,
  7541. resources = null,
  7542. pdfFunctionFactory,
  7543. localColorSpaceCache
  7544. }) {
  7545. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7546. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7547. return parsedColorSpace;
  7548. }
  7549. static parse({
  7550. cs,
  7551. xref,
  7552. resources = null,
  7553. pdfFunctionFactory,
  7554. localColorSpaceCache
  7555. }) {
  7556. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  7557. if (cachedColorSpace) {
  7558. return cachedColorSpace;
  7559. }
  7560. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7561. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7562. return parsedColorSpace;
  7563. }
  7564. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  7565. cs = xref.fetchIfRef(cs);
  7566. if (cs instanceof _primitives.Name) {
  7567. switch (cs.name) {
  7568. case "G":
  7569. case "DeviceGray":
  7570. return this.singletons.gray;
  7571. case "RGB":
  7572. case "DeviceRGB":
  7573. return this.singletons.rgb;
  7574. case "CMYK":
  7575. case "DeviceCMYK":
  7576. return this.singletons.cmyk;
  7577. case "Pattern":
  7578. return new PatternCS(null);
  7579. default:
  7580. if (resources instanceof _primitives.Dict) {
  7581. const colorSpaces = resources.get("ColorSpace");
  7582. if (colorSpaces instanceof _primitives.Dict) {
  7583. const resourcesCS = colorSpaces.get(cs.name);
  7584. if (resourcesCS) {
  7585. if (resourcesCS instanceof _primitives.Name) {
  7586. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  7587. }
  7588. cs = resourcesCS;
  7589. break;
  7590. }
  7591. }
  7592. }
  7593. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  7594. }
  7595. }
  7596. if (Array.isArray(cs)) {
  7597. const mode = xref.fetchIfRef(cs[0]).name;
  7598. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  7599. switch (mode) {
  7600. case "G":
  7601. case "DeviceGray":
  7602. return this.singletons.gray;
  7603. case "RGB":
  7604. case "DeviceRGB":
  7605. return this.singletons.rgb;
  7606. case "CMYK":
  7607. case "DeviceCMYK":
  7608. return this.singletons.cmyk;
  7609. case "CalGray":
  7610. params = xref.fetchIfRef(cs[1]);
  7611. whitePoint = params.getArray("WhitePoint");
  7612. blackPoint = params.getArray("BlackPoint");
  7613. gamma = params.get("Gamma");
  7614. return new CalGrayCS(whitePoint, blackPoint, gamma);
  7615. case "CalRGB":
  7616. params = xref.fetchIfRef(cs[1]);
  7617. whitePoint = params.getArray("WhitePoint");
  7618. blackPoint = params.getArray("BlackPoint");
  7619. gamma = params.getArray("Gamma");
  7620. const matrix = params.getArray("Matrix");
  7621. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  7622. case "ICCBased":
  7623. const stream = xref.fetchIfRef(cs[1]);
  7624. const dict = stream.dict;
  7625. numComps = dict.get("N");
  7626. const alt = dict.get("Alternate");
  7627. if (alt) {
  7628. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  7629. if (altCS.numComps === numComps) {
  7630. return altCS;
  7631. }
  7632. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  7633. }
  7634. if (numComps === 1) {
  7635. return this.singletons.gray;
  7636. } else if (numComps === 3) {
  7637. return this.singletons.rgb;
  7638. } else if (numComps === 4) {
  7639. return this.singletons.cmyk;
  7640. }
  7641. break;
  7642. case "Pattern":
  7643. baseCS = cs[1] || null;
  7644. if (baseCS) {
  7645. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  7646. }
  7647. return new PatternCS(baseCS);
  7648. case "I":
  7649. case "Indexed":
  7650. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  7651. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  7652. const lookup = xref.fetchIfRef(cs[3]);
  7653. return new IndexedCS(baseCS, hiVal, lookup);
  7654. case "Separation":
  7655. case "DeviceN":
  7656. const name = xref.fetchIfRef(cs[1]);
  7657. numComps = Array.isArray(name) ? name.length : 1;
  7658. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  7659. const tintFn = pdfFunctionFactory.create(cs[3]);
  7660. return new AlternateCS(numComps, baseCS, tintFn);
  7661. case "Lab":
  7662. params = xref.fetchIfRef(cs[1]);
  7663. whitePoint = params.getArray("WhitePoint");
  7664. blackPoint = params.getArray("BlackPoint");
  7665. const range = params.getArray("Range");
  7666. return new LabCS(whitePoint, blackPoint, range);
  7667. default:
  7668. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  7669. }
  7670. }
  7671. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  7672. }
  7673. static isDefaultDecode(decode, numComps) {
  7674. if (!Array.isArray(decode)) {
  7675. return true;
  7676. }
  7677. if (numComps * 2 !== decode.length) {
  7678. (0, _util.warn)("The decode map is not the correct length");
  7679. return true;
  7680. }
  7681. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  7682. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  7683. return false;
  7684. }
  7685. }
  7686. return true;
  7687. }
  7688. static get singletons() {
  7689. return (0, _util.shadow)(this, "singletons", {
  7690. get gray() {
  7691. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  7692. },
  7693. get rgb() {
  7694. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  7695. },
  7696. get cmyk() {
  7697. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  7698. }
  7699. });
  7700. }
  7701. }
  7702. exports.ColorSpace = ColorSpace;
  7703. class AlternateCS extends ColorSpace {
  7704. constructor(numComps, base, tintFn) {
  7705. super("Alternate", numComps);
  7706. this.base = base;
  7707. this.tintFn = tintFn;
  7708. this.tmpBuf = new Float32Array(base.numComps);
  7709. }
  7710. getRgbItem(src, srcOffset, dest, destOffset) {
  7711. const tmpBuf = this.tmpBuf;
  7712. this.tintFn(src, srcOffset, tmpBuf, 0);
  7713. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  7714. }
  7715. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7716. const tintFn = this.tintFn;
  7717. const base = this.base;
  7718. const scale = 1 / ((1 << bits) - 1);
  7719. const baseNumComps = base.numComps;
  7720. const usesZeroToOneRange = base.usesZeroToOneRange;
  7721. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  7722. let pos = isPassthrough ? destOffset : 0;
  7723. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  7724. const numComps = this.numComps;
  7725. const scaled = new Float32Array(numComps);
  7726. const tinted = new Float32Array(baseNumComps);
  7727. let i, j;
  7728. for (i = 0; i < count; i++) {
  7729. for (j = 0; j < numComps; j++) {
  7730. scaled[j] = src[srcOffset++] * scale;
  7731. }
  7732. tintFn(scaled, 0, tinted, 0);
  7733. if (usesZeroToOneRange) {
  7734. for (j = 0; j < baseNumComps; j++) {
  7735. baseBuf[pos++] = tinted[j] * 255;
  7736. }
  7737. } else {
  7738. base.getRgbItem(tinted, 0, baseBuf, pos);
  7739. pos += baseNumComps;
  7740. }
  7741. }
  7742. if (!isPassthrough) {
  7743. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  7744. }
  7745. }
  7746. getOutputLength(inputLength, alpha01) {
  7747. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  7748. }
  7749. }
  7750. class PatternCS extends ColorSpace {
  7751. constructor(baseCS) {
  7752. super("Pattern", null);
  7753. this.base = baseCS;
  7754. }
  7755. isDefaultDecode(decodeMap, bpc) {
  7756. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  7757. }
  7758. }
  7759. class IndexedCS extends ColorSpace {
  7760. constructor(base, highVal, lookup) {
  7761. super("Indexed", 1);
  7762. this.base = base;
  7763. this.highVal = highVal;
  7764. const length = base.numComps * highVal;
  7765. this.lookup = new Uint8Array(length);
  7766. if (lookup instanceof _base_stream.BaseStream) {
  7767. const bytes = lookup.getBytes(length);
  7768. this.lookup.set(bytes);
  7769. } else if (typeof lookup === "string") {
  7770. for (let i = 0; i < length; ++i) {
  7771. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  7772. }
  7773. } else {
  7774. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  7775. }
  7776. }
  7777. getRgbItem(src, srcOffset, dest, destOffset) {
  7778. const numComps = this.base.numComps;
  7779. const start = src[srcOffset] * numComps;
  7780. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  7781. }
  7782. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7783. const base = this.base;
  7784. const numComps = base.numComps;
  7785. const outputDelta = base.getOutputLength(numComps, alpha01);
  7786. const lookup = this.lookup;
  7787. for (let i = 0; i < count; ++i) {
  7788. const lookupPos = src[srcOffset++] * numComps;
  7789. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  7790. destOffset += outputDelta;
  7791. }
  7792. }
  7793. getOutputLength(inputLength, alpha01) {
  7794. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  7795. }
  7796. isDefaultDecode(decodeMap, bpc) {
  7797. if (!Array.isArray(decodeMap)) {
  7798. return true;
  7799. }
  7800. if (decodeMap.length !== 2) {
  7801. (0, _util.warn)("Decode map length is not correct");
  7802. return true;
  7803. }
  7804. if (!Number.isInteger(bpc) || bpc < 1) {
  7805. (0, _util.warn)("Bits per component is not correct");
  7806. return true;
  7807. }
  7808. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  7809. }
  7810. }
  7811. class DeviceGrayCS extends ColorSpace {
  7812. constructor() {
  7813. super("DeviceGray", 1);
  7814. }
  7815. getRgbItem(src, srcOffset, dest, destOffset) {
  7816. const c = src[srcOffset] * 255;
  7817. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  7818. }
  7819. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7820. const scale = 255 / ((1 << bits) - 1);
  7821. let j = srcOffset,
  7822. q = destOffset;
  7823. for (let i = 0; i < count; ++i) {
  7824. const c = scale * src[j++];
  7825. dest[q++] = c;
  7826. dest[q++] = c;
  7827. dest[q++] = c;
  7828. q += alpha01;
  7829. }
  7830. }
  7831. getOutputLength(inputLength, alpha01) {
  7832. return inputLength * (3 + alpha01);
  7833. }
  7834. }
  7835. class DeviceRgbCS extends ColorSpace {
  7836. constructor() {
  7837. super("DeviceRGB", 3);
  7838. }
  7839. getRgbItem(src, srcOffset, dest, destOffset) {
  7840. dest[destOffset] = src[srcOffset] * 255;
  7841. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  7842. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  7843. }
  7844. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7845. if (bits === 8 && alpha01 === 0) {
  7846. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  7847. return;
  7848. }
  7849. const scale = 255 / ((1 << bits) - 1);
  7850. let j = srcOffset,
  7851. q = destOffset;
  7852. for (let i = 0; i < count; ++i) {
  7853. dest[q++] = scale * src[j++];
  7854. dest[q++] = scale * src[j++];
  7855. dest[q++] = scale * src[j++];
  7856. q += alpha01;
  7857. }
  7858. }
  7859. getOutputLength(inputLength, alpha01) {
  7860. return inputLength * (3 + alpha01) / 3 | 0;
  7861. }
  7862. isPassthrough(bits) {
  7863. return bits === 8;
  7864. }
  7865. }
  7866. const DeviceCmykCS = function DeviceCmykCSClosure() {
  7867. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  7868. const c = src[srcOffset] * srcScale;
  7869. const m = src[srcOffset + 1] * srcScale;
  7870. const y = src[srcOffset + 2] * srcScale;
  7871. const k = src[srcOffset + 3] * srcScale;
  7872. 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);
  7873. 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);
  7874. 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);
  7875. }
  7876. class DeviceCmykCS extends ColorSpace {
  7877. constructor() {
  7878. super("DeviceCMYK", 4);
  7879. }
  7880. getRgbItem(src, srcOffset, dest, destOffset) {
  7881. convertToRgb(src, srcOffset, 1, dest, destOffset);
  7882. }
  7883. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7884. const scale = 1 / ((1 << bits) - 1);
  7885. for (let i = 0; i < count; i++) {
  7886. convertToRgb(src, srcOffset, scale, dest, destOffset);
  7887. srcOffset += 4;
  7888. destOffset += 3 + alpha01;
  7889. }
  7890. }
  7891. getOutputLength(inputLength, alpha01) {
  7892. return inputLength / 4 * (3 + alpha01) | 0;
  7893. }
  7894. }
  7895. return DeviceCmykCS;
  7896. }();
  7897. const CalGrayCS = function CalGrayCSClosure() {
  7898. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7899. const A = src[srcOffset] * scale;
  7900. const AG = A ** cs.G;
  7901. const L = cs.YW * AG;
  7902. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  7903. dest[destOffset] = val;
  7904. dest[destOffset + 1] = val;
  7905. dest[destOffset + 2] = val;
  7906. }
  7907. class CalGrayCS extends ColorSpace {
  7908. constructor(whitePoint, blackPoint, gamma) {
  7909. super("CalGray", 1);
  7910. if (!whitePoint) {
  7911. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  7912. }
  7913. blackPoint = blackPoint || [0, 0, 0];
  7914. gamma = gamma || 1;
  7915. this.XW = whitePoint[0];
  7916. this.YW = whitePoint[1];
  7917. this.ZW = whitePoint[2];
  7918. this.XB = blackPoint[0];
  7919. this.YB = blackPoint[1];
  7920. this.ZB = blackPoint[2];
  7921. this.G = gamma;
  7922. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7923. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7924. }
  7925. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7926. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  7927. this.XB = this.YB = this.ZB = 0;
  7928. }
  7929. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  7930. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  7931. }
  7932. if (this.G < 1) {
  7933. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  7934. this.G = 1;
  7935. }
  7936. }
  7937. getRgbItem(src, srcOffset, dest, destOffset) {
  7938. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7939. }
  7940. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7941. const scale = 1 / ((1 << bits) - 1);
  7942. for (let i = 0; i < count; ++i) {
  7943. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7944. srcOffset += 1;
  7945. destOffset += 3 + alpha01;
  7946. }
  7947. }
  7948. getOutputLength(inputLength, alpha01) {
  7949. return inputLength * (3 + alpha01);
  7950. }
  7951. }
  7952. return CalGrayCS;
  7953. }();
  7954. const CalRGBCS = function CalRGBCSClosure() {
  7955. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  7956. 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]);
  7957. 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]);
  7958. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  7959. const tempNormalizeMatrix = new Float32Array(3);
  7960. const tempConvertMatrix1 = new Float32Array(3);
  7961. const tempConvertMatrix2 = new Float32Array(3);
  7962. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  7963. function matrixProduct(a, b, result) {
  7964. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  7965. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  7966. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  7967. }
  7968. function convertToFlat(sourceWhitePoint, LMS, result) {
  7969. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  7970. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  7971. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  7972. }
  7973. function convertToD65(sourceWhitePoint, LMS, result) {
  7974. const D65X = 0.95047;
  7975. const D65Y = 1;
  7976. const D65Z = 1.08883;
  7977. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  7978. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  7979. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  7980. }
  7981. function sRGBTransferFunction(color) {
  7982. if (color <= 0.0031308) {
  7983. return adjustToRange(0, 1, 12.92 * color);
  7984. }
  7985. if (color >= 0.99554525) {
  7986. return 1;
  7987. }
  7988. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  7989. }
  7990. function adjustToRange(min, max, value) {
  7991. return Math.max(min, Math.min(max, value));
  7992. }
  7993. function decodeL(L) {
  7994. if (L < 0) {
  7995. return -decodeL(-L);
  7996. }
  7997. if (L > 8.0) {
  7998. return ((L + 16) / 116) ** 3;
  7999. }
  8000. return L * DECODE_L_CONSTANT;
  8001. }
  8002. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  8003. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  8004. result[0] = XYZ_Flat[0];
  8005. result[1] = XYZ_Flat[1];
  8006. result[2] = XYZ_Flat[2];
  8007. return;
  8008. }
  8009. const zeroDecodeL = decodeL(0);
  8010. const X_DST = zeroDecodeL;
  8011. const X_SRC = decodeL(sourceBlackPoint[0]);
  8012. const Y_DST = zeroDecodeL;
  8013. const Y_SRC = decodeL(sourceBlackPoint[1]);
  8014. const Z_DST = zeroDecodeL;
  8015. const Z_SRC = decodeL(sourceBlackPoint[2]);
  8016. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  8017. const X_Offset = 1 - X_Scale;
  8018. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  8019. const Y_Offset = 1 - Y_Scale;
  8020. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  8021. const Z_Offset = 1 - Z_Scale;
  8022. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  8023. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  8024. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  8025. }
  8026. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  8027. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  8028. result[0] = XYZ_In[0];
  8029. result[1] = XYZ_In[1];
  8030. result[2] = XYZ_In[2];
  8031. return;
  8032. }
  8033. const LMS = result;
  8034. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8035. const LMS_Flat = tempNormalizeMatrix;
  8036. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  8037. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  8038. }
  8039. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  8040. const LMS = result;
  8041. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8042. const LMS_D65 = tempNormalizeMatrix;
  8043. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  8044. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  8045. }
  8046. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8047. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  8048. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  8049. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  8050. const AGR = A === 1 ? 1 : A ** cs.GR;
  8051. const BGG = B === 1 ? 1 : B ** cs.GG;
  8052. const CGB = C === 1 ? 1 : C ** cs.GB;
  8053. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  8054. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  8055. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  8056. const XYZ = tempConvertMatrix1;
  8057. XYZ[0] = X;
  8058. XYZ[1] = Y;
  8059. XYZ[2] = Z;
  8060. const XYZ_Flat = tempConvertMatrix2;
  8061. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  8062. const XYZ_Black = tempConvertMatrix1;
  8063. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  8064. const XYZ_D65 = tempConvertMatrix2;
  8065. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  8066. const SRGB = tempConvertMatrix1;
  8067. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  8068. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  8069. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  8070. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  8071. }
  8072. class CalRGBCS extends ColorSpace {
  8073. constructor(whitePoint, blackPoint, gamma, matrix) {
  8074. super("CalRGB", 3);
  8075. if (!whitePoint) {
  8076. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  8077. }
  8078. blackPoint = blackPoint || new Float32Array(3);
  8079. gamma = gamma || new Float32Array([1, 1, 1]);
  8080. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  8081. const XW = whitePoint[0];
  8082. const YW = whitePoint[1];
  8083. const ZW = whitePoint[2];
  8084. this.whitePoint = whitePoint;
  8085. const XB = blackPoint[0];
  8086. const YB = blackPoint[1];
  8087. const ZB = blackPoint[2];
  8088. this.blackPoint = blackPoint;
  8089. this.GR = gamma[0];
  8090. this.GG = gamma[1];
  8091. this.GB = gamma[2];
  8092. this.MXA = matrix[0];
  8093. this.MYA = matrix[1];
  8094. this.MZA = matrix[2];
  8095. this.MXB = matrix[3];
  8096. this.MYB = matrix[4];
  8097. this.MZB = matrix[5];
  8098. this.MXC = matrix[6];
  8099. this.MYC = matrix[7];
  8100. this.MZC = matrix[8];
  8101. if (XW < 0 || ZW < 0 || YW !== 1) {
  8102. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  8103. }
  8104. if (XB < 0 || YB < 0 || ZB < 0) {
  8105. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  8106. this.blackPoint = new Float32Array(3);
  8107. }
  8108. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  8109. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  8110. this.GR = this.GG = this.GB = 1;
  8111. }
  8112. }
  8113. getRgbItem(src, srcOffset, dest, destOffset) {
  8114. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8115. }
  8116. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8117. const scale = 1 / ((1 << bits) - 1);
  8118. for (let i = 0; i < count; ++i) {
  8119. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8120. srcOffset += 3;
  8121. destOffset += 3 + alpha01;
  8122. }
  8123. }
  8124. getOutputLength(inputLength, alpha01) {
  8125. return inputLength * (3 + alpha01) / 3 | 0;
  8126. }
  8127. }
  8128. return CalRGBCS;
  8129. }();
  8130. const LabCS = function LabCSClosure() {
  8131. function fn_g(x) {
  8132. let result;
  8133. if (x >= 6 / 29) {
  8134. result = x ** 3;
  8135. } else {
  8136. result = 108 / 841 * (x - 4 / 29);
  8137. }
  8138. return result;
  8139. }
  8140. function decode(value, high1, low2, high2) {
  8141. return low2 + value * (high2 - low2) / high1;
  8142. }
  8143. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  8144. let Ls = src[srcOffset];
  8145. let as = src[srcOffset + 1];
  8146. let bs = src[srcOffset + 2];
  8147. if (maxVal !== false) {
  8148. Ls = decode(Ls, maxVal, 0, 100);
  8149. as = decode(as, maxVal, cs.amin, cs.amax);
  8150. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  8151. }
  8152. if (as > cs.amax) {
  8153. as = cs.amax;
  8154. } else if (as < cs.amin) {
  8155. as = cs.amin;
  8156. }
  8157. if (bs > cs.bmax) {
  8158. bs = cs.bmax;
  8159. } else if (bs < cs.bmin) {
  8160. bs = cs.bmin;
  8161. }
  8162. const M = (Ls + 16) / 116;
  8163. const L = M + as / 500;
  8164. const N = M - bs / 200;
  8165. const X = cs.XW * fn_g(L);
  8166. const Y = cs.YW * fn_g(M);
  8167. const Z = cs.ZW * fn_g(N);
  8168. let r, g, b;
  8169. if (cs.ZW < 1) {
  8170. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  8171. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  8172. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  8173. } else {
  8174. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  8175. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  8176. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  8177. }
  8178. dest[destOffset] = Math.sqrt(r) * 255;
  8179. dest[destOffset + 1] = Math.sqrt(g) * 255;
  8180. dest[destOffset + 2] = Math.sqrt(b) * 255;
  8181. }
  8182. class LabCS extends ColorSpace {
  8183. constructor(whitePoint, blackPoint, range) {
  8184. super("Lab", 3);
  8185. if (!whitePoint) {
  8186. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  8187. }
  8188. blackPoint = blackPoint || [0, 0, 0];
  8189. range = range || [-100, 100, -100, 100];
  8190. this.XW = whitePoint[0];
  8191. this.YW = whitePoint[1];
  8192. this.ZW = whitePoint[2];
  8193. this.amin = range[0];
  8194. this.amax = range[1];
  8195. this.bmin = range[2];
  8196. this.bmax = range[3];
  8197. this.XB = blackPoint[0];
  8198. this.YB = blackPoint[1];
  8199. this.ZB = blackPoint[2];
  8200. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8201. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  8202. }
  8203. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8204. (0, _util.info)("Invalid BlackPoint, falling back to default");
  8205. this.XB = this.YB = this.ZB = 0;
  8206. }
  8207. if (this.amin > this.amax || this.bmin > this.bmax) {
  8208. (0, _util.info)("Invalid Range, falling back to defaults");
  8209. this.amin = -100;
  8210. this.amax = 100;
  8211. this.bmin = -100;
  8212. this.bmax = 100;
  8213. }
  8214. }
  8215. getRgbItem(src, srcOffset, dest, destOffset) {
  8216. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  8217. }
  8218. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8219. const maxVal = (1 << bits) - 1;
  8220. for (let i = 0; i < count; i++) {
  8221. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  8222. srcOffset += 3;
  8223. destOffset += 3 + alpha01;
  8224. }
  8225. }
  8226. getOutputLength(inputLength, alpha01) {
  8227. return inputLength * (3 + alpha01) / 3 | 0;
  8228. }
  8229. isDefaultDecode(decodeMap, bpc) {
  8230. return true;
  8231. }
  8232. get usesZeroToOneRange() {
  8233. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  8234. }
  8235. }
  8236. return LabCS;
  8237. }();
  8238. /***/ }),
  8239. /* 13 */
  8240. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8241. Object.defineProperty(exports, "__esModule", ({
  8242. value: true
  8243. }));
  8244. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  8245. var _util = __w_pdfjs_require__(2);
  8246. var _cmap = __w_pdfjs_require__(14);
  8247. var _primitives = __w_pdfjs_require__(3);
  8248. var _fonts = __w_pdfjs_require__(32);
  8249. var _fonts_utils = __w_pdfjs_require__(36);
  8250. var _encodings = __w_pdfjs_require__(35);
  8251. var _standard_fonts = __w_pdfjs_require__(39);
  8252. var _pattern = __w_pdfjs_require__(48);
  8253. var _xfa_fonts = __w_pdfjs_require__(49);
  8254. var _to_unicode_map = __w_pdfjs_require__(40);
  8255. var _function = __w_pdfjs_require__(55);
  8256. var _parser = __w_pdfjs_require__(15);
  8257. var _image_utils = __w_pdfjs_require__(57);
  8258. var _stream = __w_pdfjs_require__(8);
  8259. var _base_stream = __w_pdfjs_require__(5);
  8260. var _bidi = __w_pdfjs_require__(58);
  8261. var _colorspace = __w_pdfjs_require__(12);
  8262. var _decode_stream = __w_pdfjs_require__(17);
  8263. var _glyphlist = __w_pdfjs_require__(37);
  8264. var _core_utils = __w_pdfjs_require__(4);
  8265. var _metrics = __w_pdfjs_require__(43);
  8266. var _unicode = __w_pdfjs_require__(38);
  8267. var _murmurhash = __w_pdfjs_require__(59);
  8268. var _operator_list = __w_pdfjs_require__(60);
  8269. var _image = __w_pdfjs_require__(61);
  8270. const DefaultPartialEvaluatorOptions = Object.freeze({
  8271. maxImageSize: -1,
  8272. disableFontFace: false,
  8273. ignoreErrors: false,
  8274. isEvalSupported: true,
  8275. isOffscreenCanvasSupported: true,
  8276. fontExtraProperties: false,
  8277. useSystemFonts: true,
  8278. cMapUrl: null,
  8279. standardFontDataUrl: null
  8280. });
  8281. const PatternType = {
  8282. TILING: 1,
  8283. SHADING: 2
  8284. };
  8285. const TEXT_CHUNK_BATCH_SIZE = 10;
  8286. const deferred = Promise.resolve();
  8287. function normalizeBlendMode(value, parsingArray = false) {
  8288. if (Array.isArray(value)) {
  8289. for (const val of value) {
  8290. const maybeBM = normalizeBlendMode(val, true);
  8291. if (maybeBM) {
  8292. return maybeBM;
  8293. }
  8294. }
  8295. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  8296. return "source-over";
  8297. }
  8298. if (!(value instanceof _primitives.Name)) {
  8299. if (parsingArray) {
  8300. return null;
  8301. }
  8302. return "source-over";
  8303. }
  8304. switch (value.name) {
  8305. case "Normal":
  8306. case "Compatible":
  8307. return "source-over";
  8308. case "Multiply":
  8309. return "multiply";
  8310. case "Screen":
  8311. return "screen";
  8312. case "Overlay":
  8313. return "overlay";
  8314. case "Darken":
  8315. return "darken";
  8316. case "Lighten":
  8317. return "lighten";
  8318. case "ColorDodge":
  8319. return "color-dodge";
  8320. case "ColorBurn":
  8321. return "color-burn";
  8322. case "HardLight":
  8323. return "hard-light";
  8324. case "SoftLight":
  8325. return "soft-light";
  8326. case "Difference":
  8327. return "difference";
  8328. case "Exclusion":
  8329. return "exclusion";
  8330. case "Hue":
  8331. return "hue";
  8332. case "Saturation":
  8333. return "saturation";
  8334. case "Color":
  8335. return "color";
  8336. case "Luminosity":
  8337. return "luminosity";
  8338. }
  8339. if (parsingArray) {
  8340. return null;
  8341. }
  8342. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  8343. return "source-over";
  8344. }
  8345. function incrementCachedImageMaskCount(data) {
  8346. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  8347. data.args[0].count++;
  8348. }
  8349. }
  8350. class TimeSlotManager {
  8351. static get TIME_SLOT_DURATION_MS() {
  8352. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  8353. }
  8354. static get CHECK_TIME_EVERY() {
  8355. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  8356. }
  8357. constructor() {
  8358. this.reset();
  8359. }
  8360. check() {
  8361. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  8362. return false;
  8363. }
  8364. this.checked = 0;
  8365. return this.endTime <= Date.now();
  8366. }
  8367. reset() {
  8368. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  8369. this.checked = 0;
  8370. }
  8371. }
  8372. class PartialEvaluator {
  8373. constructor({
  8374. xref,
  8375. handler,
  8376. pageIndex,
  8377. idFactory,
  8378. fontCache,
  8379. builtInCMapCache,
  8380. standardFontDataCache,
  8381. globalImageCache,
  8382. options = null
  8383. }) {
  8384. this.xref = xref;
  8385. this.handler = handler;
  8386. this.pageIndex = pageIndex;
  8387. this.idFactory = idFactory;
  8388. this.fontCache = fontCache;
  8389. this.builtInCMapCache = builtInCMapCache;
  8390. this.standardFontDataCache = standardFontDataCache;
  8391. this.globalImageCache = globalImageCache;
  8392. this.options = options || DefaultPartialEvaluatorOptions;
  8393. this.parsingType3Font = false;
  8394. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  8395. }
  8396. get _pdfFunctionFactory() {
  8397. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  8398. xref: this.xref,
  8399. isEvalSupported: this.options.isEvalSupported
  8400. });
  8401. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  8402. }
  8403. clone(newOptions = null) {
  8404. const newEvaluator = Object.create(this);
  8405. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  8406. return newEvaluator;
  8407. }
  8408. hasBlendModes(resources, nonBlendModesSet) {
  8409. if (!(resources instanceof _primitives.Dict)) {
  8410. return false;
  8411. }
  8412. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  8413. return false;
  8414. }
  8415. const processed = new _primitives.RefSet(nonBlendModesSet);
  8416. if (resources.objId) {
  8417. processed.put(resources.objId);
  8418. }
  8419. const nodes = [resources],
  8420. xref = this.xref;
  8421. while (nodes.length) {
  8422. const node = nodes.shift();
  8423. const graphicStates = node.get("ExtGState");
  8424. if (graphicStates instanceof _primitives.Dict) {
  8425. for (let graphicState of graphicStates.getRawValues()) {
  8426. if (graphicState instanceof _primitives.Ref) {
  8427. if (processed.has(graphicState)) {
  8428. continue;
  8429. }
  8430. try {
  8431. graphicState = xref.fetch(graphicState);
  8432. } catch (ex) {
  8433. processed.put(graphicState);
  8434. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  8435. continue;
  8436. }
  8437. }
  8438. if (!(graphicState instanceof _primitives.Dict)) {
  8439. continue;
  8440. }
  8441. if (graphicState.objId) {
  8442. processed.put(graphicState.objId);
  8443. }
  8444. const bm = graphicState.get("BM");
  8445. if (bm instanceof _primitives.Name) {
  8446. if (bm.name !== "Normal") {
  8447. return true;
  8448. }
  8449. continue;
  8450. }
  8451. if (bm !== undefined && Array.isArray(bm)) {
  8452. for (const element of bm) {
  8453. if (element instanceof _primitives.Name && element.name !== "Normal") {
  8454. return true;
  8455. }
  8456. }
  8457. }
  8458. }
  8459. }
  8460. const xObjects = node.get("XObject");
  8461. if (!(xObjects instanceof _primitives.Dict)) {
  8462. continue;
  8463. }
  8464. for (let xObject of xObjects.getRawValues()) {
  8465. if (xObject instanceof _primitives.Ref) {
  8466. if (processed.has(xObject)) {
  8467. continue;
  8468. }
  8469. try {
  8470. xObject = xref.fetch(xObject);
  8471. } catch (ex) {
  8472. processed.put(xObject);
  8473. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  8474. continue;
  8475. }
  8476. }
  8477. if (!(xObject instanceof _base_stream.BaseStream)) {
  8478. continue;
  8479. }
  8480. if (xObject.dict.objId) {
  8481. processed.put(xObject.dict.objId);
  8482. }
  8483. const xResources = xObject.dict.get("Resources");
  8484. if (!(xResources instanceof _primitives.Dict)) {
  8485. continue;
  8486. }
  8487. if (xResources.objId && processed.has(xResources.objId)) {
  8488. continue;
  8489. }
  8490. nodes.push(xResources);
  8491. if (xResources.objId) {
  8492. processed.put(xResources.objId);
  8493. }
  8494. }
  8495. }
  8496. for (const ref of processed) {
  8497. nonBlendModesSet.put(ref);
  8498. }
  8499. return false;
  8500. }
  8501. async fetchBuiltInCMap(name) {
  8502. const cachedData = this.builtInCMapCache.get(name);
  8503. if (cachedData) {
  8504. return cachedData;
  8505. }
  8506. let data;
  8507. if (this.options.cMapUrl !== null) {
  8508. const url = `${this.options.cMapUrl}${name}.bcmap`;
  8509. const response = await fetch(url);
  8510. if (!response.ok) {
  8511. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  8512. }
  8513. data = {
  8514. cMapData: new Uint8Array(await response.arrayBuffer()),
  8515. compressionType: _util.CMapCompressionType.BINARY
  8516. };
  8517. } else {
  8518. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  8519. name
  8520. });
  8521. }
  8522. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  8523. this.builtInCMapCache.set(name, data);
  8524. }
  8525. return data;
  8526. }
  8527. async fetchStandardFontData(name) {
  8528. const cachedData = this.standardFontDataCache.get(name);
  8529. if (cachedData) {
  8530. return new _stream.Stream(cachedData);
  8531. }
  8532. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  8533. return null;
  8534. }
  8535. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  8536. filename = standardFontNameToFileName[name];
  8537. let data;
  8538. if (this.options.standardFontDataUrl !== null) {
  8539. const url = `${this.options.standardFontDataUrl}${filename}`;
  8540. const response = await fetch(url);
  8541. if (!response.ok) {
  8542. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  8543. } else {
  8544. data = await response.arrayBuffer();
  8545. }
  8546. } else {
  8547. try {
  8548. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  8549. filename
  8550. });
  8551. } catch (e) {
  8552. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  8553. }
  8554. }
  8555. if (!data) {
  8556. return null;
  8557. }
  8558. this.standardFontDataCache.set(name, data);
  8559. return new _stream.Stream(data);
  8560. }
  8561. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  8562. const dict = xobj.dict;
  8563. const matrix = dict.getArray("Matrix");
  8564. let bbox = dict.getArray("BBox");
  8565. if (Array.isArray(bbox) && bbox.length === 4) {
  8566. bbox = _util.Util.normalizeRect(bbox);
  8567. } else {
  8568. bbox = null;
  8569. }
  8570. let optionalContent, groupOptions;
  8571. if (dict.has("OC")) {
  8572. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8573. }
  8574. if (optionalContent !== undefined) {
  8575. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8576. }
  8577. const group = dict.get("Group");
  8578. if (group) {
  8579. groupOptions = {
  8580. matrix,
  8581. bbox,
  8582. smask,
  8583. isolated: false,
  8584. knockout: false
  8585. };
  8586. const groupSubtype = group.get("S");
  8587. let colorSpace = null;
  8588. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  8589. groupOptions.isolated = group.get("I") || false;
  8590. groupOptions.knockout = group.get("K") || false;
  8591. if (group.has("CS")) {
  8592. const cs = group.getRaw("CS");
  8593. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  8594. if (cachedColorSpace) {
  8595. colorSpace = cachedColorSpace;
  8596. } else {
  8597. colorSpace = await this.parseColorSpace({
  8598. cs,
  8599. resources,
  8600. localColorSpaceCache
  8601. });
  8602. }
  8603. }
  8604. }
  8605. if (smask && smask.backdrop) {
  8606. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  8607. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  8608. }
  8609. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  8610. }
  8611. const args = group ? [matrix, null] : [matrix, bbox];
  8612. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  8613. return this.getOperatorList({
  8614. stream: xobj,
  8615. task,
  8616. resources: dict.get("Resources") || resources,
  8617. operatorList,
  8618. initialState
  8619. }).then(function () {
  8620. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  8621. if (group) {
  8622. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  8623. }
  8624. if (optionalContent !== undefined) {
  8625. operatorList.addOp(_util.OPS.endMarkedContent, []);
  8626. }
  8627. });
  8628. }
  8629. _sendImgData(objId, imgData, cacheGlobally = false) {
  8630. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  8631. if (this.parsingType3Font || cacheGlobally) {
  8632. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  8633. }
  8634. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  8635. }
  8636. async buildPaintImageXObject({
  8637. resources,
  8638. image,
  8639. isInline = false,
  8640. operatorList,
  8641. cacheKey,
  8642. localImageCache,
  8643. localColorSpaceCache
  8644. }) {
  8645. const dict = image.dict;
  8646. const imageRef = dict.objId;
  8647. const w = dict.get("W", "Width");
  8648. const h = dict.get("H", "Height");
  8649. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  8650. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  8651. return;
  8652. }
  8653. const maxImageSize = this.options.maxImageSize;
  8654. if (maxImageSize !== -1 && w * h > maxImageSize) {
  8655. const msg = "Image exceeded maximum allowed size and was removed.";
  8656. if (this.options.ignoreErrors) {
  8657. (0, _util.warn)(msg);
  8658. return;
  8659. }
  8660. throw new Error(msg);
  8661. }
  8662. let optionalContent;
  8663. if (dict.has("OC")) {
  8664. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8665. }
  8666. const imageMask = dict.get("IM", "ImageMask") || false;
  8667. let imgData, args;
  8668. if (imageMask) {
  8669. const interpolate = dict.get("I", "Interpolate");
  8670. const bitStrideLength = w + 7 >> 3;
  8671. const imgArray = image.getBytes(bitStrideLength * h);
  8672. const decode = dict.getArray("D", "Decode");
  8673. if (this.parsingType3Font) {
  8674. imgData = _image.PDFImage.createRawMask({
  8675. imgArray,
  8676. width: w,
  8677. height: h,
  8678. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8679. inverseDecode: !!decode && decode[0] > 0,
  8680. interpolate
  8681. });
  8682. imgData.cached = !!cacheKey;
  8683. args = [imgData];
  8684. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8685. if (cacheKey) {
  8686. localImageCache.set(cacheKey, imageRef, {
  8687. fn: _util.OPS.paintImageMaskXObject,
  8688. args,
  8689. optionalContent
  8690. });
  8691. }
  8692. return;
  8693. }
  8694. imgData = _image.PDFImage.createMask({
  8695. imgArray,
  8696. width: w,
  8697. height: h,
  8698. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8699. inverseDecode: !!decode && decode[0] > 0,
  8700. interpolate,
  8701. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  8702. });
  8703. if (imgData.isSingleOpaquePixel) {
  8704. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  8705. if (cacheKey) {
  8706. localImageCache.set(cacheKey, imageRef, {
  8707. fn: _util.OPS.paintSolidColorImageMask,
  8708. args: [],
  8709. optionalContent
  8710. });
  8711. }
  8712. return;
  8713. }
  8714. const objId = `mask_${this.idFactory.createObjId()}`;
  8715. operatorList.addDependency(objId);
  8716. this._sendImgData(objId, imgData);
  8717. args = [{
  8718. data: objId,
  8719. width: imgData.width,
  8720. height: imgData.height,
  8721. interpolate: imgData.interpolate,
  8722. count: 1
  8723. }];
  8724. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8725. if (cacheKey) {
  8726. localImageCache.set(cacheKey, imageRef, {
  8727. fn: _util.OPS.paintImageMaskXObject,
  8728. args,
  8729. optionalContent
  8730. });
  8731. }
  8732. return;
  8733. }
  8734. const softMask = dict.get("SM", "SMask") || false;
  8735. const mask = dict.get("Mask") || false;
  8736. const SMALL_IMAGE_DIMENSIONS = 200;
  8737. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  8738. const imageObj = new _image.PDFImage({
  8739. xref: this.xref,
  8740. res: resources,
  8741. image,
  8742. isInline,
  8743. pdfFunctionFactory: this._pdfFunctionFactory,
  8744. localColorSpaceCache
  8745. });
  8746. imgData = imageObj.createImageData(true);
  8747. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  8748. return;
  8749. }
  8750. let objId = `img_${this.idFactory.createObjId()}`,
  8751. cacheGlobally = false;
  8752. if (this.parsingType3Font) {
  8753. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  8754. } else if (imageRef) {
  8755. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  8756. if (cacheGlobally) {
  8757. objId = `${this.idFactory.getDocId()}_${objId}`;
  8758. }
  8759. }
  8760. operatorList.addDependency(objId);
  8761. args = [objId, w, h];
  8762. _image.PDFImage.buildImage({
  8763. xref: this.xref,
  8764. res: resources,
  8765. image,
  8766. isInline,
  8767. pdfFunctionFactory: this._pdfFunctionFactory,
  8768. localColorSpaceCache
  8769. }).then(imageObj => {
  8770. imgData = imageObj.createImageData(false);
  8771. if (cacheKey && imageRef && cacheGlobally) {
  8772. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  8773. }
  8774. return this._sendImgData(objId, imgData, cacheGlobally);
  8775. }).catch(reason => {
  8776. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  8777. return this._sendImgData(objId, null, cacheGlobally);
  8778. });
  8779. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  8780. if (cacheKey) {
  8781. localImageCache.set(cacheKey, imageRef, {
  8782. fn: _util.OPS.paintImageXObject,
  8783. args,
  8784. optionalContent
  8785. });
  8786. if (imageRef) {
  8787. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  8788. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  8789. if (cacheGlobally) {
  8790. this.globalImageCache.setData(imageRef, {
  8791. objId,
  8792. fn: _util.OPS.paintImageXObject,
  8793. args,
  8794. optionalContent,
  8795. byteSize: 0
  8796. });
  8797. }
  8798. }
  8799. }
  8800. }
  8801. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  8802. const smaskContent = smask.get("G");
  8803. const smaskOptions = {
  8804. subtype: smask.get("S").name,
  8805. backdrop: smask.get("BC")
  8806. };
  8807. const transferObj = smask.get("TR");
  8808. if ((0, _function.isPDFFunction)(transferObj)) {
  8809. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8810. const transferMap = new Uint8Array(256);
  8811. const tmp = new Float32Array(1);
  8812. for (let i = 0; i < 256; i++) {
  8813. tmp[0] = i / 255;
  8814. transferFn(tmp, 0, tmp, 0);
  8815. transferMap[i] = tmp[0] * 255 | 0;
  8816. }
  8817. smaskOptions.transferMap = transferMap;
  8818. }
  8819. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  8820. }
  8821. handleTransferFunction(tr) {
  8822. let transferArray;
  8823. if (Array.isArray(tr)) {
  8824. transferArray = tr;
  8825. } else if ((0, _function.isPDFFunction)(tr)) {
  8826. transferArray = [tr];
  8827. } else {
  8828. return null;
  8829. }
  8830. const transferMaps = [];
  8831. let numFns = 0,
  8832. numEffectfulFns = 0;
  8833. for (const entry of transferArray) {
  8834. const transferObj = this.xref.fetchIfRef(entry);
  8835. numFns++;
  8836. if ((0, _primitives.isName)(transferObj, "Identity")) {
  8837. transferMaps.push(null);
  8838. continue;
  8839. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  8840. return null;
  8841. }
  8842. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8843. const transferMap = new Uint8Array(256),
  8844. tmp = new Float32Array(1);
  8845. for (let j = 0; j < 256; j++) {
  8846. tmp[0] = j / 255;
  8847. transferFn(tmp, 0, tmp, 0);
  8848. transferMap[j] = tmp[0] * 255 | 0;
  8849. }
  8850. transferMaps.push(transferMap);
  8851. numEffectfulFns++;
  8852. }
  8853. if (!(numFns === 1 || numFns === 4)) {
  8854. return null;
  8855. }
  8856. if (numEffectfulFns === 0) {
  8857. return null;
  8858. }
  8859. return transferMaps;
  8860. }
  8861. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  8862. const tilingOpList = new _operator_list.OperatorList();
  8863. const patternResources = _primitives.Dict.merge({
  8864. xref: this.xref,
  8865. dictArray: [patternDict.get("Resources"), resources]
  8866. });
  8867. return this.getOperatorList({
  8868. stream: pattern,
  8869. task,
  8870. resources: patternResources,
  8871. operatorList: tilingOpList
  8872. }).then(function () {
  8873. const operatorListIR = tilingOpList.getIR();
  8874. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  8875. operatorList.addDependencies(tilingOpList.dependencies);
  8876. operatorList.addOp(fn, tilingPatternIR);
  8877. if (patternDict.objId) {
  8878. localTilingPatternCache.set(null, patternDict.objId, {
  8879. operatorListIR,
  8880. dict: patternDict
  8881. });
  8882. }
  8883. }).catch(reason => {
  8884. if (reason instanceof _util.AbortException) {
  8885. return;
  8886. }
  8887. if (this.options.ignoreErrors) {
  8888. this.handler.send("UnsupportedFeature", {
  8889. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  8890. });
  8891. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  8892. return;
  8893. }
  8894. throw reason;
  8895. });
  8896. }
  8897. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  8898. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  8899. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  8900. if (!translated.font.isType3Font) {
  8901. return translated;
  8902. }
  8903. return translated.loadType3Data(this, resources, task).then(function () {
  8904. operatorList.addDependencies(translated.type3Dependencies);
  8905. return translated;
  8906. }).catch(reason => {
  8907. this.handler.send("UnsupportedFeature", {
  8908. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  8909. });
  8910. return new TranslatedFont({
  8911. loadedName: "g_font_error",
  8912. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  8913. dict: translated.font,
  8914. evaluatorOptions: this.options
  8915. });
  8916. });
  8917. }).then(translated => {
  8918. state.font = translated.font;
  8919. translated.send(this.handler);
  8920. return translated.loadedName;
  8921. });
  8922. }
  8923. handleText(chars, state) {
  8924. const font = state.font;
  8925. const glyphs = font.charsToGlyphs(chars);
  8926. if (font.data) {
  8927. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  8928. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  8929. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  8930. }
  8931. }
  8932. return glyphs;
  8933. }
  8934. ensureStateFont(state) {
  8935. if (state.font) {
  8936. return;
  8937. }
  8938. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  8939. if (this.options.ignoreErrors) {
  8940. this.handler.send("UnsupportedFeature", {
  8941. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  8942. });
  8943. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  8944. return;
  8945. }
  8946. throw reason;
  8947. }
  8948. async setGState({
  8949. resources,
  8950. gState,
  8951. operatorList,
  8952. cacheKey,
  8953. task,
  8954. stateManager,
  8955. localGStateCache,
  8956. localColorSpaceCache
  8957. }) {
  8958. const gStateRef = gState.objId;
  8959. let isSimpleGState = true;
  8960. const gStateObj = [];
  8961. let promise = Promise.resolve();
  8962. for (const key of gState.getKeys()) {
  8963. const value = gState.get(key);
  8964. switch (key) {
  8965. case "Type":
  8966. break;
  8967. case "LW":
  8968. case "LC":
  8969. case "LJ":
  8970. case "ML":
  8971. case "D":
  8972. case "RI":
  8973. case "FL":
  8974. case "CA":
  8975. case "ca":
  8976. gStateObj.push([key, value]);
  8977. break;
  8978. case "Font":
  8979. isSimpleGState = false;
  8980. promise = promise.then(() => {
  8981. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  8982. operatorList.addDependency(loadedName);
  8983. gStateObj.push([key, [loadedName, value[1]]]);
  8984. });
  8985. });
  8986. break;
  8987. case "BM":
  8988. gStateObj.push([key, normalizeBlendMode(value)]);
  8989. break;
  8990. case "SMask":
  8991. if ((0, _primitives.isName)(value, "None")) {
  8992. gStateObj.push([key, false]);
  8993. break;
  8994. }
  8995. if (value instanceof _primitives.Dict) {
  8996. isSimpleGState = false;
  8997. promise = promise.then(() => {
  8998. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  8999. });
  9000. gStateObj.push([key, true]);
  9001. } else {
  9002. (0, _util.warn)("Unsupported SMask type");
  9003. }
  9004. break;
  9005. case "TR":
  9006. const transferMaps = this.handleTransferFunction(value);
  9007. gStateObj.push([key, transferMaps]);
  9008. break;
  9009. case "OP":
  9010. case "op":
  9011. case "OPM":
  9012. case "BG":
  9013. case "BG2":
  9014. case "UCR":
  9015. case "UCR2":
  9016. case "TR2":
  9017. case "HT":
  9018. case "SM":
  9019. case "SA":
  9020. case "AIS":
  9021. case "TK":
  9022. (0, _util.info)("graphic state operator " + key);
  9023. break;
  9024. default:
  9025. (0, _util.info)("Unknown graphic state operator " + key);
  9026. break;
  9027. }
  9028. }
  9029. return promise.then(function () {
  9030. if (gStateObj.length > 0) {
  9031. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  9032. }
  9033. if (isSimpleGState) {
  9034. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  9035. }
  9036. });
  9037. }
  9038. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  9039. const errorFont = async () => {
  9040. return new TranslatedFont({
  9041. loadedName: "g_font_error",
  9042. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  9043. dict: font,
  9044. evaluatorOptions: this.options
  9045. });
  9046. };
  9047. const xref = this.xref;
  9048. let fontRef;
  9049. if (font) {
  9050. if (font instanceof _primitives.Ref) {
  9051. fontRef = font;
  9052. }
  9053. } else {
  9054. const fontRes = resources.get("Font");
  9055. if (fontRes) {
  9056. fontRef = fontRes.getRaw(fontName);
  9057. }
  9058. }
  9059. if (!fontRef) {
  9060. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  9061. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  9062. (0, _util.warn)(`${partialMsg}.`);
  9063. return errorFont();
  9064. }
  9065. this.handler.send("UnsupportedFeature", {
  9066. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  9067. });
  9068. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  9069. if (fallbackFontDict) {
  9070. fontRef = fallbackFontDict;
  9071. } else {
  9072. fontRef = PartialEvaluator.fallbackFontDict;
  9073. }
  9074. }
  9075. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  9076. return errorFont();
  9077. }
  9078. if (this.fontCache.has(fontRef)) {
  9079. return this.fontCache.get(fontRef);
  9080. }
  9081. font = xref.fetchIfRef(fontRef);
  9082. if (!(font instanceof _primitives.Dict)) {
  9083. return errorFont();
  9084. }
  9085. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  9086. return this.fontCache.get(font.cacheKey);
  9087. }
  9088. const fontCapability = (0, _util.createPromiseCapability)();
  9089. let preEvaluatedFont;
  9090. try {
  9091. preEvaluatedFont = this.preEvaluateFont(font);
  9092. preEvaluatedFont.cssFontInfo = cssFontInfo;
  9093. } catch (reason) {
  9094. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  9095. return errorFont();
  9096. }
  9097. const {
  9098. descriptor,
  9099. hash
  9100. } = preEvaluatedFont;
  9101. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  9102. let fontID;
  9103. if (fontRefIsRef) {
  9104. fontID = `f${fontRef.toString()}`;
  9105. }
  9106. if (hash && descriptor instanceof _primitives.Dict) {
  9107. if (!descriptor.fontAliases) {
  9108. descriptor.fontAliases = Object.create(null);
  9109. }
  9110. const fontAliases = descriptor.fontAliases;
  9111. if (fontAliases[hash]) {
  9112. const aliasFontRef = fontAliases[hash].aliasRef;
  9113. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  9114. this.fontCache.putAlias(fontRef, aliasFontRef);
  9115. return this.fontCache.get(fontRef);
  9116. }
  9117. } else {
  9118. fontAliases[hash] = {
  9119. fontID: this.idFactory.createFontId()
  9120. };
  9121. }
  9122. if (fontRefIsRef) {
  9123. fontAliases[hash].aliasRef = fontRef;
  9124. }
  9125. fontID = fontAliases[hash].fontID;
  9126. }
  9127. if (fontRefIsRef) {
  9128. this.fontCache.put(fontRef, fontCapability.promise);
  9129. } else {
  9130. if (!fontID) {
  9131. fontID = this.idFactory.createFontId();
  9132. }
  9133. font.cacheKey = `cacheKey_${fontID}`;
  9134. this.fontCache.put(font.cacheKey, fontCapability.promise);
  9135. }
  9136. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  9137. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  9138. this.translateFont(preEvaluatedFont).then(translatedFont => {
  9139. if (translatedFont.fontType !== undefined) {
  9140. xref.stats.addFontType(translatedFont.fontType);
  9141. }
  9142. fontCapability.resolve(new TranslatedFont({
  9143. loadedName: font.loadedName,
  9144. font: translatedFont,
  9145. dict: font,
  9146. evaluatorOptions: this.options
  9147. }));
  9148. }).catch(reason => {
  9149. this.handler.send("UnsupportedFeature", {
  9150. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  9151. });
  9152. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  9153. try {
  9154. const fontFile3 = descriptor && descriptor.get("FontFile3");
  9155. const subtype = fontFile3 && fontFile3.get("Subtype");
  9156. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  9157. if (fontType !== undefined) {
  9158. xref.stats.addFontType(fontType);
  9159. }
  9160. } catch (ex) {}
  9161. fontCapability.resolve(new TranslatedFont({
  9162. loadedName: font.loadedName,
  9163. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  9164. dict: font,
  9165. evaluatorOptions: this.options
  9166. }));
  9167. });
  9168. return fontCapability.promise;
  9169. }
  9170. buildPath(operatorList, fn, args, parsingText = false) {
  9171. const lastIndex = operatorList.length - 1;
  9172. if (!args) {
  9173. args = [];
  9174. }
  9175. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  9176. if (parsingText) {
  9177. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  9178. operatorList.addOp(_util.OPS.save, null);
  9179. }
  9180. let minMax;
  9181. switch (fn) {
  9182. case _util.OPS.rectangle:
  9183. const x = args[0] + args[2];
  9184. const y = args[1] + args[3];
  9185. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  9186. break;
  9187. case _util.OPS.moveTo:
  9188. case _util.OPS.lineTo:
  9189. minMax = [args[0], args[0], args[1], args[1]];
  9190. break;
  9191. default:
  9192. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  9193. break;
  9194. }
  9195. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  9196. if (parsingText) {
  9197. operatorList.addOp(_util.OPS.restore, null);
  9198. }
  9199. } else {
  9200. const opArgs = operatorList.argsArray[lastIndex];
  9201. opArgs[0].push(fn);
  9202. opArgs[1].push(...args);
  9203. const minMax = opArgs[2];
  9204. switch (fn) {
  9205. case _util.OPS.rectangle:
  9206. const x = args[0] + args[2];
  9207. const y = args[1] + args[3];
  9208. minMax[0] = Math.min(minMax[0], args[0], x);
  9209. minMax[1] = Math.max(minMax[1], args[0], x);
  9210. minMax[2] = Math.min(minMax[2], args[1], y);
  9211. minMax[3] = Math.max(minMax[3], args[1], y);
  9212. break;
  9213. case _util.OPS.moveTo:
  9214. case _util.OPS.lineTo:
  9215. minMax[0] = Math.min(minMax[0], args[0]);
  9216. minMax[1] = Math.max(minMax[1], args[0]);
  9217. minMax[2] = Math.min(minMax[2], args[1]);
  9218. minMax[3] = Math.max(minMax[3], args[1]);
  9219. break;
  9220. }
  9221. }
  9222. }
  9223. parseColorSpace({
  9224. cs,
  9225. resources,
  9226. localColorSpaceCache
  9227. }) {
  9228. return _colorspace.ColorSpace.parseAsync({
  9229. cs,
  9230. xref: this.xref,
  9231. resources,
  9232. pdfFunctionFactory: this._pdfFunctionFactory,
  9233. localColorSpaceCache
  9234. }).catch(reason => {
  9235. if (reason instanceof _util.AbortException) {
  9236. return null;
  9237. }
  9238. if (this.options.ignoreErrors) {
  9239. this.handler.send("UnsupportedFeature", {
  9240. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  9241. });
  9242. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  9243. return null;
  9244. }
  9245. throw reason;
  9246. });
  9247. }
  9248. parseShading({
  9249. shading,
  9250. resources,
  9251. localColorSpaceCache,
  9252. localShadingPatternCache
  9253. }) {
  9254. let id = localShadingPatternCache.get(shading);
  9255. if (!id) {
  9256. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  9257. const patternIR = shadingFill.getIR();
  9258. id = `pattern_${this.idFactory.createObjId()}`;
  9259. localShadingPatternCache.set(shading, id);
  9260. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  9261. }
  9262. return id;
  9263. }
  9264. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  9265. const patternName = args.pop();
  9266. if (patternName instanceof _primitives.Name) {
  9267. const rawPattern = patterns.getRaw(patternName.name);
  9268. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  9269. if (localTilingPattern) {
  9270. try {
  9271. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9272. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  9273. operatorList.addOp(fn, tilingPatternIR);
  9274. return undefined;
  9275. } catch (ex) {}
  9276. }
  9277. const pattern = this.xref.fetchIfRef(rawPattern);
  9278. if (pattern) {
  9279. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  9280. const typeNum = dict.get("PatternType");
  9281. if (typeNum === PatternType.TILING) {
  9282. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9283. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  9284. } else if (typeNum === PatternType.SHADING) {
  9285. const shading = dict.get("Shading");
  9286. const matrix = dict.getArray("Matrix");
  9287. const objId = this.parseShading({
  9288. shading,
  9289. resources,
  9290. localColorSpaceCache,
  9291. localShadingPatternCache
  9292. });
  9293. operatorList.addOp(fn, ["Shading", objId, matrix]);
  9294. return undefined;
  9295. }
  9296. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  9297. }
  9298. }
  9299. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  9300. }
  9301. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  9302. const MAX_NESTING = 10;
  9303. if (++nestingCounter > MAX_NESTING) {
  9304. (0, _util.warn)("Visibility expression is too deeply nested");
  9305. return;
  9306. }
  9307. const length = array.length;
  9308. const operator = this.xref.fetchIfRef(array[0]);
  9309. if (length < 2 || !(operator instanceof _primitives.Name)) {
  9310. (0, _util.warn)("Invalid visibility expression");
  9311. return;
  9312. }
  9313. switch (operator.name) {
  9314. case "And":
  9315. case "Or":
  9316. case "Not":
  9317. currentResult.push(operator.name);
  9318. break;
  9319. default:
  9320. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  9321. return;
  9322. }
  9323. for (let i = 1; i < length; i++) {
  9324. const raw = array[i];
  9325. const object = this.xref.fetchIfRef(raw);
  9326. if (Array.isArray(object)) {
  9327. const nestedResult = [];
  9328. currentResult.push(nestedResult);
  9329. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  9330. } else if (raw instanceof _primitives.Ref) {
  9331. currentResult.push(raw.toString());
  9332. }
  9333. }
  9334. }
  9335. async parseMarkedContentProps(contentProperties, resources) {
  9336. let optionalContent;
  9337. if (contentProperties instanceof _primitives.Name) {
  9338. const properties = resources.get("Properties");
  9339. optionalContent = properties.get(contentProperties.name);
  9340. } else if (contentProperties instanceof _primitives.Dict) {
  9341. optionalContent = contentProperties;
  9342. } else {
  9343. throw new _util.FormatError("Optional content properties malformed.");
  9344. }
  9345. const optionalContentType = optionalContent.get("Type").name;
  9346. if (optionalContentType === "OCG") {
  9347. return {
  9348. type: optionalContentType,
  9349. id: optionalContent.objId
  9350. };
  9351. } else if (optionalContentType === "OCMD") {
  9352. const expression = optionalContent.get("VE");
  9353. if (Array.isArray(expression)) {
  9354. const result = [];
  9355. this._parseVisibilityExpression(expression, 0, result);
  9356. if (result.length > 0) {
  9357. return {
  9358. type: "OCMD",
  9359. expression: result
  9360. };
  9361. }
  9362. }
  9363. const optionalContentGroups = optionalContent.get("OCGs");
  9364. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  9365. const groupIds = [];
  9366. if (Array.isArray(optionalContentGroups)) {
  9367. for (const ocg of optionalContentGroups) {
  9368. groupIds.push(ocg.toString());
  9369. }
  9370. } else {
  9371. groupIds.push(optionalContentGroups.objId);
  9372. }
  9373. return {
  9374. type: optionalContentType,
  9375. ids: groupIds,
  9376. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  9377. expression: null
  9378. };
  9379. } else if (optionalContentGroups instanceof _primitives.Ref) {
  9380. return {
  9381. type: optionalContentType,
  9382. id: optionalContentGroups.toString()
  9383. };
  9384. }
  9385. }
  9386. return null;
  9387. }
  9388. getOperatorList({
  9389. stream,
  9390. task,
  9391. resources,
  9392. operatorList,
  9393. initialState = null,
  9394. fallbackFontDict = null
  9395. }) {
  9396. resources = resources || _primitives.Dict.empty;
  9397. initialState = initialState || new EvalState();
  9398. if (!operatorList) {
  9399. throw new Error('getOperatorList: missing "operatorList" parameter');
  9400. }
  9401. const self = this;
  9402. const xref = this.xref;
  9403. let parsingText = false;
  9404. const localImageCache = new _image_utils.LocalImageCache();
  9405. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  9406. const localGStateCache = new _image_utils.LocalGStateCache();
  9407. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  9408. const localShadingPatternCache = new Map();
  9409. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  9410. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  9411. const stateManager = new StateManager(initialState);
  9412. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9413. const timeSlotManager = new TimeSlotManager();
  9414. function closePendingRestoreOPS(argument) {
  9415. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  9416. operatorList.addOp(_util.OPS.restore, []);
  9417. }
  9418. }
  9419. return new Promise(function promiseBody(resolve, reject) {
  9420. const next = function (promise) {
  9421. Promise.all([promise, operatorList.ready]).then(function () {
  9422. try {
  9423. promiseBody(resolve, reject);
  9424. } catch (ex) {
  9425. reject(ex);
  9426. }
  9427. }, reject);
  9428. };
  9429. task.ensureNotTerminated();
  9430. timeSlotManager.reset();
  9431. const operation = {};
  9432. let stop, i, ii, cs, name, isValidName;
  9433. while (!(stop = timeSlotManager.check())) {
  9434. operation.args = null;
  9435. if (!preprocessor.read(operation)) {
  9436. break;
  9437. }
  9438. let args = operation.args;
  9439. let fn = operation.fn;
  9440. switch (fn | 0) {
  9441. case _util.OPS.paintXObject:
  9442. isValidName = args[0] instanceof _primitives.Name;
  9443. name = args[0].name;
  9444. if (isValidName) {
  9445. const localImage = localImageCache.getByName(name);
  9446. if (localImage) {
  9447. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9448. incrementCachedImageMaskCount(localImage);
  9449. args = null;
  9450. continue;
  9451. }
  9452. }
  9453. next(new Promise(function (resolveXObject, rejectXObject) {
  9454. if (!isValidName) {
  9455. throw new _util.FormatError("XObject must be referred to by name.");
  9456. }
  9457. let xobj = xobjs.getRaw(name);
  9458. if (xobj instanceof _primitives.Ref) {
  9459. const localImage = localImageCache.getByRef(xobj);
  9460. if (localImage) {
  9461. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9462. incrementCachedImageMaskCount(localImage);
  9463. resolveXObject();
  9464. return;
  9465. }
  9466. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  9467. if (globalImage) {
  9468. operatorList.addDependency(globalImage.objId);
  9469. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  9470. resolveXObject();
  9471. return;
  9472. }
  9473. xobj = xref.fetch(xobj);
  9474. }
  9475. if (!(xobj instanceof _base_stream.BaseStream)) {
  9476. throw new _util.FormatError("XObject should be a stream");
  9477. }
  9478. const type = xobj.dict.get("Subtype");
  9479. if (!(type instanceof _primitives.Name)) {
  9480. throw new _util.FormatError("XObject should have a Name subtype");
  9481. }
  9482. if (type.name === "Form") {
  9483. stateManager.save();
  9484. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  9485. stateManager.restore();
  9486. resolveXObject();
  9487. }, rejectXObject);
  9488. return;
  9489. } else if (type.name === "Image") {
  9490. self.buildPaintImageXObject({
  9491. resources,
  9492. image: xobj,
  9493. operatorList,
  9494. cacheKey: name,
  9495. localImageCache,
  9496. localColorSpaceCache
  9497. }).then(resolveXObject, rejectXObject);
  9498. return;
  9499. } else if (type.name === "PS") {
  9500. (0, _util.info)("Ignored XObject subtype PS");
  9501. } else {
  9502. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  9503. }
  9504. resolveXObject();
  9505. }).catch(function (reason) {
  9506. if (reason instanceof _util.AbortException) {
  9507. return;
  9508. }
  9509. if (self.options.ignoreErrors) {
  9510. self.handler.send("UnsupportedFeature", {
  9511. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  9512. });
  9513. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  9514. return;
  9515. }
  9516. throw reason;
  9517. }));
  9518. return;
  9519. case _util.OPS.setFont:
  9520. var fontSize = args[1];
  9521. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  9522. operatorList.addDependency(loadedName);
  9523. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  9524. }));
  9525. return;
  9526. case _util.OPS.beginText:
  9527. parsingText = true;
  9528. break;
  9529. case _util.OPS.endText:
  9530. parsingText = false;
  9531. break;
  9532. case _util.OPS.endInlineImage:
  9533. var cacheKey = args[0].cacheKey;
  9534. if (cacheKey) {
  9535. const localImage = localImageCache.getByName(cacheKey);
  9536. if (localImage) {
  9537. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9538. incrementCachedImageMaskCount(localImage);
  9539. args = null;
  9540. continue;
  9541. }
  9542. }
  9543. next(self.buildPaintImageXObject({
  9544. resources,
  9545. image: args[0],
  9546. isInline: true,
  9547. operatorList,
  9548. cacheKey,
  9549. localImageCache,
  9550. localColorSpaceCache
  9551. }));
  9552. return;
  9553. case _util.OPS.showText:
  9554. if (!stateManager.state.font) {
  9555. self.ensureStateFont(stateManager.state);
  9556. continue;
  9557. }
  9558. args[0] = self.handleText(args[0], stateManager.state);
  9559. break;
  9560. case _util.OPS.showSpacedText:
  9561. if (!stateManager.state.font) {
  9562. self.ensureStateFont(stateManager.state);
  9563. continue;
  9564. }
  9565. var combinedGlyphs = [];
  9566. var state = stateManager.state;
  9567. for (const arrItem of args[0]) {
  9568. if (typeof arrItem === "string") {
  9569. combinedGlyphs.push(...self.handleText(arrItem, state));
  9570. } else if (typeof arrItem === "number") {
  9571. combinedGlyphs.push(arrItem);
  9572. }
  9573. }
  9574. args[0] = combinedGlyphs;
  9575. fn = _util.OPS.showText;
  9576. break;
  9577. case _util.OPS.nextLineShowText:
  9578. if (!stateManager.state.font) {
  9579. self.ensureStateFont(stateManager.state);
  9580. continue;
  9581. }
  9582. operatorList.addOp(_util.OPS.nextLine);
  9583. args[0] = self.handleText(args[0], stateManager.state);
  9584. fn = _util.OPS.showText;
  9585. break;
  9586. case _util.OPS.nextLineSetSpacingShowText:
  9587. if (!stateManager.state.font) {
  9588. self.ensureStateFont(stateManager.state);
  9589. continue;
  9590. }
  9591. operatorList.addOp(_util.OPS.nextLine);
  9592. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  9593. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  9594. args[0] = self.handleText(args[0], stateManager.state);
  9595. fn = _util.OPS.showText;
  9596. break;
  9597. case _util.OPS.setTextRenderingMode:
  9598. stateManager.state.textRenderingMode = args[0];
  9599. break;
  9600. case _util.OPS.setFillColorSpace:
  9601. {
  9602. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9603. if (cachedColorSpace) {
  9604. stateManager.state.fillColorSpace = cachedColorSpace;
  9605. continue;
  9606. }
  9607. next(self.parseColorSpace({
  9608. cs: args[0],
  9609. resources,
  9610. localColorSpaceCache
  9611. }).then(function (colorSpace) {
  9612. if (colorSpace) {
  9613. stateManager.state.fillColorSpace = colorSpace;
  9614. }
  9615. }));
  9616. return;
  9617. }
  9618. case _util.OPS.setStrokeColorSpace:
  9619. {
  9620. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9621. if (cachedColorSpace) {
  9622. stateManager.state.strokeColorSpace = cachedColorSpace;
  9623. continue;
  9624. }
  9625. next(self.parseColorSpace({
  9626. cs: args[0],
  9627. resources,
  9628. localColorSpaceCache
  9629. }).then(function (colorSpace) {
  9630. if (colorSpace) {
  9631. stateManager.state.strokeColorSpace = colorSpace;
  9632. }
  9633. }));
  9634. return;
  9635. }
  9636. case _util.OPS.setFillColor:
  9637. cs = stateManager.state.fillColorSpace;
  9638. args = cs.getRgb(args, 0);
  9639. fn = _util.OPS.setFillRGBColor;
  9640. break;
  9641. case _util.OPS.setStrokeColor:
  9642. cs = stateManager.state.strokeColorSpace;
  9643. args = cs.getRgb(args, 0);
  9644. fn = _util.OPS.setStrokeRGBColor;
  9645. break;
  9646. case _util.OPS.setFillGray:
  9647. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9648. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9649. fn = _util.OPS.setFillRGBColor;
  9650. break;
  9651. case _util.OPS.setStrokeGray:
  9652. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9653. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9654. fn = _util.OPS.setStrokeRGBColor;
  9655. break;
  9656. case _util.OPS.setFillCMYKColor:
  9657. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9658. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9659. fn = _util.OPS.setFillRGBColor;
  9660. break;
  9661. case _util.OPS.setStrokeCMYKColor:
  9662. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9663. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9664. fn = _util.OPS.setStrokeRGBColor;
  9665. break;
  9666. case _util.OPS.setFillRGBColor:
  9667. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9668. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9669. break;
  9670. case _util.OPS.setStrokeRGBColor:
  9671. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9672. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9673. break;
  9674. case _util.OPS.setFillColorN:
  9675. cs = stateManager.state.fillColorSpace;
  9676. if (cs.name === "Pattern") {
  9677. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9678. return;
  9679. }
  9680. args = cs.getRgb(args, 0);
  9681. fn = _util.OPS.setFillRGBColor;
  9682. break;
  9683. case _util.OPS.setStrokeColorN:
  9684. cs = stateManager.state.strokeColorSpace;
  9685. if (cs.name === "Pattern") {
  9686. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9687. return;
  9688. }
  9689. args = cs.getRgb(args, 0);
  9690. fn = _util.OPS.setStrokeRGBColor;
  9691. break;
  9692. case _util.OPS.shadingFill:
  9693. var shadingRes = resources.get("Shading");
  9694. if (!shadingRes) {
  9695. throw new _util.FormatError("No shading resource found");
  9696. }
  9697. var shading = shadingRes.get(args[0].name);
  9698. if (!shading) {
  9699. throw new _util.FormatError("No shading object found");
  9700. }
  9701. const patternId = self.parseShading({
  9702. shading,
  9703. resources,
  9704. localColorSpaceCache,
  9705. localShadingPatternCache
  9706. });
  9707. args = [patternId];
  9708. fn = _util.OPS.shadingFill;
  9709. break;
  9710. case _util.OPS.setGState:
  9711. isValidName = args[0] instanceof _primitives.Name;
  9712. name = args[0].name;
  9713. if (isValidName) {
  9714. const localGStateObj = localGStateCache.getByName(name);
  9715. if (localGStateObj) {
  9716. if (localGStateObj.length > 0) {
  9717. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  9718. }
  9719. args = null;
  9720. continue;
  9721. }
  9722. }
  9723. next(new Promise(function (resolveGState, rejectGState) {
  9724. if (!isValidName) {
  9725. throw new _util.FormatError("GState must be referred to by name.");
  9726. }
  9727. const extGState = resources.get("ExtGState");
  9728. if (!(extGState instanceof _primitives.Dict)) {
  9729. throw new _util.FormatError("ExtGState should be a dictionary.");
  9730. }
  9731. const gState = extGState.get(name);
  9732. if (!(gState instanceof _primitives.Dict)) {
  9733. throw new _util.FormatError("GState should be a dictionary.");
  9734. }
  9735. self.setGState({
  9736. resources,
  9737. gState,
  9738. operatorList,
  9739. cacheKey: name,
  9740. task,
  9741. stateManager,
  9742. localGStateCache,
  9743. localColorSpaceCache
  9744. }).then(resolveGState, rejectGState);
  9745. }).catch(function (reason) {
  9746. if (reason instanceof _util.AbortException) {
  9747. return;
  9748. }
  9749. if (self.options.ignoreErrors) {
  9750. self.handler.send("UnsupportedFeature", {
  9751. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  9752. });
  9753. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  9754. return;
  9755. }
  9756. throw reason;
  9757. }));
  9758. return;
  9759. case _util.OPS.moveTo:
  9760. case _util.OPS.lineTo:
  9761. case _util.OPS.curveTo:
  9762. case _util.OPS.curveTo2:
  9763. case _util.OPS.curveTo3:
  9764. case _util.OPS.closePath:
  9765. case _util.OPS.rectangle:
  9766. self.buildPath(operatorList, fn, args, parsingText);
  9767. continue;
  9768. case _util.OPS.markPoint:
  9769. case _util.OPS.markPointProps:
  9770. case _util.OPS.beginCompat:
  9771. case _util.OPS.endCompat:
  9772. continue;
  9773. case _util.OPS.beginMarkedContentProps:
  9774. if (!(args[0] instanceof _primitives.Name)) {
  9775. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  9776. continue;
  9777. }
  9778. if (args[0].name === "OC") {
  9779. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  9780. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  9781. }).catch(reason => {
  9782. if (reason instanceof _util.AbortException) {
  9783. return;
  9784. }
  9785. if (self.options.ignoreErrors) {
  9786. self.handler.send("UnsupportedFeature", {
  9787. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  9788. });
  9789. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  9790. return;
  9791. }
  9792. throw reason;
  9793. }));
  9794. return;
  9795. }
  9796. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  9797. break;
  9798. case _util.OPS.beginMarkedContent:
  9799. case _util.OPS.endMarkedContent:
  9800. default:
  9801. if (args !== null) {
  9802. for (i = 0, ii = args.length; i < ii; i++) {
  9803. if (args[i] instanceof _primitives.Dict) {
  9804. break;
  9805. }
  9806. }
  9807. if (i < ii) {
  9808. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  9809. continue;
  9810. }
  9811. }
  9812. }
  9813. operatorList.addOp(fn, args);
  9814. }
  9815. if (stop) {
  9816. next(deferred);
  9817. return;
  9818. }
  9819. closePendingRestoreOPS();
  9820. resolve();
  9821. }).catch(reason => {
  9822. if (reason instanceof _util.AbortException) {
  9823. return;
  9824. }
  9825. if (this.options.ignoreErrors) {
  9826. this.handler.send("UnsupportedFeature", {
  9827. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  9828. });
  9829. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  9830. closePendingRestoreOPS();
  9831. return;
  9832. }
  9833. throw reason;
  9834. });
  9835. }
  9836. getTextContent({
  9837. stream,
  9838. task,
  9839. resources,
  9840. stateManager = null,
  9841. combineTextItems = false,
  9842. includeMarkedContent = false,
  9843. sink,
  9844. seenStyles = new Set(),
  9845. viewBox,
  9846. markedContentData = null
  9847. }) {
  9848. resources = resources || _primitives.Dict.empty;
  9849. stateManager = stateManager || new StateManager(new TextState());
  9850. if (includeMarkedContent) {
  9851. markedContentData = markedContentData || {
  9852. level: 0
  9853. };
  9854. }
  9855. const textContent = {
  9856. items: [],
  9857. styles: Object.create(null)
  9858. };
  9859. const textContentItem = {
  9860. initialized: false,
  9861. str: [],
  9862. totalWidth: 0,
  9863. totalHeight: 0,
  9864. width: 0,
  9865. height: 0,
  9866. vertical: false,
  9867. prevTransform: null,
  9868. textAdvanceScale: 0,
  9869. spaceInFlowMin: 0,
  9870. spaceInFlowMax: 0,
  9871. trackingSpaceMin: Infinity,
  9872. negativeSpaceMax: -Infinity,
  9873. notASpace: -Infinity,
  9874. transform: null,
  9875. fontName: null,
  9876. hasEOL: false
  9877. };
  9878. const twoLastChars = [" ", " "];
  9879. let twoLastCharsPos = 0;
  9880. function saveLastChar(char) {
  9881. const nextPos = (twoLastCharsPos + 1) % 2;
  9882. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  9883. twoLastChars[twoLastCharsPos] = char;
  9884. twoLastCharsPos = nextPos;
  9885. return ret;
  9886. }
  9887. function resetLastChars() {
  9888. twoLastChars[0] = twoLastChars[1] = " ";
  9889. twoLastCharsPos = 0;
  9890. }
  9891. const TRACKING_SPACE_FACTOR = 0.1;
  9892. const NOT_A_SPACE_FACTOR = 0.03;
  9893. const NEGATIVE_SPACE_FACTOR = -0.2;
  9894. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  9895. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  9896. const self = this;
  9897. const xref = this.xref;
  9898. const showSpacedTextBuffer = [];
  9899. let xobjs = null;
  9900. const emptyXObjectCache = new _image_utils.LocalImageCache();
  9901. const emptyGStateCache = new _image_utils.LocalGStateCache();
  9902. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9903. let textState;
  9904. function getCurrentTextTransform() {
  9905. const font = textState.font;
  9906. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  9907. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  9908. const glyphHeight = font.bbox[3] - font.bbox[1];
  9909. if (glyphHeight > 0) {
  9910. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  9911. }
  9912. }
  9913. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  9914. }
  9915. function ensureTextContentItem() {
  9916. if (textContentItem.initialized) {
  9917. return textContentItem;
  9918. }
  9919. const {
  9920. font,
  9921. loadedName
  9922. } = textState;
  9923. if (!seenStyles.has(loadedName)) {
  9924. seenStyles.add(loadedName);
  9925. textContent.styles[loadedName] = {
  9926. fontFamily: font.fallbackName,
  9927. ascent: font.ascent,
  9928. descent: font.descent,
  9929. vertical: font.vertical
  9930. };
  9931. }
  9932. textContentItem.fontName = loadedName;
  9933. const trm = textContentItem.transform = getCurrentTextTransform();
  9934. if (!font.vertical) {
  9935. textContentItem.width = textContentItem.totalWidth = 0;
  9936. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  9937. textContentItem.vertical = false;
  9938. } else {
  9939. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  9940. textContentItem.height = textContentItem.totalHeight = 0;
  9941. textContentItem.vertical = true;
  9942. }
  9943. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9944. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9945. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  9946. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  9947. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  9948. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  9949. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  9950. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  9951. textContentItem.hasEOL = false;
  9952. textContentItem.initialized = true;
  9953. return textContentItem;
  9954. }
  9955. function updateAdvanceScale() {
  9956. if (!textContentItem.initialized) {
  9957. return;
  9958. }
  9959. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9960. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9961. const scaleFactor = scaleCtmX * scaleLineX;
  9962. if (scaleFactor === textContentItem.textAdvanceScale) {
  9963. return;
  9964. }
  9965. if (!textContentItem.vertical) {
  9966. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9967. textContentItem.width = 0;
  9968. } else {
  9969. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9970. textContentItem.height = 0;
  9971. }
  9972. textContentItem.textAdvanceScale = scaleFactor;
  9973. }
  9974. function runBidiTransform(textChunk) {
  9975. const text = textChunk.str.join("");
  9976. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  9977. return {
  9978. str: bidiResult.str,
  9979. dir: bidiResult.dir,
  9980. width: Math.abs(textChunk.totalWidth),
  9981. height: Math.abs(textChunk.totalHeight),
  9982. transform: textChunk.transform,
  9983. fontName: textChunk.fontName,
  9984. hasEOL: textChunk.hasEOL
  9985. };
  9986. }
  9987. function handleSetFont(fontName, fontRef) {
  9988. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  9989. if (!translated.font.isType3Font) {
  9990. return translated;
  9991. }
  9992. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  9993. return translated;
  9994. });
  9995. }).then(function (translated) {
  9996. textState.loadedName = translated.loadedName;
  9997. textState.font = translated.font;
  9998. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  9999. });
  10000. }
  10001. function applyInverseRotation(x, y, matrix) {
  10002. const scale = Math.hypot(matrix[0], matrix[1]);
  10003. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  10004. }
  10005. function compareWithLastPosition() {
  10006. const currentTransform = getCurrentTextTransform();
  10007. let posX = currentTransform[4];
  10008. let posY = currentTransform[5];
  10009. const shiftedX = posX - viewBox[0];
  10010. const shiftedY = posY - viewBox[1];
  10011. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  10012. return false;
  10013. }
  10014. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  10015. return true;
  10016. }
  10017. let lastPosX = textContentItem.prevTransform[4];
  10018. let lastPosY = textContentItem.prevTransform[5];
  10019. if (lastPosX === posX && lastPosY === posY) {
  10020. return true;
  10021. }
  10022. let rotate = -1;
  10023. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  10024. rotate = currentTransform[0] > 0 ? 0 : 180;
  10025. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  10026. rotate = currentTransform[1] > 0 ? 90 : 270;
  10027. }
  10028. switch (rotate) {
  10029. case 0:
  10030. break;
  10031. case 90:
  10032. [posX, posY] = [posY, posX];
  10033. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  10034. break;
  10035. case 180:
  10036. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  10037. break;
  10038. case 270:
  10039. [posX, posY] = [-posY, -posX];
  10040. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  10041. break;
  10042. default:
  10043. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  10044. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  10045. }
  10046. if (textState.font.vertical) {
  10047. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  10048. const advanceX = posX - lastPosX;
  10049. const textOrientation = Math.sign(textContentItem.height);
  10050. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  10051. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  10052. appendEOL();
  10053. return true;
  10054. }
  10055. resetLastChars();
  10056. flushTextContentItem();
  10057. return true;
  10058. }
  10059. if (Math.abs(advanceX) > textContentItem.width) {
  10060. appendEOL();
  10061. return true;
  10062. }
  10063. if (advanceY <= textOrientation * textContentItem.notASpace) {
  10064. resetLastChars();
  10065. }
  10066. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  10067. textContentItem.height += advanceY;
  10068. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  10069. if (textContentItem.str.length === 0) {
  10070. resetLastChars();
  10071. textContent.items.push({
  10072. str: " ",
  10073. dir: "ltr",
  10074. width: 0,
  10075. height: Math.abs(advanceY),
  10076. transform: textContentItem.prevTransform,
  10077. fontName: textContentItem.fontName,
  10078. hasEOL: false
  10079. });
  10080. } else {
  10081. textContentItem.height += advanceY;
  10082. }
  10083. }
  10084. return true;
  10085. }
  10086. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  10087. const advanceY = posY - lastPosY;
  10088. const textOrientation = Math.sign(textContentItem.width);
  10089. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  10090. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  10091. appendEOL();
  10092. return true;
  10093. }
  10094. resetLastChars();
  10095. flushTextContentItem();
  10096. return true;
  10097. }
  10098. if (Math.abs(advanceY) > textContentItem.height) {
  10099. appendEOL();
  10100. return true;
  10101. }
  10102. if (advanceX <= textOrientation * textContentItem.notASpace) {
  10103. resetLastChars();
  10104. }
  10105. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  10106. textContentItem.width += advanceX;
  10107. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  10108. if (textContentItem.str.length === 0) {
  10109. resetLastChars();
  10110. textContent.items.push({
  10111. str: " ",
  10112. dir: "ltr",
  10113. width: Math.abs(advanceX),
  10114. height: 0,
  10115. transform: textContentItem.prevTransform,
  10116. fontName: textContentItem.fontName,
  10117. hasEOL: false
  10118. });
  10119. } else {
  10120. textContentItem.width += advanceX;
  10121. }
  10122. }
  10123. return true;
  10124. }
  10125. function buildTextContentItem({
  10126. chars,
  10127. extraSpacing
  10128. }) {
  10129. const font = textState.font;
  10130. if (!chars) {
  10131. const charSpacing = textState.charSpacing + extraSpacing;
  10132. if (charSpacing) {
  10133. if (!font.vertical) {
  10134. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10135. } else {
  10136. textState.translateTextMatrix(0, -charSpacing);
  10137. }
  10138. }
  10139. return;
  10140. }
  10141. const glyphs = font.charsToGlyphs(chars);
  10142. const scale = textState.fontMatrix[0] * textState.fontSize;
  10143. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  10144. const glyph = glyphs[i];
  10145. const {
  10146. category
  10147. } = glyph;
  10148. if (category.isInvisibleFormatMark) {
  10149. continue;
  10150. }
  10151. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  10152. let glyphWidth = glyph.width;
  10153. if (font.vertical) {
  10154. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  10155. }
  10156. let scaledDim = glyphWidth * scale;
  10157. if (category.isWhitespace) {
  10158. if (!font.vertical) {
  10159. charSpacing += scaledDim + textState.wordSpacing;
  10160. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10161. } else {
  10162. charSpacing += -scaledDim + textState.wordSpacing;
  10163. textState.translateTextMatrix(0, -charSpacing);
  10164. }
  10165. saveLastChar(" ");
  10166. continue;
  10167. }
  10168. if (!compareWithLastPosition()) {
  10169. continue;
  10170. }
  10171. const textChunk = ensureTextContentItem();
  10172. if (category.isZeroWidthDiacritic) {
  10173. scaledDim = 0;
  10174. }
  10175. if (!font.vertical) {
  10176. scaledDim *= textState.textHScale;
  10177. textState.translateTextMatrix(scaledDim, 0);
  10178. textChunk.width += scaledDim;
  10179. } else {
  10180. textState.translateTextMatrix(0, scaledDim);
  10181. scaledDim = Math.abs(scaledDim);
  10182. textChunk.height += scaledDim;
  10183. }
  10184. if (scaledDim) {
  10185. textChunk.prevTransform = getCurrentTextTransform();
  10186. }
  10187. const glyphUnicode = glyph.normalizedUnicode;
  10188. if (saveLastChar(glyphUnicode)) {
  10189. textChunk.str.push(" ");
  10190. }
  10191. textChunk.str.push(glyphUnicode);
  10192. if (charSpacing) {
  10193. if (!font.vertical) {
  10194. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10195. } else {
  10196. textState.translateTextMatrix(0, -charSpacing);
  10197. }
  10198. }
  10199. }
  10200. }
  10201. function appendEOL() {
  10202. resetLastChars();
  10203. if (textContentItem.initialized) {
  10204. textContentItem.hasEOL = true;
  10205. flushTextContentItem();
  10206. } else {
  10207. textContent.items.push({
  10208. str: "",
  10209. dir: "ltr",
  10210. width: 0,
  10211. height: 0,
  10212. transform: getCurrentTextTransform(),
  10213. fontName: textState.loadedName,
  10214. hasEOL: true
  10215. });
  10216. }
  10217. }
  10218. function addFakeSpaces(width, transf, textOrientation) {
  10219. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  10220. if (textContentItem.initialized) {
  10221. resetLastChars();
  10222. textContentItem.str.push(" ");
  10223. }
  10224. return false;
  10225. }
  10226. const fontName = textContentItem.fontName;
  10227. let height = 0;
  10228. if (textContentItem.vertical) {
  10229. height = width;
  10230. width = 0;
  10231. }
  10232. flushTextContentItem();
  10233. resetLastChars();
  10234. textContent.items.push({
  10235. str: " ",
  10236. dir: "ltr",
  10237. width: Math.abs(width),
  10238. height: Math.abs(height),
  10239. transform: transf || getCurrentTextTransform(),
  10240. fontName,
  10241. hasEOL: false
  10242. });
  10243. return true;
  10244. }
  10245. function flushTextContentItem() {
  10246. if (!textContentItem.initialized || !textContentItem.str) {
  10247. return;
  10248. }
  10249. if (!textContentItem.vertical) {
  10250. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  10251. } else {
  10252. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  10253. }
  10254. textContent.items.push(runBidiTransform(textContentItem));
  10255. textContentItem.initialized = false;
  10256. textContentItem.str.length = 0;
  10257. }
  10258. function enqueueChunk(batch = false) {
  10259. const length = textContent.items.length;
  10260. if (length === 0) {
  10261. return;
  10262. }
  10263. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  10264. return;
  10265. }
  10266. sink.enqueue(textContent, length);
  10267. textContent.items = [];
  10268. textContent.styles = Object.create(null);
  10269. }
  10270. const timeSlotManager = new TimeSlotManager();
  10271. return new Promise(function promiseBody(resolve, reject) {
  10272. const next = function (promise) {
  10273. enqueueChunk(true);
  10274. Promise.all([promise, sink.ready]).then(function () {
  10275. try {
  10276. promiseBody(resolve, reject);
  10277. } catch (ex) {
  10278. reject(ex);
  10279. }
  10280. }, reject);
  10281. };
  10282. task.ensureNotTerminated();
  10283. timeSlotManager.reset();
  10284. const operation = {};
  10285. let stop,
  10286. args = [];
  10287. while (!(stop = timeSlotManager.check())) {
  10288. args.length = 0;
  10289. operation.args = args;
  10290. if (!preprocessor.read(operation)) {
  10291. break;
  10292. }
  10293. textState = stateManager.state;
  10294. const fn = operation.fn;
  10295. args = operation.args;
  10296. switch (fn | 0) {
  10297. case _util.OPS.setFont:
  10298. var fontNameArg = args[0].name,
  10299. fontSizeArg = args[1];
  10300. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  10301. break;
  10302. }
  10303. flushTextContentItem();
  10304. textState.fontName = fontNameArg;
  10305. textState.fontSize = fontSizeArg;
  10306. next(handleSetFont(fontNameArg, null));
  10307. return;
  10308. case _util.OPS.setTextRise:
  10309. textState.textRise = args[0];
  10310. break;
  10311. case _util.OPS.setHScale:
  10312. textState.textHScale = args[0] / 100;
  10313. break;
  10314. case _util.OPS.setLeading:
  10315. textState.leading = args[0];
  10316. break;
  10317. case _util.OPS.moveText:
  10318. textState.translateTextLineMatrix(args[0], args[1]);
  10319. textState.textMatrix = textState.textLineMatrix.slice();
  10320. break;
  10321. case _util.OPS.setLeadingMoveText:
  10322. textState.leading = -args[1];
  10323. textState.translateTextLineMatrix(args[0], args[1]);
  10324. textState.textMatrix = textState.textLineMatrix.slice();
  10325. break;
  10326. case _util.OPS.nextLine:
  10327. textState.carriageReturn();
  10328. break;
  10329. case _util.OPS.setTextMatrix:
  10330. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10331. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10332. updateAdvanceScale();
  10333. break;
  10334. case _util.OPS.setCharSpacing:
  10335. textState.charSpacing = args[0];
  10336. break;
  10337. case _util.OPS.setWordSpacing:
  10338. textState.wordSpacing = args[0];
  10339. break;
  10340. case _util.OPS.beginText:
  10341. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  10342. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  10343. break;
  10344. case _util.OPS.showSpacedText:
  10345. if (!stateManager.state.font) {
  10346. self.ensureStateFont(stateManager.state);
  10347. continue;
  10348. }
  10349. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  10350. const elements = args[0];
  10351. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  10352. const item = elements[i];
  10353. if (typeof item === "string") {
  10354. showSpacedTextBuffer.push(item);
  10355. } else if (typeof item === "number" && item !== 0) {
  10356. const str = showSpacedTextBuffer.join("");
  10357. showSpacedTextBuffer.length = 0;
  10358. buildTextContentItem({
  10359. chars: str,
  10360. extraSpacing: item * spaceFactor
  10361. });
  10362. }
  10363. }
  10364. const item = elements.at(-1);
  10365. if (typeof item === "string") {
  10366. showSpacedTextBuffer.push(item);
  10367. }
  10368. if (showSpacedTextBuffer.length > 0) {
  10369. const str = showSpacedTextBuffer.join("");
  10370. showSpacedTextBuffer.length = 0;
  10371. buildTextContentItem({
  10372. chars: str,
  10373. extraSpacing: 0
  10374. });
  10375. }
  10376. break;
  10377. case _util.OPS.showText:
  10378. if (!stateManager.state.font) {
  10379. self.ensureStateFont(stateManager.state);
  10380. continue;
  10381. }
  10382. buildTextContentItem({
  10383. chars: args[0],
  10384. extraSpacing: 0
  10385. });
  10386. break;
  10387. case _util.OPS.nextLineShowText:
  10388. if (!stateManager.state.font) {
  10389. self.ensureStateFont(stateManager.state);
  10390. continue;
  10391. }
  10392. textState.carriageReturn();
  10393. buildTextContentItem({
  10394. chars: args[0],
  10395. extraSpacing: 0
  10396. });
  10397. break;
  10398. case _util.OPS.nextLineSetSpacingShowText:
  10399. if (!stateManager.state.font) {
  10400. self.ensureStateFont(stateManager.state);
  10401. continue;
  10402. }
  10403. textState.wordSpacing = args[0];
  10404. textState.charSpacing = args[1];
  10405. textState.carriageReturn();
  10406. buildTextContentItem({
  10407. chars: args[2],
  10408. extraSpacing: 0
  10409. });
  10410. break;
  10411. case _util.OPS.paintXObject:
  10412. flushTextContentItem();
  10413. if (!xobjs) {
  10414. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  10415. }
  10416. var isValidName = args[0] instanceof _primitives.Name;
  10417. var name = args[0].name;
  10418. if (isValidName && emptyXObjectCache.getByName(name)) {
  10419. break;
  10420. }
  10421. next(new Promise(function (resolveXObject, rejectXObject) {
  10422. if (!isValidName) {
  10423. throw new _util.FormatError("XObject must be referred to by name.");
  10424. }
  10425. let xobj = xobjs.getRaw(name);
  10426. if (xobj instanceof _primitives.Ref) {
  10427. if (emptyXObjectCache.getByRef(xobj)) {
  10428. resolveXObject();
  10429. return;
  10430. }
  10431. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  10432. if (globalImage) {
  10433. resolveXObject();
  10434. return;
  10435. }
  10436. xobj = xref.fetch(xobj);
  10437. }
  10438. if (!(xobj instanceof _base_stream.BaseStream)) {
  10439. throw new _util.FormatError("XObject should be a stream");
  10440. }
  10441. const type = xobj.dict.get("Subtype");
  10442. if (!(type instanceof _primitives.Name)) {
  10443. throw new _util.FormatError("XObject should have a Name subtype");
  10444. }
  10445. if (type.name !== "Form") {
  10446. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10447. resolveXObject();
  10448. return;
  10449. }
  10450. const currentState = stateManager.state.clone();
  10451. const xObjStateManager = new StateManager(currentState);
  10452. const matrix = xobj.dict.getArray("Matrix");
  10453. if (Array.isArray(matrix) && matrix.length === 6) {
  10454. xObjStateManager.transform(matrix);
  10455. }
  10456. enqueueChunk();
  10457. const sinkWrapper = {
  10458. enqueueInvoked: false,
  10459. enqueue(chunk, size) {
  10460. this.enqueueInvoked = true;
  10461. sink.enqueue(chunk, size);
  10462. },
  10463. get desiredSize() {
  10464. return sink.desiredSize;
  10465. },
  10466. get ready() {
  10467. return sink.ready;
  10468. }
  10469. };
  10470. self.getTextContent({
  10471. stream: xobj,
  10472. task,
  10473. resources: xobj.dict.get("Resources") || resources,
  10474. stateManager: xObjStateManager,
  10475. combineTextItems,
  10476. includeMarkedContent,
  10477. sink: sinkWrapper,
  10478. seenStyles,
  10479. viewBox,
  10480. markedContentData
  10481. }).then(function () {
  10482. if (!sinkWrapper.enqueueInvoked) {
  10483. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10484. }
  10485. resolveXObject();
  10486. }, rejectXObject);
  10487. }).catch(function (reason) {
  10488. if (reason instanceof _util.AbortException) {
  10489. return;
  10490. }
  10491. if (self.options.ignoreErrors) {
  10492. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  10493. return;
  10494. }
  10495. throw reason;
  10496. }));
  10497. return;
  10498. case _util.OPS.setGState:
  10499. isValidName = args[0] instanceof _primitives.Name;
  10500. name = args[0].name;
  10501. if (isValidName && emptyGStateCache.getByName(name)) {
  10502. break;
  10503. }
  10504. next(new Promise(function (resolveGState, rejectGState) {
  10505. if (!isValidName) {
  10506. throw new _util.FormatError("GState must be referred to by name.");
  10507. }
  10508. const extGState = resources.get("ExtGState");
  10509. if (!(extGState instanceof _primitives.Dict)) {
  10510. throw new _util.FormatError("ExtGState should be a dictionary.");
  10511. }
  10512. const gState = extGState.get(name);
  10513. if (!(gState instanceof _primitives.Dict)) {
  10514. throw new _util.FormatError("GState should be a dictionary.");
  10515. }
  10516. const gStateFont = gState.get("Font");
  10517. if (!gStateFont) {
  10518. emptyGStateCache.set(name, gState.objId, true);
  10519. resolveGState();
  10520. return;
  10521. }
  10522. flushTextContentItem();
  10523. textState.fontName = null;
  10524. textState.fontSize = gStateFont[1];
  10525. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  10526. }).catch(function (reason) {
  10527. if (reason instanceof _util.AbortException) {
  10528. return;
  10529. }
  10530. if (self.options.ignoreErrors) {
  10531. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  10532. return;
  10533. }
  10534. throw reason;
  10535. }));
  10536. return;
  10537. case _util.OPS.beginMarkedContent:
  10538. flushTextContentItem();
  10539. if (includeMarkedContent) {
  10540. markedContentData.level++;
  10541. textContent.items.push({
  10542. type: "beginMarkedContent",
  10543. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10544. });
  10545. }
  10546. break;
  10547. case _util.OPS.beginMarkedContentProps:
  10548. flushTextContentItem();
  10549. if (includeMarkedContent) {
  10550. markedContentData.level++;
  10551. let mcid = null;
  10552. if (args[1] instanceof _primitives.Dict) {
  10553. mcid = args[1].get("MCID");
  10554. }
  10555. textContent.items.push({
  10556. type: "beginMarkedContentProps",
  10557. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  10558. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10559. });
  10560. }
  10561. break;
  10562. case _util.OPS.endMarkedContent:
  10563. flushTextContentItem();
  10564. if (includeMarkedContent) {
  10565. if (markedContentData.level === 0) {
  10566. break;
  10567. }
  10568. markedContentData.level--;
  10569. textContent.items.push({
  10570. type: "endMarkedContent"
  10571. });
  10572. }
  10573. break;
  10574. }
  10575. if (textContent.items.length >= sink.desiredSize) {
  10576. stop = true;
  10577. break;
  10578. }
  10579. }
  10580. if (stop) {
  10581. next(deferred);
  10582. return;
  10583. }
  10584. flushTextContentItem();
  10585. enqueueChunk();
  10586. resolve();
  10587. }).catch(reason => {
  10588. if (reason instanceof _util.AbortException) {
  10589. return;
  10590. }
  10591. if (this.options.ignoreErrors) {
  10592. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  10593. flushTextContentItem();
  10594. enqueueChunk();
  10595. return;
  10596. }
  10597. throw reason;
  10598. });
  10599. }
  10600. extractDataStructures(dict, baseDict, properties) {
  10601. const xref = this.xref;
  10602. let cidToGidBytes;
  10603. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  10604. if (properties.composite) {
  10605. const cidSystemInfo = dict.get("CIDSystemInfo");
  10606. if (cidSystemInfo instanceof _primitives.Dict) {
  10607. properties.cidSystemInfo = {
  10608. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  10609. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  10610. supplement: cidSystemInfo.get("Supplement")
  10611. };
  10612. }
  10613. try {
  10614. const cidToGidMap = dict.get("CIDToGIDMap");
  10615. if (cidToGidMap instanceof _base_stream.BaseStream) {
  10616. cidToGidBytes = cidToGidMap.getBytes();
  10617. }
  10618. } catch (ex) {
  10619. if (!this.options.ignoreErrors) {
  10620. throw ex;
  10621. }
  10622. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  10623. }
  10624. }
  10625. const differences = [];
  10626. let baseEncodingName = null;
  10627. let encoding;
  10628. if (dict.has("Encoding")) {
  10629. encoding = dict.get("Encoding");
  10630. if (encoding instanceof _primitives.Dict) {
  10631. baseEncodingName = encoding.get("BaseEncoding");
  10632. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  10633. if (encoding.has("Differences")) {
  10634. const diffEncoding = encoding.get("Differences");
  10635. let index = 0;
  10636. for (const entry of diffEncoding) {
  10637. const data = xref.fetchIfRef(entry);
  10638. if (typeof data === "number") {
  10639. index = data;
  10640. } else if (data instanceof _primitives.Name) {
  10641. differences[index++] = data.name;
  10642. } else {
  10643. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  10644. }
  10645. }
  10646. }
  10647. } else if (encoding instanceof _primitives.Name) {
  10648. baseEncodingName = encoding.name;
  10649. } else {
  10650. const msg = "Encoding is not a Name nor a Dict";
  10651. if (!this.options.ignoreErrors) {
  10652. throw new _util.FormatError(msg);
  10653. }
  10654. (0, _util.warn)(msg);
  10655. }
  10656. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  10657. baseEncodingName = null;
  10658. }
  10659. }
  10660. if (baseEncodingName) {
  10661. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10662. } else {
  10663. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  10664. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  10665. encoding = _encodings.StandardEncoding;
  10666. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  10667. encoding = _encodings.WinAnsiEncoding;
  10668. }
  10669. if (isSymbolicFont) {
  10670. encoding = _encodings.MacRomanEncoding;
  10671. if (!properties.file || properties.isInternalFont) {
  10672. if (/Symbol/i.test(properties.name)) {
  10673. encoding = _encodings.SymbolSetEncoding;
  10674. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  10675. encoding = _encodings.ZapfDingbatsEncoding;
  10676. }
  10677. }
  10678. }
  10679. properties.defaultEncoding = encoding;
  10680. }
  10681. properties.differences = differences;
  10682. properties.baseEncodingName = baseEncodingName;
  10683. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  10684. properties.dict = dict;
  10685. return toUnicodePromise.then(readToUnicode => {
  10686. properties.toUnicode = readToUnicode;
  10687. return this.buildToUnicode(properties);
  10688. }).then(builtToUnicode => {
  10689. properties.toUnicode = builtToUnicode;
  10690. if (cidToGidBytes) {
  10691. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  10692. }
  10693. return properties;
  10694. });
  10695. }
  10696. _simpleFontToUnicode(properties, forceGlyphs = false) {
  10697. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  10698. const toUnicode = [];
  10699. const encoding = properties.defaultEncoding.slice();
  10700. const baseEncodingName = properties.baseEncodingName;
  10701. const differences = properties.differences;
  10702. for (const charcode in differences) {
  10703. const glyphName = differences[charcode];
  10704. if (glyphName === ".notdef") {
  10705. continue;
  10706. }
  10707. encoding[charcode] = glyphName;
  10708. }
  10709. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  10710. for (const charcode in encoding) {
  10711. let glyphName = encoding[charcode];
  10712. if (glyphName === "") {
  10713. continue;
  10714. }
  10715. let unicode = glyphsUnicodeMap[glyphName];
  10716. if (unicode !== undefined) {
  10717. toUnicode[charcode] = String.fromCharCode(unicode);
  10718. continue;
  10719. }
  10720. let code = 0;
  10721. switch (glyphName[0]) {
  10722. case "G":
  10723. if (glyphName.length === 3) {
  10724. code = parseInt(glyphName.substring(1), 16);
  10725. }
  10726. break;
  10727. case "g":
  10728. if (glyphName.length === 5) {
  10729. code = parseInt(glyphName.substring(1), 16);
  10730. }
  10731. break;
  10732. case "C":
  10733. case "c":
  10734. if (glyphName.length >= 3 && glyphName.length <= 4) {
  10735. const codeStr = glyphName.substring(1);
  10736. if (forceGlyphs) {
  10737. code = parseInt(codeStr, 16);
  10738. break;
  10739. }
  10740. code = +codeStr;
  10741. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  10742. return this._simpleFontToUnicode(properties, true);
  10743. }
  10744. }
  10745. break;
  10746. case "u":
  10747. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  10748. if (unicode !== -1) {
  10749. code = unicode;
  10750. }
  10751. break;
  10752. }
  10753. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  10754. if (baseEncodingName && code === +charcode) {
  10755. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10756. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  10757. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10758. continue;
  10759. }
  10760. }
  10761. toUnicode[charcode] = String.fromCodePoint(code);
  10762. }
  10763. }
  10764. return toUnicode;
  10765. }
  10766. async buildToUnicode(properties) {
  10767. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  10768. if (properties.hasIncludedToUnicodeMap) {
  10769. if (!properties.composite && properties.hasEncoding) {
  10770. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  10771. }
  10772. return properties.toUnicode;
  10773. }
  10774. if (!properties.composite) {
  10775. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  10776. }
  10777. 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"))) {
  10778. const {
  10779. registry,
  10780. ordering
  10781. } = properties.cidSystemInfo;
  10782. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  10783. const ucs2CMap = await _cmap.CMapFactory.create({
  10784. encoding: ucs2CMapName,
  10785. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10786. useCMap: null
  10787. });
  10788. const toUnicode = [];
  10789. properties.cMap.forEach(function (charcode, cid) {
  10790. if (cid > 0xffff) {
  10791. throw new _util.FormatError("Max size of CID is 65,535");
  10792. }
  10793. const ucs2 = ucs2CMap.lookup(cid);
  10794. if (ucs2) {
  10795. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  10796. }
  10797. });
  10798. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  10799. }
  10800. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  10801. }
  10802. readToUnicode(cmapObj) {
  10803. if (!cmapObj) {
  10804. return Promise.resolve(null);
  10805. }
  10806. if (cmapObj instanceof _primitives.Name) {
  10807. return _cmap.CMapFactory.create({
  10808. encoding: cmapObj,
  10809. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10810. useCMap: null
  10811. }).then(function (cmap) {
  10812. if (cmap instanceof _cmap.IdentityCMap) {
  10813. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10814. }
  10815. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  10816. });
  10817. } else if (cmapObj instanceof _base_stream.BaseStream) {
  10818. return _cmap.CMapFactory.create({
  10819. encoding: cmapObj,
  10820. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10821. useCMap: null
  10822. }).then(function (cmap) {
  10823. if (cmap instanceof _cmap.IdentityCMap) {
  10824. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10825. }
  10826. const map = new Array(cmap.length);
  10827. cmap.forEach(function (charCode, token) {
  10828. if (typeof token === "number") {
  10829. map[charCode] = String.fromCodePoint(token);
  10830. return;
  10831. }
  10832. const str = [];
  10833. for (let k = 0; k < token.length; k += 2) {
  10834. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10835. if ((w1 & 0xf800) !== 0xd800) {
  10836. str.push(w1);
  10837. continue;
  10838. }
  10839. k += 2;
  10840. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10841. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  10842. }
  10843. map[charCode] = String.fromCodePoint(...str);
  10844. });
  10845. return new _to_unicode_map.ToUnicodeMap(map);
  10846. }, reason => {
  10847. if (reason instanceof _util.AbortException) {
  10848. return null;
  10849. }
  10850. if (this.options.ignoreErrors) {
  10851. this.handler.send("UnsupportedFeature", {
  10852. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  10853. });
  10854. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  10855. return null;
  10856. }
  10857. throw reason;
  10858. });
  10859. }
  10860. return Promise.resolve(null);
  10861. }
  10862. readCidToGidMap(glyphsData, toUnicode) {
  10863. const result = [];
  10864. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  10865. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  10866. const code = j >> 1;
  10867. if (glyphID === 0 && !toUnicode.has(code)) {
  10868. continue;
  10869. }
  10870. result[code] = glyphID;
  10871. }
  10872. return result;
  10873. }
  10874. extractWidths(dict, descriptor, properties) {
  10875. const xref = this.xref;
  10876. let glyphsWidths = [];
  10877. let defaultWidth = 0;
  10878. const glyphsVMetrics = [];
  10879. let defaultVMetrics;
  10880. let i, ii, j, jj, start, code, widths;
  10881. if (properties.composite) {
  10882. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  10883. widths = dict.get("W");
  10884. if (widths) {
  10885. for (i = 0, ii = widths.length; i < ii; i++) {
  10886. start = xref.fetchIfRef(widths[i++]);
  10887. code = xref.fetchIfRef(widths[i]);
  10888. if (Array.isArray(code)) {
  10889. for (j = 0, jj = code.length; j < jj; j++) {
  10890. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  10891. }
  10892. } else {
  10893. const width = xref.fetchIfRef(widths[++i]);
  10894. for (j = start; j <= code; j++) {
  10895. glyphsWidths[j] = width;
  10896. }
  10897. }
  10898. }
  10899. }
  10900. if (properties.vertical) {
  10901. let vmetrics = dict.getArray("DW2") || [880, -1000];
  10902. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  10903. vmetrics = dict.get("W2");
  10904. if (vmetrics) {
  10905. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  10906. start = xref.fetchIfRef(vmetrics[i++]);
  10907. code = xref.fetchIfRef(vmetrics[i]);
  10908. if (Array.isArray(code)) {
  10909. for (j = 0, jj = code.length; j < jj; j++) {
  10910. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  10911. }
  10912. } else {
  10913. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  10914. for (j = start; j <= code; j++) {
  10915. glyphsVMetrics[j] = vmetric;
  10916. }
  10917. }
  10918. }
  10919. }
  10920. }
  10921. } else {
  10922. const firstChar = properties.firstChar;
  10923. widths = dict.get("Widths");
  10924. if (widths) {
  10925. j = firstChar;
  10926. for (i = 0, ii = widths.length; i < ii; i++) {
  10927. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  10928. }
  10929. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  10930. } else {
  10931. const baseFontName = dict.get("BaseFont");
  10932. if (baseFontName instanceof _primitives.Name) {
  10933. const metrics = this.getBaseFontMetrics(baseFontName.name);
  10934. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  10935. defaultWidth = metrics.defaultWidth;
  10936. }
  10937. }
  10938. }
  10939. let isMonospace = true;
  10940. let firstWidth = defaultWidth;
  10941. for (const glyph in glyphsWidths) {
  10942. const glyphWidth = glyphsWidths[glyph];
  10943. if (!glyphWidth) {
  10944. continue;
  10945. }
  10946. if (!firstWidth) {
  10947. firstWidth = glyphWidth;
  10948. continue;
  10949. }
  10950. if (firstWidth !== glyphWidth) {
  10951. isMonospace = false;
  10952. break;
  10953. }
  10954. }
  10955. if (isMonospace) {
  10956. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  10957. }
  10958. properties.defaultWidth = defaultWidth;
  10959. properties.widths = glyphsWidths;
  10960. properties.defaultVMetrics = defaultVMetrics;
  10961. properties.vmetrics = glyphsVMetrics;
  10962. }
  10963. isSerifFont(baseFontName) {
  10964. const fontNameWoStyle = baseFontName.split("-")[0];
  10965. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  10966. }
  10967. getBaseFontMetrics(name) {
  10968. let defaultWidth = 0;
  10969. let widths = Object.create(null);
  10970. let monospace = false;
  10971. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  10972. let lookupName = stdFontMap[name] || name;
  10973. const Metrics = (0, _metrics.getMetrics)();
  10974. if (!(lookupName in Metrics)) {
  10975. if (this.isSerifFont(name)) {
  10976. lookupName = "Times-Roman";
  10977. } else {
  10978. lookupName = "Helvetica";
  10979. }
  10980. }
  10981. const glyphWidths = Metrics[lookupName];
  10982. if (typeof glyphWidths === "number") {
  10983. defaultWidth = glyphWidths;
  10984. monospace = true;
  10985. } else {
  10986. widths = glyphWidths();
  10987. }
  10988. return {
  10989. defaultWidth,
  10990. monospace,
  10991. widths
  10992. };
  10993. }
  10994. buildCharCodeToWidth(widthsByGlyphName, properties) {
  10995. const widths = Object.create(null);
  10996. const differences = properties.differences;
  10997. const encoding = properties.defaultEncoding;
  10998. for (let charCode = 0; charCode < 256; charCode++) {
  10999. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  11000. widths[charCode] = widthsByGlyphName[differences[charCode]];
  11001. continue;
  11002. }
  11003. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  11004. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  11005. continue;
  11006. }
  11007. }
  11008. return widths;
  11009. }
  11010. preEvaluateFont(dict) {
  11011. const baseDict = dict;
  11012. let type = dict.get("Subtype");
  11013. if (!(type instanceof _primitives.Name)) {
  11014. throw new _util.FormatError("invalid font Subtype");
  11015. }
  11016. let composite = false;
  11017. let hash, toUnicode;
  11018. if (type.name === "Type0") {
  11019. const df = dict.get("DescendantFonts");
  11020. if (!df) {
  11021. throw new _util.FormatError("Descendant fonts are not specified");
  11022. }
  11023. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  11024. if (!(dict instanceof _primitives.Dict)) {
  11025. throw new _util.FormatError("Descendant font is not a dictionary.");
  11026. }
  11027. type = dict.get("Subtype");
  11028. if (!(type instanceof _primitives.Name)) {
  11029. throw new _util.FormatError("invalid font Subtype");
  11030. }
  11031. composite = true;
  11032. }
  11033. const firstChar = dict.get("FirstChar") || 0,
  11034. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  11035. const descriptor = dict.get("FontDescriptor");
  11036. if (descriptor) {
  11037. hash = new _murmurhash.MurmurHash3_64();
  11038. const encoding = baseDict.getRaw("Encoding");
  11039. if (encoding instanceof _primitives.Name) {
  11040. hash.update(encoding.name);
  11041. } else if (encoding instanceof _primitives.Ref) {
  11042. hash.update(encoding.toString());
  11043. } else if (encoding instanceof _primitives.Dict) {
  11044. for (const entry of encoding.getRawValues()) {
  11045. if (entry instanceof _primitives.Name) {
  11046. hash.update(entry.name);
  11047. } else if (entry instanceof _primitives.Ref) {
  11048. hash.update(entry.toString());
  11049. } else if (Array.isArray(entry)) {
  11050. const diffLength = entry.length,
  11051. diffBuf = new Array(diffLength);
  11052. for (let j = 0; j < diffLength; j++) {
  11053. const diffEntry = entry[j];
  11054. if (diffEntry instanceof _primitives.Name) {
  11055. diffBuf[j] = diffEntry.name;
  11056. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  11057. diffBuf[j] = diffEntry.toString();
  11058. }
  11059. }
  11060. hash.update(diffBuf.join());
  11061. }
  11062. }
  11063. }
  11064. hash.update(`${firstChar}-${lastChar}`);
  11065. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  11066. if (toUnicode instanceof _base_stream.BaseStream) {
  11067. const stream = toUnicode.str || toUnicode;
  11068. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  11069. hash.update(uint8array);
  11070. } else if (toUnicode instanceof _primitives.Name) {
  11071. hash.update(toUnicode.name);
  11072. }
  11073. const widths = dict.get("Widths") || baseDict.get("Widths");
  11074. if (Array.isArray(widths)) {
  11075. const widthsBuf = [];
  11076. for (const entry of widths) {
  11077. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11078. widthsBuf.push(entry.toString());
  11079. }
  11080. }
  11081. hash.update(widthsBuf.join());
  11082. }
  11083. if (composite) {
  11084. hash.update("compositeFont");
  11085. const compositeWidths = dict.get("W") || baseDict.get("W");
  11086. if (Array.isArray(compositeWidths)) {
  11087. const widthsBuf = [];
  11088. for (const entry of compositeWidths) {
  11089. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11090. widthsBuf.push(entry.toString());
  11091. } else if (Array.isArray(entry)) {
  11092. const subWidthsBuf = [];
  11093. for (const element of entry) {
  11094. if (typeof element === "number" || element instanceof _primitives.Ref) {
  11095. subWidthsBuf.push(element.toString());
  11096. }
  11097. }
  11098. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  11099. }
  11100. }
  11101. hash.update(widthsBuf.join());
  11102. }
  11103. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  11104. if (cidToGidMap instanceof _primitives.Name) {
  11105. hash.update(cidToGidMap.name);
  11106. } else if (cidToGidMap instanceof _primitives.Ref) {
  11107. hash.update(cidToGidMap.toString());
  11108. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  11109. hash.update(cidToGidMap.peekBytes());
  11110. }
  11111. }
  11112. }
  11113. return {
  11114. descriptor,
  11115. dict,
  11116. baseDict,
  11117. composite,
  11118. type: type.name,
  11119. firstChar,
  11120. lastChar,
  11121. toUnicode,
  11122. hash: hash ? hash.hexdigest() : ""
  11123. };
  11124. }
  11125. async translateFont({
  11126. descriptor,
  11127. dict,
  11128. baseDict,
  11129. composite,
  11130. type,
  11131. firstChar,
  11132. lastChar,
  11133. toUnicode,
  11134. cssFontInfo
  11135. }) {
  11136. const isType3Font = type === "Type3";
  11137. let properties;
  11138. if (!descriptor) {
  11139. if (isType3Font) {
  11140. descriptor = new _primitives.Dict(null);
  11141. descriptor.set("FontName", _primitives.Name.get(type));
  11142. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  11143. } else {
  11144. let baseFontName = dict.get("BaseFont");
  11145. if (!(baseFontName instanceof _primitives.Name)) {
  11146. throw new _util.FormatError("Base font is not specified");
  11147. }
  11148. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  11149. const metrics = this.getBaseFontMetrics(baseFontName);
  11150. const fontNameWoStyle = baseFontName.split("-")[0];
  11151. 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);
  11152. properties = {
  11153. type,
  11154. name: baseFontName,
  11155. loadedName: baseDict.loadedName,
  11156. widths: metrics.widths,
  11157. defaultWidth: metrics.defaultWidth,
  11158. isSimulatedFlags: true,
  11159. flags,
  11160. firstChar,
  11161. lastChar,
  11162. toUnicode,
  11163. xHeight: 0,
  11164. capHeight: 0,
  11165. italicAngle: 0,
  11166. isType3Font
  11167. };
  11168. const widths = dict.get("Widths");
  11169. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  11170. let file = null;
  11171. if (standardFontName) {
  11172. properties.isStandardFont = true;
  11173. file = await this.fetchStandardFontData(standardFontName);
  11174. properties.isInternalFont = !!file;
  11175. }
  11176. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  11177. if (widths) {
  11178. const glyphWidths = [];
  11179. let j = firstChar;
  11180. for (const width of widths) {
  11181. glyphWidths[j++] = this.xref.fetchIfRef(width);
  11182. }
  11183. newProperties.widths = glyphWidths;
  11184. } else {
  11185. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  11186. }
  11187. return new _fonts.Font(baseFontName, file, newProperties);
  11188. });
  11189. }
  11190. }
  11191. let fontName = descriptor.get("FontName");
  11192. let baseFont = dict.get("BaseFont");
  11193. if (typeof fontName === "string") {
  11194. fontName = _primitives.Name.get(fontName);
  11195. }
  11196. if (typeof baseFont === "string") {
  11197. baseFont = _primitives.Name.get(baseFont);
  11198. }
  11199. if (!isType3Font) {
  11200. const fontNameStr = fontName && fontName.name;
  11201. const baseFontStr = baseFont && baseFont.name;
  11202. if (fontNameStr !== baseFontStr) {
  11203. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  11204. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  11205. fontName = baseFont;
  11206. }
  11207. }
  11208. }
  11209. fontName = fontName || baseFont;
  11210. if (!(fontName instanceof _primitives.Name)) {
  11211. throw new _util.FormatError("invalid font name");
  11212. }
  11213. let fontFile, subtype, length1, length2, length3;
  11214. try {
  11215. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  11216. } catch (ex) {
  11217. if (!this.options.ignoreErrors) {
  11218. throw ex;
  11219. }
  11220. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  11221. fontFile = new _stream.NullStream();
  11222. }
  11223. let isStandardFont = false;
  11224. let isInternalFont = false;
  11225. let glyphScaleFactors = null;
  11226. if (fontFile) {
  11227. if (fontFile.dict) {
  11228. const subtypeEntry = fontFile.dict.get("Subtype");
  11229. if (subtypeEntry instanceof _primitives.Name) {
  11230. subtype = subtypeEntry.name;
  11231. }
  11232. length1 = fontFile.dict.get("Length1");
  11233. length2 = fontFile.dict.get("Length2");
  11234. length3 = fontFile.dict.get("Length3");
  11235. }
  11236. } else if (cssFontInfo) {
  11237. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  11238. if (standardFontName) {
  11239. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  11240. cssFontInfo.metrics = standardFontName.metrics || null;
  11241. glyphScaleFactors = standardFontName.factors || null;
  11242. fontFile = await this.fetchStandardFontData(standardFontName.name);
  11243. isInternalFont = !!fontFile;
  11244. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  11245. composite = true;
  11246. }
  11247. } else if (!isType3Font) {
  11248. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  11249. if (standardFontName) {
  11250. isStandardFont = true;
  11251. fontFile = await this.fetchStandardFontData(standardFontName);
  11252. isInternalFont = !!fontFile;
  11253. }
  11254. }
  11255. properties = {
  11256. type,
  11257. name: fontName.name,
  11258. subtype,
  11259. file: fontFile,
  11260. length1,
  11261. length2,
  11262. length3,
  11263. isStandardFont,
  11264. isInternalFont,
  11265. loadedName: baseDict.loadedName,
  11266. composite,
  11267. fixedPitch: false,
  11268. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  11269. firstChar,
  11270. lastChar,
  11271. toUnicode,
  11272. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  11273. ascent: descriptor.get("Ascent"),
  11274. descent: descriptor.get("Descent"),
  11275. xHeight: descriptor.get("XHeight") || 0,
  11276. capHeight: descriptor.get("CapHeight") || 0,
  11277. flags: descriptor.get("Flags"),
  11278. italicAngle: descriptor.get("ItalicAngle") || 0,
  11279. isType3Font,
  11280. cssFontInfo,
  11281. scaleFactors: glyphScaleFactors
  11282. };
  11283. if (composite) {
  11284. const cidEncoding = baseDict.get("Encoding");
  11285. if (cidEncoding instanceof _primitives.Name) {
  11286. properties.cidEncoding = cidEncoding.name;
  11287. }
  11288. const cMap = await _cmap.CMapFactory.create({
  11289. encoding: cidEncoding,
  11290. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  11291. useCMap: null
  11292. });
  11293. properties.cMap = cMap;
  11294. properties.vertical = properties.cMap.vertical;
  11295. }
  11296. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  11297. this.extractWidths(dict, descriptor, newProperties);
  11298. return new _fonts.Font(fontName.name, fontFile, newProperties);
  11299. });
  11300. }
  11301. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  11302. function buildPath(fontChar) {
  11303. const glyphName = `${font.loadedName}_path_${fontChar}`;
  11304. try {
  11305. if (font.renderer.hasBuiltPath(fontChar)) {
  11306. return;
  11307. }
  11308. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  11309. } catch (reason) {
  11310. if (evaluatorOptions.ignoreErrors) {
  11311. handler.send("UnsupportedFeature", {
  11312. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  11313. });
  11314. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  11315. return;
  11316. }
  11317. throw reason;
  11318. }
  11319. }
  11320. for (const glyph of glyphs) {
  11321. buildPath(glyph.fontChar);
  11322. const accent = glyph.accent;
  11323. if (accent && accent.fontChar) {
  11324. buildPath(accent.fontChar);
  11325. }
  11326. }
  11327. }
  11328. static get fallbackFontDict() {
  11329. const dict = new _primitives.Dict();
  11330. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  11331. dict.set("Type", _primitives.Name.get("FallbackType"));
  11332. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  11333. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  11334. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  11335. }
  11336. }
  11337. exports.PartialEvaluator = PartialEvaluator;
  11338. class TranslatedFont {
  11339. constructor({
  11340. loadedName,
  11341. font,
  11342. dict,
  11343. evaluatorOptions
  11344. }) {
  11345. this.loadedName = loadedName;
  11346. this.font = font;
  11347. this.dict = dict;
  11348. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  11349. this.type3Loaded = null;
  11350. this.type3Dependencies = font.isType3Font ? new Set() : null;
  11351. this.sent = false;
  11352. }
  11353. send(handler) {
  11354. if (this.sent) {
  11355. return;
  11356. }
  11357. this.sent = true;
  11358. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  11359. }
  11360. fallback(handler) {
  11361. if (!this.font.data) {
  11362. return;
  11363. }
  11364. this.font.disableFontFace = true;
  11365. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  11366. }
  11367. loadType3Data(evaluator, resources, task) {
  11368. if (this.type3Loaded) {
  11369. return this.type3Loaded;
  11370. }
  11371. if (!this.font.isType3Font) {
  11372. throw new Error("Must be a Type3 font.");
  11373. }
  11374. const type3Evaluator = evaluator.clone({
  11375. ignoreErrors: false
  11376. });
  11377. type3Evaluator.parsingType3Font = true;
  11378. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  11379. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  11380. type3FontRefs.put(this.dict.objId);
  11381. }
  11382. type3Evaluator.type3FontRefs = type3FontRefs;
  11383. const translatedFont = this.font,
  11384. type3Dependencies = this.type3Dependencies;
  11385. let loadCharProcsPromise = Promise.resolve();
  11386. const charProcs = this.dict.get("CharProcs");
  11387. const fontResources = this.dict.get("Resources") || resources;
  11388. const charProcOperatorList = Object.create(null);
  11389. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  11390. width = fontBBox[2] - fontBBox[0],
  11391. height = fontBBox[3] - fontBBox[1];
  11392. const fontBBoxSize = Math.hypot(width, height);
  11393. for (const key of charProcs.getKeys()) {
  11394. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  11395. const glyphStream = charProcs.get(key);
  11396. const operatorList = new _operator_list.OperatorList();
  11397. return type3Evaluator.getOperatorList({
  11398. stream: glyphStream,
  11399. task,
  11400. resources: fontResources,
  11401. operatorList
  11402. }).then(() => {
  11403. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  11404. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  11405. }
  11406. charProcOperatorList[key] = operatorList.getIR();
  11407. for (const dependency of operatorList.dependencies) {
  11408. type3Dependencies.add(dependency);
  11409. }
  11410. }).catch(function (reason) {
  11411. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  11412. const dummyOperatorList = new _operator_list.OperatorList();
  11413. charProcOperatorList[key] = dummyOperatorList.getIR();
  11414. });
  11415. });
  11416. }
  11417. this.type3Loaded = loadCharProcsPromise.then(() => {
  11418. translatedFont.charProcOperatorList = charProcOperatorList;
  11419. if (this._bbox) {
  11420. translatedFont.isCharBBox = true;
  11421. translatedFont.bbox = this._bbox;
  11422. }
  11423. });
  11424. return this.type3Loaded;
  11425. }
  11426. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  11427. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  11428. width = charBBox[2] - charBBox[0],
  11429. height = charBBox[3] - charBBox[1];
  11430. const charBBoxSize = Math.hypot(width, height);
  11431. if (width === 0 || height === 0) {
  11432. operatorList.fnArray.splice(0, 1);
  11433. operatorList.argsArray.splice(0, 1);
  11434. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  11435. if (!this._bbox) {
  11436. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  11437. }
  11438. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  11439. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  11440. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  11441. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  11442. }
  11443. let i = 0,
  11444. ii = operatorList.length;
  11445. while (i < ii) {
  11446. switch (operatorList.fnArray[i]) {
  11447. case _util.OPS.setCharWidthAndBounds:
  11448. break;
  11449. case _util.OPS.setStrokeColorSpace:
  11450. case _util.OPS.setFillColorSpace:
  11451. case _util.OPS.setStrokeColor:
  11452. case _util.OPS.setStrokeColorN:
  11453. case _util.OPS.setFillColor:
  11454. case _util.OPS.setFillColorN:
  11455. case _util.OPS.setStrokeGray:
  11456. case _util.OPS.setFillGray:
  11457. case _util.OPS.setStrokeRGBColor:
  11458. case _util.OPS.setFillRGBColor:
  11459. case _util.OPS.setStrokeCMYKColor:
  11460. case _util.OPS.setFillCMYKColor:
  11461. case _util.OPS.shadingFill:
  11462. case _util.OPS.setRenderingIntent:
  11463. operatorList.fnArray.splice(i, 1);
  11464. operatorList.argsArray.splice(i, 1);
  11465. ii--;
  11466. continue;
  11467. case _util.OPS.setGState:
  11468. const [gStateObj] = operatorList.argsArray[i];
  11469. let j = 0,
  11470. jj = gStateObj.length;
  11471. while (j < jj) {
  11472. const [gStateKey] = gStateObj[j];
  11473. switch (gStateKey) {
  11474. case "TR":
  11475. case "TR2":
  11476. case "HT":
  11477. case "BG":
  11478. case "BG2":
  11479. case "UCR":
  11480. case "UCR2":
  11481. gStateObj.splice(j, 1);
  11482. jj--;
  11483. continue;
  11484. }
  11485. j++;
  11486. }
  11487. break;
  11488. }
  11489. i++;
  11490. }
  11491. }
  11492. }
  11493. class StateManager {
  11494. constructor(initialState = new EvalState()) {
  11495. this.state = initialState;
  11496. this.stateStack = [];
  11497. }
  11498. save() {
  11499. const old = this.state;
  11500. this.stateStack.push(this.state);
  11501. this.state = old.clone();
  11502. }
  11503. restore() {
  11504. const prev = this.stateStack.pop();
  11505. if (prev) {
  11506. this.state = prev;
  11507. }
  11508. }
  11509. transform(args) {
  11510. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  11511. }
  11512. }
  11513. class TextState {
  11514. constructor() {
  11515. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11516. this.fontName = null;
  11517. this.fontSize = 0;
  11518. this.loadedName = null;
  11519. this.font = null;
  11520. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  11521. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  11522. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  11523. this.charSpacing = 0;
  11524. this.wordSpacing = 0;
  11525. this.leading = 0;
  11526. this.textHScale = 1;
  11527. this.textRise = 0;
  11528. }
  11529. setTextMatrix(a, b, c, d, e, f) {
  11530. const m = this.textMatrix;
  11531. m[0] = a;
  11532. m[1] = b;
  11533. m[2] = c;
  11534. m[3] = d;
  11535. m[4] = e;
  11536. m[5] = f;
  11537. }
  11538. setTextLineMatrix(a, b, c, d, e, f) {
  11539. const m = this.textLineMatrix;
  11540. m[0] = a;
  11541. m[1] = b;
  11542. m[2] = c;
  11543. m[3] = d;
  11544. m[4] = e;
  11545. m[5] = f;
  11546. }
  11547. translateTextMatrix(x, y) {
  11548. const m = this.textMatrix;
  11549. m[4] = m[0] * x + m[2] * y + m[4];
  11550. m[5] = m[1] * x + m[3] * y + m[5];
  11551. }
  11552. translateTextLineMatrix(x, y) {
  11553. const m = this.textLineMatrix;
  11554. m[4] = m[0] * x + m[2] * y + m[4];
  11555. m[5] = m[1] * x + m[3] * y + m[5];
  11556. }
  11557. carriageReturn() {
  11558. this.translateTextLineMatrix(0, -this.leading);
  11559. this.textMatrix = this.textLineMatrix.slice();
  11560. }
  11561. clone() {
  11562. const clone = Object.create(this);
  11563. clone.textMatrix = this.textMatrix.slice();
  11564. clone.textLineMatrix = this.textLineMatrix.slice();
  11565. clone.fontMatrix = this.fontMatrix.slice();
  11566. return clone;
  11567. }
  11568. }
  11569. class EvalState {
  11570. constructor() {
  11571. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11572. this.font = null;
  11573. this.textRenderingMode = _util.TextRenderingMode.FILL;
  11574. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  11575. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  11576. }
  11577. clone() {
  11578. return Object.create(this);
  11579. }
  11580. }
  11581. class EvaluatorPreprocessor {
  11582. static get opMap() {
  11583. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  11584. t.w = {
  11585. id: _util.OPS.setLineWidth,
  11586. numArgs: 1,
  11587. variableArgs: false
  11588. };
  11589. t.J = {
  11590. id: _util.OPS.setLineCap,
  11591. numArgs: 1,
  11592. variableArgs: false
  11593. };
  11594. t.j = {
  11595. id: _util.OPS.setLineJoin,
  11596. numArgs: 1,
  11597. variableArgs: false
  11598. };
  11599. t.M = {
  11600. id: _util.OPS.setMiterLimit,
  11601. numArgs: 1,
  11602. variableArgs: false
  11603. };
  11604. t.d = {
  11605. id: _util.OPS.setDash,
  11606. numArgs: 2,
  11607. variableArgs: false
  11608. };
  11609. t.ri = {
  11610. id: _util.OPS.setRenderingIntent,
  11611. numArgs: 1,
  11612. variableArgs: false
  11613. };
  11614. t.i = {
  11615. id: _util.OPS.setFlatness,
  11616. numArgs: 1,
  11617. variableArgs: false
  11618. };
  11619. t.gs = {
  11620. id: _util.OPS.setGState,
  11621. numArgs: 1,
  11622. variableArgs: false
  11623. };
  11624. t.q = {
  11625. id: _util.OPS.save,
  11626. numArgs: 0,
  11627. variableArgs: false
  11628. };
  11629. t.Q = {
  11630. id: _util.OPS.restore,
  11631. numArgs: 0,
  11632. variableArgs: false
  11633. };
  11634. t.cm = {
  11635. id: _util.OPS.transform,
  11636. numArgs: 6,
  11637. variableArgs: false
  11638. };
  11639. t.m = {
  11640. id: _util.OPS.moveTo,
  11641. numArgs: 2,
  11642. variableArgs: false
  11643. };
  11644. t.l = {
  11645. id: _util.OPS.lineTo,
  11646. numArgs: 2,
  11647. variableArgs: false
  11648. };
  11649. t.c = {
  11650. id: _util.OPS.curveTo,
  11651. numArgs: 6,
  11652. variableArgs: false
  11653. };
  11654. t.v = {
  11655. id: _util.OPS.curveTo2,
  11656. numArgs: 4,
  11657. variableArgs: false
  11658. };
  11659. t.y = {
  11660. id: _util.OPS.curveTo3,
  11661. numArgs: 4,
  11662. variableArgs: false
  11663. };
  11664. t.h = {
  11665. id: _util.OPS.closePath,
  11666. numArgs: 0,
  11667. variableArgs: false
  11668. };
  11669. t.re = {
  11670. id: _util.OPS.rectangle,
  11671. numArgs: 4,
  11672. variableArgs: false
  11673. };
  11674. t.S = {
  11675. id: _util.OPS.stroke,
  11676. numArgs: 0,
  11677. variableArgs: false
  11678. };
  11679. t.s = {
  11680. id: _util.OPS.closeStroke,
  11681. numArgs: 0,
  11682. variableArgs: false
  11683. };
  11684. t.f = {
  11685. id: _util.OPS.fill,
  11686. numArgs: 0,
  11687. variableArgs: false
  11688. };
  11689. t.F = {
  11690. id: _util.OPS.fill,
  11691. numArgs: 0,
  11692. variableArgs: false
  11693. };
  11694. t["f*"] = {
  11695. id: _util.OPS.eoFill,
  11696. numArgs: 0,
  11697. variableArgs: false
  11698. };
  11699. t.B = {
  11700. id: _util.OPS.fillStroke,
  11701. numArgs: 0,
  11702. variableArgs: false
  11703. };
  11704. t["B*"] = {
  11705. id: _util.OPS.eoFillStroke,
  11706. numArgs: 0,
  11707. variableArgs: false
  11708. };
  11709. t.b = {
  11710. id: _util.OPS.closeFillStroke,
  11711. numArgs: 0,
  11712. variableArgs: false
  11713. };
  11714. t["b*"] = {
  11715. id: _util.OPS.closeEOFillStroke,
  11716. numArgs: 0,
  11717. variableArgs: false
  11718. };
  11719. t.n = {
  11720. id: _util.OPS.endPath,
  11721. numArgs: 0,
  11722. variableArgs: false
  11723. };
  11724. t.W = {
  11725. id: _util.OPS.clip,
  11726. numArgs: 0,
  11727. variableArgs: false
  11728. };
  11729. t["W*"] = {
  11730. id: _util.OPS.eoClip,
  11731. numArgs: 0,
  11732. variableArgs: false
  11733. };
  11734. t.BT = {
  11735. id: _util.OPS.beginText,
  11736. numArgs: 0,
  11737. variableArgs: false
  11738. };
  11739. t.ET = {
  11740. id: _util.OPS.endText,
  11741. numArgs: 0,
  11742. variableArgs: false
  11743. };
  11744. t.Tc = {
  11745. id: _util.OPS.setCharSpacing,
  11746. numArgs: 1,
  11747. variableArgs: false
  11748. };
  11749. t.Tw = {
  11750. id: _util.OPS.setWordSpacing,
  11751. numArgs: 1,
  11752. variableArgs: false
  11753. };
  11754. t.Tz = {
  11755. id: _util.OPS.setHScale,
  11756. numArgs: 1,
  11757. variableArgs: false
  11758. };
  11759. t.TL = {
  11760. id: _util.OPS.setLeading,
  11761. numArgs: 1,
  11762. variableArgs: false
  11763. };
  11764. t.Tf = {
  11765. id: _util.OPS.setFont,
  11766. numArgs: 2,
  11767. variableArgs: false
  11768. };
  11769. t.Tr = {
  11770. id: _util.OPS.setTextRenderingMode,
  11771. numArgs: 1,
  11772. variableArgs: false
  11773. };
  11774. t.Ts = {
  11775. id: _util.OPS.setTextRise,
  11776. numArgs: 1,
  11777. variableArgs: false
  11778. };
  11779. t.Td = {
  11780. id: _util.OPS.moveText,
  11781. numArgs: 2,
  11782. variableArgs: false
  11783. };
  11784. t.TD = {
  11785. id: _util.OPS.setLeadingMoveText,
  11786. numArgs: 2,
  11787. variableArgs: false
  11788. };
  11789. t.Tm = {
  11790. id: _util.OPS.setTextMatrix,
  11791. numArgs: 6,
  11792. variableArgs: false
  11793. };
  11794. t["T*"] = {
  11795. id: _util.OPS.nextLine,
  11796. numArgs: 0,
  11797. variableArgs: false
  11798. };
  11799. t.Tj = {
  11800. id: _util.OPS.showText,
  11801. numArgs: 1,
  11802. variableArgs: false
  11803. };
  11804. t.TJ = {
  11805. id: _util.OPS.showSpacedText,
  11806. numArgs: 1,
  11807. variableArgs: false
  11808. };
  11809. t["'"] = {
  11810. id: _util.OPS.nextLineShowText,
  11811. numArgs: 1,
  11812. variableArgs: false
  11813. };
  11814. t['"'] = {
  11815. id: _util.OPS.nextLineSetSpacingShowText,
  11816. numArgs: 3,
  11817. variableArgs: false
  11818. };
  11819. t.d0 = {
  11820. id: _util.OPS.setCharWidth,
  11821. numArgs: 2,
  11822. variableArgs: false
  11823. };
  11824. t.d1 = {
  11825. id: _util.OPS.setCharWidthAndBounds,
  11826. numArgs: 6,
  11827. variableArgs: false
  11828. };
  11829. t.CS = {
  11830. id: _util.OPS.setStrokeColorSpace,
  11831. numArgs: 1,
  11832. variableArgs: false
  11833. };
  11834. t.cs = {
  11835. id: _util.OPS.setFillColorSpace,
  11836. numArgs: 1,
  11837. variableArgs: false
  11838. };
  11839. t.SC = {
  11840. id: _util.OPS.setStrokeColor,
  11841. numArgs: 4,
  11842. variableArgs: true
  11843. };
  11844. t.SCN = {
  11845. id: _util.OPS.setStrokeColorN,
  11846. numArgs: 33,
  11847. variableArgs: true
  11848. };
  11849. t.sc = {
  11850. id: _util.OPS.setFillColor,
  11851. numArgs: 4,
  11852. variableArgs: true
  11853. };
  11854. t.scn = {
  11855. id: _util.OPS.setFillColorN,
  11856. numArgs: 33,
  11857. variableArgs: true
  11858. };
  11859. t.G = {
  11860. id: _util.OPS.setStrokeGray,
  11861. numArgs: 1,
  11862. variableArgs: false
  11863. };
  11864. t.g = {
  11865. id: _util.OPS.setFillGray,
  11866. numArgs: 1,
  11867. variableArgs: false
  11868. };
  11869. t.RG = {
  11870. id: _util.OPS.setStrokeRGBColor,
  11871. numArgs: 3,
  11872. variableArgs: false
  11873. };
  11874. t.rg = {
  11875. id: _util.OPS.setFillRGBColor,
  11876. numArgs: 3,
  11877. variableArgs: false
  11878. };
  11879. t.K = {
  11880. id: _util.OPS.setStrokeCMYKColor,
  11881. numArgs: 4,
  11882. variableArgs: false
  11883. };
  11884. t.k = {
  11885. id: _util.OPS.setFillCMYKColor,
  11886. numArgs: 4,
  11887. variableArgs: false
  11888. };
  11889. t.sh = {
  11890. id: _util.OPS.shadingFill,
  11891. numArgs: 1,
  11892. variableArgs: false
  11893. };
  11894. t.BI = {
  11895. id: _util.OPS.beginInlineImage,
  11896. numArgs: 0,
  11897. variableArgs: false
  11898. };
  11899. t.ID = {
  11900. id: _util.OPS.beginImageData,
  11901. numArgs: 0,
  11902. variableArgs: false
  11903. };
  11904. t.EI = {
  11905. id: _util.OPS.endInlineImage,
  11906. numArgs: 1,
  11907. variableArgs: false
  11908. };
  11909. t.Do = {
  11910. id: _util.OPS.paintXObject,
  11911. numArgs: 1,
  11912. variableArgs: false
  11913. };
  11914. t.MP = {
  11915. id: _util.OPS.markPoint,
  11916. numArgs: 1,
  11917. variableArgs: false
  11918. };
  11919. t.DP = {
  11920. id: _util.OPS.markPointProps,
  11921. numArgs: 2,
  11922. variableArgs: false
  11923. };
  11924. t.BMC = {
  11925. id: _util.OPS.beginMarkedContent,
  11926. numArgs: 1,
  11927. variableArgs: false
  11928. };
  11929. t.BDC = {
  11930. id: _util.OPS.beginMarkedContentProps,
  11931. numArgs: 2,
  11932. variableArgs: false
  11933. };
  11934. t.EMC = {
  11935. id: _util.OPS.endMarkedContent,
  11936. numArgs: 0,
  11937. variableArgs: false
  11938. };
  11939. t.BX = {
  11940. id: _util.OPS.beginCompat,
  11941. numArgs: 0,
  11942. variableArgs: false
  11943. };
  11944. t.EX = {
  11945. id: _util.OPS.endCompat,
  11946. numArgs: 0,
  11947. variableArgs: false
  11948. };
  11949. t.BM = null;
  11950. t.BD = null;
  11951. t.true = null;
  11952. t.fa = null;
  11953. t.fal = null;
  11954. t.fals = null;
  11955. t.false = null;
  11956. t.nu = null;
  11957. t.nul = null;
  11958. t.null = null;
  11959. });
  11960. return (0, _util.shadow)(this, "opMap", getOPMap());
  11961. }
  11962. static get MAX_INVALID_PATH_OPS() {
  11963. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  11964. }
  11965. constructor(stream, xref, stateManager = new StateManager()) {
  11966. this.parser = new _parser.Parser({
  11967. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  11968. xref
  11969. });
  11970. this.stateManager = stateManager;
  11971. this.nonProcessedArgs = [];
  11972. this._isPathOp = false;
  11973. this._numInvalidPathOPS = 0;
  11974. }
  11975. get savedStatesDepth() {
  11976. return this.stateManager.stateStack.length;
  11977. }
  11978. read(operation) {
  11979. let args = operation.args;
  11980. while (true) {
  11981. const obj = this.parser.getObj();
  11982. if (obj instanceof _primitives.Cmd) {
  11983. const cmd = obj.cmd;
  11984. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  11985. if (!opSpec) {
  11986. (0, _util.warn)(`Unknown command "${cmd}".`);
  11987. continue;
  11988. }
  11989. const fn = opSpec.id;
  11990. const numArgs = opSpec.numArgs;
  11991. let argsLength = args !== null ? args.length : 0;
  11992. if (!this._isPathOp) {
  11993. this._numInvalidPathOPS = 0;
  11994. }
  11995. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  11996. if (!opSpec.variableArgs) {
  11997. if (argsLength !== numArgs) {
  11998. const nonProcessedArgs = this.nonProcessedArgs;
  11999. while (argsLength > numArgs) {
  12000. nonProcessedArgs.push(args.shift());
  12001. argsLength--;
  12002. }
  12003. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  12004. if (args === null) {
  12005. args = [];
  12006. }
  12007. args.unshift(nonProcessedArgs.pop());
  12008. argsLength++;
  12009. }
  12010. }
  12011. if (argsLength < numArgs) {
  12012. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  12013. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  12014. throw new _util.FormatError(`Invalid ${partialMsg}`);
  12015. }
  12016. (0, _util.warn)(`Skipping ${partialMsg}`);
  12017. if (args !== null) {
  12018. args.length = 0;
  12019. }
  12020. continue;
  12021. }
  12022. } else if (argsLength > numArgs) {
  12023. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  12024. }
  12025. this.preprocessCommand(fn, args);
  12026. operation.fn = fn;
  12027. operation.args = args;
  12028. return true;
  12029. }
  12030. if (obj === _primitives.EOF) {
  12031. return false;
  12032. }
  12033. if (obj !== null) {
  12034. if (args === null) {
  12035. args = [];
  12036. }
  12037. args.push(obj);
  12038. if (args.length > 33) {
  12039. throw new _util.FormatError("Too many arguments");
  12040. }
  12041. }
  12042. }
  12043. }
  12044. preprocessCommand(fn, args) {
  12045. switch (fn | 0) {
  12046. case _util.OPS.save:
  12047. this.stateManager.save();
  12048. break;
  12049. case _util.OPS.restore:
  12050. this.stateManager.restore();
  12051. break;
  12052. case _util.OPS.transform:
  12053. this.stateManager.transform(args);
  12054. break;
  12055. }
  12056. }
  12057. }
  12058. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  12059. /***/ }),
  12060. /* 14 */
  12061. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12062. Object.defineProperty(exports, "__esModule", ({
  12063. value: true
  12064. }));
  12065. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  12066. var _util = __w_pdfjs_require__(2);
  12067. var _primitives = __w_pdfjs_require__(3);
  12068. var _base_stream = __w_pdfjs_require__(5);
  12069. var _parser = __w_pdfjs_require__(15);
  12070. var _core_utils = __w_pdfjs_require__(4);
  12071. var _stream = __w_pdfjs_require__(8);
  12072. 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"];
  12073. const MAX_MAP_RANGE = 2 ** 24 - 1;
  12074. class CMap {
  12075. constructor(builtInCMap = false) {
  12076. this.codespaceRanges = [[], [], [], []];
  12077. this.numCodespaceRanges = 0;
  12078. this._map = [];
  12079. this.name = "";
  12080. this.vertical = false;
  12081. this.useCMap = null;
  12082. this.builtInCMap = builtInCMap;
  12083. }
  12084. addCodespaceRange(n, low, high) {
  12085. this.codespaceRanges[n - 1].push(low, high);
  12086. this.numCodespaceRanges++;
  12087. }
  12088. mapCidRange(low, high, dstLow) {
  12089. if (high - low > MAX_MAP_RANGE) {
  12090. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  12091. }
  12092. while (low <= high) {
  12093. this._map[low++] = dstLow++;
  12094. }
  12095. }
  12096. mapBfRange(low, high, dstLow) {
  12097. if (high - low > MAX_MAP_RANGE) {
  12098. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  12099. }
  12100. const lastByte = dstLow.length - 1;
  12101. while (low <= high) {
  12102. this._map[low++] = dstLow;
  12103. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  12104. if (nextCharCode > 0xff) {
  12105. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  12106. continue;
  12107. }
  12108. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  12109. }
  12110. }
  12111. mapBfRangeToArray(low, high, array) {
  12112. if (high - low > MAX_MAP_RANGE) {
  12113. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  12114. }
  12115. const ii = array.length;
  12116. let i = 0;
  12117. while (low <= high && i < ii) {
  12118. this._map[low] = array[i++];
  12119. ++low;
  12120. }
  12121. }
  12122. mapOne(src, dst) {
  12123. this._map[src] = dst;
  12124. }
  12125. lookup(code) {
  12126. return this._map[code];
  12127. }
  12128. contains(code) {
  12129. return this._map[code] !== undefined;
  12130. }
  12131. forEach(callback) {
  12132. const map = this._map;
  12133. const length = map.length;
  12134. if (length <= 0x10000) {
  12135. for (let i = 0; i < length; i++) {
  12136. if (map[i] !== undefined) {
  12137. callback(i, map[i]);
  12138. }
  12139. }
  12140. } else {
  12141. for (const i in map) {
  12142. callback(i, map[i]);
  12143. }
  12144. }
  12145. }
  12146. charCodeOf(value) {
  12147. const map = this._map;
  12148. if (map.length <= 0x10000) {
  12149. return map.indexOf(value);
  12150. }
  12151. for (const charCode in map) {
  12152. if (map[charCode] === value) {
  12153. return charCode | 0;
  12154. }
  12155. }
  12156. return -1;
  12157. }
  12158. getMap() {
  12159. return this._map;
  12160. }
  12161. readCharCode(str, offset, out) {
  12162. let c = 0;
  12163. const codespaceRanges = this.codespaceRanges;
  12164. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12165. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  12166. const codespaceRange = codespaceRanges[n];
  12167. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12168. const low = codespaceRange[k++];
  12169. const high = codespaceRange[k++];
  12170. if (c >= low && c <= high) {
  12171. out.charcode = c;
  12172. out.length = n + 1;
  12173. return;
  12174. }
  12175. }
  12176. }
  12177. out.charcode = 0;
  12178. out.length = 1;
  12179. }
  12180. getCharCodeLength(charCode) {
  12181. const codespaceRanges = this.codespaceRanges;
  12182. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12183. const codespaceRange = codespaceRanges[n];
  12184. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12185. const low = codespaceRange[k++];
  12186. const high = codespaceRange[k++];
  12187. if (charCode >= low && charCode <= high) {
  12188. return n + 1;
  12189. }
  12190. }
  12191. }
  12192. return 1;
  12193. }
  12194. get length() {
  12195. return this._map.length;
  12196. }
  12197. get isIdentityCMap() {
  12198. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  12199. return false;
  12200. }
  12201. if (this._map.length !== 0x10000) {
  12202. return false;
  12203. }
  12204. for (let i = 0; i < 0x10000; i++) {
  12205. if (this._map[i] !== i) {
  12206. return false;
  12207. }
  12208. }
  12209. return true;
  12210. }
  12211. }
  12212. exports.CMap = CMap;
  12213. class IdentityCMap extends CMap {
  12214. constructor(vertical, n) {
  12215. super();
  12216. this.vertical = vertical;
  12217. this.addCodespaceRange(n, 0, 0xffff);
  12218. }
  12219. mapCidRange(low, high, dstLow) {
  12220. (0, _util.unreachable)("should not call mapCidRange");
  12221. }
  12222. mapBfRange(low, high, dstLow) {
  12223. (0, _util.unreachable)("should not call mapBfRange");
  12224. }
  12225. mapBfRangeToArray(low, high, array) {
  12226. (0, _util.unreachable)("should not call mapBfRangeToArray");
  12227. }
  12228. mapOne(src, dst) {
  12229. (0, _util.unreachable)("should not call mapCidOne");
  12230. }
  12231. lookup(code) {
  12232. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  12233. }
  12234. contains(code) {
  12235. return Number.isInteger(code) && code <= 0xffff;
  12236. }
  12237. forEach(callback) {
  12238. for (let i = 0; i <= 0xffff; i++) {
  12239. callback(i, i);
  12240. }
  12241. }
  12242. charCodeOf(value) {
  12243. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  12244. }
  12245. getMap() {
  12246. const map = new Array(0x10000);
  12247. for (let i = 0; i <= 0xffff; i++) {
  12248. map[i] = i;
  12249. }
  12250. return map;
  12251. }
  12252. get length() {
  12253. return 0x10000;
  12254. }
  12255. get isIdentityCMap() {
  12256. (0, _util.unreachable)("should not access .isIdentityCMap");
  12257. }
  12258. }
  12259. exports.IdentityCMap = IdentityCMap;
  12260. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  12261. function hexToInt(a, size) {
  12262. let n = 0;
  12263. for (let i = 0; i <= size; i++) {
  12264. n = n << 8 | a[i];
  12265. }
  12266. return n >>> 0;
  12267. }
  12268. function hexToStr(a, size) {
  12269. if (size === 1) {
  12270. return String.fromCharCode(a[0], a[1]);
  12271. }
  12272. if (size === 3) {
  12273. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  12274. }
  12275. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  12276. }
  12277. function addHex(a, b, size) {
  12278. let c = 0;
  12279. for (let i = size; i >= 0; i--) {
  12280. c += a[i] + b[i];
  12281. a[i] = c & 255;
  12282. c >>= 8;
  12283. }
  12284. }
  12285. function incHex(a, size) {
  12286. let c = 1;
  12287. for (let i = size; i >= 0 && c > 0; i--) {
  12288. c += a[i];
  12289. a[i] = c & 255;
  12290. c >>= 8;
  12291. }
  12292. }
  12293. const MAX_NUM_SIZE = 16;
  12294. const MAX_ENCODED_NUM_SIZE = 19;
  12295. class BinaryCMapStream {
  12296. constructor(data) {
  12297. this.buffer = data;
  12298. this.pos = 0;
  12299. this.end = data.length;
  12300. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  12301. }
  12302. readByte() {
  12303. if (this.pos >= this.end) {
  12304. return -1;
  12305. }
  12306. return this.buffer[this.pos++];
  12307. }
  12308. readNumber() {
  12309. let n = 0;
  12310. let last;
  12311. do {
  12312. const b = this.readByte();
  12313. if (b < 0) {
  12314. throw new _util.FormatError("unexpected EOF in bcmap");
  12315. }
  12316. last = !(b & 0x80);
  12317. n = n << 7 | b & 0x7f;
  12318. } while (!last);
  12319. return n;
  12320. }
  12321. readSigned() {
  12322. const n = this.readNumber();
  12323. return n & 1 ? ~(n >>> 1) : n >>> 1;
  12324. }
  12325. readHex(num, size) {
  12326. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  12327. this.pos += size + 1;
  12328. }
  12329. readHexNumber(num, size) {
  12330. let last;
  12331. const stack = this.tmpBuf;
  12332. let sp = 0;
  12333. do {
  12334. const b = this.readByte();
  12335. if (b < 0) {
  12336. throw new _util.FormatError("unexpected EOF in bcmap");
  12337. }
  12338. last = !(b & 0x80);
  12339. stack[sp++] = b & 0x7f;
  12340. } while (!last);
  12341. let i = size,
  12342. buffer = 0,
  12343. bufferSize = 0;
  12344. while (i >= 0) {
  12345. while (bufferSize < 8 && stack.length > 0) {
  12346. buffer |= stack[--sp] << bufferSize;
  12347. bufferSize += 7;
  12348. }
  12349. num[i] = buffer & 255;
  12350. i--;
  12351. buffer >>= 8;
  12352. bufferSize -= 8;
  12353. }
  12354. }
  12355. readHexSigned(num, size) {
  12356. this.readHexNumber(num, size);
  12357. const sign = num[size] & 1 ? 255 : 0;
  12358. let c = 0;
  12359. for (let i = 0; i <= size; i++) {
  12360. c = (c & 1) << 8 | num[i];
  12361. num[i] = c >> 1 ^ sign;
  12362. }
  12363. }
  12364. readString() {
  12365. const len = this.readNumber();
  12366. let s = "";
  12367. for (let i = 0; i < len; i++) {
  12368. s += String.fromCharCode(this.readNumber());
  12369. }
  12370. return s;
  12371. }
  12372. }
  12373. class BinaryCMapReader {
  12374. async process(data, cMap, extend) {
  12375. const stream = new BinaryCMapStream(data);
  12376. const header = stream.readByte();
  12377. cMap.vertical = !!(header & 1);
  12378. let useCMap = null;
  12379. const start = new Uint8Array(MAX_NUM_SIZE);
  12380. const end = new Uint8Array(MAX_NUM_SIZE);
  12381. const char = new Uint8Array(MAX_NUM_SIZE);
  12382. const charCode = new Uint8Array(MAX_NUM_SIZE);
  12383. const tmp = new Uint8Array(MAX_NUM_SIZE);
  12384. let code;
  12385. let b;
  12386. while ((b = stream.readByte()) >= 0) {
  12387. const type = b >> 5;
  12388. if (type === 7) {
  12389. switch (b & 0x1f) {
  12390. case 0:
  12391. stream.readString();
  12392. break;
  12393. case 1:
  12394. useCMap = stream.readString();
  12395. break;
  12396. }
  12397. continue;
  12398. }
  12399. const sequence = !!(b & 0x10);
  12400. const dataSize = b & 15;
  12401. if (dataSize + 1 > MAX_NUM_SIZE) {
  12402. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  12403. }
  12404. const ucs2DataSize = 1;
  12405. const subitemsCount = stream.readNumber();
  12406. switch (type) {
  12407. case 0:
  12408. stream.readHex(start, dataSize);
  12409. stream.readHexNumber(end, dataSize);
  12410. addHex(end, start, dataSize);
  12411. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12412. for (let i = 1; i < subitemsCount; i++) {
  12413. incHex(end, dataSize);
  12414. stream.readHexNumber(start, dataSize);
  12415. addHex(start, end, dataSize);
  12416. stream.readHexNumber(end, dataSize);
  12417. addHex(end, start, dataSize);
  12418. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12419. }
  12420. break;
  12421. case 1:
  12422. stream.readHex(start, dataSize);
  12423. stream.readHexNumber(end, dataSize);
  12424. addHex(end, start, dataSize);
  12425. stream.readNumber();
  12426. for (let i = 1; i < subitemsCount; i++) {
  12427. incHex(end, dataSize);
  12428. stream.readHexNumber(start, dataSize);
  12429. addHex(start, end, dataSize);
  12430. stream.readHexNumber(end, dataSize);
  12431. addHex(end, start, dataSize);
  12432. stream.readNumber();
  12433. }
  12434. break;
  12435. case 2:
  12436. stream.readHex(char, dataSize);
  12437. code = stream.readNumber();
  12438. cMap.mapOne(hexToInt(char, dataSize), code);
  12439. for (let i = 1; i < subitemsCount; i++) {
  12440. incHex(char, dataSize);
  12441. if (!sequence) {
  12442. stream.readHexNumber(tmp, dataSize);
  12443. addHex(char, tmp, dataSize);
  12444. }
  12445. code = stream.readSigned() + (code + 1);
  12446. cMap.mapOne(hexToInt(char, dataSize), code);
  12447. }
  12448. break;
  12449. case 3:
  12450. stream.readHex(start, dataSize);
  12451. stream.readHexNumber(end, dataSize);
  12452. addHex(end, start, dataSize);
  12453. code = stream.readNumber();
  12454. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12455. for (let i = 1; i < subitemsCount; i++) {
  12456. incHex(end, dataSize);
  12457. if (!sequence) {
  12458. stream.readHexNumber(start, dataSize);
  12459. addHex(start, end, dataSize);
  12460. } else {
  12461. start.set(end);
  12462. }
  12463. stream.readHexNumber(end, dataSize);
  12464. addHex(end, start, dataSize);
  12465. code = stream.readNumber();
  12466. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12467. }
  12468. break;
  12469. case 4:
  12470. stream.readHex(char, ucs2DataSize);
  12471. stream.readHex(charCode, dataSize);
  12472. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12473. for (let i = 1; i < subitemsCount; i++) {
  12474. incHex(char, ucs2DataSize);
  12475. if (!sequence) {
  12476. stream.readHexNumber(tmp, ucs2DataSize);
  12477. addHex(char, tmp, ucs2DataSize);
  12478. }
  12479. incHex(charCode, dataSize);
  12480. stream.readHexSigned(tmp, dataSize);
  12481. addHex(charCode, tmp, dataSize);
  12482. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12483. }
  12484. break;
  12485. case 5:
  12486. stream.readHex(start, ucs2DataSize);
  12487. stream.readHexNumber(end, ucs2DataSize);
  12488. addHex(end, start, ucs2DataSize);
  12489. stream.readHex(charCode, dataSize);
  12490. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12491. for (let i = 1; i < subitemsCount; i++) {
  12492. incHex(end, ucs2DataSize);
  12493. if (!sequence) {
  12494. stream.readHexNumber(start, ucs2DataSize);
  12495. addHex(start, end, ucs2DataSize);
  12496. } else {
  12497. start.set(end);
  12498. }
  12499. stream.readHexNumber(end, ucs2DataSize);
  12500. addHex(end, start, ucs2DataSize);
  12501. stream.readHex(charCode, dataSize);
  12502. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12503. }
  12504. break;
  12505. default:
  12506. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  12507. }
  12508. }
  12509. if (useCMap) {
  12510. return extend(useCMap);
  12511. }
  12512. return cMap;
  12513. }
  12514. }
  12515. return BinaryCMapReader;
  12516. }();
  12517. const CMapFactory = function CMapFactoryClosure() {
  12518. function strToInt(str) {
  12519. let a = 0;
  12520. for (let i = 0; i < str.length; i++) {
  12521. a = a << 8 | str.charCodeAt(i);
  12522. }
  12523. return a >>> 0;
  12524. }
  12525. function expectString(obj) {
  12526. if (typeof obj !== "string") {
  12527. throw new _util.FormatError("Malformed CMap: expected string.");
  12528. }
  12529. }
  12530. function expectInt(obj) {
  12531. if (!Number.isInteger(obj)) {
  12532. throw new _util.FormatError("Malformed CMap: expected int.");
  12533. }
  12534. }
  12535. function parseBfChar(cMap, lexer) {
  12536. while (true) {
  12537. let obj = lexer.getObj();
  12538. if (obj === _primitives.EOF) {
  12539. break;
  12540. }
  12541. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  12542. return;
  12543. }
  12544. expectString(obj);
  12545. const src = strToInt(obj);
  12546. obj = lexer.getObj();
  12547. expectString(obj);
  12548. const dst = obj;
  12549. cMap.mapOne(src, dst);
  12550. }
  12551. }
  12552. function parseBfRange(cMap, lexer) {
  12553. while (true) {
  12554. let obj = lexer.getObj();
  12555. if (obj === _primitives.EOF) {
  12556. break;
  12557. }
  12558. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  12559. return;
  12560. }
  12561. expectString(obj);
  12562. const low = strToInt(obj);
  12563. obj = lexer.getObj();
  12564. expectString(obj);
  12565. const high = strToInt(obj);
  12566. obj = lexer.getObj();
  12567. if (Number.isInteger(obj) || typeof obj === "string") {
  12568. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  12569. cMap.mapBfRange(low, high, dstLow);
  12570. } else if ((0, _primitives.isCmd)(obj, "[")) {
  12571. obj = lexer.getObj();
  12572. const array = [];
  12573. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  12574. array.push(obj);
  12575. obj = lexer.getObj();
  12576. }
  12577. cMap.mapBfRangeToArray(low, high, array);
  12578. } else {
  12579. break;
  12580. }
  12581. }
  12582. throw new _util.FormatError("Invalid bf range.");
  12583. }
  12584. function parseCidChar(cMap, lexer) {
  12585. while (true) {
  12586. let obj = lexer.getObj();
  12587. if (obj === _primitives.EOF) {
  12588. break;
  12589. }
  12590. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  12591. return;
  12592. }
  12593. expectString(obj);
  12594. const src = strToInt(obj);
  12595. obj = lexer.getObj();
  12596. expectInt(obj);
  12597. const dst = obj;
  12598. cMap.mapOne(src, dst);
  12599. }
  12600. }
  12601. function parseCidRange(cMap, lexer) {
  12602. while (true) {
  12603. let obj = lexer.getObj();
  12604. if (obj === _primitives.EOF) {
  12605. break;
  12606. }
  12607. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  12608. return;
  12609. }
  12610. expectString(obj);
  12611. const low = strToInt(obj);
  12612. obj = lexer.getObj();
  12613. expectString(obj);
  12614. const high = strToInt(obj);
  12615. obj = lexer.getObj();
  12616. expectInt(obj);
  12617. const dstLow = obj;
  12618. cMap.mapCidRange(low, high, dstLow);
  12619. }
  12620. }
  12621. function parseCodespaceRange(cMap, lexer) {
  12622. while (true) {
  12623. let obj = lexer.getObj();
  12624. if (obj === _primitives.EOF) {
  12625. break;
  12626. }
  12627. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  12628. return;
  12629. }
  12630. if (typeof obj !== "string") {
  12631. break;
  12632. }
  12633. const low = strToInt(obj);
  12634. obj = lexer.getObj();
  12635. if (typeof obj !== "string") {
  12636. break;
  12637. }
  12638. const high = strToInt(obj);
  12639. cMap.addCodespaceRange(obj.length, low, high);
  12640. }
  12641. throw new _util.FormatError("Invalid codespace range.");
  12642. }
  12643. function parseWMode(cMap, lexer) {
  12644. const obj = lexer.getObj();
  12645. if (Number.isInteger(obj)) {
  12646. cMap.vertical = !!obj;
  12647. }
  12648. }
  12649. function parseCMapName(cMap, lexer) {
  12650. const obj = lexer.getObj();
  12651. if (obj instanceof _primitives.Name) {
  12652. cMap.name = obj.name;
  12653. }
  12654. }
  12655. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  12656. let previous, embeddedUseCMap;
  12657. objLoop: while (true) {
  12658. try {
  12659. const obj = lexer.getObj();
  12660. if (obj === _primitives.EOF) {
  12661. break;
  12662. } else if (obj instanceof _primitives.Name) {
  12663. if (obj.name === "WMode") {
  12664. parseWMode(cMap, lexer);
  12665. } else if (obj.name === "CMapName") {
  12666. parseCMapName(cMap, lexer);
  12667. }
  12668. previous = obj;
  12669. } else if (obj instanceof _primitives.Cmd) {
  12670. switch (obj.cmd) {
  12671. case "endcmap":
  12672. break objLoop;
  12673. case "usecmap":
  12674. if (previous instanceof _primitives.Name) {
  12675. embeddedUseCMap = previous.name;
  12676. }
  12677. break;
  12678. case "begincodespacerange":
  12679. parseCodespaceRange(cMap, lexer);
  12680. break;
  12681. case "beginbfchar":
  12682. parseBfChar(cMap, lexer);
  12683. break;
  12684. case "begincidchar":
  12685. parseCidChar(cMap, lexer);
  12686. break;
  12687. case "beginbfrange":
  12688. parseBfRange(cMap, lexer);
  12689. break;
  12690. case "begincidrange":
  12691. parseCidRange(cMap, lexer);
  12692. break;
  12693. }
  12694. }
  12695. } catch (ex) {
  12696. if (ex instanceof _core_utils.MissingDataException) {
  12697. throw ex;
  12698. }
  12699. (0, _util.warn)("Invalid cMap data: " + ex);
  12700. continue;
  12701. }
  12702. }
  12703. if (!useCMap && embeddedUseCMap) {
  12704. useCMap = embeddedUseCMap;
  12705. }
  12706. if (useCMap) {
  12707. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12708. }
  12709. return cMap;
  12710. }
  12711. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  12712. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  12713. if (cMap.numCodespaceRanges === 0) {
  12714. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  12715. for (let i = 0; i < useCodespaceRanges.length; i++) {
  12716. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  12717. }
  12718. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  12719. }
  12720. cMap.useCMap.forEach(function (key, value) {
  12721. if (!cMap.contains(key)) {
  12722. cMap.mapOne(key, cMap.useCMap.lookup(key));
  12723. }
  12724. });
  12725. return cMap;
  12726. }
  12727. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  12728. if (name === "Identity-H") {
  12729. return new IdentityCMap(false, 2);
  12730. } else if (name === "Identity-V") {
  12731. return new IdentityCMap(true, 2);
  12732. }
  12733. if (!BUILT_IN_CMAPS.includes(name)) {
  12734. throw new Error("Unknown CMap name: " + name);
  12735. }
  12736. if (!fetchBuiltInCMap) {
  12737. throw new Error("Built-in CMap parameters are not provided.");
  12738. }
  12739. const {
  12740. cMapData,
  12741. compressionType
  12742. } = await fetchBuiltInCMap(name);
  12743. const cMap = new CMap(true);
  12744. if (compressionType === _util.CMapCompressionType.BINARY) {
  12745. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  12746. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12747. });
  12748. }
  12749. if (compressionType === _util.CMapCompressionType.NONE) {
  12750. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  12751. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  12752. }
  12753. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  12754. }
  12755. return {
  12756. async create(params) {
  12757. const encoding = params.encoding;
  12758. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  12759. const useCMap = params.useCMap;
  12760. if (encoding instanceof _primitives.Name) {
  12761. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  12762. } else if (encoding instanceof _base_stream.BaseStream) {
  12763. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  12764. if (parsedCMap.isIdentityCMap) {
  12765. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  12766. }
  12767. return parsedCMap;
  12768. }
  12769. throw new Error("Encoding required.");
  12770. }
  12771. };
  12772. }();
  12773. exports.CMapFactory = CMapFactory;
  12774. /***/ }),
  12775. /* 15 */
  12776. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12777. Object.defineProperty(exports, "__esModule", ({
  12778. value: true
  12779. }));
  12780. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  12781. var _util = __w_pdfjs_require__(2);
  12782. var _primitives = __w_pdfjs_require__(3);
  12783. var _core_utils = __w_pdfjs_require__(4);
  12784. var _ascii_85_stream = __w_pdfjs_require__(16);
  12785. var _ascii_hex_stream = __w_pdfjs_require__(18);
  12786. var _ccitt_stream = __w_pdfjs_require__(19);
  12787. var _flate_stream = __w_pdfjs_require__(21);
  12788. var _jbig2_stream = __w_pdfjs_require__(22);
  12789. var _jpeg_stream = __w_pdfjs_require__(25);
  12790. var _jpx_stream = __w_pdfjs_require__(27);
  12791. var _lzw_stream = __w_pdfjs_require__(29);
  12792. var _stream = __w_pdfjs_require__(8);
  12793. var _predictor_stream = __w_pdfjs_require__(30);
  12794. var _run_length_stream = __w_pdfjs_require__(31);
  12795. const MAX_LENGTH_TO_CACHE = 1000;
  12796. function getInlineImageCacheKey(bytes) {
  12797. const strBuf = [],
  12798. ii = bytes.length;
  12799. let i = 0;
  12800. while (i < ii - 1) {
  12801. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  12802. }
  12803. if (i < ii) {
  12804. strBuf.push(bytes[i]);
  12805. }
  12806. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  12807. }
  12808. class Parser {
  12809. constructor({
  12810. lexer,
  12811. xref,
  12812. allowStreams = false,
  12813. recoveryMode = false
  12814. }) {
  12815. this.lexer = lexer;
  12816. this.xref = xref;
  12817. this.allowStreams = allowStreams;
  12818. this.recoveryMode = recoveryMode;
  12819. this.imageCache = Object.create(null);
  12820. this._imageId = 0;
  12821. this.refill();
  12822. }
  12823. refill() {
  12824. this.buf1 = this.lexer.getObj();
  12825. this.buf2 = this.lexer.getObj();
  12826. }
  12827. shift() {
  12828. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  12829. this.buf1 = this.buf2;
  12830. this.buf2 = null;
  12831. } else {
  12832. this.buf1 = this.buf2;
  12833. this.buf2 = this.lexer.getObj();
  12834. }
  12835. }
  12836. tryShift() {
  12837. try {
  12838. this.shift();
  12839. return true;
  12840. } catch (e) {
  12841. if (e instanceof _core_utils.MissingDataException) {
  12842. throw e;
  12843. }
  12844. return false;
  12845. }
  12846. }
  12847. getObj(cipherTransform = null) {
  12848. const buf1 = this.buf1;
  12849. this.shift();
  12850. if (buf1 instanceof _primitives.Cmd) {
  12851. switch (buf1.cmd) {
  12852. case "BI":
  12853. return this.makeInlineImage(cipherTransform);
  12854. case "[":
  12855. const array = [];
  12856. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  12857. array.push(this.getObj(cipherTransform));
  12858. }
  12859. if (this.buf1 === _primitives.EOF) {
  12860. if (this.recoveryMode) {
  12861. return array;
  12862. }
  12863. throw new _core_utils.ParserEOFException("End of file inside array.");
  12864. }
  12865. this.shift();
  12866. return array;
  12867. case "<<":
  12868. const dict = new _primitives.Dict(this.xref);
  12869. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  12870. if (!(this.buf1 instanceof _primitives.Name)) {
  12871. (0, _util.info)("Malformed dictionary: key must be a name object");
  12872. this.shift();
  12873. continue;
  12874. }
  12875. const key = this.buf1.name;
  12876. this.shift();
  12877. if (this.buf1 === _primitives.EOF) {
  12878. break;
  12879. }
  12880. dict.set(key, this.getObj(cipherTransform));
  12881. }
  12882. if (this.buf1 === _primitives.EOF) {
  12883. if (this.recoveryMode) {
  12884. return dict;
  12885. }
  12886. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  12887. }
  12888. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  12889. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12890. }
  12891. this.shift();
  12892. return dict;
  12893. default:
  12894. return buf1;
  12895. }
  12896. }
  12897. if (Number.isInteger(buf1)) {
  12898. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  12899. const ref = _primitives.Ref.get(buf1, this.buf1);
  12900. this.shift();
  12901. this.shift();
  12902. return ref;
  12903. }
  12904. return buf1;
  12905. }
  12906. if (typeof buf1 === "string") {
  12907. if (cipherTransform) {
  12908. return cipherTransform.decryptString(buf1);
  12909. }
  12910. return buf1;
  12911. }
  12912. return buf1;
  12913. }
  12914. findDefaultInlineStreamEnd(stream) {
  12915. const E = 0x45,
  12916. I = 0x49,
  12917. SPACE = 0x20,
  12918. LF = 0xa,
  12919. CR = 0xd,
  12920. NUL = 0x0;
  12921. const lexer = this.lexer,
  12922. startPos = stream.pos,
  12923. n = 10;
  12924. let state = 0,
  12925. ch,
  12926. maybeEIPos;
  12927. while ((ch = stream.getByte()) !== -1) {
  12928. if (state === 0) {
  12929. state = ch === E ? 1 : 0;
  12930. } else if (state === 1) {
  12931. state = ch === I ? 2 : 0;
  12932. } else {
  12933. if (ch === SPACE || ch === LF || ch === CR) {
  12934. maybeEIPos = stream.pos;
  12935. const followingBytes = stream.peekBytes(n);
  12936. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  12937. ch = followingBytes[i];
  12938. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  12939. continue;
  12940. }
  12941. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  12942. state = 0;
  12943. break;
  12944. }
  12945. }
  12946. if (state !== 2) {
  12947. continue;
  12948. }
  12949. if (lexer.knownCommands) {
  12950. const nextObj = lexer.peekObj();
  12951. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  12952. state = 0;
  12953. }
  12954. } else {
  12955. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  12956. }
  12957. if (state === 2) {
  12958. break;
  12959. }
  12960. } else {
  12961. state = 0;
  12962. }
  12963. }
  12964. }
  12965. if (ch === -1) {
  12966. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  12967. if (maybeEIPos) {
  12968. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  12969. stream.skip(-(stream.pos - maybeEIPos));
  12970. }
  12971. }
  12972. let endOffset = 4;
  12973. stream.skip(-endOffset);
  12974. ch = stream.peekByte();
  12975. stream.skip(endOffset);
  12976. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  12977. endOffset--;
  12978. }
  12979. return stream.pos - endOffset - startPos;
  12980. }
  12981. findDCTDecodeInlineStreamEnd(stream) {
  12982. const startPos = stream.pos;
  12983. let foundEOI = false,
  12984. b,
  12985. markerLength;
  12986. while ((b = stream.getByte()) !== -1) {
  12987. if (b !== 0xff) {
  12988. continue;
  12989. }
  12990. switch (stream.getByte()) {
  12991. case 0x00:
  12992. break;
  12993. case 0xff:
  12994. stream.skip(-1);
  12995. break;
  12996. case 0xd9:
  12997. foundEOI = true;
  12998. break;
  12999. case 0xc0:
  13000. case 0xc1:
  13001. case 0xc2:
  13002. case 0xc3:
  13003. case 0xc5:
  13004. case 0xc6:
  13005. case 0xc7:
  13006. case 0xc9:
  13007. case 0xca:
  13008. case 0xcb:
  13009. case 0xcd:
  13010. case 0xce:
  13011. case 0xcf:
  13012. case 0xc4:
  13013. case 0xcc:
  13014. case 0xda:
  13015. case 0xdb:
  13016. case 0xdc:
  13017. case 0xdd:
  13018. case 0xde:
  13019. case 0xdf:
  13020. case 0xe0:
  13021. case 0xe1:
  13022. case 0xe2:
  13023. case 0xe3:
  13024. case 0xe4:
  13025. case 0xe5:
  13026. case 0xe6:
  13027. case 0xe7:
  13028. case 0xe8:
  13029. case 0xe9:
  13030. case 0xea:
  13031. case 0xeb:
  13032. case 0xec:
  13033. case 0xed:
  13034. case 0xee:
  13035. case 0xef:
  13036. case 0xfe:
  13037. markerLength = stream.getUint16();
  13038. if (markerLength > 2) {
  13039. stream.skip(markerLength - 2);
  13040. } else {
  13041. stream.skip(-2);
  13042. }
  13043. break;
  13044. }
  13045. if (foundEOI) {
  13046. break;
  13047. }
  13048. }
  13049. const length = stream.pos - startPos;
  13050. if (b === -1) {
  13051. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  13052. stream.skip(-length);
  13053. return this.findDefaultInlineStreamEnd(stream);
  13054. }
  13055. this.inlineStreamSkipEI(stream);
  13056. return length;
  13057. }
  13058. findASCII85DecodeInlineStreamEnd(stream) {
  13059. const TILDE = 0x7e,
  13060. GT = 0x3e;
  13061. const startPos = stream.pos;
  13062. let ch;
  13063. while ((ch = stream.getByte()) !== -1) {
  13064. if (ch === TILDE) {
  13065. const tildePos = stream.pos;
  13066. ch = stream.peekByte();
  13067. while ((0, _core_utils.isWhiteSpace)(ch)) {
  13068. stream.skip();
  13069. ch = stream.peekByte();
  13070. }
  13071. if (ch === GT) {
  13072. stream.skip();
  13073. break;
  13074. }
  13075. if (stream.pos > tildePos) {
  13076. const maybeEI = stream.peekBytes(2);
  13077. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  13078. break;
  13079. }
  13080. }
  13081. }
  13082. }
  13083. const length = stream.pos - startPos;
  13084. if (ch === -1) {
  13085. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13086. stream.skip(-length);
  13087. return this.findDefaultInlineStreamEnd(stream);
  13088. }
  13089. this.inlineStreamSkipEI(stream);
  13090. return length;
  13091. }
  13092. findASCIIHexDecodeInlineStreamEnd(stream) {
  13093. const GT = 0x3e;
  13094. const startPos = stream.pos;
  13095. let ch;
  13096. while ((ch = stream.getByte()) !== -1) {
  13097. if (ch === GT) {
  13098. break;
  13099. }
  13100. }
  13101. const length = stream.pos - startPos;
  13102. if (ch === -1) {
  13103. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13104. stream.skip(-length);
  13105. return this.findDefaultInlineStreamEnd(stream);
  13106. }
  13107. this.inlineStreamSkipEI(stream);
  13108. return length;
  13109. }
  13110. inlineStreamSkipEI(stream) {
  13111. const E = 0x45,
  13112. I = 0x49;
  13113. let state = 0,
  13114. ch;
  13115. while ((ch = stream.getByte()) !== -1) {
  13116. if (state === 0) {
  13117. state = ch === E ? 1 : 0;
  13118. } else if (state === 1) {
  13119. state = ch === I ? 2 : 0;
  13120. } else if (state === 2) {
  13121. break;
  13122. }
  13123. }
  13124. }
  13125. makeInlineImage(cipherTransform) {
  13126. const lexer = this.lexer;
  13127. const stream = lexer.stream;
  13128. const dictMap = Object.create(null);
  13129. let dictLength;
  13130. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  13131. if (!(this.buf1 instanceof _primitives.Name)) {
  13132. throw new _util.FormatError("Dictionary key must be a name object");
  13133. }
  13134. const key = this.buf1.name;
  13135. this.shift();
  13136. if (this.buf1 === _primitives.EOF) {
  13137. break;
  13138. }
  13139. dictMap[key] = this.getObj(cipherTransform);
  13140. }
  13141. if (lexer.beginInlineImagePos !== -1) {
  13142. dictLength = stream.pos - lexer.beginInlineImagePos;
  13143. }
  13144. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  13145. let filterName;
  13146. if (filter instanceof _primitives.Name) {
  13147. filterName = filter.name;
  13148. } else if (Array.isArray(filter)) {
  13149. const filterZero = this.xref.fetchIfRef(filter[0]);
  13150. if (filterZero instanceof _primitives.Name) {
  13151. filterName = filterZero.name;
  13152. }
  13153. }
  13154. const startPos = stream.pos;
  13155. let length;
  13156. switch (filterName) {
  13157. case "DCT":
  13158. case "DCTDecode":
  13159. length = this.findDCTDecodeInlineStreamEnd(stream);
  13160. break;
  13161. case "A85":
  13162. case "ASCII85Decode":
  13163. length = this.findASCII85DecodeInlineStreamEnd(stream);
  13164. break;
  13165. case "AHx":
  13166. case "ASCIIHexDecode":
  13167. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  13168. break;
  13169. default:
  13170. length = this.findDefaultInlineStreamEnd(stream);
  13171. }
  13172. let cacheKey;
  13173. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  13174. const initialStreamPos = stream.pos;
  13175. stream.pos = lexer.beginInlineImagePos;
  13176. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  13177. stream.pos = initialStreamPos;
  13178. const cacheEntry = this.imageCache[cacheKey];
  13179. if (cacheEntry !== undefined) {
  13180. this.buf2 = _primitives.Cmd.get("EI");
  13181. this.shift();
  13182. cacheEntry.reset();
  13183. return cacheEntry;
  13184. }
  13185. }
  13186. const dict = new _primitives.Dict(this.xref);
  13187. for (const key in dictMap) {
  13188. dict.set(key, dictMap[key]);
  13189. }
  13190. let imageStream = stream.makeSubStream(startPos, length, dict);
  13191. if (cipherTransform) {
  13192. imageStream = cipherTransform.createStream(imageStream, length);
  13193. }
  13194. imageStream = this.filter(imageStream, dict, length);
  13195. imageStream.dict = dict;
  13196. if (cacheKey !== undefined) {
  13197. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  13198. this.imageCache[cacheKey] = imageStream;
  13199. }
  13200. this.buf2 = _primitives.Cmd.get("EI");
  13201. this.shift();
  13202. return imageStream;
  13203. }
  13204. _findStreamLength(startPos, signature) {
  13205. const {
  13206. stream
  13207. } = this.lexer;
  13208. stream.pos = startPos;
  13209. const SCAN_BLOCK_LENGTH = 2048;
  13210. const signatureLength = signature.length;
  13211. while (stream.pos < stream.end) {
  13212. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  13213. const scanLength = scanBytes.length - signatureLength;
  13214. if (scanLength <= 0) {
  13215. break;
  13216. }
  13217. let pos = 0;
  13218. while (pos < scanLength) {
  13219. let j = 0;
  13220. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  13221. j++;
  13222. }
  13223. if (j >= signatureLength) {
  13224. stream.pos += pos;
  13225. return stream.pos - startPos;
  13226. }
  13227. pos++;
  13228. }
  13229. stream.pos += scanLength;
  13230. }
  13231. return -1;
  13232. }
  13233. makeStream(dict, cipherTransform) {
  13234. const lexer = this.lexer;
  13235. let stream = lexer.stream;
  13236. lexer.skipToNextLine();
  13237. const startPos = stream.pos - 1;
  13238. let length = dict.get("Length");
  13239. if (!Number.isInteger(length)) {
  13240. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  13241. length = 0;
  13242. }
  13243. stream.pos = startPos + length;
  13244. lexer.nextChar();
  13245. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  13246. this.shift();
  13247. } else {
  13248. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  13249. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  13250. if (actualLength < 0) {
  13251. const MAX_TRUNCATION = 1;
  13252. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  13253. const end = ENDSTREAM_SIGNATURE.length - i;
  13254. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  13255. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  13256. if (maybeLength >= 0) {
  13257. const lastByte = stream.peekBytes(end + 1)[end];
  13258. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  13259. break;
  13260. }
  13261. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  13262. actualLength = maybeLength;
  13263. break;
  13264. }
  13265. }
  13266. if (actualLength < 0) {
  13267. throw new _util.FormatError("Missing endstream command.");
  13268. }
  13269. }
  13270. length = actualLength;
  13271. lexer.nextChar();
  13272. this.shift();
  13273. this.shift();
  13274. }
  13275. this.shift();
  13276. stream = stream.makeSubStream(startPos, length, dict);
  13277. if (cipherTransform) {
  13278. stream = cipherTransform.createStream(stream, length);
  13279. }
  13280. stream = this.filter(stream, dict, length);
  13281. stream.dict = dict;
  13282. return stream;
  13283. }
  13284. filter(stream, dict, length) {
  13285. let filter = dict.get("F", "Filter");
  13286. let params = dict.get("DP", "DecodeParms");
  13287. if (filter instanceof _primitives.Name) {
  13288. if (Array.isArray(params)) {
  13289. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  13290. }
  13291. return this.makeFilter(stream, filter.name, length, params);
  13292. }
  13293. let maybeLength = length;
  13294. if (Array.isArray(filter)) {
  13295. const filterArray = filter;
  13296. const paramsArray = params;
  13297. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  13298. filter = this.xref.fetchIfRef(filterArray[i]);
  13299. if (!(filter instanceof _primitives.Name)) {
  13300. throw new _util.FormatError(`Bad filter name "${filter}"`);
  13301. }
  13302. params = null;
  13303. if (Array.isArray(paramsArray) && i in paramsArray) {
  13304. params = this.xref.fetchIfRef(paramsArray[i]);
  13305. }
  13306. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  13307. maybeLength = null;
  13308. }
  13309. }
  13310. return stream;
  13311. }
  13312. makeFilter(stream, name, maybeLength, params) {
  13313. if (maybeLength === 0) {
  13314. (0, _util.warn)(`Empty "${name}" stream.`);
  13315. return new _stream.NullStream();
  13316. }
  13317. const xrefStats = this.xref.stats;
  13318. try {
  13319. switch (name) {
  13320. case "Fl":
  13321. case "FlateDecode":
  13322. xrefStats.addStreamType(_util.StreamType.FLATE);
  13323. if (params) {
  13324. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  13325. }
  13326. return new _flate_stream.FlateStream(stream, maybeLength);
  13327. case "LZW":
  13328. case "LZWDecode":
  13329. xrefStats.addStreamType(_util.StreamType.LZW);
  13330. let earlyChange = 1;
  13331. if (params) {
  13332. if (params.has("EarlyChange")) {
  13333. earlyChange = params.get("EarlyChange");
  13334. }
  13335. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  13336. }
  13337. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  13338. case "DCT":
  13339. case "DCTDecode":
  13340. xrefStats.addStreamType(_util.StreamType.DCT);
  13341. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  13342. case "JPX":
  13343. case "JPXDecode":
  13344. xrefStats.addStreamType(_util.StreamType.JPX);
  13345. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  13346. case "A85":
  13347. case "ASCII85Decode":
  13348. xrefStats.addStreamType(_util.StreamType.A85);
  13349. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  13350. case "AHx":
  13351. case "ASCIIHexDecode":
  13352. xrefStats.addStreamType(_util.StreamType.AHX);
  13353. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  13354. case "CCF":
  13355. case "CCITTFaxDecode":
  13356. xrefStats.addStreamType(_util.StreamType.CCF);
  13357. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  13358. case "RL":
  13359. case "RunLengthDecode":
  13360. xrefStats.addStreamType(_util.StreamType.RLX);
  13361. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  13362. case "JBIG2Decode":
  13363. xrefStats.addStreamType(_util.StreamType.JBIG);
  13364. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  13365. }
  13366. (0, _util.warn)(`Filter "${name}" is not supported.`);
  13367. return stream;
  13368. } catch (ex) {
  13369. if (ex instanceof _core_utils.MissingDataException) {
  13370. throw ex;
  13371. }
  13372. (0, _util.warn)(`Invalid stream: "${ex}"`);
  13373. return new _stream.NullStream();
  13374. }
  13375. }
  13376. }
  13377. exports.Parser = Parser;
  13378. 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];
  13379. function toHexDigit(ch) {
  13380. if (ch >= 0x30 && ch <= 0x39) {
  13381. return ch & 0x0f;
  13382. }
  13383. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13384. return (ch & 0x0f) + 9;
  13385. }
  13386. return -1;
  13387. }
  13388. class Lexer {
  13389. constructor(stream, knownCommands = null) {
  13390. this.stream = stream;
  13391. this.nextChar();
  13392. this.strBuf = [];
  13393. this.knownCommands = knownCommands;
  13394. this._hexStringNumWarn = 0;
  13395. this.beginInlineImagePos = -1;
  13396. }
  13397. nextChar() {
  13398. return this.currentChar = this.stream.getByte();
  13399. }
  13400. peekChar() {
  13401. return this.stream.peekByte();
  13402. }
  13403. getNumber() {
  13404. let ch = this.currentChar;
  13405. let eNotation = false;
  13406. let divideBy = 0;
  13407. let sign = 0;
  13408. if (ch === 0x2d) {
  13409. sign = -1;
  13410. ch = this.nextChar();
  13411. if (ch === 0x2d) {
  13412. ch = this.nextChar();
  13413. }
  13414. } else if (ch === 0x2b) {
  13415. sign = 1;
  13416. ch = this.nextChar();
  13417. }
  13418. if (ch === 0x0a || ch === 0x0d) {
  13419. do {
  13420. ch = this.nextChar();
  13421. } while (ch === 0x0a || ch === 0x0d);
  13422. }
  13423. if (ch === 0x2e) {
  13424. divideBy = 10;
  13425. ch = this.nextChar();
  13426. }
  13427. if (ch < 0x30 || ch > 0x39) {
  13428. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  13429. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  13430. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  13431. return 0;
  13432. }
  13433. throw new _util.FormatError(msg);
  13434. }
  13435. sign = sign || 1;
  13436. let baseValue = ch - 0x30;
  13437. let powerValue = 0;
  13438. let powerValueSign = 1;
  13439. while ((ch = this.nextChar()) >= 0) {
  13440. if (ch >= 0x30 && ch <= 0x39) {
  13441. const currentDigit = ch - 0x30;
  13442. if (eNotation) {
  13443. powerValue = powerValue * 10 + currentDigit;
  13444. } else {
  13445. if (divideBy !== 0) {
  13446. divideBy *= 10;
  13447. }
  13448. baseValue = baseValue * 10 + currentDigit;
  13449. }
  13450. } else if (ch === 0x2e) {
  13451. if (divideBy === 0) {
  13452. divideBy = 1;
  13453. } else {
  13454. break;
  13455. }
  13456. } else if (ch === 0x2d) {
  13457. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  13458. } else if (ch === 0x45 || ch === 0x65) {
  13459. ch = this.peekChar();
  13460. if (ch === 0x2b || ch === 0x2d) {
  13461. powerValueSign = ch === 0x2d ? -1 : 1;
  13462. this.nextChar();
  13463. } else if (ch < 0x30 || ch > 0x39) {
  13464. break;
  13465. }
  13466. eNotation = true;
  13467. } else {
  13468. break;
  13469. }
  13470. }
  13471. if (divideBy !== 0) {
  13472. baseValue /= divideBy;
  13473. }
  13474. if (eNotation) {
  13475. baseValue *= 10 ** (powerValueSign * powerValue);
  13476. }
  13477. return sign * baseValue;
  13478. }
  13479. getString() {
  13480. let numParen = 1;
  13481. let done = false;
  13482. const strBuf = this.strBuf;
  13483. strBuf.length = 0;
  13484. let ch = this.nextChar();
  13485. while (true) {
  13486. let charBuffered = false;
  13487. switch (ch | 0) {
  13488. case -1:
  13489. (0, _util.warn)("Unterminated string");
  13490. done = true;
  13491. break;
  13492. case 0x28:
  13493. ++numParen;
  13494. strBuf.push("(");
  13495. break;
  13496. case 0x29:
  13497. if (--numParen === 0) {
  13498. this.nextChar();
  13499. done = true;
  13500. } else {
  13501. strBuf.push(")");
  13502. }
  13503. break;
  13504. case 0x5c:
  13505. ch = this.nextChar();
  13506. switch (ch) {
  13507. case -1:
  13508. (0, _util.warn)("Unterminated string");
  13509. done = true;
  13510. break;
  13511. case 0x6e:
  13512. strBuf.push("\n");
  13513. break;
  13514. case 0x72:
  13515. strBuf.push("\r");
  13516. break;
  13517. case 0x74:
  13518. strBuf.push("\t");
  13519. break;
  13520. case 0x62:
  13521. strBuf.push("\b");
  13522. break;
  13523. case 0x66:
  13524. strBuf.push("\f");
  13525. break;
  13526. case 0x5c:
  13527. case 0x28:
  13528. case 0x29:
  13529. strBuf.push(String.fromCharCode(ch));
  13530. break;
  13531. case 0x30:
  13532. case 0x31:
  13533. case 0x32:
  13534. case 0x33:
  13535. case 0x34:
  13536. case 0x35:
  13537. case 0x36:
  13538. case 0x37:
  13539. let x = ch & 0x0f;
  13540. ch = this.nextChar();
  13541. charBuffered = true;
  13542. if (ch >= 0x30 && ch <= 0x37) {
  13543. x = (x << 3) + (ch & 0x0f);
  13544. ch = this.nextChar();
  13545. if (ch >= 0x30 && ch <= 0x37) {
  13546. charBuffered = false;
  13547. x = (x << 3) + (ch & 0x0f);
  13548. }
  13549. }
  13550. strBuf.push(String.fromCharCode(x));
  13551. break;
  13552. case 0x0d:
  13553. if (this.peekChar() === 0x0a) {
  13554. this.nextChar();
  13555. }
  13556. break;
  13557. case 0x0a:
  13558. break;
  13559. default:
  13560. strBuf.push(String.fromCharCode(ch));
  13561. break;
  13562. }
  13563. break;
  13564. default:
  13565. strBuf.push(String.fromCharCode(ch));
  13566. break;
  13567. }
  13568. if (done) {
  13569. break;
  13570. }
  13571. if (!charBuffered) {
  13572. ch = this.nextChar();
  13573. }
  13574. }
  13575. return strBuf.join("");
  13576. }
  13577. getName() {
  13578. let ch, previousCh;
  13579. const strBuf = this.strBuf;
  13580. strBuf.length = 0;
  13581. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13582. if (ch === 0x23) {
  13583. ch = this.nextChar();
  13584. if (specialChars[ch]) {
  13585. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  13586. strBuf.push("#");
  13587. break;
  13588. }
  13589. const x = toHexDigit(ch);
  13590. if (x !== -1) {
  13591. previousCh = ch;
  13592. ch = this.nextChar();
  13593. const x2 = toHexDigit(ch);
  13594. if (x2 === -1) {
  13595. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  13596. strBuf.push("#", String.fromCharCode(previousCh));
  13597. if (specialChars[ch]) {
  13598. break;
  13599. }
  13600. strBuf.push(String.fromCharCode(ch));
  13601. continue;
  13602. }
  13603. strBuf.push(String.fromCharCode(x << 4 | x2));
  13604. } else {
  13605. strBuf.push("#", String.fromCharCode(ch));
  13606. }
  13607. } else {
  13608. strBuf.push(String.fromCharCode(ch));
  13609. }
  13610. }
  13611. if (strBuf.length > 127) {
  13612. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  13613. }
  13614. return _primitives.Name.get(strBuf.join(""));
  13615. }
  13616. _hexStringWarn(ch) {
  13617. const MAX_HEX_STRING_NUM_WARN = 5;
  13618. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  13619. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  13620. return;
  13621. }
  13622. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  13623. return;
  13624. }
  13625. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  13626. }
  13627. getHexString() {
  13628. const strBuf = this.strBuf;
  13629. strBuf.length = 0;
  13630. let ch = this.currentChar;
  13631. let isFirstHex = true;
  13632. let firstDigit, secondDigit;
  13633. this._hexStringNumWarn = 0;
  13634. while (true) {
  13635. if (ch < 0) {
  13636. (0, _util.warn)("Unterminated hex string");
  13637. break;
  13638. } else if (ch === 0x3e) {
  13639. this.nextChar();
  13640. break;
  13641. } else if (specialChars[ch] === 1) {
  13642. ch = this.nextChar();
  13643. continue;
  13644. } else {
  13645. if (isFirstHex) {
  13646. firstDigit = toHexDigit(ch);
  13647. if (firstDigit === -1) {
  13648. this._hexStringWarn(ch);
  13649. ch = this.nextChar();
  13650. continue;
  13651. }
  13652. } else {
  13653. secondDigit = toHexDigit(ch);
  13654. if (secondDigit === -1) {
  13655. this._hexStringWarn(ch);
  13656. ch = this.nextChar();
  13657. continue;
  13658. }
  13659. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  13660. }
  13661. isFirstHex = !isFirstHex;
  13662. ch = this.nextChar();
  13663. }
  13664. }
  13665. return strBuf.join("");
  13666. }
  13667. getObj() {
  13668. let comment = false;
  13669. let ch = this.currentChar;
  13670. while (true) {
  13671. if (ch < 0) {
  13672. return _primitives.EOF;
  13673. }
  13674. if (comment) {
  13675. if (ch === 0x0a || ch === 0x0d) {
  13676. comment = false;
  13677. }
  13678. } else if (ch === 0x25) {
  13679. comment = true;
  13680. } else if (specialChars[ch] !== 1) {
  13681. break;
  13682. }
  13683. ch = this.nextChar();
  13684. }
  13685. switch (ch | 0) {
  13686. case 0x30:
  13687. case 0x31:
  13688. case 0x32:
  13689. case 0x33:
  13690. case 0x34:
  13691. case 0x35:
  13692. case 0x36:
  13693. case 0x37:
  13694. case 0x38:
  13695. case 0x39:
  13696. case 0x2b:
  13697. case 0x2d:
  13698. case 0x2e:
  13699. return this.getNumber();
  13700. case 0x28:
  13701. return this.getString();
  13702. case 0x2f:
  13703. return this.getName();
  13704. case 0x5b:
  13705. this.nextChar();
  13706. return _primitives.Cmd.get("[");
  13707. case 0x5d:
  13708. this.nextChar();
  13709. return _primitives.Cmd.get("]");
  13710. case 0x3c:
  13711. ch = this.nextChar();
  13712. if (ch === 0x3c) {
  13713. this.nextChar();
  13714. return _primitives.Cmd.get("<<");
  13715. }
  13716. return this.getHexString();
  13717. case 0x3e:
  13718. ch = this.nextChar();
  13719. if (ch === 0x3e) {
  13720. this.nextChar();
  13721. return _primitives.Cmd.get(">>");
  13722. }
  13723. return _primitives.Cmd.get(">");
  13724. case 0x7b:
  13725. this.nextChar();
  13726. return _primitives.Cmd.get("{");
  13727. case 0x7d:
  13728. this.nextChar();
  13729. return _primitives.Cmd.get("}");
  13730. case 0x29:
  13731. this.nextChar();
  13732. throw new _util.FormatError(`Illegal character: ${ch}`);
  13733. }
  13734. let str = String.fromCharCode(ch);
  13735. if (ch < 0x20 || ch > 0x7f) {
  13736. const nextCh = this.peekChar();
  13737. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  13738. this.nextChar();
  13739. return _primitives.Cmd.get(str);
  13740. }
  13741. }
  13742. const knownCommands = this.knownCommands;
  13743. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13744. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13745. const possibleCommand = str + String.fromCharCode(ch);
  13746. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13747. break;
  13748. }
  13749. if (str.length === 128) {
  13750. throw new _util.FormatError(`Command token too long: ${str.length}`);
  13751. }
  13752. str = possibleCommand;
  13753. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13754. }
  13755. if (str === "true") {
  13756. return true;
  13757. }
  13758. if (str === "false") {
  13759. return false;
  13760. }
  13761. if (str === "null") {
  13762. return null;
  13763. }
  13764. if (str === "BI") {
  13765. this.beginInlineImagePos = this.stream.pos;
  13766. }
  13767. return _primitives.Cmd.get(str);
  13768. }
  13769. peekObj() {
  13770. const streamPos = this.stream.pos,
  13771. currentChar = this.currentChar,
  13772. beginInlineImagePos = this.beginInlineImagePos;
  13773. let nextObj;
  13774. try {
  13775. nextObj = this.getObj();
  13776. } catch (ex) {
  13777. if (ex instanceof _core_utils.MissingDataException) {
  13778. throw ex;
  13779. }
  13780. (0, _util.warn)(`peekObj: ${ex}`);
  13781. }
  13782. this.stream.pos = streamPos;
  13783. this.currentChar = currentChar;
  13784. this.beginInlineImagePos = beginInlineImagePos;
  13785. return nextObj;
  13786. }
  13787. skipToNextLine() {
  13788. let ch = this.currentChar;
  13789. while (ch >= 0) {
  13790. if (ch === 0x0d) {
  13791. ch = this.nextChar();
  13792. if (ch === 0x0a) {
  13793. this.nextChar();
  13794. }
  13795. break;
  13796. } else if (ch === 0x0a) {
  13797. this.nextChar();
  13798. break;
  13799. }
  13800. ch = this.nextChar();
  13801. }
  13802. }
  13803. }
  13804. exports.Lexer = Lexer;
  13805. class Linearization {
  13806. static create(stream) {
  13807. function getInt(linDict, name, allowZeroValue = false) {
  13808. const obj = linDict.get(name);
  13809. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13810. return obj;
  13811. }
  13812. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  13813. }
  13814. function getHints(linDict) {
  13815. const hints = linDict.get("H");
  13816. let hintsLength;
  13817. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13818. for (let index = 0; index < hintsLength; index++) {
  13819. const hint = hints[index];
  13820. if (!(Number.isInteger(hint) && hint > 0)) {
  13821. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  13822. }
  13823. }
  13824. return hints;
  13825. }
  13826. throw new Error("Hint array in the linearization dictionary is invalid.");
  13827. }
  13828. const parser = new Parser({
  13829. lexer: new Lexer(stream),
  13830. xref: null
  13831. });
  13832. const obj1 = parser.getObj();
  13833. const obj2 = parser.getObj();
  13834. const obj3 = parser.getObj();
  13835. const linDict = parser.getObj();
  13836. let obj, length;
  13837. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  13838. return null;
  13839. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  13840. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  13841. }
  13842. return {
  13843. length,
  13844. hints: getHints(linDict),
  13845. objectNumberFirst: getInt(linDict, "O"),
  13846. endFirst: getInt(linDict, "E"),
  13847. numPages: getInt(linDict, "N"),
  13848. mainXRefEntriesOffset: getInt(linDict, "T"),
  13849. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  13850. };
  13851. }
  13852. }
  13853. exports.Linearization = Linearization;
  13854. /***/ }),
  13855. /* 16 */
  13856. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13857. Object.defineProperty(exports, "__esModule", ({
  13858. value: true
  13859. }));
  13860. exports.Ascii85Stream = void 0;
  13861. var _decode_stream = __w_pdfjs_require__(17);
  13862. var _core_utils = __w_pdfjs_require__(4);
  13863. class Ascii85Stream extends _decode_stream.DecodeStream {
  13864. constructor(str, maybeLength) {
  13865. if (maybeLength) {
  13866. maybeLength *= 0.8;
  13867. }
  13868. super(maybeLength);
  13869. this.str = str;
  13870. this.dict = str.dict;
  13871. this.input = new Uint8Array(5);
  13872. }
  13873. readBlock() {
  13874. const TILDA_CHAR = 0x7e;
  13875. const Z_LOWER_CHAR = 0x7a;
  13876. const EOF = -1;
  13877. const str = this.str;
  13878. let c = str.getByte();
  13879. while ((0, _core_utils.isWhiteSpace)(c)) {
  13880. c = str.getByte();
  13881. }
  13882. if (c === EOF || c === TILDA_CHAR) {
  13883. this.eof = true;
  13884. return;
  13885. }
  13886. const bufferLength = this.bufferLength;
  13887. let buffer, i;
  13888. if (c === Z_LOWER_CHAR) {
  13889. buffer = this.ensureBuffer(bufferLength + 4);
  13890. for (i = 0; i < 4; ++i) {
  13891. buffer[bufferLength + i] = 0;
  13892. }
  13893. this.bufferLength += 4;
  13894. } else {
  13895. const input = this.input;
  13896. input[0] = c;
  13897. for (i = 1; i < 5; ++i) {
  13898. c = str.getByte();
  13899. while ((0, _core_utils.isWhiteSpace)(c)) {
  13900. c = str.getByte();
  13901. }
  13902. input[i] = c;
  13903. if (c === EOF || c === TILDA_CHAR) {
  13904. break;
  13905. }
  13906. }
  13907. buffer = this.ensureBuffer(bufferLength + i - 1);
  13908. this.bufferLength += i - 1;
  13909. if (i < 5) {
  13910. for (; i < 5; ++i) {
  13911. input[i] = 0x21 + 84;
  13912. }
  13913. this.eof = true;
  13914. }
  13915. let t = 0;
  13916. for (i = 0; i < 5; ++i) {
  13917. t = t * 85 + (input[i] - 0x21);
  13918. }
  13919. for (i = 3; i >= 0; --i) {
  13920. buffer[bufferLength + i] = t & 0xff;
  13921. t >>= 8;
  13922. }
  13923. }
  13924. }
  13925. }
  13926. exports.Ascii85Stream = Ascii85Stream;
  13927. /***/ }),
  13928. /* 17 */
  13929. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13930. Object.defineProperty(exports, "__esModule", ({
  13931. value: true
  13932. }));
  13933. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  13934. var _base_stream = __w_pdfjs_require__(5);
  13935. var _stream = __w_pdfjs_require__(8);
  13936. const emptyBuffer = new Uint8Array(0);
  13937. class DecodeStream extends _base_stream.BaseStream {
  13938. constructor(maybeMinBufferLength) {
  13939. super();
  13940. this._rawMinBufferLength = maybeMinBufferLength || 0;
  13941. this.pos = 0;
  13942. this.bufferLength = 0;
  13943. this.eof = false;
  13944. this.buffer = emptyBuffer;
  13945. this.minBufferLength = 512;
  13946. if (maybeMinBufferLength) {
  13947. while (this.minBufferLength < maybeMinBufferLength) {
  13948. this.minBufferLength *= 2;
  13949. }
  13950. }
  13951. }
  13952. get isEmpty() {
  13953. while (!this.eof && this.bufferLength === 0) {
  13954. this.readBlock();
  13955. }
  13956. return this.bufferLength === 0;
  13957. }
  13958. ensureBuffer(requested) {
  13959. const buffer = this.buffer;
  13960. if (requested <= buffer.byteLength) {
  13961. return buffer;
  13962. }
  13963. let size = this.minBufferLength;
  13964. while (size < requested) {
  13965. size *= 2;
  13966. }
  13967. const buffer2 = new Uint8Array(size);
  13968. buffer2.set(buffer);
  13969. return this.buffer = buffer2;
  13970. }
  13971. getByte() {
  13972. const pos = this.pos;
  13973. while (this.bufferLength <= pos) {
  13974. if (this.eof) {
  13975. return -1;
  13976. }
  13977. this.readBlock();
  13978. }
  13979. return this.buffer[this.pos++];
  13980. }
  13981. getBytes(length) {
  13982. const pos = this.pos;
  13983. let end;
  13984. if (length) {
  13985. this.ensureBuffer(pos + length);
  13986. end = pos + length;
  13987. while (!this.eof && this.bufferLength < end) {
  13988. this.readBlock();
  13989. }
  13990. const bufEnd = this.bufferLength;
  13991. if (end > bufEnd) {
  13992. end = bufEnd;
  13993. }
  13994. } else {
  13995. while (!this.eof) {
  13996. this.readBlock();
  13997. }
  13998. end = this.bufferLength;
  13999. }
  14000. this.pos = end;
  14001. return this.buffer.subarray(pos, end);
  14002. }
  14003. reset() {
  14004. this.pos = 0;
  14005. }
  14006. makeSubStream(start, length, dict = null) {
  14007. if (length === undefined) {
  14008. while (!this.eof) {
  14009. this.readBlock();
  14010. }
  14011. } else {
  14012. const end = start + length;
  14013. while (this.bufferLength <= end && !this.eof) {
  14014. this.readBlock();
  14015. }
  14016. }
  14017. return new _stream.Stream(this.buffer, start, length, dict);
  14018. }
  14019. getBaseStreams() {
  14020. return this.str ? this.str.getBaseStreams() : null;
  14021. }
  14022. }
  14023. exports.DecodeStream = DecodeStream;
  14024. class StreamsSequenceStream extends DecodeStream {
  14025. constructor(streams, onError = null) {
  14026. let maybeLength = 0;
  14027. for (const stream of streams) {
  14028. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  14029. }
  14030. super(maybeLength);
  14031. this.streams = streams;
  14032. this._onError = onError;
  14033. }
  14034. readBlock() {
  14035. const streams = this.streams;
  14036. if (streams.length === 0) {
  14037. this.eof = true;
  14038. return;
  14039. }
  14040. const stream = streams.shift();
  14041. let chunk;
  14042. try {
  14043. chunk = stream.getBytes();
  14044. } catch (reason) {
  14045. if (this._onError) {
  14046. this._onError(reason, stream.dict && stream.dict.objId);
  14047. return;
  14048. }
  14049. throw reason;
  14050. }
  14051. const bufferLength = this.bufferLength;
  14052. const newLength = bufferLength + chunk.length;
  14053. const buffer = this.ensureBuffer(newLength);
  14054. buffer.set(chunk, bufferLength);
  14055. this.bufferLength = newLength;
  14056. }
  14057. getBaseStreams() {
  14058. const baseStreamsBuf = [];
  14059. for (const stream of this.streams) {
  14060. const baseStreams = stream.getBaseStreams();
  14061. if (baseStreams) {
  14062. baseStreamsBuf.push(...baseStreams);
  14063. }
  14064. }
  14065. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  14066. }
  14067. }
  14068. exports.StreamsSequenceStream = StreamsSequenceStream;
  14069. /***/ }),
  14070. /* 18 */
  14071. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14072. Object.defineProperty(exports, "__esModule", ({
  14073. value: true
  14074. }));
  14075. exports.AsciiHexStream = void 0;
  14076. var _decode_stream = __w_pdfjs_require__(17);
  14077. class AsciiHexStream extends _decode_stream.DecodeStream {
  14078. constructor(str, maybeLength) {
  14079. if (maybeLength) {
  14080. maybeLength *= 0.5;
  14081. }
  14082. super(maybeLength);
  14083. this.str = str;
  14084. this.dict = str.dict;
  14085. this.firstDigit = -1;
  14086. }
  14087. readBlock() {
  14088. const UPSTREAM_BLOCK_SIZE = 8000;
  14089. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  14090. if (!bytes.length) {
  14091. this.eof = true;
  14092. return;
  14093. }
  14094. const maxDecodeLength = bytes.length + 1 >> 1;
  14095. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  14096. let bufferLength = this.bufferLength;
  14097. let firstDigit = this.firstDigit;
  14098. for (const ch of bytes) {
  14099. let digit;
  14100. if (ch >= 0x30 && ch <= 0x39) {
  14101. digit = ch & 0x0f;
  14102. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  14103. digit = (ch & 0x0f) + 9;
  14104. } else if (ch === 0x3e) {
  14105. this.eof = true;
  14106. break;
  14107. } else {
  14108. continue;
  14109. }
  14110. if (firstDigit < 0) {
  14111. firstDigit = digit;
  14112. } else {
  14113. buffer[bufferLength++] = firstDigit << 4 | digit;
  14114. firstDigit = -1;
  14115. }
  14116. }
  14117. if (firstDigit >= 0 && this.eof) {
  14118. buffer[bufferLength++] = firstDigit << 4;
  14119. firstDigit = -1;
  14120. }
  14121. this.firstDigit = firstDigit;
  14122. this.bufferLength = bufferLength;
  14123. }
  14124. }
  14125. exports.AsciiHexStream = AsciiHexStream;
  14126. /***/ }),
  14127. /* 19 */
  14128. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14129. Object.defineProperty(exports, "__esModule", ({
  14130. value: true
  14131. }));
  14132. exports.CCITTFaxStream = void 0;
  14133. var _ccitt = __w_pdfjs_require__(20);
  14134. var _decode_stream = __w_pdfjs_require__(17);
  14135. var _primitives = __w_pdfjs_require__(3);
  14136. class CCITTFaxStream extends _decode_stream.DecodeStream {
  14137. constructor(str, maybeLength, params) {
  14138. super(maybeLength);
  14139. this.str = str;
  14140. this.dict = str.dict;
  14141. if (!(params instanceof _primitives.Dict)) {
  14142. params = _primitives.Dict.empty;
  14143. }
  14144. const source = {
  14145. next() {
  14146. return str.getByte();
  14147. }
  14148. };
  14149. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  14150. K: params.get("K"),
  14151. EndOfLine: params.get("EndOfLine"),
  14152. EncodedByteAlign: params.get("EncodedByteAlign"),
  14153. Columns: params.get("Columns"),
  14154. Rows: params.get("Rows"),
  14155. EndOfBlock: params.get("EndOfBlock"),
  14156. BlackIs1: params.get("BlackIs1")
  14157. });
  14158. }
  14159. readBlock() {
  14160. while (!this.eof) {
  14161. const c = this.ccittFaxDecoder.readNextChar();
  14162. if (c === -1) {
  14163. this.eof = true;
  14164. return;
  14165. }
  14166. this.ensureBuffer(this.bufferLength + 1);
  14167. this.buffer[this.bufferLength++] = c;
  14168. }
  14169. }
  14170. }
  14171. exports.CCITTFaxStream = CCITTFaxStream;
  14172. /***/ }),
  14173. /* 20 */
  14174. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14175. Object.defineProperty(exports, "__esModule", ({
  14176. value: true
  14177. }));
  14178. exports.CCITTFaxDecoder = void 0;
  14179. var _util = __w_pdfjs_require__(2);
  14180. const ccittEOL = -2;
  14181. const ccittEOF = -1;
  14182. const twoDimPass = 0;
  14183. const twoDimHoriz = 1;
  14184. const twoDimVert0 = 2;
  14185. const twoDimVertR1 = 3;
  14186. const twoDimVertL1 = 4;
  14187. const twoDimVertR2 = 5;
  14188. const twoDimVertL2 = 6;
  14189. const twoDimVertR3 = 7;
  14190. const twoDimVertL3 = 8;
  14191. 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]];
  14192. 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]];
  14193. 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]];
  14194. 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]];
  14195. 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]];
  14196. 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]];
  14197. class CCITTFaxDecoder {
  14198. constructor(source, options = {}) {
  14199. if (!source || typeof source.next !== "function") {
  14200. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  14201. }
  14202. this.source = source;
  14203. this.eof = false;
  14204. this.encoding = options.K || 0;
  14205. this.eoline = options.EndOfLine || false;
  14206. this.byteAlign = options.EncodedByteAlign || false;
  14207. this.columns = options.Columns || 1728;
  14208. this.rows = options.Rows || 0;
  14209. let eoblock = options.EndOfBlock;
  14210. if (eoblock === null || eoblock === undefined) {
  14211. eoblock = true;
  14212. }
  14213. this.eoblock = eoblock;
  14214. this.black = options.BlackIs1 || false;
  14215. this.codingLine = new Uint32Array(this.columns + 1);
  14216. this.refLine = new Uint32Array(this.columns + 2);
  14217. this.codingLine[0] = this.columns;
  14218. this.codingPos = 0;
  14219. this.row = 0;
  14220. this.nextLine2D = this.encoding < 0;
  14221. this.inputBits = 0;
  14222. this.inputBuf = 0;
  14223. this.outputBits = 0;
  14224. this.rowsDone = false;
  14225. let code1;
  14226. while ((code1 = this._lookBits(12)) === 0) {
  14227. this._eatBits(1);
  14228. }
  14229. if (code1 === 1) {
  14230. this._eatBits(12);
  14231. }
  14232. if (this.encoding > 0) {
  14233. this.nextLine2D = !this._lookBits(1);
  14234. this._eatBits(1);
  14235. }
  14236. }
  14237. readNextChar() {
  14238. if (this.eof) {
  14239. return -1;
  14240. }
  14241. const refLine = this.refLine;
  14242. const codingLine = this.codingLine;
  14243. const columns = this.columns;
  14244. let refPos, blackPixels, bits, i;
  14245. if (this.outputBits === 0) {
  14246. if (this.rowsDone) {
  14247. this.eof = true;
  14248. }
  14249. if (this.eof) {
  14250. return -1;
  14251. }
  14252. this.err = false;
  14253. let code1, code2, code3;
  14254. if (this.nextLine2D) {
  14255. for (i = 0; codingLine[i] < columns; ++i) {
  14256. refLine[i] = codingLine[i];
  14257. }
  14258. refLine[i++] = columns;
  14259. refLine[i] = columns;
  14260. codingLine[0] = 0;
  14261. this.codingPos = 0;
  14262. refPos = 0;
  14263. blackPixels = 0;
  14264. while (codingLine[this.codingPos] < columns) {
  14265. code1 = this._getTwoDimCode();
  14266. switch (code1) {
  14267. case twoDimPass:
  14268. this._addPixels(refLine[refPos + 1], blackPixels);
  14269. if (refLine[refPos + 1] < columns) {
  14270. refPos += 2;
  14271. }
  14272. break;
  14273. case twoDimHoriz:
  14274. code1 = code2 = 0;
  14275. if (blackPixels) {
  14276. do {
  14277. code1 += code3 = this._getBlackCode();
  14278. } while (code3 >= 64);
  14279. do {
  14280. code2 += code3 = this._getWhiteCode();
  14281. } while (code3 >= 64);
  14282. } else {
  14283. do {
  14284. code1 += code3 = this._getWhiteCode();
  14285. } while (code3 >= 64);
  14286. do {
  14287. code2 += code3 = this._getBlackCode();
  14288. } while (code3 >= 64);
  14289. }
  14290. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14291. if (codingLine[this.codingPos] < columns) {
  14292. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  14293. }
  14294. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14295. refPos += 2;
  14296. }
  14297. break;
  14298. case twoDimVertR3:
  14299. this._addPixels(refLine[refPos] + 3, blackPixels);
  14300. blackPixels ^= 1;
  14301. if (codingLine[this.codingPos] < columns) {
  14302. ++refPos;
  14303. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14304. refPos += 2;
  14305. }
  14306. }
  14307. break;
  14308. case twoDimVertR2:
  14309. this._addPixels(refLine[refPos] + 2, blackPixels);
  14310. blackPixels ^= 1;
  14311. if (codingLine[this.codingPos] < columns) {
  14312. ++refPos;
  14313. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14314. refPos += 2;
  14315. }
  14316. }
  14317. break;
  14318. case twoDimVertR1:
  14319. this._addPixels(refLine[refPos] + 1, blackPixels);
  14320. blackPixels ^= 1;
  14321. if (codingLine[this.codingPos] < columns) {
  14322. ++refPos;
  14323. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14324. refPos += 2;
  14325. }
  14326. }
  14327. break;
  14328. case twoDimVert0:
  14329. this._addPixels(refLine[refPos], blackPixels);
  14330. blackPixels ^= 1;
  14331. if (codingLine[this.codingPos] < columns) {
  14332. ++refPos;
  14333. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14334. refPos += 2;
  14335. }
  14336. }
  14337. break;
  14338. case twoDimVertL3:
  14339. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  14340. blackPixels ^= 1;
  14341. if (codingLine[this.codingPos] < columns) {
  14342. if (refPos > 0) {
  14343. --refPos;
  14344. } else {
  14345. ++refPos;
  14346. }
  14347. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14348. refPos += 2;
  14349. }
  14350. }
  14351. break;
  14352. case twoDimVertL2:
  14353. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  14354. blackPixels ^= 1;
  14355. if (codingLine[this.codingPos] < columns) {
  14356. if (refPos > 0) {
  14357. --refPos;
  14358. } else {
  14359. ++refPos;
  14360. }
  14361. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14362. refPos += 2;
  14363. }
  14364. }
  14365. break;
  14366. case twoDimVertL1:
  14367. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  14368. blackPixels ^= 1;
  14369. if (codingLine[this.codingPos] < columns) {
  14370. if (refPos > 0) {
  14371. --refPos;
  14372. } else {
  14373. ++refPos;
  14374. }
  14375. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14376. refPos += 2;
  14377. }
  14378. }
  14379. break;
  14380. case ccittEOF:
  14381. this._addPixels(columns, 0);
  14382. this.eof = true;
  14383. break;
  14384. default:
  14385. (0, _util.info)("bad 2d code");
  14386. this._addPixels(columns, 0);
  14387. this.err = true;
  14388. }
  14389. }
  14390. } else {
  14391. codingLine[0] = 0;
  14392. this.codingPos = 0;
  14393. blackPixels = 0;
  14394. while (codingLine[this.codingPos] < columns) {
  14395. code1 = 0;
  14396. if (blackPixels) {
  14397. do {
  14398. code1 += code3 = this._getBlackCode();
  14399. } while (code3 >= 64);
  14400. } else {
  14401. do {
  14402. code1 += code3 = this._getWhiteCode();
  14403. } while (code3 >= 64);
  14404. }
  14405. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14406. blackPixels ^= 1;
  14407. }
  14408. }
  14409. let gotEOL = false;
  14410. if (this.byteAlign) {
  14411. this.inputBits &= ~7;
  14412. }
  14413. if (!this.eoblock && this.row === this.rows - 1) {
  14414. this.rowsDone = true;
  14415. } else {
  14416. code1 = this._lookBits(12);
  14417. if (this.eoline) {
  14418. while (code1 !== ccittEOF && code1 !== 1) {
  14419. this._eatBits(1);
  14420. code1 = this._lookBits(12);
  14421. }
  14422. } else {
  14423. while (code1 === 0) {
  14424. this._eatBits(1);
  14425. code1 = this._lookBits(12);
  14426. }
  14427. }
  14428. if (code1 === 1) {
  14429. this._eatBits(12);
  14430. gotEOL = true;
  14431. } else if (code1 === ccittEOF) {
  14432. this.eof = true;
  14433. }
  14434. }
  14435. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  14436. this.nextLine2D = !this._lookBits(1);
  14437. this._eatBits(1);
  14438. }
  14439. if (this.eoblock && gotEOL && this.byteAlign) {
  14440. code1 = this._lookBits(12);
  14441. if (code1 === 1) {
  14442. this._eatBits(12);
  14443. if (this.encoding > 0) {
  14444. this._lookBits(1);
  14445. this._eatBits(1);
  14446. }
  14447. if (this.encoding >= 0) {
  14448. for (i = 0; i < 4; ++i) {
  14449. code1 = this._lookBits(12);
  14450. if (code1 !== 1) {
  14451. (0, _util.info)("bad rtc code: " + code1);
  14452. }
  14453. this._eatBits(12);
  14454. if (this.encoding > 0) {
  14455. this._lookBits(1);
  14456. this._eatBits(1);
  14457. }
  14458. }
  14459. }
  14460. this.eof = true;
  14461. }
  14462. } else if (this.err && this.eoline) {
  14463. while (true) {
  14464. code1 = this._lookBits(13);
  14465. if (code1 === ccittEOF) {
  14466. this.eof = true;
  14467. return -1;
  14468. }
  14469. if (code1 >> 1 === 1) {
  14470. break;
  14471. }
  14472. this._eatBits(1);
  14473. }
  14474. this._eatBits(12);
  14475. if (this.encoding > 0) {
  14476. this._eatBits(1);
  14477. this.nextLine2D = !(code1 & 1);
  14478. }
  14479. }
  14480. if (codingLine[0] > 0) {
  14481. this.outputBits = codingLine[this.codingPos = 0];
  14482. } else {
  14483. this.outputBits = codingLine[this.codingPos = 1];
  14484. }
  14485. this.row++;
  14486. }
  14487. let c;
  14488. if (this.outputBits >= 8) {
  14489. c = this.codingPos & 1 ? 0 : 0xff;
  14490. this.outputBits -= 8;
  14491. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  14492. this.codingPos++;
  14493. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14494. }
  14495. } else {
  14496. bits = 8;
  14497. c = 0;
  14498. do {
  14499. if (typeof this.outputBits !== "number") {
  14500. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  14501. }
  14502. if (this.outputBits > bits) {
  14503. c <<= bits;
  14504. if (!(this.codingPos & 1)) {
  14505. c |= 0xff >> 8 - bits;
  14506. }
  14507. this.outputBits -= bits;
  14508. bits = 0;
  14509. } else {
  14510. c <<= this.outputBits;
  14511. if (!(this.codingPos & 1)) {
  14512. c |= 0xff >> 8 - this.outputBits;
  14513. }
  14514. bits -= this.outputBits;
  14515. this.outputBits = 0;
  14516. if (codingLine[this.codingPos] < columns) {
  14517. this.codingPos++;
  14518. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14519. } else if (bits > 0) {
  14520. c <<= bits;
  14521. bits = 0;
  14522. }
  14523. }
  14524. } while (bits);
  14525. }
  14526. if (this.black) {
  14527. c ^= 0xff;
  14528. }
  14529. return c;
  14530. }
  14531. _addPixels(a1, blackPixels) {
  14532. const codingLine = this.codingLine;
  14533. let codingPos = this.codingPos;
  14534. if (a1 > codingLine[codingPos]) {
  14535. if (a1 > this.columns) {
  14536. (0, _util.info)("row is wrong length");
  14537. this.err = true;
  14538. a1 = this.columns;
  14539. }
  14540. if (codingPos & 1 ^ blackPixels) {
  14541. ++codingPos;
  14542. }
  14543. codingLine[codingPos] = a1;
  14544. }
  14545. this.codingPos = codingPos;
  14546. }
  14547. _addPixelsNeg(a1, blackPixels) {
  14548. const codingLine = this.codingLine;
  14549. let codingPos = this.codingPos;
  14550. if (a1 > codingLine[codingPos]) {
  14551. if (a1 > this.columns) {
  14552. (0, _util.info)("row is wrong length");
  14553. this.err = true;
  14554. a1 = this.columns;
  14555. }
  14556. if (codingPos & 1 ^ blackPixels) {
  14557. ++codingPos;
  14558. }
  14559. codingLine[codingPos] = a1;
  14560. } else if (a1 < codingLine[codingPos]) {
  14561. if (a1 < 0) {
  14562. (0, _util.info)("invalid code");
  14563. this.err = true;
  14564. a1 = 0;
  14565. }
  14566. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  14567. --codingPos;
  14568. }
  14569. codingLine[codingPos] = a1;
  14570. }
  14571. this.codingPos = codingPos;
  14572. }
  14573. _findTableCode(start, end, table, limit) {
  14574. const limitValue = limit || 0;
  14575. for (let i = start; i <= end; ++i) {
  14576. let code = this._lookBits(i);
  14577. if (code === ccittEOF) {
  14578. return [true, 1, false];
  14579. }
  14580. if (i < end) {
  14581. code <<= end - i;
  14582. }
  14583. if (!limitValue || code >= limitValue) {
  14584. const p = table[code - limitValue];
  14585. if (p[0] === i) {
  14586. this._eatBits(i);
  14587. return [true, p[1], true];
  14588. }
  14589. }
  14590. }
  14591. return [false, 0, false];
  14592. }
  14593. _getTwoDimCode() {
  14594. let code = 0;
  14595. let p;
  14596. if (this.eoblock) {
  14597. code = this._lookBits(7);
  14598. p = twoDimTable[code];
  14599. if (p && p[0] > 0) {
  14600. this._eatBits(p[0]);
  14601. return p[1];
  14602. }
  14603. } else {
  14604. const result = this._findTableCode(1, 7, twoDimTable);
  14605. if (result[0] && result[2]) {
  14606. return result[1];
  14607. }
  14608. }
  14609. (0, _util.info)("Bad two dim code");
  14610. return ccittEOF;
  14611. }
  14612. _getWhiteCode() {
  14613. let code = 0;
  14614. let p;
  14615. if (this.eoblock) {
  14616. code = this._lookBits(12);
  14617. if (code === ccittEOF) {
  14618. return 1;
  14619. }
  14620. if (code >> 5 === 0) {
  14621. p = whiteTable1[code];
  14622. } else {
  14623. p = whiteTable2[code >> 3];
  14624. }
  14625. if (p[0] > 0) {
  14626. this._eatBits(p[0]);
  14627. return p[1];
  14628. }
  14629. } else {
  14630. let result = this._findTableCode(1, 9, whiteTable2);
  14631. if (result[0]) {
  14632. return result[1];
  14633. }
  14634. result = this._findTableCode(11, 12, whiteTable1);
  14635. if (result[0]) {
  14636. return result[1];
  14637. }
  14638. }
  14639. (0, _util.info)("bad white code");
  14640. this._eatBits(1);
  14641. return 1;
  14642. }
  14643. _getBlackCode() {
  14644. let code, p;
  14645. if (this.eoblock) {
  14646. code = this._lookBits(13);
  14647. if (code === ccittEOF) {
  14648. return 1;
  14649. }
  14650. if (code >> 7 === 0) {
  14651. p = blackTable1[code];
  14652. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  14653. p = blackTable2[(code >> 1) - 64];
  14654. } else {
  14655. p = blackTable3[code >> 7];
  14656. }
  14657. if (p[0] > 0) {
  14658. this._eatBits(p[0]);
  14659. return p[1];
  14660. }
  14661. } else {
  14662. let result = this._findTableCode(2, 6, blackTable3);
  14663. if (result[0]) {
  14664. return result[1];
  14665. }
  14666. result = this._findTableCode(7, 12, blackTable2, 64);
  14667. if (result[0]) {
  14668. return result[1];
  14669. }
  14670. result = this._findTableCode(10, 13, blackTable1);
  14671. if (result[0]) {
  14672. return result[1];
  14673. }
  14674. }
  14675. (0, _util.info)("bad black code");
  14676. this._eatBits(1);
  14677. return 1;
  14678. }
  14679. _lookBits(n) {
  14680. let c;
  14681. while (this.inputBits < n) {
  14682. if ((c = this.source.next()) === -1) {
  14683. if (this.inputBits === 0) {
  14684. return ccittEOF;
  14685. }
  14686. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  14687. }
  14688. this.inputBuf = this.inputBuf << 8 | c;
  14689. this.inputBits += 8;
  14690. }
  14691. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  14692. }
  14693. _eatBits(n) {
  14694. if ((this.inputBits -= n) < 0) {
  14695. this.inputBits = 0;
  14696. }
  14697. }
  14698. }
  14699. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  14700. /***/ }),
  14701. /* 21 */
  14702. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14703. Object.defineProperty(exports, "__esModule", ({
  14704. value: true
  14705. }));
  14706. exports.FlateStream = void 0;
  14707. var _decode_stream = __w_pdfjs_require__(17);
  14708. var _util = __w_pdfjs_require__(2);
  14709. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  14710. 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]);
  14711. 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]);
  14712. 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];
  14713. 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];
  14714. class FlateStream extends _decode_stream.DecodeStream {
  14715. constructor(str, maybeLength) {
  14716. super(maybeLength);
  14717. this.str = str;
  14718. this.dict = str.dict;
  14719. const cmf = str.getByte();
  14720. const flg = str.getByte();
  14721. if (cmf === -1 || flg === -1) {
  14722. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  14723. }
  14724. if ((cmf & 0x0f) !== 0x08) {
  14725. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  14726. }
  14727. if (((cmf << 8) + flg) % 31 !== 0) {
  14728. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  14729. }
  14730. if (flg & 0x20) {
  14731. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  14732. }
  14733. this.codeSize = 0;
  14734. this.codeBuf = 0;
  14735. }
  14736. getBits(bits) {
  14737. const str = this.str;
  14738. let codeSize = this.codeSize;
  14739. let codeBuf = this.codeBuf;
  14740. let b;
  14741. while (codeSize < bits) {
  14742. if ((b = str.getByte()) === -1) {
  14743. throw new _util.FormatError("Bad encoding in flate stream");
  14744. }
  14745. codeBuf |= b << codeSize;
  14746. codeSize += 8;
  14747. }
  14748. b = codeBuf & (1 << bits) - 1;
  14749. this.codeBuf = codeBuf >> bits;
  14750. this.codeSize = codeSize -= bits;
  14751. return b;
  14752. }
  14753. getCode(table) {
  14754. const str = this.str;
  14755. const codes = table[0];
  14756. const maxLen = table[1];
  14757. let codeSize = this.codeSize;
  14758. let codeBuf = this.codeBuf;
  14759. let b;
  14760. while (codeSize < maxLen) {
  14761. if ((b = str.getByte()) === -1) {
  14762. break;
  14763. }
  14764. codeBuf |= b << codeSize;
  14765. codeSize += 8;
  14766. }
  14767. const code = codes[codeBuf & (1 << maxLen) - 1];
  14768. const codeLen = code >> 16;
  14769. const codeVal = code & 0xffff;
  14770. if (codeLen < 1 || codeSize < codeLen) {
  14771. throw new _util.FormatError("Bad encoding in flate stream");
  14772. }
  14773. this.codeBuf = codeBuf >> codeLen;
  14774. this.codeSize = codeSize - codeLen;
  14775. return codeVal;
  14776. }
  14777. generateHuffmanTable(lengths) {
  14778. const n = lengths.length;
  14779. let maxLen = 0;
  14780. let i;
  14781. for (i = 0; i < n; ++i) {
  14782. if (lengths[i] > maxLen) {
  14783. maxLen = lengths[i];
  14784. }
  14785. }
  14786. const size = 1 << maxLen;
  14787. const codes = new Int32Array(size);
  14788. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  14789. for (let val = 0; val < n; ++val) {
  14790. if (lengths[val] === len) {
  14791. let code2 = 0;
  14792. let t = code;
  14793. for (i = 0; i < len; ++i) {
  14794. code2 = code2 << 1 | t & 1;
  14795. t >>= 1;
  14796. }
  14797. for (i = code2; i < size; i += skip) {
  14798. codes[i] = len << 16 | val;
  14799. }
  14800. ++code;
  14801. }
  14802. }
  14803. }
  14804. return [codes, maxLen];
  14805. }
  14806. readBlock() {
  14807. let buffer, len;
  14808. const str = this.str;
  14809. let hdr = this.getBits(3);
  14810. if (hdr & 1) {
  14811. this.eof = true;
  14812. }
  14813. hdr >>= 1;
  14814. if (hdr === 0) {
  14815. let b;
  14816. if ((b = str.getByte()) === -1) {
  14817. throw new _util.FormatError("Bad block header in flate stream");
  14818. }
  14819. let blockLen = b;
  14820. if ((b = str.getByte()) === -1) {
  14821. throw new _util.FormatError("Bad block header in flate stream");
  14822. }
  14823. blockLen |= b << 8;
  14824. if ((b = str.getByte()) === -1) {
  14825. throw new _util.FormatError("Bad block header in flate stream");
  14826. }
  14827. let check = b;
  14828. if ((b = str.getByte()) === -1) {
  14829. throw new _util.FormatError("Bad block header in flate stream");
  14830. }
  14831. check |= b << 8;
  14832. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  14833. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  14834. }
  14835. this.codeBuf = 0;
  14836. this.codeSize = 0;
  14837. const bufferLength = this.bufferLength,
  14838. end = bufferLength + blockLen;
  14839. buffer = this.ensureBuffer(end);
  14840. this.bufferLength = end;
  14841. if (blockLen === 0) {
  14842. if (str.peekByte() === -1) {
  14843. this.eof = true;
  14844. }
  14845. } else {
  14846. const block = str.getBytes(blockLen);
  14847. buffer.set(block, bufferLength);
  14848. if (block.length < blockLen) {
  14849. this.eof = true;
  14850. }
  14851. }
  14852. return;
  14853. }
  14854. let litCodeTable;
  14855. let distCodeTable;
  14856. if (hdr === 1) {
  14857. litCodeTable = fixedLitCodeTab;
  14858. distCodeTable = fixedDistCodeTab;
  14859. } else if (hdr === 2) {
  14860. const numLitCodes = this.getBits(5) + 257;
  14861. const numDistCodes = this.getBits(5) + 1;
  14862. const numCodeLenCodes = this.getBits(4) + 4;
  14863. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  14864. let i;
  14865. for (i = 0; i < numCodeLenCodes; ++i) {
  14866. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  14867. }
  14868. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  14869. len = 0;
  14870. i = 0;
  14871. const codes = numLitCodes + numDistCodes;
  14872. const codeLengths = new Uint8Array(codes);
  14873. let bitsLength, bitsOffset, what;
  14874. while (i < codes) {
  14875. const code = this.getCode(codeLenCodeTab);
  14876. if (code === 16) {
  14877. bitsLength = 2;
  14878. bitsOffset = 3;
  14879. what = len;
  14880. } else if (code === 17) {
  14881. bitsLength = 3;
  14882. bitsOffset = 3;
  14883. what = len = 0;
  14884. } else if (code === 18) {
  14885. bitsLength = 7;
  14886. bitsOffset = 11;
  14887. what = len = 0;
  14888. } else {
  14889. codeLengths[i++] = len = code;
  14890. continue;
  14891. }
  14892. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  14893. while (repeatLength-- > 0) {
  14894. codeLengths[i++] = what;
  14895. }
  14896. }
  14897. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  14898. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  14899. } else {
  14900. throw new _util.FormatError("Unknown block type in flate stream");
  14901. }
  14902. buffer = this.buffer;
  14903. let limit = buffer ? buffer.length : 0;
  14904. let pos = this.bufferLength;
  14905. while (true) {
  14906. let code1 = this.getCode(litCodeTable);
  14907. if (code1 < 256) {
  14908. if (pos + 1 >= limit) {
  14909. buffer = this.ensureBuffer(pos + 1);
  14910. limit = buffer.length;
  14911. }
  14912. buffer[pos++] = code1;
  14913. continue;
  14914. }
  14915. if (code1 === 256) {
  14916. this.bufferLength = pos;
  14917. return;
  14918. }
  14919. code1 -= 257;
  14920. code1 = lengthDecode[code1];
  14921. let code2 = code1 >> 16;
  14922. if (code2 > 0) {
  14923. code2 = this.getBits(code2);
  14924. }
  14925. len = (code1 & 0xffff) + code2;
  14926. code1 = this.getCode(distCodeTable);
  14927. code1 = distDecode[code1];
  14928. code2 = code1 >> 16;
  14929. if (code2 > 0) {
  14930. code2 = this.getBits(code2);
  14931. }
  14932. const dist = (code1 & 0xffff) + code2;
  14933. if (pos + len >= limit) {
  14934. buffer = this.ensureBuffer(pos + len);
  14935. limit = buffer.length;
  14936. }
  14937. for (let k = 0; k < len; ++k, ++pos) {
  14938. buffer[pos] = buffer[pos - dist];
  14939. }
  14940. }
  14941. }
  14942. }
  14943. exports.FlateStream = FlateStream;
  14944. /***/ }),
  14945. /* 22 */
  14946. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14947. Object.defineProperty(exports, "__esModule", ({
  14948. value: true
  14949. }));
  14950. exports.Jbig2Stream = void 0;
  14951. var _base_stream = __w_pdfjs_require__(5);
  14952. var _decode_stream = __w_pdfjs_require__(17);
  14953. var _primitives = __w_pdfjs_require__(3);
  14954. var _jbig = __w_pdfjs_require__(23);
  14955. var _util = __w_pdfjs_require__(2);
  14956. class Jbig2Stream extends _decode_stream.DecodeStream {
  14957. constructor(stream, maybeLength, params) {
  14958. super(maybeLength);
  14959. this.stream = stream;
  14960. this.dict = stream.dict;
  14961. this.maybeLength = maybeLength;
  14962. this.params = params;
  14963. }
  14964. get bytes() {
  14965. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  14966. }
  14967. ensureBuffer(requested) {}
  14968. readBlock() {
  14969. if (this.eof) {
  14970. return;
  14971. }
  14972. const jbig2Image = new _jbig.Jbig2Image();
  14973. const chunks = [];
  14974. if (this.params instanceof _primitives.Dict) {
  14975. const globalsStream = this.params.get("JBIG2Globals");
  14976. if (globalsStream instanceof _base_stream.BaseStream) {
  14977. const globals = globalsStream.getBytes();
  14978. chunks.push({
  14979. data: globals,
  14980. start: 0,
  14981. end: globals.length
  14982. });
  14983. }
  14984. }
  14985. chunks.push({
  14986. data: this.bytes,
  14987. start: 0,
  14988. end: this.bytes.length
  14989. });
  14990. const data = jbig2Image.parseChunks(chunks);
  14991. const dataLength = data.length;
  14992. for (let i = 0; i < dataLength; i++) {
  14993. data[i] ^= 0xff;
  14994. }
  14995. this.buffer = data;
  14996. this.bufferLength = dataLength;
  14997. this.eof = true;
  14998. }
  14999. }
  15000. exports.Jbig2Stream = Jbig2Stream;
  15001. /***/ }),
  15002. /* 23 */
  15003. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15004. Object.defineProperty(exports, "__esModule", ({
  15005. value: true
  15006. }));
  15007. exports.Jbig2Image = void 0;
  15008. var _util = __w_pdfjs_require__(2);
  15009. var _core_utils = __w_pdfjs_require__(4);
  15010. var _arithmetic_decoder = __w_pdfjs_require__(24);
  15011. var _ccitt = __w_pdfjs_require__(20);
  15012. class Jbig2Error extends _util.BaseException {
  15013. constructor(msg) {
  15014. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  15015. }
  15016. }
  15017. class ContextCache {
  15018. getContexts(id) {
  15019. if (id in this) {
  15020. return this[id];
  15021. }
  15022. return this[id] = new Int8Array(1 << 16);
  15023. }
  15024. }
  15025. class DecodingContext {
  15026. constructor(data, start, end) {
  15027. this.data = data;
  15028. this.start = start;
  15029. this.end = end;
  15030. }
  15031. get decoder() {
  15032. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  15033. return (0, _util.shadow)(this, "decoder", decoder);
  15034. }
  15035. get contextCache() {
  15036. const cache = new ContextCache();
  15037. return (0, _util.shadow)(this, "contextCache", cache);
  15038. }
  15039. }
  15040. function decodeInteger(contextCache, procedure, decoder) {
  15041. const contexts = contextCache.getContexts(procedure);
  15042. let prev = 1;
  15043. function readBits(length) {
  15044. let v = 0;
  15045. for (let i = 0; i < length; i++) {
  15046. const bit = decoder.readBit(contexts, prev);
  15047. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  15048. v = v << 1 | bit;
  15049. }
  15050. return v >>> 0;
  15051. }
  15052. const sign = readBits(1);
  15053. 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);
  15054. if (sign === 0) {
  15055. return value;
  15056. } else if (value > 0) {
  15057. return -value;
  15058. }
  15059. return null;
  15060. }
  15061. function decodeIAID(contextCache, decoder, codeLength) {
  15062. const contexts = contextCache.getContexts("IAID");
  15063. let prev = 1;
  15064. for (let i = 0; i < codeLength; i++) {
  15065. const bit = decoder.readBit(contexts, prev);
  15066. prev = prev << 1 | bit;
  15067. }
  15068. if (codeLength < 31) {
  15069. return prev & (1 << codeLength) - 1;
  15070. }
  15071. return prev & 0x7fffffff;
  15072. }
  15073. 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"];
  15074. const CodingTemplates = [[{
  15075. x: -1,
  15076. y: -2
  15077. }, {
  15078. x: 0,
  15079. y: -2
  15080. }, {
  15081. x: 1,
  15082. y: -2
  15083. }, {
  15084. x: -2,
  15085. y: -1
  15086. }, {
  15087. x: -1,
  15088. y: -1
  15089. }, {
  15090. x: 0,
  15091. y: -1
  15092. }, {
  15093. x: 1,
  15094. y: -1
  15095. }, {
  15096. x: 2,
  15097. y: -1
  15098. }, {
  15099. x: -4,
  15100. y: 0
  15101. }, {
  15102. x: -3,
  15103. y: 0
  15104. }, {
  15105. x: -2,
  15106. y: 0
  15107. }, {
  15108. x: -1,
  15109. y: 0
  15110. }], [{
  15111. x: -1,
  15112. y: -2
  15113. }, {
  15114. x: 0,
  15115. y: -2
  15116. }, {
  15117. x: 1,
  15118. y: -2
  15119. }, {
  15120. x: 2,
  15121. y: -2
  15122. }, {
  15123. x: -2,
  15124. y: -1
  15125. }, {
  15126. x: -1,
  15127. y: -1
  15128. }, {
  15129. x: 0,
  15130. y: -1
  15131. }, {
  15132. x: 1,
  15133. y: -1
  15134. }, {
  15135. x: 2,
  15136. y: -1
  15137. }, {
  15138. x: -3,
  15139. y: 0
  15140. }, {
  15141. x: -2,
  15142. y: 0
  15143. }, {
  15144. x: -1,
  15145. y: 0
  15146. }], [{
  15147. x: -1,
  15148. y: -2
  15149. }, {
  15150. x: 0,
  15151. y: -2
  15152. }, {
  15153. x: 1,
  15154. y: -2
  15155. }, {
  15156. x: -2,
  15157. y: -1
  15158. }, {
  15159. x: -1,
  15160. y: -1
  15161. }, {
  15162. x: 0,
  15163. y: -1
  15164. }, {
  15165. x: 1,
  15166. y: -1
  15167. }, {
  15168. x: -2,
  15169. y: 0
  15170. }, {
  15171. x: -1,
  15172. y: 0
  15173. }], [{
  15174. x: -3,
  15175. y: -1
  15176. }, {
  15177. x: -2,
  15178. y: -1
  15179. }, {
  15180. x: -1,
  15181. y: -1
  15182. }, {
  15183. x: 0,
  15184. y: -1
  15185. }, {
  15186. x: 1,
  15187. y: -1
  15188. }, {
  15189. x: -4,
  15190. y: 0
  15191. }, {
  15192. x: -3,
  15193. y: 0
  15194. }, {
  15195. x: -2,
  15196. y: 0
  15197. }, {
  15198. x: -1,
  15199. y: 0
  15200. }]];
  15201. const RefinementTemplates = [{
  15202. coding: [{
  15203. x: 0,
  15204. y: -1
  15205. }, {
  15206. x: 1,
  15207. y: -1
  15208. }, {
  15209. x: -1,
  15210. y: 0
  15211. }],
  15212. reference: [{
  15213. x: 0,
  15214. y: -1
  15215. }, {
  15216. x: 1,
  15217. y: -1
  15218. }, {
  15219. x: -1,
  15220. y: 0
  15221. }, {
  15222. x: 0,
  15223. y: 0
  15224. }, {
  15225. x: 1,
  15226. y: 0
  15227. }, {
  15228. x: -1,
  15229. y: 1
  15230. }, {
  15231. x: 0,
  15232. y: 1
  15233. }, {
  15234. x: 1,
  15235. y: 1
  15236. }]
  15237. }, {
  15238. coding: [{
  15239. x: -1,
  15240. y: -1
  15241. }, {
  15242. x: 0,
  15243. y: -1
  15244. }, {
  15245. x: 1,
  15246. y: -1
  15247. }, {
  15248. x: -1,
  15249. y: 0
  15250. }],
  15251. reference: [{
  15252. x: 0,
  15253. y: -1
  15254. }, {
  15255. x: -1,
  15256. y: 0
  15257. }, {
  15258. x: 0,
  15259. y: 0
  15260. }, {
  15261. x: 1,
  15262. y: 0
  15263. }, {
  15264. x: 0,
  15265. y: 1
  15266. }, {
  15267. x: 1,
  15268. y: 1
  15269. }]
  15270. }];
  15271. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  15272. const RefinementReusedContexts = [0x0020, 0x0008];
  15273. function decodeBitmapTemplate0(width, height, decodingContext) {
  15274. const decoder = decodingContext.decoder;
  15275. const contexts = decodingContext.contextCache.getContexts("GB");
  15276. const bitmap = [];
  15277. let contextLabel, i, j, pixel, row, row1, row2;
  15278. const OLD_PIXEL_MASK = 0x7bf7;
  15279. for (i = 0; i < height; i++) {
  15280. row = bitmap[i] = new Uint8Array(width);
  15281. row1 = i < 1 ? row : bitmap[i - 1];
  15282. row2 = i < 2 ? row : bitmap[i - 2];
  15283. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  15284. for (j = 0; j < width; j++) {
  15285. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  15286. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  15287. }
  15288. }
  15289. return bitmap;
  15290. }
  15291. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  15292. if (mmr) {
  15293. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15294. return decodeMMRBitmap(input, width, height, false);
  15295. }
  15296. 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) {
  15297. return decodeBitmapTemplate0(width, height, decodingContext);
  15298. }
  15299. const useskip = !!skip;
  15300. const template = CodingTemplates[templateIndex].concat(at);
  15301. template.sort(function (a, b) {
  15302. return a.y - b.y || a.x - b.x;
  15303. });
  15304. const templateLength = template.length;
  15305. const templateX = new Int8Array(templateLength);
  15306. const templateY = new Int8Array(templateLength);
  15307. const changingTemplateEntries = [];
  15308. let reuseMask = 0,
  15309. minX = 0,
  15310. maxX = 0,
  15311. minY = 0;
  15312. let c, k;
  15313. for (k = 0; k < templateLength; k++) {
  15314. templateX[k] = template[k].x;
  15315. templateY[k] = template[k].y;
  15316. minX = Math.min(minX, template[k].x);
  15317. maxX = Math.max(maxX, template[k].x);
  15318. minY = Math.min(minY, template[k].y);
  15319. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  15320. reuseMask |= 1 << templateLength - 1 - k;
  15321. } else {
  15322. changingTemplateEntries.push(k);
  15323. }
  15324. }
  15325. const changingEntriesLength = changingTemplateEntries.length;
  15326. const changingTemplateX = new Int8Array(changingEntriesLength);
  15327. const changingTemplateY = new Int8Array(changingEntriesLength);
  15328. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  15329. for (c = 0; c < changingEntriesLength; c++) {
  15330. k = changingTemplateEntries[c];
  15331. changingTemplateX[c] = template[k].x;
  15332. changingTemplateY[c] = template[k].y;
  15333. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  15334. }
  15335. const sbb_left = -minX;
  15336. const sbb_top = -minY;
  15337. const sbb_right = width - maxX;
  15338. const pseudoPixelContext = ReusedContexts[templateIndex];
  15339. let row = new Uint8Array(width);
  15340. const bitmap = [];
  15341. const decoder = decodingContext.decoder;
  15342. const contexts = decodingContext.contextCache.getContexts("GB");
  15343. let ltp = 0,
  15344. j,
  15345. i0,
  15346. j0,
  15347. contextLabel = 0,
  15348. bit,
  15349. shift;
  15350. for (let i = 0; i < height; i++) {
  15351. if (prediction) {
  15352. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15353. ltp ^= sltp;
  15354. if (ltp) {
  15355. bitmap.push(row);
  15356. continue;
  15357. }
  15358. }
  15359. row = new Uint8Array(row);
  15360. bitmap.push(row);
  15361. for (j = 0; j < width; j++) {
  15362. if (useskip && skip[i][j]) {
  15363. row[j] = 0;
  15364. continue;
  15365. }
  15366. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  15367. contextLabel = contextLabel << 1 & reuseMask;
  15368. for (k = 0; k < changingEntriesLength; k++) {
  15369. i0 = i + changingTemplateY[k];
  15370. j0 = j + changingTemplateX[k];
  15371. bit = bitmap[i0][j0];
  15372. if (bit) {
  15373. bit = changingTemplateBit[k];
  15374. contextLabel |= bit;
  15375. }
  15376. }
  15377. } else {
  15378. contextLabel = 0;
  15379. shift = templateLength - 1;
  15380. for (k = 0; k < templateLength; k++, shift--) {
  15381. j0 = j + templateX[k];
  15382. if (j0 >= 0 && j0 < width) {
  15383. i0 = i + templateY[k];
  15384. if (i0 >= 0) {
  15385. bit = bitmap[i0][j0];
  15386. if (bit) {
  15387. contextLabel |= bit << shift;
  15388. }
  15389. }
  15390. }
  15391. }
  15392. }
  15393. const pixel = decoder.readBit(contexts, contextLabel);
  15394. row[j] = pixel;
  15395. }
  15396. }
  15397. return bitmap;
  15398. }
  15399. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  15400. let codingTemplate = RefinementTemplates[templateIndex].coding;
  15401. if (templateIndex === 0) {
  15402. codingTemplate = codingTemplate.concat([at[0]]);
  15403. }
  15404. const codingTemplateLength = codingTemplate.length;
  15405. const codingTemplateX = new Int32Array(codingTemplateLength);
  15406. const codingTemplateY = new Int32Array(codingTemplateLength);
  15407. let k;
  15408. for (k = 0; k < codingTemplateLength; k++) {
  15409. codingTemplateX[k] = codingTemplate[k].x;
  15410. codingTemplateY[k] = codingTemplate[k].y;
  15411. }
  15412. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  15413. if (templateIndex === 0) {
  15414. referenceTemplate = referenceTemplate.concat([at[1]]);
  15415. }
  15416. const referenceTemplateLength = referenceTemplate.length;
  15417. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  15418. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  15419. for (k = 0; k < referenceTemplateLength; k++) {
  15420. referenceTemplateX[k] = referenceTemplate[k].x;
  15421. referenceTemplateY[k] = referenceTemplate[k].y;
  15422. }
  15423. const referenceWidth = referenceBitmap[0].length;
  15424. const referenceHeight = referenceBitmap.length;
  15425. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  15426. const bitmap = [];
  15427. const decoder = decodingContext.decoder;
  15428. const contexts = decodingContext.contextCache.getContexts("GR");
  15429. let ltp = 0;
  15430. for (let i = 0; i < height; i++) {
  15431. if (prediction) {
  15432. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15433. ltp ^= sltp;
  15434. if (ltp) {
  15435. throw new Jbig2Error("prediction is not supported");
  15436. }
  15437. }
  15438. const row = new Uint8Array(width);
  15439. bitmap.push(row);
  15440. for (let j = 0; j < width; j++) {
  15441. let i0, j0;
  15442. let contextLabel = 0;
  15443. for (k = 0; k < codingTemplateLength; k++) {
  15444. i0 = i + codingTemplateY[k];
  15445. j0 = j + codingTemplateX[k];
  15446. if (i0 < 0 || j0 < 0 || j0 >= width) {
  15447. contextLabel <<= 1;
  15448. } else {
  15449. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  15450. }
  15451. }
  15452. for (k = 0; k < referenceTemplateLength; k++) {
  15453. i0 = i + referenceTemplateY[k] - offsetY;
  15454. j0 = j + referenceTemplateX[k] - offsetX;
  15455. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  15456. contextLabel <<= 1;
  15457. } else {
  15458. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  15459. }
  15460. }
  15461. const pixel = decoder.readBit(contexts, contextLabel);
  15462. row[j] = pixel;
  15463. }
  15464. }
  15465. return bitmap;
  15466. }
  15467. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  15468. if (huffman && refinement) {
  15469. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  15470. }
  15471. const newSymbols = [];
  15472. let currentHeight = 0;
  15473. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  15474. const decoder = decodingContext.decoder;
  15475. const contextCache = decodingContext.contextCache;
  15476. let tableB1, symbolWidths;
  15477. if (huffman) {
  15478. tableB1 = getStandardTable(1);
  15479. symbolWidths = [];
  15480. symbolCodeLength = Math.max(symbolCodeLength, 1);
  15481. }
  15482. while (newSymbols.length < numberOfNewSymbols) {
  15483. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  15484. currentHeight += deltaHeight;
  15485. let currentWidth = 0,
  15486. totalWidth = 0;
  15487. const firstSymbol = huffman ? symbolWidths.length : 0;
  15488. while (true) {
  15489. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  15490. if (deltaWidth === null) {
  15491. break;
  15492. }
  15493. currentWidth += deltaWidth;
  15494. totalWidth += currentWidth;
  15495. let bitmap;
  15496. if (refinement) {
  15497. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  15498. if (numberOfInstances > 1) {
  15499. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  15500. } else {
  15501. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  15502. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15503. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15504. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  15505. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  15506. }
  15507. newSymbols.push(bitmap);
  15508. } else if (huffman) {
  15509. symbolWidths.push(currentWidth);
  15510. } else {
  15511. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  15512. newSymbols.push(bitmap);
  15513. }
  15514. }
  15515. if (huffman && !refinement) {
  15516. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  15517. huffmanInput.byteAlign();
  15518. let collectiveBitmap;
  15519. if (bitmapSize === 0) {
  15520. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  15521. } else {
  15522. const originalEnd = huffmanInput.end;
  15523. const bitmapEnd = huffmanInput.position + bitmapSize;
  15524. huffmanInput.end = bitmapEnd;
  15525. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  15526. huffmanInput.end = originalEnd;
  15527. huffmanInput.position = bitmapEnd;
  15528. }
  15529. const numberOfSymbolsDecoded = symbolWidths.length;
  15530. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  15531. newSymbols.push(collectiveBitmap);
  15532. } else {
  15533. let i,
  15534. y,
  15535. xMin = 0,
  15536. xMax,
  15537. bitmapWidth,
  15538. symbolBitmap;
  15539. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  15540. bitmapWidth = symbolWidths[i];
  15541. xMax = xMin + bitmapWidth;
  15542. symbolBitmap = [];
  15543. for (y = 0; y < currentHeight; y++) {
  15544. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15545. }
  15546. newSymbols.push(symbolBitmap);
  15547. xMin = xMax;
  15548. }
  15549. }
  15550. }
  15551. }
  15552. const exportedSymbols = [],
  15553. flags = [];
  15554. let currentFlag = false,
  15555. i,
  15556. ii;
  15557. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  15558. while (flags.length < totalSymbolsLength) {
  15559. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  15560. while (runLength--) {
  15561. flags.push(currentFlag);
  15562. }
  15563. currentFlag = !currentFlag;
  15564. }
  15565. for (i = 0, ii = symbols.length; i < ii; i++) {
  15566. if (flags[i]) {
  15567. exportedSymbols.push(symbols[i]);
  15568. }
  15569. }
  15570. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  15571. if (flags[i]) {
  15572. exportedSymbols.push(newSymbols[j]);
  15573. }
  15574. }
  15575. return exportedSymbols;
  15576. }
  15577. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  15578. if (huffman && refinement) {
  15579. throw new Jbig2Error("refinement with Huffman is not supported");
  15580. }
  15581. const bitmap = [];
  15582. let i, row;
  15583. for (i = 0; i < height; i++) {
  15584. row = new Uint8Array(width);
  15585. if (defaultPixelValue) {
  15586. for (let j = 0; j < width; j++) {
  15587. row[j] = defaultPixelValue;
  15588. }
  15589. }
  15590. bitmap.push(row);
  15591. }
  15592. const decoder = decodingContext.decoder;
  15593. const contextCache = decodingContext.contextCache;
  15594. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  15595. let firstS = 0;
  15596. i = 0;
  15597. while (i < numberOfSymbolInstances) {
  15598. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  15599. stripT += deltaT;
  15600. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  15601. firstS += deltaFirstS;
  15602. let currentS = firstS;
  15603. do {
  15604. let currentT = 0;
  15605. if (stripSize > 1) {
  15606. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  15607. }
  15608. const t = stripSize * stripT + currentT;
  15609. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  15610. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  15611. let symbolBitmap = inputSymbols[symbolId];
  15612. let symbolWidth = symbolBitmap[0].length;
  15613. let symbolHeight = symbolBitmap.length;
  15614. if (applyRefinement) {
  15615. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  15616. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  15617. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15618. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15619. symbolWidth += rdw;
  15620. symbolHeight += rdh;
  15621. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  15622. }
  15623. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  15624. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  15625. let s2, t2, symbolRow;
  15626. if (transposed) {
  15627. for (s2 = 0; s2 < symbolHeight; s2++) {
  15628. row = bitmap[offsetS + s2];
  15629. if (!row) {
  15630. continue;
  15631. }
  15632. symbolRow = symbolBitmap[s2];
  15633. const maxWidth = Math.min(width - offsetT, symbolWidth);
  15634. switch (combinationOperator) {
  15635. case 0:
  15636. for (t2 = 0; t2 < maxWidth; t2++) {
  15637. row[offsetT + t2] |= symbolRow[t2];
  15638. }
  15639. break;
  15640. case 2:
  15641. for (t2 = 0; t2 < maxWidth; t2++) {
  15642. row[offsetT + t2] ^= symbolRow[t2];
  15643. }
  15644. break;
  15645. default:
  15646. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15647. }
  15648. }
  15649. currentS += symbolHeight - 1;
  15650. } else {
  15651. for (t2 = 0; t2 < symbolHeight; t2++) {
  15652. row = bitmap[offsetT + t2];
  15653. if (!row) {
  15654. continue;
  15655. }
  15656. symbolRow = symbolBitmap[t2];
  15657. switch (combinationOperator) {
  15658. case 0:
  15659. for (s2 = 0; s2 < symbolWidth; s2++) {
  15660. row[offsetS + s2] |= symbolRow[s2];
  15661. }
  15662. break;
  15663. case 2:
  15664. for (s2 = 0; s2 < symbolWidth; s2++) {
  15665. row[offsetS + s2] ^= symbolRow[s2];
  15666. }
  15667. break;
  15668. default:
  15669. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15670. }
  15671. }
  15672. currentS += symbolWidth - 1;
  15673. }
  15674. i++;
  15675. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  15676. if (deltaS === null) {
  15677. break;
  15678. }
  15679. currentS += deltaS + dsOffset;
  15680. } while (true);
  15681. }
  15682. return bitmap;
  15683. }
  15684. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  15685. const at = [];
  15686. if (!mmr) {
  15687. at.push({
  15688. x: -patternWidth,
  15689. y: 0
  15690. });
  15691. if (template === 0) {
  15692. at.push({
  15693. x: -3,
  15694. y: -1
  15695. }, {
  15696. x: 2,
  15697. y: -2
  15698. }, {
  15699. x: -2,
  15700. y: -2
  15701. });
  15702. }
  15703. }
  15704. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  15705. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  15706. const patterns = [];
  15707. for (let i = 0; i <= maxPatternIndex; i++) {
  15708. const patternBitmap = [];
  15709. const xMin = patternWidth * i;
  15710. const xMax = xMin + patternWidth;
  15711. for (let y = 0; y < patternHeight; y++) {
  15712. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15713. }
  15714. patterns.push(patternBitmap);
  15715. }
  15716. return patterns;
  15717. }
  15718. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  15719. const skip = null;
  15720. if (enableSkip) {
  15721. throw new Jbig2Error("skip is not supported");
  15722. }
  15723. if (combinationOperator !== 0) {
  15724. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  15725. }
  15726. const regionBitmap = [];
  15727. let i, j, row;
  15728. for (i = 0; i < regionHeight; i++) {
  15729. row = new Uint8Array(regionWidth);
  15730. if (defaultPixelValue) {
  15731. for (j = 0; j < regionWidth; j++) {
  15732. row[j] = defaultPixelValue;
  15733. }
  15734. }
  15735. regionBitmap.push(row);
  15736. }
  15737. const numberOfPatterns = patterns.length;
  15738. const pattern0 = patterns[0];
  15739. const patternWidth = pattern0[0].length,
  15740. patternHeight = pattern0.length;
  15741. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  15742. const at = [];
  15743. if (!mmr) {
  15744. at.push({
  15745. x: template <= 1 ? 3 : 2,
  15746. y: -1
  15747. });
  15748. if (template === 0) {
  15749. at.push({
  15750. x: -3,
  15751. y: -1
  15752. }, {
  15753. x: 2,
  15754. y: -2
  15755. }, {
  15756. x: -2,
  15757. y: -2
  15758. });
  15759. }
  15760. }
  15761. const grayScaleBitPlanes = [];
  15762. let mmrInput, bitmap;
  15763. if (mmr) {
  15764. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15765. }
  15766. for (i = bitsPerValue - 1; i >= 0; i--) {
  15767. if (mmr) {
  15768. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  15769. } else {
  15770. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  15771. }
  15772. grayScaleBitPlanes[i] = bitmap;
  15773. }
  15774. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  15775. for (mg = 0; mg < gridHeight; mg++) {
  15776. for (ng = 0; ng < gridWidth; ng++) {
  15777. bit = 0;
  15778. patternIndex = 0;
  15779. for (j = bitsPerValue - 1; j >= 0; j--) {
  15780. bit ^= grayScaleBitPlanes[j][mg][ng];
  15781. patternIndex |= bit << j;
  15782. }
  15783. patternBitmap = patterns[patternIndex];
  15784. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  15785. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  15786. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  15787. for (i = 0; i < patternHeight; i++) {
  15788. regionRow = regionBitmap[y + i];
  15789. patternRow = patternBitmap[i];
  15790. for (j = 0; j < patternWidth; j++) {
  15791. regionRow[x + j] |= patternRow[j];
  15792. }
  15793. }
  15794. } else {
  15795. let regionX, regionY;
  15796. for (i = 0; i < patternHeight; i++) {
  15797. regionY = y + i;
  15798. if (regionY < 0 || regionY >= regionHeight) {
  15799. continue;
  15800. }
  15801. regionRow = regionBitmap[regionY];
  15802. patternRow = patternBitmap[i];
  15803. for (j = 0; j < patternWidth; j++) {
  15804. regionX = x + j;
  15805. if (regionX >= 0 && regionX < regionWidth) {
  15806. regionRow[regionX] |= patternRow[j];
  15807. }
  15808. }
  15809. }
  15810. }
  15811. }
  15812. }
  15813. return regionBitmap;
  15814. }
  15815. function readSegmentHeader(data, start) {
  15816. const segmentHeader = {};
  15817. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  15818. const flags = data[start + 4];
  15819. const segmentType = flags & 0x3f;
  15820. if (!SegmentTypes[segmentType]) {
  15821. throw new Jbig2Error("invalid segment type: " + segmentType);
  15822. }
  15823. segmentHeader.type = segmentType;
  15824. segmentHeader.typeName = SegmentTypes[segmentType];
  15825. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  15826. const pageAssociationFieldSize = !!(flags & 0x40);
  15827. const referredFlags = data[start + 5];
  15828. let referredToCount = referredFlags >> 5 & 7;
  15829. const retainBits = [referredFlags & 31];
  15830. let position = start + 6;
  15831. if (referredFlags === 7) {
  15832. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  15833. position += 3;
  15834. let bytes = referredToCount + 7 >> 3;
  15835. retainBits[0] = data[position++];
  15836. while (--bytes > 0) {
  15837. retainBits.push(data[position++]);
  15838. }
  15839. } else if (referredFlags === 5 || referredFlags === 6) {
  15840. throw new Jbig2Error("invalid referred-to flags");
  15841. }
  15842. segmentHeader.retainBits = retainBits;
  15843. let referredToSegmentNumberSize = 4;
  15844. if (segmentHeader.number <= 256) {
  15845. referredToSegmentNumberSize = 1;
  15846. } else if (segmentHeader.number <= 65536) {
  15847. referredToSegmentNumberSize = 2;
  15848. }
  15849. const referredTo = [];
  15850. let i, ii;
  15851. for (i = 0; i < referredToCount; i++) {
  15852. let number;
  15853. if (referredToSegmentNumberSize === 1) {
  15854. number = data[position];
  15855. } else if (referredToSegmentNumberSize === 2) {
  15856. number = (0, _core_utils.readUint16)(data, position);
  15857. } else {
  15858. number = (0, _core_utils.readUint32)(data, position);
  15859. }
  15860. referredTo.push(number);
  15861. position += referredToSegmentNumberSize;
  15862. }
  15863. segmentHeader.referredTo = referredTo;
  15864. if (!pageAssociationFieldSize) {
  15865. segmentHeader.pageAssociation = data[position++];
  15866. } else {
  15867. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  15868. position += 4;
  15869. }
  15870. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  15871. position += 4;
  15872. if (segmentHeader.length === 0xffffffff) {
  15873. if (segmentType === 38) {
  15874. const genericRegionInfo = readRegionSegmentInformation(data, position);
  15875. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  15876. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  15877. const searchPatternLength = 6;
  15878. const searchPattern = new Uint8Array(searchPatternLength);
  15879. if (!genericRegionMmr) {
  15880. searchPattern[0] = 0xff;
  15881. searchPattern[1] = 0xac;
  15882. }
  15883. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  15884. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  15885. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  15886. searchPattern[5] = genericRegionInfo.height & 0xff;
  15887. for (i = position, ii = data.length; i < ii; i++) {
  15888. let j = 0;
  15889. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  15890. j++;
  15891. }
  15892. if (j === searchPatternLength) {
  15893. segmentHeader.length = i + searchPatternLength;
  15894. break;
  15895. }
  15896. }
  15897. if (segmentHeader.length === 0xffffffff) {
  15898. throw new Jbig2Error("segment end was not found");
  15899. }
  15900. } else {
  15901. throw new Jbig2Error("invalid unknown segment length");
  15902. }
  15903. }
  15904. segmentHeader.headerEnd = position;
  15905. return segmentHeader;
  15906. }
  15907. function readSegments(header, data, start, end) {
  15908. const segments = [];
  15909. let position = start;
  15910. while (position < end) {
  15911. const segmentHeader = readSegmentHeader(data, position);
  15912. position = segmentHeader.headerEnd;
  15913. const segment = {
  15914. header: segmentHeader,
  15915. data
  15916. };
  15917. if (!header.randomAccess) {
  15918. segment.start = position;
  15919. position += segmentHeader.length;
  15920. segment.end = position;
  15921. }
  15922. segments.push(segment);
  15923. if (segmentHeader.type === 51) {
  15924. break;
  15925. }
  15926. }
  15927. if (header.randomAccess) {
  15928. for (let i = 0, ii = segments.length; i < ii; i++) {
  15929. segments[i].start = position;
  15930. position += segments[i].header.length;
  15931. segments[i].end = position;
  15932. }
  15933. }
  15934. return segments;
  15935. }
  15936. function readRegionSegmentInformation(data, start) {
  15937. return {
  15938. width: (0, _core_utils.readUint32)(data, start),
  15939. height: (0, _core_utils.readUint32)(data, start + 4),
  15940. x: (0, _core_utils.readUint32)(data, start + 8),
  15941. y: (0, _core_utils.readUint32)(data, start + 12),
  15942. combinationOperator: data[start + 16] & 7
  15943. };
  15944. }
  15945. const RegionSegmentInformationFieldLength = 17;
  15946. function processSegment(segment, visitor) {
  15947. const header = segment.header;
  15948. const data = segment.data,
  15949. end = segment.end;
  15950. let position = segment.start;
  15951. let args, at, i, atLength;
  15952. switch (header.type) {
  15953. case 0:
  15954. const dictionary = {};
  15955. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  15956. dictionary.huffman = !!(dictionaryFlags & 1);
  15957. dictionary.refinement = !!(dictionaryFlags & 2);
  15958. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  15959. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  15960. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  15961. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  15962. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  15963. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  15964. dictionary.template = dictionaryFlags >> 10 & 3;
  15965. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  15966. position += 2;
  15967. if (!dictionary.huffman) {
  15968. atLength = dictionary.template === 0 ? 4 : 1;
  15969. at = [];
  15970. for (i = 0; i < atLength; i++) {
  15971. at.push({
  15972. x: (0, _core_utils.readInt8)(data, position),
  15973. y: (0, _core_utils.readInt8)(data, position + 1)
  15974. });
  15975. position += 2;
  15976. }
  15977. dictionary.at = at;
  15978. }
  15979. if (dictionary.refinement && !dictionary.refinementTemplate) {
  15980. at = [];
  15981. for (i = 0; i < 2; i++) {
  15982. at.push({
  15983. x: (0, _core_utils.readInt8)(data, position),
  15984. y: (0, _core_utils.readInt8)(data, position + 1)
  15985. });
  15986. position += 2;
  15987. }
  15988. dictionary.refinementAt = at;
  15989. }
  15990. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  15991. position += 4;
  15992. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  15993. position += 4;
  15994. args = [dictionary, header.number, header.referredTo, data, position, end];
  15995. break;
  15996. case 6:
  15997. case 7:
  15998. const textRegion = {};
  15999. textRegion.info = readRegionSegmentInformation(data, position);
  16000. position += RegionSegmentInformationFieldLength;
  16001. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  16002. position += 2;
  16003. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  16004. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  16005. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  16006. textRegion.stripSize = 1 << textRegion.logStripSize;
  16007. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  16008. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  16009. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  16010. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  16011. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  16012. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  16013. if (textRegion.huffman) {
  16014. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  16015. position += 2;
  16016. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  16017. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  16018. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  16019. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  16020. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  16021. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  16022. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  16023. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  16024. }
  16025. if (textRegion.refinement && !textRegion.refinementTemplate) {
  16026. at = [];
  16027. for (i = 0; i < 2; i++) {
  16028. at.push({
  16029. x: (0, _core_utils.readInt8)(data, position),
  16030. y: (0, _core_utils.readInt8)(data, position + 1)
  16031. });
  16032. position += 2;
  16033. }
  16034. textRegion.refinementAt = at;
  16035. }
  16036. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  16037. position += 4;
  16038. args = [textRegion, header.referredTo, data, position, end];
  16039. break;
  16040. case 16:
  16041. const patternDictionary = {};
  16042. const patternDictionaryFlags = data[position++];
  16043. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  16044. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  16045. patternDictionary.patternWidth = data[position++];
  16046. patternDictionary.patternHeight = data[position++];
  16047. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  16048. position += 4;
  16049. args = [patternDictionary, header.number, data, position, end];
  16050. break;
  16051. case 22:
  16052. case 23:
  16053. const halftoneRegion = {};
  16054. halftoneRegion.info = readRegionSegmentInformation(data, position);
  16055. position += RegionSegmentInformationFieldLength;
  16056. const halftoneRegionFlags = data[position++];
  16057. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  16058. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  16059. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  16060. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  16061. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  16062. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  16063. position += 4;
  16064. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  16065. position += 4;
  16066. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16067. position += 4;
  16068. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16069. position += 4;
  16070. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  16071. position += 2;
  16072. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  16073. position += 2;
  16074. args = [halftoneRegion, header.referredTo, data, position, end];
  16075. break;
  16076. case 38:
  16077. case 39:
  16078. const genericRegion = {};
  16079. genericRegion.info = readRegionSegmentInformation(data, position);
  16080. position += RegionSegmentInformationFieldLength;
  16081. const genericRegionSegmentFlags = data[position++];
  16082. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  16083. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  16084. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  16085. if (!genericRegion.mmr) {
  16086. atLength = genericRegion.template === 0 ? 4 : 1;
  16087. at = [];
  16088. for (i = 0; i < atLength; i++) {
  16089. at.push({
  16090. x: (0, _core_utils.readInt8)(data, position),
  16091. y: (0, _core_utils.readInt8)(data, position + 1)
  16092. });
  16093. position += 2;
  16094. }
  16095. genericRegion.at = at;
  16096. }
  16097. args = [genericRegion, data, position, end];
  16098. break;
  16099. case 48:
  16100. const pageInfo = {
  16101. width: (0, _core_utils.readUint32)(data, position),
  16102. height: (0, _core_utils.readUint32)(data, position + 4),
  16103. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  16104. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  16105. };
  16106. if (pageInfo.height === 0xffffffff) {
  16107. delete pageInfo.height;
  16108. }
  16109. const pageSegmentFlags = data[position + 16];
  16110. (0, _core_utils.readUint16)(data, position + 17);
  16111. pageInfo.lossless = !!(pageSegmentFlags & 1);
  16112. pageInfo.refinement = !!(pageSegmentFlags & 2);
  16113. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  16114. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  16115. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  16116. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  16117. args = [pageInfo];
  16118. break;
  16119. case 49:
  16120. break;
  16121. case 50:
  16122. break;
  16123. case 51:
  16124. break;
  16125. case 53:
  16126. args = [header.number, data, position, end];
  16127. break;
  16128. case 62:
  16129. break;
  16130. default:
  16131. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  16132. }
  16133. const callbackName = "on" + header.typeName;
  16134. if (callbackName in visitor) {
  16135. visitor[callbackName].apply(visitor, args);
  16136. }
  16137. }
  16138. function processSegments(segments, visitor) {
  16139. for (let i = 0, ii = segments.length; i < ii; i++) {
  16140. processSegment(segments[i], visitor);
  16141. }
  16142. }
  16143. function parseJbig2Chunks(chunks) {
  16144. const visitor = new SimpleSegmentVisitor();
  16145. for (let i = 0, ii = chunks.length; i < ii; i++) {
  16146. const chunk = chunks[i];
  16147. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  16148. processSegments(segments, visitor);
  16149. }
  16150. return visitor.buffer;
  16151. }
  16152. function parseJbig2(data) {
  16153. throw new Error("Not implemented: parseJbig2");
  16154. }
  16155. class SimpleSegmentVisitor {
  16156. onPageInformation(info) {
  16157. this.currentPageInfo = info;
  16158. const rowSize = info.width + 7 >> 3;
  16159. const buffer = new Uint8ClampedArray(rowSize * info.height);
  16160. if (info.defaultPixelValue) {
  16161. buffer.fill(0xff);
  16162. }
  16163. this.buffer = buffer;
  16164. }
  16165. drawBitmap(regionInfo, bitmap) {
  16166. const pageInfo = this.currentPageInfo;
  16167. const width = regionInfo.width,
  16168. height = regionInfo.height;
  16169. const rowSize = pageInfo.width + 7 >> 3;
  16170. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  16171. const buffer = this.buffer;
  16172. const mask0 = 128 >> (regionInfo.x & 7);
  16173. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  16174. let i, j, mask, offset;
  16175. switch (combinationOperator) {
  16176. case 0:
  16177. for (i = 0; i < height; i++) {
  16178. mask = mask0;
  16179. offset = offset0;
  16180. for (j = 0; j < width; j++) {
  16181. if (bitmap[i][j]) {
  16182. buffer[offset] |= mask;
  16183. }
  16184. mask >>= 1;
  16185. if (!mask) {
  16186. mask = 128;
  16187. offset++;
  16188. }
  16189. }
  16190. offset0 += rowSize;
  16191. }
  16192. break;
  16193. case 2:
  16194. for (i = 0; i < height; i++) {
  16195. mask = mask0;
  16196. offset = offset0;
  16197. for (j = 0; j < width; j++) {
  16198. if (bitmap[i][j]) {
  16199. buffer[offset] ^= mask;
  16200. }
  16201. mask >>= 1;
  16202. if (!mask) {
  16203. mask = 128;
  16204. offset++;
  16205. }
  16206. }
  16207. offset0 += rowSize;
  16208. }
  16209. break;
  16210. default:
  16211. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  16212. }
  16213. }
  16214. onImmediateGenericRegion(region, data, start, end) {
  16215. const regionInfo = region.info;
  16216. const decodingContext = new DecodingContext(data, start, end);
  16217. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  16218. this.drawBitmap(regionInfo, bitmap);
  16219. }
  16220. onImmediateLosslessGenericRegion() {
  16221. this.onImmediateGenericRegion(...arguments);
  16222. }
  16223. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  16224. let huffmanTables, huffmanInput;
  16225. if (dictionary.huffman) {
  16226. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  16227. huffmanInput = new Reader(data, start, end);
  16228. }
  16229. let symbols = this.symbols;
  16230. if (!symbols) {
  16231. this.symbols = symbols = {};
  16232. }
  16233. const inputSymbols = [];
  16234. for (const referredSegment of referredSegments) {
  16235. const referredSymbols = symbols[referredSegment];
  16236. if (referredSymbols) {
  16237. inputSymbols.push(...referredSymbols);
  16238. }
  16239. }
  16240. const decodingContext = new DecodingContext(data, start, end);
  16241. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  16242. }
  16243. onImmediateTextRegion(region, referredSegments, data, start, end) {
  16244. const regionInfo = region.info;
  16245. let huffmanTables, huffmanInput;
  16246. const symbols = this.symbols;
  16247. const inputSymbols = [];
  16248. for (const referredSegment of referredSegments) {
  16249. const referredSymbols = symbols[referredSegment];
  16250. if (referredSymbols) {
  16251. inputSymbols.push(...referredSymbols);
  16252. }
  16253. }
  16254. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  16255. if (region.huffman) {
  16256. huffmanInput = new Reader(data, start, end);
  16257. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  16258. }
  16259. const decodingContext = new DecodingContext(data, start, end);
  16260. 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);
  16261. this.drawBitmap(regionInfo, bitmap);
  16262. }
  16263. onImmediateLosslessTextRegion() {
  16264. this.onImmediateTextRegion(...arguments);
  16265. }
  16266. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  16267. let patterns = this.patterns;
  16268. if (!patterns) {
  16269. this.patterns = patterns = {};
  16270. }
  16271. const decodingContext = new DecodingContext(data, start, end);
  16272. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  16273. }
  16274. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  16275. const patterns = this.patterns[referredSegments[0]];
  16276. const regionInfo = region.info;
  16277. const decodingContext = new DecodingContext(data, start, end);
  16278. 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);
  16279. this.drawBitmap(regionInfo, bitmap);
  16280. }
  16281. onImmediateLosslessHalftoneRegion() {
  16282. this.onImmediateHalftoneRegion(...arguments);
  16283. }
  16284. onTables(currentSegment, data, start, end) {
  16285. let customTables = this.customTables;
  16286. if (!customTables) {
  16287. this.customTables = customTables = {};
  16288. }
  16289. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  16290. }
  16291. }
  16292. class HuffmanLine {
  16293. constructor(lineData) {
  16294. if (lineData.length === 2) {
  16295. this.isOOB = true;
  16296. this.rangeLow = 0;
  16297. this.prefixLength = lineData[0];
  16298. this.rangeLength = 0;
  16299. this.prefixCode = lineData[1];
  16300. this.isLowerRange = false;
  16301. } else {
  16302. this.isOOB = false;
  16303. this.rangeLow = lineData[0];
  16304. this.prefixLength = lineData[1];
  16305. this.rangeLength = lineData[2];
  16306. this.prefixCode = lineData[3];
  16307. this.isLowerRange = lineData[4] === "lower";
  16308. }
  16309. }
  16310. }
  16311. class HuffmanTreeNode {
  16312. constructor(line) {
  16313. this.children = [];
  16314. if (line) {
  16315. this.isLeaf = true;
  16316. this.rangeLength = line.rangeLength;
  16317. this.rangeLow = line.rangeLow;
  16318. this.isLowerRange = line.isLowerRange;
  16319. this.isOOB = line.isOOB;
  16320. } else {
  16321. this.isLeaf = false;
  16322. }
  16323. }
  16324. buildTree(line, shift) {
  16325. const bit = line.prefixCode >> shift & 1;
  16326. if (shift <= 0) {
  16327. this.children[bit] = new HuffmanTreeNode(line);
  16328. } else {
  16329. let node = this.children[bit];
  16330. if (!node) {
  16331. this.children[bit] = node = new HuffmanTreeNode(null);
  16332. }
  16333. node.buildTree(line, shift - 1);
  16334. }
  16335. }
  16336. decodeNode(reader) {
  16337. if (this.isLeaf) {
  16338. if (this.isOOB) {
  16339. return null;
  16340. }
  16341. const htOffset = reader.readBits(this.rangeLength);
  16342. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  16343. }
  16344. const node = this.children[reader.readBit()];
  16345. if (!node) {
  16346. throw new Jbig2Error("invalid Huffman data");
  16347. }
  16348. return node.decodeNode(reader);
  16349. }
  16350. }
  16351. class HuffmanTable {
  16352. constructor(lines, prefixCodesDone) {
  16353. if (!prefixCodesDone) {
  16354. this.assignPrefixCodes(lines);
  16355. }
  16356. this.rootNode = new HuffmanTreeNode(null);
  16357. for (let i = 0, ii = lines.length; i < ii; i++) {
  16358. const line = lines[i];
  16359. if (line.prefixLength > 0) {
  16360. this.rootNode.buildTree(line, line.prefixLength - 1);
  16361. }
  16362. }
  16363. }
  16364. decode(reader) {
  16365. return this.rootNode.decodeNode(reader);
  16366. }
  16367. assignPrefixCodes(lines) {
  16368. const linesLength = lines.length;
  16369. let prefixLengthMax = 0;
  16370. for (let i = 0; i < linesLength; i++) {
  16371. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  16372. }
  16373. const histogram = new Uint32Array(prefixLengthMax + 1);
  16374. for (let i = 0; i < linesLength; i++) {
  16375. histogram[lines[i].prefixLength]++;
  16376. }
  16377. let currentLength = 1,
  16378. firstCode = 0,
  16379. currentCode,
  16380. currentTemp,
  16381. line;
  16382. histogram[0] = 0;
  16383. while (currentLength <= prefixLengthMax) {
  16384. firstCode = firstCode + histogram[currentLength - 1] << 1;
  16385. currentCode = firstCode;
  16386. currentTemp = 0;
  16387. while (currentTemp < linesLength) {
  16388. line = lines[currentTemp];
  16389. if (line.prefixLength === currentLength) {
  16390. line.prefixCode = currentCode;
  16391. currentCode++;
  16392. }
  16393. currentTemp++;
  16394. }
  16395. currentLength++;
  16396. }
  16397. }
  16398. }
  16399. function decodeTablesSegment(data, start, end) {
  16400. const flags = data[start];
  16401. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  16402. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  16403. const reader = new Reader(data, start + 9, end);
  16404. const prefixSizeBits = (flags >> 1 & 7) + 1;
  16405. const rangeSizeBits = (flags >> 4 & 7) + 1;
  16406. const lines = [];
  16407. let prefixLength,
  16408. rangeLength,
  16409. currentRangeLow = lowestValue;
  16410. do {
  16411. prefixLength = reader.readBits(prefixSizeBits);
  16412. rangeLength = reader.readBits(rangeSizeBits);
  16413. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  16414. currentRangeLow += 1 << rangeLength;
  16415. } while (currentRangeLow < highestValue);
  16416. prefixLength = reader.readBits(prefixSizeBits);
  16417. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  16418. prefixLength = reader.readBits(prefixSizeBits);
  16419. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  16420. if (flags & 1) {
  16421. prefixLength = reader.readBits(prefixSizeBits);
  16422. lines.push(new HuffmanLine([prefixLength, 0]));
  16423. }
  16424. return new HuffmanTable(lines, false);
  16425. }
  16426. const standardTablesCache = {};
  16427. function getStandardTable(number) {
  16428. let table = standardTablesCache[number];
  16429. if (table) {
  16430. return table;
  16431. }
  16432. let lines;
  16433. switch (number) {
  16434. case 1:
  16435. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  16436. break;
  16437. case 2:
  16438. 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]];
  16439. break;
  16440. case 3:
  16441. 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]];
  16442. break;
  16443. case 4:
  16444. 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]];
  16445. break;
  16446. case 5:
  16447. 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]];
  16448. break;
  16449. case 6:
  16450. 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]];
  16451. break;
  16452. case 7:
  16453. 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]];
  16454. break;
  16455. case 8:
  16456. 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]];
  16457. break;
  16458. case 9:
  16459. 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]];
  16460. break;
  16461. case 10:
  16462. 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]];
  16463. break;
  16464. case 11:
  16465. 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]];
  16466. break;
  16467. case 12:
  16468. 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]];
  16469. break;
  16470. case 13:
  16471. 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]];
  16472. break;
  16473. case 14:
  16474. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  16475. break;
  16476. case 15:
  16477. 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]];
  16478. break;
  16479. default:
  16480. throw new Jbig2Error(`standard table B.${number} does not exist`);
  16481. }
  16482. for (let i = 0, ii = lines.length; i < ii; i++) {
  16483. lines[i] = new HuffmanLine(lines[i]);
  16484. }
  16485. table = new HuffmanTable(lines, true);
  16486. standardTablesCache[number] = table;
  16487. return table;
  16488. }
  16489. class Reader {
  16490. constructor(data, start, end) {
  16491. this.data = data;
  16492. this.start = start;
  16493. this.end = end;
  16494. this.position = start;
  16495. this.shift = -1;
  16496. this.currentByte = 0;
  16497. }
  16498. readBit() {
  16499. if (this.shift < 0) {
  16500. if (this.position >= this.end) {
  16501. throw new Jbig2Error("end of data while reading bit");
  16502. }
  16503. this.currentByte = this.data[this.position++];
  16504. this.shift = 7;
  16505. }
  16506. const bit = this.currentByte >> this.shift & 1;
  16507. this.shift--;
  16508. return bit;
  16509. }
  16510. readBits(numBits) {
  16511. let result = 0,
  16512. i;
  16513. for (i = numBits - 1; i >= 0; i--) {
  16514. result |= this.readBit() << i;
  16515. }
  16516. return result;
  16517. }
  16518. byteAlign() {
  16519. this.shift = -1;
  16520. }
  16521. next() {
  16522. if (this.position >= this.end) {
  16523. return -1;
  16524. }
  16525. return this.data[this.position++];
  16526. }
  16527. }
  16528. function getCustomHuffmanTable(index, referredTo, customTables) {
  16529. let currentIndex = 0;
  16530. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  16531. const table = customTables[referredTo[i]];
  16532. if (table) {
  16533. if (index === currentIndex) {
  16534. return table;
  16535. }
  16536. currentIndex++;
  16537. }
  16538. }
  16539. throw new Jbig2Error("can't find custom Huffman table");
  16540. }
  16541. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  16542. const codes = [];
  16543. for (let i = 0; i <= 34; i++) {
  16544. const codeLength = reader.readBits(4);
  16545. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16546. }
  16547. const runCodesTable = new HuffmanTable(codes, false);
  16548. codes.length = 0;
  16549. for (let i = 0; i < numberOfSymbols;) {
  16550. const codeLength = runCodesTable.decode(reader);
  16551. if (codeLength >= 32) {
  16552. let repeatedLength, numberOfRepeats, j;
  16553. switch (codeLength) {
  16554. case 32:
  16555. if (i === 0) {
  16556. throw new Jbig2Error("no previous value in symbol ID table");
  16557. }
  16558. numberOfRepeats = reader.readBits(2) + 3;
  16559. repeatedLength = codes[i - 1].prefixLength;
  16560. break;
  16561. case 33:
  16562. numberOfRepeats = reader.readBits(3) + 3;
  16563. repeatedLength = 0;
  16564. break;
  16565. case 34:
  16566. numberOfRepeats = reader.readBits(7) + 11;
  16567. repeatedLength = 0;
  16568. break;
  16569. default:
  16570. throw new Jbig2Error("invalid code length in symbol ID table");
  16571. }
  16572. for (j = 0; j < numberOfRepeats; j++) {
  16573. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  16574. i++;
  16575. }
  16576. } else {
  16577. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16578. i++;
  16579. }
  16580. }
  16581. reader.byteAlign();
  16582. const symbolIDTable = new HuffmanTable(codes, false);
  16583. let customIndex = 0,
  16584. tableFirstS,
  16585. tableDeltaS,
  16586. tableDeltaT;
  16587. switch (textRegion.huffmanFS) {
  16588. case 0:
  16589. case 1:
  16590. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  16591. break;
  16592. case 3:
  16593. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16594. customIndex++;
  16595. break;
  16596. default:
  16597. throw new Jbig2Error("invalid Huffman FS selector");
  16598. }
  16599. switch (textRegion.huffmanDS) {
  16600. case 0:
  16601. case 1:
  16602. case 2:
  16603. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  16604. break;
  16605. case 3:
  16606. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16607. customIndex++;
  16608. break;
  16609. default:
  16610. throw new Jbig2Error("invalid Huffman DS selector");
  16611. }
  16612. switch (textRegion.huffmanDT) {
  16613. case 0:
  16614. case 1:
  16615. case 2:
  16616. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  16617. break;
  16618. case 3:
  16619. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16620. customIndex++;
  16621. break;
  16622. default:
  16623. throw new Jbig2Error("invalid Huffman DT selector");
  16624. }
  16625. if (textRegion.refinement) {
  16626. throw new Jbig2Error("refinement with Huffman is not supported");
  16627. }
  16628. return {
  16629. symbolIDTable,
  16630. tableFirstS,
  16631. tableDeltaS,
  16632. tableDeltaT
  16633. };
  16634. }
  16635. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  16636. let customIndex = 0,
  16637. tableDeltaHeight,
  16638. tableDeltaWidth;
  16639. switch (dictionary.huffmanDHSelector) {
  16640. case 0:
  16641. case 1:
  16642. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  16643. break;
  16644. case 3:
  16645. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16646. customIndex++;
  16647. break;
  16648. default:
  16649. throw new Jbig2Error("invalid Huffman DH selector");
  16650. }
  16651. switch (dictionary.huffmanDWSelector) {
  16652. case 0:
  16653. case 1:
  16654. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  16655. break;
  16656. case 3:
  16657. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16658. customIndex++;
  16659. break;
  16660. default:
  16661. throw new Jbig2Error("invalid Huffman DW selector");
  16662. }
  16663. let tableBitmapSize, tableAggregateInstances;
  16664. if (dictionary.bitmapSizeSelector) {
  16665. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16666. customIndex++;
  16667. } else {
  16668. tableBitmapSize = getStandardTable(1);
  16669. }
  16670. if (dictionary.aggregationInstancesSelector) {
  16671. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16672. } else {
  16673. tableAggregateInstances = getStandardTable(1);
  16674. }
  16675. return {
  16676. tableDeltaHeight,
  16677. tableDeltaWidth,
  16678. tableBitmapSize,
  16679. tableAggregateInstances
  16680. };
  16681. }
  16682. function readUncompressedBitmap(reader, width, height) {
  16683. const bitmap = [];
  16684. for (let y = 0; y < height; y++) {
  16685. const row = new Uint8Array(width);
  16686. bitmap.push(row);
  16687. for (let x = 0; x < width; x++) {
  16688. row[x] = reader.readBit();
  16689. }
  16690. reader.byteAlign();
  16691. }
  16692. return bitmap;
  16693. }
  16694. function decodeMMRBitmap(input, width, height, endOfBlock) {
  16695. const params = {
  16696. K: -1,
  16697. Columns: width,
  16698. Rows: height,
  16699. BlackIs1: true,
  16700. EndOfBlock: endOfBlock
  16701. };
  16702. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  16703. const bitmap = [];
  16704. let currentByte,
  16705. eof = false;
  16706. for (let y = 0; y < height; y++) {
  16707. const row = new Uint8Array(width);
  16708. bitmap.push(row);
  16709. let shift = -1;
  16710. for (let x = 0; x < width; x++) {
  16711. if (shift < 0) {
  16712. currentByte = decoder.readNextChar();
  16713. if (currentByte === -1) {
  16714. currentByte = 0;
  16715. eof = true;
  16716. }
  16717. shift = 7;
  16718. }
  16719. row[x] = currentByte >> shift & 1;
  16720. shift--;
  16721. }
  16722. }
  16723. if (endOfBlock && !eof) {
  16724. const lookForEOFLimit = 5;
  16725. for (let i = 0; i < lookForEOFLimit; i++) {
  16726. if (decoder.readNextChar() === -1) {
  16727. break;
  16728. }
  16729. }
  16730. }
  16731. return bitmap;
  16732. }
  16733. class Jbig2Image {
  16734. parseChunks(chunks) {
  16735. return parseJbig2Chunks(chunks);
  16736. }
  16737. parse(data) {
  16738. throw new Error("Not implemented: Jbig2Image.parse");
  16739. }
  16740. }
  16741. exports.Jbig2Image = Jbig2Image;
  16742. /***/ }),
  16743. /* 24 */
  16744. /***/ ((__unused_webpack_module, exports) => {
  16745. Object.defineProperty(exports, "__esModule", ({
  16746. value: true
  16747. }));
  16748. exports.ArithmeticDecoder = void 0;
  16749. const QeTable = [{
  16750. qe: 0x5601,
  16751. nmps: 1,
  16752. nlps: 1,
  16753. switchFlag: 1
  16754. }, {
  16755. qe: 0x3401,
  16756. nmps: 2,
  16757. nlps: 6,
  16758. switchFlag: 0
  16759. }, {
  16760. qe: 0x1801,
  16761. nmps: 3,
  16762. nlps: 9,
  16763. switchFlag: 0
  16764. }, {
  16765. qe: 0x0ac1,
  16766. nmps: 4,
  16767. nlps: 12,
  16768. switchFlag: 0
  16769. }, {
  16770. qe: 0x0521,
  16771. nmps: 5,
  16772. nlps: 29,
  16773. switchFlag: 0
  16774. }, {
  16775. qe: 0x0221,
  16776. nmps: 38,
  16777. nlps: 33,
  16778. switchFlag: 0
  16779. }, {
  16780. qe: 0x5601,
  16781. nmps: 7,
  16782. nlps: 6,
  16783. switchFlag: 1
  16784. }, {
  16785. qe: 0x5401,
  16786. nmps: 8,
  16787. nlps: 14,
  16788. switchFlag: 0
  16789. }, {
  16790. qe: 0x4801,
  16791. nmps: 9,
  16792. nlps: 14,
  16793. switchFlag: 0
  16794. }, {
  16795. qe: 0x3801,
  16796. nmps: 10,
  16797. nlps: 14,
  16798. switchFlag: 0
  16799. }, {
  16800. qe: 0x3001,
  16801. nmps: 11,
  16802. nlps: 17,
  16803. switchFlag: 0
  16804. }, {
  16805. qe: 0x2401,
  16806. nmps: 12,
  16807. nlps: 18,
  16808. switchFlag: 0
  16809. }, {
  16810. qe: 0x1c01,
  16811. nmps: 13,
  16812. nlps: 20,
  16813. switchFlag: 0
  16814. }, {
  16815. qe: 0x1601,
  16816. nmps: 29,
  16817. nlps: 21,
  16818. switchFlag: 0
  16819. }, {
  16820. qe: 0x5601,
  16821. nmps: 15,
  16822. nlps: 14,
  16823. switchFlag: 1
  16824. }, {
  16825. qe: 0x5401,
  16826. nmps: 16,
  16827. nlps: 14,
  16828. switchFlag: 0
  16829. }, {
  16830. qe: 0x5101,
  16831. nmps: 17,
  16832. nlps: 15,
  16833. switchFlag: 0
  16834. }, {
  16835. qe: 0x4801,
  16836. nmps: 18,
  16837. nlps: 16,
  16838. switchFlag: 0
  16839. }, {
  16840. qe: 0x3801,
  16841. nmps: 19,
  16842. nlps: 17,
  16843. switchFlag: 0
  16844. }, {
  16845. qe: 0x3401,
  16846. nmps: 20,
  16847. nlps: 18,
  16848. switchFlag: 0
  16849. }, {
  16850. qe: 0x3001,
  16851. nmps: 21,
  16852. nlps: 19,
  16853. switchFlag: 0
  16854. }, {
  16855. qe: 0x2801,
  16856. nmps: 22,
  16857. nlps: 19,
  16858. switchFlag: 0
  16859. }, {
  16860. qe: 0x2401,
  16861. nmps: 23,
  16862. nlps: 20,
  16863. switchFlag: 0
  16864. }, {
  16865. qe: 0x2201,
  16866. nmps: 24,
  16867. nlps: 21,
  16868. switchFlag: 0
  16869. }, {
  16870. qe: 0x1c01,
  16871. nmps: 25,
  16872. nlps: 22,
  16873. switchFlag: 0
  16874. }, {
  16875. qe: 0x1801,
  16876. nmps: 26,
  16877. nlps: 23,
  16878. switchFlag: 0
  16879. }, {
  16880. qe: 0x1601,
  16881. nmps: 27,
  16882. nlps: 24,
  16883. switchFlag: 0
  16884. }, {
  16885. qe: 0x1401,
  16886. nmps: 28,
  16887. nlps: 25,
  16888. switchFlag: 0
  16889. }, {
  16890. qe: 0x1201,
  16891. nmps: 29,
  16892. nlps: 26,
  16893. switchFlag: 0
  16894. }, {
  16895. qe: 0x1101,
  16896. nmps: 30,
  16897. nlps: 27,
  16898. switchFlag: 0
  16899. }, {
  16900. qe: 0x0ac1,
  16901. nmps: 31,
  16902. nlps: 28,
  16903. switchFlag: 0
  16904. }, {
  16905. qe: 0x09c1,
  16906. nmps: 32,
  16907. nlps: 29,
  16908. switchFlag: 0
  16909. }, {
  16910. qe: 0x08a1,
  16911. nmps: 33,
  16912. nlps: 30,
  16913. switchFlag: 0
  16914. }, {
  16915. qe: 0x0521,
  16916. nmps: 34,
  16917. nlps: 31,
  16918. switchFlag: 0
  16919. }, {
  16920. qe: 0x0441,
  16921. nmps: 35,
  16922. nlps: 32,
  16923. switchFlag: 0
  16924. }, {
  16925. qe: 0x02a1,
  16926. nmps: 36,
  16927. nlps: 33,
  16928. switchFlag: 0
  16929. }, {
  16930. qe: 0x0221,
  16931. nmps: 37,
  16932. nlps: 34,
  16933. switchFlag: 0
  16934. }, {
  16935. qe: 0x0141,
  16936. nmps: 38,
  16937. nlps: 35,
  16938. switchFlag: 0
  16939. }, {
  16940. qe: 0x0111,
  16941. nmps: 39,
  16942. nlps: 36,
  16943. switchFlag: 0
  16944. }, {
  16945. qe: 0x0085,
  16946. nmps: 40,
  16947. nlps: 37,
  16948. switchFlag: 0
  16949. }, {
  16950. qe: 0x0049,
  16951. nmps: 41,
  16952. nlps: 38,
  16953. switchFlag: 0
  16954. }, {
  16955. qe: 0x0025,
  16956. nmps: 42,
  16957. nlps: 39,
  16958. switchFlag: 0
  16959. }, {
  16960. qe: 0x0015,
  16961. nmps: 43,
  16962. nlps: 40,
  16963. switchFlag: 0
  16964. }, {
  16965. qe: 0x0009,
  16966. nmps: 44,
  16967. nlps: 41,
  16968. switchFlag: 0
  16969. }, {
  16970. qe: 0x0005,
  16971. nmps: 45,
  16972. nlps: 42,
  16973. switchFlag: 0
  16974. }, {
  16975. qe: 0x0001,
  16976. nmps: 45,
  16977. nlps: 43,
  16978. switchFlag: 0
  16979. }, {
  16980. qe: 0x5601,
  16981. nmps: 46,
  16982. nlps: 46,
  16983. switchFlag: 0
  16984. }];
  16985. class ArithmeticDecoder {
  16986. constructor(data, start, end) {
  16987. this.data = data;
  16988. this.bp = start;
  16989. this.dataEnd = end;
  16990. this.chigh = data[start];
  16991. this.clow = 0;
  16992. this.byteIn();
  16993. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  16994. this.clow = this.clow << 7 & 0xffff;
  16995. this.ct -= 7;
  16996. this.a = 0x8000;
  16997. }
  16998. byteIn() {
  16999. const data = this.data;
  17000. let bp = this.bp;
  17001. if (data[bp] === 0xff) {
  17002. if (data[bp + 1] > 0x8f) {
  17003. this.clow += 0xff00;
  17004. this.ct = 8;
  17005. } else {
  17006. bp++;
  17007. this.clow += data[bp] << 9;
  17008. this.ct = 7;
  17009. this.bp = bp;
  17010. }
  17011. } else {
  17012. bp++;
  17013. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  17014. this.ct = 8;
  17015. this.bp = bp;
  17016. }
  17017. if (this.clow > 0xffff) {
  17018. this.chigh += this.clow >> 16;
  17019. this.clow &= 0xffff;
  17020. }
  17021. }
  17022. readBit(contexts, pos) {
  17023. let cx_index = contexts[pos] >> 1,
  17024. cx_mps = contexts[pos] & 1;
  17025. const qeTableIcx = QeTable[cx_index];
  17026. const qeIcx = qeTableIcx.qe;
  17027. let d;
  17028. let a = this.a - qeIcx;
  17029. if (this.chigh < qeIcx) {
  17030. if (a < qeIcx) {
  17031. a = qeIcx;
  17032. d = cx_mps;
  17033. cx_index = qeTableIcx.nmps;
  17034. } else {
  17035. a = qeIcx;
  17036. d = 1 ^ cx_mps;
  17037. if (qeTableIcx.switchFlag === 1) {
  17038. cx_mps = d;
  17039. }
  17040. cx_index = qeTableIcx.nlps;
  17041. }
  17042. } else {
  17043. this.chigh -= qeIcx;
  17044. if ((a & 0x8000) !== 0) {
  17045. this.a = a;
  17046. return cx_mps;
  17047. }
  17048. if (a < qeIcx) {
  17049. d = 1 ^ cx_mps;
  17050. if (qeTableIcx.switchFlag === 1) {
  17051. cx_mps = d;
  17052. }
  17053. cx_index = qeTableIcx.nlps;
  17054. } else {
  17055. d = cx_mps;
  17056. cx_index = qeTableIcx.nmps;
  17057. }
  17058. }
  17059. do {
  17060. if (this.ct === 0) {
  17061. this.byteIn();
  17062. }
  17063. a <<= 1;
  17064. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  17065. this.clow = this.clow << 1 & 0xffff;
  17066. this.ct--;
  17067. } while ((a & 0x8000) === 0);
  17068. this.a = a;
  17069. contexts[pos] = cx_index << 1 | cx_mps;
  17070. return d;
  17071. }
  17072. }
  17073. exports.ArithmeticDecoder = ArithmeticDecoder;
  17074. /***/ }),
  17075. /* 25 */
  17076. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17077. Object.defineProperty(exports, "__esModule", ({
  17078. value: true
  17079. }));
  17080. exports.JpegStream = void 0;
  17081. var _decode_stream = __w_pdfjs_require__(17);
  17082. var _primitives = __w_pdfjs_require__(3);
  17083. var _jpg = __w_pdfjs_require__(26);
  17084. var _util = __w_pdfjs_require__(2);
  17085. class JpegStream extends _decode_stream.DecodeStream {
  17086. constructor(stream, maybeLength, params) {
  17087. let ch;
  17088. while ((ch = stream.getByte()) !== -1) {
  17089. if (ch === 0xff) {
  17090. stream.skip(-1);
  17091. break;
  17092. }
  17093. }
  17094. super(maybeLength);
  17095. this.stream = stream;
  17096. this.dict = stream.dict;
  17097. this.maybeLength = maybeLength;
  17098. this.params = params;
  17099. }
  17100. get bytes() {
  17101. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17102. }
  17103. ensureBuffer(requested) {}
  17104. readBlock() {
  17105. if (this.eof) {
  17106. return;
  17107. }
  17108. const jpegOptions = {
  17109. decodeTransform: undefined,
  17110. colorTransform: undefined
  17111. };
  17112. const decodeArr = this.dict.getArray("D", "Decode");
  17113. if (this.forceRGB && Array.isArray(decodeArr)) {
  17114. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  17115. const decodeArrLength = decodeArr.length;
  17116. const transform = new Int32Array(decodeArrLength);
  17117. let transformNeeded = false;
  17118. const maxValue = (1 << bitsPerComponent) - 1;
  17119. for (let i = 0; i < decodeArrLength; i += 2) {
  17120. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  17121. transform[i + 1] = decodeArr[i] * maxValue | 0;
  17122. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  17123. transformNeeded = true;
  17124. }
  17125. }
  17126. if (transformNeeded) {
  17127. jpegOptions.decodeTransform = transform;
  17128. }
  17129. }
  17130. if (this.params instanceof _primitives.Dict) {
  17131. const colorTransform = this.params.get("ColorTransform");
  17132. if (Number.isInteger(colorTransform)) {
  17133. jpegOptions.colorTransform = colorTransform;
  17134. }
  17135. }
  17136. const jpegImage = new _jpg.JpegImage(jpegOptions);
  17137. jpegImage.parse(this.bytes);
  17138. const data = jpegImage.getData({
  17139. width: this.drawWidth,
  17140. height: this.drawHeight,
  17141. forceRGB: this.forceRGB,
  17142. isSourcePDF: true
  17143. });
  17144. this.buffer = data;
  17145. this.bufferLength = data.length;
  17146. this.eof = true;
  17147. }
  17148. }
  17149. exports.JpegStream = JpegStream;
  17150. /***/ }),
  17151. /* 26 */
  17152. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17153. Object.defineProperty(exports, "__esModule", ({
  17154. value: true
  17155. }));
  17156. exports.JpegImage = void 0;
  17157. var _util = __w_pdfjs_require__(2);
  17158. var _core_utils = __w_pdfjs_require__(4);
  17159. class JpegError extends _util.BaseException {
  17160. constructor(msg) {
  17161. super(`JPEG error: ${msg}`, "JpegError");
  17162. }
  17163. }
  17164. class DNLMarkerError extends _util.BaseException {
  17165. constructor(message, scanLines) {
  17166. super(message, "DNLMarkerError");
  17167. this.scanLines = scanLines;
  17168. }
  17169. }
  17170. class EOIMarkerError extends _util.BaseException {
  17171. constructor(msg) {
  17172. super(msg, "EOIMarkerError");
  17173. }
  17174. }
  17175. 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]);
  17176. const dctCos1 = 4017;
  17177. const dctSin1 = 799;
  17178. const dctCos3 = 3406;
  17179. const dctSin3 = 2276;
  17180. const dctCos6 = 1567;
  17181. const dctSin6 = 3784;
  17182. const dctSqrt2 = 5793;
  17183. const dctSqrt1d2 = 2896;
  17184. function buildHuffmanTable(codeLengths, values) {
  17185. let k = 0,
  17186. i,
  17187. j,
  17188. length = 16;
  17189. while (length > 0 && !codeLengths[length - 1]) {
  17190. length--;
  17191. }
  17192. const code = [{
  17193. children: [],
  17194. index: 0
  17195. }];
  17196. let p = code[0],
  17197. q;
  17198. for (i = 0; i < length; i++) {
  17199. for (j = 0; j < codeLengths[i]; j++) {
  17200. p = code.pop();
  17201. p.children[p.index] = values[k];
  17202. while (p.index > 0) {
  17203. p = code.pop();
  17204. }
  17205. p.index++;
  17206. code.push(p);
  17207. while (code.length <= i) {
  17208. code.push(q = {
  17209. children: [],
  17210. index: 0
  17211. });
  17212. p.children[p.index] = q.children;
  17213. p = q;
  17214. }
  17215. k++;
  17216. }
  17217. if (i + 1 < length) {
  17218. code.push(q = {
  17219. children: [],
  17220. index: 0
  17221. });
  17222. p.children[p.index] = q.children;
  17223. p = q;
  17224. }
  17225. }
  17226. return code[0].children;
  17227. }
  17228. function getBlockBufferOffset(component, row, col) {
  17229. return 64 * ((component.blocksPerLine + 1) * row + col);
  17230. }
  17231. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  17232. const mcusPerLine = frame.mcusPerLine;
  17233. const progressive = frame.progressive;
  17234. const startOffset = offset;
  17235. let bitsData = 0,
  17236. bitsCount = 0;
  17237. function readBit() {
  17238. if (bitsCount > 0) {
  17239. bitsCount--;
  17240. return bitsData >> bitsCount & 1;
  17241. }
  17242. bitsData = data[offset++];
  17243. if (bitsData === 0xff) {
  17244. const nextByte = data[offset++];
  17245. if (nextByte) {
  17246. if (nextByte === 0xdc && parseDNLMarker) {
  17247. offset += 2;
  17248. const scanLines = (0, _core_utils.readUint16)(data, offset);
  17249. offset += 2;
  17250. if (scanLines > 0 && scanLines !== frame.scanLines) {
  17251. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  17252. }
  17253. } else if (nextByte === 0xd9) {
  17254. if (parseDNLMarker) {
  17255. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  17256. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  17257. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  17258. }
  17259. }
  17260. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  17261. }
  17262. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  17263. }
  17264. }
  17265. bitsCount = 7;
  17266. return bitsData >>> 7;
  17267. }
  17268. function decodeHuffman(tree) {
  17269. let node = tree;
  17270. while (true) {
  17271. node = node[readBit()];
  17272. switch (typeof node) {
  17273. case "number":
  17274. return node;
  17275. case "object":
  17276. continue;
  17277. }
  17278. throw new JpegError("invalid huffman sequence");
  17279. }
  17280. }
  17281. function receive(length) {
  17282. let n = 0;
  17283. while (length > 0) {
  17284. n = n << 1 | readBit();
  17285. length--;
  17286. }
  17287. return n;
  17288. }
  17289. function receiveAndExtend(length) {
  17290. if (length === 1) {
  17291. return readBit() === 1 ? 1 : -1;
  17292. }
  17293. const n = receive(length);
  17294. if (n >= 1 << length - 1) {
  17295. return n;
  17296. }
  17297. return n + (-1 << length) + 1;
  17298. }
  17299. function decodeBaseline(component, blockOffset) {
  17300. const t = decodeHuffman(component.huffmanTableDC);
  17301. const diff = t === 0 ? 0 : receiveAndExtend(t);
  17302. component.blockData[blockOffset] = component.pred += diff;
  17303. let k = 1;
  17304. while (k < 64) {
  17305. const rs = decodeHuffman(component.huffmanTableAC);
  17306. const s = rs & 15,
  17307. r = rs >> 4;
  17308. if (s === 0) {
  17309. if (r < 15) {
  17310. break;
  17311. }
  17312. k += 16;
  17313. continue;
  17314. }
  17315. k += r;
  17316. const z = dctZigZag[k];
  17317. component.blockData[blockOffset + z] = receiveAndExtend(s);
  17318. k++;
  17319. }
  17320. }
  17321. function decodeDCFirst(component, blockOffset) {
  17322. const t = decodeHuffman(component.huffmanTableDC);
  17323. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  17324. component.blockData[blockOffset] = component.pred += diff;
  17325. }
  17326. function decodeDCSuccessive(component, blockOffset) {
  17327. component.blockData[blockOffset] |= readBit() << successive;
  17328. }
  17329. let eobrun = 0;
  17330. function decodeACFirst(component, blockOffset) {
  17331. if (eobrun > 0) {
  17332. eobrun--;
  17333. return;
  17334. }
  17335. let k = spectralStart;
  17336. const e = spectralEnd;
  17337. while (k <= e) {
  17338. const rs = decodeHuffman(component.huffmanTableAC);
  17339. const s = rs & 15,
  17340. r = rs >> 4;
  17341. if (s === 0) {
  17342. if (r < 15) {
  17343. eobrun = receive(r) + (1 << r) - 1;
  17344. break;
  17345. }
  17346. k += 16;
  17347. continue;
  17348. }
  17349. k += r;
  17350. const z = dctZigZag[k];
  17351. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  17352. k++;
  17353. }
  17354. }
  17355. let successiveACState = 0,
  17356. successiveACNextValue;
  17357. function decodeACSuccessive(component, blockOffset) {
  17358. let k = spectralStart;
  17359. const e = spectralEnd;
  17360. let r = 0;
  17361. let s;
  17362. let rs;
  17363. while (k <= e) {
  17364. const offsetZ = blockOffset + dctZigZag[k];
  17365. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  17366. switch (successiveACState) {
  17367. case 0:
  17368. rs = decodeHuffman(component.huffmanTableAC);
  17369. s = rs & 15;
  17370. r = rs >> 4;
  17371. if (s === 0) {
  17372. if (r < 15) {
  17373. eobrun = receive(r) + (1 << r);
  17374. successiveACState = 4;
  17375. } else {
  17376. r = 16;
  17377. successiveACState = 1;
  17378. }
  17379. } else {
  17380. if (s !== 1) {
  17381. throw new JpegError("invalid ACn encoding");
  17382. }
  17383. successiveACNextValue = receiveAndExtend(s);
  17384. successiveACState = r ? 2 : 3;
  17385. }
  17386. continue;
  17387. case 1:
  17388. case 2:
  17389. if (component.blockData[offsetZ]) {
  17390. component.blockData[offsetZ] += sign * (readBit() << successive);
  17391. } else {
  17392. r--;
  17393. if (r === 0) {
  17394. successiveACState = successiveACState === 2 ? 3 : 0;
  17395. }
  17396. }
  17397. break;
  17398. case 3:
  17399. if (component.blockData[offsetZ]) {
  17400. component.blockData[offsetZ] += sign * (readBit() << successive);
  17401. } else {
  17402. component.blockData[offsetZ] = successiveACNextValue << successive;
  17403. successiveACState = 0;
  17404. }
  17405. break;
  17406. case 4:
  17407. if (component.blockData[offsetZ]) {
  17408. component.blockData[offsetZ] += sign * (readBit() << successive);
  17409. }
  17410. break;
  17411. }
  17412. k++;
  17413. }
  17414. if (successiveACState === 4) {
  17415. eobrun--;
  17416. if (eobrun === 0) {
  17417. successiveACState = 0;
  17418. }
  17419. }
  17420. }
  17421. let blockRow = 0;
  17422. function decodeMcu(component, decode, mcu, row, col) {
  17423. const mcuRow = mcu / mcusPerLine | 0;
  17424. const mcuCol = mcu % mcusPerLine;
  17425. blockRow = mcuRow * component.v + row;
  17426. const blockCol = mcuCol * component.h + col;
  17427. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17428. decode(component, blockOffset);
  17429. }
  17430. function decodeBlock(component, decode, mcu) {
  17431. blockRow = mcu / component.blocksPerLine | 0;
  17432. const blockCol = mcu % component.blocksPerLine;
  17433. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17434. decode(component, blockOffset);
  17435. }
  17436. const componentsLength = components.length;
  17437. let component, i, j, k, n;
  17438. let decodeFn;
  17439. if (progressive) {
  17440. if (spectralStart === 0) {
  17441. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  17442. } else {
  17443. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  17444. }
  17445. } else {
  17446. decodeFn = decodeBaseline;
  17447. }
  17448. let mcu = 0,
  17449. fileMarker;
  17450. let mcuExpected;
  17451. if (componentsLength === 1) {
  17452. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  17453. } else {
  17454. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  17455. }
  17456. let h, v;
  17457. while (mcu <= mcuExpected) {
  17458. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  17459. if (mcuToRead > 0) {
  17460. for (i = 0; i < componentsLength; i++) {
  17461. components[i].pred = 0;
  17462. }
  17463. eobrun = 0;
  17464. if (componentsLength === 1) {
  17465. component = components[0];
  17466. for (n = 0; n < mcuToRead; n++) {
  17467. decodeBlock(component, decodeFn, mcu);
  17468. mcu++;
  17469. }
  17470. } else {
  17471. for (n = 0; n < mcuToRead; n++) {
  17472. for (i = 0; i < componentsLength; i++) {
  17473. component = components[i];
  17474. h = component.h;
  17475. v = component.v;
  17476. for (j = 0; j < v; j++) {
  17477. for (k = 0; k < h; k++) {
  17478. decodeMcu(component, decodeFn, mcu, j, k);
  17479. }
  17480. }
  17481. }
  17482. mcu++;
  17483. }
  17484. }
  17485. }
  17486. bitsCount = 0;
  17487. fileMarker = findNextFileMarker(data, offset);
  17488. if (!fileMarker) {
  17489. break;
  17490. }
  17491. if (fileMarker.invalid) {
  17492. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  17493. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  17494. offset = fileMarker.offset;
  17495. }
  17496. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  17497. offset += 2;
  17498. } else {
  17499. break;
  17500. }
  17501. }
  17502. return offset - startOffset;
  17503. }
  17504. function quantizeAndInverse(component, blockBufferOffset, p) {
  17505. const qt = component.quantizationTable,
  17506. blockData = component.blockData;
  17507. let v0, v1, v2, v3, v4, v5, v6, v7;
  17508. let p0, p1, p2, p3, p4, p5, p6, p7;
  17509. let t;
  17510. if (!qt) {
  17511. throw new JpegError("missing required Quantization Table.");
  17512. }
  17513. for (let row = 0; row < 64; row += 8) {
  17514. p0 = blockData[blockBufferOffset + row];
  17515. p1 = blockData[blockBufferOffset + row + 1];
  17516. p2 = blockData[blockBufferOffset + row + 2];
  17517. p3 = blockData[blockBufferOffset + row + 3];
  17518. p4 = blockData[blockBufferOffset + row + 4];
  17519. p5 = blockData[blockBufferOffset + row + 5];
  17520. p6 = blockData[blockBufferOffset + row + 6];
  17521. p7 = blockData[blockBufferOffset + row + 7];
  17522. p0 *= qt[row];
  17523. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17524. t = dctSqrt2 * p0 + 512 >> 10;
  17525. p[row] = t;
  17526. p[row + 1] = t;
  17527. p[row + 2] = t;
  17528. p[row + 3] = t;
  17529. p[row + 4] = t;
  17530. p[row + 5] = t;
  17531. p[row + 6] = t;
  17532. p[row + 7] = t;
  17533. continue;
  17534. }
  17535. p1 *= qt[row + 1];
  17536. p2 *= qt[row + 2];
  17537. p3 *= qt[row + 3];
  17538. p4 *= qt[row + 4];
  17539. p5 *= qt[row + 5];
  17540. p6 *= qt[row + 6];
  17541. p7 *= qt[row + 7];
  17542. v0 = dctSqrt2 * p0 + 128 >> 8;
  17543. v1 = dctSqrt2 * p4 + 128 >> 8;
  17544. v2 = p2;
  17545. v3 = p6;
  17546. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  17547. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  17548. v5 = p3 << 4;
  17549. v6 = p5 << 4;
  17550. v0 = v0 + v1 + 1 >> 1;
  17551. v1 = v0 - v1;
  17552. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  17553. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  17554. v3 = t;
  17555. v4 = v4 + v6 + 1 >> 1;
  17556. v6 = v4 - v6;
  17557. v7 = v7 + v5 + 1 >> 1;
  17558. v5 = v7 - v5;
  17559. v0 = v0 + v3 + 1 >> 1;
  17560. v3 = v0 - v3;
  17561. v1 = v1 + v2 + 1 >> 1;
  17562. v2 = v1 - v2;
  17563. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17564. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17565. v7 = t;
  17566. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17567. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17568. v6 = t;
  17569. p[row] = v0 + v7;
  17570. p[row + 7] = v0 - v7;
  17571. p[row + 1] = v1 + v6;
  17572. p[row + 6] = v1 - v6;
  17573. p[row + 2] = v2 + v5;
  17574. p[row + 5] = v2 - v5;
  17575. p[row + 3] = v3 + v4;
  17576. p[row + 4] = v3 - v4;
  17577. }
  17578. for (let col = 0; col < 8; ++col) {
  17579. p0 = p[col];
  17580. p1 = p[col + 8];
  17581. p2 = p[col + 16];
  17582. p3 = p[col + 24];
  17583. p4 = p[col + 32];
  17584. p5 = p[col + 40];
  17585. p6 = p[col + 48];
  17586. p7 = p[col + 56];
  17587. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17588. t = dctSqrt2 * p0 + 8192 >> 14;
  17589. if (t < -2040) {
  17590. t = 0;
  17591. } else if (t >= 2024) {
  17592. t = 255;
  17593. } else {
  17594. t = t + 2056 >> 4;
  17595. }
  17596. blockData[blockBufferOffset + col] = t;
  17597. blockData[blockBufferOffset + col + 8] = t;
  17598. blockData[blockBufferOffset + col + 16] = t;
  17599. blockData[blockBufferOffset + col + 24] = t;
  17600. blockData[blockBufferOffset + col + 32] = t;
  17601. blockData[blockBufferOffset + col + 40] = t;
  17602. blockData[blockBufferOffset + col + 48] = t;
  17603. blockData[blockBufferOffset + col + 56] = t;
  17604. continue;
  17605. }
  17606. v0 = dctSqrt2 * p0 + 2048 >> 12;
  17607. v1 = dctSqrt2 * p4 + 2048 >> 12;
  17608. v2 = p2;
  17609. v3 = p6;
  17610. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  17611. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  17612. v5 = p3;
  17613. v6 = p5;
  17614. v0 = (v0 + v1 + 1 >> 1) + 4112;
  17615. v1 = v0 - v1;
  17616. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  17617. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  17618. v3 = t;
  17619. v4 = v4 + v6 + 1 >> 1;
  17620. v6 = v4 - v6;
  17621. v7 = v7 + v5 + 1 >> 1;
  17622. v5 = v7 - v5;
  17623. v0 = v0 + v3 + 1 >> 1;
  17624. v3 = v0 - v3;
  17625. v1 = v1 + v2 + 1 >> 1;
  17626. v2 = v1 - v2;
  17627. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17628. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17629. v7 = t;
  17630. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17631. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17632. v6 = t;
  17633. p0 = v0 + v7;
  17634. p7 = v0 - v7;
  17635. p1 = v1 + v6;
  17636. p6 = v1 - v6;
  17637. p2 = v2 + v5;
  17638. p5 = v2 - v5;
  17639. p3 = v3 + v4;
  17640. p4 = v3 - v4;
  17641. if (p0 < 16) {
  17642. p0 = 0;
  17643. } else if (p0 >= 4080) {
  17644. p0 = 255;
  17645. } else {
  17646. p0 >>= 4;
  17647. }
  17648. if (p1 < 16) {
  17649. p1 = 0;
  17650. } else if (p1 >= 4080) {
  17651. p1 = 255;
  17652. } else {
  17653. p1 >>= 4;
  17654. }
  17655. if (p2 < 16) {
  17656. p2 = 0;
  17657. } else if (p2 >= 4080) {
  17658. p2 = 255;
  17659. } else {
  17660. p2 >>= 4;
  17661. }
  17662. if (p3 < 16) {
  17663. p3 = 0;
  17664. } else if (p3 >= 4080) {
  17665. p3 = 255;
  17666. } else {
  17667. p3 >>= 4;
  17668. }
  17669. if (p4 < 16) {
  17670. p4 = 0;
  17671. } else if (p4 >= 4080) {
  17672. p4 = 255;
  17673. } else {
  17674. p4 >>= 4;
  17675. }
  17676. if (p5 < 16) {
  17677. p5 = 0;
  17678. } else if (p5 >= 4080) {
  17679. p5 = 255;
  17680. } else {
  17681. p5 >>= 4;
  17682. }
  17683. if (p6 < 16) {
  17684. p6 = 0;
  17685. } else if (p6 >= 4080) {
  17686. p6 = 255;
  17687. } else {
  17688. p6 >>= 4;
  17689. }
  17690. if (p7 < 16) {
  17691. p7 = 0;
  17692. } else if (p7 >= 4080) {
  17693. p7 = 255;
  17694. } else {
  17695. p7 >>= 4;
  17696. }
  17697. blockData[blockBufferOffset + col] = p0;
  17698. blockData[blockBufferOffset + col + 8] = p1;
  17699. blockData[blockBufferOffset + col + 16] = p2;
  17700. blockData[blockBufferOffset + col + 24] = p3;
  17701. blockData[blockBufferOffset + col + 32] = p4;
  17702. blockData[blockBufferOffset + col + 40] = p5;
  17703. blockData[blockBufferOffset + col + 48] = p6;
  17704. blockData[blockBufferOffset + col + 56] = p7;
  17705. }
  17706. }
  17707. function buildComponentData(frame, component) {
  17708. const blocksPerLine = component.blocksPerLine;
  17709. const blocksPerColumn = component.blocksPerColumn;
  17710. const computationBuffer = new Int16Array(64);
  17711. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  17712. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  17713. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  17714. quantizeAndInverse(component, offset, computationBuffer);
  17715. }
  17716. }
  17717. return component.blockData;
  17718. }
  17719. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  17720. const maxPos = data.length - 1;
  17721. let newPos = startPos < currentPos ? startPos : currentPos;
  17722. if (currentPos >= maxPos) {
  17723. return null;
  17724. }
  17725. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  17726. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  17727. return {
  17728. invalid: null,
  17729. marker: currentMarker,
  17730. offset: currentPos
  17731. };
  17732. }
  17733. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  17734. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  17735. if (++newPos >= maxPos) {
  17736. return null;
  17737. }
  17738. newMarker = (0, _core_utils.readUint16)(data, newPos);
  17739. }
  17740. return {
  17741. invalid: currentMarker.toString(16),
  17742. marker: newMarker,
  17743. offset: newPos
  17744. };
  17745. }
  17746. class JpegImage {
  17747. constructor({
  17748. decodeTransform = null,
  17749. colorTransform = -1
  17750. } = {}) {
  17751. this._decodeTransform = decodeTransform;
  17752. this._colorTransform = colorTransform;
  17753. }
  17754. parse(data, {
  17755. dnlScanLines = null
  17756. } = {}) {
  17757. function readDataBlock() {
  17758. const length = (0, _core_utils.readUint16)(data, offset);
  17759. offset += 2;
  17760. let endOffset = offset + length - 2;
  17761. const fileMarker = findNextFileMarker(data, endOffset, offset);
  17762. if (fileMarker && fileMarker.invalid) {
  17763. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  17764. endOffset = fileMarker.offset;
  17765. }
  17766. const array = data.subarray(offset, endOffset);
  17767. offset += array.length;
  17768. return array;
  17769. }
  17770. function prepareComponents(frame) {
  17771. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  17772. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  17773. for (const component of frame.components) {
  17774. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  17775. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  17776. const blocksPerLineForMcu = mcusPerLine * component.h;
  17777. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  17778. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  17779. component.blockData = new Int16Array(blocksBufferSize);
  17780. component.blocksPerLine = blocksPerLine;
  17781. component.blocksPerColumn = blocksPerColumn;
  17782. }
  17783. frame.mcusPerLine = mcusPerLine;
  17784. frame.mcusPerColumn = mcusPerColumn;
  17785. }
  17786. let offset = 0;
  17787. let jfif = null;
  17788. let adobe = null;
  17789. let frame, resetInterval;
  17790. let numSOSMarkers = 0;
  17791. const quantizationTables = [];
  17792. const huffmanTablesAC = [],
  17793. huffmanTablesDC = [];
  17794. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  17795. offset += 2;
  17796. if (fileMarker !== 0xffd8) {
  17797. throw new JpegError("SOI not found");
  17798. }
  17799. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17800. offset += 2;
  17801. markerLoop: while (fileMarker !== 0xffd9) {
  17802. let i, j, l;
  17803. switch (fileMarker) {
  17804. case 0xffe0:
  17805. case 0xffe1:
  17806. case 0xffe2:
  17807. case 0xffe3:
  17808. case 0xffe4:
  17809. case 0xffe5:
  17810. case 0xffe6:
  17811. case 0xffe7:
  17812. case 0xffe8:
  17813. case 0xffe9:
  17814. case 0xffea:
  17815. case 0xffeb:
  17816. case 0xffec:
  17817. case 0xffed:
  17818. case 0xffee:
  17819. case 0xffef:
  17820. case 0xfffe:
  17821. const appData = readDataBlock();
  17822. if (fileMarker === 0xffe0) {
  17823. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  17824. jfif = {
  17825. version: {
  17826. major: appData[5],
  17827. minor: appData[6]
  17828. },
  17829. densityUnits: appData[7],
  17830. xDensity: appData[8] << 8 | appData[9],
  17831. yDensity: appData[10] << 8 | appData[11],
  17832. thumbWidth: appData[12],
  17833. thumbHeight: appData[13],
  17834. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  17835. };
  17836. }
  17837. }
  17838. if (fileMarker === 0xffee) {
  17839. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  17840. adobe = {
  17841. version: appData[5] << 8 | appData[6],
  17842. flags0: appData[7] << 8 | appData[8],
  17843. flags1: appData[9] << 8 | appData[10],
  17844. transformCode: appData[11]
  17845. };
  17846. }
  17847. }
  17848. break;
  17849. case 0xffdb:
  17850. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  17851. offset += 2;
  17852. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  17853. let z;
  17854. while (offset < quantizationTablesEnd) {
  17855. const quantizationTableSpec = data[offset++];
  17856. const tableData = new Uint16Array(64);
  17857. if (quantizationTableSpec >> 4 === 0) {
  17858. for (j = 0; j < 64; j++) {
  17859. z = dctZigZag[j];
  17860. tableData[z] = data[offset++];
  17861. }
  17862. } else if (quantizationTableSpec >> 4 === 1) {
  17863. for (j = 0; j < 64; j++) {
  17864. z = dctZigZag[j];
  17865. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  17866. offset += 2;
  17867. }
  17868. } else {
  17869. throw new JpegError("DQT - invalid table spec");
  17870. }
  17871. quantizationTables[quantizationTableSpec & 15] = tableData;
  17872. }
  17873. break;
  17874. case 0xffc0:
  17875. case 0xffc1:
  17876. case 0xffc2:
  17877. if (frame) {
  17878. throw new JpegError("Only single frame JPEGs supported");
  17879. }
  17880. offset += 2;
  17881. frame = {};
  17882. frame.extended = fileMarker === 0xffc1;
  17883. frame.progressive = fileMarker === 0xffc2;
  17884. frame.precision = data[offset++];
  17885. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  17886. offset += 2;
  17887. frame.scanLines = dnlScanLines || sofScanLines;
  17888. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  17889. offset += 2;
  17890. frame.components = [];
  17891. frame.componentIds = {};
  17892. const componentsCount = data[offset++];
  17893. let maxH = 0,
  17894. maxV = 0;
  17895. for (i = 0; i < componentsCount; i++) {
  17896. const componentId = data[offset];
  17897. const h = data[offset + 1] >> 4;
  17898. const v = data[offset + 1] & 15;
  17899. if (maxH < h) {
  17900. maxH = h;
  17901. }
  17902. if (maxV < v) {
  17903. maxV = v;
  17904. }
  17905. const qId = data[offset + 2];
  17906. l = frame.components.push({
  17907. h,
  17908. v,
  17909. quantizationId: qId,
  17910. quantizationTable: null
  17911. });
  17912. frame.componentIds[componentId] = l - 1;
  17913. offset += 3;
  17914. }
  17915. frame.maxH = maxH;
  17916. frame.maxV = maxV;
  17917. prepareComponents(frame);
  17918. break;
  17919. case 0xffc4:
  17920. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  17921. offset += 2;
  17922. for (i = 2; i < huffmanLength;) {
  17923. const huffmanTableSpec = data[offset++];
  17924. const codeLengths = new Uint8Array(16);
  17925. let codeLengthSum = 0;
  17926. for (j = 0; j < 16; j++, offset++) {
  17927. codeLengthSum += codeLengths[j] = data[offset];
  17928. }
  17929. const huffmanValues = new Uint8Array(codeLengthSum);
  17930. for (j = 0; j < codeLengthSum; j++, offset++) {
  17931. huffmanValues[j] = data[offset];
  17932. }
  17933. i += 17 + codeLengthSum;
  17934. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  17935. }
  17936. break;
  17937. case 0xffdd:
  17938. offset += 2;
  17939. resetInterval = (0, _core_utils.readUint16)(data, offset);
  17940. offset += 2;
  17941. break;
  17942. case 0xffda:
  17943. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  17944. offset += 2;
  17945. const selectorsCount = data[offset++],
  17946. components = [];
  17947. for (i = 0; i < selectorsCount; i++) {
  17948. const index = data[offset++];
  17949. const componentIndex = frame.componentIds[index];
  17950. const component = frame.components[componentIndex];
  17951. component.index = index;
  17952. const tableSpec = data[offset++];
  17953. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  17954. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  17955. components.push(component);
  17956. }
  17957. const spectralStart = data[offset++],
  17958. spectralEnd = data[offset++],
  17959. successiveApproximation = data[offset++];
  17960. try {
  17961. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  17962. offset += processed;
  17963. } catch (ex) {
  17964. if (ex instanceof DNLMarkerError) {
  17965. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  17966. return this.parse(data, {
  17967. dnlScanLines: ex.scanLines
  17968. });
  17969. } else if (ex instanceof EOIMarkerError) {
  17970. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  17971. break markerLoop;
  17972. }
  17973. throw ex;
  17974. }
  17975. break;
  17976. case 0xffdc:
  17977. offset += 4;
  17978. break;
  17979. case 0xffff:
  17980. if (data[offset] !== 0xff) {
  17981. offset--;
  17982. }
  17983. break;
  17984. default:
  17985. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  17986. if (nextFileMarker && nextFileMarker.invalid) {
  17987. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  17988. offset = nextFileMarker.offset;
  17989. break;
  17990. }
  17991. if (!nextFileMarker || offset >= data.length - 1) {
  17992. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  17993. break markerLoop;
  17994. }
  17995. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  17996. }
  17997. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17998. offset += 2;
  17999. }
  18000. this.width = frame.samplesPerLine;
  18001. this.height = frame.scanLines;
  18002. this.jfif = jfif;
  18003. this.adobe = adobe;
  18004. this.components = [];
  18005. for (const component of frame.components) {
  18006. const quantizationTable = quantizationTables[component.quantizationId];
  18007. if (quantizationTable) {
  18008. component.quantizationTable = quantizationTable;
  18009. }
  18010. this.components.push({
  18011. index: component.index,
  18012. output: buildComponentData(frame, component),
  18013. scaleX: component.h / frame.maxH,
  18014. scaleY: component.v / frame.maxV,
  18015. blocksPerLine: component.blocksPerLine,
  18016. blocksPerColumn: component.blocksPerColumn
  18017. });
  18018. }
  18019. this.numComponents = this.components.length;
  18020. return undefined;
  18021. }
  18022. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  18023. const scaleX = this.width / width,
  18024. scaleY = this.height / height;
  18025. let component, componentScaleX, componentScaleY, blocksPerScanline;
  18026. let x, y, i, j, k;
  18027. let index;
  18028. let offset = 0;
  18029. let output;
  18030. const numComponents = this.components.length;
  18031. const dataLength = width * height * numComponents;
  18032. const data = new Uint8ClampedArray(dataLength);
  18033. const xScaleBlockOffset = new Uint32Array(width);
  18034. const mask3LSB = 0xfffffff8;
  18035. let lastComponentScaleX;
  18036. for (i = 0; i < numComponents; i++) {
  18037. component = this.components[i];
  18038. componentScaleX = component.scaleX * scaleX;
  18039. componentScaleY = component.scaleY * scaleY;
  18040. offset = i;
  18041. output = component.output;
  18042. blocksPerScanline = component.blocksPerLine + 1 << 3;
  18043. if (componentScaleX !== lastComponentScaleX) {
  18044. for (x = 0; x < width; x++) {
  18045. j = 0 | x * componentScaleX;
  18046. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  18047. }
  18048. lastComponentScaleX = componentScaleX;
  18049. }
  18050. for (y = 0; y < height; y++) {
  18051. j = 0 | y * componentScaleY;
  18052. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  18053. for (x = 0; x < width; x++) {
  18054. data[offset] = output[index + xScaleBlockOffset[x]];
  18055. offset += numComponents;
  18056. }
  18057. }
  18058. }
  18059. let transform = this._decodeTransform;
  18060. if (!isSourcePDF && numComponents === 4 && !transform) {
  18061. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  18062. }
  18063. if (transform) {
  18064. for (i = 0; i < dataLength;) {
  18065. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  18066. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  18067. }
  18068. }
  18069. }
  18070. return data;
  18071. }
  18072. get _isColorConversionNeeded() {
  18073. if (this.adobe) {
  18074. return !!this.adobe.transformCode;
  18075. }
  18076. if (this.numComponents === 3) {
  18077. if (this._colorTransform === 0) {
  18078. return false;
  18079. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  18080. return false;
  18081. }
  18082. return true;
  18083. }
  18084. if (this._colorTransform === 1) {
  18085. return true;
  18086. }
  18087. return false;
  18088. }
  18089. _convertYccToRgb(data) {
  18090. let Y, Cb, Cr;
  18091. for (let i = 0, length = data.length; i < length; i += 3) {
  18092. Y = data[i];
  18093. Cb = data[i + 1];
  18094. Cr = data[i + 2];
  18095. data[i] = Y - 179.456 + 1.402 * Cr;
  18096. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  18097. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  18098. }
  18099. return data;
  18100. }
  18101. _convertYcckToRgb(data) {
  18102. let Y, Cb, Cr, k;
  18103. let offset = 0;
  18104. for (let i = 0, length = data.length; i < length; i += 4) {
  18105. Y = data[i];
  18106. Cb = data[i + 1];
  18107. Cr = data[i + 2];
  18108. k = data[i + 3];
  18109. 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);
  18110. 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);
  18111. 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);
  18112. }
  18113. return data.subarray(0, offset);
  18114. }
  18115. _convertYcckToCmyk(data) {
  18116. let Y, Cb, Cr;
  18117. for (let i = 0, length = data.length; i < length; i += 4) {
  18118. Y = data[i];
  18119. Cb = data[i + 1];
  18120. Cr = data[i + 2];
  18121. data[i] = 434.456 - Y - 1.402 * Cr;
  18122. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  18123. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  18124. }
  18125. return data;
  18126. }
  18127. _convertCmykToRgb(data) {
  18128. let c, m, y, k;
  18129. let offset = 0;
  18130. for (let i = 0, length = data.length; i < length; i += 4) {
  18131. c = data[i];
  18132. m = data[i + 1];
  18133. y = data[i + 2];
  18134. k = data[i + 3];
  18135. 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);
  18136. 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);
  18137. 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);
  18138. }
  18139. return data.subarray(0, offset);
  18140. }
  18141. getData({
  18142. width,
  18143. height,
  18144. forceRGB = false,
  18145. isSourcePDF = false
  18146. }) {
  18147. if (this.numComponents > 4) {
  18148. throw new JpegError("Unsupported color mode");
  18149. }
  18150. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  18151. if (this.numComponents === 1 && forceRGB) {
  18152. const rgbData = new Uint8ClampedArray(data.length * 3);
  18153. let offset = 0;
  18154. for (const grayColor of data) {
  18155. rgbData[offset++] = grayColor;
  18156. rgbData[offset++] = grayColor;
  18157. rgbData[offset++] = grayColor;
  18158. }
  18159. return rgbData;
  18160. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  18161. return this._convertYccToRgb(data);
  18162. } else if (this.numComponents === 4) {
  18163. if (this._isColorConversionNeeded) {
  18164. if (forceRGB) {
  18165. return this._convertYcckToRgb(data);
  18166. }
  18167. return this._convertYcckToCmyk(data);
  18168. } else if (forceRGB) {
  18169. return this._convertCmykToRgb(data);
  18170. }
  18171. }
  18172. return data;
  18173. }
  18174. }
  18175. exports.JpegImage = JpegImage;
  18176. /***/ }),
  18177. /* 27 */
  18178. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18179. Object.defineProperty(exports, "__esModule", ({
  18180. value: true
  18181. }));
  18182. exports.JpxStream = void 0;
  18183. var _decode_stream = __w_pdfjs_require__(17);
  18184. var _jpx = __w_pdfjs_require__(28);
  18185. var _util = __w_pdfjs_require__(2);
  18186. class JpxStream extends _decode_stream.DecodeStream {
  18187. constructor(stream, maybeLength, params) {
  18188. super(maybeLength);
  18189. this.stream = stream;
  18190. this.dict = stream.dict;
  18191. this.maybeLength = maybeLength;
  18192. this.params = params;
  18193. }
  18194. get bytes() {
  18195. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18196. }
  18197. ensureBuffer(requested) {}
  18198. readBlock() {
  18199. if (this.eof) {
  18200. return;
  18201. }
  18202. const jpxImage = new _jpx.JpxImage();
  18203. jpxImage.parse(this.bytes);
  18204. const width = jpxImage.width;
  18205. const height = jpxImage.height;
  18206. const componentsCount = jpxImage.componentsCount;
  18207. const tileCount = jpxImage.tiles.length;
  18208. if (tileCount === 1) {
  18209. this.buffer = jpxImage.tiles[0].items;
  18210. } else {
  18211. const data = new Uint8ClampedArray(width * height * componentsCount);
  18212. for (let k = 0; k < tileCount; k++) {
  18213. const tileComponents = jpxImage.tiles[k];
  18214. const tileWidth = tileComponents.width;
  18215. const tileHeight = tileComponents.height;
  18216. const tileLeft = tileComponents.left;
  18217. const tileTop = tileComponents.top;
  18218. const src = tileComponents.items;
  18219. let srcPosition = 0;
  18220. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  18221. const imgRowSize = width * componentsCount;
  18222. const tileRowSize = tileWidth * componentsCount;
  18223. for (let j = 0; j < tileHeight; j++) {
  18224. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  18225. data.set(rowBytes, dataPosition);
  18226. srcPosition += tileRowSize;
  18227. dataPosition += imgRowSize;
  18228. }
  18229. }
  18230. this.buffer = data;
  18231. }
  18232. this.bufferLength = this.buffer.length;
  18233. this.eof = true;
  18234. }
  18235. }
  18236. exports.JpxStream = JpxStream;
  18237. /***/ }),
  18238. /* 28 */
  18239. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18240. Object.defineProperty(exports, "__esModule", ({
  18241. value: true
  18242. }));
  18243. exports.JpxImage = void 0;
  18244. var _util = __w_pdfjs_require__(2);
  18245. var _core_utils = __w_pdfjs_require__(4);
  18246. var _arithmetic_decoder = __w_pdfjs_require__(24);
  18247. class JpxError extends _util.BaseException {
  18248. constructor(msg) {
  18249. super(`JPX error: ${msg}`, "JpxError");
  18250. }
  18251. }
  18252. const SubbandsGainLog2 = {
  18253. LL: 0,
  18254. LH: 1,
  18255. HL: 1,
  18256. HH: 2
  18257. };
  18258. class JpxImage {
  18259. constructor() {
  18260. this.failOnCorruptedImage = false;
  18261. }
  18262. parse(data) {
  18263. const head = (0, _core_utils.readUint16)(data, 0);
  18264. if (head === 0xff4f) {
  18265. this.parseCodestream(data, 0, data.length);
  18266. return;
  18267. }
  18268. const length = data.length;
  18269. let position = 0;
  18270. while (position < length) {
  18271. let headerSize = 8;
  18272. let lbox = (0, _core_utils.readUint32)(data, position);
  18273. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  18274. position += headerSize;
  18275. if (lbox === 1) {
  18276. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  18277. position += 8;
  18278. headerSize += 8;
  18279. }
  18280. if (lbox === 0) {
  18281. lbox = length - position + headerSize;
  18282. }
  18283. if (lbox < headerSize) {
  18284. throw new JpxError("Invalid box field size");
  18285. }
  18286. const dataLength = lbox - headerSize;
  18287. let jumpDataLength = true;
  18288. switch (tbox) {
  18289. case 0x6a703268:
  18290. jumpDataLength = false;
  18291. break;
  18292. case 0x636f6c72:
  18293. const method = data[position];
  18294. if (method === 1) {
  18295. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  18296. switch (colorspace) {
  18297. case 16:
  18298. case 17:
  18299. case 18:
  18300. break;
  18301. default:
  18302. (0, _util.warn)("Unknown colorspace " + colorspace);
  18303. break;
  18304. }
  18305. } else if (method === 2) {
  18306. (0, _util.info)("ICC profile not supported");
  18307. }
  18308. break;
  18309. case 0x6a703263:
  18310. this.parseCodestream(data, position, position + dataLength);
  18311. break;
  18312. case 0x6a502020:
  18313. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  18314. (0, _util.warn)("Invalid JP2 signature");
  18315. }
  18316. break;
  18317. case 0x6a501a1a:
  18318. case 0x66747970:
  18319. case 0x72726571:
  18320. case 0x72657320:
  18321. case 0x69686472:
  18322. break;
  18323. default:
  18324. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  18325. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  18326. break;
  18327. }
  18328. if (jumpDataLength) {
  18329. position += dataLength;
  18330. }
  18331. }
  18332. }
  18333. parseImageProperties(stream) {
  18334. let newByte = stream.getByte();
  18335. while (newByte >= 0) {
  18336. const oldByte = newByte;
  18337. newByte = stream.getByte();
  18338. const code = oldByte << 8 | newByte;
  18339. if (code === 0xff51) {
  18340. stream.skip(4);
  18341. const Xsiz = stream.getInt32() >>> 0;
  18342. const Ysiz = stream.getInt32() >>> 0;
  18343. const XOsiz = stream.getInt32() >>> 0;
  18344. const YOsiz = stream.getInt32() >>> 0;
  18345. stream.skip(16);
  18346. const Csiz = stream.getUint16();
  18347. this.width = Xsiz - XOsiz;
  18348. this.height = Ysiz - YOsiz;
  18349. this.componentsCount = Csiz;
  18350. this.bitsPerComponent = 8;
  18351. return;
  18352. }
  18353. }
  18354. throw new JpxError("No size marker found in JPX stream");
  18355. }
  18356. parseCodestream(data, start, end) {
  18357. const context = {};
  18358. let doNotRecover = false;
  18359. try {
  18360. let position = start;
  18361. while (position + 1 < end) {
  18362. const code = (0, _core_utils.readUint16)(data, position);
  18363. position += 2;
  18364. let length = 0,
  18365. j,
  18366. sqcd,
  18367. spqcds,
  18368. spqcdSize,
  18369. scalarExpounded,
  18370. tile;
  18371. switch (code) {
  18372. case 0xff4f:
  18373. context.mainHeader = true;
  18374. break;
  18375. case 0xffd9:
  18376. break;
  18377. case 0xff51:
  18378. length = (0, _core_utils.readUint16)(data, position);
  18379. const siz = {};
  18380. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  18381. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  18382. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  18383. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  18384. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  18385. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  18386. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  18387. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  18388. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  18389. siz.Csiz = componentsCount;
  18390. const components = [];
  18391. j = position + 38;
  18392. for (let i = 0; i < componentsCount; i++) {
  18393. const component = {
  18394. precision: (data[j] & 0x7f) + 1,
  18395. isSigned: !!(data[j] & 0x80),
  18396. XRsiz: data[j + 1],
  18397. YRsiz: data[j + 2]
  18398. };
  18399. j += 3;
  18400. calculateComponentDimensions(component, siz);
  18401. components.push(component);
  18402. }
  18403. context.SIZ = siz;
  18404. context.components = components;
  18405. calculateTileGrids(context, components);
  18406. context.QCC = [];
  18407. context.COC = [];
  18408. break;
  18409. case 0xff5c:
  18410. length = (0, _core_utils.readUint16)(data, position);
  18411. const qcd = {};
  18412. j = position + 2;
  18413. sqcd = data[j++];
  18414. switch (sqcd & 0x1f) {
  18415. case 0:
  18416. spqcdSize = 8;
  18417. scalarExpounded = true;
  18418. break;
  18419. case 1:
  18420. spqcdSize = 16;
  18421. scalarExpounded = false;
  18422. break;
  18423. case 2:
  18424. spqcdSize = 16;
  18425. scalarExpounded = true;
  18426. break;
  18427. default:
  18428. throw new Error("Invalid SQcd value " + sqcd);
  18429. }
  18430. qcd.noQuantization = spqcdSize === 8;
  18431. qcd.scalarExpounded = scalarExpounded;
  18432. qcd.guardBits = sqcd >> 5;
  18433. spqcds = [];
  18434. while (j < length + position) {
  18435. const spqcd = {};
  18436. if (spqcdSize === 8) {
  18437. spqcd.epsilon = data[j++] >> 3;
  18438. spqcd.mu = 0;
  18439. } else {
  18440. spqcd.epsilon = data[j] >> 3;
  18441. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18442. j += 2;
  18443. }
  18444. spqcds.push(spqcd);
  18445. }
  18446. qcd.SPqcds = spqcds;
  18447. if (context.mainHeader) {
  18448. context.QCD = qcd;
  18449. } else {
  18450. context.currentTile.QCD = qcd;
  18451. context.currentTile.QCC = [];
  18452. }
  18453. break;
  18454. case 0xff5d:
  18455. length = (0, _core_utils.readUint16)(data, position);
  18456. const qcc = {};
  18457. j = position + 2;
  18458. let cqcc;
  18459. if (context.SIZ.Csiz < 257) {
  18460. cqcc = data[j++];
  18461. } else {
  18462. cqcc = (0, _core_utils.readUint16)(data, j);
  18463. j += 2;
  18464. }
  18465. sqcd = data[j++];
  18466. switch (sqcd & 0x1f) {
  18467. case 0:
  18468. spqcdSize = 8;
  18469. scalarExpounded = true;
  18470. break;
  18471. case 1:
  18472. spqcdSize = 16;
  18473. scalarExpounded = false;
  18474. break;
  18475. case 2:
  18476. spqcdSize = 16;
  18477. scalarExpounded = true;
  18478. break;
  18479. default:
  18480. throw new Error("Invalid SQcd value " + sqcd);
  18481. }
  18482. qcc.noQuantization = spqcdSize === 8;
  18483. qcc.scalarExpounded = scalarExpounded;
  18484. qcc.guardBits = sqcd >> 5;
  18485. spqcds = [];
  18486. while (j < length + position) {
  18487. const spqcd = {};
  18488. if (spqcdSize === 8) {
  18489. spqcd.epsilon = data[j++] >> 3;
  18490. spqcd.mu = 0;
  18491. } else {
  18492. spqcd.epsilon = data[j] >> 3;
  18493. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18494. j += 2;
  18495. }
  18496. spqcds.push(spqcd);
  18497. }
  18498. qcc.SPqcds = spqcds;
  18499. if (context.mainHeader) {
  18500. context.QCC[cqcc] = qcc;
  18501. } else {
  18502. context.currentTile.QCC[cqcc] = qcc;
  18503. }
  18504. break;
  18505. case 0xff52:
  18506. length = (0, _core_utils.readUint16)(data, position);
  18507. const cod = {};
  18508. j = position + 2;
  18509. const scod = data[j++];
  18510. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18511. cod.sopMarkerUsed = !!(scod & 2);
  18512. cod.ephMarkerUsed = !!(scod & 4);
  18513. cod.progressionOrder = data[j++];
  18514. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  18515. j += 2;
  18516. cod.multipleComponentTransform = data[j++];
  18517. cod.decompositionLevelsCount = data[j++];
  18518. cod.xcb = (data[j++] & 0xf) + 2;
  18519. cod.ycb = (data[j++] & 0xf) + 2;
  18520. const blockStyle = data[j++];
  18521. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18522. cod.resetContextProbabilities = !!(blockStyle & 2);
  18523. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18524. cod.verticallyStripe = !!(blockStyle & 8);
  18525. cod.predictableTermination = !!(blockStyle & 16);
  18526. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18527. cod.reversibleTransformation = data[j++];
  18528. if (cod.entropyCoderWithCustomPrecincts) {
  18529. const precinctsSizes = [];
  18530. while (j < length + position) {
  18531. const precinctsSize = data[j++];
  18532. precinctsSizes.push({
  18533. PPx: precinctsSize & 0xf,
  18534. PPy: precinctsSize >> 4
  18535. });
  18536. }
  18537. cod.precinctsSizes = precinctsSizes;
  18538. }
  18539. const unsupported = [];
  18540. if (cod.selectiveArithmeticCodingBypass) {
  18541. unsupported.push("selectiveArithmeticCodingBypass");
  18542. }
  18543. if (cod.terminationOnEachCodingPass) {
  18544. unsupported.push("terminationOnEachCodingPass");
  18545. }
  18546. if (cod.verticallyStripe) {
  18547. unsupported.push("verticallyStripe");
  18548. }
  18549. if (cod.predictableTermination) {
  18550. unsupported.push("predictableTermination");
  18551. }
  18552. if (unsupported.length > 0) {
  18553. doNotRecover = true;
  18554. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  18555. }
  18556. if (context.mainHeader) {
  18557. context.COD = cod;
  18558. } else {
  18559. context.currentTile.COD = cod;
  18560. context.currentTile.COC = [];
  18561. }
  18562. break;
  18563. case 0xff90:
  18564. length = (0, _core_utils.readUint16)(data, position);
  18565. tile = {};
  18566. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  18567. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  18568. tile.dataEnd = tile.length + position - 2;
  18569. tile.partIndex = data[position + 8];
  18570. tile.partsCount = data[position + 9];
  18571. context.mainHeader = false;
  18572. if (tile.partIndex === 0) {
  18573. tile.COD = context.COD;
  18574. tile.COC = context.COC.slice(0);
  18575. tile.QCD = context.QCD;
  18576. tile.QCC = context.QCC.slice(0);
  18577. }
  18578. context.currentTile = tile;
  18579. break;
  18580. case 0xff93:
  18581. tile = context.currentTile;
  18582. if (tile.partIndex === 0) {
  18583. initializeTile(context, tile.index);
  18584. buildPackets(context);
  18585. }
  18586. length = tile.dataEnd - position;
  18587. parseTilePackets(context, data, position, length);
  18588. break;
  18589. case 0xff53:
  18590. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  18591. case 0xff55:
  18592. case 0xff57:
  18593. case 0xff58:
  18594. case 0xff64:
  18595. length = (0, _core_utils.readUint16)(data, position);
  18596. break;
  18597. default:
  18598. throw new Error("Unknown codestream code: " + code.toString(16));
  18599. }
  18600. position += length;
  18601. }
  18602. } catch (e) {
  18603. if (doNotRecover || this.failOnCorruptedImage) {
  18604. throw new JpxError(e.message);
  18605. } else {
  18606. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  18607. }
  18608. }
  18609. this.tiles = transformComponents(context);
  18610. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18611. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18612. this.componentsCount = context.SIZ.Csiz;
  18613. }
  18614. }
  18615. exports.JpxImage = JpxImage;
  18616. function calculateComponentDimensions(component, siz) {
  18617. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18618. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18619. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18620. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18621. component.width = component.x1 - component.x0;
  18622. component.height = component.y1 - component.y0;
  18623. }
  18624. function calculateTileGrids(context, components) {
  18625. const siz = context.SIZ;
  18626. const tiles = [];
  18627. let tile;
  18628. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18629. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18630. for (let q = 0; q < numYtiles; q++) {
  18631. for (let p = 0; p < numXtiles; p++) {
  18632. tile = {};
  18633. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18634. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18635. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18636. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18637. tile.width = tile.tx1 - tile.tx0;
  18638. tile.height = tile.ty1 - tile.ty0;
  18639. tile.components = [];
  18640. tiles.push(tile);
  18641. }
  18642. }
  18643. context.tiles = tiles;
  18644. const componentsCount = siz.Csiz;
  18645. for (let i = 0, ii = componentsCount; i < ii; i++) {
  18646. const component = components[i];
  18647. for (let j = 0, jj = tiles.length; j < jj; j++) {
  18648. const tileComponent = {};
  18649. tile = tiles[j];
  18650. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18651. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18652. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18653. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18654. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18655. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18656. tile.components[i] = tileComponent;
  18657. }
  18658. }
  18659. }
  18660. function getBlocksDimensions(context, component, r) {
  18661. const codOrCoc = component.codingStyleParameters;
  18662. const result = {};
  18663. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18664. result.PPx = 15;
  18665. result.PPy = 15;
  18666. } else {
  18667. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18668. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18669. }
  18670. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18671. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18672. return result;
  18673. }
  18674. function buildPrecincts(context, resolution, dimensions) {
  18675. const precinctWidth = 1 << dimensions.PPx;
  18676. const precinctHeight = 1 << dimensions.PPy;
  18677. const isZeroRes = resolution.resLevel === 0;
  18678. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18679. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18680. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18681. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18682. const numprecincts = numprecinctswide * numprecinctshigh;
  18683. resolution.precinctParameters = {
  18684. precinctWidth,
  18685. precinctHeight,
  18686. numprecinctswide,
  18687. numprecinctshigh,
  18688. numprecincts,
  18689. precinctWidthInSubband,
  18690. precinctHeightInSubband
  18691. };
  18692. }
  18693. function buildCodeblocks(context, subband, dimensions) {
  18694. const xcb_ = dimensions.xcb_;
  18695. const ycb_ = dimensions.ycb_;
  18696. const codeblockWidth = 1 << xcb_;
  18697. const codeblockHeight = 1 << ycb_;
  18698. const cbx0 = subband.tbx0 >> xcb_;
  18699. const cby0 = subband.tby0 >> ycb_;
  18700. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18701. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18702. const precinctParameters = subband.resolution.precinctParameters;
  18703. const codeblocks = [];
  18704. const precincts = [];
  18705. let i, j, codeblock, precinctNumber;
  18706. for (j = cby0; j < cby1; j++) {
  18707. for (i = cbx0; i < cbx1; i++) {
  18708. codeblock = {
  18709. cbx: i,
  18710. cby: j,
  18711. tbx0: codeblockWidth * i,
  18712. tby0: codeblockHeight * j,
  18713. tbx1: codeblockWidth * (i + 1),
  18714. tby1: codeblockHeight * (j + 1)
  18715. };
  18716. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18717. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18718. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18719. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18720. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18721. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18722. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18723. codeblock.precinctNumber = precinctNumber;
  18724. codeblock.subbandType = subband.type;
  18725. codeblock.Lblock = 3;
  18726. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18727. continue;
  18728. }
  18729. codeblocks.push(codeblock);
  18730. let precinct = precincts[precinctNumber];
  18731. if (precinct !== undefined) {
  18732. if (i < precinct.cbxMin) {
  18733. precinct.cbxMin = i;
  18734. } else if (i > precinct.cbxMax) {
  18735. precinct.cbxMax = i;
  18736. }
  18737. if (j < precinct.cbyMin) {
  18738. precinct.cbxMin = j;
  18739. } else if (j > precinct.cbyMax) {
  18740. precinct.cbyMax = j;
  18741. }
  18742. } else {
  18743. precincts[precinctNumber] = precinct = {
  18744. cbxMin: i,
  18745. cbyMin: j,
  18746. cbxMax: i,
  18747. cbyMax: j
  18748. };
  18749. }
  18750. codeblock.precinct = precinct;
  18751. }
  18752. }
  18753. subband.codeblockParameters = {
  18754. codeblockWidth: xcb_,
  18755. codeblockHeight: ycb_,
  18756. numcodeblockwide: cbx1 - cbx0 + 1,
  18757. numcodeblockhigh: cby1 - cby0 + 1
  18758. };
  18759. subband.codeblocks = codeblocks;
  18760. subband.precincts = precincts;
  18761. }
  18762. function createPacket(resolution, precinctNumber, layerNumber) {
  18763. const precinctCodeblocks = [];
  18764. const subbands = resolution.subbands;
  18765. for (let i = 0, ii = subbands.length; i < ii; i++) {
  18766. const subband = subbands[i];
  18767. const codeblocks = subband.codeblocks;
  18768. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  18769. const codeblock = codeblocks[j];
  18770. if (codeblock.precinctNumber !== precinctNumber) {
  18771. continue;
  18772. }
  18773. precinctCodeblocks.push(codeblock);
  18774. }
  18775. }
  18776. return {
  18777. layerNumber,
  18778. codeblocks: precinctCodeblocks
  18779. };
  18780. }
  18781. function LayerResolutionComponentPositionIterator(context) {
  18782. const siz = context.SIZ;
  18783. const tileIndex = context.currentTile.index;
  18784. const tile = context.tiles[tileIndex];
  18785. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18786. const componentsCount = siz.Csiz;
  18787. let maxDecompositionLevelsCount = 0;
  18788. for (let q = 0; q < componentsCount; q++) {
  18789. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18790. }
  18791. let l = 0,
  18792. r = 0,
  18793. i = 0,
  18794. k = 0;
  18795. this.nextPacket = function JpxImage_nextPacket() {
  18796. for (; l < layersCount; l++) {
  18797. for (; r <= maxDecompositionLevelsCount; r++) {
  18798. for (; i < componentsCount; i++) {
  18799. const component = tile.components[i];
  18800. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18801. continue;
  18802. }
  18803. const resolution = component.resolutions[r];
  18804. const numprecincts = resolution.precinctParameters.numprecincts;
  18805. for (; k < numprecincts;) {
  18806. const packet = createPacket(resolution, k, l);
  18807. k++;
  18808. return packet;
  18809. }
  18810. k = 0;
  18811. }
  18812. i = 0;
  18813. }
  18814. r = 0;
  18815. }
  18816. throw new JpxError("Out of packets");
  18817. };
  18818. }
  18819. function ResolutionLayerComponentPositionIterator(context) {
  18820. const siz = context.SIZ;
  18821. const tileIndex = context.currentTile.index;
  18822. const tile = context.tiles[tileIndex];
  18823. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18824. const componentsCount = siz.Csiz;
  18825. let maxDecompositionLevelsCount = 0;
  18826. for (let q = 0; q < componentsCount; q++) {
  18827. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18828. }
  18829. let r = 0,
  18830. l = 0,
  18831. i = 0,
  18832. k = 0;
  18833. this.nextPacket = function JpxImage_nextPacket() {
  18834. for (; r <= maxDecompositionLevelsCount; r++) {
  18835. for (; l < layersCount; l++) {
  18836. for (; i < componentsCount; i++) {
  18837. const component = tile.components[i];
  18838. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18839. continue;
  18840. }
  18841. const resolution = component.resolutions[r];
  18842. const numprecincts = resolution.precinctParameters.numprecincts;
  18843. for (; k < numprecincts;) {
  18844. const packet = createPacket(resolution, k, l);
  18845. k++;
  18846. return packet;
  18847. }
  18848. k = 0;
  18849. }
  18850. i = 0;
  18851. }
  18852. l = 0;
  18853. }
  18854. throw new JpxError("Out of packets");
  18855. };
  18856. }
  18857. function ResolutionPositionComponentLayerIterator(context) {
  18858. const siz = context.SIZ;
  18859. const tileIndex = context.currentTile.index;
  18860. const tile = context.tiles[tileIndex];
  18861. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18862. const componentsCount = siz.Csiz;
  18863. let l, r, c, p;
  18864. let maxDecompositionLevelsCount = 0;
  18865. for (c = 0; c < componentsCount; c++) {
  18866. const component = tile.components[c];
  18867. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18868. }
  18869. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18870. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18871. let maxNumPrecincts = 0;
  18872. for (c = 0; c < componentsCount; ++c) {
  18873. const resolutions = tile.components[c].resolutions;
  18874. if (r < resolutions.length) {
  18875. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18876. }
  18877. }
  18878. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18879. }
  18880. l = 0;
  18881. r = 0;
  18882. c = 0;
  18883. p = 0;
  18884. this.nextPacket = function JpxImage_nextPacket() {
  18885. for (; r <= maxDecompositionLevelsCount; r++) {
  18886. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18887. for (; c < componentsCount; c++) {
  18888. const component = tile.components[c];
  18889. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18890. continue;
  18891. }
  18892. const resolution = component.resolutions[r];
  18893. const numprecincts = resolution.precinctParameters.numprecincts;
  18894. if (p >= numprecincts) {
  18895. continue;
  18896. }
  18897. for (; l < layersCount;) {
  18898. const packet = createPacket(resolution, p, l);
  18899. l++;
  18900. return packet;
  18901. }
  18902. l = 0;
  18903. }
  18904. c = 0;
  18905. }
  18906. p = 0;
  18907. }
  18908. throw new JpxError("Out of packets");
  18909. };
  18910. }
  18911. function PositionComponentResolutionLayerIterator(context) {
  18912. const siz = context.SIZ;
  18913. const tileIndex = context.currentTile.index;
  18914. const tile = context.tiles[tileIndex];
  18915. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18916. const componentsCount = siz.Csiz;
  18917. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18918. const precinctsIterationSizes = precinctsSizes;
  18919. let l = 0,
  18920. r = 0,
  18921. c = 0,
  18922. px = 0,
  18923. py = 0;
  18924. this.nextPacket = function JpxImage_nextPacket() {
  18925. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18926. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18927. for (; c < componentsCount; c++) {
  18928. const component = tile.components[c];
  18929. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18930. for (; r <= decompositionLevelsCount; r++) {
  18931. const resolution = component.resolutions[r];
  18932. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18933. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18934. if (k === null) {
  18935. continue;
  18936. }
  18937. for (; l < layersCount;) {
  18938. const packet = createPacket(resolution, k, l);
  18939. l++;
  18940. return packet;
  18941. }
  18942. l = 0;
  18943. }
  18944. r = 0;
  18945. }
  18946. c = 0;
  18947. }
  18948. px = 0;
  18949. }
  18950. throw new JpxError("Out of packets");
  18951. };
  18952. }
  18953. function ComponentPositionResolutionLayerIterator(context) {
  18954. const siz = context.SIZ;
  18955. const tileIndex = context.currentTile.index;
  18956. const tile = context.tiles[tileIndex];
  18957. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18958. const componentsCount = siz.Csiz;
  18959. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18960. let l = 0,
  18961. r = 0,
  18962. c = 0,
  18963. px = 0,
  18964. py = 0;
  18965. this.nextPacket = function JpxImage_nextPacket() {
  18966. for (; c < componentsCount; ++c) {
  18967. const component = tile.components[c];
  18968. const precinctsIterationSizes = precinctsSizes.components[c];
  18969. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18970. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18971. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18972. for (; r <= decompositionLevelsCount; r++) {
  18973. const resolution = component.resolutions[r];
  18974. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18975. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18976. if (k === null) {
  18977. continue;
  18978. }
  18979. for (; l < layersCount;) {
  18980. const packet = createPacket(resolution, k, l);
  18981. l++;
  18982. return packet;
  18983. }
  18984. l = 0;
  18985. }
  18986. r = 0;
  18987. }
  18988. px = 0;
  18989. }
  18990. py = 0;
  18991. }
  18992. throw new JpxError("Out of packets");
  18993. };
  18994. }
  18995. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  18996. const posX = pxIndex * precinctIterationSizes.minWidth;
  18997. const posY = pyIndex * precinctIterationSizes.minHeight;
  18998. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  18999. return null;
  19000. }
  19001. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  19002. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  19003. }
  19004. function getPrecinctSizesInImageScale(tile) {
  19005. const componentsCount = tile.components.length;
  19006. let minWidth = Number.MAX_VALUE;
  19007. let minHeight = Number.MAX_VALUE;
  19008. let maxNumWide = 0;
  19009. let maxNumHigh = 0;
  19010. const sizePerComponent = new Array(componentsCount);
  19011. for (let c = 0; c < componentsCount; c++) {
  19012. const component = tile.components[c];
  19013. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  19014. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  19015. let minWidthCurrentComponent = Number.MAX_VALUE;
  19016. let minHeightCurrentComponent = Number.MAX_VALUE;
  19017. let maxNumWideCurrentComponent = 0;
  19018. let maxNumHighCurrentComponent = 0;
  19019. let scale = 1;
  19020. for (let r = decompositionLevelsCount; r >= 0; --r) {
  19021. const resolution = component.resolutions[r];
  19022. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  19023. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  19024. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  19025. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  19026. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  19027. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  19028. sizePerResolution[r] = {
  19029. width: widthCurrentResolution,
  19030. height: heightCurrentResolution
  19031. };
  19032. scale <<= 1;
  19033. }
  19034. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  19035. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  19036. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  19037. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  19038. sizePerComponent[c] = {
  19039. resolutions: sizePerResolution,
  19040. minWidth: minWidthCurrentComponent,
  19041. minHeight: minHeightCurrentComponent,
  19042. maxNumWide: maxNumWideCurrentComponent,
  19043. maxNumHigh: maxNumHighCurrentComponent
  19044. };
  19045. }
  19046. return {
  19047. components: sizePerComponent,
  19048. minWidth,
  19049. minHeight,
  19050. maxNumWide,
  19051. maxNumHigh
  19052. };
  19053. }
  19054. function buildPackets(context) {
  19055. const siz = context.SIZ;
  19056. const tileIndex = context.currentTile.index;
  19057. const tile = context.tiles[tileIndex];
  19058. const componentsCount = siz.Csiz;
  19059. for (let c = 0; c < componentsCount; c++) {
  19060. const component = tile.components[c];
  19061. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  19062. const resolutions = [];
  19063. const subbands = [];
  19064. for (let r = 0; r <= decompositionLevelsCount; r++) {
  19065. const blocksDimensions = getBlocksDimensions(context, component, r);
  19066. const resolution = {};
  19067. const scale = 1 << decompositionLevelsCount - r;
  19068. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  19069. resolution.try0 = Math.ceil(component.tcy0 / scale);
  19070. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  19071. resolution.try1 = Math.ceil(component.tcy1 / scale);
  19072. resolution.resLevel = r;
  19073. buildPrecincts(context, resolution, blocksDimensions);
  19074. resolutions.push(resolution);
  19075. let subband;
  19076. if (r === 0) {
  19077. subband = {};
  19078. subband.type = "LL";
  19079. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  19080. subband.tby0 = Math.ceil(component.tcy0 / scale);
  19081. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  19082. subband.tby1 = Math.ceil(component.tcy1 / scale);
  19083. subband.resolution = resolution;
  19084. buildCodeblocks(context, subband, blocksDimensions);
  19085. subbands.push(subband);
  19086. resolution.subbands = [subband];
  19087. } else {
  19088. const bscale = 1 << decompositionLevelsCount - r + 1;
  19089. const resolutionSubbands = [];
  19090. subband = {};
  19091. subband.type = "HL";
  19092. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19093. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  19094. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19095. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  19096. subband.resolution = resolution;
  19097. buildCodeblocks(context, subband, blocksDimensions);
  19098. subbands.push(subband);
  19099. resolutionSubbands.push(subband);
  19100. subband = {};
  19101. subband.type = "LH";
  19102. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  19103. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19104. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  19105. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19106. subband.resolution = resolution;
  19107. buildCodeblocks(context, subband, blocksDimensions);
  19108. subbands.push(subband);
  19109. resolutionSubbands.push(subband);
  19110. subband = {};
  19111. subband.type = "HH";
  19112. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19113. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19114. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19115. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19116. subband.resolution = resolution;
  19117. buildCodeblocks(context, subband, blocksDimensions);
  19118. subbands.push(subband);
  19119. resolutionSubbands.push(subband);
  19120. resolution.subbands = resolutionSubbands;
  19121. }
  19122. }
  19123. component.resolutions = resolutions;
  19124. component.subbands = subbands;
  19125. }
  19126. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  19127. switch (progressionOrder) {
  19128. case 0:
  19129. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  19130. break;
  19131. case 1:
  19132. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  19133. break;
  19134. case 2:
  19135. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  19136. break;
  19137. case 3:
  19138. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  19139. break;
  19140. case 4:
  19141. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  19142. break;
  19143. default:
  19144. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  19145. }
  19146. }
  19147. function parseTilePackets(context, data, offset, dataLength) {
  19148. let position = 0;
  19149. let buffer,
  19150. bufferSize = 0,
  19151. skipNextBit = false;
  19152. function readBits(count) {
  19153. while (bufferSize < count) {
  19154. const b = data[offset + position];
  19155. position++;
  19156. if (skipNextBit) {
  19157. buffer = buffer << 7 | b;
  19158. bufferSize += 7;
  19159. skipNextBit = false;
  19160. } else {
  19161. buffer = buffer << 8 | b;
  19162. bufferSize += 8;
  19163. }
  19164. if (b === 0xff) {
  19165. skipNextBit = true;
  19166. }
  19167. }
  19168. bufferSize -= count;
  19169. return buffer >>> bufferSize & (1 << count) - 1;
  19170. }
  19171. function skipMarkerIfEqual(value) {
  19172. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  19173. skipBytes(1);
  19174. return true;
  19175. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  19176. skipBytes(2);
  19177. return true;
  19178. }
  19179. return false;
  19180. }
  19181. function skipBytes(count) {
  19182. position += count;
  19183. }
  19184. function alignToByte() {
  19185. bufferSize = 0;
  19186. if (skipNextBit) {
  19187. position++;
  19188. skipNextBit = false;
  19189. }
  19190. }
  19191. function readCodingpasses() {
  19192. if (readBits(1) === 0) {
  19193. return 1;
  19194. }
  19195. if (readBits(1) === 0) {
  19196. return 2;
  19197. }
  19198. let value = readBits(2);
  19199. if (value < 3) {
  19200. return value + 3;
  19201. }
  19202. value = readBits(5);
  19203. if (value < 31) {
  19204. return value + 6;
  19205. }
  19206. value = readBits(7);
  19207. return value + 37;
  19208. }
  19209. const tileIndex = context.currentTile.index;
  19210. const tile = context.tiles[tileIndex];
  19211. const sopMarkerUsed = context.COD.sopMarkerUsed;
  19212. const ephMarkerUsed = context.COD.ephMarkerUsed;
  19213. const packetsIterator = tile.packetsIterator;
  19214. while (position < dataLength) {
  19215. alignToByte();
  19216. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  19217. skipBytes(4);
  19218. }
  19219. const packet = packetsIterator.nextPacket();
  19220. if (!readBits(1)) {
  19221. continue;
  19222. }
  19223. const layerNumber = packet.layerNumber,
  19224. queue = [];
  19225. let codeblock;
  19226. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  19227. codeblock = packet.codeblocks[i];
  19228. let precinct = codeblock.precinct;
  19229. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  19230. const codeblockRow = codeblock.cby - precinct.cbyMin;
  19231. let codeblockIncluded = false;
  19232. let firstTimeInclusion = false;
  19233. let valueReady, zeroBitPlanesTree;
  19234. if (codeblock.included !== undefined) {
  19235. codeblockIncluded = !!readBits(1);
  19236. } else {
  19237. precinct = codeblock.precinct;
  19238. let inclusionTree;
  19239. if (precinct.inclusionTree !== undefined) {
  19240. inclusionTree = precinct.inclusionTree;
  19241. } else {
  19242. const width = precinct.cbxMax - precinct.cbxMin + 1;
  19243. const height = precinct.cbyMax - precinct.cbyMin + 1;
  19244. inclusionTree = new InclusionTree(width, height, layerNumber);
  19245. zeroBitPlanesTree = new TagTree(width, height);
  19246. precinct.inclusionTree = inclusionTree;
  19247. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  19248. for (let l = 0; l < layerNumber; l++) {
  19249. if (readBits(1) !== 0) {
  19250. throw new JpxError("Invalid tag tree");
  19251. }
  19252. }
  19253. }
  19254. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  19255. while (true) {
  19256. if (readBits(1)) {
  19257. valueReady = !inclusionTree.nextLevel();
  19258. if (valueReady) {
  19259. codeblock.included = true;
  19260. codeblockIncluded = firstTimeInclusion = true;
  19261. break;
  19262. }
  19263. } else {
  19264. inclusionTree.incrementValue(layerNumber);
  19265. break;
  19266. }
  19267. }
  19268. }
  19269. }
  19270. if (!codeblockIncluded) {
  19271. continue;
  19272. }
  19273. if (firstTimeInclusion) {
  19274. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  19275. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  19276. while (true) {
  19277. if (readBits(1)) {
  19278. valueReady = !zeroBitPlanesTree.nextLevel();
  19279. if (valueReady) {
  19280. break;
  19281. }
  19282. } else {
  19283. zeroBitPlanesTree.incrementValue();
  19284. }
  19285. }
  19286. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  19287. }
  19288. const codingpasses = readCodingpasses();
  19289. while (readBits(1)) {
  19290. codeblock.Lblock++;
  19291. }
  19292. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  19293. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  19294. const codedDataLength = readBits(bits);
  19295. queue.push({
  19296. codeblock,
  19297. codingpasses,
  19298. dataLength: codedDataLength
  19299. });
  19300. }
  19301. alignToByte();
  19302. if (ephMarkerUsed) {
  19303. skipMarkerIfEqual(0x92);
  19304. }
  19305. while (queue.length > 0) {
  19306. const packetItem = queue.shift();
  19307. codeblock = packetItem.codeblock;
  19308. if (codeblock.data === undefined) {
  19309. codeblock.data = [];
  19310. }
  19311. codeblock.data.push({
  19312. data,
  19313. start: offset + position,
  19314. end: offset + position + packetItem.dataLength,
  19315. codingpasses: packetItem.codingpasses
  19316. });
  19317. position += packetItem.dataLength;
  19318. }
  19319. }
  19320. return position;
  19321. }
  19322. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  19323. const x0 = subband.tbx0;
  19324. const y0 = subband.tby0;
  19325. const width = subband.tbx1 - subband.tbx0;
  19326. const codeblocks = subband.codeblocks;
  19327. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  19328. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  19329. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  19330. const codeblock = codeblocks[i];
  19331. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  19332. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  19333. if (blockWidth === 0 || blockHeight === 0) {
  19334. continue;
  19335. }
  19336. if (codeblock.data === undefined) {
  19337. continue;
  19338. }
  19339. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  19340. let currentCodingpassType = 2;
  19341. const data = codeblock.data;
  19342. let totalLength = 0,
  19343. codingpasses = 0;
  19344. let j, jj, dataItem;
  19345. for (j = 0, jj = data.length; j < jj; j++) {
  19346. dataItem = data[j];
  19347. totalLength += dataItem.end - dataItem.start;
  19348. codingpasses += dataItem.codingpasses;
  19349. }
  19350. const encodedData = new Uint8Array(totalLength);
  19351. let position = 0;
  19352. for (j = 0, jj = data.length; j < jj; j++) {
  19353. dataItem = data[j];
  19354. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  19355. encodedData.set(chunk, position);
  19356. position += chunk.length;
  19357. }
  19358. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  19359. bitModel.setDecoder(decoder);
  19360. for (j = 0; j < codingpasses; j++) {
  19361. switch (currentCodingpassType) {
  19362. case 0:
  19363. bitModel.runSignificancePropagationPass();
  19364. break;
  19365. case 1:
  19366. bitModel.runMagnitudeRefinementPass();
  19367. break;
  19368. case 2:
  19369. bitModel.runCleanupPass();
  19370. if (segmentationSymbolUsed) {
  19371. bitModel.checkSegmentationSymbol();
  19372. }
  19373. break;
  19374. }
  19375. if (resetContextProbabilities) {
  19376. bitModel.reset();
  19377. }
  19378. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19379. }
  19380. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19381. const sign = bitModel.coefficentsSign;
  19382. const magnitude = bitModel.coefficentsMagnitude;
  19383. const bitsDecoded = bitModel.bitsDecoded;
  19384. const magnitudeCorrection = reversible ? 0 : 0.5;
  19385. let k, n, nb;
  19386. position = 0;
  19387. const interleave = subband.type !== "LL";
  19388. for (j = 0; j < blockHeight; j++) {
  19389. const row = offset / width | 0;
  19390. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19391. for (k = 0; k < blockWidth; k++) {
  19392. n = magnitude[position];
  19393. if (n !== 0) {
  19394. n = (n + magnitudeCorrection) * delta;
  19395. if (sign[position] !== 0) {
  19396. n = -n;
  19397. }
  19398. nb = bitsDecoded[position];
  19399. const pos = interleave ? levelOffset + (offset << 1) : offset;
  19400. if (reversible && nb >= mb) {
  19401. coefficients[pos] = n;
  19402. } else {
  19403. coefficients[pos] = n * (1 << mb - nb);
  19404. }
  19405. }
  19406. offset++;
  19407. position++;
  19408. }
  19409. offset += width - blockWidth;
  19410. }
  19411. }
  19412. }
  19413. function transformTile(context, tile, c) {
  19414. const component = tile.components[c];
  19415. const codingStyleParameters = component.codingStyleParameters;
  19416. const quantizationParameters = component.quantizationParameters;
  19417. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19418. const spqcds = quantizationParameters.SPqcds;
  19419. const scalarExpounded = quantizationParameters.scalarExpounded;
  19420. const guardBits = quantizationParameters.guardBits;
  19421. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19422. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  19423. const precision = context.components[c].precision;
  19424. const reversible = codingStyleParameters.reversibleTransformation;
  19425. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19426. const subbandCoefficients = [];
  19427. let b = 0;
  19428. for (let i = 0; i <= decompositionLevelsCount; i++) {
  19429. const resolution = component.resolutions[i];
  19430. const width = resolution.trx1 - resolution.trx0;
  19431. const height = resolution.try1 - resolution.try0;
  19432. const coefficients = new Float32Array(width * height);
  19433. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19434. let mu, epsilon;
  19435. if (!scalarExpounded) {
  19436. mu = spqcds[0].mu;
  19437. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19438. } else {
  19439. mu = spqcds[b].mu;
  19440. epsilon = spqcds[b].epsilon;
  19441. b++;
  19442. }
  19443. const subband = resolution.subbands[j];
  19444. const gainLog2 = SubbandsGainLog2[subband.type];
  19445. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19446. const mb = guardBits + epsilon - 1;
  19447. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  19448. }
  19449. subbandCoefficients.push({
  19450. width,
  19451. height,
  19452. items: coefficients
  19453. });
  19454. }
  19455. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19456. return {
  19457. left: component.tcx0,
  19458. top: component.tcy0,
  19459. width: result.width,
  19460. height: result.height,
  19461. items: result.items
  19462. };
  19463. }
  19464. function transformComponents(context) {
  19465. const siz = context.SIZ;
  19466. const components = context.components;
  19467. const componentsCount = siz.Csiz;
  19468. const resultImages = [];
  19469. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  19470. const tile = context.tiles[i];
  19471. const transformedTiles = [];
  19472. for (let c = 0; c < componentsCount; c++) {
  19473. transformedTiles[c] = transformTile(context, tile, c);
  19474. }
  19475. const tile0 = transformedTiles[0];
  19476. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  19477. const result = {
  19478. left: tile0.left,
  19479. top: tile0.top,
  19480. width: tile0.width,
  19481. height: tile0.height,
  19482. items: out
  19483. };
  19484. let shift, offset;
  19485. let pos = 0,
  19486. j,
  19487. jj,
  19488. y0,
  19489. y1,
  19490. y2;
  19491. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19492. const fourComponents = componentsCount === 4;
  19493. const y0items = transformedTiles[0].items;
  19494. const y1items = transformedTiles[1].items;
  19495. const y2items = transformedTiles[2].items;
  19496. const y3items = fourComponents ? transformedTiles[3].items : null;
  19497. shift = components[0].precision - 8;
  19498. offset = (128 << shift) + 0.5;
  19499. const component0 = tile.components[0];
  19500. const alpha01 = componentsCount - 3;
  19501. jj = y0items.length;
  19502. if (!component0.codingStyleParameters.reversibleTransformation) {
  19503. for (j = 0; j < jj; j++, pos += alpha01) {
  19504. y0 = y0items[j] + offset;
  19505. y1 = y1items[j];
  19506. y2 = y2items[j];
  19507. out[pos++] = y0 + 1.402 * y2 >> shift;
  19508. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  19509. out[pos++] = y0 + 1.772 * y1 >> shift;
  19510. }
  19511. } else {
  19512. for (j = 0; j < jj; j++, pos += alpha01) {
  19513. y0 = y0items[j] + offset;
  19514. y1 = y1items[j];
  19515. y2 = y2items[j];
  19516. const g = y0 - (y2 + y1 >> 2);
  19517. out[pos++] = g + y2 >> shift;
  19518. out[pos++] = g >> shift;
  19519. out[pos++] = g + y1 >> shift;
  19520. }
  19521. }
  19522. if (fourComponents) {
  19523. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19524. out[pos] = y3items[j] + offset >> shift;
  19525. }
  19526. }
  19527. } else {
  19528. for (let c = 0; c < componentsCount; c++) {
  19529. const items = transformedTiles[c].items;
  19530. shift = components[c].precision - 8;
  19531. offset = (128 << shift) + 0.5;
  19532. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19533. out[pos] = items[j] + offset >> shift;
  19534. pos += componentsCount;
  19535. }
  19536. }
  19537. }
  19538. resultImages.push(result);
  19539. }
  19540. return resultImages;
  19541. }
  19542. function initializeTile(context, tileIndex) {
  19543. const siz = context.SIZ;
  19544. const componentsCount = siz.Csiz;
  19545. const tile = context.tiles[tileIndex];
  19546. for (let c = 0; c < componentsCount; c++) {
  19547. const component = tile.components[c];
  19548. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19549. component.quantizationParameters = qcdOrQcc;
  19550. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19551. component.codingStyleParameters = codOrCoc;
  19552. }
  19553. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19554. }
  19555. class TagTree {
  19556. constructor(width, height) {
  19557. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19558. this.levels = [];
  19559. for (let i = 0; i < levelsLength; i++) {
  19560. const level = {
  19561. width,
  19562. height,
  19563. items: []
  19564. };
  19565. this.levels.push(level);
  19566. width = Math.ceil(width / 2);
  19567. height = Math.ceil(height / 2);
  19568. }
  19569. }
  19570. reset(i, j) {
  19571. let currentLevel = 0,
  19572. value = 0,
  19573. level;
  19574. while (currentLevel < this.levels.length) {
  19575. level = this.levels[currentLevel];
  19576. const index = i + j * level.width;
  19577. if (level.items[index] !== undefined) {
  19578. value = level.items[index];
  19579. break;
  19580. }
  19581. level.index = index;
  19582. i >>= 1;
  19583. j >>= 1;
  19584. currentLevel++;
  19585. }
  19586. currentLevel--;
  19587. level = this.levels[currentLevel];
  19588. level.items[level.index] = value;
  19589. this.currentLevel = currentLevel;
  19590. delete this.value;
  19591. }
  19592. incrementValue() {
  19593. const level = this.levels[this.currentLevel];
  19594. level.items[level.index]++;
  19595. }
  19596. nextLevel() {
  19597. let currentLevel = this.currentLevel;
  19598. let level = this.levels[currentLevel];
  19599. const value = level.items[level.index];
  19600. currentLevel--;
  19601. if (currentLevel < 0) {
  19602. this.value = value;
  19603. return false;
  19604. }
  19605. this.currentLevel = currentLevel;
  19606. level = this.levels[currentLevel];
  19607. level.items[level.index] = value;
  19608. return true;
  19609. }
  19610. }
  19611. class InclusionTree {
  19612. constructor(width, height, defaultValue) {
  19613. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19614. this.levels = [];
  19615. for (let i = 0; i < levelsLength; i++) {
  19616. const items = new Uint8Array(width * height);
  19617. for (let j = 0, jj = items.length; j < jj; j++) {
  19618. items[j] = defaultValue;
  19619. }
  19620. const level = {
  19621. width,
  19622. height,
  19623. items
  19624. };
  19625. this.levels.push(level);
  19626. width = Math.ceil(width / 2);
  19627. height = Math.ceil(height / 2);
  19628. }
  19629. }
  19630. reset(i, j, stopValue) {
  19631. let currentLevel = 0;
  19632. while (currentLevel < this.levels.length) {
  19633. const level = this.levels[currentLevel];
  19634. const index = i + j * level.width;
  19635. level.index = index;
  19636. const value = level.items[index];
  19637. if (value === 0xff) {
  19638. break;
  19639. }
  19640. if (value > stopValue) {
  19641. this.currentLevel = currentLevel;
  19642. this.propagateValues();
  19643. return false;
  19644. }
  19645. i >>= 1;
  19646. j >>= 1;
  19647. currentLevel++;
  19648. }
  19649. this.currentLevel = currentLevel - 1;
  19650. return true;
  19651. }
  19652. incrementValue(stopValue) {
  19653. const level = this.levels[this.currentLevel];
  19654. level.items[level.index] = stopValue + 1;
  19655. this.propagateValues();
  19656. }
  19657. propagateValues() {
  19658. let levelIndex = this.currentLevel;
  19659. let level = this.levels[levelIndex];
  19660. const currentValue = level.items[level.index];
  19661. while (--levelIndex >= 0) {
  19662. level = this.levels[levelIndex];
  19663. level.items[level.index] = currentValue;
  19664. }
  19665. }
  19666. nextLevel() {
  19667. let currentLevel = this.currentLevel;
  19668. let level = this.levels[currentLevel];
  19669. const value = level.items[level.index];
  19670. level.items[level.index] = 0xff;
  19671. currentLevel--;
  19672. if (currentLevel < 0) {
  19673. return false;
  19674. }
  19675. this.currentLevel = currentLevel;
  19676. level = this.levels[currentLevel];
  19677. level.items[level.index] = value;
  19678. return true;
  19679. }
  19680. }
  19681. const BitModel = function BitModelClosure() {
  19682. const UNIFORM_CONTEXT = 17;
  19683. const RUNLENGTH_CONTEXT = 18;
  19684. 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]);
  19685. 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]);
  19686. 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]);
  19687. class BitModel {
  19688. constructor(width, height, subband, zeroBitPlanes, mb) {
  19689. this.width = width;
  19690. this.height = height;
  19691. let contextLabelTable;
  19692. if (subband === "HH") {
  19693. contextLabelTable = HHContextLabel;
  19694. } else if (subband === "HL") {
  19695. contextLabelTable = HLContextLabel;
  19696. } else {
  19697. contextLabelTable = LLAndLHContextsLabel;
  19698. }
  19699. this.contextLabelTable = contextLabelTable;
  19700. const coefficientCount = width * height;
  19701. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19702. this.coefficentsSign = new Uint8Array(coefficientCount);
  19703. let coefficentsMagnitude;
  19704. if (mb > 14) {
  19705. coefficentsMagnitude = new Uint32Array(coefficientCount);
  19706. } else if (mb > 6) {
  19707. coefficentsMagnitude = new Uint16Array(coefficientCount);
  19708. } else {
  19709. coefficentsMagnitude = new Uint8Array(coefficientCount);
  19710. }
  19711. this.coefficentsMagnitude = coefficentsMagnitude;
  19712. this.processingFlags = new Uint8Array(coefficientCount);
  19713. const bitsDecoded = new Uint8Array(coefficientCount);
  19714. if (zeroBitPlanes !== 0) {
  19715. for (let i = 0; i < coefficientCount; i++) {
  19716. bitsDecoded[i] = zeroBitPlanes;
  19717. }
  19718. }
  19719. this.bitsDecoded = bitsDecoded;
  19720. this.reset();
  19721. }
  19722. setDecoder(decoder) {
  19723. this.decoder = decoder;
  19724. }
  19725. reset() {
  19726. this.contexts = new Int8Array(19);
  19727. this.contexts[0] = 4 << 1 | 0;
  19728. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19729. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19730. }
  19731. setNeighborsSignificance(row, column, index) {
  19732. const neighborsSignificance = this.neighborsSignificance;
  19733. const width = this.width,
  19734. height = this.height;
  19735. const left = column > 0;
  19736. const right = column + 1 < width;
  19737. let i;
  19738. if (row > 0) {
  19739. i = index - width;
  19740. if (left) {
  19741. neighborsSignificance[i - 1] += 0x10;
  19742. }
  19743. if (right) {
  19744. neighborsSignificance[i + 1] += 0x10;
  19745. }
  19746. neighborsSignificance[i] += 0x04;
  19747. }
  19748. if (row + 1 < height) {
  19749. i = index + width;
  19750. if (left) {
  19751. neighborsSignificance[i - 1] += 0x10;
  19752. }
  19753. if (right) {
  19754. neighborsSignificance[i + 1] += 0x10;
  19755. }
  19756. neighborsSignificance[i] += 0x04;
  19757. }
  19758. if (left) {
  19759. neighborsSignificance[index - 1] += 0x01;
  19760. }
  19761. if (right) {
  19762. neighborsSignificance[index + 1] += 0x01;
  19763. }
  19764. neighborsSignificance[index] |= 0x80;
  19765. }
  19766. runSignificancePropagationPass() {
  19767. const decoder = this.decoder;
  19768. const width = this.width,
  19769. height = this.height;
  19770. const coefficentsMagnitude = this.coefficentsMagnitude;
  19771. const coefficentsSign = this.coefficentsSign;
  19772. const neighborsSignificance = this.neighborsSignificance;
  19773. const processingFlags = this.processingFlags;
  19774. const contexts = this.contexts;
  19775. const labels = this.contextLabelTable;
  19776. const bitsDecoded = this.bitsDecoded;
  19777. const processedInverseMask = ~1;
  19778. const processedMask = 1;
  19779. const firstMagnitudeBitMask = 2;
  19780. for (let i0 = 0; i0 < height; i0 += 4) {
  19781. for (let j = 0; j < width; j++) {
  19782. let index = i0 * width + j;
  19783. for (let i1 = 0; i1 < 4; i1++, index += width) {
  19784. const i = i0 + i1;
  19785. if (i >= height) {
  19786. break;
  19787. }
  19788. processingFlags[index] &= processedInverseMask;
  19789. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19790. continue;
  19791. }
  19792. const contextLabel = labels[neighborsSignificance[index]];
  19793. const decision = decoder.readBit(contexts, contextLabel);
  19794. if (decision) {
  19795. const sign = this.decodeSignBit(i, j, index);
  19796. coefficentsSign[index] = sign;
  19797. coefficentsMagnitude[index] = 1;
  19798. this.setNeighborsSignificance(i, j, index);
  19799. processingFlags[index] |= firstMagnitudeBitMask;
  19800. }
  19801. bitsDecoded[index]++;
  19802. processingFlags[index] |= processedMask;
  19803. }
  19804. }
  19805. }
  19806. }
  19807. decodeSignBit(row, column, index) {
  19808. const width = this.width,
  19809. height = this.height;
  19810. const coefficentsMagnitude = this.coefficentsMagnitude;
  19811. const coefficentsSign = this.coefficentsSign;
  19812. let contribution, sign0, sign1, significance1;
  19813. let contextLabel, decoded;
  19814. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19815. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19816. sign1 = coefficentsSign[index + 1];
  19817. if (significance1) {
  19818. sign0 = coefficentsSign[index - 1];
  19819. contribution = 1 - sign1 - sign0;
  19820. } else {
  19821. contribution = 1 - sign1 - sign1;
  19822. }
  19823. } else if (significance1) {
  19824. sign0 = coefficentsSign[index - 1];
  19825. contribution = 1 - sign0 - sign0;
  19826. } else {
  19827. contribution = 0;
  19828. }
  19829. const horizontalContribution = 3 * contribution;
  19830. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19831. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19832. sign1 = coefficentsSign[index + width];
  19833. if (significance1) {
  19834. sign0 = coefficentsSign[index - width];
  19835. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19836. } else {
  19837. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19838. }
  19839. } else if (significance1) {
  19840. sign0 = coefficentsSign[index - width];
  19841. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19842. } else {
  19843. contribution = horizontalContribution;
  19844. }
  19845. if (contribution >= 0) {
  19846. contextLabel = 9 + contribution;
  19847. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19848. } else {
  19849. contextLabel = 9 - contribution;
  19850. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19851. }
  19852. return decoded;
  19853. }
  19854. runMagnitudeRefinementPass() {
  19855. const decoder = this.decoder;
  19856. const width = this.width,
  19857. height = this.height;
  19858. const coefficentsMagnitude = this.coefficentsMagnitude;
  19859. const neighborsSignificance = this.neighborsSignificance;
  19860. const contexts = this.contexts;
  19861. const bitsDecoded = this.bitsDecoded;
  19862. const processingFlags = this.processingFlags;
  19863. const processedMask = 1;
  19864. const firstMagnitudeBitMask = 2;
  19865. const length = width * height;
  19866. const width4 = width * 4;
  19867. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19868. indexNext = Math.min(length, index0 + width4);
  19869. for (let j = 0; j < width; j++) {
  19870. for (let index = index0 + j; index < indexNext; index += width) {
  19871. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19872. continue;
  19873. }
  19874. let contextLabel = 16;
  19875. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19876. processingFlags[index] ^= firstMagnitudeBitMask;
  19877. const significance = neighborsSignificance[index] & 127;
  19878. contextLabel = significance === 0 ? 15 : 14;
  19879. }
  19880. const bit = decoder.readBit(contexts, contextLabel);
  19881. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19882. bitsDecoded[index]++;
  19883. processingFlags[index] |= processedMask;
  19884. }
  19885. }
  19886. }
  19887. }
  19888. runCleanupPass() {
  19889. const decoder = this.decoder;
  19890. const width = this.width,
  19891. height = this.height;
  19892. const neighborsSignificance = this.neighborsSignificance;
  19893. const coefficentsMagnitude = this.coefficentsMagnitude;
  19894. const coefficentsSign = this.coefficentsSign;
  19895. const contexts = this.contexts;
  19896. const labels = this.contextLabelTable;
  19897. const bitsDecoded = this.bitsDecoded;
  19898. const processingFlags = this.processingFlags;
  19899. const processedMask = 1;
  19900. const firstMagnitudeBitMask = 2;
  19901. const oneRowDown = width;
  19902. const twoRowsDown = width * 2;
  19903. const threeRowsDown = width * 3;
  19904. let iNext;
  19905. for (let i0 = 0; i0 < height; i0 = iNext) {
  19906. iNext = Math.min(i0 + 4, height);
  19907. const indexBase = i0 * width;
  19908. const checkAllEmpty = i0 + 3 < height;
  19909. for (let j = 0; j < width; j++) {
  19910. const index0 = indexBase + j;
  19911. 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;
  19912. let i1 = 0,
  19913. index = index0;
  19914. let i = i0,
  19915. sign;
  19916. if (allEmpty) {
  19917. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19918. if (!hasSignificantCoefficent) {
  19919. bitsDecoded[index0]++;
  19920. bitsDecoded[index0 + oneRowDown]++;
  19921. bitsDecoded[index0 + twoRowsDown]++;
  19922. bitsDecoded[index0 + threeRowsDown]++;
  19923. continue;
  19924. }
  19925. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19926. if (i1 !== 0) {
  19927. i = i0 + i1;
  19928. index += i1 * width;
  19929. }
  19930. sign = this.decodeSignBit(i, j, index);
  19931. coefficentsSign[index] = sign;
  19932. coefficentsMagnitude[index] = 1;
  19933. this.setNeighborsSignificance(i, j, index);
  19934. processingFlags[index] |= firstMagnitudeBitMask;
  19935. index = index0;
  19936. for (let i2 = i0; i2 <= i; i2++, index += width) {
  19937. bitsDecoded[index]++;
  19938. }
  19939. i1++;
  19940. }
  19941. for (i = i0 + i1; i < iNext; i++, index += width) {
  19942. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19943. continue;
  19944. }
  19945. const contextLabel = labels[neighborsSignificance[index]];
  19946. const decision = decoder.readBit(contexts, contextLabel);
  19947. if (decision === 1) {
  19948. sign = this.decodeSignBit(i, j, index);
  19949. coefficentsSign[index] = sign;
  19950. coefficentsMagnitude[index] = 1;
  19951. this.setNeighborsSignificance(i, j, index);
  19952. processingFlags[index] |= firstMagnitudeBitMask;
  19953. }
  19954. bitsDecoded[index]++;
  19955. }
  19956. }
  19957. }
  19958. }
  19959. checkSegmentationSymbol() {
  19960. const decoder = this.decoder;
  19961. const contexts = this.contexts;
  19962. 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);
  19963. if (symbol !== 0xa) {
  19964. throw new JpxError("Invalid segmentation symbol");
  19965. }
  19966. }
  19967. }
  19968. return BitModel;
  19969. }();
  19970. class Transform {
  19971. constructor() {
  19972. if (this.constructor === Transform) {
  19973. (0, _util.unreachable)("Cannot initialize Transform.");
  19974. }
  19975. }
  19976. calculate(subbands, u0, v0) {
  19977. let ll = subbands[0];
  19978. for (let i = 1, ii = subbands.length; i < ii; i++) {
  19979. ll = this.iterate(ll, subbands[i], u0, v0);
  19980. }
  19981. return ll;
  19982. }
  19983. extend(buffer, offset, size) {
  19984. let i1 = offset - 1,
  19985. j1 = offset + 1;
  19986. let i2 = offset + size - 2,
  19987. j2 = offset + size;
  19988. buffer[i1--] = buffer[j1++];
  19989. buffer[j2++] = buffer[i2--];
  19990. buffer[i1--] = buffer[j1++];
  19991. buffer[j2++] = buffer[i2--];
  19992. buffer[i1--] = buffer[j1++];
  19993. buffer[j2++] = buffer[i2--];
  19994. buffer[i1] = buffer[j1];
  19995. buffer[j2] = buffer[i2];
  19996. }
  19997. filter(x, offset, length) {
  19998. (0, _util.unreachable)("Abstract method `filter` called");
  19999. }
  20000. iterate(ll, hl_lh_hh, u0, v0) {
  20001. const llWidth = ll.width,
  20002. llHeight = ll.height;
  20003. let llItems = ll.items;
  20004. const width = hl_lh_hh.width;
  20005. const height = hl_lh_hh.height;
  20006. const items = hl_lh_hh.items;
  20007. let i, j, k, l, u, v;
  20008. for (k = 0, i = 0; i < llHeight; i++) {
  20009. l = i * 2 * width;
  20010. for (j = 0; j < llWidth; j++, k++, l += 2) {
  20011. items[l] = llItems[k];
  20012. }
  20013. }
  20014. llItems = ll.items = null;
  20015. const bufferPadding = 4;
  20016. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  20017. if (width === 1) {
  20018. if ((u0 & 1) !== 0) {
  20019. for (v = 0, k = 0; v < height; v++, k += width) {
  20020. items[k] *= 0.5;
  20021. }
  20022. }
  20023. } else {
  20024. for (v = 0, k = 0; v < height; v++, k += width) {
  20025. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  20026. this.extend(rowBuffer, bufferPadding, width);
  20027. this.filter(rowBuffer, bufferPadding, width);
  20028. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  20029. }
  20030. }
  20031. let numBuffers = 16;
  20032. const colBuffers = [];
  20033. for (i = 0; i < numBuffers; i++) {
  20034. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  20035. }
  20036. let b,
  20037. currentBuffer = 0;
  20038. ll = bufferPadding + height;
  20039. if (height === 1) {
  20040. if ((v0 & 1) !== 0) {
  20041. for (u = 0; u < width; u++) {
  20042. items[u] *= 0.5;
  20043. }
  20044. }
  20045. } else {
  20046. for (u = 0; u < width; u++) {
  20047. if (currentBuffer === 0) {
  20048. numBuffers = Math.min(width - u, numBuffers);
  20049. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  20050. for (b = 0; b < numBuffers; b++) {
  20051. colBuffers[b][l] = items[k + b];
  20052. }
  20053. }
  20054. currentBuffer = numBuffers;
  20055. }
  20056. currentBuffer--;
  20057. const buffer = colBuffers[currentBuffer];
  20058. this.extend(buffer, bufferPadding, height);
  20059. this.filter(buffer, bufferPadding, height);
  20060. if (currentBuffer === 0) {
  20061. k = u - numBuffers + 1;
  20062. for (l = bufferPadding; l < ll; k += width, l++) {
  20063. for (b = 0; b < numBuffers; b++) {
  20064. items[k + b] = colBuffers[b][l];
  20065. }
  20066. }
  20067. }
  20068. }
  20069. }
  20070. return {
  20071. width,
  20072. height,
  20073. items
  20074. };
  20075. }
  20076. }
  20077. class IrreversibleTransform extends Transform {
  20078. filter(x, offset, length) {
  20079. const len = length >> 1;
  20080. offset |= 0;
  20081. let j, n, current, next;
  20082. const alpha = -1.586134342059924;
  20083. const beta = -0.052980118572961;
  20084. const gamma = 0.882911075530934;
  20085. const delta = 0.443506852043971;
  20086. const K = 1.230174104914001;
  20087. const K_ = 1 / K;
  20088. j = offset - 3;
  20089. for (n = len + 4; n--; j += 2) {
  20090. x[j] *= K_;
  20091. }
  20092. j = offset - 2;
  20093. current = delta * x[j - 1];
  20094. for (n = len + 3; n--; j += 2) {
  20095. next = delta * x[j + 1];
  20096. x[j] = K * x[j] - current - next;
  20097. if (n--) {
  20098. j += 2;
  20099. current = delta * x[j + 1];
  20100. x[j] = K * x[j] - current - next;
  20101. } else {
  20102. break;
  20103. }
  20104. }
  20105. j = offset - 1;
  20106. current = gamma * x[j - 1];
  20107. for (n = len + 2; n--; j += 2) {
  20108. next = gamma * x[j + 1];
  20109. x[j] -= current + next;
  20110. if (n--) {
  20111. j += 2;
  20112. current = gamma * x[j + 1];
  20113. x[j] -= current + next;
  20114. } else {
  20115. break;
  20116. }
  20117. }
  20118. j = offset;
  20119. current = beta * x[j - 1];
  20120. for (n = len + 1; n--; j += 2) {
  20121. next = beta * x[j + 1];
  20122. x[j] -= current + next;
  20123. if (n--) {
  20124. j += 2;
  20125. current = beta * x[j + 1];
  20126. x[j] -= current + next;
  20127. } else {
  20128. break;
  20129. }
  20130. }
  20131. if (len !== 0) {
  20132. j = offset + 1;
  20133. current = alpha * x[j - 1];
  20134. for (n = len; n--; j += 2) {
  20135. next = alpha * x[j + 1];
  20136. x[j] -= current + next;
  20137. if (n--) {
  20138. j += 2;
  20139. current = alpha * x[j + 1];
  20140. x[j] -= current + next;
  20141. } else {
  20142. break;
  20143. }
  20144. }
  20145. }
  20146. }
  20147. }
  20148. class ReversibleTransform extends Transform {
  20149. filter(x, offset, length) {
  20150. const len = length >> 1;
  20151. offset |= 0;
  20152. let j, n;
  20153. for (j = offset, n = len + 1; n--; j += 2) {
  20154. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  20155. }
  20156. for (j = offset + 1, n = len; n--; j += 2) {
  20157. x[j] += x[j - 1] + x[j + 1] >> 1;
  20158. }
  20159. }
  20160. }
  20161. /***/ }),
  20162. /* 29 */
  20163. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20164. Object.defineProperty(exports, "__esModule", ({
  20165. value: true
  20166. }));
  20167. exports.LZWStream = void 0;
  20168. var _decode_stream = __w_pdfjs_require__(17);
  20169. class LZWStream extends _decode_stream.DecodeStream {
  20170. constructor(str, maybeLength, earlyChange) {
  20171. super(maybeLength);
  20172. this.str = str;
  20173. this.dict = str.dict;
  20174. this.cachedData = 0;
  20175. this.bitsCached = 0;
  20176. const maxLzwDictionarySize = 4096;
  20177. const lzwState = {
  20178. earlyChange,
  20179. codeLength: 9,
  20180. nextCode: 258,
  20181. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  20182. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  20183. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  20184. currentSequence: new Uint8Array(maxLzwDictionarySize),
  20185. currentSequenceLength: 0
  20186. };
  20187. for (let i = 0; i < 256; ++i) {
  20188. lzwState.dictionaryValues[i] = i;
  20189. lzwState.dictionaryLengths[i] = 1;
  20190. }
  20191. this.lzwState = lzwState;
  20192. }
  20193. readBits(n) {
  20194. let bitsCached = this.bitsCached;
  20195. let cachedData = this.cachedData;
  20196. while (bitsCached < n) {
  20197. const c = this.str.getByte();
  20198. if (c === -1) {
  20199. this.eof = true;
  20200. return null;
  20201. }
  20202. cachedData = cachedData << 8 | c;
  20203. bitsCached += 8;
  20204. }
  20205. this.bitsCached = bitsCached -= n;
  20206. this.cachedData = cachedData;
  20207. this.lastCode = null;
  20208. return cachedData >>> bitsCached & (1 << n) - 1;
  20209. }
  20210. readBlock() {
  20211. const blockSize = 512,
  20212. decodedSizeDelta = blockSize;
  20213. let estimatedDecodedSize = blockSize * 2;
  20214. let i, j, q;
  20215. const lzwState = this.lzwState;
  20216. if (!lzwState) {
  20217. return;
  20218. }
  20219. const earlyChange = lzwState.earlyChange;
  20220. let nextCode = lzwState.nextCode;
  20221. const dictionaryValues = lzwState.dictionaryValues;
  20222. const dictionaryLengths = lzwState.dictionaryLengths;
  20223. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  20224. let codeLength = lzwState.codeLength;
  20225. let prevCode = lzwState.prevCode;
  20226. const currentSequence = lzwState.currentSequence;
  20227. let currentSequenceLength = lzwState.currentSequenceLength;
  20228. let decodedLength = 0;
  20229. let currentBufferLength = this.bufferLength;
  20230. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20231. for (i = 0; i < blockSize; i++) {
  20232. const code = this.readBits(codeLength);
  20233. const hasPrev = currentSequenceLength > 0;
  20234. if (code < 256) {
  20235. currentSequence[0] = code;
  20236. currentSequenceLength = 1;
  20237. } else if (code >= 258) {
  20238. if (code < nextCode) {
  20239. currentSequenceLength = dictionaryLengths[code];
  20240. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  20241. currentSequence[j] = dictionaryValues[q];
  20242. q = dictionaryPrevCodes[q];
  20243. }
  20244. } else {
  20245. currentSequence[currentSequenceLength++] = currentSequence[0];
  20246. }
  20247. } else if (code === 256) {
  20248. codeLength = 9;
  20249. nextCode = 258;
  20250. currentSequenceLength = 0;
  20251. continue;
  20252. } else {
  20253. this.eof = true;
  20254. delete this.lzwState;
  20255. break;
  20256. }
  20257. if (hasPrev) {
  20258. dictionaryPrevCodes[nextCode] = prevCode;
  20259. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  20260. dictionaryValues[nextCode] = currentSequence[0];
  20261. nextCode++;
  20262. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  20263. }
  20264. prevCode = code;
  20265. decodedLength += currentSequenceLength;
  20266. if (estimatedDecodedSize < decodedLength) {
  20267. do {
  20268. estimatedDecodedSize += decodedSizeDelta;
  20269. } while (estimatedDecodedSize < decodedLength);
  20270. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20271. }
  20272. for (j = 0; j < currentSequenceLength; j++) {
  20273. buffer[currentBufferLength++] = currentSequence[j];
  20274. }
  20275. }
  20276. lzwState.nextCode = nextCode;
  20277. lzwState.codeLength = codeLength;
  20278. lzwState.prevCode = prevCode;
  20279. lzwState.currentSequenceLength = currentSequenceLength;
  20280. this.bufferLength = currentBufferLength;
  20281. }
  20282. }
  20283. exports.LZWStream = LZWStream;
  20284. /***/ }),
  20285. /* 30 */
  20286. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20287. Object.defineProperty(exports, "__esModule", ({
  20288. value: true
  20289. }));
  20290. exports.PredictorStream = void 0;
  20291. var _decode_stream = __w_pdfjs_require__(17);
  20292. var _primitives = __w_pdfjs_require__(3);
  20293. var _util = __w_pdfjs_require__(2);
  20294. class PredictorStream extends _decode_stream.DecodeStream {
  20295. constructor(str, maybeLength, params) {
  20296. super(maybeLength);
  20297. if (!(params instanceof _primitives.Dict)) {
  20298. return str;
  20299. }
  20300. const predictor = this.predictor = params.get("Predictor") || 1;
  20301. if (predictor <= 1) {
  20302. return str;
  20303. }
  20304. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  20305. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20306. }
  20307. if (predictor === 2) {
  20308. this.readBlock = this.readBlockTiff;
  20309. } else {
  20310. this.readBlock = this.readBlockPng;
  20311. }
  20312. this.str = str;
  20313. this.dict = str.dict;
  20314. const colors = this.colors = params.get("Colors") || 1;
  20315. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  20316. const columns = this.columns = params.get("Columns") || 1;
  20317. this.pixBytes = colors * bits + 7 >> 3;
  20318. this.rowBytes = columns * colors * bits + 7 >> 3;
  20319. return this;
  20320. }
  20321. readBlockTiff() {
  20322. const rowBytes = this.rowBytes;
  20323. const bufferLength = this.bufferLength;
  20324. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20325. const bits = this.bits;
  20326. const colors = this.colors;
  20327. const rawBytes = this.str.getBytes(rowBytes);
  20328. this.eof = !rawBytes.length;
  20329. if (this.eof) {
  20330. return;
  20331. }
  20332. let inbuf = 0,
  20333. outbuf = 0;
  20334. let inbits = 0,
  20335. outbits = 0;
  20336. let pos = bufferLength;
  20337. let i;
  20338. if (bits === 1 && colors === 1) {
  20339. for (i = 0; i < rowBytes; ++i) {
  20340. let c = rawBytes[i] ^ inbuf;
  20341. c ^= c >> 1;
  20342. c ^= c >> 2;
  20343. c ^= c >> 4;
  20344. inbuf = (c & 1) << 7;
  20345. buffer[pos++] = c;
  20346. }
  20347. } else if (bits === 8) {
  20348. for (i = 0; i < colors; ++i) {
  20349. buffer[pos++] = rawBytes[i];
  20350. }
  20351. for (; i < rowBytes; ++i) {
  20352. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  20353. pos++;
  20354. }
  20355. } else if (bits === 16) {
  20356. const bytesPerPixel = colors * 2;
  20357. for (i = 0; i < bytesPerPixel; ++i) {
  20358. buffer[pos++] = rawBytes[i];
  20359. }
  20360. for (; i < rowBytes; i += 2) {
  20361. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  20362. buffer[pos++] = sum >> 8 & 0xff;
  20363. buffer[pos++] = sum & 0xff;
  20364. }
  20365. } else {
  20366. const compArray = new Uint8Array(colors + 1);
  20367. const bitMask = (1 << bits) - 1;
  20368. let j = 0,
  20369. k = bufferLength;
  20370. const columns = this.columns;
  20371. for (i = 0; i < columns; ++i) {
  20372. for (let kk = 0; kk < colors; ++kk) {
  20373. if (inbits < bits) {
  20374. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  20375. inbits += 8;
  20376. }
  20377. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  20378. inbits -= bits;
  20379. outbuf = outbuf << bits | compArray[kk];
  20380. outbits += bits;
  20381. if (outbits >= 8) {
  20382. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  20383. outbits -= 8;
  20384. }
  20385. }
  20386. }
  20387. if (outbits > 0) {
  20388. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  20389. }
  20390. }
  20391. this.bufferLength += rowBytes;
  20392. }
  20393. readBlockPng() {
  20394. const rowBytes = this.rowBytes;
  20395. const pixBytes = this.pixBytes;
  20396. const predictor = this.str.getByte();
  20397. const rawBytes = this.str.getBytes(rowBytes);
  20398. this.eof = !rawBytes.length;
  20399. if (this.eof) {
  20400. return;
  20401. }
  20402. const bufferLength = this.bufferLength;
  20403. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20404. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  20405. if (prevRow.length === 0) {
  20406. prevRow = new Uint8Array(rowBytes);
  20407. }
  20408. let i,
  20409. j = bufferLength,
  20410. up,
  20411. c;
  20412. switch (predictor) {
  20413. case 0:
  20414. for (i = 0; i < rowBytes; ++i) {
  20415. buffer[j++] = rawBytes[i];
  20416. }
  20417. break;
  20418. case 1:
  20419. for (i = 0; i < pixBytes; ++i) {
  20420. buffer[j++] = rawBytes[i];
  20421. }
  20422. for (; i < rowBytes; ++i) {
  20423. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  20424. j++;
  20425. }
  20426. break;
  20427. case 2:
  20428. for (i = 0; i < rowBytes; ++i) {
  20429. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  20430. }
  20431. break;
  20432. case 3:
  20433. for (i = 0; i < pixBytes; ++i) {
  20434. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  20435. }
  20436. for (; i < rowBytes; ++i) {
  20437. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  20438. j++;
  20439. }
  20440. break;
  20441. case 4:
  20442. for (i = 0; i < pixBytes; ++i) {
  20443. up = prevRow[i];
  20444. c = rawBytes[i];
  20445. buffer[j++] = up + c;
  20446. }
  20447. for (; i < rowBytes; ++i) {
  20448. up = prevRow[i];
  20449. const upLeft = prevRow[i - pixBytes];
  20450. const left = buffer[j - pixBytes];
  20451. const p = left + up - upLeft;
  20452. let pa = p - left;
  20453. if (pa < 0) {
  20454. pa = -pa;
  20455. }
  20456. let pb = p - up;
  20457. if (pb < 0) {
  20458. pb = -pb;
  20459. }
  20460. let pc = p - upLeft;
  20461. if (pc < 0) {
  20462. pc = -pc;
  20463. }
  20464. c = rawBytes[i];
  20465. if (pa <= pb && pa <= pc) {
  20466. buffer[j++] = left + c;
  20467. } else if (pb <= pc) {
  20468. buffer[j++] = up + c;
  20469. } else {
  20470. buffer[j++] = upLeft + c;
  20471. }
  20472. }
  20473. break;
  20474. default:
  20475. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20476. }
  20477. this.bufferLength += rowBytes;
  20478. }
  20479. }
  20480. exports.PredictorStream = PredictorStream;
  20481. /***/ }),
  20482. /* 31 */
  20483. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20484. Object.defineProperty(exports, "__esModule", ({
  20485. value: true
  20486. }));
  20487. exports.RunLengthStream = void 0;
  20488. var _decode_stream = __w_pdfjs_require__(17);
  20489. class RunLengthStream extends _decode_stream.DecodeStream {
  20490. constructor(str, maybeLength) {
  20491. super(maybeLength);
  20492. this.str = str;
  20493. this.dict = str.dict;
  20494. }
  20495. readBlock() {
  20496. const repeatHeader = this.str.getBytes(2);
  20497. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  20498. this.eof = true;
  20499. return;
  20500. }
  20501. let buffer;
  20502. let bufferLength = this.bufferLength;
  20503. let n = repeatHeader[0];
  20504. if (n < 128) {
  20505. buffer = this.ensureBuffer(bufferLength + n + 1);
  20506. buffer[bufferLength++] = repeatHeader[1];
  20507. if (n > 0) {
  20508. const source = this.str.getBytes(n);
  20509. buffer.set(source, bufferLength);
  20510. bufferLength += n;
  20511. }
  20512. } else {
  20513. n = 257 - n;
  20514. const b = repeatHeader[1];
  20515. buffer = this.ensureBuffer(bufferLength + n + 1);
  20516. for (let i = 0; i < n; i++) {
  20517. buffer[bufferLength++] = b;
  20518. }
  20519. }
  20520. this.bufferLength = bufferLength;
  20521. }
  20522. }
  20523. exports.RunLengthStream = RunLengthStream;
  20524. /***/ }),
  20525. /* 32 */
  20526. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20527. Object.defineProperty(exports, "__esModule", ({
  20528. value: true
  20529. }));
  20530. exports.Font = exports.ErrorFont = void 0;
  20531. var _util = __w_pdfjs_require__(2);
  20532. var _cff_parser = __w_pdfjs_require__(33);
  20533. var _fonts_utils = __w_pdfjs_require__(36);
  20534. var _unicode = __w_pdfjs_require__(38);
  20535. var _glyphlist = __w_pdfjs_require__(37);
  20536. var _encodings = __w_pdfjs_require__(35);
  20537. var _standard_fonts = __w_pdfjs_require__(39);
  20538. var _to_unicode_map = __w_pdfjs_require__(40);
  20539. var _cff_font = __w_pdfjs_require__(41);
  20540. var _font_renderer = __w_pdfjs_require__(42);
  20541. var _metrics = __w_pdfjs_require__(43);
  20542. var _glyf = __w_pdfjs_require__(44);
  20543. var _cmap = __w_pdfjs_require__(14);
  20544. var _opentype_file_builder = __w_pdfjs_require__(45);
  20545. var _core_utils = __w_pdfjs_require__(4);
  20546. var _stream = __w_pdfjs_require__(8);
  20547. var _type1_font = __w_pdfjs_require__(46);
  20548. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20549. const PDF_GLYPH_SPACE_UNITS = 1000;
  20550. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  20551. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20552. function adjustWidths(properties) {
  20553. if (!properties.fontMatrix) {
  20554. return;
  20555. }
  20556. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20557. return;
  20558. }
  20559. const scale = 0.001 / properties.fontMatrix[0];
  20560. const glyphsWidths = properties.widths;
  20561. for (const glyph in glyphsWidths) {
  20562. glyphsWidths[glyph] *= scale;
  20563. }
  20564. properties.defaultWidth *= scale;
  20565. }
  20566. function adjustToUnicode(properties, builtInEncoding) {
  20567. if (properties.isInternalFont) {
  20568. return;
  20569. }
  20570. if (properties.hasIncludedToUnicodeMap) {
  20571. return;
  20572. }
  20573. if (builtInEncoding === properties.defaultEncoding) {
  20574. return;
  20575. }
  20576. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20577. return;
  20578. }
  20579. const toUnicode = [],
  20580. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20581. for (const charCode in builtInEncoding) {
  20582. if (properties.hasEncoding) {
  20583. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  20584. continue;
  20585. }
  20586. }
  20587. const glyphName = builtInEncoding[charCode];
  20588. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20589. if (unicode !== -1) {
  20590. toUnicode[charCode] = String.fromCharCode(unicode);
  20591. }
  20592. }
  20593. if (toUnicode.length > 0) {
  20594. properties.toUnicode.amend(toUnicode);
  20595. }
  20596. }
  20597. function amendFallbackToUnicode(properties) {
  20598. if (!properties.fallbackToUnicode) {
  20599. return;
  20600. }
  20601. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20602. return;
  20603. }
  20604. const toUnicode = [];
  20605. for (const charCode in properties.fallbackToUnicode) {
  20606. if (properties.toUnicode.has(charCode)) {
  20607. continue;
  20608. }
  20609. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  20610. }
  20611. if (toUnicode.length > 0) {
  20612. properties.toUnicode.amend(toUnicode);
  20613. }
  20614. }
  20615. class Glyph {
  20616. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20617. this.originalCharCode = originalCharCode;
  20618. this.fontChar = fontChar;
  20619. this.unicode = unicode;
  20620. this.accent = accent;
  20621. this.width = width;
  20622. this.vmetric = vmetric;
  20623. this.operatorListId = operatorListId;
  20624. this.isSpace = isSpace;
  20625. this.isInFont = isInFont;
  20626. }
  20627. get category() {
  20628. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  20629. }
  20630. get normalizedUnicode() {
  20631. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  20632. }
  20633. static get _NormalizedUnicodes() {
  20634. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  20635. }
  20636. }
  20637. function int16(b0, b1) {
  20638. return (b0 << 8) + b1;
  20639. }
  20640. function writeSignedInt16(bytes, index, value) {
  20641. bytes[index + 1] = value;
  20642. bytes[index] = value >>> 8;
  20643. }
  20644. function signedInt16(b0, b1) {
  20645. const value = (b0 << 8) + b1;
  20646. return value & 1 << 15 ? value - 0x10000 : value;
  20647. }
  20648. function int32(b0, b1, b2, b3) {
  20649. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20650. }
  20651. function string16(value) {
  20652. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20653. }
  20654. function safeString16(value) {
  20655. if (value > 0x7fff) {
  20656. value = 0x7fff;
  20657. } else if (value < -0x8000) {
  20658. value = -0x8000;
  20659. }
  20660. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20661. }
  20662. function isTrueTypeFile(file) {
  20663. const header = file.peekBytes(4);
  20664. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20665. }
  20666. function isTrueTypeCollectionFile(file) {
  20667. const header = file.peekBytes(4);
  20668. return (0, _util.bytesToString)(header) === "ttcf";
  20669. }
  20670. function isOpenTypeFile(file) {
  20671. const header = file.peekBytes(4);
  20672. return (0, _util.bytesToString)(header) === "OTTO";
  20673. }
  20674. function isType1File(file) {
  20675. const header = file.peekBytes(2);
  20676. if (header[0] === 0x25 && header[1] === 0x21) {
  20677. return true;
  20678. }
  20679. if (header[0] === 0x80 && header[1] === 0x01) {
  20680. return true;
  20681. }
  20682. return false;
  20683. }
  20684. function isCFFFile(file) {
  20685. const header = file.peekBytes(4);
  20686. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20687. return true;
  20688. }
  20689. return false;
  20690. }
  20691. function getFontFileType(file, {
  20692. type,
  20693. subtype,
  20694. composite
  20695. }) {
  20696. let fileType, fileSubtype;
  20697. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20698. if (composite) {
  20699. fileType = "CIDFontType2";
  20700. } else {
  20701. fileType = "TrueType";
  20702. }
  20703. } else if (isOpenTypeFile(file)) {
  20704. if (composite) {
  20705. fileType = "CIDFontType2";
  20706. } else {
  20707. fileType = "OpenType";
  20708. }
  20709. } else if (isType1File(file)) {
  20710. if (composite) {
  20711. fileType = "CIDFontType0";
  20712. } else {
  20713. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20714. }
  20715. } else if (isCFFFile(file)) {
  20716. if (composite) {
  20717. fileType = "CIDFontType0";
  20718. fileSubtype = "CIDFontType0C";
  20719. } else {
  20720. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20721. fileSubtype = "Type1C";
  20722. }
  20723. } else {
  20724. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20725. fileType = type;
  20726. fileSubtype = subtype;
  20727. }
  20728. return [fileType, fileSubtype];
  20729. }
  20730. function applyStandardFontGlyphMap(map, glyphMap) {
  20731. for (const charCode in glyphMap) {
  20732. map[+charCode] = glyphMap[charCode];
  20733. }
  20734. }
  20735. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20736. const toFontChar = [];
  20737. let unicode;
  20738. for (let i = 0, ii = encoding.length; i < ii; i++) {
  20739. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20740. if (unicode !== -1) {
  20741. toFontChar[i] = unicode;
  20742. }
  20743. }
  20744. for (const charCode in differences) {
  20745. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20746. if (unicode !== -1) {
  20747. toFontChar[+charCode] = unicode;
  20748. }
  20749. }
  20750. return toFontChar;
  20751. }
  20752. function convertCidString(charCode, cid, shouldThrow = false) {
  20753. switch (cid.length) {
  20754. case 1:
  20755. return cid.charCodeAt(0);
  20756. case 2:
  20757. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  20758. }
  20759. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  20760. if (shouldThrow) {
  20761. throw new _util.FormatError(msg);
  20762. }
  20763. (0, _util.warn)(msg);
  20764. return cid;
  20765. }
  20766. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  20767. const newMap = Object.create(null);
  20768. const toUnicodeExtraMap = new Map();
  20769. const toFontChar = [];
  20770. const usedGlyphIds = new Set();
  20771. let privateUseAreaIndex = 0;
  20772. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20773. let nextAvailableFontCharCode = privateUseOffetStart;
  20774. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20775. for (let originalCharCode in charCodeToGlyphId) {
  20776. originalCharCode |= 0;
  20777. let glyphId = charCodeToGlyphId[originalCharCode];
  20778. if (!hasGlyph(glyphId)) {
  20779. continue;
  20780. }
  20781. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20782. privateUseAreaIndex++;
  20783. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20784. (0, _util.warn)("Ran out of space in font private use area.");
  20785. break;
  20786. }
  20787. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20788. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20789. }
  20790. const fontCharCode = nextAvailableFontCharCode++;
  20791. if (glyphId === 0) {
  20792. glyphId = newGlyphZeroId;
  20793. }
  20794. let unicode = toUnicode.get(originalCharCode);
  20795. if (typeof unicode === "string") {
  20796. unicode = unicode.codePointAt(0);
  20797. }
  20798. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  20799. toUnicodeExtraMap.set(unicode, glyphId);
  20800. usedGlyphIds.add(glyphId);
  20801. }
  20802. newMap[fontCharCode] = glyphId;
  20803. toFontChar[originalCharCode] = fontCharCode;
  20804. }
  20805. return {
  20806. toFontChar,
  20807. charCodeToGlyphId: newMap,
  20808. toUnicodeExtraMap,
  20809. nextAvailableFontCharCode
  20810. };
  20811. }
  20812. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  20813. const codes = [];
  20814. for (const charCode in glyphs) {
  20815. if (glyphs[charCode] >= numGlyphs) {
  20816. continue;
  20817. }
  20818. codes.push({
  20819. fontCharCode: charCode | 0,
  20820. glyphId: glyphs[charCode]
  20821. });
  20822. }
  20823. if (toUnicodeExtraMap) {
  20824. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  20825. if (glyphId >= numGlyphs) {
  20826. continue;
  20827. }
  20828. codes.push({
  20829. fontCharCode: unicode,
  20830. glyphId
  20831. });
  20832. }
  20833. }
  20834. if (codes.length === 0) {
  20835. codes.push({
  20836. fontCharCode: 0,
  20837. glyphId: 0
  20838. });
  20839. }
  20840. codes.sort(function fontGetRangesSort(a, b) {
  20841. return a.fontCharCode - b.fontCharCode;
  20842. });
  20843. const ranges = [];
  20844. const length = codes.length;
  20845. for (let n = 0; n < length;) {
  20846. const start = codes[n].fontCharCode;
  20847. const codeIndices = [codes[n].glyphId];
  20848. ++n;
  20849. let end = start;
  20850. while (n < length && end + 1 === codes[n].fontCharCode) {
  20851. codeIndices.push(codes[n].glyphId);
  20852. ++end;
  20853. ++n;
  20854. if (end === 0xffff) {
  20855. break;
  20856. }
  20857. }
  20858. ranges.push([start, end, codeIndices]);
  20859. }
  20860. return ranges;
  20861. }
  20862. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  20863. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  20864. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  20865. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20866. let i, ii, j, jj;
  20867. for (i = ranges.length - 1; i >= 0; --i) {
  20868. if (ranges[i][0] <= 0xffff) {
  20869. break;
  20870. }
  20871. }
  20872. const bmpLength = i + 1;
  20873. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20874. ranges[i][1] = 0xfffe;
  20875. }
  20876. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20877. const segCount = bmpLength + trailingRangesCount;
  20878. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20879. let startCount = "";
  20880. let endCount = "";
  20881. let idDeltas = "";
  20882. let idRangeOffsets = "";
  20883. let glyphsIds = "";
  20884. let bias = 0;
  20885. let range, start, end, codes;
  20886. for (i = 0, ii = bmpLength; i < ii; i++) {
  20887. range = ranges[i];
  20888. start = range[0];
  20889. end = range[1];
  20890. startCount += string16(start);
  20891. endCount += string16(end);
  20892. codes = range[2];
  20893. let contiguous = true;
  20894. for (j = 1, jj = codes.length; j < jj; ++j) {
  20895. if (codes[j] !== codes[j - 1] + 1) {
  20896. contiguous = false;
  20897. break;
  20898. }
  20899. }
  20900. if (!contiguous) {
  20901. const offset = (segCount - i) * 2 + bias * 2;
  20902. bias += end - start + 1;
  20903. idDeltas += string16(0);
  20904. idRangeOffsets += string16(offset);
  20905. for (j = 0, jj = codes.length; j < jj; ++j) {
  20906. glyphsIds += string16(codes[j]);
  20907. }
  20908. } else {
  20909. const startCode = codes[0];
  20910. idDeltas += string16(startCode - start & 0xffff);
  20911. idRangeOffsets += string16(0);
  20912. }
  20913. }
  20914. if (trailingRangesCount > 0) {
  20915. endCount += "\xFF\xFF";
  20916. startCount += "\xFF\xFF";
  20917. idDeltas += "\x00\x01";
  20918. idRangeOffsets += "\x00\x00";
  20919. }
  20920. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20921. let format31012 = "";
  20922. let header31012 = "";
  20923. if (numTables > 1) {
  20924. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20925. format31012 = "";
  20926. for (i = 0, ii = ranges.length; i < ii; i++) {
  20927. range = ranges[i];
  20928. start = range[0];
  20929. codes = range[2];
  20930. let code = codes[0];
  20931. for (j = 1, jj = codes.length; j < jj; ++j) {
  20932. if (codes[j] !== codes[j - 1] + 1) {
  20933. end = range[0] + j - 1;
  20934. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20935. start = end + 1;
  20936. code = codes[j];
  20937. }
  20938. }
  20939. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20940. }
  20941. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20942. }
  20943. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20944. }
  20945. function validateOS2Table(os2, file) {
  20946. file.pos = (file.start || 0) + os2.offset;
  20947. const version = file.getUint16();
  20948. file.skip(60);
  20949. const selection = file.getUint16();
  20950. if (version < 4 && selection & 0x0300) {
  20951. return false;
  20952. }
  20953. const firstChar = file.getUint16();
  20954. const lastChar = file.getUint16();
  20955. if (firstChar > lastChar) {
  20956. return false;
  20957. }
  20958. file.skip(6);
  20959. const usWinAscent = file.getUint16();
  20960. if (usWinAscent === 0) {
  20961. return false;
  20962. }
  20963. os2.data[8] = os2.data[9] = 0;
  20964. return true;
  20965. }
  20966. function createOS2Table(properties, charstrings, override) {
  20967. override = override || {
  20968. unitsPerEm: 0,
  20969. yMax: 0,
  20970. yMin: 0,
  20971. ascent: 0,
  20972. descent: 0
  20973. };
  20974. let ulUnicodeRange1 = 0;
  20975. let ulUnicodeRange2 = 0;
  20976. let ulUnicodeRange3 = 0;
  20977. let ulUnicodeRange4 = 0;
  20978. let firstCharIndex = null;
  20979. let lastCharIndex = 0;
  20980. if (charstrings) {
  20981. for (let code in charstrings) {
  20982. code |= 0;
  20983. if (firstCharIndex > code || !firstCharIndex) {
  20984. firstCharIndex = code;
  20985. }
  20986. if (lastCharIndex < code) {
  20987. lastCharIndex = code;
  20988. }
  20989. const position = (0, _unicode.getUnicodeRangeFor)(code);
  20990. if (position < 32) {
  20991. ulUnicodeRange1 |= 1 << position;
  20992. } else if (position < 64) {
  20993. ulUnicodeRange2 |= 1 << position - 32;
  20994. } else if (position < 96) {
  20995. ulUnicodeRange3 |= 1 << position - 64;
  20996. } else if (position < 123) {
  20997. ulUnicodeRange4 |= 1 << position - 96;
  20998. } else {
  20999. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  21000. }
  21001. }
  21002. if (lastCharIndex > 0xffff) {
  21003. lastCharIndex = 0xffff;
  21004. }
  21005. } else {
  21006. firstCharIndex = 0;
  21007. lastCharIndex = 255;
  21008. }
  21009. const bbox = properties.bbox || [0, 0, 0, 0];
  21010. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  21011. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  21012. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  21013. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  21014. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  21015. typoDescent = -typoDescent;
  21016. }
  21017. const winAscent = override.yMax || typoAscent;
  21018. const winDescent = -override.yMin || -typoDescent;
  21019. 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";
  21020. }
  21021. function createPostTable(properties) {
  21022. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  21023. 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";
  21024. }
  21025. function createPostscriptName(name) {
  21026. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  21027. }
  21028. function createNameTable(name, proto) {
  21029. if (!proto) {
  21030. proto = [[], []];
  21031. }
  21032. 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"];
  21033. const stringsUnicode = [];
  21034. let i, ii, j, jj, str;
  21035. for (i = 0, ii = strings.length; i < ii; i++) {
  21036. str = proto[1][i] || strings[i];
  21037. const strBufUnicode = [];
  21038. for (j = 0, jj = str.length; j < jj; j++) {
  21039. strBufUnicode.push(string16(str.charCodeAt(j)));
  21040. }
  21041. stringsUnicode.push(strBufUnicode.join(""));
  21042. }
  21043. const names = [strings, stringsUnicode];
  21044. const platforms = ["\x00\x01", "\x00\x03"];
  21045. const encodings = ["\x00\x00", "\x00\x01"];
  21046. const languages = ["\x00\x00", "\x04\x09"];
  21047. const namesRecordCount = strings.length * platforms.length;
  21048. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  21049. let strOffset = 0;
  21050. for (i = 0, ii = platforms.length; i < ii; i++) {
  21051. const strs = names[i];
  21052. for (j = 0, jj = strs.length; j < jj; j++) {
  21053. str = strs[j];
  21054. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  21055. nameTable += nameRecord;
  21056. strOffset += str.length;
  21057. }
  21058. }
  21059. nameTable += strings.join("") + stringsUnicode.join("");
  21060. return nameTable;
  21061. }
  21062. class Font {
  21063. constructor(name, file, properties) {
  21064. this.name = name;
  21065. this.psName = null;
  21066. this.mimetype = null;
  21067. this.disableFontFace = false;
  21068. this.loadedName = properties.loadedName;
  21069. this.isType3Font = properties.isType3Font;
  21070. this.missingFile = false;
  21071. this.cssFontInfo = properties.cssFontInfo;
  21072. this._charsCache = Object.create(null);
  21073. this._glyphCache = Object.create(null);
  21074. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  21075. if (!isSerifFont && !properties.isSimulatedFlags) {
  21076. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  21077. serifFonts = (0, _standard_fonts.getSerifFonts)();
  21078. for (const namePart of baseName.split("+")) {
  21079. if (serifFonts[namePart]) {
  21080. isSerifFont = true;
  21081. break;
  21082. }
  21083. }
  21084. }
  21085. this.isSerifFont = isSerifFont;
  21086. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  21087. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  21088. let type = properties.type;
  21089. let subtype = properties.subtype;
  21090. this.type = type;
  21091. this.subtype = subtype;
  21092. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  21093. this.isInvalidPDFjsFont = !!matches;
  21094. if (this.isInvalidPDFjsFont) {
  21095. this.fallbackName = matches[1];
  21096. } else if (this.isMonospace) {
  21097. this.fallbackName = "monospace";
  21098. } else if (this.isSerifFont) {
  21099. this.fallbackName = "serif";
  21100. } else {
  21101. this.fallbackName = "sans-serif";
  21102. }
  21103. this.differences = properties.differences;
  21104. this.widths = properties.widths;
  21105. this.defaultWidth = properties.defaultWidth;
  21106. this.composite = properties.composite;
  21107. this.cMap = properties.cMap;
  21108. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  21109. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  21110. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  21111. this.lineHeight = this.ascent - this.descent;
  21112. this.fontMatrix = properties.fontMatrix;
  21113. this.bbox = properties.bbox;
  21114. this.defaultEncoding = properties.defaultEncoding;
  21115. this.toUnicode = properties.toUnicode;
  21116. this.toFontChar = [];
  21117. if (properties.type === "Type3") {
  21118. for (let charCode = 0; charCode < 256; charCode++) {
  21119. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  21120. }
  21121. this.fontType = _util.FontType.TYPE3;
  21122. return;
  21123. }
  21124. this.cidEncoding = properties.cidEncoding || "";
  21125. this.vertical = !!properties.vertical;
  21126. if (this.vertical) {
  21127. this.vmetrics = properties.vmetrics;
  21128. this.defaultVMetrics = properties.defaultVMetrics;
  21129. }
  21130. if (!file || file.isEmpty) {
  21131. if (file) {
  21132. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  21133. }
  21134. this.fallbackToSystemFont(properties);
  21135. return;
  21136. }
  21137. [type, subtype] = getFontFileType(file, properties);
  21138. if (type !== this.type || subtype !== this.subtype) {
  21139. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  21140. }
  21141. let data;
  21142. try {
  21143. switch (type) {
  21144. case "MMType1":
  21145. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  21146. case "Type1":
  21147. case "CIDFontType0":
  21148. this.mimetype = "font/opentype";
  21149. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  21150. adjustWidths(properties);
  21151. data = this.convert(name, cff, properties);
  21152. break;
  21153. case "OpenType":
  21154. case "TrueType":
  21155. case "CIDFontType2":
  21156. this.mimetype = "font/opentype";
  21157. data = this.checkAndRepair(name, file, properties);
  21158. if (this.isOpenType) {
  21159. adjustWidths(properties);
  21160. type = "OpenType";
  21161. }
  21162. break;
  21163. default:
  21164. throw new _util.FormatError(`Font ${type} is not supported`);
  21165. }
  21166. } catch (e) {
  21167. (0, _util.warn)(e);
  21168. this.fallbackToSystemFont(properties);
  21169. return;
  21170. }
  21171. amendFallbackToUnicode(properties);
  21172. this.data = data;
  21173. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  21174. this.fontMatrix = properties.fontMatrix;
  21175. this.widths = properties.widths;
  21176. this.defaultWidth = properties.defaultWidth;
  21177. this.toUnicode = properties.toUnicode;
  21178. this.seacMap = properties.seacMap;
  21179. }
  21180. get renderer() {
  21181. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  21182. return (0, _util.shadow)(this, "renderer", renderer);
  21183. }
  21184. exportData(extraProperties = false) {
  21185. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  21186. const data = Object.create(null);
  21187. let property, value;
  21188. for (property of exportDataProperties) {
  21189. value = this[property];
  21190. if (value !== undefined) {
  21191. data[property] = value;
  21192. }
  21193. }
  21194. return data;
  21195. }
  21196. fallbackToSystemFont(properties) {
  21197. this.missingFile = true;
  21198. const name = this.name;
  21199. const type = this.type;
  21200. const subtype = this.subtype;
  21201. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  21202. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  21203. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  21204. const isStandardFont = !!stdFontMap[fontName];
  21205. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  21206. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  21207. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  21208. const metrics = fontBasicMetricsMap[fontName];
  21209. if (metrics) {
  21210. if (isNaN(this.ascent)) {
  21211. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  21212. }
  21213. if (isNaN(this.descent)) {
  21214. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  21215. }
  21216. if (isNaN(this.capHeight)) {
  21217. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  21218. }
  21219. }
  21220. this.bold = /bold/gi.test(fontName);
  21221. this.italic = /oblique|italic/gi.test(fontName);
  21222. this.black = /Black/g.test(name);
  21223. const isNarrow = /Narrow/g.test(name);
  21224. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  21225. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  21226. const cidToGidMap = properties.cidToGidMap;
  21227. const map = [];
  21228. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21229. if (/Arial-?Black/i.test(name)) {
  21230. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  21231. } else if (/Calibri/i.test(name)) {
  21232. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  21233. }
  21234. if (cidToGidMap) {
  21235. for (const charCode in map) {
  21236. const cid = map[charCode];
  21237. if (cidToGidMap[cid] !== undefined) {
  21238. map[+charCode] = cidToGidMap[cid];
  21239. }
  21240. }
  21241. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21242. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21243. const cid = map[charCode];
  21244. if (cidToGidMap[cid] === undefined) {
  21245. map[+charCode] = unicodeCharCode;
  21246. }
  21247. });
  21248. }
  21249. }
  21250. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21251. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21252. map[+charCode] = unicodeCharCode;
  21253. });
  21254. }
  21255. this.toFontChar = map;
  21256. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  21257. } else if (/Symbol/i.test(fontName)) {
  21258. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21259. } else if (/Dingbats/i.test(fontName)) {
  21260. if (/Wingdings/i.test(name)) {
  21261. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  21262. }
  21263. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  21264. } else if (isStandardFont) {
  21265. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21266. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21267. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21268. map[+charCode] = unicodeCharCode;
  21269. });
  21270. }
  21271. this.toFontChar = map;
  21272. } else {
  21273. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21274. const map = [];
  21275. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  21276. if (!this.composite) {
  21277. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  21278. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  21279. if (unicode !== -1) {
  21280. unicodeCharCode = unicode;
  21281. }
  21282. }
  21283. map[+charCode] = unicodeCharCode;
  21284. });
  21285. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21286. if (/Tahoma|Verdana/i.test(name)) {
  21287. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21288. }
  21289. }
  21290. this.toFontChar = map;
  21291. }
  21292. amendFallbackToUnicode(properties);
  21293. this.loadedName = fontName.split("-")[0];
  21294. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  21295. }
  21296. checkAndRepair(name, font, properties) {
  21297. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  21298. function readTables(file, numTables) {
  21299. const tables = Object.create(null);
  21300. tables["OS/2"] = null;
  21301. tables.cmap = null;
  21302. tables.head = null;
  21303. tables.hhea = null;
  21304. tables.hmtx = null;
  21305. tables.maxp = null;
  21306. tables.name = null;
  21307. tables.post = null;
  21308. for (let i = 0; i < numTables; i++) {
  21309. const table = readTableEntry(file);
  21310. if (!VALID_TABLES.includes(table.tag)) {
  21311. continue;
  21312. }
  21313. if (table.length === 0) {
  21314. continue;
  21315. }
  21316. tables[table.tag] = table;
  21317. }
  21318. return tables;
  21319. }
  21320. function readTableEntry(file) {
  21321. const tag = file.getString(4);
  21322. const checksum = file.getInt32() >>> 0;
  21323. const offset = file.getInt32() >>> 0;
  21324. const length = file.getInt32() >>> 0;
  21325. const previousPosition = file.pos;
  21326. file.pos = file.start || 0;
  21327. file.skip(offset);
  21328. const data = file.getBytes(length);
  21329. file.pos = previousPosition;
  21330. if (tag === "head") {
  21331. data[8] = data[9] = data[10] = data[11] = 0;
  21332. data[17] |= 0x20;
  21333. }
  21334. return {
  21335. tag,
  21336. checksum,
  21337. length,
  21338. offset,
  21339. data
  21340. };
  21341. }
  21342. function readOpenTypeHeader(ttf) {
  21343. return {
  21344. version: ttf.getString(4),
  21345. numTables: ttf.getUint16(),
  21346. searchRange: ttf.getUint16(),
  21347. entrySelector: ttf.getUint16(),
  21348. rangeShift: ttf.getUint16()
  21349. };
  21350. }
  21351. function readTrueTypeCollectionHeader(ttc) {
  21352. const ttcTag = ttc.getString(4);
  21353. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  21354. const majorVersion = ttc.getUint16();
  21355. const minorVersion = ttc.getUint16();
  21356. const numFonts = ttc.getInt32() >>> 0;
  21357. const offsetTable = [];
  21358. for (let i = 0; i < numFonts; i++) {
  21359. offsetTable.push(ttc.getInt32() >>> 0);
  21360. }
  21361. const header = {
  21362. ttcTag,
  21363. majorVersion,
  21364. minorVersion,
  21365. numFonts,
  21366. offsetTable
  21367. };
  21368. switch (majorVersion) {
  21369. case 1:
  21370. return header;
  21371. case 2:
  21372. header.dsigTag = ttc.getInt32() >>> 0;
  21373. header.dsigLength = ttc.getInt32() >>> 0;
  21374. header.dsigOffset = ttc.getInt32() >>> 0;
  21375. return header;
  21376. }
  21377. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  21378. }
  21379. function readTrueTypeCollectionData(ttc, fontName) {
  21380. const {
  21381. numFonts,
  21382. offsetTable
  21383. } = readTrueTypeCollectionHeader(ttc);
  21384. const fontNameParts = fontName.split("+");
  21385. let fallbackData;
  21386. for (let i = 0; i < numFonts; i++) {
  21387. ttc.pos = (ttc.start || 0) + offsetTable[i];
  21388. const potentialHeader = readOpenTypeHeader(ttc);
  21389. const potentialTables = readTables(ttc, potentialHeader.numTables);
  21390. if (!potentialTables.name) {
  21391. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  21392. }
  21393. const nameTable = readNameTable(potentialTables.name);
  21394. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  21395. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  21396. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  21397. if (!nameEntry) {
  21398. continue;
  21399. }
  21400. if (nameEntry === fontName) {
  21401. return {
  21402. header: potentialHeader,
  21403. tables: potentialTables
  21404. };
  21405. }
  21406. if (fontNameParts.length < 2) {
  21407. continue;
  21408. }
  21409. for (const part of fontNameParts) {
  21410. if (nameEntry === part) {
  21411. fallbackData = {
  21412. name: part,
  21413. header: potentialHeader,
  21414. tables: potentialTables
  21415. };
  21416. }
  21417. }
  21418. }
  21419. }
  21420. }
  21421. if (fallbackData) {
  21422. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  21423. return {
  21424. header: fallbackData.header,
  21425. tables: fallbackData.tables
  21426. };
  21427. }
  21428. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  21429. }
  21430. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  21431. if (!cmap) {
  21432. (0, _util.warn)("No cmap table available.");
  21433. return {
  21434. platformId: -1,
  21435. encodingId: -1,
  21436. mappings: [],
  21437. hasShortCmap: false
  21438. };
  21439. }
  21440. let segment;
  21441. let start = (file.start || 0) + cmap.offset;
  21442. file.pos = start;
  21443. file.skip(2);
  21444. const numTables = file.getUint16();
  21445. let potentialTable;
  21446. let canBreak = false;
  21447. for (let i = 0; i < numTables; i++) {
  21448. const platformId = file.getUint16();
  21449. const encodingId = file.getUint16();
  21450. const offset = file.getInt32() >>> 0;
  21451. let useTable = false;
  21452. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21453. continue;
  21454. }
  21455. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  21456. useTable = true;
  21457. } else if (platformId === 1 && encodingId === 0) {
  21458. useTable = true;
  21459. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21460. useTable = true;
  21461. if (!isSymbolicFont) {
  21462. canBreak = true;
  21463. }
  21464. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21465. useTable = true;
  21466. let correctlySorted = true;
  21467. if (i < numTables - 1) {
  21468. const nextBytes = file.peekBytes(2),
  21469. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  21470. if (nextPlatformId < platformId) {
  21471. correctlySorted = false;
  21472. }
  21473. }
  21474. if (correctlySorted) {
  21475. canBreak = true;
  21476. }
  21477. }
  21478. if (useTable) {
  21479. potentialTable = {
  21480. platformId,
  21481. encodingId,
  21482. offset
  21483. };
  21484. }
  21485. if (canBreak) {
  21486. break;
  21487. }
  21488. }
  21489. if (potentialTable) {
  21490. file.pos = start + potentialTable.offset;
  21491. }
  21492. if (!potentialTable || file.peekByte() === -1) {
  21493. (0, _util.warn)("Could not find a preferred cmap table.");
  21494. return {
  21495. platformId: -1,
  21496. encodingId: -1,
  21497. mappings: [],
  21498. hasShortCmap: false
  21499. };
  21500. }
  21501. const format = file.getUint16();
  21502. let hasShortCmap = false;
  21503. const mappings = [];
  21504. let j, glyphId;
  21505. if (format === 0) {
  21506. file.skip(2 + 2);
  21507. for (j = 0; j < 256; j++) {
  21508. const index = file.getByte();
  21509. if (!index) {
  21510. continue;
  21511. }
  21512. mappings.push({
  21513. charCode: j,
  21514. glyphId: index
  21515. });
  21516. }
  21517. hasShortCmap = true;
  21518. } else if (format === 2) {
  21519. file.skip(2 + 2);
  21520. const subHeaderKeys = [];
  21521. let maxSubHeaderKey = 0;
  21522. for (let i = 0; i < 256; i++) {
  21523. const subHeaderKey = file.getUint16() >> 3;
  21524. subHeaderKeys.push(subHeaderKey);
  21525. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  21526. }
  21527. const subHeaders = [];
  21528. for (let i = 0; i <= maxSubHeaderKey; i++) {
  21529. subHeaders.push({
  21530. firstCode: file.getUint16(),
  21531. entryCount: file.getUint16(),
  21532. idDelta: signedInt16(file.getByte(), file.getByte()),
  21533. idRangePos: file.pos + file.getUint16()
  21534. });
  21535. }
  21536. for (let i = 0; i < 256; i++) {
  21537. if (subHeaderKeys[i] === 0) {
  21538. file.pos = subHeaders[0].idRangePos + 2 * i;
  21539. glyphId = file.getUint16();
  21540. mappings.push({
  21541. charCode: i,
  21542. glyphId
  21543. });
  21544. } else {
  21545. const s = subHeaders[subHeaderKeys[i]];
  21546. for (j = 0; j < s.entryCount; j++) {
  21547. const charCode = (i << 8) + j + s.firstCode;
  21548. file.pos = s.idRangePos + 2 * j;
  21549. glyphId = file.getUint16();
  21550. if (glyphId !== 0) {
  21551. glyphId = (glyphId + s.idDelta) % 65536;
  21552. }
  21553. mappings.push({
  21554. charCode,
  21555. glyphId
  21556. });
  21557. }
  21558. }
  21559. }
  21560. } else if (format === 4) {
  21561. file.skip(2 + 2);
  21562. const segCount = file.getUint16() >> 1;
  21563. file.skip(6);
  21564. const segments = [];
  21565. let segIndex;
  21566. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21567. segments.push({
  21568. end: file.getUint16()
  21569. });
  21570. }
  21571. file.skip(2);
  21572. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21573. segments[segIndex].start = file.getUint16();
  21574. }
  21575. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21576. segments[segIndex].delta = file.getUint16();
  21577. }
  21578. let offsetsCount = 0,
  21579. offsetIndex;
  21580. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21581. segment = segments[segIndex];
  21582. const rangeOffset = file.getUint16();
  21583. if (!rangeOffset) {
  21584. segment.offsetIndex = -1;
  21585. continue;
  21586. }
  21587. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21588. segment.offsetIndex = offsetIndex;
  21589. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21590. }
  21591. const offsets = [];
  21592. for (j = 0; j < offsetsCount; j++) {
  21593. offsets.push(file.getUint16());
  21594. }
  21595. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21596. segment = segments[segIndex];
  21597. start = segment.start;
  21598. const end = segment.end;
  21599. const delta = segment.delta;
  21600. offsetIndex = segment.offsetIndex;
  21601. for (j = start; j <= end; j++) {
  21602. if (j === 0xffff) {
  21603. continue;
  21604. }
  21605. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21606. glyphId = glyphId + delta & 0xffff;
  21607. mappings.push({
  21608. charCode: j,
  21609. glyphId
  21610. });
  21611. }
  21612. }
  21613. } else if (format === 6) {
  21614. file.skip(2 + 2);
  21615. const firstCode = file.getUint16();
  21616. const entryCount = file.getUint16();
  21617. for (j = 0; j < entryCount; j++) {
  21618. glyphId = file.getUint16();
  21619. const charCode = firstCode + j;
  21620. mappings.push({
  21621. charCode,
  21622. glyphId
  21623. });
  21624. }
  21625. } else if (format === 12) {
  21626. file.skip(2 + 4 + 4);
  21627. const nGroups = file.getInt32() >>> 0;
  21628. for (j = 0; j < nGroups; j++) {
  21629. const startCharCode = file.getInt32() >>> 0;
  21630. const endCharCode = file.getInt32() >>> 0;
  21631. let glyphCode = file.getInt32() >>> 0;
  21632. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  21633. mappings.push({
  21634. charCode,
  21635. glyphId: glyphCode++
  21636. });
  21637. }
  21638. }
  21639. } else {
  21640. (0, _util.warn)("cmap table has unsupported format: " + format);
  21641. return {
  21642. platformId: -1,
  21643. encodingId: -1,
  21644. mappings: [],
  21645. hasShortCmap: false
  21646. };
  21647. }
  21648. mappings.sort(function (a, b) {
  21649. return a.charCode - b.charCode;
  21650. });
  21651. for (let i = 1; i < mappings.length; i++) {
  21652. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21653. mappings.splice(i, 1);
  21654. i--;
  21655. }
  21656. }
  21657. return {
  21658. platformId: potentialTable.platformId,
  21659. encodingId: potentialTable.encodingId,
  21660. mappings,
  21661. hasShortCmap
  21662. };
  21663. }
  21664. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  21665. if (!header) {
  21666. if (metrics) {
  21667. metrics.data = null;
  21668. }
  21669. return;
  21670. }
  21671. file.pos = (file.start || 0) + header.offset;
  21672. file.pos += 4;
  21673. file.pos += 2;
  21674. file.pos += 2;
  21675. file.pos += 2;
  21676. file.pos += 2;
  21677. file.pos += 2;
  21678. file.pos += 2;
  21679. file.pos += 2;
  21680. file.pos += 2;
  21681. file.pos += 2;
  21682. const caretOffset = file.getUint16();
  21683. file.pos += 8;
  21684. file.pos += 2;
  21685. let numOfMetrics = file.getUint16();
  21686. if (caretOffset !== 0) {
  21687. const macStyle = int16(headTable.data[44], headTable.data[45]);
  21688. if (!(macStyle & 2)) {
  21689. header.data[22] = 0;
  21690. header.data[23] = 0;
  21691. }
  21692. }
  21693. if (numOfMetrics > numGlyphs) {
  21694. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  21695. numOfMetrics = numGlyphs;
  21696. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21697. header.data[35] = numOfMetrics & 0x00ff;
  21698. }
  21699. const numOfSidebearings = numGlyphs - numOfMetrics;
  21700. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21701. if (numMissing > 0) {
  21702. const entries = new Uint8Array(metrics.length + numMissing * 2);
  21703. entries.set(metrics.data);
  21704. if (dupFirstEntry) {
  21705. entries[metrics.length] = metrics.data[2];
  21706. entries[metrics.length + 1] = metrics.data[3];
  21707. }
  21708. metrics.data = entries;
  21709. }
  21710. }
  21711. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21712. const glyphProfile = {
  21713. length: 0,
  21714. sizeOfInstructions: 0
  21715. };
  21716. if (sourceEnd - sourceStart <= 12) {
  21717. return glyphProfile;
  21718. }
  21719. const glyf = source.subarray(sourceStart, sourceEnd);
  21720. let contoursCount = signedInt16(glyf[0], glyf[1]);
  21721. if (contoursCount < 0) {
  21722. contoursCount = -1;
  21723. writeSignedInt16(glyf, 0, contoursCount);
  21724. dest.set(glyf, destStart);
  21725. glyphProfile.length = glyf.length;
  21726. return glyphProfile;
  21727. }
  21728. let i,
  21729. j = 10,
  21730. flagsCount = 0;
  21731. for (i = 0; i < contoursCount; i++) {
  21732. const endPoint = glyf[j] << 8 | glyf[j + 1];
  21733. flagsCount = endPoint + 1;
  21734. j += 2;
  21735. }
  21736. const instructionsStart = j;
  21737. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21738. glyphProfile.sizeOfInstructions = instructionsLength;
  21739. j += 2 + instructionsLength;
  21740. const instructionsEnd = j;
  21741. let coordinatesLength = 0;
  21742. for (i = 0; i < flagsCount; i++) {
  21743. const flag = glyf[j++];
  21744. if (flag & 0xc0) {
  21745. glyf[j - 1] = flag & 0x3f;
  21746. }
  21747. let xLength = 2;
  21748. if (flag & 2) {
  21749. xLength = 1;
  21750. } else if (flag & 16) {
  21751. xLength = 0;
  21752. }
  21753. let yLength = 2;
  21754. if (flag & 4) {
  21755. yLength = 1;
  21756. } else if (flag & 32) {
  21757. yLength = 0;
  21758. }
  21759. const xyLength = xLength + yLength;
  21760. coordinatesLength += xyLength;
  21761. if (flag & 8) {
  21762. const repeat = glyf[j++];
  21763. i += repeat;
  21764. coordinatesLength += repeat * xyLength;
  21765. }
  21766. }
  21767. if (coordinatesLength === 0) {
  21768. return glyphProfile;
  21769. }
  21770. let glyphDataLength = j + coordinatesLength;
  21771. if (glyphDataLength > glyf.length) {
  21772. return glyphProfile;
  21773. }
  21774. if (!hintsValid && instructionsLength > 0) {
  21775. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21776. dest.set([0, 0], destStart + instructionsStart);
  21777. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21778. glyphDataLength -= instructionsLength;
  21779. if (glyf.length - glyphDataLength > 3) {
  21780. glyphDataLength = glyphDataLength + 3 & ~3;
  21781. }
  21782. glyphProfile.length = glyphDataLength;
  21783. return glyphProfile;
  21784. }
  21785. if (glyf.length - glyphDataLength > 3) {
  21786. glyphDataLength = glyphDataLength + 3 & ~3;
  21787. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21788. glyphProfile.length = glyphDataLength;
  21789. return glyphProfile;
  21790. }
  21791. dest.set(glyf, destStart);
  21792. glyphProfile.length = glyf.length;
  21793. return glyphProfile;
  21794. }
  21795. function sanitizeHead(head, numGlyphs, locaLength) {
  21796. const data = head.data;
  21797. const version = int32(data[0], data[1], data[2], data[3]);
  21798. if (version >> 16 !== 1) {
  21799. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21800. data[0] = 0;
  21801. data[1] = 1;
  21802. data[2] = 0;
  21803. data[3] = 0;
  21804. }
  21805. const indexToLocFormat = int16(data[50], data[51]);
  21806. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21807. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21808. const numGlyphsPlusOne = numGlyphs + 1;
  21809. if (locaLength === numGlyphsPlusOne << 1) {
  21810. data[50] = 0;
  21811. data[51] = 0;
  21812. } else if (locaLength === numGlyphsPlusOne << 2) {
  21813. data[50] = 0;
  21814. data[51] = 1;
  21815. } else {
  21816. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21817. }
  21818. }
  21819. }
  21820. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21821. let itemSize, itemDecode, itemEncode;
  21822. if (isGlyphLocationsLong) {
  21823. itemSize = 4;
  21824. itemDecode = function fontItemDecodeLong(data, offset) {
  21825. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21826. };
  21827. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21828. data[offset] = value >>> 24 & 0xff;
  21829. data[offset + 1] = value >> 16 & 0xff;
  21830. data[offset + 2] = value >> 8 & 0xff;
  21831. data[offset + 3] = value & 0xff;
  21832. };
  21833. } else {
  21834. itemSize = 2;
  21835. itemDecode = function fontItemDecode(data, offset) {
  21836. return data[offset] << 9 | data[offset + 1] << 1;
  21837. };
  21838. itemEncode = function fontItemEncode(data, offset, value) {
  21839. data[offset] = value >> 9 & 0xff;
  21840. data[offset + 1] = value >> 1 & 0xff;
  21841. };
  21842. }
  21843. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21844. const locaDataSize = itemSize * (1 + numGlyphsOut);
  21845. const locaData = new Uint8Array(locaDataSize);
  21846. locaData.set(loca.data.subarray(0, locaDataSize));
  21847. loca.data = locaData;
  21848. const oldGlyfData = glyf.data;
  21849. const oldGlyfDataLength = oldGlyfData.length;
  21850. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  21851. let i, j;
  21852. const locaEntries = [];
  21853. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  21854. let offset = itemDecode(locaData, j);
  21855. if (offset > oldGlyfDataLength) {
  21856. offset = oldGlyfDataLength;
  21857. }
  21858. locaEntries.push({
  21859. index: i,
  21860. offset,
  21861. endOffset: 0
  21862. });
  21863. }
  21864. locaEntries.sort((a, b) => {
  21865. return a.offset - b.offset;
  21866. });
  21867. for (i = 0; i < numGlyphs; i++) {
  21868. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  21869. }
  21870. locaEntries.sort((a, b) => {
  21871. return a.index - b.index;
  21872. });
  21873. for (i = 0; i < numGlyphs; i++) {
  21874. const {
  21875. offset,
  21876. endOffset
  21877. } = locaEntries[i];
  21878. if (offset !== 0 || endOffset !== 0) {
  21879. break;
  21880. }
  21881. const nextOffset = locaEntries[i + 1].offset;
  21882. if (nextOffset === 0) {
  21883. continue;
  21884. }
  21885. locaEntries[i].endOffset = nextOffset;
  21886. break;
  21887. }
  21888. const missingGlyphs = Object.create(null);
  21889. let writeOffset = 0;
  21890. itemEncode(locaData, 0, writeOffset);
  21891. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21892. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  21893. const newLength = glyphProfile.length;
  21894. if (newLength === 0) {
  21895. missingGlyphs[i] = true;
  21896. }
  21897. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21898. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21899. }
  21900. writeOffset += newLength;
  21901. itemEncode(locaData, j, writeOffset);
  21902. }
  21903. if (writeOffset === 0) {
  21904. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21905. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21906. itemEncode(locaData, j, simpleGlyph.length);
  21907. }
  21908. glyf.data = simpleGlyph;
  21909. } else if (dupFirstEntry) {
  21910. const firstEntryLength = itemDecode(locaData, itemSize);
  21911. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21912. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21913. } else {
  21914. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21915. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21916. }
  21917. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21918. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21919. } else {
  21920. glyf.data = newGlyfData.subarray(0, writeOffset);
  21921. }
  21922. return {
  21923. missingGlyphs,
  21924. maxSizeOfInstructions
  21925. };
  21926. }
  21927. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21928. const start = (font.start || 0) + post.offset;
  21929. font.pos = start;
  21930. const length = post.length,
  21931. end = start + length;
  21932. const version = font.getInt32();
  21933. font.skip(28);
  21934. let glyphNames;
  21935. let valid = true;
  21936. let i;
  21937. switch (version) {
  21938. case 0x00010000:
  21939. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  21940. break;
  21941. case 0x00020000:
  21942. const numGlyphs = font.getUint16();
  21943. if (numGlyphs !== maxpNumGlyphs) {
  21944. valid = false;
  21945. break;
  21946. }
  21947. const glyphNameIndexes = [];
  21948. for (i = 0; i < numGlyphs; ++i) {
  21949. const index = font.getUint16();
  21950. if (index >= 32768) {
  21951. valid = false;
  21952. break;
  21953. }
  21954. glyphNameIndexes.push(index);
  21955. }
  21956. if (!valid) {
  21957. break;
  21958. }
  21959. const customNames = [],
  21960. strBuf = [];
  21961. while (font.pos < end) {
  21962. const stringLength = font.getByte();
  21963. strBuf.length = stringLength;
  21964. for (i = 0; i < stringLength; ++i) {
  21965. strBuf[i] = String.fromCharCode(font.getByte());
  21966. }
  21967. customNames.push(strBuf.join(""));
  21968. }
  21969. glyphNames = [];
  21970. for (i = 0; i < numGlyphs; ++i) {
  21971. const j = glyphNameIndexes[i];
  21972. if (j < 258) {
  21973. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  21974. continue;
  21975. }
  21976. glyphNames.push(customNames[j - 258]);
  21977. }
  21978. break;
  21979. case 0x00030000:
  21980. break;
  21981. default:
  21982. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21983. valid = false;
  21984. if (propertiesObj.defaultEncoding) {
  21985. glyphNames = propertiesObj.defaultEncoding;
  21986. }
  21987. break;
  21988. }
  21989. propertiesObj.glyphNames = glyphNames;
  21990. return valid;
  21991. }
  21992. function readNameTable(nameTable) {
  21993. const start = (font.start || 0) + nameTable.offset;
  21994. font.pos = start;
  21995. const names = [[], []];
  21996. const length = nameTable.length,
  21997. end = start + length;
  21998. const format = font.getUint16();
  21999. const FORMAT_0_HEADER_LENGTH = 6;
  22000. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  22001. return names;
  22002. }
  22003. const numRecords = font.getUint16();
  22004. const stringsStart = font.getUint16();
  22005. const records = [];
  22006. const NAME_RECORD_LENGTH = 12;
  22007. let i, ii;
  22008. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  22009. const r = {
  22010. platform: font.getUint16(),
  22011. encoding: font.getUint16(),
  22012. language: font.getUint16(),
  22013. name: font.getUint16(),
  22014. length: font.getUint16(),
  22015. offset: font.getUint16()
  22016. };
  22017. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  22018. records.push(r);
  22019. }
  22020. }
  22021. for (i = 0, ii = records.length; i < ii; i++) {
  22022. const record = records[i];
  22023. if (record.length <= 0) {
  22024. continue;
  22025. }
  22026. const pos = start + stringsStart + record.offset;
  22027. if (pos + record.length > end) {
  22028. continue;
  22029. }
  22030. font.pos = pos;
  22031. const nameIndex = record.name;
  22032. if (record.encoding) {
  22033. let str = "";
  22034. for (let j = 0, jj = record.length; j < jj; j += 2) {
  22035. str += String.fromCharCode(font.getUint16());
  22036. }
  22037. names[1][nameIndex] = str;
  22038. } else {
  22039. names[0][nameIndex] = font.getString(record.length);
  22040. }
  22041. }
  22042. return names;
  22043. }
  22044. 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];
  22045. function sanitizeTTProgram(table, ttContext) {
  22046. let data = table.data;
  22047. let i = 0,
  22048. j,
  22049. n,
  22050. b,
  22051. funcId,
  22052. pc,
  22053. lastEndf = 0,
  22054. lastDeff = 0;
  22055. const stack = [];
  22056. const callstack = [];
  22057. const functionsCalled = [];
  22058. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  22059. let inFDEF = false,
  22060. ifLevel = 0,
  22061. inELSE = 0;
  22062. for (let ii = data.length; i < ii;) {
  22063. const op = data[i++];
  22064. if (op === 0x40) {
  22065. n = data[i++];
  22066. if (inFDEF || inELSE) {
  22067. i += n;
  22068. } else {
  22069. for (j = 0; j < n; j++) {
  22070. stack.push(data[i++]);
  22071. }
  22072. }
  22073. } else if (op === 0x41) {
  22074. n = data[i++];
  22075. if (inFDEF || inELSE) {
  22076. i += n * 2;
  22077. } else {
  22078. for (j = 0; j < n; j++) {
  22079. b = data[i++];
  22080. stack.push(b << 8 | data[i++]);
  22081. }
  22082. }
  22083. } else if ((op & 0xf8) === 0xb0) {
  22084. n = op - 0xb0 + 1;
  22085. if (inFDEF || inELSE) {
  22086. i += n;
  22087. } else {
  22088. for (j = 0; j < n; j++) {
  22089. stack.push(data[i++]);
  22090. }
  22091. }
  22092. } else if ((op & 0xf8) === 0xb8) {
  22093. n = op - 0xb8 + 1;
  22094. if (inFDEF || inELSE) {
  22095. i += n * 2;
  22096. } else {
  22097. for (j = 0; j < n; j++) {
  22098. b = data[i++];
  22099. stack.push(b << 8 | data[i++]);
  22100. }
  22101. }
  22102. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  22103. if (!inFDEF && !inELSE) {
  22104. funcId = stack.at(-1);
  22105. if (isNaN(funcId)) {
  22106. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  22107. } else {
  22108. ttContext.functionsUsed[funcId] = true;
  22109. if (funcId in ttContext.functionsStackDeltas) {
  22110. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  22111. if (newStackLength < 0) {
  22112. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  22113. ttContext.hintsValid = false;
  22114. return;
  22115. }
  22116. stack.length = newStackLength;
  22117. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  22118. callstack.push({
  22119. data,
  22120. i,
  22121. stackTop: stack.length - 1
  22122. });
  22123. functionsCalled.push(funcId);
  22124. pc = ttContext.functionsDefined[funcId];
  22125. if (!pc) {
  22126. (0, _util.warn)("TT: CALL non-existent function");
  22127. ttContext.hintsValid = false;
  22128. return;
  22129. }
  22130. data = pc.data;
  22131. i = pc.i;
  22132. }
  22133. }
  22134. }
  22135. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  22136. if (inFDEF || inELSE) {
  22137. (0, _util.warn)("TT: nested FDEFs not allowed");
  22138. tooComplexToFollowFunctions = true;
  22139. }
  22140. inFDEF = true;
  22141. lastDeff = i;
  22142. funcId = stack.pop();
  22143. ttContext.functionsDefined[funcId] = {
  22144. data,
  22145. i
  22146. };
  22147. } else if (op === 0x2d) {
  22148. if (inFDEF) {
  22149. inFDEF = false;
  22150. lastEndf = i;
  22151. } else {
  22152. pc = callstack.pop();
  22153. if (!pc) {
  22154. (0, _util.warn)("TT: ENDF bad stack");
  22155. ttContext.hintsValid = false;
  22156. return;
  22157. }
  22158. funcId = functionsCalled.pop();
  22159. data = pc.data;
  22160. i = pc.i;
  22161. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  22162. }
  22163. } else if (op === 0x89) {
  22164. if (inFDEF || inELSE) {
  22165. (0, _util.warn)("TT: nested IDEFs not allowed");
  22166. tooComplexToFollowFunctions = true;
  22167. }
  22168. inFDEF = true;
  22169. lastDeff = i;
  22170. } else if (op === 0x58) {
  22171. ++ifLevel;
  22172. } else if (op === 0x1b) {
  22173. inELSE = ifLevel;
  22174. } else if (op === 0x59) {
  22175. if (inELSE === ifLevel) {
  22176. inELSE = 0;
  22177. }
  22178. --ifLevel;
  22179. } else if (op === 0x1c) {
  22180. if (!inFDEF && !inELSE) {
  22181. const offset = stack.at(-1);
  22182. if (offset > 0) {
  22183. i += offset - 1;
  22184. }
  22185. }
  22186. }
  22187. if (!inFDEF && !inELSE) {
  22188. let stackDelta = 0;
  22189. if (op <= 0x8e) {
  22190. stackDelta = TTOpsStackDeltas[op];
  22191. } else if (op >= 0xc0 && op <= 0xdf) {
  22192. stackDelta = -1;
  22193. } else if (op >= 0xe0) {
  22194. stackDelta = -2;
  22195. }
  22196. if (op >= 0x71 && op <= 0x75) {
  22197. n = stack.pop();
  22198. if (!isNaN(n)) {
  22199. stackDelta = -n * 2;
  22200. }
  22201. }
  22202. while (stackDelta < 0 && stack.length > 0) {
  22203. stack.pop();
  22204. stackDelta++;
  22205. }
  22206. while (stackDelta > 0) {
  22207. stack.push(NaN);
  22208. stackDelta--;
  22209. }
  22210. }
  22211. }
  22212. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  22213. const content = [data];
  22214. if (i > data.length) {
  22215. content.push(new Uint8Array(i - data.length));
  22216. }
  22217. if (lastDeff > lastEndf) {
  22218. (0, _util.warn)("TT: complementing a missing function tail");
  22219. content.push(new Uint8Array([0x22, 0x2d]));
  22220. }
  22221. foldTTTable(table, content);
  22222. }
  22223. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  22224. if (ttContext.tooComplexToFollowFunctions) {
  22225. return;
  22226. }
  22227. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  22228. (0, _util.warn)("TT: more functions defined than expected");
  22229. ttContext.hintsValid = false;
  22230. return;
  22231. }
  22232. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  22233. if (j > maxFunctionDefs) {
  22234. (0, _util.warn)("TT: invalid function id: " + j);
  22235. ttContext.hintsValid = false;
  22236. return;
  22237. }
  22238. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  22239. (0, _util.warn)("TT: undefined function: " + j);
  22240. ttContext.hintsValid = false;
  22241. return;
  22242. }
  22243. }
  22244. }
  22245. function foldTTTable(table, content) {
  22246. if (content.length > 1) {
  22247. let newLength = 0;
  22248. let j, jj;
  22249. for (j = 0, jj = content.length; j < jj; j++) {
  22250. newLength += content[j].length;
  22251. }
  22252. newLength = newLength + 3 & ~3;
  22253. const result = new Uint8Array(newLength);
  22254. let pos = 0;
  22255. for (j = 0, jj = content.length; j < jj; j++) {
  22256. result.set(content[j], pos);
  22257. pos += content[j].length;
  22258. }
  22259. table.data = result;
  22260. table.length = newLength;
  22261. }
  22262. }
  22263. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  22264. const ttContext = {
  22265. functionsDefined: [],
  22266. functionsUsed: [],
  22267. functionsStackDeltas: [],
  22268. tooComplexToFollowFunctions: false,
  22269. hintsValid: true
  22270. };
  22271. if (fpgm) {
  22272. sanitizeTTProgram(fpgm, ttContext);
  22273. }
  22274. if (prep) {
  22275. sanitizeTTProgram(prep, ttContext);
  22276. }
  22277. if (fpgm) {
  22278. checkInvalidFunctions(ttContext, maxFunctionDefs);
  22279. }
  22280. if (cvt && cvt.length & 1) {
  22281. const cvtData = new Uint8Array(cvt.length + 1);
  22282. cvtData.set(cvt.data);
  22283. cvt.data = cvtData;
  22284. }
  22285. return ttContext.hintsValid;
  22286. }
  22287. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  22288. let header, tables;
  22289. if (isTrueTypeCollectionFile(font)) {
  22290. const ttcData = readTrueTypeCollectionData(font, this.name);
  22291. header = ttcData.header;
  22292. tables = ttcData.tables;
  22293. } else {
  22294. header = readOpenTypeHeader(font);
  22295. tables = readTables(font, header.numTables);
  22296. }
  22297. let cff, cffFile;
  22298. const isTrueType = !tables["CFF "];
  22299. if (!isTrueType) {
  22300. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  22301. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  22302. cffFile = new _stream.Stream(tables["CFF "].data);
  22303. cff = new _cff_font.CFFFont(cffFile, properties);
  22304. adjustWidths(properties);
  22305. return this.convert(name, cff, properties);
  22306. }
  22307. delete tables.glyf;
  22308. delete tables.loca;
  22309. delete tables.fpgm;
  22310. delete tables.prep;
  22311. delete tables["cvt "];
  22312. this.isOpenType = true;
  22313. } else {
  22314. if (!tables.loca) {
  22315. throw new _util.FormatError('Required "loca" table is not found');
  22316. }
  22317. if (!tables.glyf) {
  22318. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  22319. tables.glyf = {
  22320. tag: "glyf",
  22321. data: new Uint8Array(0)
  22322. };
  22323. }
  22324. this.isOpenType = false;
  22325. }
  22326. if (!tables.maxp) {
  22327. throw new _util.FormatError('Required "maxp" table is not found');
  22328. }
  22329. font.pos = (font.start || 0) + tables.maxp.offset;
  22330. const version = font.getInt32();
  22331. const numGlyphs = font.getUint16();
  22332. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  22333. const {
  22334. scaleFactors
  22335. } = properties;
  22336. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22337. const glyphs = new _glyf.GlyfTable({
  22338. glyfTable: tables.glyf.data,
  22339. isGlyphLocationsLong,
  22340. locaTable: tables.loca.data,
  22341. numGlyphs
  22342. });
  22343. glyphs.scale(scaleFactors);
  22344. const {
  22345. glyf,
  22346. loca,
  22347. isLocationLong
  22348. } = glyphs.write();
  22349. tables.glyf.data = glyf;
  22350. tables.loca.data = loca;
  22351. if (isLocationLong !== !!isGlyphLocationsLong) {
  22352. tables.head.data[50] = 0;
  22353. tables.head.data[51] = isLocationLong ? 1 : 0;
  22354. }
  22355. const metrics = tables.hmtx.data;
  22356. for (let i = 0; i < numGlyphs; i++) {
  22357. const j = 4 * i;
  22358. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  22359. metrics[j] = advanceWidth >> 8 & 0xff;
  22360. metrics[j + 1] = advanceWidth & 0xff;
  22361. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  22362. writeSignedInt16(metrics, j + 2, lsb);
  22363. }
  22364. }
  22365. let numGlyphsOut = numGlyphs + 1;
  22366. let dupFirstEntry = true;
  22367. if (numGlyphsOut > 0xffff) {
  22368. dupFirstEntry = false;
  22369. numGlyphsOut = numGlyphs;
  22370. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  22371. }
  22372. let maxFunctionDefs = 0;
  22373. let maxSizeOfInstructions = 0;
  22374. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22375. font.pos += 8;
  22376. const maxZones = font.getUint16();
  22377. if (maxZones > 2) {
  22378. tables.maxp.data[14] = 0;
  22379. tables.maxp.data[15] = 2;
  22380. }
  22381. font.pos += 4;
  22382. maxFunctionDefs = font.getUint16();
  22383. font.pos += 4;
  22384. maxSizeOfInstructions = font.getUint16();
  22385. }
  22386. tables.maxp.data[4] = numGlyphsOut >> 8;
  22387. tables.maxp.data[5] = numGlyphsOut & 255;
  22388. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  22389. if (!hintsValid) {
  22390. delete tables.fpgm;
  22391. delete tables.prep;
  22392. delete tables["cvt "];
  22393. }
  22394. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  22395. if (!tables.head) {
  22396. throw new _util.FormatError('Required "head" table is not found');
  22397. }
  22398. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  22399. let missingGlyphs = Object.create(null);
  22400. if (isTrueType) {
  22401. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22402. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  22403. missingGlyphs = glyphsInfo.missingGlyphs;
  22404. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22405. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  22406. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  22407. }
  22408. }
  22409. if (!tables.hhea) {
  22410. throw new _util.FormatError('Required "hhea" table is not found');
  22411. }
  22412. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  22413. tables.hhea.data[10] = 0xff;
  22414. tables.hhea.data[11] = 0xff;
  22415. }
  22416. const metricsOverride = {
  22417. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  22418. yMax: int16(tables.head.data[42], tables.head.data[43]),
  22419. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  22420. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  22421. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  22422. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  22423. };
  22424. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  22425. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  22426. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  22427. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  22428. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  22429. this.lineGap = this.cssFontInfo.metrics.lineGap;
  22430. } else {
  22431. this.lineHeight = this.ascent - this.descent + this.lineGap;
  22432. }
  22433. if (tables.post) {
  22434. readPostScriptTable(tables.post, properties, numGlyphs);
  22435. }
  22436. tables.post = {
  22437. tag: "post",
  22438. data: createPostTable(properties)
  22439. };
  22440. const charCodeToGlyphId = [];
  22441. function hasGlyph(glyphId) {
  22442. return !missingGlyphs[glyphId];
  22443. }
  22444. if (properties.composite) {
  22445. const cidToGidMap = properties.cidToGidMap || [];
  22446. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  22447. properties.cMap.forEach(function (charCode, cid) {
  22448. if (typeof cid === "string") {
  22449. cid = convertCidString(charCode, cid, true);
  22450. }
  22451. if (cid > 0xffff) {
  22452. throw new _util.FormatError("Max size of CID is 65,535");
  22453. }
  22454. let glyphId = -1;
  22455. if (isCidToGidMapEmpty) {
  22456. glyphId = cid;
  22457. } else if (cidToGidMap[cid] !== undefined) {
  22458. glyphId = cidToGidMap[cid];
  22459. }
  22460. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  22461. charCodeToGlyphId[charCode] = glyphId;
  22462. }
  22463. });
  22464. } else {
  22465. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  22466. const cmapPlatformId = cmapTable.platformId;
  22467. const cmapEncodingId = cmapTable.encodingId;
  22468. const cmapMappings = cmapTable.mappings;
  22469. let baseEncoding = [],
  22470. forcePostTable = false;
  22471. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  22472. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22473. }
  22474. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  22475. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22476. for (let charCode = 0; charCode < 256; charCode++) {
  22477. let glyphName;
  22478. if (this.differences[charCode] !== undefined) {
  22479. glyphName = this.differences[charCode];
  22480. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  22481. glyphName = baseEncoding[charCode];
  22482. } else {
  22483. glyphName = _encodings.StandardEncoding[charCode];
  22484. }
  22485. if (!glyphName) {
  22486. continue;
  22487. }
  22488. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  22489. let unicodeOrCharCode;
  22490. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  22491. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  22492. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  22493. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  22494. }
  22495. if (unicodeOrCharCode === undefined) {
  22496. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  22497. const unicode = this.toUnicode.get(charCode);
  22498. if (unicode) {
  22499. unicodeOrCharCode = unicode.codePointAt(0);
  22500. }
  22501. }
  22502. if (unicodeOrCharCode === undefined) {
  22503. continue;
  22504. }
  22505. }
  22506. for (const mapping of cmapMappings) {
  22507. if (mapping.charCode !== unicodeOrCharCode) {
  22508. continue;
  22509. }
  22510. charCodeToGlyphId[charCode] = mapping.glyphId;
  22511. break;
  22512. }
  22513. }
  22514. } else if (cmapPlatformId === 0) {
  22515. for (const mapping of cmapMappings) {
  22516. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  22517. }
  22518. forcePostTable = true;
  22519. } else {
  22520. for (const mapping of cmapMappings) {
  22521. let charCode = mapping.charCode;
  22522. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  22523. charCode &= 0xff;
  22524. }
  22525. charCodeToGlyphId[charCode] = mapping.glyphId;
  22526. }
  22527. }
  22528. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  22529. for (let i = 0; i < 256; ++i) {
  22530. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  22531. continue;
  22532. }
  22533. const glyphName = this.differences[i] || baseEncoding[i];
  22534. if (!glyphName) {
  22535. continue;
  22536. }
  22537. const glyphId = properties.glyphNames.indexOf(glyphName);
  22538. if (glyphId > 0 && hasGlyph(glyphId)) {
  22539. charCodeToGlyphId[i] = glyphId;
  22540. }
  22541. }
  22542. }
  22543. }
  22544. if (charCodeToGlyphId.length === 0) {
  22545. charCodeToGlyphId[0] = 0;
  22546. }
  22547. let glyphZeroId = numGlyphsOut - 1;
  22548. if (!dupFirstEntry) {
  22549. glyphZeroId = 0;
  22550. }
  22551. if (!properties.cssFontInfo) {
  22552. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  22553. this.toFontChar = newMapping.toFontChar;
  22554. tables.cmap = {
  22555. tag: "cmap",
  22556. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  22557. };
  22558. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  22559. tables["OS/2"] = {
  22560. tag: "OS/2",
  22561. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  22562. };
  22563. }
  22564. }
  22565. if (!isTrueType) {
  22566. try {
  22567. cffFile = new _stream.Stream(tables["CFF "].data);
  22568. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  22569. cff = parser.parse();
  22570. cff.duplicateFirstGlyph();
  22571. const compiler = new _cff_parser.CFFCompiler(cff);
  22572. tables["CFF "].data = compiler.compile();
  22573. } catch (e) {
  22574. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22575. }
  22576. }
  22577. if (!tables.name) {
  22578. tables.name = {
  22579. tag: "name",
  22580. data: createNameTable(this.name)
  22581. };
  22582. } else {
  22583. const namePrototype = readNameTable(tables.name);
  22584. tables.name.data = createNameTable(name, namePrototype);
  22585. this.psName = namePrototype[0][6] || null;
  22586. }
  22587. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  22588. for (const tableTag in tables) {
  22589. builder.addTable(tableTag, tables[tableTag].data);
  22590. }
  22591. return builder.toArray();
  22592. }
  22593. convert(fontName, font, properties) {
  22594. properties.fixedPitch = false;
  22595. if (properties.builtInEncoding) {
  22596. adjustToUnicode(properties, properties.builtInEncoding);
  22597. }
  22598. let glyphZeroId = 1;
  22599. if (font instanceof _cff_font.CFFFont) {
  22600. glyphZeroId = font.numGlyphs - 1;
  22601. }
  22602. const mapping = font.getGlyphMapping(properties);
  22603. let newMapping = null;
  22604. let newCharCodeToGlyphId = mapping;
  22605. let toUnicodeExtraMap = null;
  22606. if (!properties.cssFontInfo) {
  22607. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  22608. this.toFontChar = newMapping.toFontChar;
  22609. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  22610. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  22611. }
  22612. const numGlyphs = font.numGlyphs;
  22613. function getCharCodes(charCodeToGlyphId, glyphId) {
  22614. let charCodes = null;
  22615. for (const charCode in charCodeToGlyphId) {
  22616. if (glyphId === charCodeToGlyphId[charCode]) {
  22617. if (!charCodes) {
  22618. charCodes = [];
  22619. }
  22620. charCodes.push(charCode | 0);
  22621. }
  22622. }
  22623. return charCodes;
  22624. }
  22625. function createCharCode(charCodeToGlyphId, glyphId) {
  22626. for (const charCode in charCodeToGlyphId) {
  22627. if (glyphId === charCodeToGlyphId[charCode]) {
  22628. return charCode | 0;
  22629. }
  22630. }
  22631. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22632. return newMapping.nextAvailableFontCharCode++;
  22633. }
  22634. const seacs = font.seacs;
  22635. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22636. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22637. const charset = font.getCharset();
  22638. const seacMap = Object.create(null);
  22639. for (let glyphId in seacs) {
  22640. glyphId |= 0;
  22641. const seac = seacs[glyphId];
  22642. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22643. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22644. const baseGlyphId = charset.indexOf(baseGlyphName);
  22645. const accentGlyphId = charset.indexOf(accentGlyphName);
  22646. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22647. continue;
  22648. }
  22649. const accentOffset = {
  22650. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22651. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22652. };
  22653. const charCodes = getCharCodes(mapping, glyphId);
  22654. if (!charCodes) {
  22655. continue;
  22656. }
  22657. for (const charCode of charCodes) {
  22658. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22659. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22660. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22661. seacMap[charCode] = {
  22662. baseFontCharCode,
  22663. accentFontCharCode,
  22664. accentOffset
  22665. };
  22666. }
  22667. }
  22668. properties.seacMap = seacMap;
  22669. }
  22670. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22671. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22672. builder.addTable("CFF ", font.data);
  22673. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  22674. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  22675. 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");
  22676. 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));
  22677. builder.addTable("hmtx", function fontFieldsHmtx() {
  22678. const charstrings = font.charstrings;
  22679. const cffWidths = font.cff ? font.cff.widths : null;
  22680. let hmtx = "\x00\x00\x00\x00";
  22681. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22682. let width = 0;
  22683. if (charstrings) {
  22684. const charstring = charstrings[i - 1];
  22685. width = "width" in charstring ? charstring.width : 0;
  22686. } else if (cffWidths) {
  22687. width = Math.ceil(cffWidths[i] || 0);
  22688. }
  22689. hmtx += string16(width) + string16(0);
  22690. }
  22691. return hmtx;
  22692. }());
  22693. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22694. builder.addTable("name", createNameTable(fontName));
  22695. builder.addTable("post", createPostTable(properties));
  22696. return builder.toArray();
  22697. }
  22698. get spaceWidth() {
  22699. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22700. let width;
  22701. for (const glyphName of possibleSpaceReplacements) {
  22702. if (glyphName in this.widths) {
  22703. width = this.widths[glyphName];
  22704. break;
  22705. }
  22706. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22707. const glyphUnicode = glyphsUnicodeMap[glyphName];
  22708. let charcode = 0;
  22709. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22710. charcode = this.cMap.lookup(glyphUnicode);
  22711. if (typeof charcode === "string") {
  22712. charcode = convertCidString(glyphUnicode, charcode);
  22713. }
  22714. }
  22715. if (!charcode && this.toUnicode) {
  22716. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22717. }
  22718. if (charcode <= 0) {
  22719. charcode = glyphUnicode;
  22720. }
  22721. width = this.widths[charcode];
  22722. if (width) {
  22723. break;
  22724. }
  22725. }
  22726. width = width || this.defaultWidth;
  22727. return (0, _util.shadow)(this, "spaceWidth", width);
  22728. }
  22729. _charToGlyph(charcode, isSpace = false) {
  22730. let glyph = this._glyphCache[charcode];
  22731. if (glyph && glyph.isSpace === isSpace) {
  22732. return glyph;
  22733. }
  22734. let fontCharCode, width, operatorListId;
  22735. let widthCode = charcode;
  22736. if (this.cMap && this.cMap.contains(charcode)) {
  22737. widthCode = this.cMap.lookup(charcode);
  22738. if (typeof widthCode === "string") {
  22739. widthCode = convertCidString(charcode, widthCode);
  22740. }
  22741. }
  22742. width = this.widths[widthCode];
  22743. if (typeof width !== "number") {
  22744. width = this.defaultWidth;
  22745. }
  22746. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  22747. let unicode = this.toUnicode.get(charcode) || charcode;
  22748. if (typeof unicode === "number") {
  22749. unicode = String.fromCharCode(unicode);
  22750. }
  22751. let isInFont = this.toFontChar[charcode] !== undefined;
  22752. fontCharCode = this.toFontChar[charcode] || charcode;
  22753. if (this.missingFile) {
  22754. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22755. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22756. fontCharCode = 0x20;
  22757. }
  22758. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22759. }
  22760. if (this.isType3Font) {
  22761. operatorListId = fontCharCode;
  22762. }
  22763. let accent = null;
  22764. if (this.seacMap && this.seacMap[charcode]) {
  22765. isInFont = true;
  22766. const seac = this.seacMap[charcode];
  22767. fontCharCode = seac.baseFontCharCode;
  22768. accent = {
  22769. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22770. offset: seac.accentOffset
  22771. };
  22772. }
  22773. let fontChar = "";
  22774. if (typeof fontCharCode === "number") {
  22775. if (fontCharCode <= 0x10ffff) {
  22776. fontChar = String.fromCodePoint(fontCharCode);
  22777. } else {
  22778. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22779. }
  22780. }
  22781. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22782. return this._glyphCache[charcode] = glyph;
  22783. }
  22784. charsToGlyphs(chars) {
  22785. let glyphs = this._charsCache[chars];
  22786. if (glyphs) {
  22787. return glyphs;
  22788. }
  22789. glyphs = [];
  22790. if (this.cMap) {
  22791. const c = Object.create(null),
  22792. ii = chars.length;
  22793. let i = 0;
  22794. while (i < ii) {
  22795. this.cMap.readCharCode(chars, i, c);
  22796. const {
  22797. charcode,
  22798. length
  22799. } = c;
  22800. i += length;
  22801. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  22802. glyphs.push(glyph);
  22803. }
  22804. } else {
  22805. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22806. const charcode = chars.charCodeAt(i);
  22807. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  22808. glyphs.push(glyph);
  22809. }
  22810. }
  22811. return this._charsCache[chars] = glyphs;
  22812. }
  22813. getCharPositions(chars) {
  22814. const positions = [];
  22815. if (this.cMap) {
  22816. const c = Object.create(null);
  22817. let i = 0;
  22818. while (i < chars.length) {
  22819. this.cMap.readCharCode(chars, i, c);
  22820. const length = c.length;
  22821. positions.push([i, i + length]);
  22822. i += length;
  22823. }
  22824. } else {
  22825. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22826. positions.push([i, i + 1]);
  22827. }
  22828. }
  22829. return positions;
  22830. }
  22831. get glyphCacheValues() {
  22832. return Object.values(this._glyphCache);
  22833. }
  22834. encodeString(str) {
  22835. const buffers = [];
  22836. const currentBuf = [];
  22837. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  22838. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  22839. for (let i = 0, ii = str.length; i < ii; i++) {
  22840. const unicode = str.codePointAt(i);
  22841. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  22842. i++;
  22843. }
  22844. if (this.toUnicode) {
  22845. const charCode = getCharCode(unicode);
  22846. if (charCode !== -1) {
  22847. if (hasCurrentBufErrors()) {
  22848. buffers.push(currentBuf.join(""));
  22849. currentBuf.length = 0;
  22850. }
  22851. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  22852. for (let j = charCodeLength - 1; j >= 0; j--) {
  22853. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  22854. }
  22855. continue;
  22856. }
  22857. }
  22858. if (!hasCurrentBufErrors()) {
  22859. buffers.push(currentBuf.join(""));
  22860. currentBuf.length = 0;
  22861. }
  22862. currentBuf.push(String.fromCodePoint(unicode));
  22863. }
  22864. buffers.push(currentBuf.join(""));
  22865. return buffers;
  22866. }
  22867. }
  22868. exports.Font = Font;
  22869. class ErrorFont {
  22870. constructor(error) {
  22871. this.error = error;
  22872. this.loadedName = "g_font_error";
  22873. this.missingFile = true;
  22874. }
  22875. charsToGlyphs() {
  22876. return [];
  22877. }
  22878. encodeString(chars) {
  22879. return [chars];
  22880. }
  22881. exportData(extraProperties = false) {
  22882. return {
  22883. error: this.error
  22884. };
  22885. }
  22886. }
  22887. exports.ErrorFont = ErrorFont;
  22888. /***/ }),
  22889. /* 33 */
  22890. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22891. Object.defineProperty(exports, "__esModule", ({
  22892. value: true
  22893. }));
  22894. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  22895. var _util = __w_pdfjs_require__(2);
  22896. var _charsets = __w_pdfjs_require__(34);
  22897. var _encodings = __w_pdfjs_require__(35);
  22898. const MAX_SUBR_NESTING = 10;
  22899. 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"];
  22900. exports.CFFStandardStrings = CFFStandardStrings;
  22901. const NUM_STANDARD_CFF_STRINGS = 391;
  22902. const CharstringValidationData = [null, {
  22903. id: "hstem",
  22904. min: 2,
  22905. stackClearing: true,
  22906. stem: true
  22907. }, null, {
  22908. id: "vstem",
  22909. min: 2,
  22910. stackClearing: true,
  22911. stem: true
  22912. }, {
  22913. id: "vmoveto",
  22914. min: 1,
  22915. stackClearing: true
  22916. }, {
  22917. id: "rlineto",
  22918. min: 2,
  22919. resetStack: true
  22920. }, {
  22921. id: "hlineto",
  22922. min: 1,
  22923. resetStack: true
  22924. }, {
  22925. id: "vlineto",
  22926. min: 1,
  22927. resetStack: true
  22928. }, {
  22929. id: "rrcurveto",
  22930. min: 6,
  22931. resetStack: true
  22932. }, null, {
  22933. id: "callsubr",
  22934. min: 1,
  22935. undefStack: true
  22936. }, {
  22937. id: "return",
  22938. min: 0,
  22939. undefStack: true
  22940. }, null, null, {
  22941. id: "endchar",
  22942. min: 0,
  22943. stackClearing: true
  22944. }, null, null, null, {
  22945. id: "hstemhm",
  22946. min: 2,
  22947. stackClearing: true,
  22948. stem: true
  22949. }, {
  22950. id: "hintmask",
  22951. min: 0,
  22952. stackClearing: true
  22953. }, {
  22954. id: "cntrmask",
  22955. min: 0,
  22956. stackClearing: true
  22957. }, {
  22958. id: "rmoveto",
  22959. min: 2,
  22960. stackClearing: true
  22961. }, {
  22962. id: "hmoveto",
  22963. min: 1,
  22964. stackClearing: true
  22965. }, {
  22966. id: "vstemhm",
  22967. min: 2,
  22968. stackClearing: true,
  22969. stem: true
  22970. }, {
  22971. id: "rcurveline",
  22972. min: 8,
  22973. resetStack: true
  22974. }, {
  22975. id: "rlinecurve",
  22976. min: 8,
  22977. resetStack: true
  22978. }, {
  22979. id: "vvcurveto",
  22980. min: 4,
  22981. resetStack: true
  22982. }, {
  22983. id: "hhcurveto",
  22984. min: 4,
  22985. resetStack: true
  22986. }, null, {
  22987. id: "callgsubr",
  22988. min: 1,
  22989. undefStack: true
  22990. }, {
  22991. id: "vhcurveto",
  22992. min: 4,
  22993. resetStack: true
  22994. }, {
  22995. id: "hvcurveto",
  22996. min: 4,
  22997. resetStack: true
  22998. }];
  22999. const CharstringValidationData12 = [null, null, null, {
  23000. id: "and",
  23001. min: 2,
  23002. stackDelta: -1
  23003. }, {
  23004. id: "or",
  23005. min: 2,
  23006. stackDelta: -1
  23007. }, {
  23008. id: "not",
  23009. min: 1,
  23010. stackDelta: 0
  23011. }, null, null, null, {
  23012. id: "abs",
  23013. min: 1,
  23014. stackDelta: 0
  23015. }, {
  23016. id: "add",
  23017. min: 2,
  23018. stackDelta: -1,
  23019. stackFn(stack, index) {
  23020. stack[index - 2] = stack[index - 2] + stack[index - 1];
  23021. }
  23022. }, {
  23023. id: "sub",
  23024. min: 2,
  23025. stackDelta: -1,
  23026. stackFn(stack, index) {
  23027. stack[index - 2] = stack[index - 2] - stack[index - 1];
  23028. }
  23029. }, {
  23030. id: "div",
  23031. min: 2,
  23032. stackDelta: -1,
  23033. stackFn(stack, index) {
  23034. stack[index - 2] = stack[index - 2] / stack[index - 1];
  23035. }
  23036. }, null, {
  23037. id: "neg",
  23038. min: 1,
  23039. stackDelta: 0,
  23040. stackFn(stack, index) {
  23041. stack[index - 1] = -stack[index - 1];
  23042. }
  23043. }, {
  23044. id: "eq",
  23045. min: 2,
  23046. stackDelta: -1
  23047. }, null, null, {
  23048. id: "drop",
  23049. min: 1,
  23050. stackDelta: -1
  23051. }, null, {
  23052. id: "put",
  23053. min: 2,
  23054. stackDelta: -2
  23055. }, {
  23056. id: "get",
  23057. min: 1,
  23058. stackDelta: 0
  23059. }, {
  23060. id: "ifelse",
  23061. min: 4,
  23062. stackDelta: -3
  23063. }, {
  23064. id: "random",
  23065. min: 0,
  23066. stackDelta: 1
  23067. }, {
  23068. id: "mul",
  23069. min: 2,
  23070. stackDelta: -1,
  23071. stackFn(stack, index) {
  23072. stack[index - 2] = stack[index - 2] * stack[index - 1];
  23073. }
  23074. }, null, {
  23075. id: "sqrt",
  23076. min: 1,
  23077. stackDelta: 0
  23078. }, {
  23079. id: "dup",
  23080. min: 1,
  23081. stackDelta: 1
  23082. }, {
  23083. id: "exch",
  23084. min: 2,
  23085. stackDelta: 0
  23086. }, {
  23087. id: "index",
  23088. min: 2,
  23089. stackDelta: 0
  23090. }, {
  23091. id: "roll",
  23092. min: 3,
  23093. stackDelta: -2
  23094. }, null, null, null, {
  23095. id: "hflex",
  23096. min: 7,
  23097. resetStack: true
  23098. }, {
  23099. id: "flex",
  23100. min: 13,
  23101. resetStack: true
  23102. }, {
  23103. id: "hflex1",
  23104. min: 9,
  23105. resetStack: true
  23106. }, {
  23107. id: "flex1",
  23108. min: 11,
  23109. resetStack: true
  23110. }];
  23111. class CFFParser {
  23112. constructor(file, properties, seacAnalysisEnabled) {
  23113. this.bytes = file.getBytes();
  23114. this.properties = properties;
  23115. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  23116. }
  23117. parse() {
  23118. const properties = this.properties;
  23119. const cff = new CFF();
  23120. this.cff = cff;
  23121. const header = this.parseHeader();
  23122. const nameIndex = this.parseIndex(header.endPos);
  23123. const topDictIndex = this.parseIndex(nameIndex.endPos);
  23124. const stringIndex = this.parseIndex(topDictIndex.endPos);
  23125. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  23126. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  23127. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  23128. cff.header = header.obj;
  23129. cff.names = this.parseNameIndex(nameIndex.obj);
  23130. cff.strings = this.parseStringIndex(stringIndex.obj);
  23131. cff.topDict = topDict;
  23132. cff.globalSubrIndex = globalSubrIndex.obj;
  23133. this.parsePrivateDict(cff.topDict);
  23134. cff.isCIDFont = topDict.hasName("ROS");
  23135. const charStringOffset = topDict.getByName("CharStrings");
  23136. const charStringIndex = this.parseIndex(charStringOffset).obj;
  23137. const fontMatrix = topDict.getByName("FontMatrix");
  23138. if (fontMatrix) {
  23139. properties.fontMatrix = fontMatrix;
  23140. }
  23141. const fontBBox = topDict.getByName("FontBBox");
  23142. if (fontBBox) {
  23143. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  23144. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  23145. properties.ascentScaled = true;
  23146. }
  23147. let charset, encoding;
  23148. if (cff.isCIDFont) {
  23149. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  23150. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  23151. const dictRaw = fdArrayIndex.get(i);
  23152. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  23153. this.parsePrivateDict(fontDict);
  23154. cff.fdArray.push(fontDict);
  23155. }
  23156. encoding = null;
  23157. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  23158. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  23159. } else {
  23160. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  23161. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  23162. }
  23163. cff.charset = charset;
  23164. cff.encoding = encoding;
  23165. const charStringsAndSeacs = this.parseCharStrings({
  23166. charStrings: charStringIndex,
  23167. localSubrIndex: topDict.privateDict.subrsIndex,
  23168. globalSubrIndex: globalSubrIndex.obj,
  23169. fdSelect: cff.fdSelect,
  23170. fdArray: cff.fdArray,
  23171. privateDict: topDict.privateDict
  23172. });
  23173. cff.charStrings = charStringsAndSeacs.charStrings;
  23174. cff.seacs = charStringsAndSeacs.seacs;
  23175. cff.widths = charStringsAndSeacs.widths;
  23176. return cff;
  23177. }
  23178. parseHeader() {
  23179. let bytes = this.bytes;
  23180. const bytesLength = bytes.length;
  23181. let offset = 0;
  23182. while (offset < bytesLength && bytes[offset] !== 1) {
  23183. ++offset;
  23184. }
  23185. if (offset >= bytesLength) {
  23186. throw new _util.FormatError("Invalid CFF header");
  23187. }
  23188. if (offset !== 0) {
  23189. (0, _util.info)("cff data is shifted");
  23190. bytes = bytes.subarray(offset);
  23191. this.bytes = bytes;
  23192. }
  23193. const major = bytes[0];
  23194. const minor = bytes[1];
  23195. const hdrSize = bytes[2];
  23196. const offSize = bytes[3];
  23197. const header = new CFFHeader(major, minor, hdrSize, offSize);
  23198. return {
  23199. obj: header,
  23200. endPos: hdrSize
  23201. };
  23202. }
  23203. parseDict(dict) {
  23204. let pos = 0;
  23205. function parseOperand() {
  23206. let value = dict[pos++];
  23207. if (value === 30) {
  23208. return parseFloatOperand();
  23209. } else if (value === 28) {
  23210. value = dict[pos++];
  23211. value = (value << 24 | dict[pos++] << 16) >> 16;
  23212. return value;
  23213. } else if (value === 29) {
  23214. value = dict[pos++];
  23215. value = value << 8 | dict[pos++];
  23216. value = value << 8 | dict[pos++];
  23217. value = value << 8 | dict[pos++];
  23218. return value;
  23219. } else if (value >= 32 && value <= 246) {
  23220. return value - 139;
  23221. } else if (value >= 247 && value <= 250) {
  23222. return (value - 247) * 256 + dict[pos++] + 108;
  23223. } else if (value >= 251 && value <= 254) {
  23224. return -((value - 251) * 256) - dict[pos++] - 108;
  23225. }
  23226. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  23227. return NaN;
  23228. }
  23229. function parseFloatOperand() {
  23230. let str = "";
  23231. const eof = 15;
  23232. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  23233. const length = dict.length;
  23234. while (pos < length) {
  23235. const b = dict[pos++];
  23236. const b1 = b >> 4;
  23237. const b2 = b & 15;
  23238. if (b1 === eof) {
  23239. break;
  23240. }
  23241. str += lookup[b1];
  23242. if (b2 === eof) {
  23243. break;
  23244. }
  23245. str += lookup[b2];
  23246. }
  23247. return parseFloat(str);
  23248. }
  23249. let operands = [];
  23250. const entries = [];
  23251. pos = 0;
  23252. const end = dict.length;
  23253. while (pos < end) {
  23254. let b = dict[pos];
  23255. if (b <= 21) {
  23256. if (b === 12) {
  23257. b = b << 8 | dict[++pos];
  23258. }
  23259. entries.push([b, operands]);
  23260. operands = [];
  23261. ++pos;
  23262. } else {
  23263. operands.push(parseOperand());
  23264. }
  23265. }
  23266. return entries;
  23267. }
  23268. parseIndex(pos) {
  23269. const cffIndex = new CFFIndex();
  23270. const bytes = this.bytes;
  23271. const count = bytes[pos++] << 8 | bytes[pos++];
  23272. const offsets = [];
  23273. let end = pos;
  23274. let i, ii;
  23275. if (count !== 0) {
  23276. const offsetSize = bytes[pos++];
  23277. const startPos = pos + (count + 1) * offsetSize - 1;
  23278. for (i = 0, ii = count + 1; i < ii; ++i) {
  23279. let offset = 0;
  23280. for (let j = 0; j < offsetSize; ++j) {
  23281. offset <<= 8;
  23282. offset += bytes[pos++];
  23283. }
  23284. offsets.push(startPos + offset);
  23285. }
  23286. end = offsets[count];
  23287. }
  23288. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  23289. const offsetStart = offsets[i];
  23290. const offsetEnd = offsets[i + 1];
  23291. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  23292. }
  23293. return {
  23294. obj: cffIndex,
  23295. endPos: end
  23296. };
  23297. }
  23298. parseNameIndex(index) {
  23299. const names = [];
  23300. for (let i = 0, ii = index.count; i < ii; ++i) {
  23301. const name = index.get(i);
  23302. names.push((0, _util.bytesToString)(name));
  23303. }
  23304. return names;
  23305. }
  23306. parseStringIndex(index) {
  23307. const strings = new CFFStrings();
  23308. for (let i = 0, ii = index.count; i < ii; ++i) {
  23309. const data = index.get(i);
  23310. strings.add((0, _util.bytesToString)(data));
  23311. }
  23312. return strings;
  23313. }
  23314. createDict(Type, dict, strings) {
  23315. const cffDict = new Type(strings);
  23316. for (const [key, value] of dict) {
  23317. cffDict.setByKey(key, value);
  23318. }
  23319. return cffDict;
  23320. }
  23321. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  23322. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  23323. return false;
  23324. }
  23325. let stackSize = state.stackSize;
  23326. const stack = state.stack;
  23327. const length = data.length;
  23328. for (let j = 0; j < length;) {
  23329. const value = data[j++];
  23330. let validationCommand = null;
  23331. if (value === 12) {
  23332. const q = data[j++];
  23333. if (q === 0) {
  23334. data[j - 2] = 139;
  23335. data[j - 1] = 22;
  23336. stackSize = 0;
  23337. } else {
  23338. validationCommand = CharstringValidationData12[q];
  23339. }
  23340. } else if (value === 28) {
  23341. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  23342. j += 2;
  23343. stackSize++;
  23344. } else if (value === 14) {
  23345. if (stackSize >= 4) {
  23346. stackSize -= 4;
  23347. if (this.seacAnalysisEnabled) {
  23348. state.seac = stack.slice(stackSize, stackSize + 4);
  23349. return false;
  23350. }
  23351. }
  23352. validationCommand = CharstringValidationData[value];
  23353. } else if (value >= 32 && value <= 246) {
  23354. stack[stackSize] = value - 139;
  23355. stackSize++;
  23356. } else if (value >= 247 && value <= 254) {
  23357. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  23358. j++;
  23359. stackSize++;
  23360. } else if (value === 255) {
  23361. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  23362. j += 4;
  23363. stackSize++;
  23364. } else if (value === 19 || value === 20) {
  23365. state.hints += stackSize >> 1;
  23366. j += state.hints + 7 >> 3;
  23367. stackSize %= 2;
  23368. validationCommand = CharstringValidationData[value];
  23369. } else if (value === 10 || value === 29) {
  23370. let subrsIndex;
  23371. if (value === 10) {
  23372. subrsIndex = localSubrIndex;
  23373. } else {
  23374. subrsIndex = globalSubrIndex;
  23375. }
  23376. if (!subrsIndex) {
  23377. validationCommand = CharstringValidationData[value];
  23378. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23379. return false;
  23380. }
  23381. let bias = 32768;
  23382. if (subrsIndex.count < 1240) {
  23383. bias = 107;
  23384. } else if (subrsIndex.count < 33900) {
  23385. bias = 1131;
  23386. }
  23387. const subrNumber = stack[--stackSize] + bias;
  23388. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23389. validationCommand = CharstringValidationData[value];
  23390. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23391. return false;
  23392. }
  23393. state.stackSize = stackSize;
  23394. state.callDepth++;
  23395. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23396. if (!valid) {
  23397. return false;
  23398. }
  23399. state.callDepth--;
  23400. stackSize = state.stackSize;
  23401. continue;
  23402. } else if (value === 11) {
  23403. state.stackSize = stackSize;
  23404. return true;
  23405. } else if (value === 0 && j === data.length) {
  23406. data[j - 1] = 14;
  23407. validationCommand = CharstringValidationData[14];
  23408. } else {
  23409. validationCommand = CharstringValidationData[value];
  23410. }
  23411. if (validationCommand) {
  23412. if (validationCommand.stem) {
  23413. state.hints += stackSize >> 1;
  23414. if (value === 3 || value === 23) {
  23415. state.hasVStems = true;
  23416. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23417. (0, _util.warn)("CFF stem hints are in wrong order");
  23418. data[j - 1] = value === 1 ? 3 : 23;
  23419. }
  23420. }
  23421. if ("min" in validationCommand) {
  23422. if (!state.undefStack && stackSize < validationCommand.min) {
  23423. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23424. if (stackSize === 0) {
  23425. data[j - 1] = 14;
  23426. return true;
  23427. }
  23428. return false;
  23429. }
  23430. }
  23431. if (state.firstStackClearing && validationCommand.stackClearing) {
  23432. state.firstStackClearing = false;
  23433. stackSize -= validationCommand.min;
  23434. if (stackSize >= 2 && validationCommand.stem) {
  23435. stackSize %= 2;
  23436. } else if (stackSize > 1) {
  23437. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23438. }
  23439. if (stackSize > 0) {
  23440. state.width = stack[stackSize - 1];
  23441. }
  23442. }
  23443. if ("stackDelta" in validationCommand) {
  23444. if ("stackFn" in validationCommand) {
  23445. validationCommand.stackFn(stack, stackSize);
  23446. }
  23447. stackSize += validationCommand.stackDelta;
  23448. } else if (validationCommand.stackClearing) {
  23449. stackSize = 0;
  23450. } else if (validationCommand.resetStack) {
  23451. stackSize = 0;
  23452. state.undefStack = false;
  23453. } else if (validationCommand.undefStack) {
  23454. stackSize = 0;
  23455. state.undefStack = true;
  23456. state.firstStackClearing = false;
  23457. }
  23458. }
  23459. }
  23460. state.stackSize = stackSize;
  23461. return true;
  23462. }
  23463. parseCharStrings({
  23464. charStrings,
  23465. localSubrIndex,
  23466. globalSubrIndex,
  23467. fdSelect,
  23468. fdArray,
  23469. privateDict
  23470. }) {
  23471. const seacs = [];
  23472. const widths = [];
  23473. const count = charStrings.count;
  23474. for (let i = 0; i < count; i++) {
  23475. const charstring = charStrings.get(i);
  23476. const state = {
  23477. callDepth: 0,
  23478. stackSize: 0,
  23479. stack: [],
  23480. undefStack: true,
  23481. hints: 0,
  23482. firstStackClearing: true,
  23483. seac: null,
  23484. width: null,
  23485. hasVStems: false
  23486. };
  23487. let valid = true;
  23488. let localSubrToUse = null;
  23489. let privateDictToUse = privateDict;
  23490. if (fdSelect && fdArray.length) {
  23491. const fdIndex = fdSelect.getFDIndex(i);
  23492. if (fdIndex === -1) {
  23493. (0, _util.warn)("Glyph index is not in fd select.");
  23494. valid = false;
  23495. }
  23496. if (fdIndex >= fdArray.length) {
  23497. (0, _util.warn)("Invalid fd index for glyph index.");
  23498. valid = false;
  23499. }
  23500. if (valid) {
  23501. privateDictToUse = fdArray[fdIndex].privateDict;
  23502. localSubrToUse = privateDictToUse.subrsIndex;
  23503. }
  23504. } else if (localSubrIndex) {
  23505. localSubrToUse = localSubrIndex;
  23506. }
  23507. if (valid) {
  23508. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23509. }
  23510. if (state.width !== null) {
  23511. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23512. widths[i] = nominalWidth + state.width;
  23513. } else {
  23514. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23515. widths[i] = defaultWidth;
  23516. }
  23517. if (state.seac !== null) {
  23518. seacs[i] = state.seac;
  23519. }
  23520. if (!valid) {
  23521. charStrings.set(i, new Uint8Array([14]));
  23522. }
  23523. }
  23524. return {
  23525. charStrings,
  23526. seacs,
  23527. widths
  23528. };
  23529. }
  23530. emptyPrivateDictionary(parentDict) {
  23531. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23532. parentDict.setByKey(18, [0, 0]);
  23533. parentDict.privateDict = privateDict;
  23534. }
  23535. parsePrivateDict(parentDict) {
  23536. if (!parentDict.hasName("Private")) {
  23537. this.emptyPrivateDictionary(parentDict);
  23538. return;
  23539. }
  23540. const privateOffset = parentDict.getByName("Private");
  23541. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23542. parentDict.removeByName("Private");
  23543. return;
  23544. }
  23545. const size = privateOffset[0];
  23546. const offset = privateOffset[1];
  23547. if (size === 0 || offset >= this.bytes.length) {
  23548. this.emptyPrivateDictionary(parentDict);
  23549. return;
  23550. }
  23551. const privateDictEnd = offset + size;
  23552. const dictData = this.bytes.subarray(offset, privateDictEnd);
  23553. const dict = this.parseDict(dictData);
  23554. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23555. parentDict.privateDict = privateDict;
  23556. if (!privateDict.getByName("Subrs")) {
  23557. return;
  23558. }
  23559. const subrsOffset = privateDict.getByName("Subrs");
  23560. const relativeOffset = offset + subrsOffset;
  23561. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23562. this.emptyPrivateDictionary(parentDict);
  23563. return;
  23564. }
  23565. const subrsIndex = this.parseIndex(relativeOffset);
  23566. privateDict.subrsIndex = subrsIndex.obj;
  23567. }
  23568. parseCharsets(pos, length, strings, cid) {
  23569. if (pos === 0) {
  23570. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23571. } else if (pos === 1) {
  23572. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23573. } else if (pos === 2) {
  23574. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23575. }
  23576. const bytes = this.bytes;
  23577. const start = pos;
  23578. const format = bytes[pos++];
  23579. const charset = [cid ? 0 : ".notdef"];
  23580. let id, count, i;
  23581. length -= 1;
  23582. switch (format) {
  23583. case 0:
  23584. for (i = 0; i < length; i++) {
  23585. id = bytes[pos++] << 8 | bytes[pos++];
  23586. charset.push(cid ? id : strings.get(id));
  23587. }
  23588. break;
  23589. case 1:
  23590. while (charset.length <= length) {
  23591. id = bytes[pos++] << 8 | bytes[pos++];
  23592. count = bytes[pos++];
  23593. for (i = 0; i <= count; i++) {
  23594. charset.push(cid ? id++ : strings.get(id++));
  23595. }
  23596. }
  23597. break;
  23598. case 2:
  23599. while (charset.length <= length) {
  23600. id = bytes[pos++] << 8 | bytes[pos++];
  23601. count = bytes[pos++] << 8 | bytes[pos++];
  23602. for (i = 0; i <= count; i++) {
  23603. charset.push(cid ? id++ : strings.get(id++));
  23604. }
  23605. }
  23606. break;
  23607. default:
  23608. throw new _util.FormatError("Unknown charset format");
  23609. }
  23610. const end = pos;
  23611. const raw = bytes.subarray(start, end);
  23612. return new CFFCharset(false, format, charset, raw);
  23613. }
  23614. parseEncoding(pos, properties, strings, charset) {
  23615. const encoding = Object.create(null);
  23616. const bytes = this.bytes;
  23617. let predefined = false;
  23618. let format, i, ii;
  23619. let raw = null;
  23620. function readSupplement() {
  23621. const supplementsCount = bytes[pos++];
  23622. for (i = 0; i < supplementsCount; i++) {
  23623. const code = bytes[pos++];
  23624. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23625. encoding[code] = charset.indexOf(strings.get(sid));
  23626. }
  23627. }
  23628. if (pos === 0 || pos === 1) {
  23629. predefined = true;
  23630. format = pos;
  23631. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23632. for (i = 0, ii = charset.length; i < ii; i++) {
  23633. const index = baseEncoding.indexOf(charset[i]);
  23634. if (index !== -1) {
  23635. encoding[index] = i;
  23636. }
  23637. }
  23638. } else {
  23639. const dataStart = pos;
  23640. format = bytes[pos++];
  23641. switch (format & 0x7f) {
  23642. case 0:
  23643. const glyphsCount = bytes[pos++];
  23644. for (i = 1; i <= glyphsCount; i++) {
  23645. encoding[bytes[pos++]] = i;
  23646. }
  23647. break;
  23648. case 1:
  23649. const rangesCount = bytes[pos++];
  23650. let gid = 1;
  23651. for (i = 0; i < rangesCount; i++) {
  23652. const start = bytes[pos++];
  23653. const left = bytes[pos++];
  23654. for (let j = start; j <= start + left; j++) {
  23655. encoding[j] = gid++;
  23656. }
  23657. }
  23658. break;
  23659. default:
  23660. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23661. }
  23662. const dataEnd = pos;
  23663. if (format & 0x80) {
  23664. bytes[dataStart] &= 0x7f;
  23665. readSupplement();
  23666. }
  23667. raw = bytes.subarray(dataStart, dataEnd);
  23668. }
  23669. format &= 0x7f;
  23670. return new CFFEncoding(predefined, format, encoding, raw);
  23671. }
  23672. parseFDSelect(pos, length) {
  23673. const bytes = this.bytes;
  23674. const format = bytes[pos++];
  23675. const fdSelect = [];
  23676. let i;
  23677. switch (format) {
  23678. case 0:
  23679. for (i = 0; i < length; ++i) {
  23680. const id = bytes[pos++];
  23681. fdSelect.push(id);
  23682. }
  23683. break;
  23684. case 3:
  23685. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23686. for (i = 0; i < rangesCount; ++i) {
  23687. let first = bytes[pos++] << 8 | bytes[pos++];
  23688. if (i === 0 && first !== 0) {
  23689. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23690. first = 0;
  23691. }
  23692. const fdIndex = bytes[pos++];
  23693. const next = bytes[pos] << 8 | bytes[pos + 1];
  23694. for (let j = first; j < next; ++j) {
  23695. fdSelect.push(fdIndex);
  23696. }
  23697. }
  23698. pos += 2;
  23699. break;
  23700. default:
  23701. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23702. }
  23703. if (fdSelect.length !== length) {
  23704. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23705. }
  23706. return new CFFFDSelect(format, fdSelect);
  23707. }
  23708. }
  23709. exports.CFFParser = CFFParser;
  23710. class CFF {
  23711. constructor() {
  23712. this.header = null;
  23713. this.names = [];
  23714. this.topDict = null;
  23715. this.strings = new CFFStrings();
  23716. this.globalSubrIndex = null;
  23717. this.encoding = null;
  23718. this.charset = null;
  23719. this.charStrings = null;
  23720. this.fdArray = [];
  23721. this.fdSelect = null;
  23722. this.isCIDFont = false;
  23723. }
  23724. duplicateFirstGlyph() {
  23725. if (this.charStrings.count >= 65535) {
  23726. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23727. return;
  23728. }
  23729. const glyphZero = this.charStrings.get(0);
  23730. this.charStrings.add(glyphZero);
  23731. if (this.isCIDFont) {
  23732. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23733. }
  23734. }
  23735. hasGlyphId(id) {
  23736. if (id < 0 || id >= this.charStrings.count) {
  23737. return false;
  23738. }
  23739. const glyph = this.charStrings.get(id);
  23740. return glyph.length > 0;
  23741. }
  23742. }
  23743. exports.CFF = CFF;
  23744. class CFFHeader {
  23745. constructor(major, minor, hdrSize, offSize) {
  23746. this.major = major;
  23747. this.minor = minor;
  23748. this.hdrSize = hdrSize;
  23749. this.offSize = offSize;
  23750. }
  23751. }
  23752. exports.CFFHeader = CFFHeader;
  23753. class CFFStrings {
  23754. constructor() {
  23755. this.strings = [];
  23756. }
  23757. get(index) {
  23758. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23759. return CFFStandardStrings[index];
  23760. }
  23761. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23762. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23763. }
  23764. return CFFStandardStrings[0];
  23765. }
  23766. getSID(str) {
  23767. let index = CFFStandardStrings.indexOf(str);
  23768. if (index !== -1) {
  23769. return index;
  23770. }
  23771. index = this.strings.indexOf(str);
  23772. if (index !== -1) {
  23773. return index + NUM_STANDARD_CFF_STRINGS;
  23774. }
  23775. return -1;
  23776. }
  23777. add(value) {
  23778. this.strings.push(value);
  23779. }
  23780. get count() {
  23781. return this.strings.length;
  23782. }
  23783. }
  23784. exports.CFFStrings = CFFStrings;
  23785. class CFFIndex {
  23786. constructor() {
  23787. this.objects = [];
  23788. this.length = 0;
  23789. }
  23790. add(data) {
  23791. this.length += data.length;
  23792. this.objects.push(data);
  23793. }
  23794. set(index, data) {
  23795. this.length += data.length - this.objects[index].length;
  23796. this.objects[index] = data;
  23797. }
  23798. get(index) {
  23799. return this.objects[index];
  23800. }
  23801. get count() {
  23802. return this.objects.length;
  23803. }
  23804. }
  23805. exports.CFFIndex = CFFIndex;
  23806. class CFFDict {
  23807. constructor(tables, strings) {
  23808. this.keyToNameMap = tables.keyToNameMap;
  23809. this.nameToKeyMap = tables.nameToKeyMap;
  23810. this.defaults = tables.defaults;
  23811. this.types = tables.types;
  23812. this.opcodes = tables.opcodes;
  23813. this.order = tables.order;
  23814. this.strings = strings;
  23815. this.values = Object.create(null);
  23816. }
  23817. setByKey(key, value) {
  23818. if (!(key in this.keyToNameMap)) {
  23819. return false;
  23820. }
  23821. if (value.length === 0) {
  23822. return true;
  23823. }
  23824. for (const val of value) {
  23825. if (isNaN(val)) {
  23826. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  23827. return true;
  23828. }
  23829. }
  23830. const type = this.types[key];
  23831. if (type === "num" || type === "sid" || type === "offset") {
  23832. value = value[0];
  23833. }
  23834. this.values[key] = value;
  23835. return true;
  23836. }
  23837. setByName(name, value) {
  23838. if (!(name in this.nameToKeyMap)) {
  23839. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23840. }
  23841. this.values[this.nameToKeyMap[name]] = value;
  23842. }
  23843. hasName(name) {
  23844. return this.nameToKeyMap[name] in this.values;
  23845. }
  23846. getByName(name) {
  23847. if (!(name in this.nameToKeyMap)) {
  23848. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23849. }
  23850. const key = this.nameToKeyMap[name];
  23851. if (!(key in this.values)) {
  23852. return this.defaults[key];
  23853. }
  23854. return this.values[key];
  23855. }
  23856. removeByName(name) {
  23857. delete this.values[this.nameToKeyMap[name]];
  23858. }
  23859. static createTables(layout) {
  23860. const tables = {
  23861. keyToNameMap: {},
  23862. nameToKeyMap: {},
  23863. defaults: {},
  23864. types: {},
  23865. opcodes: {},
  23866. order: []
  23867. };
  23868. for (const entry of layout) {
  23869. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23870. tables.keyToNameMap[key] = entry[1];
  23871. tables.nameToKeyMap[entry[1]] = key;
  23872. tables.types[key] = entry[2];
  23873. tables.defaults[key] = entry[3];
  23874. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23875. tables.order.push(key);
  23876. }
  23877. return tables;
  23878. }
  23879. }
  23880. 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]];
  23881. class CFFTopDict extends CFFDict {
  23882. static get tables() {
  23883. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  23884. }
  23885. constructor(strings) {
  23886. super(CFFTopDict.tables, strings);
  23887. this.privateDict = null;
  23888. }
  23889. }
  23890. exports.CFFTopDict = CFFTopDict;
  23891. 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]];
  23892. class CFFPrivateDict extends CFFDict {
  23893. static get tables() {
  23894. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  23895. }
  23896. constructor(strings) {
  23897. super(CFFPrivateDict.tables, strings);
  23898. this.subrsIndex = null;
  23899. }
  23900. }
  23901. exports.CFFPrivateDict = CFFPrivateDict;
  23902. const CFFCharsetPredefinedTypes = {
  23903. ISO_ADOBE: 0,
  23904. EXPERT: 1,
  23905. EXPERT_SUBSET: 2
  23906. };
  23907. class CFFCharset {
  23908. constructor(predefined, format, charset, raw) {
  23909. this.predefined = predefined;
  23910. this.format = format;
  23911. this.charset = charset;
  23912. this.raw = raw;
  23913. }
  23914. }
  23915. exports.CFFCharset = CFFCharset;
  23916. class CFFEncoding {
  23917. constructor(predefined, format, encoding, raw) {
  23918. this.predefined = predefined;
  23919. this.format = format;
  23920. this.encoding = encoding;
  23921. this.raw = raw;
  23922. }
  23923. }
  23924. class CFFFDSelect {
  23925. constructor(format, fdSelect) {
  23926. this.format = format;
  23927. this.fdSelect = fdSelect;
  23928. }
  23929. getFDIndex(glyphIndex) {
  23930. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23931. return -1;
  23932. }
  23933. return this.fdSelect[glyphIndex];
  23934. }
  23935. }
  23936. exports.CFFFDSelect = CFFFDSelect;
  23937. class CFFOffsetTracker {
  23938. constructor() {
  23939. this.offsets = Object.create(null);
  23940. }
  23941. isTracking(key) {
  23942. return key in this.offsets;
  23943. }
  23944. track(key, location) {
  23945. if (key in this.offsets) {
  23946. throw new _util.FormatError(`Already tracking location of ${key}`);
  23947. }
  23948. this.offsets[key] = location;
  23949. }
  23950. offset(value) {
  23951. for (const key in this.offsets) {
  23952. this.offsets[key] += value;
  23953. }
  23954. }
  23955. setEntryLocation(key, values, output) {
  23956. if (!(key in this.offsets)) {
  23957. throw new _util.FormatError(`Not tracking location of ${key}`);
  23958. }
  23959. const data = output.data;
  23960. const dataOffset = this.offsets[key];
  23961. const size = 5;
  23962. for (let i = 0, ii = values.length; i < ii; ++i) {
  23963. const offset0 = i * size + dataOffset;
  23964. const offset1 = offset0 + 1;
  23965. const offset2 = offset0 + 2;
  23966. const offset3 = offset0 + 3;
  23967. const offset4 = offset0 + 4;
  23968. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23969. throw new _util.FormatError("writing to an offset that is not empty");
  23970. }
  23971. const value = values[i];
  23972. data[offset0] = 0x1d;
  23973. data[offset1] = value >> 24 & 0xff;
  23974. data[offset2] = value >> 16 & 0xff;
  23975. data[offset3] = value >> 8 & 0xff;
  23976. data[offset4] = value & 0xff;
  23977. }
  23978. }
  23979. }
  23980. class CFFCompiler {
  23981. constructor(cff) {
  23982. this.cff = cff;
  23983. }
  23984. compile() {
  23985. const cff = this.cff;
  23986. const output = {
  23987. data: [],
  23988. length: 0,
  23989. add(data) {
  23990. this.data = this.data.concat(data);
  23991. this.length = this.data.length;
  23992. }
  23993. };
  23994. const header = this.compileHeader(cff.header);
  23995. output.add(header);
  23996. const nameIndex = this.compileNameIndex(cff.names);
  23997. output.add(nameIndex);
  23998. if (cff.isCIDFont) {
  23999. if (cff.topDict.hasName("FontMatrix")) {
  24000. const base = cff.topDict.getByName("FontMatrix");
  24001. cff.topDict.removeByName("FontMatrix");
  24002. for (const subDict of cff.fdArray) {
  24003. let matrix = base.slice(0);
  24004. if (subDict.hasName("FontMatrix")) {
  24005. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  24006. }
  24007. subDict.setByName("FontMatrix", matrix);
  24008. }
  24009. }
  24010. }
  24011. const xuid = cff.topDict.getByName("XUID");
  24012. if (xuid && xuid.length > 16) {
  24013. cff.topDict.removeByName("XUID");
  24014. }
  24015. cff.topDict.setByName("charset", 0);
  24016. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  24017. output.add(compiled.output);
  24018. const topDictTracker = compiled.trackers[0];
  24019. const stringIndex = this.compileStringIndex(cff.strings.strings);
  24020. output.add(stringIndex);
  24021. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  24022. output.add(globalSubrIndex);
  24023. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  24024. if (cff.encoding.predefined) {
  24025. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  24026. } else {
  24027. const encoding = this.compileEncoding(cff.encoding);
  24028. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  24029. output.add(encoding);
  24030. }
  24031. }
  24032. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  24033. topDictTracker.setEntryLocation("charset", [output.length], output);
  24034. output.add(charset);
  24035. const charStrings = this.compileCharStrings(cff.charStrings);
  24036. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  24037. output.add(charStrings);
  24038. if (cff.isCIDFont) {
  24039. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  24040. const fdSelect = this.compileFDSelect(cff.fdSelect);
  24041. output.add(fdSelect);
  24042. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  24043. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  24044. output.add(compiled.output);
  24045. const fontDictTrackers = compiled.trackers;
  24046. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  24047. }
  24048. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  24049. output.add([0]);
  24050. return output.data;
  24051. }
  24052. encodeNumber(value) {
  24053. if (Number.isInteger(value)) {
  24054. return this.encodeInteger(value);
  24055. }
  24056. return this.encodeFloat(value);
  24057. }
  24058. static get EncodeFloatRegExp() {
  24059. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  24060. }
  24061. encodeFloat(num) {
  24062. let value = num.toString();
  24063. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  24064. if (m) {
  24065. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  24066. value = (Math.round(num * epsilon) / epsilon).toString();
  24067. }
  24068. let nibbles = "";
  24069. let i, ii;
  24070. for (i = 0, ii = value.length; i < ii; ++i) {
  24071. const a = value[i];
  24072. if (a === "e") {
  24073. nibbles += value[++i] === "-" ? "c" : "b";
  24074. } else if (a === ".") {
  24075. nibbles += "a";
  24076. } else if (a === "-") {
  24077. nibbles += "e";
  24078. } else {
  24079. nibbles += a;
  24080. }
  24081. }
  24082. nibbles += nibbles.length & 1 ? "f" : "ff";
  24083. const out = [30];
  24084. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  24085. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  24086. }
  24087. return out;
  24088. }
  24089. encodeInteger(value) {
  24090. let code;
  24091. if (value >= -107 && value <= 107) {
  24092. code = [value + 139];
  24093. } else if (value >= 108 && value <= 1131) {
  24094. value -= 108;
  24095. code = [(value >> 8) + 247, value & 0xff];
  24096. } else if (value >= -1131 && value <= -108) {
  24097. value = -value - 108;
  24098. code = [(value >> 8) + 251, value & 0xff];
  24099. } else if (value >= -32768 && value <= 32767) {
  24100. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  24101. } else {
  24102. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  24103. }
  24104. return code;
  24105. }
  24106. compileHeader(header) {
  24107. return [header.major, header.minor, 4, header.offSize];
  24108. }
  24109. compileNameIndex(names) {
  24110. const nameIndex = new CFFIndex();
  24111. for (const name of names) {
  24112. const length = Math.min(name.length, 127);
  24113. let sanitizedName = new Array(length);
  24114. for (let j = 0; j < length; j++) {
  24115. let char = name[j];
  24116. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  24117. char = "_";
  24118. }
  24119. sanitizedName[j] = char;
  24120. }
  24121. sanitizedName = sanitizedName.join("");
  24122. if (sanitizedName === "") {
  24123. sanitizedName = "Bad_Font_Name";
  24124. }
  24125. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  24126. }
  24127. return this.compileIndex(nameIndex);
  24128. }
  24129. compileTopDicts(dicts, length, removeCidKeys) {
  24130. const fontDictTrackers = [];
  24131. let fdArrayIndex = new CFFIndex();
  24132. for (const fontDict of dicts) {
  24133. if (removeCidKeys) {
  24134. fontDict.removeByName("CIDFontVersion");
  24135. fontDict.removeByName("CIDFontRevision");
  24136. fontDict.removeByName("CIDFontType");
  24137. fontDict.removeByName("CIDCount");
  24138. fontDict.removeByName("UIDBase");
  24139. }
  24140. const fontDictTracker = new CFFOffsetTracker();
  24141. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  24142. fontDictTrackers.push(fontDictTracker);
  24143. fdArrayIndex.add(fontDictData);
  24144. fontDictTracker.offset(length);
  24145. }
  24146. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  24147. return {
  24148. trackers: fontDictTrackers,
  24149. output: fdArrayIndex
  24150. };
  24151. }
  24152. compilePrivateDicts(dicts, trackers, output) {
  24153. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  24154. const fontDict = dicts[i];
  24155. const privateDict = fontDict.privateDict;
  24156. if (!privateDict || !fontDict.hasName("Private")) {
  24157. throw new _util.FormatError("There must be a private dictionary.");
  24158. }
  24159. const privateDictTracker = new CFFOffsetTracker();
  24160. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  24161. let outputLength = output.length;
  24162. privateDictTracker.offset(outputLength);
  24163. if (!privateDictData.length) {
  24164. outputLength = 0;
  24165. }
  24166. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  24167. output.add(privateDictData);
  24168. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  24169. const subrs = this.compileIndex(privateDict.subrsIndex);
  24170. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  24171. output.add(subrs);
  24172. }
  24173. }
  24174. }
  24175. compileDict(dict, offsetTracker) {
  24176. const out = [];
  24177. for (const key of dict.order) {
  24178. if (!(key in dict.values)) {
  24179. continue;
  24180. }
  24181. let values = dict.values[key];
  24182. let types = dict.types[key];
  24183. if (!Array.isArray(types)) {
  24184. types = [types];
  24185. }
  24186. if (!Array.isArray(values)) {
  24187. values = [values];
  24188. }
  24189. if (values.length === 0) {
  24190. continue;
  24191. }
  24192. for (let j = 0, jj = types.length; j < jj; ++j) {
  24193. const type = types[j];
  24194. const value = values[j];
  24195. switch (type) {
  24196. case "num":
  24197. case "sid":
  24198. out.push(...this.encodeNumber(value));
  24199. break;
  24200. case "offset":
  24201. const name = dict.keyToNameMap[key];
  24202. if (!offsetTracker.isTracking(name)) {
  24203. offsetTracker.track(name, out.length);
  24204. }
  24205. out.push(0x1d, 0, 0, 0, 0);
  24206. break;
  24207. case "array":
  24208. case "delta":
  24209. out.push(...this.encodeNumber(value));
  24210. for (let k = 1, kk = values.length; k < kk; ++k) {
  24211. out.push(...this.encodeNumber(values[k]));
  24212. }
  24213. break;
  24214. default:
  24215. throw new _util.FormatError(`Unknown data type of ${type}`);
  24216. }
  24217. }
  24218. out.push(...dict.opcodes[key]);
  24219. }
  24220. return out;
  24221. }
  24222. compileStringIndex(strings) {
  24223. const stringIndex = new CFFIndex();
  24224. for (const string of strings) {
  24225. stringIndex.add((0, _util.stringToBytes)(string));
  24226. }
  24227. return this.compileIndex(stringIndex);
  24228. }
  24229. compileGlobalSubrIndex() {
  24230. const globalSubrIndex = this.cff.globalSubrIndex;
  24231. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  24232. }
  24233. compileCharStrings(charStrings) {
  24234. const charStringsIndex = new CFFIndex();
  24235. for (let i = 0; i < charStrings.count; i++) {
  24236. const glyph = charStrings.get(i);
  24237. if (glyph.length === 0) {
  24238. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  24239. continue;
  24240. }
  24241. charStringsIndex.add(glyph);
  24242. }
  24243. return this.compileIndex(charStringsIndex);
  24244. }
  24245. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  24246. let out;
  24247. const numGlyphsLessNotDef = numGlyphs - 1;
  24248. if (isCIDFont) {
  24249. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  24250. } else {
  24251. const length = 1 + numGlyphsLessNotDef * 2;
  24252. out = new Uint8Array(length);
  24253. out[0] = 0;
  24254. let charsetIndex = 0;
  24255. const numCharsets = charset.charset.length;
  24256. let warned = false;
  24257. for (let i = 1; i < out.length; i += 2) {
  24258. let sid = 0;
  24259. if (charsetIndex < numCharsets) {
  24260. const name = charset.charset[charsetIndex++];
  24261. sid = strings.getSID(name);
  24262. if (sid === -1) {
  24263. sid = 0;
  24264. if (!warned) {
  24265. warned = true;
  24266. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  24267. }
  24268. }
  24269. }
  24270. out[i] = sid >> 8 & 0xff;
  24271. out[i + 1] = sid & 0xff;
  24272. }
  24273. }
  24274. return this.compileTypedArray(out);
  24275. }
  24276. compileEncoding(encoding) {
  24277. return this.compileTypedArray(encoding.raw);
  24278. }
  24279. compileFDSelect(fdSelect) {
  24280. const format = fdSelect.format;
  24281. let out, i;
  24282. switch (format) {
  24283. case 0:
  24284. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  24285. out[0] = format;
  24286. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  24287. out[i + 1] = fdSelect.fdSelect[i];
  24288. }
  24289. break;
  24290. case 3:
  24291. const start = 0;
  24292. let lastFD = fdSelect.fdSelect[0];
  24293. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  24294. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  24295. const currentFD = fdSelect.fdSelect[i];
  24296. if (currentFD !== lastFD) {
  24297. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  24298. lastFD = currentFD;
  24299. }
  24300. }
  24301. const numRanges = (ranges.length - 3) / 3;
  24302. ranges[1] = numRanges >> 8 & 0xff;
  24303. ranges[2] = numRanges & 0xff;
  24304. ranges.push(i >> 8 & 0xff, i & 0xff);
  24305. out = new Uint8Array(ranges);
  24306. break;
  24307. }
  24308. return this.compileTypedArray(out);
  24309. }
  24310. compileTypedArray(data) {
  24311. const out = [];
  24312. for (let i = 0, ii = data.length; i < ii; ++i) {
  24313. out[i] = data[i];
  24314. }
  24315. return out;
  24316. }
  24317. compileIndex(index, trackers = []) {
  24318. const objects = index.objects;
  24319. const count = objects.length;
  24320. if (count === 0) {
  24321. return [0, 0];
  24322. }
  24323. const data = [count >> 8 & 0xff, count & 0xff];
  24324. let lastOffset = 1,
  24325. i;
  24326. for (i = 0; i < count; ++i) {
  24327. lastOffset += objects[i].length;
  24328. }
  24329. let offsetSize;
  24330. if (lastOffset < 0x100) {
  24331. offsetSize = 1;
  24332. } else if (lastOffset < 0x10000) {
  24333. offsetSize = 2;
  24334. } else if (lastOffset < 0x1000000) {
  24335. offsetSize = 3;
  24336. } else {
  24337. offsetSize = 4;
  24338. }
  24339. data.push(offsetSize);
  24340. let relativeOffset = 1;
  24341. for (i = 0; i < count + 1; i++) {
  24342. if (offsetSize === 1) {
  24343. data.push(relativeOffset & 0xff);
  24344. } else if (offsetSize === 2) {
  24345. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24346. } else if (offsetSize === 3) {
  24347. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24348. } else {
  24349. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24350. }
  24351. if (objects[i]) {
  24352. relativeOffset += objects[i].length;
  24353. }
  24354. }
  24355. for (i = 0; i < count; i++) {
  24356. if (trackers[i]) {
  24357. trackers[i].offset(data.length);
  24358. }
  24359. data.push(...objects[i]);
  24360. }
  24361. return data;
  24362. }
  24363. }
  24364. exports.CFFCompiler = CFFCompiler;
  24365. /***/ }),
  24366. /* 34 */
  24367. /***/ ((__unused_webpack_module, exports) => {
  24368. Object.defineProperty(exports, "__esModule", ({
  24369. value: true
  24370. }));
  24371. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  24372. 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"];
  24373. exports.ISOAdobeCharset = ISOAdobeCharset;
  24374. 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"];
  24375. exports.ExpertCharset = ExpertCharset;
  24376. 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"];
  24377. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24378. /***/ }),
  24379. /* 35 */
  24380. /***/ ((__unused_webpack_module, exports) => {
  24381. Object.defineProperty(exports, "__esModule", ({
  24382. value: true
  24383. }));
  24384. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  24385. exports.getEncoding = getEncoding;
  24386. 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"];
  24387. exports.ExpertEncoding = ExpertEncoding;
  24388. 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", "", "", "", ""];
  24389. 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"];
  24390. exports.MacRomanEncoding = MacRomanEncoding;
  24391. 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", "", "", "", ""];
  24392. exports.StandardEncoding = StandardEncoding;
  24393. 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"];
  24394. exports.WinAnsiEncoding = WinAnsiEncoding;
  24395. 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", ""];
  24396. exports.SymbolSetEncoding = SymbolSetEncoding;
  24397. 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", ""];
  24398. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24399. function getEncoding(encodingName) {
  24400. switch (encodingName) {
  24401. case "WinAnsiEncoding":
  24402. return WinAnsiEncoding;
  24403. case "StandardEncoding":
  24404. return StandardEncoding;
  24405. case "MacRomanEncoding":
  24406. return MacRomanEncoding;
  24407. case "SymbolSetEncoding":
  24408. return SymbolSetEncoding;
  24409. case "ZapfDingbatsEncoding":
  24410. return ZapfDingbatsEncoding;
  24411. case "ExpertEncoding":
  24412. return ExpertEncoding;
  24413. case "MacExpertEncoding":
  24414. return MacExpertEncoding;
  24415. default:
  24416. return null;
  24417. }
  24418. }
  24419. /***/ }),
  24420. /* 36 */
  24421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24422. Object.defineProperty(exports, "__esModule", ({
  24423. value: true
  24424. }));
  24425. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  24426. exports.getFontType = getFontType;
  24427. exports.normalizeFontName = normalizeFontName;
  24428. exports.recoverGlyphName = recoverGlyphName;
  24429. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  24430. var _util = __w_pdfjs_require__(2);
  24431. var _encodings = __w_pdfjs_require__(35);
  24432. var _glyphlist = __w_pdfjs_require__(37);
  24433. var _unicode = __w_pdfjs_require__(38);
  24434. const SEAC_ANALYSIS_ENABLED = true;
  24435. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  24436. const FontFlags = {
  24437. FixedPitch: 1,
  24438. Serif: 2,
  24439. Symbolic: 4,
  24440. Script: 8,
  24441. Nonsymbolic: 32,
  24442. Italic: 64,
  24443. AllCap: 65536,
  24444. SmallCap: 131072,
  24445. ForceBold: 262144
  24446. };
  24447. exports.FontFlags = FontFlags;
  24448. 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"];
  24449. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  24450. function getFontType(type, subtype, isStandardFont = false) {
  24451. switch (type) {
  24452. case "Type1":
  24453. if (isStandardFont) {
  24454. return _util.FontType.TYPE1STANDARD;
  24455. }
  24456. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  24457. case "CIDFontType0":
  24458. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  24459. case "OpenType":
  24460. return _util.FontType.OPENTYPE;
  24461. case "TrueType":
  24462. return _util.FontType.TRUETYPE;
  24463. case "CIDFontType2":
  24464. return _util.FontType.CIDFONTTYPE2;
  24465. case "MMType1":
  24466. return _util.FontType.MMTYPE1;
  24467. case "Type0":
  24468. return _util.FontType.TYPE0;
  24469. default:
  24470. return _util.FontType.UNKNOWN;
  24471. }
  24472. }
  24473. function recoverGlyphName(name, glyphsUnicodeMap) {
  24474. if (glyphsUnicodeMap[name] !== undefined) {
  24475. return name;
  24476. }
  24477. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  24478. if (unicode !== -1) {
  24479. for (const key in glyphsUnicodeMap) {
  24480. if (glyphsUnicodeMap[key] === unicode) {
  24481. return key;
  24482. }
  24483. }
  24484. }
  24485. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  24486. return name;
  24487. }
  24488. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24489. const charCodeToGlyphId = Object.create(null);
  24490. let glyphId, charCode, baseEncoding;
  24491. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24492. if (properties.isInternalFont) {
  24493. baseEncoding = builtInEncoding;
  24494. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24495. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24496. if (glyphId >= 0) {
  24497. charCodeToGlyphId[charCode] = glyphId;
  24498. } else {
  24499. charCodeToGlyphId[charCode] = 0;
  24500. }
  24501. }
  24502. } else if (properties.baseEncodingName) {
  24503. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24504. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24505. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24506. if (glyphId >= 0) {
  24507. charCodeToGlyphId[charCode] = glyphId;
  24508. } else {
  24509. charCodeToGlyphId[charCode] = 0;
  24510. }
  24511. }
  24512. } else if (isSymbolicFont) {
  24513. for (charCode in builtInEncoding) {
  24514. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24515. }
  24516. } else {
  24517. baseEncoding = _encodings.StandardEncoding;
  24518. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24519. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24520. if (glyphId >= 0) {
  24521. charCodeToGlyphId[charCode] = glyphId;
  24522. } else {
  24523. charCodeToGlyphId[charCode] = 0;
  24524. }
  24525. }
  24526. }
  24527. const differences = properties.differences;
  24528. let glyphsUnicodeMap;
  24529. if (differences) {
  24530. for (charCode in differences) {
  24531. const glyphName = differences[charCode];
  24532. glyphId = glyphNames.indexOf(glyphName);
  24533. if (glyphId === -1) {
  24534. if (!glyphsUnicodeMap) {
  24535. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24536. }
  24537. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24538. if (standardGlyphName !== glyphName) {
  24539. glyphId = glyphNames.indexOf(standardGlyphName);
  24540. }
  24541. }
  24542. if (glyphId >= 0) {
  24543. charCodeToGlyphId[charCode] = glyphId;
  24544. } else {
  24545. charCodeToGlyphId[charCode] = 0;
  24546. }
  24547. }
  24548. }
  24549. return charCodeToGlyphId;
  24550. }
  24551. function normalizeFontName(name) {
  24552. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  24553. }
  24554. /***/ }),
  24555. /* 37 */
  24556. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  24557. __w_pdfjs_require__.r(__webpack_exports__);
  24558. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  24559. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  24560. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  24561. /* harmony export */ });
  24562. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  24563. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  24564. return [
  24565. "A",
  24566. 0x0041,
  24567. "AE",
  24568. 0x00c6,
  24569. "AEacute",
  24570. 0x01fc,
  24571. "AEmacron",
  24572. 0x01e2,
  24573. "AEsmall",
  24574. 0xf7e6,
  24575. "Aacute",
  24576. 0x00c1,
  24577. "Aacutesmall",
  24578. 0xf7e1,
  24579. "Abreve",
  24580. 0x0102,
  24581. "Abreveacute",
  24582. 0x1eae,
  24583. "Abrevecyrillic",
  24584. 0x04d0,
  24585. "Abrevedotbelow",
  24586. 0x1eb6,
  24587. "Abrevegrave",
  24588. 0x1eb0,
  24589. "Abrevehookabove",
  24590. 0x1eb2,
  24591. "Abrevetilde",
  24592. 0x1eb4,
  24593. "Acaron",
  24594. 0x01cd,
  24595. "Acircle",
  24596. 0x24b6,
  24597. "Acircumflex",
  24598. 0x00c2,
  24599. "Acircumflexacute",
  24600. 0x1ea4,
  24601. "Acircumflexdotbelow",
  24602. 0x1eac,
  24603. "Acircumflexgrave",
  24604. 0x1ea6,
  24605. "Acircumflexhookabove",
  24606. 0x1ea8,
  24607. "Acircumflexsmall",
  24608. 0xf7e2,
  24609. "Acircumflextilde",
  24610. 0x1eaa,
  24611. "Acute",
  24612. 0xf6c9,
  24613. "Acutesmall",
  24614. 0xf7b4,
  24615. "Acyrillic",
  24616. 0x0410,
  24617. "Adblgrave",
  24618. 0x0200,
  24619. "Adieresis",
  24620. 0x00c4,
  24621. "Adieresiscyrillic",
  24622. 0x04d2,
  24623. "Adieresismacron",
  24624. 0x01de,
  24625. "Adieresissmall",
  24626. 0xf7e4,
  24627. "Adotbelow",
  24628. 0x1ea0,
  24629. "Adotmacron",
  24630. 0x01e0,
  24631. "Agrave",
  24632. 0x00c0,
  24633. "Agravesmall",
  24634. 0xf7e0,
  24635. "Ahookabove",
  24636. 0x1ea2,
  24637. "Aiecyrillic",
  24638. 0x04d4,
  24639. "Ainvertedbreve",
  24640. 0x0202,
  24641. "Alpha",
  24642. 0x0391,
  24643. "Alphatonos",
  24644. 0x0386,
  24645. "Amacron",
  24646. 0x0100,
  24647. "Amonospace",
  24648. 0xff21,
  24649. "Aogonek",
  24650. 0x0104,
  24651. "Aring",
  24652. 0x00c5,
  24653. "Aringacute",
  24654. 0x01fa,
  24655. "Aringbelow",
  24656. 0x1e00,
  24657. "Aringsmall",
  24658. 0xf7e5,
  24659. "Asmall",
  24660. 0xf761,
  24661. "Atilde",
  24662. 0x00c3,
  24663. "Atildesmall",
  24664. 0xf7e3,
  24665. "Aybarmenian",
  24666. 0x0531,
  24667. "B",
  24668. 0x0042,
  24669. "Bcircle",
  24670. 0x24b7,
  24671. "Bdotaccent",
  24672. 0x1e02,
  24673. "Bdotbelow",
  24674. 0x1e04,
  24675. "Becyrillic",
  24676. 0x0411,
  24677. "Benarmenian",
  24678. 0x0532,
  24679. "Beta",
  24680. 0x0392,
  24681. "Bhook",
  24682. 0x0181,
  24683. "Blinebelow",
  24684. 0x1e06,
  24685. "Bmonospace",
  24686. 0xff22,
  24687. "Brevesmall",
  24688. 0xf6f4,
  24689. "Bsmall",
  24690. 0xf762,
  24691. "Btopbar",
  24692. 0x0182,
  24693. "C",
  24694. 0x0043,
  24695. "Caarmenian",
  24696. 0x053e,
  24697. "Cacute",
  24698. 0x0106,
  24699. "Caron",
  24700. 0xf6ca,
  24701. "Caronsmall",
  24702. 0xf6f5,
  24703. "Ccaron",
  24704. 0x010c,
  24705. "Ccedilla",
  24706. 0x00c7,
  24707. "Ccedillaacute",
  24708. 0x1e08,
  24709. "Ccedillasmall",
  24710. 0xf7e7,
  24711. "Ccircle",
  24712. 0x24b8,
  24713. "Ccircumflex",
  24714. 0x0108,
  24715. "Cdot",
  24716. 0x010a,
  24717. "Cdotaccent",
  24718. 0x010a,
  24719. "Cedillasmall",
  24720. 0xf7b8,
  24721. "Chaarmenian",
  24722. 0x0549,
  24723. "Cheabkhasiancyrillic",
  24724. 0x04bc,
  24725. "Checyrillic",
  24726. 0x0427,
  24727. "Chedescenderabkhasiancyrillic",
  24728. 0x04be,
  24729. "Chedescendercyrillic",
  24730. 0x04b6,
  24731. "Chedieresiscyrillic",
  24732. 0x04f4,
  24733. "Cheharmenian",
  24734. 0x0543,
  24735. "Chekhakassiancyrillic",
  24736. 0x04cb,
  24737. "Cheverticalstrokecyrillic",
  24738. 0x04b8,
  24739. "Chi",
  24740. 0x03a7,
  24741. "Chook",
  24742. 0x0187,
  24743. "Circumflexsmall",
  24744. 0xf6f6,
  24745. "Cmonospace",
  24746. 0xff23,
  24747. "Coarmenian",
  24748. 0x0551,
  24749. "Csmall",
  24750. 0xf763,
  24751. "D",
  24752. 0x0044,
  24753. "DZ",
  24754. 0x01f1,
  24755. "DZcaron",
  24756. 0x01c4,
  24757. "Daarmenian",
  24758. 0x0534,
  24759. "Dafrican",
  24760. 0x0189,
  24761. "Dcaron",
  24762. 0x010e,
  24763. "Dcedilla",
  24764. 0x1e10,
  24765. "Dcircle",
  24766. 0x24b9,
  24767. "Dcircumflexbelow",
  24768. 0x1e12,
  24769. "Dcroat",
  24770. 0x0110,
  24771. "Ddotaccent",
  24772. 0x1e0a,
  24773. "Ddotbelow",
  24774. 0x1e0c,
  24775. "Decyrillic",
  24776. 0x0414,
  24777. "Deicoptic",
  24778. 0x03ee,
  24779. "Delta",
  24780. 0x2206,
  24781. "Deltagreek",
  24782. 0x0394,
  24783. "Dhook",
  24784. 0x018a,
  24785. "Dieresis",
  24786. 0xf6cb,
  24787. "DieresisAcute",
  24788. 0xf6cc,
  24789. "DieresisGrave",
  24790. 0xf6cd,
  24791. "Dieresissmall",
  24792. 0xf7a8,
  24793. "Digammagreek",
  24794. 0x03dc,
  24795. "Djecyrillic",
  24796. 0x0402,
  24797. "Dlinebelow",
  24798. 0x1e0e,
  24799. "Dmonospace",
  24800. 0xff24,
  24801. "Dotaccentsmall",
  24802. 0xf6f7,
  24803. "Dslash",
  24804. 0x0110,
  24805. "Dsmall",
  24806. 0xf764,
  24807. "Dtopbar",
  24808. 0x018b,
  24809. "Dz",
  24810. 0x01f2,
  24811. "Dzcaron",
  24812. 0x01c5,
  24813. "Dzeabkhasiancyrillic",
  24814. 0x04e0,
  24815. "Dzecyrillic",
  24816. 0x0405,
  24817. "Dzhecyrillic",
  24818. 0x040f,
  24819. "E",
  24820. 0x0045,
  24821. "Eacute",
  24822. 0x00c9,
  24823. "Eacutesmall",
  24824. 0xf7e9,
  24825. "Ebreve",
  24826. 0x0114,
  24827. "Ecaron",
  24828. 0x011a,
  24829. "Ecedillabreve",
  24830. 0x1e1c,
  24831. "Echarmenian",
  24832. 0x0535,
  24833. "Ecircle",
  24834. 0x24ba,
  24835. "Ecircumflex",
  24836. 0x00ca,
  24837. "Ecircumflexacute",
  24838. 0x1ebe,
  24839. "Ecircumflexbelow",
  24840. 0x1e18,
  24841. "Ecircumflexdotbelow",
  24842. 0x1ec6,
  24843. "Ecircumflexgrave",
  24844. 0x1ec0,
  24845. "Ecircumflexhookabove",
  24846. 0x1ec2,
  24847. "Ecircumflexsmall",
  24848. 0xf7ea,
  24849. "Ecircumflextilde",
  24850. 0x1ec4,
  24851. "Ecyrillic",
  24852. 0x0404,
  24853. "Edblgrave",
  24854. 0x0204,
  24855. "Edieresis",
  24856. 0x00cb,
  24857. "Edieresissmall",
  24858. 0xf7eb,
  24859. "Edot",
  24860. 0x0116,
  24861. "Edotaccent",
  24862. 0x0116,
  24863. "Edotbelow",
  24864. 0x1eb8,
  24865. "Efcyrillic",
  24866. 0x0424,
  24867. "Egrave",
  24868. 0x00c8,
  24869. "Egravesmall",
  24870. 0xf7e8,
  24871. "Eharmenian",
  24872. 0x0537,
  24873. "Ehookabove",
  24874. 0x1eba,
  24875. "Eightroman",
  24876. 0x2167,
  24877. "Einvertedbreve",
  24878. 0x0206,
  24879. "Eiotifiedcyrillic",
  24880. 0x0464,
  24881. "Elcyrillic",
  24882. 0x041b,
  24883. "Elevenroman",
  24884. 0x216a,
  24885. "Emacron",
  24886. 0x0112,
  24887. "Emacronacute",
  24888. 0x1e16,
  24889. "Emacrongrave",
  24890. 0x1e14,
  24891. "Emcyrillic",
  24892. 0x041c,
  24893. "Emonospace",
  24894. 0xff25,
  24895. "Encyrillic",
  24896. 0x041d,
  24897. "Endescendercyrillic",
  24898. 0x04a2,
  24899. "Eng",
  24900. 0x014a,
  24901. "Enghecyrillic",
  24902. 0x04a4,
  24903. "Enhookcyrillic",
  24904. 0x04c7,
  24905. "Eogonek",
  24906. 0x0118,
  24907. "Eopen",
  24908. 0x0190,
  24909. "Epsilon",
  24910. 0x0395,
  24911. "Epsilontonos",
  24912. 0x0388,
  24913. "Ercyrillic",
  24914. 0x0420,
  24915. "Ereversed",
  24916. 0x018e,
  24917. "Ereversedcyrillic",
  24918. 0x042d,
  24919. "Escyrillic",
  24920. 0x0421,
  24921. "Esdescendercyrillic",
  24922. 0x04aa,
  24923. "Esh",
  24924. 0x01a9,
  24925. "Esmall",
  24926. 0xf765,
  24927. "Eta",
  24928. 0x0397,
  24929. "Etarmenian",
  24930. 0x0538,
  24931. "Etatonos",
  24932. 0x0389,
  24933. "Eth",
  24934. 0x00d0,
  24935. "Ethsmall",
  24936. 0xf7f0,
  24937. "Etilde",
  24938. 0x1ebc,
  24939. "Etildebelow",
  24940. 0x1e1a,
  24941. "Euro",
  24942. 0x20ac,
  24943. "Ezh",
  24944. 0x01b7,
  24945. "Ezhcaron",
  24946. 0x01ee,
  24947. "Ezhreversed",
  24948. 0x01b8,
  24949. "F",
  24950. 0x0046,
  24951. "Fcircle",
  24952. 0x24bb,
  24953. "Fdotaccent",
  24954. 0x1e1e,
  24955. "Feharmenian",
  24956. 0x0556,
  24957. "Feicoptic",
  24958. 0x03e4,
  24959. "Fhook",
  24960. 0x0191,
  24961. "Fitacyrillic",
  24962. 0x0472,
  24963. "Fiveroman",
  24964. 0x2164,
  24965. "Fmonospace",
  24966. 0xff26,
  24967. "Fourroman",
  24968. 0x2163,
  24969. "Fsmall",
  24970. 0xf766,
  24971. "G",
  24972. 0x0047,
  24973. "GBsquare",
  24974. 0x3387,
  24975. "Gacute",
  24976. 0x01f4,
  24977. "Gamma",
  24978. 0x0393,
  24979. "Gammaafrican",
  24980. 0x0194,
  24981. "Gangiacoptic",
  24982. 0x03ea,
  24983. "Gbreve",
  24984. 0x011e,
  24985. "Gcaron",
  24986. 0x01e6,
  24987. "Gcedilla",
  24988. 0x0122,
  24989. "Gcircle",
  24990. 0x24bc,
  24991. "Gcircumflex",
  24992. 0x011c,
  24993. "Gcommaaccent",
  24994. 0x0122,
  24995. "Gdot",
  24996. 0x0120,
  24997. "Gdotaccent",
  24998. 0x0120,
  24999. "Gecyrillic",
  25000. 0x0413,
  25001. "Ghadarmenian",
  25002. 0x0542,
  25003. "Ghemiddlehookcyrillic",
  25004. 0x0494,
  25005. "Ghestrokecyrillic",
  25006. 0x0492,
  25007. "Gheupturncyrillic",
  25008. 0x0490,
  25009. "Ghook",
  25010. 0x0193,
  25011. "Gimarmenian",
  25012. 0x0533,
  25013. "Gjecyrillic",
  25014. 0x0403,
  25015. "Gmacron",
  25016. 0x1e20,
  25017. "Gmonospace",
  25018. 0xff27,
  25019. "Grave",
  25020. 0xf6ce,
  25021. "Gravesmall",
  25022. 0xf760,
  25023. "Gsmall",
  25024. 0xf767,
  25025. "Gsmallhook",
  25026. 0x029b,
  25027. "Gstroke",
  25028. 0x01e4,
  25029. "H",
  25030. 0x0048,
  25031. "H18533",
  25032. 0x25cf,
  25033. "H18543",
  25034. 0x25aa,
  25035. "H18551",
  25036. 0x25ab,
  25037. "H22073",
  25038. 0x25a1,
  25039. "HPsquare",
  25040. 0x33cb,
  25041. "Haabkhasiancyrillic",
  25042. 0x04a8,
  25043. "Hadescendercyrillic",
  25044. 0x04b2,
  25045. "Hardsigncyrillic",
  25046. 0x042a,
  25047. "Hbar",
  25048. 0x0126,
  25049. "Hbrevebelow",
  25050. 0x1e2a,
  25051. "Hcedilla",
  25052. 0x1e28,
  25053. "Hcircle",
  25054. 0x24bd,
  25055. "Hcircumflex",
  25056. 0x0124,
  25057. "Hdieresis",
  25058. 0x1e26,
  25059. "Hdotaccent",
  25060. 0x1e22,
  25061. "Hdotbelow",
  25062. 0x1e24,
  25063. "Hmonospace",
  25064. 0xff28,
  25065. "Hoarmenian",
  25066. 0x0540,
  25067. "Horicoptic",
  25068. 0x03e8,
  25069. "Hsmall",
  25070. 0xf768,
  25071. "Hungarumlaut",
  25072. 0xf6cf,
  25073. "Hungarumlautsmall",
  25074. 0xf6f8,
  25075. "Hzsquare",
  25076. 0x3390,
  25077. "I",
  25078. 0x0049,
  25079. "IAcyrillic",
  25080. 0x042f,
  25081. "IJ",
  25082. 0x0132,
  25083. "IUcyrillic",
  25084. 0x042e,
  25085. "Iacute",
  25086. 0x00cd,
  25087. "Iacutesmall",
  25088. 0xf7ed,
  25089. "Ibreve",
  25090. 0x012c,
  25091. "Icaron",
  25092. 0x01cf,
  25093. "Icircle",
  25094. 0x24be,
  25095. "Icircumflex",
  25096. 0x00ce,
  25097. "Icircumflexsmall",
  25098. 0xf7ee,
  25099. "Icyrillic",
  25100. 0x0406,
  25101. "Idblgrave",
  25102. 0x0208,
  25103. "Idieresis",
  25104. 0x00cf,
  25105. "Idieresisacute",
  25106. 0x1e2e,
  25107. "Idieresiscyrillic",
  25108. 0x04e4,
  25109. "Idieresissmall",
  25110. 0xf7ef,
  25111. "Idot",
  25112. 0x0130,
  25113. "Idotaccent",
  25114. 0x0130,
  25115. "Idotbelow",
  25116. 0x1eca,
  25117. "Iebrevecyrillic",
  25118. 0x04d6,
  25119. "Iecyrillic",
  25120. 0x0415,
  25121. "Ifraktur",
  25122. 0x2111,
  25123. "Igrave",
  25124. 0x00cc,
  25125. "Igravesmall",
  25126. 0xf7ec,
  25127. "Ihookabove",
  25128. 0x1ec8,
  25129. "Iicyrillic",
  25130. 0x0418,
  25131. "Iinvertedbreve",
  25132. 0x020a,
  25133. "Iishortcyrillic",
  25134. 0x0419,
  25135. "Imacron",
  25136. 0x012a,
  25137. "Imacroncyrillic",
  25138. 0x04e2,
  25139. "Imonospace",
  25140. 0xff29,
  25141. "Iniarmenian",
  25142. 0x053b,
  25143. "Iocyrillic",
  25144. 0x0401,
  25145. "Iogonek",
  25146. 0x012e,
  25147. "Iota",
  25148. 0x0399,
  25149. "Iotaafrican",
  25150. 0x0196,
  25151. "Iotadieresis",
  25152. 0x03aa,
  25153. "Iotatonos",
  25154. 0x038a,
  25155. "Ismall",
  25156. 0xf769,
  25157. "Istroke",
  25158. 0x0197,
  25159. "Itilde",
  25160. 0x0128,
  25161. "Itildebelow",
  25162. 0x1e2c,
  25163. "Izhitsacyrillic",
  25164. 0x0474,
  25165. "Izhitsadblgravecyrillic",
  25166. 0x0476,
  25167. "J",
  25168. 0x004a,
  25169. "Jaarmenian",
  25170. 0x0541,
  25171. "Jcircle",
  25172. 0x24bf,
  25173. "Jcircumflex",
  25174. 0x0134,
  25175. "Jecyrillic",
  25176. 0x0408,
  25177. "Jheharmenian",
  25178. 0x054b,
  25179. "Jmonospace",
  25180. 0xff2a,
  25181. "Jsmall",
  25182. 0xf76a,
  25183. "K",
  25184. 0x004b,
  25185. "KBsquare",
  25186. 0x3385,
  25187. "KKsquare",
  25188. 0x33cd,
  25189. "Kabashkircyrillic",
  25190. 0x04a0,
  25191. "Kacute",
  25192. 0x1e30,
  25193. "Kacyrillic",
  25194. 0x041a,
  25195. "Kadescendercyrillic",
  25196. 0x049a,
  25197. "Kahookcyrillic",
  25198. 0x04c3,
  25199. "Kappa",
  25200. 0x039a,
  25201. "Kastrokecyrillic",
  25202. 0x049e,
  25203. "Kaverticalstrokecyrillic",
  25204. 0x049c,
  25205. "Kcaron",
  25206. 0x01e8,
  25207. "Kcedilla",
  25208. 0x0136,
  25209. "Kcircle",
  25210. 0x24c0,
  25211. "Kcommaaccent",
  25212. 0x0136,
  25213. "Kdotbelow",
  25214. 0x1e32,
  25215. "Keharmenian",
  25216. 0x0554,
  25217. "Kenarmenian",
  25218. 0x053f,
  25219. "Khacyrillic",
  25220. 0x0425,
  25221. "Kheicoptic",
  25222. 0x03e6,
  25223. "Khook",
  25224. 0x0198,
  25225. "Kjecyrillic",
  25226. 0x040c,
  25227. "Klinebelow",
  25228. 0x1e34,
  25229. "Kmonospace",
  25230. 0xff2b,
  25231. "Koppacyrillic",
  25232. 0x0480,
  25233. "Koppagreek",
  25234. 0x03de,
  25235. "Ksicyrillic",
  25236. 0x046e,
  25237. "Ksmall",
  25238. 0xf76b,
  25239. "L",
  25240. 0x004c,
  25241. "LJ",
  25242. 0x01c7,
  25243. "LL",
  25244. 0xf6bf,
  25245. "Lacute",
  25246. 0x0139,
  25247. "Lambda",
  25248. 0x039b,
  25249. "Lcaron",
  25250. 0x013d,
  25251. "Lcedilla",
  25252. 0x013b,
  25253. "Lcircle",
  25254. 0x24c1,
  25255. "Lcircumflexbelow",
  25256. 0x1e3c,
  25257. "Lcommaaccent",
  25258. 0x013b,
  25259. "Ldot",
  25260. 0x013f,
  25261. "Ldotaccent",
  25262. 0x013f,
  25263. "Ldotbelow",
  25264. 0x1e36,
  25265. "Ldotbelowmacron",
  25266. 0x1e38,
  25267. "Liwnarmenian",
  25268. 0x053c,
  25269. "Lj",
  25270. 0x01c8,
  25271. "Ljecyrillic",
  25272. 0x0409,
  25273. "Llinebelow",
  25274. 0x1e3a,
  25275. "Lmonospace",
  25276. 0xff2c,
  25277. "Lslash",
  25278. 0x0141,
  25279. "Lslashsmall",
  25280. 0xf6f9,
  25281. "Lsmall",
  25282. 0xf76c,
  25283. "M",
  25284. 0x004d,
  25285. "MBsquare",
  25286. 0x3386,
  25287. "Macron",
  25288. 0xf6d0,
  25289. "Macronsmall",
  25290. 0xf7af,
  25291. "Macute",
  25292. 0x1e3e,
  25293. "Mcircle",
  25294. 0x24c2,
  25295. "Mdotaccent",
  25296. 0x1e40,
  25297. "Mdotbelow",
  25298. 0x1e42,
  25299. "Menarmenian",
  25300. 0x0544,
  25301. "Mmonospace",
  25302. 0xff2d,
  25303. "Msmall",
  25304. 0xf76d,
  25305. "Mturned",
  25306. 0x019c,
  25307. "Mu",
  25308. 0x039c,
  25309. "N",
  25310. 0x004e,
  25311. "NJ",
  25312. 0x01ca,
  25313. "Nacute",
  25314. 0x0143,
  25315. "Ncaron",
  25316. 0x0147,
  25317. "Ncedilla",
  25318. 0x0145,
  25319. "Ncircle",
  25320. 0x24c3,
  25321. "Ncircumflexbelow",
  25322. 0x1e4a,
  25323. "Ncommaaccent",
  25324. 0x0145,
  25325. "Ndotaccent",
  25326. 0x1e44,
  25327. "Ndotbelow",
  25328. 0x1e46,
  25329. "Nhookleft",
  25330. 0x019d,
  25331. "Nineroman",
  25332. 0x2168,
  25333. "Nj",
  25334. 0x01cb,
  25335. "Njecyrillic",
  25336. 0x040a,
  25337. "Nlinebelow",
  25338. 0x1e48,
  25339. "Nmonospace",
  25340. 0xff2e,
  25341. "Nowarmenian",
  25342. 0x0546,
  25343. "Nsmall",
  25344. 0xf76e,
  25345. "Ntilde",
  25346. 0x00d1,
  25347. "Ntildesmall",
  25348. 0xf7f1,
  25349. "Nu",
  25350. 0x039d,
  25351. "O",
  25352. 0x004f,
  25353. "OE",
  25354. 0x0152,
  25355. "OEsmall",
  25356. 0xf6fa,
  25357. "Oacute",
  25358. 0x00d3,
  25359. "Oacutesmall",
  25360. 0xf7f3,
  25361. "Obarredcyrillic",
  25362. 0x04e8,
  25363. "Obarreddieresiscyrillic",
  25364. 0x04ea,
  25365. "Obreve",
  25366. 0x014e,
  25367. "Ocaron",
  25368. 0x01d1,
  25369. "Ocenteredtilde",
  25370. 0x019f,
  25371. "Ocircle",
  25372. 0x24c4,
  25373. "Ocircumflex",
  25374. 0x00d4,
  25375. "Ocircumflexacute",
  25376. 0x1ed0,
  25377. "Ocircumflexdotbelow",
  25378. 0x1ed8,
  25379. "Ocircumflexgrave",
  25380. 0x1ed2,
  25381. "Ocircumflexhookabove",
  25382. 0x1ed4,
  25383. "Ocircumflexsmall",
  25384. 0xf7f4,
  25385. "Ocircumflextilde",
  25386. 0x1ed6,
  25387. "Ocyrillic",
  25388. 0x041e,
  25389. "Odblacute",
  25390. 0x0150,
  25391. "Odblgrave",
  25392. 0x020c,
  25393. "Odieresis",
  25394. 0x00d6,
  25395. "Odieresiscyrillic",
  25396. 0x04e6,
  25397. "Odieresissmall",
  25398. 0xf7f6,
  25399. "Odotbelow",
  25400. 0x1ecc,
  25401. "Ogoneksmall",
  25402. 0xf6fb,
  25403. "Ograve",
  25404. 0x00d2,
  25405. "Ogravesmall",
  25406. 0xf7f2,
  25407. "Oharmenian",
  25408. 0x0555,
  25409. "Ohm",
  25410. 0x2126,
  25411. "Ohookabove",
  25412. 0x1ece,
  25413. "Ohorn",
  25414. 0x01a0,
  25415. "Ohornacute",
  25416. 0x1eda,
  25417. "Ohorndotbelow",
  25418. 0x1ee2,
  25419. "Ohorngrave",
  25420. 0x1edc,
  25421. "Ohornhookabove",
  25422. 0x1ede,
  25423. "Ohorntilde",
  25424. 0x1ee0,
  25425. "Ohungarumlaut",
  25426. 0x0150,
  25427. "Oi",
  25428. 0x01a2,
  25429. "Oinvertedbreve",
  25430. 0x020e,
  25431. "Omacron",
  25432. 0x014c,
  25433. "Omacronacute",
  25434. 0x1e52,
  25435. "Omacrongrave",
  25436. 0x1e50,
  25437. "Omega",
  25438. 0x2126,
  25439. "Omegacyrillic",
  25440. 0x0460,
  25441. "Omegagreek",
  25442. 0x03a9,
  25443. "Omegaroundcyrillic",
  25444. 0x047a,
  25445. "Omegatitlocyrillic",
  25446. 0x047c,
  25447. "Omegatonos",
  25448. 0x038f,
  25449. "Omicron",
  25450. 0x039f,
  25451. "Omicrontonos",
  25452. 0x038c,
  25453. "Omonospace",
  25454. 0xff2f,
  25455. "Oneroman",
  25456. 0x2160,
  25457. "Oogonek",
  25458. 0x01ea,
  25459. "Oogonekmacron",
  25460. 0x01ec,
  25461. "Oopen",
  25462. 0x0186,
  25463. "Oslash",
  25464. 0x00d8,
  25465. "Oslashacute",
  25466. 0x01fe,
  25467. "Oslashsmall",
  25468. 0xf7f8,
  25469. "Osmall",
  25470. 0xf76f,
  25471. "Ostrokeacute",
  25472. 0x01fe,
  25473. "Otcyrillic",
  25474. 0x047e,
  25475. "Otilde",
  25476. 0x00d5,
  25477. "Otildeacute",
  25478. 0x1e4c,
  25479. "Otildedieresis",
  25480. 0x1e4e,
  25481. "Otildesmall",
  25482. 0xf7f5,
  25483. "P",
  25484. 0x0050,
  25485. "Pacute",
  25486. 0x1e54,
  25487. "Pcircle",
  25488. 0x24c5,
  25489. "Pdotaccent",
  25490. 0x1e56,
  25491. "Pecyrillic",
  25492. 0x041f,
  25493. "Peharmenian",
  25494. 0x054a,
  25495. "Pemiddlehookcyrillic",
  25496. 0x04a6,
  25497. "Phi",
  25498. 0x03a6,
  25499. "Phook",
  25500. 0x01a4,
  25501. "Pi",
  25502. 0x03a0,
  25503. "Piwrarmenian",
  25504. 0x0553,
  25505. "Pmonospace",
  25506. 0xff30,
  25507. "Psi",
  25508. 0x03a8,
  25509. "Psicyrillic",
  25510. 0x0470,
  25511. "Psmall",
  25512. 0xf770,
  25513. "Q",
  25514. 0x0051,
  25515. "Qcircle",
  25516. 0x24c6,
  25517. "Qmonospace",
  25518. 0xff31,
  25519. "Qsmall",
  25520. 0xf771,
  25521. "R",
  25522. 0x0052,
  25523. "Raarmenian",
  25524. 0x054c,
  25525. "Racute",
  25526. 0x0154,
  25527. "Rcaron",
  25528. 0x0158,
  25529. "Rcedilla",
  25530. 0x0156,
  25531. "Rcircle",
  25532. 0x24c7,
  25533. "Rcommaaccent",
  25534. 0x0156,
  25535. "Rdblgrave",
  25536. 0x0210,
  25537. "Rdotaccent",
  25538. 0x1e58,
  25539. "Rdotbelow",
  25540. 0x1e5a,
  25541. "Rdotbelowmacron",
  25542. 0x1e5c,
  25543. "Reharmenian",
  25544. 0x0550,
  25545. "Rfraktur",
  25546. 0x211c,
  25547. "Rho",
  25548. 0x03a1,
  25549. "Ringsmall",
  25550. 0xf6fc,
  25551. "Rinvertedbreve",
  25552. 0x0212,
  25553. "Rlinebelow",
  25554. 0x1e5e,
  25555. "Rmonospace",
  25556. 0xff32,
  25557. "Rsmall",
  25558. 0xf772,
  25559. "Rsmallinverted",
  25560. 0x0281,
  25561. "Rsmallinvertedsuperior",
  25562. 0x02b6,
  25563. "S",
  25564. 0x0053,
  25565. "SF010000",
  25566. 0x250c,
  25567. "SF020000",
  25568. 0x2514,
  25569. "SF030000",
  25570. 0x2510,
  25571. "SF040000",
  25572. 0x2518,
  25573. "SF050000",
  25574. 0x253c,
  25575. "SF060000",
  25576. 0x252c,
  25577. "SF070000",
  25578. 0x2534,
  25579. "SF080000",
  25580. 0x251c,
  25581. "SF090000",
  25582. 0x2524,
  25583. "SF100000",
  25584. 0x2500,
  25585. "SF110000",
  25586. 0x2502,
  25587. "SF190000",
  25588. 0x2561,
  25589. "SF200000",
  25590. 0x2562,
  25591. "SF210000",
  25592. 0x2556,
  25593. "SF220000",
  25594. 0x2555,
  25595. "SF230000",
  25596. 0x2563,
  25597. "SF240000",
  25598. 0x2551,
  25599. "SF250000",
  25600. 0x2557,
  25601. "SF260000",
  25602. 0x255d,
  25603. "SF270000",
  25604. 0x255c,
  25605. "SF280000",
  25606. 0x255b,
  25607. "SF360000",
  25608. 0x255e,
  25609. "SF370000",
  25610. 0x255f,
  25611. "SF380000",
  25612. 0x255a,
  25613. "SF390000",
  25614. 0x2554,
  25615. "SF400000",
  25616. 0x2569,
  25617. "SF410000",
  25618. 0x2566,
  25619. "SF420000",
  25620. 0x2560,
  25621. "SF430000",
  25622. 0x2550,
  25623. "SF440000",
  25624. 0x256c,
  25625. "SF450000",
  25626. 0x2567,
  25627. "SF460000",
  25628. 0x2568,
  25629. "SF470000",
  25630. 0x2564,
  25631. "SF480000",
  25632. 0x2565,
  25633. "SF490000",
  25634. 0x2559,
  25635. "SF500000",
  25636. 0x2558,
  25637. "SF510000",
  25638. 0x2552,
  25639. "SF520000",
  25640. 0x2553,
  25641. "SF530000",
  25642. 0x256b,
  25643. "SF540000",
  25644. 0x256a,
  25645. "Sacute",
  25646. 0x015a,
  25647. "Sacutedotaccent",
  25648. 0x1e64,
  25649. "Sampigreek",
  25650. 0x03e0,
  25651. "Scaron",
  25652. 0x0160,
  25653. "Scarondotaccent",
  25654. 0x1e66,
  25655. "Scaronsmall",
  25656. 0xf6fd,
  25657. "Scedilla",
  25658. 0x015e,
  25659. "Schwa",
  25660. 0x018f,
  25661. "Schwacyrillic",
  25662. 0x04d8,
  25663. "Schwadieresiscyrillic",
  25664. 0x04da,
  25665. "Scircle",
  25666. 0x24c8,
  25667. "Scircumflex",
  25668. 0x015c,
  25669. "Scommaaccent",
  25670. 0x0218,
  25671. "Sdotaccent",
  25672. 0x1e60,
  25673. "Sdotbelow",
  25674. 0x1e62,
  25675. "Sdotbelowdotaccent",
  25676. 0x1e68,
  25677. "Seharmenian",
  25678. 0x054d,
  25679. "Sevenroman",
  25680. 0x2166,
  25681. "Shaarmenian",
  25682. 0x0547,
  25683. "Shacyrillic",
  25684. 0x0428,
  25685. "Shchacyrillic",
  25686. 0x0429,
  25687. "Sheicoptic",
  25688. 0x03e2,
  25689. "Shhacyrillic",
  25690. 0x04ba,
  25691. "Shimacoptic",
  25692. 0x03ec,
  25693. "Sigma",
  25694. 0x03a3,
  25695. "Sixroman",
  25696. 0x2165,
  25697. "Smonospace",
  25698. 0xff33,
  25699. "Softsigncyrillic",
  25700. 0x042c,
  25701. "Ssmall",
  25702. 0xf773,
  25703. "Stigmagreek",
  25704. 0x03da,
  25705. "T",
  25706. 0x0054,
  25707. "Tau",
  25708. 0x03a4,
  25709. "Tbar",
  25710. 0x0166,
  25711. "Tcaron",
  25712. 0x0164,
  25713. "Tcedilla",
  25714. 0x0162,
  25715. "Tcircle",
  25716. 0x24c9,
  25717. "Tcircumflexbelow",
  25718. 0x1e70,
  25719. "Tcommaaccent",
  25720. 0x0162,
  25721. "Tdotaccent",
  25722. 0x1e6a,
  25723. "Tdotbelow",
  25724. 0x1e6c,
  25725. "Tecyrillic",
  25726. 0x0422,
  25727. "Tedescendercyrillic",
  25728. 0x04ac,
  25729. "Tenroman",
  25730. 0x2169,
  25731. "Tetsecyrillic",
  25732. 0x04b4,
  25733. "Theta",
  25734. 0x0398,
  25735. "Thook",
  25736. 0x01ac,
  25737. "Thorn",
  25738. 0x00de,
  25739. "Thornsmall",
  25740. 0xf7fe,
  25741. "Threeroman",
  25742. 0x2162,
  25743. "Tildesmall",
  25744. 0xf6fe,
  25745. "Tiwnarmenian",
  25746. 0x054f,
  25747. "Tlinebelow",
  25748. 0x1e6e,
  25749. "Tmonospace",
  25750. 0xff34,
  25751. "Toarmenian",
  25752. 0x0539,
  25753. "Tonefive",
  25754. 0x01bc,
  25755. "Tonesix",
  25756. 0x0184,
  25757. "Tonetwo",
  25758. 0x01a7,
  25759. "Tretroflexhook",
  25760. 0x01ae,
  25761. "Tsecyrillic",
  25762. 0x0426,
  25763. "Tshecyrillic",
  25764. 0x040b,
  25765. "Tsmall",
  25766. 0xf774,
  25767. "Twelveroman",
  25768. 0x216b,
  25769. "Tworoman",
  25770. 0x2161,
  25771. "U",
  25772. 0x0055,
  25773. "Uacute",
  25774. 0x00da,
  25775. "Uacutesmall",
  25776. 0xf7fa,
  25777. "Ubreve",
  25778. 0x016c,
  25779. "Ucaron",
  25780. 0x01d3,
  25781. "Ucircle",
  25782. 0x24ca,
  25783. "Ucircumflex",
  25784. 0x00db,
  25785. "Ucircumflexbelow",
  25786. 0x1e76,
  25787. "Ucircumflexsmall",
  25788. 0xf7fb,
  25789. "Ucyrillic",
  25790. 0x0423,
  25791. "Udblacute",
  25792. 0x0170,
  25793. "Udblgrave",
  25794. 0x0214,
  25795. "Udieresis",
  25796. 0x00dc,
  25797. "Udieresisacute",
  25798. 0x01d7,
  25799. "Udieresisbelow",
  25800. 0x1e72,
  25801. "Udieresiscaron",
  25802. 0x01d9,
  25803. "Udieresiscyrillic",
  25804. 0x04f0,
  25805. "Udieresisgrave",
  25806. 0x01db,
  25807. "Udieresismacron",
  25808. 0x01d5,
  25809. "Udieresissmall",
  25810. 0xf7fc,
  25811. "Udotbelow",
  25812. 0x1ee4,
  25813. "Ugrave",
  25814. 0x00d9,
  25815. "Ugravesmall",
  25816. 0xf7f9,
  25817. "Uhookabove",
  25818. 0x1ee6,
  25819. "Uhorn",
  25820. 0x01af,
  25821. "Uhornacute",
  25822. 0x1ee8,
  25823. "Uhorndotbelow",
  25824. 0x1ef0,
  25825. "Uhorngrave",
  25826. 0x1eea,
  25827. "Uhornhookabove",
  25828. 0x1eec,
  25829. "Uhorntilde",
  25830. 0x1eee,
  25831. "Uhungarumlaut",
  25832. 0x0170,
  25833. "Uhungarumlautcyrillic",
  25834. 0x04f2,
  25835. "Uinvertedbreve",
  25836. 0x0216,
  25837. "Ukcyrillic",
  25838. 0x0478,
  25839. "Umacron",
  25840. 0x016a,
  25841. "Umacroncyrillic",
  25842. 0x04ee,
  25843. "Umacrondieresis",
  25844. 0x1e7a,
  25845. "Umonospace",
  25846. 0xff35,
  25847. "Uogonek",
  25848. 0x0172,
  25849. "Upsilon",
  25850. 0x03a5,
  25851. "Upsilon1",
  25852. 0x03d2,
  25853. "Upsilonacutehooksymbolgreek",
  25854. 0x03d3,
  25855. "Upsilonafrican",
  25856. 0x01b1,
  25857. "Upsilondieresis",
  25858. 0x03ab,
  25859. "Upsilondieresishooksymbolgreek",
  25860. 0x03d4,
  25861. "Upsilonhooksymbol",
  25862. 0x03d2,
  25863. "Upsilontonos",
  25864. 0x038e,
  25865. "Uring",
  25866. 0x016e,
  25867. "Ushortcyrillic",
  25868. 0x040e,
  25869. "Usmall",
  25870. 0xf775,
  25871. "Ustraightcyrillic",
  25872. 0x04ae,
  25873. "Ustraightstrokecyrillic",
  25874. 0x04b0,
  25875. "Utilde",
  25876. 0x0168,
  25877. "Utildeacute",
  25878. 0x1e78,
  25879. "Utildebelow",
  25880. 0x1e74,
  25881. "V",
  25882. 0x0056,
  25883. "Vcircle",
  25884. 0x24cb,
  25885. "Vdotbelow",
  25886. 0x1e7e,
  25887. "Vecyrillic",
  25888. 0x0412,
  25889. "Vewarmenian",
  25890. 0x054e,
  25891. "Vhook",
  25892. 0x01b2,
  25893. "Vmonospace",
  25894. 0xff36,
  25895. "Voarmenian",
  25896. 0x0548,
  25897. "Vsmall",
  25898. 0xf776,
  25899. "Vtilde",
  25900. 0x1e7c,
  25901. "W",
  25902. 0x0057,
  25903. "Wacute",
  25904. 0x1e82,
  25905. "Wcircle",
  25906. 0x24cc,
  25907. "Wcircumflex",
  25908. 0x0174,
  25909. "Wdieresis",
  25910. 0x1e84,
  25911. "Wdotaccent",
  25912. 0x1e86,
  25913. "Wdotbelow",
  25914. 0x1e88,
  25915. "Wgrave",
  25916. 0x1e80,
  25917. "Wmonospace",
  25918. 0xff37,
  25919. "Wsmall",
  25920. 0xf777,
  25921. "X",
  25922. 0x0058,
  25923. "Xcircle",
  25924. 0x24cd,
  25925. "Xdieresis",
  25926. 0x1e8c,
  25927. "Xdotaccent",
  25928. 0x1e8a,
  25929. "Xeharmenian",
  25930. 0x053d,
  25931. "Xi",
  25932. 0x039e,
  25933. "Xmonospace",
  25934. 0xff38,
  25935. "Xsmall",
  25936. 0xf778,
  25937. "Y",
  25938. 0x0059,
  25939. "Yacute",
  25940. 0x00dd,
  25941. "Yacutesmall",
  25942. 0xf7fd,
  25943. "Yatcyrillic",
  25944. 0x0462,
  25945. "Ycircle",
  25946. 0x24ce,
  25947. "Ycircumflex",
  25948. 0x0176,
  25949. "Ydieresis",
  25950. 0x0178,
  25951. "Ydieresissmall",
  25952. 0xf7ff,
  25953. "Ydotaccent",
  25954. 0x1e8e,
  25955. "Ydotbelow",
  25956. 0x1ef4,
  25957. "Yericyrillic",
  25958. 0x042b,
  25959. "Yerudieresiscyrillic",
  25960. 0x04f8,
  25961. "Ygrave",
  25962. 0x1ef2,
  25963. "Yhook",
  25964. 0x01b3,
  25965. "Yhookabove",
  25966. 0x1ef6,
  25967. "Yiarmenian",
  25968. 0x0545,
  25969. "Yicyrillic",
  25970. 0x0407,
  25971. "Yiwnarmenian",
  25972. 0x0552,
  25973. "Ymonospace",
  25974. 0xff39,
  25975. "Ysmall",
  25976. 0xf779,
  25977. "Ytilde",
  25978. 0x1ef8,
  25979. "Yusbigcyrillic",
  25980. 0x046a,
  25981. "Yusbigiotifiedcyrillic",
  25982. 0x046c,
  25983. "Yuslittlecyrillic",
  25984. 0x0466,
  25985. "Yuslittleiotifiedcyrillic",
  25986. 0x0468,
  25987. "Z",
  25988. 0x005a,
  25989. "Zaarmenian",
  25990. 0x0536,
  25991. "Zacute",
  25992. 0x0179,
  25993. "Zcaron",
  25994. 0x017d,
  25995. "Zcaronsmall",
  25996. 0xf6ff,
  25997. "Zcircle",
  25998. 0x24cf,
  25999. "Zcircumflex",
  26000. 0x1e90,
  26001. "Zdot",
  26002. 0x017b,
  26003. "Zdotaccent",
  26004. 0x017b,
  26005. "Zdotbelow",
  26006. 0x1e92,
  26007. "Zecyrillic",
  26008. 0x0417,
  26009. "Zedescendercyrillic",
  26010. 0x0498,
  26011. "Zedieresiscyrillic",
  26012. 0x04de,
  26013. "Zeta",
  26014. 0x0396,
  26015. "Zhearmenian",
  26016. 0x053a,
  26017. "Zhebrevecyrillic",
  26018. 0x04c1,
  26019. "Zhecyrillic",
  26020. 0x0416,
  26021. "Zhedescendercyrillic",
  26022. 0x0496,
  26023. "Zhedieresiscyrillic",
  26024. 0x04dc,
  26025. "Zlinebelow",
  26026. 0x1e94,
  26027. "Zmonospace",
  26028. 0xff3a,
  26029. "Zsmall",
  26030. 0xf77a,
  26031. "Zstroke",
  26032. 0x01b5,
  26033. "a",
  26034. 0x0061,
  26035. "aabengali",
  26036. 0x0986,
  26037. "aacute",
  26038. 0x00e1,
  26039. "aadeva",
  26040. 0x0906,
  26041. "aagujarati",
  26042. 0x0a86,
  26043. "aagurmukhi",
  26044. 0x0a06,
  26045. "aamatragurmukhi",
  26046. 0x0a3e,
  26047. "aarusquare",
  26048. 0x3303,
  26049. "aavowelsignbengali",
  26050. 0x09be,
  26051. "aavowelsigndeva",
  26052. 0x093e,
  26053. "aavowelsigngujarati",
  26054. 0x0abe,
  26055. "abbreviationmarkarmenian",
  26056. 0x055f,
  26057. "abbreviationsigndeva",
  26058. 0x0970,
  26059. "abengali",
  26060. 0x0985,
  26061. "abopomofo",
  26062. 0x311a,
  26063. "abreve",
  26064. 0x0103,
  26065. "abreveacute",
  26066. 0x1eaf,
  26067. "abrevecyrillic",
  26068. 0x04d1,
  26069. "abrevedotbelow",
  26070. 0x1eb7,
  26071. "abrevegrave",
  26072. 0x1eb1,
  26073. "abrevehookabove",
  26074. 0x1eb3,
  26075. "abrevetilde",
  26076. 0x1eb5,
  26077. "acaron",
  26078. 0x01ce,
  26079. "acircle",
  26080. 0x24d0,
  26081. "acircumflex",
  26082. 0x00e2,
  26083. "acircumflexacute",
  26084. 0x1ea5,
  26085. "acircumflexdotbelow",
  26086. 0x1ead,
  26087. "acircumflexgrave",
  26088. 0x1ea7,
  26089. "acircumflexhookabove",
  26090. 0x1ea9,
  26091. "acircumflextilde",
  26092. 0x1eab,
  26093. "acute",
  26094. 0x00b4,
  26095. "acutebelowcmb",
  26096. 0x0317,
  26097. "acutecmb",
  26098. 0x0301,
  26099. "acutecomb",
  26100. 0x0301,
  26101. "acutedeva",
  26102. 0x0954,
  26103. "acutelowmod",
  26104. 0x02cf,
  26105. "acutetonecmb",
  26106. 0x0341,
  26107. "acyrillic",
  26108. 0x0430,
  26109. "adblgrave",
  26110. 0x0201,
  26111. "addakgurmukhi",
  26112. 0x0a71,
  26113. "adeva",
  26114. 0x0905,
  26115. "adieresis",
  26116. 0x00e4,
  26117. "adieresiscyrillic",
  26118. 0x04d3,
  26119. "adieresismacron",
  26120. 0x01df,
  26121. "adotbelow",
  26122. 0x1ea1,
  26123. "adotmacron",
  26124. 0x01e1,
  26125. "ae",
  26126. 0x00e6,
  26127. "aeacute",
  26128. 0x01fd,
  26129. "aekorean",
  26130. 0x3150,
  26131. "aemacron",
  26132. 0x01e3,
  26133. "afii00208",
  26134. 0x2015,
  26135. "afii08941",
  26136. 0x20a4,
  26137. "afii10017",
  26138. 0x0410,
  26139. "afii10018",
  26140. 0x0411,
  26141. "afii10019",
  26142. 0x0412,
  26143. "afii10020",
  26144. 0x0413,
  26145. "afii10021",
  26146. 0x0414,
  26147. "afii10022",
  26148. 0x0415,
  26149. "afii10023",
  26150. 0x0401,
  26151. "afii10024",
  26152. 0x0416,
  26153. "afii10025",
  26154. 0x0417,
  26155. "afii10026",
  26156. 0x0418,
  26157. "afii10027",
  26158. 0x0419,
  26159. "afii10028",
  26160. 0x041a,
  26161. "afii10029",
  26162. 0x041b,
  26163. "afii10030",
  26164. 0x041c,
  26165. "afii10031",
  26166. 0x041d,
  26167. "afii10032",
  26168. 0x041e,
  26169. "afii10033",
  26170. 0x041f,
  26171. "afii10034",
  26172. 0x0420,
  26173. "afii10035",
  26174. 0x0421,
  26175. "afii10036",
  26176. 0x0422,
  26177. "afii10037",
  26178. 0x0423,
  26179. "afii10038",
  26180. 0x0424,
  26181. "afii10039",
  26182. 0x0425,
  26183. "afii10040",
  26184. 0x0426,
  26185. "afii10041",
  26186. 0x0427,
  26187. "afii10042",
  26188. 0x0428,
  26189. "afii10043",
  26190. 0x0429,
  26191. "afii10044",
  26192. 0x042a,
  26193. "afii10045",
  26194. 0x042b,
  26195. "afii10046",
  26196. 0x042c,
  26197. "afii10047",
  26198. 0x042d,
  26199. "afii10048",
  26200. 0x042e,
  26201. "afii10049",
  26202. 0x042f,
  26203. "afii10050",
  26204. 0x0490,
  26205. "afii10051",
  26206. 0x0402,
  26207. "afii10052",
  26208. 0x0403,
  26209. "afii10053",
  26210. 0x0404,
  26211. "afii10054",
  26212. 0x0405,
  26213. "afii10055",
  26214. 0x0406,
  26215. "afii10056",
  26216. 0x0407,
  26217. "afii10057",
  26218. 0x0408,
  26219. "afii10058",
  26220. 0x0409,
  26221. "afii10059",
  26222. 0x040a,
  26223. "afii10060",
  26224. 0x040b,
  26225. "afii10061",
  26226. 0x040c,
  26227. "afii10062",
  26228. 0x040e,
  26229. "afii10063",
  26230. 0xf6c4,
  26231. "afii10064",
  26232. 0xf6c5,
  26233. "afii10065",
  26234. 0x0430,
  26235. "afii10066",
  26236. 0x0431,
  26237. "afii10067",
  26238. 0x0432,
  26239. "afii10068",
  26240. 0x0433,
  26241. "afii10069",
  26242. 0x0434,
  26243. "afii10070",
  26244. 0x0435,
  26245. "afii10071",
  26246. 0x0451,
  26247. "afii10072",
  26248. 0x0436,
  26249. "afii10073",
  26250. 0x0437,
  26251. "afii10074",
  26252. 0x0438,
  26253. "afii10075",
  26254. 0x0439,
  26255. "afii10076",
  26256. 0x043a,
  26257. "afii10077",
  26258. 0x043b,
  26259. "afii10078",
  26260. 0x043c,
  26261. "afii10079",
  26262. 0x043d,
  26263. "afii10080",
  26264. 0x043e,
  26265. "afii10081",
  26266. 0x043f,
  26267. "afii10082",
  26268. 0x0440,
  26269. "afii10083",
  26270. 0x0441,
  26271. "afii10084",
  26272. 0x0442,
  26273. "afii10085",
  26274. 0x0443,
  26275. "afii10086",
  26276. 0x0444,
  26277. "afii10087",
  26278. 0x0445,
  26279. "afii10088",
  26280. 0x0446,
  26281. "afii10089",
  26282. 0x0447,
  26283. "afii10090",
  26284. 0x0448,
  26285. "afii10091",
  26286. 0x0449,
  26287. "afii10092",
  26288. 0x044a,
  26289. "afii10093",
  26290. 0x044b,
  26291. "afii10094",
  26292. 0x044c,
  26293. "afii10095",
  26294. 0x044d,
  26295. "afii10096",
  26296. 0x044e,
  26297. "afii10097",
  26298. 0x044f,
  26299. "afii10098",
  26300. 0x0491,
  26301. "afii10099",
  26302. 0x0452,
  26303. "afii10100",
  26304. 0x0453,
  26305. "afii10101",
  26306. 0x0454,
  26307. "afii10102",
  26308. 0x0455,
  26309. "afii10103",
  26310. 0x0456,
  26311. "afii10104",
  26312. 0x0457,
  26313. "afii10105",
  26314. 0x0458,
  26315. "afii10106",
  26316. 0x0459,
  26317. "afii10107",
  26318. 0x045a,
  26319. "afii10108",
  26320. 0x045b,
  26321. "afii10109",
  26322. 0x045c,
  26323. "afii10110",
  26324. 0x045e,
  26325. "afii10145",
  26326. 0x040f,
  26327. "afii10146",
  26328. 0x0462,
  26329. "afii10147",
  26330. 0x0472,
  26331. "afii10148",
  26332. 0x0474,
  26333. "afii10192",
  26334. 0xf6c6,
  26335. "afii10193",
  26336. 0x045f,
  26337. "afii10194",
  26338. 0x0463,
  26339. "afii10195",
  26340. 0x0473,
  26341. "afii10196",
  26342. 0x0475,
  26343. "afii10831",
  26344. 0xf6c7,
  26345. "afii10832",
  26346. 0xf6c8,
  26347. "afii10846",
  26348. 0x04d9,
  26349. "afii299",
  26350. 0x200e,
  26351. "afii300",
  26352. 0x200f,
  26353. "afii301",
  26354. 0x200d,
  26355. "afii57381",
  26356. 0x066a,
  26357. "afii57388",
  26358. 0x060c,
  26359. "afii57392",
  26360. 0x0660,
  26361. "afii57393",
  26362. 0x0661,
  26363. "afii57394",
  26364. 0x0662,
  26365. "afii57395",
  26366. 0x0663,
  26367. "afii57396",
  26368. 0x0664,
  26369. "afii57397",
  26370. 0x0665,
  26371. "afii57398",
  26372. 0x0666,
  26373. "afii57399",
  26374. 0x0667,
  26375. "afii57400",
  26376. 0x0668,
  26377. "afii57401",
  26378. 0x0669,
  26379. "afii57403",
  26380. 0x061b,
  26381. "afii57407",
  26382. 0x061f,
  26383. "afii57409",
  26384. 0x0621,
  26385. "afii57410",
  26386. 0x0622,
  26387. "afii57411",
  26388. 0x0623,
  26389. "afii57412",
  26390. 0x0624,
  26391. "afii57413",
  26392. 0x0625,
  26393. "afii57414",
  26394. 0x0626,
  26395. "afii57415",
  26396. 0x0627,
  26397. "afii57416",
  26398. 0x0628,
  26399. "afii57417",
  26400. 0x0629,
  26401. "afii57418",
  26402. 0x062a,
  26403. "afii57419",
  26404. 0x062b,
  26405. "afii57420",
  26406. 0x062c,
  26407. "afii57421",
  26408. 0x062d,
  26409. "afii57422",
  26410. 0x062e,
  26411. "afii57423",
  26412. 0x062f,
  26413. "afii57424",
  26414. 0x0630,
  26415. "afii57425",
  26416. 0x0631,
  26417. "afii57426",
  26418. 0x0632,
  26419. "afii57427",
  26420. 0x0633,
  26421. "afii57428",
  26422. 0x0634,
  26423. "afii57429",
  26424. 0x0635,
  26425. "afii57430",
  26426. 0x0636,
  26427. "afii57431",
  26428. 0x0637,
  26429. "afii57432",
  26430. 0x0638,
  26431. "afii57433",
  26432. 0x0639,
  26433. "afii57434",
  26434. 0x063a,
  26435. "afii57440",
  26436. 0x0640,
  26437. "afii57441",
  26438. 0x0641,
  26439. "afii57442",
  26440. 0x0642,
  26441. "afii57443",
  26442. 0x0643,
  26443. "afii57444",
  26444. 0x0644,
  26445. "afii57445",
  26446. 0x0645,
  26447. "afii57446",
  26448. 0x0646,
  26449. "afii57448",
  26450. 0x0648,
  26451. "afii57449",
  26452. 0x0649,
  26453. "afii57450",
  26454. 0x064a,
  26455. "afii57451",
  26456. 0x064b,
  26457. "afii57452",
  26458. 0x064c,
  26459. "afii57453",
  26460. 0x064d,
  26461. "afii57454",
  26462. 0x064e,
  26463. "afii57455",
  26464. 0x064f,
  26465. "afii57456",
  26466. 0x0650,
  26467. "afii57457",
  26468. 0x0651,
  26469. "afii57458",
  26470. 0x0652,
  26471. "afii57470",
  26472. 0x0647,
  26473. "afii57505",
  26474. 0x06a4,
  26475. "afii57506",
  26476. 0x067e,
  26477. "afii57507",
  26478. 0x0686,
  26479. "afii57508",
  26480. 0x0698,
  26481. "afii57509",
  26482. 0x06af,
  26483. "afii57511",
  26484. 0x0679,
  26485. "afii57512",
  26486. 0x0688,
  26487. "afii57513",
  26488. 0x0691,
  26489. "afii57514",
  26490. 0x06ba,
  26491. "afii57519",
  26492. 0x06d2,
  26493. "afii57534",
  26494. 0x06d5,
  26495. "afii57636",
  26496. 0x20aa,
  26497. "afii57645",
  26498. 0x05be,
  26499. "afii57658",
  26500. 0x05c3,
  26501. "afii57664",
  26502. 0x05d0,
  26503. "afii57665",
  26504. 0x05d1,
  26505. "afii57666",
  26506. 0x05d2,
  26507. "afii57667",
  26508. 0x05d3,
  26509. "afii57668",
  26510. 0x05d4,
  26511. "afii57669",
  26512. 0x05d5,
  26513. "afii57670",
  26514. 0x05d6,
  26515. "afii57671",
  26516. 0x05d7,
  26517. "afii57672",
  26518. 0x05d8,
  26519. "afii57673",
  26520. 0x05d9,
  26521. "afii57674",
  26522. 0x05da,
  26523. "afii57675",
  26524. 0x05db,
  26525. "afii57676",
  26526. 0x05dc,
  26527. "afii57677",
  26528. 0x05dd,
  26529. "afii57678",
  26530. 0x05de,
  26531. "afii57679",
  26532. 0x05df,
  26533. "afii57680",
  26534. 0x05e0,
  26535. "afii57681",
  26536. 0x05e1,
  26537. "afii57682",
  26538. 0x05e2,
  26539. "afii57683",
  26540. 0x05e3,
  26541. "afii57684",
  26542. 0x05e4,
  26543. "afii57685",
  26544. 0x05e5,
  26545. "afii57686",
  26546. 0x05e6,
  26547. "afii57687",
  26548. 0x05e7,
  26549. "afii57688",
  26550. 0x05e8,
  26551. "afii57689",
  26552. 0x05e9,
  26553. "afii57690",
  26554. 0x05ea,
  26555. "afii57694",
  26556. 0xfb2a,
  26557. "afii57695",
  26558. 0xfb2b,
  26559. "afii57700",
  26560. 0xfb4b,
  26561. "afii57705",
  26562. 0xfb1f,
  26563. "afii57716",
  26564. 0x05f0,
  26565. "afii57717",
  26566. 0x05f1,
  26567. "afii57718",
  26568. 0x05f2,
  26569. "afii57723",
  26570. 0xfb35,
  26571. "afii57793",
  26572. 0x05b4,
  26573. "afii57794",
  26574. 0x05b5,
  26575. "afii57795",
  26576. 0x05b6,
  26577. "afii57796",
  26578. 0x05bb,
  26579. "afii57797",
  26580. 0x05b8,
  26581. "afii57798",
  26582. 0x05b7,
  26583. "afii57799",
  26584. 0x05b0,
  26585. "afii57800",
  26586. 0x05b2,
  26587. "afii57801",
  26588. 0x05b1,
  26589. "afii57802",
  26590. 0x05b3,
  26591. "afii57803",
  26592. 0x05c2,
  26593. "afii57804",
  26594. 0x05c1,
  26595. "afii57806",
  26596. 0x05b9,
  26597. "afii57807",
  26598. 0x05bc,
  26599. "afii57839",
  26600. 0x05bd,
  26601. "afii57841",
  26602. 0x05bf,
  26603. "afii57842",
  26604. 0x05c0,
  26605. "afii57929",
  26606. 0x02bc,
  26607. "afii61248",
  26608. 0x2105,
  26609. "afii61289",
  26610. 0x2113,
  26611. "afii61352",
  26612. 0x2116,
  26613. "afii61573",
  26614. 0x202c,
  26615. "afii61574",
  26616. 0x202d,
  26617. "afii61575",
  26618. 0x202e,
  26619. "afii61664",
  26620. 0x200c,
  26621. "afii63167",
  26622. 0x066d,
  26623. "afii64937",
  26624. 0x02bd,
  26625. "agrave",
  26626. 0x00e0,
  26627. "agujarati",
  26628. 0x0a85,
  26629. "agurmukhi",
  26630. 0x0a05,
  26631. "ahiragana",
  26632. 0x3042,
  26633. "ahookabove",
  26634. 0x1ea3,
  26635. "aibengali",
  26636. 0x0990,
  26637. "aibopomofo",
  26638. 0x311e,
  26639. "aideva",
  26640. 0x0910,
  26641. "aiecyrillic",
  26642. 0x04d5,
  26643. "aigujarati",
  26644. 0x0a90,
  26645. "aigurmukhi",
  26646. 0x0a10,
  26647. "aimatragurmukhi",
  26648. 0x0a48,
  26649. "ainarabic",
  26650. 0x0639,
  26651. "ainfinalarabic",
  26652. 0xfeca,
  26653. "aininitialarabic",
  26654. 0xfecb,
  26655. "ainmedialarabic",
  26656. 0xfecc,
  26657. "ainvertedbreve",
  26658. 0x0203,
  26659. "aivowelsignbengali",
  26660. 0x09c8,
  26661. "aivowelsigndeva",
  26662. 0x0948,
  26663. "aivowelsigngujarati",
  26664. 0x0ac8,
  26665. "akatakana",
  26666. 0x30a2,
  26667. "akatakanahalfwidth",
  26668. 0xff71,
  26669. "akorean",
  26670. 0x314f,
  26671. "alef",
  26672. 0x05d0,
  26673. "alefarabic",
  26674. 0x0627,
  26675. "alefdageshhebrew",
  26676. 0xfb30,
  26677. "aleffinalarabic",
  26678. 0xfe8e,
  26679. "alefhamzaabovearabic",
  26680. 0x0623,
  26681. "alefhamzaabovefinalarabic",
  26682. 0xfe84,
  26683. "alefhamzabelowarabic",
  26684. 0x0625,
  26685. "alefhamzabelowfinalarabic",
  26686. 0xfe88,
  26687. "alefhebrew",
  26688. 0x05d0,
  26689. "aleflamedhebrew",
  26690. 0xfb4f,
  26691. "alefmaddaabovearabic",
  26692. 0x0622,
  26693. "alefmaddaabovefinalarabic",
  26694. 0xfe82,
  26695. "alefmaksuraarabic",
  26696. 0x0649,
  26697. "alefmaksurafinalarabic",
  26698. 0xfef0,
  26699. "alefmaksurainitialarabic",
  26700. 0xfef3,
  26701. "alefmaksuramedialarabic",
  26702. 0xfef4,
  26703. "alefpatahhebrew",
  26704. 0xfb2e,
  26705. "alefqamatshebrew",
  26706. 0xfb2f,
  26707. "aleph",
  26708. 0x2135,
  26709. "allequal",
  26710. 0x224c,
  26711. "alpha",
  26712. 0x03b1,
  26713. "alphatonos",
  26714. 0x03ac,
  26715. "amacron",
  26716. 0x0101,
  26717. "amonospace",
  26718. 0xff41,
  26719. "ampersand",
  26720. 0x0026,
  26721. "ampersandmonospace",
  26722. 0xff06,
  26723. "ampersandsmall",
  26724. 0xf726,
  26725. "amsquare",
  26726. 0x33c2,
  26727. "anbopomofo",
  26728. 0x3122,
  26729. "angbopomofo",
  26730. 0x3124,
  26731. "angbracketleft",
  26732. 0x3008,
  26733. "angbracketright",
  26734. 0x3009,
  26735. "angkhankhuthai",
  26736. 0x0e5a,
  26737. "angle",
  26738. 0x2220,
  26739. "anglebracketleft",
  26740. 0x3008,
  26741. "anglebracketleftvertical",
  26742. 0xfe3f,
  26743. "anglebracketright",
  26744. 0x3009,
  26745. "anglebracketrightvertical",
  26746. 0xfe40,
  26747. "angleleft",
  26748. 0x2329,
  26749. "angleright",
  26750. 0x232a,
  26751. "angstrom",
  26752. 0x212b,
  26753. "anoteleia",
  26754. 0x0387,
  26755. "anudattadeva",
  26756. 0x0952,
  26757. "anusvarabengali",
  26758. 0x0982,
  26759. "anusvaradeva",
  26760. 0x0902,
  26761. "anusvaragujarati",
  26762. 0x0a82,
  26763. "aogonek",
  26764. 0x0105,
  26765. "apaatosquare",
  26766. 0x3300,
  26767. "aparen",
  26768. 0x249c,
  26769. "apostrophearmenian",
  26770. 0x055a,
  26771. "apostrophemod",
  26772. 0x02bc,
  26773. "apple",
  26774. 0xf8ff,
  26775. "approaches",
  26776. 0x2250,
  26777. "approxequal",
  26778. 0x2248,
  26779. "approxequalorimage",
  26780. 0x2252,
  26781. "approximatelyequal",
  26782. 0x2245,
  26783. "araeaekorean",
  26784. 0x318e,
  26785. "araeakorean",
  26786. 0x318d,
  26787. "arc",
  26788. 0x2312,
  26789. "arighthalfring",
  26790. 0x1e9a,
  26791. "aring",
  26792. 0x00e5,
  26793. "aringacute",
  26794. 0x01fb,
  26795. "aringbelow",
  26796. 0x1e01,
  26797. "arrowboth",
  26798. 0x2194,
  26799. "arrowdashdown",
  26800. 0x21e3,
  26801. "arrowdashleft",
  26802. 0x21e0,
  26803. "arrowdashright",
  26804. 0x21e2,
  26805. "arrowdashup",
  26806. 0x21e1,
  26807. "arrowdblboth",
  26808. 0x21d4,
  26809. "arrowdbldown",
  26810. 0x21d3,
  26811. "arrowdblleft",
  26812. 0x21d0,
  26813. "arrowdblright",
  26814. 0x21d2,
  26815. "arrowdblup",
  26816. 0x21d1,
  26817. "arrowdown",
  26818. 0x2193,
  26819. "arrowdownleft",
  26820. 0x2199,
  26821. "arrowdownright",
  26822. 0x2198,
  26823. "arrowdownwhite",
  26824. 0x21e9,
  26825. "arrowheaddownmod",
  26826. 0x02c5,
  26827. "arrowheadleftmod",
  26828. 0x02c2,
  26829. "arrowheadrightmod",
  26830. 0x02c3,
  26831. "arrowheadupmod",
  26832. 0x02c4,
  26833. "arrowhorizex",
  26834. 0xf8e7,
  26835. "arrowleft",
  26836. 0x2190,
  26837. "arrowleftdbl",
  26838. 0x21d0,
  26839. "arrowleftdblstroke",
  26840. 0x21cd,
  26841. "arrowleftoverright",
  26842. 0x21c6,
  26843. "arrowleftwhite",
  26844. 0x21e6,
  26845. "arrowright",
  26846. 0x2192,
  26847. "arrowrightdblstroke",
  26848. 0x21cf,
  26849. "arrowrightheavy",
  26850. 0x279e,
  26851. "arrowrightoverleft",
  26852. 0x21c4,
  26853. "arrowrightwhite",
  26854. 0x21e8,
  26855. "arrowtableft",
  26856. 0x21e4,
  26857. "arrowtabright",
  26858. 0x21e5,
  26859. "arrowup",
  26860. 0x2191,
  26861. "arrowupdn",
  26862. 0x2195,
  26863. "arrowupdnbse",
  26864. 0x21a8,
  26865. "arrowupdownbase",
  26866. 0x21a8,
  26867. "arrowupleft",
  26868. 0x2196,
  26869. "arrowupleftofdown",
  26870. 0x21c5,
  26871. "arrowupright",
  26872. 0x2197,
  26873. "arrowupwhite",
  26874. 0x21e7,
  26875. "arrowvertex",
  26876. 0xf8e6,
  26877. "asciicircum",
  26878. 0x005e,
  26879. "asciicircummonospace",
  26880. 0xff3e,
  26881. "asciitilde",
  26882. 0x007e,
  26883. "asciitildemonospace",
  26884. 0xff5e,
  26885. "ascript",
  26886. 0x0251,
  26887. "ascriptturned",
  26888. 0x0252,
  26889. "asmallhiragana",
  26890. 0x3041,
  26891. "asmallkatakana",
  26892. 0x30a1,
  26893. "asmallkatakanahalfwidth",
  26894. 0xff67,
  26895. "asterisk",
  26896. 0x002a,
  26897. "asteriskaltonearabic",
  26898. 0x066d,
  26899. "asteriskarabic",
  26900. 0x066d,
  26901. "asteriskmath",
  26902. 0x2217,
  26903. "asteriskmonospace",
  26904. 0xff0a,
  26905. "asterisksmall",
  26906. 0xfe61,
  26907. "asterism",
  26908. 0x2042,
  26909. "asuperior",
  26910. 0xf6e9,
  26911. "asymptoticallyequal",
  26912. 0x2243,
  26913. "at",
  26914. 0x0040,
  26915. "atilde",
  26916. 0x00e3,
  26917. "atmonospace",
  26918. 0xff20,
  26919. "atsmall",
  26920. 0xfe6b,
  26921. "aturned",
  26922. 0x0250,
  26923. "aubengali",
  26924. 0x0994,
  26925. "aubopomofo",
  26926. 0x3120,
  26927. "audeva",
  26928. 0x0914,
  26929. "augujarati",
  26930. 0x0a94,
  26931. "augurmukhi",
  26932. 0x0a14,
  26933. "aulengthmarkbengali",
  26934. 0x09d7,
  26935. "aumatragurmukhi",
  26936. 0x0a4c,
  26937. "auvowelsignbengali",
  26938. 0x09cc,
  26939. "auvowelsigndeva",
  26940. 0x094c,
  26941. "auvowelsigngujarati",
  26942. 0x0acc,
  26943. "avagrahadeva",
  26944. 0x093d,
  26945. "aybarmenian",
  26946. 0x0561,
  26947. "ayin",
  26948. 0x05e2,
  26949. "ayinaltonehebrew",
  26950. 0xfb20,
  26951. "ayinhebrew",
  26952. 0x05e2,
  26953. "b",
  26954. 0x0062,
  26955. "babengali",
  26956. 0x09ac,
  26957. "backslash",
  26958. 0x005c,
  26959. "backslashmonospace",
  26960. 0xff3c,
  26961. "badeva",
  26962. 0x092c,
  26963. "bagujarati",
  26964. 0x0aac,
  26965. "bagurmukhi",
  26966. 0x0a2c,
  26967. "bahiragana",
  26968. 0x3070,
  26969. "bahtthai",
  26970. 0x0e3f,
  26971. "bakatakana",
  26972. 0x30d0,
  26973. "bar",
  26974. 0x007c,
  26975. "barmonospace",
  26976. 0xff5c,
  26977. "bbopomofo",
  26978. 0x3105,
  26979. "bcircle",
  26980. 0x24d1,
  26981. "bdotaccent",
  26982. 0x1e03,
  26983. "bdotbelow",
  26984. 0x1e05,
  26985. "beamedsixteenthnotes",
  26986. 0x266c,
  26987. "because",
  26988. 0x2235,
  26989. "becyrillic",
  26990. 0x0431,
  26991. "beharabic",
  26992. 0x0628,
  26993. "behfinalarabic",
  26994. 0xfe90,
  26995. "behinitialarabic",
  26996. 0xfe91,
  26997. "behiragana",
  26998. 0x3079,
  26999. "behmedialarabic",
  27000. 0xfe92,
  27001. "behmeeminitialarabic",
  27002. 0xfc9f,
  27003. "behmeemisolatedarabic",
  27004. 0xfc08,
  27005. "behnoonfinalarabic",
  27006. 0xfc6d,
  27007. "bekatakana",
  27008. 0x30d9,
  27009. "benarmenian",
  27010. 0x0562,
  27011. "bet",
  27012. 0x05d1,
  27013. "beta",
  27014. 0x03b2,
  27015. "betasymbolgreek",
  27016. 0x03d0,
  27017. "betdagesh",
  27018. 0xfb31,
  27019. "betdageshhebrew",
  27020. 0xfb31,
  27021. "bethebrew",
  27022. 0x05d1,
  27023. "betrafehebrew",
  27024. 0xfb4c,
  27025. "bhabengali",
  27026. 0x09ad,
  27027. "bhadeva",
  27028. 0x092d,
  27029. "bhagujarati",
  27030. 0x0aad,
  27031. "bhagurmukhi",
  27032. 0x0a2d,
  27033. "bhook",
  27034. 0x0253,
  27035. "bihiragana",
  27036. 0x3073,
  27037. "bikatakana",
  27038. 0x30d3,
  27039. "bilabialclick",
  27040. 0x0298,
  27041. "bindigurmukhi",
  27042. 0x0a02,
  27043. "birusquare",
  27044. 0x3331,
  27045. "blackcircle",
  27046. 0x25cf,
  27047. "blackdiamond",
  27048. 0x25c6,
  27049. "blackdownpointingtriangle",
  27050. 0x25bc,
  27051. "blackleftpointingpointer",
  27052. 0x25c4,
  27053. "blackleftpointingtriangle",
  27054. 0x25c0,
  27055. "blacklenticularbracketleft",
  27056. 0x3010,
  27057. "blacklenticularbracketleftvertical",
  27058. 0xfe3b,
  27059. "blacklenticularbracketright",
  27060. 0x3011,
  27061. "blacklenticularbracketrightvertical",
  27062. 0xfe3c,
  27063. "blacklowerlefttriangle",
  27064. 0x25e3,
  27065. "blacklowerrighttriangle",
  27066. 0x25e2,
  27067. "blackrectangle",
  27068. 0x25ac,
  27069. "blackrightpointingpointer",
  27070. 0x25ba,
  27071. "blackrightpointingtriangle",
  27072. 0x25b6,
  27073. "blacksmallsquare",
  27074. 0x25aa,
  27075. "blacksmilingface",
  27076. 0x263b,
  27077. "blacksquare",
  27078. 0x25a0,
  27079. "blackstar",
  27080. 0x2605,
  27081. "blackupperlefttriangle",
  27082. 0x25e4,
  27083. "blackupperrighttriangle",
  27084. 0x25e5,
  27085. "blackuppointingsmalltriangle",
  27086. 0x25b4,
  27087. "blackuppointingtriangle",
  27088. 0x25b2,
  27089. "blank",
  27090. 0x2423,
  27091. "blinebelow",
  27092. 0x1e07,
  27093. "block",
  27094. 0x2588,
  27095. "bmonospace",
  27096. 0xff42,
  27097. "bobaimaithai",
  27098. 0x0e1a,
  27099. "bohiragana",
  27100. 0x307c,
  27101. "bokatakana",
  27102. 0x30dc,
  27103. "bparen",
  27104. 0x249d,
  27105. "bqsquare",
  27106. 0x33c3,
  27107. "braceex",
  27108. 0xf8f4,
  27109. "braceleft",
  27110. 0x007b,
  27111. "braceleftbt",
  27112. 0xf8f3,
  27113. "braceleftmid",
  27114. 0xf8f2,
  27115. "braceleftmonospace",
  27116. 0xff5b,
  27117. "braceleftsmall",
  27118. 0xfe5b,
  27119. "bracelefttp",
  27120. 0xf8f1,
  27121. "braceleftvertical",
  27122. 0xfe37,
  27123. "braceright",
  27124. 0x007d,
  27125. "bracerightbt",
  27126. 0xf8fe,
  27127. "bracerightmid",
  27128. 0xf8fd,
  27129. "bracerightmonospace",
  27130. 0xff5d,
  27131. "bracerightsmall",
  27132. 0xfe5c,
  27133. "bracerighttp",
  27134. 0xf8fc,
  27135. "bracerightvertical",
  27136. 0xfe38,
  27137. "bracketleft",
  27138. 0x005b,
  27139. "bracketleftbt",
  27140. 0xf8f0,
  27141. "bracketleftex",
  27142. 0xf8ef,
  27143. "bracketleftmonospace",
  27144. 0xff3b,
  27145. "bracketlefttp",
  27146. 0xf8ee,
  27147. "bracketright",
  27148. 0x005d,
  27149. "bracketrightbt",
  27150. 0xf8fb,
  27151. "bracketrightex",
  27152. 0xf8fa,
  27153. "bracketrightmonospace",
  27154. 0xff3d,
  27155. "bracketrighttp",
  27156. 0xf8f9,
  27157. "breve",
  27158. 0x02d8,
  27159. "brevebelowcmb",
  27160. 0x032e,
  27161. "brevecmb",
  27162. 0x0306,
  27163. "breveinvertedbelowcmb",
  27164. 0x032f,
  27165. "breveinvertedcmb",
  27166. 0x0311,
  27167. "breveinverteddoublecmb",
  27168. 0x0361,
  27169. "bridgebelowcmb",
  27170. 0x032a,
  27171. "bridgeinvertedbelowcmb",
  27172. 0x033a,
  27173. "brokenbar",
  27174. 0x00a6,
  27175. "bstroke",
  27176. 0x0180,
  27177. "bsuperior",
  27178. 0xf6ea,
  27179. "btopbar",
  27180. 0x0183,
  27181. "buhiragana",
  27182. 0x3076,
  27183. "bukatakana",
  27184. 0x30d6,
  27185. "bullet",
  27186. 0x2022,
  27187. "bulletinverse",
  27188. 0x25d8,
  27189. "bulletoperator",
  27190. 0x2219,
  27191. "bullseye",
  27192. 0x25ce,
  27193. "c",
  27194. 0x0063,
  27195. "caarmenian",
  27196. 0x056e,
  27197. "cabengali",
  27198. 0x099a,
  27199. "cacute",
  27200. 0x0107,
  27201. "cadeva",
  27202. 0x091a,
  27203. "cagujarati",
  27204. 0x0a9a,
  27205. "cagurmukhi",
  27206. 0x0a1a,
  27207. "calsquare",
  27208. 0x3388,
  27209. "candrabindubengali",
  27210. 0x0981,
  27211. "candrabinducmb",
  27212. 0x0310,
  27213. "candrabindudeva",
  27214. 0x0901,
  27215. "candrabindugujarati",
  27216. 0x0a81,
  27217. "capslock",
  27218. 0x21ea,
  27219. "careof",
  27220. 0x2105,
  27221. "caron",
  27222. 0x02c7,
  27223. "caronbelowcmb",
  27224. 0x032c,
  27225. "caroncmb",
  27226. 0x030c,
  27227. "carriagereturn",
  27228. 0x21b5,
  27229. "cbopomofo",
  27230. 0x3118,
  27231. "ccaron",
  27232. 0x010d,
  27233. "ccedilla",
  27234. 0x00e7,
  27235. "ccedillaacute",
  27236. 0x1e09,
  27237. "ccircle",
  27238. 0x24d2,
  27239. "ccircumflex",
  27240. 0x0109,
  27241. "ccurl",
  27242. 0x0255,
  27243. "cdot",
  27244. 0x010b,
  27245. "cdotaccent",
  27246. 0x010b,
  27247. "cdsquare",
  27248. 0x33c5,
  27249. "cedilla",
  27250. 0x00b8,
  27251. "cedillacmb",
  27252. 0x0327,
  27253. "cent",
  27254. 0x00a2,
  27255. "centigrade",
  27256. 0x2103,
  27257. "centinferior",
  27258. 0xf6df,
  27259. "centmonospace",
  27260. 0xffe0,
  27261. "centoldstyle",
  27262. 0xf7a2,
  27263. "centsuperior",
  27264. 0xf6e0,
  27265. "chaarmenian",
  27266. 0x0579,
  27267. "chabengali",
  27268. 0x099b,
  27269. "chadeva",
  27270. 0x091b,
  27271. "chagujarati",
  27272. 0x0a9b,
  27273. "chagurmukhi",
  27274. 0x0a1b,
  27275. "chbopomofo",
  27276. 0x3114,
  27277. "cheabkhasiancyrillic",
  27278. 0x04bd,
  27279. "checkmark",
  27280. 0x2713,
  27281. "checyrillic",
  27282. 0x0447,
  27283. "chedescenderabkhasiancyrillic",
  27284. 0x04bf,
  27285. "chedescendercyrillic",
  27286. 0x04b7,
  27287. "chedieresiscyrillic",
  27288. 0x04f5,
  27289. "cheharmenian",
  27290. 0x0573,
  27291. "chekhakassiancyrillic",
  27292. 0x04cc,
  27293. "cheverticalstrokecyrillic",
  27294. 0x04b9,
  27295. "chi",
  27296. 0x03c7,
  27297. "chieuchacirclekorean",
  27298. 0x3277,
  27299. "chieuchaparenkorean",
  27300. 0x3217,
  27301. "chieuchcirclekorean",
  27302. 0x3269,
  27303. "chieuchkorean",
  27304. 0x314a,
  27305. "chieuchparenkorean",
  27306. 0x3209,
  27307. "chochangthai",
  27308. 0x0e0a,
  27309. "chochanthai",
  27310. 0x0e08,
  27311. "chochingthai",
  27312. 0x0e09,
  27313. "chochoethai",
  27314. 0x0e0c,
  27315. "chook",
  27316. 0x0188,
  27317. "cieucacirclekorean",
  27318. 0x3276,
  27319. "cieucaparenkorean",
  27320. 0x3216,
  27321. "cieuccirclekorean",
  27322. 0x3268,
  27323. "cieuckorean",
  27324. 0x3148,
  27325. "cieucparenkorean",
  27326. 0x3208,
  27327. "cieucuparenkorean",
  27328. 0x321c,
  27329. "circle",
  27330. 0x25cb,
  27331. "circlecopyrt",
  27332. 0x00a9,
  27333. "circlemultiply",
  27334. 0x2297,
  27335. "circleot",
  27336. 0x2299,
  27337. "circleplus",
  27338. 0x2295,
  27339. "circlepostalmark",
  27340. 0x3036,
  27341. "circlewithlefthalfblack",
  27342. 0x25d0,
  27343. "circlewithrighthalfblack",
  27344. 0x25d1,
  27345. "circumflex",
  27346. 0x02c6,
  27347. "circumflexbelowcmb",
  27348. 0x032d,
  27349. "circumflexcmb",
  27350. 0x0302,
  27351. "clear",
  27352. 0x2327,
  27353. "clickalveolar",
  27354. 0x01c2,
  27355. "clickdental",
  27356. 0x01c0,
  27357. "clicklateral",
  27358. 0x01c1,
  27359. "clickretroflex",
  27360. 0x01c3,
  27361. "club",
  27362. 0x2663,
  27363. "clubsuitblack",
  27364. 0x2663,
  27365. "clubsuitwhite",
  27366. 0x2667,
  27367. "cmcubedsquare",
  27368. 0x33a4,
  27369. "cmonospace",
  27370. 0xff43,
  27371. "cmsquaredsquare",
  27372. 0x33a0,
  27373. "coarmenian",
  27374. 0x0581,
  27375. "colon",
  27376. 0x003a,
  27377. "colonmonetary",
  27378. 0x20a1,
  27379. "colonmonospace",
  27380. 0xff1a,
  27381. "colonsign",
  27382. 0x20a1,
  27383. "colonsmall",
  27384. 0xfe55,
  27385. "colontriangularhalfmod",
  27386. 0x02d1,
  27387. "colontriangularmod",
  27388. 0x02d0,
  27389. "comma",
  27390. 0x002c,
  27391. "commaabovecmb",
  27392. 0x0313,
  27393. "commaaboverightcmb",
  27394. 0x0315,
  27395. "commaaccent",
  27396. 0xf6c3,
  27397. "commaarabic",
  27398. 0x060c,
  27399. "commaarmenian",
  27400. 0x055d,
  27401. "commainferior",
  27402. 0xf6e1,
  27403. "commamonospace",
  27404. 0xff0c,
  27405. "commareversedabovecmb",
  27406. 0x0314,
  27407. "commareversedmod",
  27408. 0x02bd,
  27409. "commasmall",
  27410. 0xfe50,
  27411. "commasuperior",
  27412. 0xf6e2,
  27413. "commaturnedabovecmb",
  27414. 0x0312,
  27415. "commaturnedmod",
  27416. 0x02bb,
  27417. "compass",
  27418. 0x263c,
  27419. "congruent",
  27420. 0x2245,
  27421. "contourintegral",
  27422. 0x222e,
  27423. "control",
  27424. 0x2303,
  27425. "controlACK",
  27426. 0x0006,
  27427. "controlBEL",
  27428. 0x0007,
  27429. "controlBS",
  27430. 0x0008,
  27431. "controlCAN",
  27432. 0x0018,
  27433. "controlCR",
  27434. 0x000d,
  27435. "controlDC1",
  27436. 0x0011,
  27437. "controlDC2",
  27438. 0x0012,
  27439. "controlDC3",
  27440. 0x0013,
  27441. "controlDC4",
  27442. 0x0014,
  27443. "controlDEL",
  27444. 0x007f,
  27445. "controlDLE",
  27446. 0x0010,
  27447. "controlEM",
  27448. 0x0019,
  27449. "controlENQ",
  27450. 0x0005,
  27451. "controlEOT",
  27452. 0x0004,
  27453. "controlESC",
  27454. 0x001b,
  27455. "controlETB",
  27456. 0x0017,
  27457. "controlETX",
  27458. 0x0003,
  27459. "controlFF",
  27460. 0x000c,
  27461. "controlFS",
  27462. 0x001c,
  27463. "controlGS",
  27464. 0x001d,
  27465. "controlHT",
  27466. 0x0009,
  27467. "controlLF",
  27468. 0x000a,
  27469. "controlNAK",
  27470. 0x0015,
  27471. "controlNULL",
  27472. 0x0000,
  27473. "controlRS",
  27474. 0x001e,
  27475. "controlSI",
  27476. 0x000f,
  27477. "controlSO",
  27478. 0x000e,
  27479. "controlSOT",
  27480. 0x0002,
  27481. "controlSTX",
  27482. 0x0001,
  27483. "controlSUB",
  27484. 0x001a,
  27485. "controlSYN",
  27486. 0x0016,
  27487. "controlUS",
  27488. 0x001f,
  27489. "controlVT",
  27490. 0x000b,
  27491. "copyright",
  27492. 0x00a9,
  27493. "copyrightsans",
  27494. 0xf8e9,
  27495. "copyrightserif",
  27496. 0xf6d9,
  27497. "cornerbracketleft",
  27498. 0x300c,
  27499. "cornerbracketlefthalfwidth",
  27500. 0xff62,
  27501. "cornerbracketleftvertical",
  27502. 0xfe41,
  27503. "cornerbracketright",
  27504. 0x300d,
  27505. "cornerbracketrighthalfwidth",
  27506. 0xff63,
  27507. "cornerbracketrightvertical",
  27508. 0xfe42,
  27509. "corporationsquare",
  27510. 0x337f,
  27511. "cosquare",
  27512. 0x33c7,
  27513. "coverkgsquare",
  27514. 0x33c6,
  27515. "cparen",
  27516. 0x249e,
  27517. "cruzeiro",
  27518. 0x20a2,
  27519. "cstretched",
  27520. 0x0297,
  27521. "curlyand",
  27522. 0x22cf,
  27523. "curlyor",
  27524. 0x22ce,
  27525. "currency",
  27526. 0x00a4,
  27527. "cyrBreve",
  27528. 0xf6d1,
  27529. "cyrFlex",
  27530. 0xf6d2,
  27531. "cyrbreve",
  27532. 0xf6d4,
  27533. "cyrflex",
  27534. 0xf6d5,
  27535. "d",
  27536. 0x0064,
  27537. "daarmenian",
  27538. 0x0564,
  27539. "dabengali",
  27540. 0x09a6,
  27541. "dadarabic",
  27542. 0x0636,
  27543. "dadeva",
  27544. 0x0926,
  27545. "dadfinalarabic",
  27546. 0xfebe,
  27547. "dadinitialarabic",
  27548. 0xfebf,
  27549. "dadmedialarabic",
  27550. 0xfec0,
  27551. "dagesh",
  27552. 0x05bc,
  27553. "dageshhebrew",
  27554. 0x05bc,
  27555. "dagger",
  27556. 0x2020,
  27557. "daggerdbl",
  27558. 0x2021,
  27559. "dagujarati",
  27560. 0x0aa6,
  27561. "dagurmukhi",
  27562. 0x0a26,
  27563. "dahiragana",
  27564. 0x3060,
  27565. "dakatakana",
  27566. 0x30c0,
  27567. "dalarabic",
  27568. 0x062f,
  27569. "dalet",
  27570. 0x05d3,
  27571. "daletdagesh",
  27572. 0xfb33,
  27573. "daletdageshhebrew",
  27574. 0xfb33,
  27575. "dalethebrew",
  27576. 0x05d3,
  27577. "dalfinalarabic",
  27578. 0xfeaa,
  27579. "dammaarabic",
  27580. 0x064f,
  27581. "dammalowarabic",
  27582. 0x064f,
  27583. "dammatanaltonearabic",
  27584. 0x064c,
  27585. "dammatanarabic",
  27586. 0x064c,
  27587. "danda",
  27588. 0x0964,
  27589. "dargahebrew",
  27590. 0x05a7,
  27591. "dargalefthebrew",
  27592. 0x05a7,
  27593. "dasiapneumatacyrilliccmb",
  27594. 0x0485,
  27595. "dblGrave",
  27596. 0xf6d3,
  27597. "dblanglebracketleft",
  27598. 0x300a,
  27599. "dblanglebracketleftvertical",
  27600. 0xfe3d,
  27601. "dblanglebracketright",
  27602. 0x300b,
  27603. "dblanglebracketrightvertical",
  27604. 0xfe3e,
  27605. "dblarchinvertedbelowcmb",
  27606. 0x032b,
  27607. "dblarrowleft",
  27608. 0x21d4,
  27609. "dblarrowright",
  27610. 0x21d2,
  27611. "dbldanda",
  27612. 0x0965,
  27613. "dblgrave",
  27614. 0xf6d6,
  27615. "dblgravecmb",
  27616. 0x030f,
  27617. "dblintegral",
  27618. 0x222c,
  27619. "dbllowline",
  27620. 0x2017,
  27621. "dbllowlinecmb",
  27622. 0x0333,
  27623. "dbloverlinecmb",
  27624. 0x033f,
  27625. "dblprimemod",
  27626. 0x02ba,
  27627. "dblverticalbar",
  27628. 0x2016,
  27629. "dblverticallineabovecmb",
  27630. 0x030e,
  27631. "dbopomofo",
  27632. 0x3109,
  27633. "dbsquare",
  27634. 0x33c8,
  27635. "dcaron",
  27636. 0x010f,
  27637. "dcedilla",
  27638. 0x1e11,
  27639. "dcircle",
  27640. 0x24d3,
  27641. "dcircumflexbelow",
  27642. 0x1e13,
  27643. "dcroat",
  27644. 0x0111,
  27645. "ddabengali",
  27646. 0x09a1,
  27647. "ddadeva",
  27648. 0x0921,
  27649. "ddagujarati",
  27650. 0x0aa1,
  27651. "ddagurmukhi",
  27652. 0x0a21,
  27653. "ddalarabic",
  27654. 0x0688,
  27655. "ddalfinalarabic",
  27656. 0xfb89,
  27657. "dddhadeva",
  27658. 0x095c,
  27659. "ddhabengali",
  27660. 0x09a2,
  27661. "ddhadeva",
  27662. 0x0922,
  27663. "ddhagujarati",
  27664. 0x0aa2,
  27665. "ddhagurmukhi",
  27666. 0x0a22,
  27667. "ddotaccent",
  27668. 0x1e0b,
  27669. "ddotbelow",
  27670. 0x1e0d,
  27671. "decimalseparatorarabic",
  27672. 0x066b,
  27673. "decimalseparatorpersian",
  27674. 0x066b,
  27675. "decyrillic",
  27676. 0x0434,
  27677. "degree",
  27678. 0x00b0,
  27679. "dehihebrew",
  27680. 0x05ad,
  27681. "dehiragana",
  27682. 0x3067,
  27683. "deicoptic",
  27684. 0x03ef,
  27685. "dekatakana",
  27686. 0x30c7,
  27687. "deleteleft",
  27688. 0x232b,
  27689. "deleteright",
  27690. 0x2326,
  27691. "delta",
  27692. 0x03b4,
  27693. "deltaturned",
  27694. 0x018d,
  27695. "denominatorminusonenumeratorbengali",
  27696. 0x09f8,
  27697. "dezh",
  27698. 0x02a4,
  27699. "dhabengali",
  27700. 0x09a7,
  27701. "dhadeva",
  27702. 0x0927,
  27703. "dhagujarati",
  27704. 0x0aa7,
  27705. "dhagurmukhi",
  27706. 0x0a27,
  27707. "dhook",
  27708. 0x0257,
  27709. "dialytikatonos",
  27710. 0x0385,
  27711. "dialytikatonoscmb",
  27712. 0x0344,
  27713. "diamond",
  27714. 0x2666,
  27715. "diamondsuitwhite",
  27716. 0x2662,
  27717. "dieresis",
  27718. 0x00a8,
  27719. "dieresisacute",
  27720. 0xf6d7,
  27721. "dieresisbelowcmb",
  27722. 0x0324,
  27723. "dieresiscmb",
  27724. 0x0308,
  27725. "dieresisgrave",
  27726. 0xf6d8,
  27727. "dieresistonos",
  27728. 0x0385,
  27729. "dihiragana",
  27730. 0x3062,
  27731. "dikatakana",
  27732. 0x30c2,
  27733. "dittomark",
  27734. 0x3003,
  27735. "divide",
  27736. 0x00f7,
  27737. "divides",
  27738. 0x2223,
  27739. "divisionslash",
  27740. 0x2215,
  27741. "djecyrillic",
  27742. 0x0452,
  27743. "dkshade",
  27744. 0x2593,
  27745. "dlinebelow",
  27746. 0x1e0f,
  27747. "dlsquare",
  27748. 0x3397,
  27749. "dmacron",
  27750. 0x0111,
  27751. "dmonospace",
  27752. 0xff44,
  27753. "dnblock",
  27754. 0x2584,
  27755. "dochadathai",
  27756. 0x0e0e,
  27757. "dodekthai",
  27758. 0x0e14,
  27759. "dohiragana",
  27760. 0x3069,
  27761. "dokatakana",
  27762. 0x30c9,
  27763. "dollar",
  27764. 0x0024,
  27765. "dollarinferior",
  27766. 0xf6e3,
  27767. "dollarmonospace",
  27768. 0xff04,
  27769. "dollaroldstyle",
  27770. 0xf724,
  27771. "dollarsmall",
  27772. 0xfe69,
  27773. "dollarsuperior",
  27774. 0xf6e4,
  27775. "dong",
  27776. 0x20ab,
  27777. "dorusquare",
  27778. 0x3326,
  27779. "dotaccent",
  27780. 0x02d9,
  27781. "dotaccentcmb",
  27782. 0x0307,
  27783. "dotbelowcmb",
  27784. 0x0323,
  27785. "dotbelowcomb",
  27786. 0x0323,
  27787. "dotkatakana",
  27788. 0x30fb,
  27789. "dotlessi",
  27790. 0x0131,
  27791. "dotlessj",
  27792. 0xf6be,
  27793. "dotlessjstrokehook",
  27794. 0x0284,
  27795. "dotmath",
  27796. 0x22c5,
  27797. "dottedcircle",
  27798. 0x25cc,
  27799. "doubleyodpatah",
  27800. 0xfb1f,
  27801. "doubleyodpatahhebrew",
  27802. 0xfb1f,
  27803. "downtackbelowcmb",
  27804. 0x031e,
  27805. "downtackmod",
  27806. 0x02d5,
  27807. "dparen",
  27808. 0x249f,
  27809. "dsuperior",
  27810. 0xf6eb,
  27811. "dtail",
  27812. 0x0256,
  27813. "dtopbar",
  27814. 0x018c,
  27815. "duhiragana",
  27816. 0x3065,
  27817. "dukatakana",
  27818. 0x30c5,
  27819. "dz",
  27820. 0x01f3,
  27821. "dzaltone",
  27822. 0x02a3,
  27823. "dzcaron",
  27824. 0x01c6,
  27825. "dzcurl",
  27826. 0x02a5,
  27827. "dzeabkhasiancyrillic",
  27828. 0x04e1,
  27829. "dzecyrillic",
  27830. 0x0455,
  27831. "dzhecyrillic",
  27832. 0x045f,
  27833. "e",
  27834. 0x0065,
  27835. "eacute",
  27836. 0x00e9,
  27837. "earth",
  27838. 0x2641,
  27839. "ebengali",
  27840. 0x098f,
  27841. "ebopomofo",
  27842. 0x311c,
  27843. "ebreve",
  27844. 0x0115,
  27845. "ecandradeva",
  27846. 0x090d,
  27847. "ecandragujarati",
  27848. 0x0a8d,
  27849. "ecandravowelsigndeva",
  27850. 0x0945,
  27851. "ecandravowelsigngujarati",
  27852. 0x0ac5,
  27853. "ecaron",
  27854. 0x011b,
  27855. "ecedillabreve",
  27856. 0x1e1d,
  27857. "echarmenian",
  27858. 0x0565,
  27859. "echyiwnarmenian",
  27860. 0x0587,
  27861. "ecircle",
  27862. 0x24d4,
  27863. "ecircumflex",
  27864. 0x00ea,
  27865. "ecircumflexacute",
  27866. 0x1ebf,
  27867. "ecircumflexbelow",
  27868. 0x1e19,
  27869. "ecircumflexdotbelow",
  27870. 0x1ec7,
  27871. "ecircumflexgrave",
  27872. 0x1ec1,
  27873. "ecircumflexhookabove",
  27874. 0x1ec3,
  27875. "ecircumflextilde",
  27876. 0x1ec5,
  27877. "ecyrillic",
  27878. 0x0454,
  27879. "edblgrave",
  27880. 0x0205,
  27881. "edeva",
  27882. 0x090f,
  27883. "edieresis",
  27884. 0x00eb,
  27885. "edot",
  27886. 0x0117,
  27887. "edotaccent",
  27888. 0x0117,
  27889. "edotbelow",
  27890. 0x1eb9,
  27891. "eegurmukhi",
  27892. 0x0a0f,
  27893. "eematragurmukhi",
  27894. 0x0a47,
  27895. "efcyrillic",
  27896. 0x0444,
  27897. "egrave",
  27898. 0x00e8,
  27899. "egujarati",
  27900. 0x0a8f,
  27901. "eharmenian",
  27902. 0x0567,
  27903. "ehbopomofo",
  27904. 0x311d,
  27905. "ehiragana",
  27906. 0x3048,
  27907. "ehookabove",
  27908. 0x1ebb,
  27909. "eibopomofo",
  27910. 0x311f,
  27911. "eight",
  27912. 0x0038,
  27913. "eightarabic",
  27914. 0x0668,
  27915. "eightbengali",
  27916. 0x09ee,
  27917. "eightcircle",
  27918. 0x2467,
  27919. "eightcircleinversesansserif",
  27920. 0x2791,
  27921. "eightdeva",
  27922. 0x096e,
  27923. "eighteencircle",
  27924. 0x2471,
  27925. "eighteenparen",
  27926. 0x2485,
  27927. "eighteenperiod",
  27928. 0x2499,
  27929. "eightgujarati",
  27930. 0x0aee,
  27931. "eightgurmukhi",
  27932. 0x0a6e,
  27933. "eighthackarabic",
  27934. 0x0668,
  27935. "eighthangzhou",
  27936. 0x3028,
  27937. "eighthnotebeamed",
  27938. 0x266b,
  27939. "eightideographicparen",
  27940. 0x3227,
  27941. "eightinferior",
  27942. 0x2088,
  27943. "eightmonospace",
  27944. 0xff18,
  27945. "eightoldstyle",
  27946. 0xf738,
  27947. "eightparen",
  27948. 0x247b,
  27949. "eightperiod",
  27950. 0x248f,
  27951. "eightpersian",
  27952. 0x06f8,
  27953. "eightroman",
  27954. 0x2177,
  27955. "eightsuperior",
  27956. 0x2078,
  27957. "eightthai",
  27958. 0x0e58,
  27959. "einvertedbreve",
  27960. 0x0207,
  27961. "eiotifiedcyrillic",
  27962. 0x0465,
  27963. "ekatakana",
  27964. 0x30a8,
  27965. "ekatakanahalfwidth",
  27966. 0xff74,
  27967. "ekonkargurmukhi",
  27968. 0x0a74,
  27969. "ekorean",
  27970. 0x3154,
  27971. "elcyrillic",
  27972. 0x043b,
  27973. "element",
  27974. 0x2208,
  27975. "elevencircle",
  27976. 0x246a,
  27977. "elevenparen",
  27978. 0x247e,
  27979. "elevenperiod",
  27980. 0x2492,
  27981. "elevenroman",
  27982. 0x217a,
  27983. "ellipsis",
  27984. 0x2026,
  27985. "ellipsisvertical",
  27986. 0x22ee,
  27987. "emacron",
  27988. 0x0113,
  27989. "emacronacute",
  27990. 0x1e17,
  27991. "emacrongrave",
  27992. 0x1e15,
  27993. "emcyrillic",
  27994. 0x043c,
  27995. "emdash",
  27996. 0x2014,
  27997. "emdashvertical",
  27998. 0xfe31,
  27999. "emonospace",
  28000. 0xff45,
  28001. "emphasismarkarmenian",
  28002. 0x055b,
  28003. "emptyset",
  28004. 0x2205,
  28005. "enbopomofo",
  28006. 0x3123,
  28007. "encyrillic",
  28008. 0x043d,
  28009. "endash",
  28010. 0x2013,
  28011. "endashvertical",
  28012. 0xfe32,
  28013. "endescendercyrillic",
  28014. 0x04a3,
  28015. "eng",
  28016. 0x014b,
  28017. "engbopomofo",
  28018. 0x3125,
  28019. "enghecyrillic",
  28020. 0x04a5,
  28021. "enhookcyrillic",
  28022. 0x04c8,
  28023. "enspace",
  28024. 0x2002,
  28025. "eogonek",
  28026. 0x0119,
  28027. "eokorean",
  28028. 0x3153,
  28029. "eopen",
  28030. 0x025b,
  28031. "eopenclosed",
  28032. 0x029a,
  28033. "eopenreversed",
  28034. 0x025c,
  28035. "eopenreversedclosed",
  28036. 0x025e,
  28037. "eopenreversedhook",
  28038. 0x025d,
  28039. "eparen",
  28040. 0x24a0,
  28041. "epsilon",
  28042. 0x03b5,
  28043. "epsilontonos",
  28044. 0x03ad,
  28045. "equal",
  28046. 0x003d,
  28047. "equalmonospace",
  28048. 0xff1d,
  28049. "equalsmall",
  28050. 0xfe66,
  28051. "equalsuperior",
  28052. 0x207c,
  28053. "equivalence",
  28054. 0x2261,
  28055. "erbopomofo",
  28056. 0x3126,
  28057. "ercyrillic",
  28058. 0x0440,
  28059. "ereversed",
  28060. 0x0258,
  28061. "ereversedcyrillic",
  28062. 0x044d,
  28063. "escyrillic",
  28064. 0x0441,
  28065. "esdescendercyrillic",
  28066. 0x04ab,
  28067. "esh",
  28068. 0x0283,
  28069. "eshcurl",
  28070. 0x0286,
  28071. "eshortdeva",
  28072. 0x090e,
  28073. "eshortvowelsigndeva",
  28074. 0x0946,
  28075. "eshreversedloop",
  28076. 0x01aa,
  28077. "eshsquatreversed",
  28078. 0x0285,
  28079. "esmallhiragana",
  28080. 0x3047,
  28081. "esmallkatakana",
  28082. 0x30a7,
  28083. "esmallkatakanahalfwidth",
  28084. 0xff6a,
  28085. "estimated",
  28086. 0x212e,
  28087. "esuperior",
  28088. 0xf6ec,
  28089. "eta",
  28090. 0x03b7,
  28091. "etarmenian",
  28092. 0x0568,
  28093. "etatonos",
  28094. 0x03ae,
  28095. "eth",
  28096. 0x00f0,
  28097. "etilde",
  28098. 0x1ebd,
  28099. "etildebelow",
  28100. 0x1e1b,
  28101. "etnahtafoukhhebrew",
  28102. 0x0591,
  28103. "etnahtafoukhlefthebrew",
  28104. 0x0591,
  28105. "etnahtahebrew",
  28106. 0x0591,
  28107. "etnahtalefthebrew",
  28108. 0x0591,
  28109. "eturned",
  28110. 0x01dd,
  28111. "eukorean",
  28112. 0x3161,
  28113. "euro",
  28114. 0x20ac,
  28115. "evowelsignbengali",
  28116. 0x09c7,
  28117. "evowelsigndeva",
  28118. 0x0947,
  28119. "evowelsigngujarati",
  28120. 0x0ac7,
  28121. "exclam",
  28122. 0x0021,
  28123. "exclamarmenian",
  28124. 0x055c,
  28125. "exclamdbl",
  28126. 0x203c,
  28127. "exclamdown",
  28128. 0x00a1,
  28129. "exclamdownsmall",
  28130. 0xf7a1,
  28131. "exclammonospace",
  28132. 0xff01,
  28133. "exclamsmall",
  28134. 0xf721,
  28135. "existential",
  28136. 0x2203,
  28137. "ezh",
  28138. 0x0292,
  28139. "ezhcaron",
  28140. 0x01ef,
  28141. "ezhcurl",
  28142. 0x0293,
  28143. "ezhreversed",
  28144. 0x01b9,
  28145. "ezhtail",
  28146. 0x01ba,
  28147. "f",
  28148. 0x0066,
  28149. "fadeva",
  28150. 0x095e,
  28151. "fagurmukhi",
  28152. 0x0a5e,
  28153. "fahrenheit",
  28154. 0x2109,
  28155. "fathaarabic",
  28156. 0x064e,
  28157. "fathalowarabic",
  28158. 0x064e,
  28159. "fathatanarabic",
  28160. 0x064b,
  28161. "fbopomofo",
  28162. 0x3108,
  28163. "fcircle",
  28164. 0x24d5,
  28165. "fdotaccent",
  28166. 0x1e1f,
  28167. "feharabic",
  28168. 0x0641,
  28169. "feharmenian",
  28170. 0x0586,
  28171. "fehfinalarabic",
  28172. 0xfed2,
  28173. "fehinitialarabic",
  28174. 0xfed3,
  28175. "fehmedialarabic",
  28176. 0xfed4,
  28177. "feicoptic",
  28178. 0x03e5,
  28179. "female",
  28180. 0x2640,
  28181. "ff",
  28182. 0xfb00,
  28183. "f_f",
  28184. 0xfb00,
  28185. "ffi",
  28186. 0xfb03,
  28187. "f_f_i",
  28188. 0xfb03,
  28189. "ffl",
  28190. 0xfb04,
  28191. "f_f_l",
  28192. 0xfb04,
  28193. "fi",
  28194. 0xfb01,
  28195. "f_i",
  28196. 0xfb01,
  28197. "fifteencircle",
  28198. 0x246e,
  28199. "fifteenparen",
  28200. 0x2482,
  28201. "fifteenperiod",
  28202. 0x2496,
  28203. "figuredash",
  28204. 0x2012,
  28205. "filledbox",
  28206. 0x25a0,
  28207. "filledrect",
  28208. 0x25ac,
  28209. "finalkaf",
  28210. 0x05da,
  28211. "finalkafdagesh",
  28212. 0xfb3a,
  28213. "finalkafdageshhebrew",
  28214. 0xfb3a,
  28215. "finalkafhebrew",
  28216. 0x05da,
  28217. "finalmem",
  28218. 0x05dd,
  28219. "finalmemhebrew",
  28220. 0x05dd,
  28221. "finalnun",
  28222. 0x05df,
  28223. "finalnunhebrew",
  28224. 0x05df,
  28225. "finalpe",
  28226. 0x05e3,
  28227. "finalpehebrew",
  28228. 0x05e3,
  28229. "finaltsadi",
  28230. 0x05e5,
  28231. "finaltsadihebrew",
  28232. 0x05e5,
  28233. "firsttonechinese",
  28234. 0x02c9,
  28235. "fisheye",
  28236. 0x25c9,
  28237. "fitacyrillic",
  28238. 0x0473,
  28239. "five",
  28240. 0x0035,
  28241. "fivearabic",
  28242. 0x0665,
  28243. "fivebengali",
  28244. 0x09eb,
  28245. "fivecircle",
  28246. 0x2464,
  28247. "fivecircleinversesansserif",
  28248. 0x278e,
  28249. "fivedeva",
  28250. 0x096b,
  28251. "fiveeighths",
  28252. 0x215d,
  28253. "fivegujarati",
  28254. 0x0aeb,
  28255. "fivegurmukhi",
  28256. 0x0a6b,
  28257. "fivehackarabic",
  28258. 0x0665,
  28259. "fivehangzhou",
  28260. 0x3025,
  28261. "fiveideographicparen",
  28262. 0x3224,
  28263. "fiveinferior",
  28264. 0x2085,
  28265. "fivemonospace",
  28266. 0xff15,
  28267. "fiveoldstyle",
  28268. 0xf735,
  28269. "fiveparen",
  28270. 0x2478,
  28271. "fiveperiod",
  28272. 0x248c,
  28273. "fivepersian",
  28274. 0x06f5,
  28275. "fiveroman",
  28276. 0x2174,
  28277. "fivesuperior",
  28278. 0x2075,
  28279. "fivethai",
  28280. 0x0e55,
  28281. "fl",
  28282. 0xfb02,
  28283. "f_l",
  28284. 0xfb02,
  28285. "florin",
  28286. 0x0192,
  28287. "fmonospace",
  28288. 0xff46,
  28289. "fmsquare",
  28290. 0x3399,
  28291. "fofanthai",
  28292. 0x0e1f,
  28293. "fofathai",
  28294. 0x0e1d,
  28295. "fongmanthai",
  28296. 0x0e4f,
  28297. "forall",
  28298. 0x2200,
  28299. "four",
  28300. 0x0034,
  28301. "fourarabic",
  28302. 0x0664,
  28303. "fourbengali",
  28304. 0x09ea,
  28305. "fourcircle",
  28306. 0x2463,
  28307. "fourcircleinversesansserif",
  28308. 0x278d,
  28309. "fourdeva",
  28310. 0x096a,
  28311. "fourgujarati",
  28312. 0x0aea,
  28313. "fourgurmukhi",
  28314. 0x0a6a,
  28315. "fourhackarabic",
  28316. 0x0664,
  28317. "fourhangzhou",
  28318. 0x3024,
  28319. "fourideographicparen",
  28320. 0x3223,
  28321. "fourinferior",
  28322. 0x2084,
  28323. "fourmonospace",
  28324. 0xff14,
  28325. "fournumeratorbengali",
  28326. 0x09f7,
  28327. "fouroldstyle",
  28328. 0xf734,
  28329. "fourparen",
  28330. 0x2477,
  28331. "fourperiod",
  28332. 0x248b,
  28333. "fourpersian",
  28334. 0x06f4,
  28335. "fourroman",
  28336. 0x2173,
  28337. "foursuperior",
  28338. 0x2074,
  28339. "fourteencircle",
  28340. 0x246d,
  28341. "fourteenparen",
  28342. 0x2481,
  28343. "fourteenperiod",
  28344. 0x2495,
  28345. "fourthai",
  28346. 0x0e54,
  28347. "fourthtonechinese",
  28348. 0x02cb,
  28349. "fparen",
  28350. 0x24a1,
  28351. "fraction",
  28352. 0x2044,
  28353. "franc",
  28354. 0x20a3,
  28355. "g",
  28356. 0x0067,
  28357. "gabengali",
  28358. 0x0997,
  28359. "gacute",
  28360. 0x01f5,
  28361. "gadeva",
  28362. 0x0917,
  28363. "gafarabic",
  28364. 0x06af,
  28365. "gaffinalarabic",
  28366. 0xfb93,
  28367. "gafinitialarabic",
  28368. 0xfb94,
  28369. "gafmedialarabic",
  28370. 0xfb95,
  28371. "gagujarati",
  28372. 0x0a97,
  28373. "gagurmukhi",
  28374. 0x0a17,
  28375. "gahiragana",
  28376. 0x304c,
  28377. "gakatakana",
  28378. 0x30ac,
  28379. "gamma",
  28380. 0x03b3,
  28381. "gammalatinsmall",
  28382. 0x0263,
  28383. "gammasuperior",
  28384. 0x02e0,
  28385. "gangiacoptic",
  28386. 0x03eb,
  28387. "gbopomofo",
  28388. 0x310d,
  28389. "gbreve",
  28390. 0x011f,
  28391. "gcaron",
  28392. 0x01e7,
  28393. "gcedilla",
  28394. 0x0123,
  28395. "gcircle",
  28396. 0x24d6,
  28397. "gcircumflex",
  28398. 0x011d,
  28399. "gcommaaccent",
  28400. 0x0123,
  28401. "gdot",
  28402. 0x0121,
  28403. "gdotaccent",
  28404. 0x0121,
  28405. "gecyrillic",
  28406. 0x0433,
  28407. "gehiragana",
  28408. 0x3052,
  28409. "gekatakana",
  28410. 0x30b2,
  28411. "geometricallyequal",
  28412. 0x2251,
  28413. "gereshaccenthebrew",
  28414. 0x059c,
  28415. "gereshhebrew",
  28416. 0x05f3,
  28417. "gereshmuqdamhebrew",
  28418. 0x059d,
  28419. "germandbls",
  28420. 0x00df,
  28421. "gershayimaccenthebrew",
  28422. 0x059e,
  28423. "gershayimhebrew",
  28424. 0x05f4,
  28425. "getamark",
  28426. 0x3013,
  28427. "ghabengali",
  28428. 0x0998,
  28429. "ghadarmenian",
  28430. 0x0572,
  28431. "ghadeva",
  28432. 0x0918,
  28433. "ghagujarati",
  28434. 0x0a98,
  28435. "ghagurmukhi",
  28436. 0x0a18,
  28437. "ghainarabic",
  28438. 0x063a,
  28439. "ghainfinalarabic",
  28440. 0xfece,
  28441. "ghaininitialarabic",
  28442. 0xfecf,
  28443. "ghainmedialarabic",
  28444. 0xfed0,
  28445. "ghemiddlehookcyrillic",
  28446. 0x0495,
  28447. "ghestrokecyrillic",
  28448. 0x0493,
  28449. "gheupturncyrillic",
  28450. 0x0491,
  28451. "ghhadeva",
  28452. 0x095a,
  28453. "ghhagurmukhi",
  28454. 0x0a5a,
  28455. "ghook",
  28456. 0x0260,
  28457. "ghzsquare",
  28458. 0x3393,
  28459. "gihiragana",
  28460. 0x304e,
  28461. "gikatakana",
  28462. 0x30ae,
  28463. "gimarmenian",
  28464. 0x0563,
  28465. "gimel",
  28466. 0x05d2,
  28467. "gimeldagesh",
  28468. 0xfb32,
  28469. "gimeldageshhebrew",
  28470. 0xfb32,
  28471. "gimelhebrew",
  28472. 0x05d2,
  28473. "gjecyrillic",
  28474. 0x0453,
  28475. "glottalinvertedstroke",
  28476. 0x01be,
  28477. "glottalstop",
  28478. 0x0294,
  28479. "glottalstopinverted",
  28480. 0x0296,
  28481. "glottalstopmod",
  28482. 0x02c0,
  28483. "glottalstopreversed",
  28484. 0x0295,
  28485. "glottalstopreversedmod",
  28486. 0x02c1,
  28487. "glottalstopreversedsuperior",
  28488. 0x02e4,
  28489. "glottalstopstroke",
  28490. 0x02a1,
  28491. "glottalstopstrokereversed",
  28492. 0x02a2,
  28493. "gmacron",
  28494. 0x1e21,
  28495. "gmonospace",
  28496. 0xff47,
  28497. "gohiragana",
  28498. 0x3054,
  28499. "gokatakana",
  28500. 0x30b4,
  28501. "gparen",
  28502. 0x24a2,
  28503. "gpasquare",
  28504. 0x33ac,
  28505. "gradient",
  28506. 0x2207,
  28507. "grave",
  28508. 0x0060,
  28509. "gravebelowcmb",
  28510. 0x0316,
  28511. "gravecmb",
  28512. 0x0300,
  28513. "gravecomb",
  28514. 0x0300,
  28515. "gravedeva",
  28516. 0x0953,
  28517. "gravelowmod",
  28518. 0x02ce,
  28519. "gravemonospace",
  28520. 0xff40,
  28521. "gravetonecmb",
  28522. 0x0340,
  28523. "greater",
  28524. 0x003e,
  28525. "greaterequal",
  28526. 0x2265,
  28527. "greaterequalorless",
  28528. 0x22db,
  28529. "greatermonospace",
  28530. 0xff1e,
  28531. "greaterorequivalent",
  28532. 0x2273,
  28533. "greaterorless",
  28534. 0x2277,
  28535. "greateroverequal",
  28536. 0x2267,
  28537. "greatersmall",
  28538. 0xfe65,
  28539. "gscript",
  28540. 0x0261,
  28541. "gstroke",
  28542. 0x01e5,
  28543. "guhiragana",
  28544. 0x3050,
  28545. "guillemotleft",
  28546. 0x00ab,
  28547. "guillemotright",
  28548. 0x00bb,
  28549. "guilsinglleft",
  28550. 0x2039,
  28551. "guilsinglright",
  28552. 0x203a,
  28553. "gukatakana",
  28554. 0x30b0,
  28555. "guramusquare",
  28556. 0x3318,
  28557. "gysquare",
  28558. 0x33c9,
  28559. "h",
  28560. 0x0068,
  28561. "haabkhasiancyrillic",
  28562. 0x04a9,
  28563. "haaltonearabic",
  28564. 0x06c1,
  28565. "habengali",
  28566. 0x09b9,
  28567. "hadescendercyrillic",
  28568. 0x04b3,
  28569. "hadeva",
  28570. 0x0939,
  28571. "hagujarati",
  28572. 0x0ab9,
  28573. "hagurmukhi",
  28574. 0x0a39,
  28575. "haharabic",
  28576. 0x062d,
  28577. "hahfinalarabic",
  28578. 0xfea2,
  28579. "hahinitialarabic",
  28580. 0xfea3,
  28581. "hahiragana",
  28582. 0x306f,
  28583. "hahmedialarabic",
  28584. 0xfea4,
  28585. "haitusquare",
  28586. 0x332a,
  28587. "hakatakana",
  28588. 0x30cf,
  28589. "hakatakanahalfwidth",
  28590. 0xff8a,
  28591. "halantgurmukhi",
  28592. 0x0a4d,
  28593. "hamzaarabic",
  28594. 0x0621,
  28595. "hamzalowarabic",
  28596. 0x0621,
  28597. "hangulfiller",
  28598. 0x3164,
  28599. "hardsigncyrillic",
  28600. 0x044a,
  28601. "harpoonleftbarbup",
  28602. 0x21bc,
  28603. "harpoonrightbarbup",
  28604. 0x21c0,
  28605. "hasquare",
  28606. 0x33ca,
  28607. "hatafpatah",
  28608. 0x05b2,
  28609. "hatafpatah16",
  28610. 0x05b2,
  28611. "hatafpatah23",
  28612. 0x05b2,
  28613. "hatafpatah2f",
  28614. 0x05b2,
  28615. "hatafpatahhebrew",
  28616. 0x05b2,
  28617. "hatafpatahnarrowhebrew",
  28618. 0x05b2,
  28619. "hatafpatahquarterhebrew",
  28620. 0x05b2,
  28621. "hatafpatahwidehebrew",
  28622. 0x05b2,
  28623. "hatafqamats",
  28624. 0x05b3,
  28625. "hatafqamats1b",
  28626. 0x05b3,
  28627. "hatafqamats28",
  28628. 0x05b3,
  28629. "hatafqamats34",
  28630. 0x05b3,
  28631. "hatafqamatshebrew",
  28632. 0x05b3,
  28633. "hatafqamatsnarrowhebrew",
  28634. 0x05b3,
  28635. "hatafqamatsquarterhebrew",
  28636. 0x05b3,
  28637. "hatafqamatswidehebrew",
  28638. 0x05b3,
  28639. "hatafsegol",
  28640. 0x05b1,
  28641. "hatafsegol17",
  28642. 0x05b1,
  28643. "hatafsegol24",
  28644. 0x05b1,
  28645. "hatafsegol30",
  28646. 0x05b1,
  28647. "hatafsegolhebrew",
  28648. 0x05b1,
  28649. "hatafsegolnarrowhebrew",
  28650. 0x05b1,
  28651. "hatafsegolquarterhebrew",
  28652. 0x05b1,
  28653. "hatafsegolwidehebrew",
  28654. 0x05b1,
  28655. "hbar",
  28656. 0x0127,
  28657. "hbopomofo",
  28658. 0x310f,
  28659. "hbrevebelow",
  28660. 0x1e2b,
  28661. "hcedilla",
  28662. 0x1e29,
  28663. "hcircle",
  28664. 0x24d7,
  28665. "hcircumflex",
  28666. 0x0125,
  28667. "hdieresis",
  28668. 0x1e27,
  28669. "hdotaccent",
  28670. 0x1e23,
  28671. "hdotbelow",
  28672. 0x1e25,
  28673. "he",
  28674. 0x05d4,
  28675. "heart",
  28676. 0x2665,
  28677. "heartsuitblack",
  28678. 0x2665,
  28679. "heartsuitwhite",
  28680. 0x2661,
  28681. "hedagesh",
  28682. 0xfb34,
  28683. "hedageshhebrew",
  28684. 0xfb34,
  28685. "hehaltonearabic",
  28686. 0x06c1,
  28687. "heharabic",
  28688. 0x0647,
  28689. "hehebrew",
  28690. 0x05d4,
  28691. "hehfinalaltonearabic",
  28692. 0xfba7,
  28693. "hehfinalalttwoarabic",
  28694. 0xfeea,
  28695. "hehfinalarabic",
  28696. 0xfeea,
  28697. "hehhamzaabovefinalarabic",
  28698. 0xfba5,
  28699. "hehhamzaaboveisolatedarabic",
  28700. 0xfba4,
  28701. "hehinitialaltonearabic",
  28702. 0xfba8,
  28703. "hehinitialarabic",
  28704. 0xfeeb,
  28705. "hehiragana",
  28706. 0x3078,
  28707. "hehmedialaltonearabic",
  28708. 0xfba9,
  28709. "hehmedialarabic",
  28710. 0xfeec,
  28711. "heiseierasquare",
  28712. 0x337b,
  28713. "hekatakana",
  28714. 0x30d8,
  28715. "hekatakanahalfwidth",
  28716. 0xff8d,
  28717. "hekutaarusquare",
  28718. 0x3336,
  28719. "henghook",
  28720. 0x0267,
  28721. "herutusquare",
  28722. 0x3339,
  28723. "het",
  28724. 0x05d7,
  28725. "hethebrew",
  28726. 0x05d7,
  28727. "hhook",
  28728. 0x0266,
  28729. "hhooksuperior",
  28730. 0x02b1,
  28731. "hieuhacirclekorean",
  28732. 0x327b,
  28733. "hieuhaparenkorean",
  28734. 0x321b,
  28735. "hieuhcirclekorean",
  28736. 0x326d,
  28737. "hieuhkorean",
  28738. 0x314e,
  28739. "hieuhparenkorean",
  28740. 0x320d,
  28741. "hihiragana",
  28742. 0x3072,
  28743. "hikatakana",
  28744. 0x30d2,
  28745. "hikatakanahalfwidth",
  28746. 0xff8b,
  28747. "hiriq",
  28748. 0x05b4,
  28749. "hiriq14",
  28750. 0x05b4,
  28751. "hiriq21",
  28752. 0x05b4,
  28753. "hiriq2d",
  28754. 0x05b4,
  28755. "hiriqhebrew",
  28756. 0x05b4,
  28757. "hiriqnarrowhebrew",
  28758. 0x05b4,
  28759. "hiriqquarterhebrew",
  28760. 0x05b4,
  28761. "hiriqwidehebrew",
  28762. 0x05b4,
  28763. "hlinebelow",
  28764. 0x1e96,
  28765. "hmonospace",
  28766. 0xff48,
  28767. "hoarmenian",
  28768. 0x0570,
  28769. "hohipthai",
  28770. 0x0e2b,
  28771. "hohiragana",
  28772. 0x307b,
  28773. "hokatakana",
  28774. 0x30db,
  28775. "hokatakanahalfwidth",
  28776. 0xff8e,
  28777. "holam",
  28778. 0x05b9,
  28779. "holam19",
  28780. 0x05b9,
  28781. "holam26",
  28782. 0x05b9,
  28783. "holam32",
  28784. 0x05b9,
  28785. "holamhebrew",
  28786. 0x05b9,
  28787. "holamnarrowhebrew",
  28788. 0x05b9,
  28789. "holamquarterhebrew",
  28790. 0x05b9,
  28791. "holamwidehebrew",
  28792. 0x05b9,
  28793. "honokhukthai",
  28794. 0x0e2e,
  28795. "hookabovecomb",
  28796. 0x0309,
  28797. "hookcmb",
  28798. 0x0309,
  28799. "hookpalatalizedbelowcmb",
  28800. 0x0321,
  28801. "hookretroflexbelowcmb",
  28802. 0x0322,
  28803. "hoonsquare",
  28804. 0x3342,
  28805. "horicoptic",
  28806. 0x03e9,
  28807. "horizontalbar",
  28808. 0x2015,
  28809. "horncmb",
  28810. 0x031b,
  28811. "hotsprings",
  28812. 0x2668,
  28813. "house",
  28814. 0x2302,
  28815. "hparen",
  28816. 0x24a3,
  28817. "hsuperior",
  28818. 0x02b0,
  28819. "hturned",
  28820. 0x0265,
  28821. "huhiragana",
  28822. 0x3075,
  28823. "huiitosquare",
  28824. 0x3333,
  28825. "hukatakana",
  28826. 0x30d5,
  28827. "hukatakanahalfwidth",
  28828. 0xff8c,
  28829. "hungarumlaut",
  28830. 0x02dd,
  28831. "hungarumlautcmb",
  28832. 0x030b,
  28833. "hv",
  28834. 0x0195,
  28835. "hyphen",
  28836. 0x002d,
  28837. "hypheninferior",
  28838. 0xf6e5,
  28839. "hyphenmonospace",
  28840. 0xff0d,
  28841. "hyphensmall",
  28842. 0xfe63,
  28843. "hyphensuperior",
  28844. 0xf6e6,
  28845. "hyphentwo",
  28846. 0x2010,
  28847. "i",
  28848. 0x0069,
  28849. "iacute",
  28850. 0x00ed,
  28851. "iacyrillic",
  28852. 0x044f,
  28853. "ibengali",
  28854. 0x0987,
  28855. "ibopomofo",
  28856. 0x3127,
  28857. "ibreve",
  28858. 0x012d,
  28859. "icaron",
  28860. 0x01d0,
  28861. "icircle",
  28862. 0x24d8,
  28863. "icircumflex",
  28864. 0x00ee,
  28865. "icyrillic",
  28866. 0x0456,
  28867. "idblgrave",
  28868. 0x0209,
  28869. "ideographearthcircle",
  28870. 0x328f,
  28871. "ideographfirecircle",
  28872. 0x328b,
  28873. "ideographicallianceparen",
  28874. 0x323f,
  28875. "ideographiccallparen",
  28876. 0x323a,
  28877. "ideographiccentrecircle",
  28878. 0x32a5,
  28879. "ideographicclose",
  28880. 0x3006,
  28881. "ideographiccomma",
  28882. 0x3001,
  28883. "ideographiccommaleft",
  28884. 0xff64,
  28885. "ideographiccongratulationparen",
  28886. 0x3237,
  28887. "ideographiccorrectcircle",
  28888. 0x32a3,
  28889. "ideographicearthparen",
  28890. 0x322f,
  28891. "ideographicenterpriseparen",
  28892. 0x323d,
  28893. "ideographicexcellentcircle",
  28894. 0x329d,
  28895. "ideographicfestivalparen",
  28896. 0x3240,
  28897. "ideographicfinancialcircle",
  28898. 0x3296,
  28899. "ideographicfinancialparen",
  28900. 0x3236,
  28901. "ideographicfireparen",
  28902. 0x322b,
  28903. "ideographichaveparen",
  28904. 0x3232,
  28905. "ideographichighcircle",
  28906. 0x32a4,
  28907. "ideographiciterationmark",
  28908. 0x3005,
  28909. "ideographiclaborcircle",
  28910. 0x3298,
  28911. "ideographiclaborparen",
  28912. 0x3238,
  28913. "ideographicleftcircle",
  28914. 0x32a7,
  28915. "ideographiclowcircle",
  28916. 0x32a6,
  28917. "ideographicmedicinecircle",
  28918. 0x32a9,
  28919. "ideographicmetalparen",
  28920. 0x322e,
  28921. "ideographicmoonparen",
  28922. 0x322a,
  28923. "ideographicnameparen",
  28924. 0x3234,
  28925. "ideographicperiod",
  28926. 0x3002,
  28927. "ideographicprintcircle",
  28928. 0x329e,
  28929. "ideographicreachparen",
  28930. 0x3243,
  28931. "ideographicrepresentparen",
  28932. 0x3239,
  28933. "ideographicresourceparen",
  28934. 0x323e,
  28935. "ideographicrightcircle",
  28936. 0x32a8,
  28937. "ideographicsecretcircle",
  28938. 0x3299,
  28939. "ideographicselfparen",
  28940. 0x3242,
  28941. "ideographicsocietyparen",
  28942. 0x3233,
  28943. "ideographicspace",
  28944. 0x3000,
  28945. "ideographicspecialparen",
  28946. 0x3235,
  28947. "ideographicstockparen",
  28948. 0x3231,
  28949. "ideographicstudyparen",
  28950. 0x323b,
  28951. "ideographicsunparen",
  28952. 0x3230,
  28953. "ideographicsuperviseparen",
  28954. 0x323c,
  28955. "ideographicwaterparen",
  28956. 0x322c,
  28957. "ideographicwoodparen",
  28958. 0x322d,
  28959. "ideographiczero",
  28960. 0x3007,
  28961. "ideographmetalcircle",
  28962. 0x328e,
  28963. "ideographmooncircle",
  28964. 0x328a,
  28965. "ideographnamecircle",
  28966. 0x3294,
  28967. "ideographsuncircle",
  28968. 0x3290,
  28969. "ideographwatercircle",
  28970. 0x328c,
  28971. "ideographwoodcircle",
  28972. 0x328d,
  28973. "ideva",
  28974. 0x0907,
  28975. "idieresis",
  28976. 0x00ef,
  28977. "idieresisacute",
  28978. 0x1e2f,
  28979. "idieresiscyrillic",
  28980. 0x04e5,
  28981. "idotbelow",
  28982. 0x1ecb,
  28983. "iebrevecyrillic",
  28984. 0x04d7,
  28985. "iecyrillic",
  28986. 0x0435,
  28987. "ieungacirclekorean",
  28988. 0x3275,
  28989. "ieungaparenkorean",
  28990. 0x3215,
  28991. "ieungcirclekorean",
  28992. 0x3267,
  28993. "ieungkorean",
  28994. 0x3147,
  28995. "ieungparenkorean",
  28996. 0x3207,
  28997. "igrave",
  28998. 0x00ec,
  28999. "igujarati",
  29000. 0x0a87,
  29001. "igurmukhi",
  29002. 0x0a07,
  29003. "ihiragana",
  29004. 0x3044,
  29005. "ihookabove",
  29006. 0x1ec9,
  29007. "iibengali",
  29008. 0x0988,
  29009. "iicyrillic",
  29010. 0x0438,
  29011. "iideva",
  29012. 0x0908,
  29013. "iigujarati",
  29014. 0x0a88,
  29015. "iigurmukhi",
  29016. 0x0a08,
  29017. "iimatragurmukhi",
  29018. 0x0a40,
  29019. "iinvertedbreve",
  29020. 0x020b,
  29021. "iishortcyrillic",
  29022. 0x0439,
  29023. "iivowelsignbengali",
  29024. 0x09c0,
  29025. "iivowelsigndeva",
  29026. 0x0940,
  29027. "iivowelsigngujarati",
  29028. 0x0ac0,
  29029. "ij",
  29030. 0x0133,
  29031. "ikatakana",
  29032. 0x30a4,
  29033. "ikatakanahalfwidth",
  29034. 0xff72,
  29035. "ikorean",
  29036. 0x3163,
  29037. "ilde",
  29038. 0x02dc,
  29039. "iluyhebrew",
  29040. 0x05ac,
  29041. "imacron",
  29042. 0x012b,
  29043. "imacroncyrillic",
  29044. 0x04e3,
  29045. "imageorapproximatelyequal",
  29046. 0x2253,
  29047. "imatragurmukhi",
  29048. 0x0a3f,
  29049. "imonospace",
  29050. 0xff49,
  29051. "increment",
  29052. 0x2206,
  29053. "infinity",
  29054. 0x221e,
  29055. "iniarmenian",
  29056. 0x056b,
  29057. "integral",
  29058. 0x222b,
  29059. "integralbottom",
  29060. 0x2321,
  29061. "integralbt",
  29062. 0x2321,
  29063. "integralex",
  29064. 0xf8f5,
  29065. "integraltop",
  29066. 0x2320,
  29067. "integraltp",
  29068. 0x2320,
  29069. "intersection",
  29070. 0x2229,
  29071. "intisquare",
  29072. 0x3305,
  29073. "invbullet",
  29074. 0x25d8,
  29075. "invcircle",
  29076. 0x25d9,
  29077. "invsmileface",
  29078. 0x263b,
  29079. "iocyrillic",
  29080. 0x0451,
  29081. "iogonek",
  29082. 0x012f,
  29083. "iota",
  29084. 0x03b9,
  29085. "iotadieresis",
  29086. 0x03ca,
  29087. "iotadieresistonos",
  29088. 0x0390,
  29089. "iotalatin",
  29090. 0x0269,
  29091. "iotatonos",
  29092. 0x03af,
  29093. "iparen",
  29094. 0x24a4,
  29095. "irigurmukhi",
  29096. 0x0a72,
  29097. "ismallhiragana",
  29098. 0x3043,
  29099. "ismallkatakana",
  29100. 0x30a3,
  29101. "ismallkatakanahalfwidth",
  29102. 0xff68,
  29103. "issharbengali",
  29104. 0x09fa,
  29105. "istroke",
  29106. 0x0268,
  29107. "isuperior",
  29108. 0xf6ed,
  29109. "iterationhiragana",
  29110. 0x309d,
  29111. "iterationkatakana",
  29112. 0x30fd,
  29113. "itilde",
  29114. 0x0129,
  29115. "itildebelow",
  29116. 0x1e2d,
  29117. "iubopomofo",
  29118. 0x3129,
  29119. "iucyrillic",
  29120. 0x044e,
  29121. "ivowelsignbengali",
  29122. 0x09bf,
  29123. "ivowelsigndeva",
  29124. 0x093f,
  29125. "ivowelsigngujarati",
  29126. 0x0abf,
  29127. "izhitsacyrillic",
  29128. 0x0475,
  29129. "izhitsadblgravecyrillic",
  29130. 0x0477,
  29131. "j",
  29132. 0x006a,
  29133. "jaarmenian",
  29134. 0x0571,
  29135. "jabengali",
  29136. 0x099c,
  29137. "jadeva",
  29138. 0x091c,
  29139. "jagujarati",
  29140. 0x0a9c,
  29141. "jagurmukhi",
  29142. 0x0a1c,
  29143. "jbopomofo",
  29144. 0x3110,
  29145. "jcaron",
  29146. 0x01f0,
  29147. "jcircle",
  29148. 0x24d9,
  29149. "jcircumflex",
  29150. 0x0135,
  29151. "jcrossedtail",
  29152. 0x029d,
  29153. "jdotlessstroke",
  29154. 0x025f,
  29155. "jecyrillic",
  29156. 0x0458,
  29157. "jeemarabic",
  29158. 0x062c,
  29159. "jeemfinalarabic",
  29160. 0xfe9e,
  29161. "jeeminitialarabic",
  29162. 0xfe9f,
  29163. "jeemmedialarabic",
  29164. 0xfea0,
  29165. "jeharabic",
  29166. 0x0698,
  29167. "jehfinalarabic",
  29168. 0xfb8b,
  29169. "jhabengali",
  29170. 0x099d,
  29171. "jhadeva",
  29172. 0x091d,
  29173. "jhagujarati",
  29174. 0x0a9d,
  29175. "jhagurmukhi",
  29176. 0x0a1d,
  29177. "jheharmenian",
  29178. 0x057b,
  29179. "jis",
  29180. 0x3004,
  29181. "jmonospace",
  29182. 0xff4a,
  29183. "jparen",
  29184. 0x24a5,
  29185. "jsuperior",
  29186. 0x02b2,
  29187. "k",
  29188. 0x006b,
  29189. "kabashkircyrillic",
  29190. 0x04a1,
  29191. "kabengali",
  29192. 0x0995,
  29193. "kacute",
  29194. 0x1e31,
  29195. "kacyrillic",
  29196. 0x043a,
  29197. "kadescendercyrillic",
  29198. 0x049b,
  29199. "kadeva",
  29200. 0x0915,
  29201. "kaf",
  29202. 0x05db,
  29203. "kafarabic",
  29204. 0x0643,
  29205. "kafdagesh",
  29206. 0xfb3b,
  29207. "kafdageshhebrew",
  29208. 0xfb3b,
  29209. "kaffinalarabic",
  29210. 0xfeda,
  29211. "kafhebrew",
  29212. 0x05db,
  29213. "kafinitialarabic",
  29214. 0xfedb,
  29215. "kafmedialarabic",
  29216. 0xfedc,
  29217. "kafrafehebrew",
  29218. 0xfb4d,
  29219. "kagujarati",
  29220. 0x0a95,
  29221. "kagurmukhi",
  29222. 0x0a15,
  29223. "kahiragana",
  29224. 0x304b,
  29225. "kahookcyrillic",
  29226. 0x04c4,
  29227. "kakatakana",
  29228. 0x30ab,
  29229. "kakatakanahalfwidth",
  29230. 0xff76,
  29231. "kappa",
  29232. 0x03ba,
  29233. "kappasymbolgreek",
  29234. 0x03f0,
  29235. "kapyeounmieumkorean",
  29236. 0x3171,
  29237. "kapyeounphieuphkorean",
  29238. 0x3184,
  29239. "kapyeounpieupkorean",
  29240. 0x3178,
  29241. "kapyeounssangpieupkorean",
  29242. 0x3179,
  29243. "karoriisquare",
  29244. 0x330d,
  29245. "kashidaautoarabic",
  29246. 0x0640,
  29247. "kashidaautonosidebearingarabic",
  29248. 0x0640,
  29249. "kasmallkatakana",
  29250. 0x30f5,
  29251. "kasquare",
  29252. 0x3384,
  29253. "kasraarabic",
  29254. 0x0650,
  29255. "kasratanarabic",
  29256. 0x064d,
  29257. "kastrokecyrillic",
  29258. 0x049f,
  29259. "katahiraprolongmarkhalfwidth",
  29260. 0xff70,
  29261. "kaverticalstrokecyrillic",
  29262. 0x049d,
  29263. "kbopomofo",
  29264. 0x310e,
  29265. "kcalsquare",
  29266. 0x3389,
  29267. "kcaron",
  29268. 0x01e9,
  29269. "kcedilla",
  29270. 0x0137,
  29271. "kcircle",
  29272. 0x24da,
  29273. "kcommaaccent",
  29274. 0x0137,
  29275. "kdotbelow",
  29276. 0x1e33,
  29277. "keharmenian",
  29278. 0x0584,
  29279. "kehiragana",
  29280. 0x3051,
  29281. "kekatakana",
  29282. 0x30b1,
  29283. "kekatakanahalfwidth",
  29284. 0xff79,
  29285. "kenarmenian",
  29286. 0x056f,
  29287. "kesmallkatakana",
  29288. 0x30f6,
  29289. "kgreenlandic",
  29290. 0x0138,
  29291. "khabengali",
  29292. 0x0996,
  29293. "khacyrillic",
  29294. 0x0445,
  29295. "khadeva",
  29296. 0x0916,
  29297. "khagujarati",
  29298. 0x0a96,
  29299. "khagurmukhi",
  29300. 0x0a16,
  29301. "khaharabic",
  29302. 0x062e,
  29303. "khahfinalarabic",
  29304. 0xfea6,
  29305. "khahinitialarabic",
  29306. 0xfea7,
  29307. "khahmedialarabic",
  29308. 0xfea8,
  29309. "kheicoptic",
  29310. 0x03e7,
  29311. "khhadeva",
  29312. 0x0959,
  29313. "khhagurmukhi",
  29314. 0x0a59,
  29315. "khieukhacirclekorean",
  29316. 0x3278,
  29317. "khieukhaparenkorean",
  29318. 0x3218,
  29319. "khieukhcirclekorean",
  29320. 0x326a,
  29321. "khieukhkorean",
  29322. 0x314b,
  29323. "khieukhparenkorean",
  29324. 0x320a,
  29325. "khokhaithai",
  29326. 0x0e02,
  29327. "khokhonthai",
  29328. 0x0e05,
  29329. "khokhuatthai",
  29330. 0x0e03,
  29331. "khokhwaithai",
  29332. 0x0e04,
  29333. "khomutthai",
  29334. 0x0e5b,
  29335. "khook",
  29336. 0x0199,
  29337. "khorakhangthai",
  29338. 0x0e06,
  29339. "khzsquare",
  29340. 0x3391,
  29341. "kihiragana",
  29342. 0x304d,
  29343. "kikatakana",
  29344. 0x30ad,
  29345. "kikatakanahalfwidth",
  29346. 0xff77,
  29347. "kiroguramusquare",
  29348. 0x3315,
  29349. "kiromeetorusquare",
  29350. 0x3316,
  29351. "kirosquare",
  29352. 0x3314,
  29353. "kiyeokacirclekorean",
  29354. 0x326e,
  29355. "kiyeokaparenkorean",
  29356. 0x320e,
  29357. "kiyeokcirclekorean",
  29358. 0x3260,
  29359. "kiyeokkorean",
  29360. 0x3131,
  29361. "kiyeokparenkorean",
  29362. 0x3200,
  29363. "kiyeoksioskorean",
  29364. 0x3133,
  29365. "kjecyrillic",
  29366. 0x045c,
  29367. "klinebelow",
  29368. 0x1e35,
  29369. "klsquare",
  29370. 0x3398,
  29371. "kmcubedsquare",
  29372. 0x33a6,
  29373. "kmonospace",
  29374. 0xff4b,
  29375. "kmsquaredsquare",
  29376. 0x33a2,
  29377. "kohiragana",
  29378. 0x3053,
  29379. "kohmsquare",
  29380. 0x33c0,
  29381. "kokaithai",
  29382. 0x0e01,
  29383. "kokatakana",
  29384. 0x30b3,
  29385. "kokatakanahalfwidth",
  29386. 0xff7a,
  29387. "kooposquare",
  29388. 0x331e,
  29389. "koppacyrillic",
  29390. 0x0481,
  29391. "koreanstandardsymbol",
  29392. 0x327f,
  29393. "koroniscmb",
  29394. 0x0343,
  29395. "kparen",
  29396. 0x24a6,
  29397. "kpasquare",
  29398. 0x33aa,
  29399. "ksicyrillic",
  29400. 0x046f,
  29401. "ktsquare",
  29402. 0x33cf,
  29403. "kturned",
  29404. 0x029e,
  29405. "kuhiragana",
  29406. 0x304f,
  29407. "kukatakana",
  29408. 0x30af,
  29409. "kukatakanahalfwidth",
  29410. 0xff78,
  29411. "kvsquare",
  29412. 0x33b8,
  29413. "kwsquare",
  29414. 0x33be,
  29415. "l",
  29416. 0x006c,
  29417. "labengali",
  29418. 0x09b2,
  29419. "lacute",
  29420. 0x013a,
  29421. "ladeva",
  29422. 0x0932,
  29423. "lagujarati",
  29424. 0x0ab2,
  29425. "lagurmukhi",
  29426. 0x0a32,
  29427. "lakkhangyaothai",
  29428. 0x0e45,
  29429. "lamaleffinalarabic",
  29430. 0xfefc,
  29431. "lamalefhamzaabovefinalarabic",
  29432. 0xfef8,
  29433. "lamalefhamzaaboveisolatedarabic",
  29434. 0xfef7,
  29435. "lamalefhamzabelowfinalarabic",
  29436. 0xfefa,
  29437. "lamalefhamzabelowisolatedarabic",
  29438. 0xfef9,
  29439. "lamalefisolatedarabic",
  29440. 0xfefb,
  29441. "lamalefmaddaabovefinalarabic",
  29442. 0xfef6,
  29443. "lamalefmaddaaboveisolatedarabic",
  29444. 0xfef5,
  29445. "lamarabic",
  29446. 0x0644,
  29447. "lambda",
  29448. 0x03bb,
  29449. "lambdastroke",
  29450. 0x019b,
  29451. "lamed",
  29452. 0x05dc,
  29453. "lameddagesh",
  29454. 0xfb3c,
  29455. "lameddageshhebrew",
  29456. 0xfb3c,
  29457. "lamedhebrew",
  29458. 0x05dc,
  29459. "lamfinalarabic",
  29460. 0xfede,
  29461. "lamhahinitialarabic",
  29462. 0xfcca,
  29463. "laminitialarabic",
  29464. 0xfedf,
  29465. "lamjeeminitialarabic",
  29466. 0xfcc9,
  29467. "lamkhahinitialarabic",
  29468. 0xfccb,
  29469. "lamlamhehisolatedarabic",
  29470. 0xfdf2,
  29471. "lammedialarabic",
  29472. 0xfee0,
  29473. "lammeemhahinitialarabic",
  29474. 0xfd88,
  29475. "lammeeminitialarabic",
  29476. 0xfccc,
  29477. "largecircle",
  29478. 0x25ef,
  29479. "lbar",
  29480. 0x019a,
  29481. "lbelt",
  29482. 0x026c,
  29483. "lbopomofo",
  29484. 0x310c,
  29485. "lcaron",
  29486. 0x013e,
  29487. "lcedilla",
  29488. 0x013c,
  29489. "lcircle",
  29490. 0x24db,
  29491. "lcircumflexbelow",
  29492. 0x1e3d,
  29493. "lcommaaccent",
  29494. 0x013c,
  29495. "ldot",
  29496. 0x0140,
  29497. "ldotaccent",
  29498. 0x0140,
  29499. "ldotbelow",
  29500. 0x1e37,
  29501. "ldotbelowmacron",
  29502. 0x1e39,
  29503. "leftangleabovecmb",
  29504. 0x031a,
  29505. "lefttackbelowcmb",
  29506. 0x0318,
  29507. "less",
  29508. 0x003c,
  29509. "lessequal",
  29510. 0x2264,
  29511. "lessequalorgreater",
  29512. 0x22da,
  29513. "lessmonospace",
  29514. 0xff1c,
  29515. "lessorequivalent",
  29516. 0x2272,
  29517. "lessorgreater",
  29518. 0x2276,
  29519. "lessoverequal",
  29520. 0x2266,
  29521. "lesssmall",
  29522. 0xfe64,
  29523. "lezh",
  29524. 0x026e,
  29525. "lfblock",
  29526. 0x258c,
  29527. "lhookretroflex",
  29528. 0x026d,
  29529. "lira",
  29530. 0x20a4,
  29531. "liwnarmenian",
  29532. 0x056c,
  29533. "lj",
  29534. 0x01c9,
  29535. "ljecyrillic",
  29536. 0x0459,
  29537. "ll",
  29538. 0xf6c0,
  29539. "lladeva",
  29540. 0x0933,
  29541. "llagujarati",
  29542. 0x0ab3,
  29543. "llinebelow",
  29544. 0x1e3b,
  29545. "llladeva",
  29546. 0x0934,
  29547. "llvocalicbengali",
  29548. 0x09e1,
  29549. "llvocalicdeva",
  29550. 0x0961,
  29551. "llvocalicvowelsignbengali",
  29552. 0x09e3,
  29553. "llvocalicvowelsigndeva",
  29554. 0x0963,
  29555. "lmiddletilde",
  29556. 0x026b,
  29557. "lmonospace",
  29558. 0xff4c,
  29559. "lmsquare",
  29560. 0x33d0,
  29561. "lochulathai",
  29562. 0x0e2c,
  29563. "logicaland",
  29564. 0x2227,
  29565. "logicalnot",
  29566. 0x00ac,
  29567. "logicalnotreversed",
  29568. 0x2310,
  29569. "logicalor",
  29570. 0x2228,
  29571. "lolingthai",
  29572. 0x0e25,
  29573. "longs",
  29574. 0x017f,
  29575. "lowlinecenterline",
  29576. 0xfe4e,
  29577. "lowlinecmb",
  29578. 0x0332,
  29579. "lowlinedashed",
  29580. 0xfe4d,
  29581. "lozenge",
  29582. 0x25ca,
  29583. "lparen",
  29584. 0x24a7,
  29585. "lslash",
  29586. 0x0142,
  29587. "lsquare",
  29588. 0x2113,
  29589. "lsuperior",
  29590. 0xf6ee,
  29591. "ltshade",
  29592. 0x2591,
  29593. "luthai",
  29594. 0x0e26,
  29595. "lvocalicbengali",
  29596. 0x098c,
  29597. "lvocalicdeva",
  29598. 0x090c,
  29599. "lvocalicvowelsignbengali",
  29600. 0x09e2,
  29601. "lvocalicvowelsigndeva",
  29602. 0x0962,
  29603. "lxsquare",
  29604. 0x33d3,
  29605. "m",
  29606. 0x006d,
  29607. "mabengali",
  29608. 0x09ae,
  29609. "macron",
  29610. 0x00af,
  29611. "macronbelowcmb",
  29612. 0x0331,
  29613. "macroncmb",
  29614. 0x0304,
  29615. "macronlowmod",
  29616. 0x02cd,
  29617. "macronmonospace",
  29618. 0xffe3,
  29619. "macute",
  29620. 0x1e3f,
  29621. "madeva",
  29622. 0x092e,
  29623. "magujarati",
  29624. 0x0aae,
  29625. "magurmukhi",
  29626. 0x0a2e,
  29627. "mahapakhhebrew",
  29628. 0x05a4,
  29629. "mahapakhlefthebrew",
  29630. 0x05a4,
  29631. "mahiragana",
  29632. 0x307e,
  29633. "maichattawalowleftthai",
  29634. 0xf895,
  29635. "maichattawalowrightthai",
  29636. 0xf894,
  29637. "maichattawathai",
  29638. 0x0e4b,
  29639. "maichattawaupperleftthai",
  29640. 0xf893,
  29641. "maieklowleftthai",
  29642. 0xf88c,
  29643. "maieklowrightthai",
  29644. 0xf88b,
  29645. "maiekthai",
  29646. 0x0e48,
  29647. "maiekupperleftthai",
  29648. 0xf88a,
  29649. "maihanakatleftthai",
  29650. 0xf884,
  29651. "maihanakatthai",
  29652. 0x0e31,
  29653. "maitaikhuleftthai",
  29654. 0xf889,
  29655. "maitaikhuthai",
  29656. 0x0e47,
  29657. "maitholowleftthai",
  29658. 0xf88f,
  29659. "maitholowrightthai",
  29660. 0xf88e,
  29661. "maithothai",
  29662. 0x0e49,
  29663. "maithoupperleftthai",
  29664. 0xf88d,
  29665. "maitrilowleftthai",
  29666. 0xf892,
  29667. "maitrilowrightthai",
  29668. 0xf891,
  29669. "maitrithai",
  29670. 0x0e4a,
  29671. "maitriupperleftthai",
  29672. 0xf890,
  29673. "maiyamokthai",
  29674. 0x0e46,
  29675. "makatakana",
  29676. 0x30de,
  29677. "makatakanahalfwidth",
  29678. 0xff8f,
  29679. "male",
  29680. 0x2642,
  29681. "mansyonsquare",
  29682. 0x3347,
  29683. "maqafhebrew",
  29684. 0x05be,
  29685. "mars",
  29686. 0x2642,
  29687. "masoracirclehebrew",
  29688. 0x05af,
  29689. "masquare",
  29690. 0x3383,
  29691. "mbopomofo",
  29692. 0x3107,
  29693. "mbsquare",
  29694. 0x33d4,
  29695. "mcircle",
  29696. 0x24dc,
  29697. "mcubedsquare",
  29698. 0x33a5,
  29699. "mdotaccent",
  29700. 0x1e41,
  29701. "mdotbelow",
  29702. 0x1e43,
  29703. "meemarabic",
  29704. 0x0645,
  29705. "meemfinalarabic",
  29706. 0xfee2,
  29707. "meeminitialarabic",
  29708. 0xfee3,
  29709. "meemmedialarabic",
  29710. 0xfee4,
  29711. "meemmeeminitialarabic",
  29712. 0xfcd1,
  29713. "meemmeemisolatedarabic",
  29714. 0xfc48,
  29715. "meetorusquare",
  29716. 0x334d,
  29717. "mehiragana",
  29718. 0x3081,
  29719. "meizierasquare",
  29720. 0x337e,
  29721. "mekatakana",
  29722. 0x30e1,
  29723. "mekatakanahalfwidth",
  29724. 0xff92,
  29725. "mem",
  29726. 0x05de,
  29727. "memdagesh",
  29728. 0xfb3e,
  29729. "memdageshhebrew",
  29730. 0xfb3e,
  29731. "memhebrew",
  29732. 0x05de,
  29733. "menarmenian",
  29734. 0x0574,
  29735. "merkhahebrew",
  29736. 0x05a5,
  29737. "merkhakefulahebrew",
  29738. 0x05a6,
  29739. "merkhakefulalefthebrew",
  29740. 0x05a6,
  29741. "merkhalefthebrew",
  29742. 0x05a5,
  29743. "mhook",
  29744. 0x0271,
  29745. "mhzsquare",
  29746. 0x3392,
  29747. "middledotkatakanahalfwidth",
  29748. 0xff65,
  29749. "middot",
  29750. 0x00b7,
  29751. "mieumacirclekorean",
  29752. 0x3272,
  29753. "mieumaparenkorean",
  29754. 0x3212,
  29755. "mieumcirclekorean",
  29756. 0x3264,
  29757. "mieumkorean",
  29758. 0x3141,
  29759. "mieumpansioskorean",
  29760. 0x3170,
  29761. "mieumparenkorean",
  29762. 0x3204,
  29763. "mieumpieupkorean",
  29764. 0x316e,
  29765. "mieumsioskorean",
  29766. 0x316f,
  29767. "mihiragana",
  29768. 0x307f,
  29769. "mikatakana",
  29770. 0x30df,
  29771. "mikatakanahalfwidth",
  29772. 0xff90,
  29773. "minus",
  29774. 0x2212,
  29775. "minusbelowcmb",
  29776. 0x0320,
  29777. "minuscircle",
  29778. 0x2296,
  29779. "minusmod",
  29780. 0x02d7,
  29781. "minusplus",
  29782. 0x2213,
  29783. "minute",
  29784. 0x2032,
  29785. "miribaarusquare",
  29786. 0x334a,
  29787. "mirisquare",
  29788. 0x3349,
  29789. "mlonglegturned",
  29790. 0x0270,
  29791. "mlsquare",
  29792. 0x3396,
  29793. "mmcubedsquare",
  29794. 0x33a3,
  29795. "mmonospace",
  29796. 0xff4d,
  29797. "mmsquaredsquare",
  29798. 0x339f,
  29799. "mohiragana",
  29800. 0x3082,
  29801. "mohmsquare",
  29802. 0x33c1,
  29803. "mokatakana",
  29804. 0x30e2,
  29805. "mokatakanahalfwidth",
  29806. 0xff93,
  29807. "molsquare",
  29808. 0x33d6,
  29809. "momathai",
  29810. 0x0e21,
  29811. "moverssquare",
  29812. 0x33a7,
  29813. "moverssquaredsquare",
  29814. 0x33a8,
  29815. "mparen",
  29816. 0x24a8,
  29817. "mpasquare",
  29818. 0x33ab,
  29819. "mssquare",
  29820. 0x33b3,
  29821. "msuperior",
  29822. 0xf6ef,
  29823. "mturned",
  29824. 0x026f,
  29825. "mu",
  29826. 0x00b5,
  29827. "mu1",
  29828. 0x00b5,
  29829. "muasquare",
  29830. 0x3382,
  29831. "muchgreater",
  29832. 0x226b,
  29833. "muchless",
  29834. 0x226a,
  29835. "mufsquare",
  29836. 0x338c,
  29837. "mugreek",
  29838. 0x03bc,
  29839. "mugsquare",
  29840. 0x338d,
  29841. "muhiragana",
  29842. 0x3080,
  29843. "mukatakana",
  29844. 0x30e0,
  29845. "mukatakanahalfwidth",
  29846. 0xff91,
  29847. "mulsquare",
  29848. 0x3395,
  29849. "multiply",
  29850. 0x00d7,
  29851. "mumsquare",
  29852. 0x339b,
  29853. "munahhebrew",
  29854. 0x05a3,
  29855. "munahlefthebrew",
  29856. 0x05a3,
  29857. "musicalnote",
  29858. 0x266a,
  29859. "musicalnotedbl",
  29860. 0x266b,
  29861. "musicflatsign",
  29862. 0x266d,
  29863. "musicsharpsign",
  29864. 0x266f,
  29865. "mussquare",
  29866. 0x33b2,
  29867. "muvsquare",
  29868. 0x33b6,
  29869. "muwsquare",
  29870. 0x33bc,
  29871. "mvmegasquare",
  29872. 0x33b9,
  29873. "mvsquare",
  29874. 0x33b7,
  29875. "mwmegasquare",
  29876. 0x33bf,
  29877. "mwsquare",
  29878. 0x33bd,
  29879. "n",
  29880. 0x006e,
  29881. "nabengali",
  29882. 0x09a8,
  29883. "nabla",
  29884. 0x2207,
  29885. "nacute",
  29886. 0x0144,
  29887. "nadeva",
  29888. 0x0928,
  29889. "nagujarati",
  29890. 0x0aa8,
  29891. "nagurmukhi",
  29892. 0x0a28,
  29893. "nahiragana",
  29894. 0x306a,
  29895. "nakatakana",
  29896. 0x30ca,
  29897. "nakatakanahalfwidth",
  29898. 0xff85,
  29899. "napostrophe",
  29900. 0x0149,
  29901. "nasquare",
  29902. 0x3381,
  29903. "nbopomofo",
  29904. 0x310b,
  29905. "nbspace",
  29906. 0x00a0,
  29907. "ncaron",
  29908. 0x0148,
  29909. "ncedilla",
  29910. 0x0146,
  29911. "ncircle",
  29912. 0x24dd,
  29913. "ncircumflexbelow",
  29914. 0x1e4b,
  29915. "ncommaaccent",
  29916. 0x0146,
  29917. "ndotaccent",
  29918. 0x1e45,
  29919. "ndotbelow",
  29920. 0x1e47,
  29921. "nehiragana",
  29922. 0x306d,
  29923. "nekatakana",
  29924. 0x30cd,
  29925. "nekatakanahalfwidth",
  29926. 0xff88,
  29927. "newsheqelsign",
  29928. 0x20aa,
  29929. "nfsquare",
  29930. 0x338b,
  29931. "ngabengali",
  29932. 0x0999,
  29933. "ngadeva",
  29934. 0x0919,
  29935. "ngagujarati",
  29936. 0x0a99,
  29937. "ngagurmukhi",
  29938. 0x0a19,
  29939. "ngonguthai",
  29940. 0x0e07,
  29941. "nhiragana",
  29942. 0x3093,
  29943. "nhookleft",
  29944. 0x0272,
  29945. "nhookretroflex",
  29946. 0x0273,
  29947. "nieunacirclekorean",
  29948. 0x326f,
  29949. "nieunaparenkorean",
  29950. 0x320f,
  29951. "nieuncieuckorean",
  29952. 0x3135,
  29953. "nieuncirclekorean",
  29954. 0x3261,
  29955. "nieunhieuhkorean",
  29956. 0x3136,
  29957. "nieunkorean",
  29958. 0x3134,
  29959. "nieunpansioskorean",
  29960. 0x3168,
  29961. "nieunparenkorean",
  29962. 0x3201,
  29963. "nieunsioskorean",
  29964. 0x3167,
  29965. "nieuntikeutkorean",
  29966. 0x3166,
  29967. "nihiragana",
  29968. 0x306b,
  29969. "nikatakana",
  29970. 0x30cb,
  29971. "nikatakanahalfwidth",
  29972. 0xff86,
  29973. "nikhahitleftthai",
  29974. 0xf899,
  29975. "nikhahitthai",
  29976. 0x0e4d,
  29977. "nine",
  29978. 0x0039,
  29979. "ninearabic",
  29980. 0x0669,
  29981. "ninebengali",
  29982. 0x09ef,
  29983. "ninecircle",
  29984. 0x2468,
  29985. "ninecircleinversesansserif",
  29986. 0x2792,
  29987. "ninedeva",
  29988. 0x096f,
  29989. "ninegujarati",
  29990. 0x0aef,
  29991. "ninegurmukhi",
  29992. 0x0a6f,
  29993. "ninehackarabic",
  29994. 0x0669,
  29995. "ninehangzhou",
  29996. 0x3029,
  29997. "nineideographicparen",
  29998. 0x3228,
  29999. "nineinferior",
  30000. 0x2089,
  30001. "ninemonospace",
  30002. 0xff19,
  30003. "nineoldstyle",
  30004. 0xf739,
  30005. "nineparen",
  30006. 0x247c,
  30007. "nineperiod",
  30008. 0x2490,
  30009. "ninepersian",
  30010. 0x06f9,
  30011. "nineroman",
  30012. 0x2178,
  30013. "ninesuperior",
  30014. 0x2079,
  30015. "nineteencircle",
  30016. 0x2472,
  30017. "nineteenparen",
  30018. 0x2486,
  30019. "nineteenperiod",
  30020. 0x249a,
  30021. "ninethai",
  30022. 0x0e59,
  30023. "nj",
  30024. 0x01cc,
  30025. "njecyrillic",
  30026. 0x045a,
  30027. "nkatakana",
  30028. 0x30f3,
  30029. "nkatakanahalfwidth",
  30030. 0xff9d,
  30031. "nlegrightlong",
  30032. 0x019e,
  30033. "nlinebelow",
  30034. 0x1e49,
  30035. "nmonospace",
  30036. 0xff4e,
  30037. "nmsquare",
  30038. 0x339a,
  30039. "nnabengali",
  30040. 0x09a3,
  30041. "nnadeva",
  30042. 0x0923,
  30043. "nnagujarati",
  30044. 0x0aa3,
  30045. "nnagurmukhi",
  30046. 0x0a23,
  30047. "nnnadeva",
  30048. 0x0929,
  30049. "nohiragana",
  30050. 0x306e,
  30051. "nokatakana",
  30052. 0x30ce,
  30053. "nokatakanahalfwidth",
  30054. 0xff89,
  30055. "nonbreakingspace",
  30056. 0x00a0,
  30057. "nonenthai",
  30058. 0x0e13,
  30059. "nonuthai",
  30060. 0x0e19,
  30061. "noonarabic",
  30062. 0x0646,
  30063. "noonfinalarabic",
  30064. 0xfee6,
  30065. "noonghunnaarabic",
  30066. 0x06ba,
  30067. "noonghunnafinalarabic",
  30068. 0xfb9f,
  30069. "nooninitialarabic",
  30070. 0xfee7,
  30071. "noonjeeminitialarabic",
  30072. 0xfcd2,
  30073. "noonjeemisolatedarabic",
  30074. 0xfc4b,
  30075. "noonmedialarabic",
  30076. 0xfee8,
  30077. "noonmeeminitialarabic",
  30078. 0xfcd5,
  30079. "noonmeemisolatedarabic",
  30080. 0xfc4e,
  30081. "noonnoonfinalarabic",
  30082. 0xfc8d,
  30083. "notcontains",
  30084. 0x220c,
  30085. "notelement",
  30086. 0x2209,
  30087. "notelementof",
  30088. 0x2209,
  30089. "notequal",
  30090. 0x2260,
  30091. "notgreater",
  30092. 0x226f,
  30093. "notgreaternorequal",
  30094. 0x2271,
  30095. "notgreaternorless",
  30096. 0x2279,
  30097. "notidentical",
  30098. 0x2262,
  30099. "notless",
  30100. 0x226e,
  30101. "notlessnorequal",
  30102. 0x2270,
  30103. "notparallel",
  30104. 0x2226,
  30105. "notprecedes",
  30106. 0x2280,
  30107. "notsubset",
  30108. 0x2284,
  30109. "notsucceeds",
  30110. 0x2281,
  30111. "notsuperset",
  30112. 0x2285,
  30113. "nowarmenian",
  30114. 0x0576,
  30115. "nparen",
  30116. 0x24a9,
  30117. "nssquare",
  30118. 0x33b1,
  30119. "nsuperior",
  30120. 0x207f,
  30121. "ntilde",
  30122. 0x00f1,
  30123. "nu",
  30124. 0x03bd,
  30125. "nuhiragana",
  30126. 0x306c,
  30127. "nukatakana",
  30128. 0x30cc,
  30129. "nukatakanahalfwidth",
  30130. 0xff87,
  30131. "nuktabengali",
  30132. 0x09bc,
  30133. "nuktadeva",
  30134. 0x093c,
  30135. "nuktagujarati",
  30136. 0x0abc,
  30137. "nuktagurmukhi",
  30138. 0x0a3c,
  30139. "numbersign",
  30140. 0x0023,
  30141. "numbersignmonospace",
  30142. 0xff03,
  30143. "numbersignsmall",
  30144. 0xfe5f,
  30145. "numeralsigngreek",
  30146. 0x0374,
  30147. "numeralsignlowergreek",
  30148. 0x0375,
  30149. "numero",
  30150. 0x2116,
  30151. "nun",
  30152. 0x05e0,
  30153. "nundagesh",
  30154. 0xfb40,
  30155. "nundageshhebrew",
  30156. 0xfb40,
  30157. "nunhebrew",
  30158. 0x05e0,
  30159. "nvsquare",
  30160. 0x33b5,
  30161. "nwsquare",
  30162. 0x33bb,
  30163. "nyabengali",
  30164. 0x099e,
  30165. "nyadeva",
  30166. 0x091e,
  30167. "nyagujarati",
  30168. 0x0a9e,
  30169. "nyagurmukhi",
  30170. 0x0a1e,
  30171. "o",
  30172. 0x006f,
  30173. "oacute",
  30174. 0x00f3,
  30175. "oangthai",
  30176. 0x0e2d,
  30177. "obarred",
  30178. 0x0275,
  30179. "obarredcyrillic",
  30180. 0x04e9,
  30181. "obarreddieresiscyrillic",
  30182. 0x04eb,
  30183. "obengali",
  30184. 0x0993,
  30185. "obopomofo",
  30186. 0x311b,
  30187. "obreve",
  30188. 0x014f,
  30189. "ocandradeva",
  30190. 0x0911,
  30191. "ocandragujarati",
  30192. 0x0a91,
  30193. "ocandravowelsigndeva",
  30194. 0x0949,
  30195. "ocandravowelsigngujarati",
  30196. 0x0ac9,
  30197. "ocaron",
  30198. 0x01d2,
  30199. "ocircle",
  30200. 0x24de,
  30201. "ocircumflex",
  30202. 0x00f4,
  30203. "ocircumflexacute",
  30204. 0x1ed1,
  30205. "ocircumflexdotbelow",
  30206. 0x1ed9,
  30207. "ocircumflexgrave",
  30208. 0x1ed3,
  30209. "ocircumflexhookabove",
  30210. 0x1ed5,
  30211. "ocircumflextilde",
  30212. 0x1ed7,
  30213. "ocyrillic",
  30214. 0x043e,
  30215. "odblacute",
  30216. 0x0151,
  30217. "odblgrave",
  30218. 0x020d,
  30219. "odeva",
  30220. 0x0913,
  30221. "odieresis",
  30222. 0x00f6,
  30223. "odieresiscyrillic",
  30224. 0x04e7,
  30225. "odotbelow",
  30226. 0x1ecd,
  30227. "oe",
  30228. 0x0153,
  30229. "oekorean",
  30230. 0x315a,
  30231. "ogonek",
  30232. 0x02db,
  30233. "ogonekcmb",
  30234. 0x0328,
  30235. "ograve",
  30236. 0x00f2,
  30237. "ogujarati",
  30238. 0x0a93,
  30239. "oharmenian",
  30240. 0x0585,
  30241. "ohiragana",
  30242. 0x304a,
  30243. "ohookabove",
  30244. 0x1ecf,
  30245. "ohorn",
  30246. 0x01a1,
  30247. "ohornacute",
  30248. 0x1edb,
  30249. "ohorndotbelow",
  30250. 0x1ee3,
  30251. "ohorngrave",
  30252. 0x1edd,
  30253. "ohornhookabove",
  30254. 0x1edf,
  30255. "ohorntilde",
  30256. 0x1ee1,
  30257. "ohungarumlaut",
  30258. 0x0151,
  30259. "oi",
  30260. 0x01a3,
  30261. "oinvertedbreve",
  30262. 0x020f,
  30263. "okatakana",
  30264. 0x30aa,
  30265. "okatakanahalfwidth",
  30266. 0xff75,
  30267. "okorean",
  30268. 0x3157,
  30269. "olehebrew",
  30270. 0x05ab,
  30271. "omacron",
  30272. 0x014d,
  30273. "omacronacute",
  30274. 0x1e53,
  30275. "omacrongrave",
  30276. 0x1e51,
  30277. "omdeva",
  30278. 0x0950,
  30279. "omega",
  30280. 0x03c9,
  30281. "omega1",
  30282. 0x03d6,
  30283. "omegacyrillic",
  30284. 0x0461,
  30285. "omegalatinclosed",
  30286. 0x0277,
  30287. "omegaroundcyrillic",
  30288. 0x047b,
  30289. "omegatitlocyrillic",
  30290. 0x047d,
  30291. "omegatonos",
  30292. 0x03ce,
  30293. "omgujarati",
  30294. 0x0ad0,
  30295. "omicron",
  30296. 0x03bf,
  30297. "omicrontonos",
  30298. 0x03cc,
  30299. "omonospace",
  30300. 0xff4f,
  30301. "one",
  30302. 0x0031,
  30303. "onearabic",
  30304. 0x0661,
  30305. "onebengali",
  30306. 0x09e7,
  30307. "onecircle",
  30308. 0x2460,
  30309. "onecircleinversesansserif",
  30310. 0x278a,
  30311. "onedeva",
  30312. 0x0967,
  30313. "onedotenleader",
  30314. 0x2024,
  30315. "oneeighth",
  30316. 0x215b,
  30317. "onefitted",
  30318. 0xf6dc,
  30319. "onegujarati",
  30320. 0x0ae7,
  30321. "onegurmukhi",
  30322. 0x0a67,
  30323. "onehackarabic",
  30324. 0x0661,
  30325. "onehalf",
  30326. 0x00bd,
  30327. "onehangzhou",
  30328. 0x3021,
  30329. "oneideographicparen",
  30330. 0x3220,
  30331. "oneinferior",
  30332. 0x2081,
  30333. "onemonospace",
  30334. 0xff11,
  30335. "onenumeratorbengali",
  30336. 0x09f4,
  30337. "oneoldstyle",
  30338. 0xf731,
  30339. "oneparen",
  30340. 0x2474,
  30341. "oneperiod",
  30342. 0x2488,
  30343. "onepersian",
  30344. 0x06f1,
  30345. "onequarter",
  30346. 0x00bc,
  30347. "oneroman",
  30348. 0x2170,
  30349. "onesuperior",
  30350. 0x00b9,
  30351. "onethai",
  30352. 0x0e51,
  30353. "onethird",
  30354. 0x2153,
  30355. "oogonek",
  30356. 0x01eb,
  30357. "oogonekmacron",
  30358. 0x01ed,
  30359. "oogurmukhi",
  30360. 0x0a13,
  30361. "oomatragurmukhi",
  30362. 0x0a4b,
  30363. "oopen",
  30364. 0x0254,
  30365. "oparen",
  30366. 0x24aa,
  30367. "openbullet",
  30368. 0x25e6,
  30369. "option",
  30370. 0x2325,
  30371. "ordfeminine",
  30372. 0x00aa,
  30373. "ordmasculine",
  30374. 0x00ba,
  30375. "orthogonal",
  30376. 0x221f,
  30377. "oshortdeva",
  30378. 0x0912,
  30379. "oshortvowelsigndeva",
  30380. 0x094a,
  30381. "oslash",
  30382. 0x00f8,
  30383. "oslashacute",
  30384. 0x01ff,
  30385. "osmallhiragana",
  30386. 0x3049,
  30387. "osmallkatakana",
  30388. 0x30a9,
  30389. "osmallkatakanahalfwidth",
  30390. 0xff6b,
  30391. "ostrokeacute",
  30392. 0x01ff,
  30393. "osuperior",
  30394. 0xf6f0,
  30395. "otcyrillic",
  30396. 0x047f,
  30397. "otilde",
  30398. 0x00f5,
  30399. "otildeacute",
  30400. 0x1e4d,
  30401. "otildedieresis",
  30402. 0x1e4f,
  30403. "oubopomofo",
  30404. 0x3121,
  30405. "overline",
  30406. 0x203e,
  30407. "overlinecenterline",
  30408. 0xfe4a,
  30409. "overlinecmb",
  30410. 0x0305,
  30411. "overlinedashed",
  30412. 0xfe49,
  30413. "overlinedblwavy",
  30414. 0xfe4c,
  30415. "overlinewavy",
  30416. 0xfe4b,
  30417. "overscore",
  30418. 0x00af,
  30419. "ovowelsignbengali",
  30420. 0x09cb,
  30421. "ovowelsigndeva",
  30422. 0x094b,
  30423. "ovowelsigngujarati",
  30424. 0x0acb,
  30425. "p",
  30426. 0x0070,
  30427. "paampssquare",
  30428. 0x3380,
  30429. "paasentosquare",
  30430. 0x332b,
  30431. "pabengali",
  30432. 0x09aa,
  30433. "pacute",
  30434. 0x1e55,
  30435. "padeva",
  30436. 0x092a,
  30437. "pagedown",
  30438. 0x21df,
  30439. "pageup",
  30440. 0x21de,
  30441. "pagujarati",
  30442. 0x0aaa,
  30443. "pagurmukhi",
  30444. 0x0a2a,
  30445. "pahiragana",
  30446. 0x3071,
  30447. "paiyannoithai",
  30448. 0x0e2f,
  30449. "pakatakana",
  30450. 0x30d1,
  30451. "palatalizationcyrilliccmb",
  30452. 0x0484,
  30453. "palochkacyrillic",
  30454. 0x04c0,
  30455. "pansioskorean",
  30456. 0x317f,
  30457. "paragraph",
  30458. 0x00b6,
  30459. "parallel",
  30460. 0x2225,
  30461. "parenleft",
  30462. 0x0028,
  30463. "parenleftaltonearabic",
  30464. 0xfd3e,
  30465. "parenleftbt",
  30466. 0xf8ed,
  30467. "parenleftex",
  30468. 0xf8ec,
  30469. "parenleftinferior",
  30470. 0x208d,
  30471. "parenleftmonospace",
  30472. 0xff08,
  30473. "parenleftsmall",
  30474. 0xfe59,
  30475. "parenleftsuperior",
  30476. 0x207d,
  30477. "parenlefttp",
  30478. 0xf8eb,
  30479. "parenleftvertical",
  30480. 0xfe35,
  30481. "parenright",
  30482. 0x0029,
  30483. "parenrightaltonearabic",
  30484. 0xfd3f,
  30485. "parenrightbt",
  30486. 0xf8f8,
  30487. "parenrightex",
  30488. 0xf8f7,
  30489. "parenrightinferior",
  30490. 0x208e,
  30491. "parenrightmonospace",
  30492. 0xff09,
  30493. "parenrightsmall",
  30494. 0xfe5a,
  30495. "parenrightsuperior",
  30496. 0x207e,
  30497. "parenrighttp",
  30498. 0xf8f6,
  30499. "parenrightvertical",
  30500. 0xfe36,
  30501. "partialdiff",
  30502. 0x2202,
  30503. "paseqhebrew",
  30504. 0x05c0,
  30505. "pashtahebrew",
  30506. 0x0599,
  30507. "pasquare",
  30508. 0x33a9,
  30509. "patah",
  30510. 0x05b7,
  30511. "patah11",
  30512. 0x05b7,
  30513. "patah1d",
  30514. 0x05b7,
  30515. "patah2a",
  30516. 0x05b7,
  30517. "patahhebrew",
  30518. 0x05b7,
  30519. "patahnarrowhebrew",
  30520. 0x05b7,
  30521. "patahquarterhebrew",
  30522. 0x05b7,
  30523. "patahwidehebrew",
  30524. 0x05b7,
  30525. "pazerhebrew",
  30526. 0x05a1,
  30527. "pbopomofo",
  30528. 0x3106,
  30529. "pcircle",
  30530. 0x24df,
  30531. "pdotaccent",
  30532. 0x1e57,
  30533. "pe",
  30534. 0x05e4,
  30535. "pecyrillic",
  30536. 0x043f,
  30537. "pedagesh",
  30538. 0xfb44,
  30539. "pedageshhebrew",
  30540. 0xfb44,
  30541. "peezisquare",
  30542. 0x333b,
  30543. "pefinaldageshhebrew",
  30544. 0xfb43,
  30545. "peharabic",
  30546. 0x067e,
  30547. "peharmenian",
  30548. 0x057a,
  30549. "pehebrew",
  30550. 0x05e4,
  30551. "pehfinalarabic",
  30552. 0xfb57,
  30553. "pehinitialarabic",
  30554. 0xfb58,
  30555. "pehiragana",
  30556. 0x307a,
  30557. "pehmedialarabic",
  30558. 0xfb59,
  30559. "pekatakana",
  30560. 0x30da,
  30561. "pemiddlehookcyrillic",
  30562. 0x04a7,
  30563. "perafehebrew",
  30564. 0xfb4e,
  30565. "percent",
  30566. 0x0025,
  30567. "percentarabic",
  30568. 0x066a,
  30569. "percentmonospace",
  30570. 0xff05,
  30571. "percentsmall",
  30572. 0xfe6a,
  30573. "period",
  30574. 0x002e,
  30575. "periodarmenian",
  30576. 0x0589,
  30577. "periodcentered",
  30578. 0x00b7,
  30579. "periodhalfwidth",
  30580. 0xff61,
  30581. "periodinferior",
  30582. 0xf6e7,
  30583. "periodmonospace",
  30584. 0xff0e,
  30585. "periodsmall",
  30586. 0xfe52,
  30587. "periodsuperior",
  30588. 0xf6e8,
  30589. "perispomenigreekcmb",
  30590. 0x0342,
  30591. "perpendicular",
  30592. 0x22a5,
  30593. "perthousand",
  30594. 0x2030,
  30595. "peseta",
  30596. 0x20a7,
  30597. "pfsquare",
  30598. 0x338a,
  30599. "phabengali",
  30600. 0x09ab,
  30601. "phadeva",
  30602. 0x092b,
  30603. "phagujarati",
  30604. 0x0aab,
  30605. "phagurmukhi",
  30606. 0x0a2b,
  30607. "phi",
  30608. 0x03c6,
  30609. "phi1",
  30610. 0x03d5,
  30611. "phieuphacirclekorean",
  30612. 0x327a,
  30613. "phieuphaparenkorean",
  30614. 0x321a,
  30615. "phieuphcirclekorean",
  30616. 0x326c,
  30617. "phieuphkorean",
  30618. 0x314d,
  30619. "phieuphparenkorean",
  30620. 0x320c,
  30621. "philatin",
  30622. 0x0278,
  30623. "phinthuthai",
  30624. 0x0e3a,
  30625. "phisymbolgreek",
  30626. 0x03d5,
  30627. "phook",
  30628. 0x01a5,
  30629. "phophanthai",
  30630. 0x0e1e,
  30631. "phophungthai",
  30632. 0x0e1c,
  30633. "phosamphaothai",
  30634. 0x0e20,
  30635. "pi",
  30636. 0x03c0,
  30637. "pieupacirclekorean",
  30638. 0x3273,
  30639. "pieupaparenkorean",
  30640. 0x3213,
  30641. "pieupcieuckorean",
  30642. 0x3176,
  30643. "pieupcirclekorean",
  30644. 0x3265,
  30645. "pieupkiyeokkorean",
  30646. 0x3172,
  30647. "pieupkorean",
  30648. 0x3142,
  30649. "pieupparenkorean",
  30650. 0x3205,
  30651. "pieupsioskiyeokkorean",
  30652. 0x3174,
  30653. "pieupsioskorean",
  30654. 0x3144,
  30655. "pieupsiostikeutkorean",
  30656. 0x3175,
  30657. "pieupthieuthkorean",
  30658. 0x3177,
  30659. "pieuptikeutkorean",
  30660. 0x3173,
  30661. "pihiragana",
  30662. 0x3074,
  30663. "pikatakana",
  30664. 0x30d4,
  30665. "pisymbolgreek",
  30666. 0x03d6,
  30667. "piwrarmenian",
  30668. 0x0583,
  30669. "plus",
  30670. 0x002b,
  30671. "plusbelowcmb",
  30672. 0x031f,
  30673. "pluscircle",
  30674. 0x2295,
  30675. "plusminus",
  30676. 0x00b1,
  30677. "plusmod",
  30678. 0x02d6,
  30679. "plusmonospace",
  30680. 0xff0b,
  30681. "plussmall",
  30682. 0xfe62,
  30683. "plussuperior",
  30684. 0x207a,
  30685. "pmonospace",
  30686. 0xff50,
  30687. "pmsquare",
  30688. 0x33d8,
  30689. "pohiragana",
  30690. 0x307d,
  30691. "pointingindexdownwhite",
  30692. 0x261f,
  30693. "pointingindexleftwhite",
  30694. 0x261c,
  30695. "pointingindexrightwhite",
  30696. 0x261e,
  30697. "pointingindexupwhite",
  30698. 0x261d,
  30699. "pokatakana",
  30700. 0x30dd,
  30701. "poplathai",
  30702. 0x0e1b,
  30703. "postalmark",
  30704. 0x3012,
  30705. "postalmarkface",
  30706. 0x3020,
  30707. "pparen",
  30708. 0x24ab,
  30709. "precedes",
  30710. 0x227a,
  30711. "prescription",
  30712. 0x211e,
  30713. "primemod",
  30714. 0x02b9,
  30715. "primereversed",
  30716. 0x2035,
  30717. "product",
  30718. 0x220f,
  30719. "projective",
  30720. 0x2305,
  30721. "prolongedkana",
  30722. 0x30fc,
  30723. "propellor",
  30724. 0x2318,
  30725. "propersubset",
  30726. 0x2282,
  30727. "propersuperset",
  30728. 0x2283,
  30729. "proportion",
  30730. 0x2237,
  30731. "proportional",
  30732. 0x221d,
  30733. "psi",
  30734. 0x03c8,
  30735. "psicyrillic",
  30736. 0x0471,
  30737. "psilipneumatacyrilliccmb",
  30738. 0x0486,
  30739. "pssquare",
  30740. 0x33b0,
  30741. "puhiragana",
  30742. 0x3077,
  30743. "pukatakana",
  30744. 0x30d7,
  30745. "pvsquare",
  30746. 0x33b4,
  30747. "pwsquare",
  30748. 0x33ba,
  30749. "q",
  30750. 0x0071,
  30751. "qadeva",
  30752. 0x0958,
  30753. "qadmahebrew",
  30754. 0x05a8,
  30755. "qafarabic",
  30756. 0x0642,
  30757. "qaffinalarabic",
  30758. 0xfed6,
  30759. "qafinitialarabic",
  30760. 0xfed7,
  30761. "qafmedialarabic",
  30762. 0xfed8,
  30763. "qamats",
  30764. 0x05b8,
  30765. "qamats10",
  30766. 0x05b8,
  30767. "qamats1a",
  30768. 0x05b8,
  30769. "qamats1c",
  30770. 0x05b8,
  30771. "qamats27",
  30772. 0x05b8,
  30773. "qamats29",
  30774. 0x05b8,
  30775. "qamats33",
  30776. 0x05b8,
  30777. "qamatsde",
  30778. 0x05b8,
  30779. "qamatshebrew",
  30780. 0x05b8,
  30781. "qamatsnarrowhebrew",
  30782. 0x05b8,
  30783. "qamatsqatanhebrew",
  30784. 0x05b8,
  30785. "qamatsqatannarrowhebrew",
  30786. 0x05b8,
  30787. "qamatsqatanquarterhebrew",
  30788. 0x05b8,
  30789. "qamatsqatanwidehebrew",
  30790. 0x05b8,
  30791. "qamatsquarterhebrew",
  30792. 0x05b8,
  30793. "qamatswidehebrew",
  30794. 0x05b8,
  30795. "qarneyparahebrew",
  30796. 0x059f,
  30797. "qbopomofo",
  30798. 0x3111,
  30799. "qcircle",
  30800. 0x24e0,
  30801. "qhook",
  30802. 0x02a0,
  30803. "qmonospace",
  30804. 0xff51,
  30805. "qof",
  30806. 0x05e7,
  30807. "qofdagesh",
  30808. 0xfb47,
  30809. "qofdageshhebrew",
  30810. 0xfb47,
  30811. "qofhebrew",
  30812. 0x05e7,
  30813. "qparen",
  30814. 0x24ac,
  30815. "quarternote",
  30816. 0x2669,
  30817. "qubuts",
  30818. 0x05bb,
  30819. "qubuts18",
  30820. 0x05bb,
  30821. "qubuts25",
  30822. 0x05bb,
  30823. "qubuts31",
  30824. 0x05bb,
  30825. "qubutshebrew",
  30826. 0x05bb,
  30827. "qubutsnarrowhebrew",
  30828. 0x05bb,
  30829. "qubutsquarterhebrew",
  30830. 0x05bb,
  30831. "qubutswidehebrew",
  30832. 0x05bb,
  30833. "question",
  30834. 0x003f,
  30835. "questionarabic",
  30836. 0x061f,
  30837. "questionarmenian",
  30838. 0x055e,
  30839. "questiondown",
  30840. 0x00bf,
  30841. "questiondownsmall",
  30842. 0xf7bf,
  30843. "questiongreek",
  30844. 0x037e,
  30845. "questionmonospace",
  30846. 0xff1f,
  30847. "questionsmall",
  30848. 0xf73f,
  30849. "quotedbl",
  30850. 0x0022,
  30851. "quotedblbase",
  30852. 0x201e,
  30853. "quotedblleft",
  30854. 0x201c,
  30855. "quotedblmonospace",
  30856. 0xff02,
  30857. "quotedblprime",
  30858. 0x301e,
  30859. "quotedblprimereversed",
  30860. 0x301d,
  30861. "quotedblright",
  30862. 0x201d,
  30863. "quoteleft",
  30864. 0x2018,
  30865. "quoteleftreversed",
  30866. 0x201b,
  30867. "quotereversed",
  30868. 0x201b,
  30869. "quoteright",
  30870. 0x2019,
  30871. "quoterightn",
  30872. 0x0149,
  30873. "quotesinglbase",
  30874. 0x201a,
  30875. "quotesingle",
  30876. 0x0027,
  30877. "quotesinglemonospace",
  30878. 0xff07,
  30879. "r",
  30880. 0x0072,
  30881. "raarmenian",
  30882. 0x057c,
  30883. "rabengali",
  30884. 0x09b0,
  30885. "racute",
  30886. 0x0155,
  30887. "radeva",
  30888. 0x0930,
  30889. "radical",
  30890. 0x221a,
  30891. "radicalex",
  30892. 0xf8e5,
  30893. "radoverssquare",
  30894. 0x33ae,
  30895. "radoverssquaredsquare",
  30896. 0x33af,
  30897. "radsquare",
  30898. 0x33ad,
  30899. "rafe",
  30900. 0x05bf,
  30901. "rafehebrew",
  30902. 0x05bf,
  30903. "ragujarati",
  30904. 0x0ab0,
  30905. "ragurmukhi",
  30906. 0x0a30,
  30907. "rahiragana",
  30908. 0x3089,
  30909. "rakatakana",
  30910. 0x30e9,
  30911. "rakatakanahalfwidth",
  30912. 0xff97,
  30913. "ralowerdiagonalbengali",
  30914. 0x09f1,
  30915. "ramiddlediagonalbengali",
  30916. 0x09f0,
  30917. "ramshorn",
  30918. 0x0264,
  30919. "ratio",
  30920. 0x2236,
  30921. "rbopomofo",
  30922. 0x3116,
  30923. "rcaron",
  30924. 0x0159,
  30925. "rcedilla",
  30926. 0x0157,
  30927. "rcircle",
  30928. 0x24e1,
  30929. "rcommaaccent",
  30930. 0x0157,
  30931. "rdblgrave",
  30932. 0x0211,
  30933. "rdotaccent",
  30934. 0x1e59,
  30935. "rdotbelow",
  30936. 0x1e5b,
  30937. "rdotbelowmacron",
  30938. 0x1e5d,
  30939. "referencemark",
  30940. 0x203b,
  30941. "reflexsubset",
  30942. 0x2286,
  30943. "reflexsuperset",
  30944. 0x2287,
  30945. "registered",
  30946. 0x00ae,
  30947. "registersans",
  30948. 0xf8e8,
  30949. "registerserif",
  30950. 0xf6da,
  30951. "reharabic",
  30952. 0x0631,
  30953. "reharmenian",
  30954. 0x0580,
  30955. "rehfinalarabic",
  30956. 0xfeae,
  30957. "rehiragana",
  30958. 0x308c,
  30959. "rekatakana",
  30960. 0x30ec,
  30961. "rekatakanahalfwidth",
  30962. 0xff9a,
  30963. "resh",
  30964. 0x05e8,
  30965. "reshdageshhebrew",
  30966. 0xfb48,
  30967. "reshhebrew",
  30968. 0x05e8,
  30969. "reversedtilde",
  30970. 0x223d,
  30971. "reviahebrew",
  30972. 0x0597,
  30973. "reviamugrashhebrew",
  30974. 0x0597,
  30975. "revlogicalnot",
  30976. 0x2310,
  30977. "rfishhook",
  30978. 0x027e,
  30979. "rfishhookreversed",
  30980. 0x027f,
  30981. "rhabengali",
  30982. 0x09dd,
  30983. "rhadeva",
  30984. 0x095d,
  30985. "rho",
  30986. 0x03c1,
  30987. "rhook",
  30988. 0x027d,
  30989. "rhookturned",
  30990. 0x027b,
  30991. "rhookturnedsuperior",
  30992. 0x02b5,
  30993. "rhosymbolgreek",
  30994. 0x03f1,
  30995. "rhotichookmod",
  30996. 0x02de,
  30997. "rieulacirclekorean",
  30998. 0x3271,
  30999. "rieulaparenkorean",
  31000. 0x3211,
  31001. "rieulcirclekorean",
  31002. 0x3263,
  31003. "rieulhieuhkorean",
  31004. 0x3140,
  31005. "rieulkiyeokkorean",
  31006. 0x313a,
  31007. "rieulkiyeoksioskorean",
  31008. 0x3169,
  31009. "rieulkorean",
  31010. 0x3139,
  31011. "rieulmieumkorean",
  31012. 0x313b,
  31013. "rieulpansioskorean",
  31014. 0x316c,
  31015. "rieulparenkorean",
  31016. 0x3203,
  31017. "rieulphieuphkorean",
  31018. 0x313f,
  31019. "rieulpieupkorean",
  31020. 0x313c,
  31021. "rieulpieupsioskorean",
  31022. 0x316b,
  31023. "rieulsioskorean",
  31024. 0x313d,
  31025. "rieulthieuthkorean",
  31026. 0x313e,
  31027. "rieultikeutkorean",
  31028. 0x316a,
  31029. "rieulyeorinhieuhkorean",
  31030. 0x316d,
  31031. "rightangle",
  31032. 0x221f,
  31033. "righttackbelowcmb",
  31034. 0x0319,
  31035. "righttriangle",
  31036. 0x22bf,
  31037. "rihiragana",
  31038. 0x308a,
  31039. "rikatakana",
  31040. 0x30ea,
  31041. "rikatakanahalfwidth",
  31042. 0xff98,
  31043. "ring",
  31044. 0x02da,
  31045. "ringbelowcmb",
  31046. 0x0325,
  31047. "ringcmb",
  31048. 0x030a,
  31049. "ringhalfleft",
  31050. 0x02bf,
  31051. "ringhalfleftarmenian",
  31052. 0x0559,
  31053. "ringhalfleftbelowcmb",
  31054. 0x031c,
  31055. "ringhalfleftcentered",
  31056. 0x02d3,
  31057. "ringhalfright",
  31058. 0x02be,
  31059. "ringhalfrightbelowcmb",
  31060. 0x0339,
  31061. "ringhalfrightcentered",
  31062. 0x02d2,
  31063. "rinvertedbreve",
  31064. 0x0213,
  31065. "rittorusquare",
  31066. 0x3351,
  31067. "rlinebelow",
  31068. 0x1e5f,
  31069. "rlongleg",
  31070. 0x027c,
  31071. "rlonglegturned",
  31072. 0x027a,
  31073. "rmonospace",
  31074. 0xff52,
  31075. "rohiragana",
  31076. 0x308d,
  31077. "rokatakana",
  31078. 0x30ed,
  31079. "rokatakanahalfwidth",
  31080. 0xff9b,
  31081. "roruathai",
  31082. 0x0e23,
  31083. "rparen",
  31084. 0x24ad,
  31085. "rrabengali",
  31086. 0x09dc,
  31087. "rradeva",
  31088. 0x0931,
  31089. "rragurmukhi",
  31090. 0x0a5c,
  31091. "rreharabic",
  31092. 0x0691,
  31093. "rrehfinalarabic",
  31094. 0xfb8d,
  31095. "rrvocalicbengali",
  31096. 0x09e0,
  31097. "rrvocalicdeva",
  31098. 0x0960,
  31099. "rrvocalicgujarati",
  31100. 0x0ae0,
  31101. "rrvocalicvowelsignbengali",
  31102. 0x09c4,
  31103. "rrvocalicvowelsigndeva",
  31104. 0x0944,
  31105. "rrvocalicvowelsigngujarati",
  31106. 0x0ac4,
  31107. "rsuperior",
  31108. 0xf6f1,
  31109. "rtblock",
  31110. 0x2590,
  31111. "rturned",
  31112. 0x0279,
  31113. "rturnedsuperior",
  31114. 0x02b4,
  31115. "ruhiragana",
  31116. 0x308b,
  31117. "rukatakana",
  31118. 0x30eb,
  31119. "rukatakanahalfwidth",
  31120. 0xff99,
  31121. "rupeemarkbengali",
  31122. 0x09f2,
  31123. "rupeesignbengali",
  31124. 0x09f3,
  31125. "rupiah",
  31126. 0xf6dd,
  31127. "ruthai",
  31128. 0x0e24,
  31129. "rvocalicbengali",
  31130. 0x098b,
  31131. "rvocalicdeva",
  31132. 0x090b,
  31133. "rvocalicgujarati",
  31134. 0x0a8b,
  31135. "rvocalicvowelsignbengali",
  31136. 0x09c3,
  31137. "rvocalicvowelsigndeva",
  31138. 0x0943,
  31139. "rvocalicvowelsigngujarati",
  31140. 0x0ac3,
  31141. "s",
  31142. 0x0073,
  31143. "sabengali",
  31144. 0x09b8,
  31145. "sacute",
  31146. 0x015b,
  31147. "sacutedotaccent",
  31148. 0x1e65,
  31149. "sadarabic",
  31150. 0x0635,
  31151. "sadeva",
  31152. 0x0938,
  31153. "sadfinalarabic",
  31154. 0xfeba,
  31155. "sadinitialarabic",
  31156. 0xfebb,
  31157. "sadmedialarabic",
  31158. 0xfebc,
  31159. "sagujarati",
  31160. 0x0ab8,
  31161. "sagurmukhi",
  31162. 0x0a38,
  31163. "sahiragana",
  31164. 0x3055,
  31165. "sakatakana",
  31166. 0x30b5,
  31167. "sakatakanahalfwidth",
  31168. 0xff7b,
  31169. "sallallahoualayhewasallamarabic",
  31170. 0xfdfa,
  31171. "samekh",
  31172. 0x05e1,
  31173. "samekhdagesh",
  31174. 0xfb41,
  31175. "samekhdageshhebrew",
  31176. 0xfb41,
  31177. "samekhhebrew",
  31178. 0x05e1,
  31179. "saraaathai",
  31180. 0x0e32,
  31181. "saraaethai",
  31182. 0x0e41,
  31183. "saraaimaimalaithai",
  31184. 0x0e44,
  31185. "saraaimaimuanthai",
  31186. 0x0e43,
  31187. "saraamthai",
  31188. 0x0e33,
  31189. "saraathai",
  31190. 0x0e30,
  31191. "saraethai",
  31192. 0x0e40,
  31193. "saraiileftthai",
  31194. 0xf886,
  31195. "saraiithai",
  31196. 0x0e35,
  31197. "saraileftthai",
  31198. 0xf885,
  31199. "saraithai",
  31200. 0x0e34,
  31201. "saraothai",
  31202. 0x0e42,
  31203. "saraueeleftthai",
  31204. 0xf888,
  31205. "saraueethai",
  31206. 0x0e37,
  31207. "saraueleftthai",
  31208. 0xf887,
  31209. "sarauethai",
  31210. 0x0e36,
  31211. "sarauthai",
  31212. 0x0e38,
  31213. "sarauuthai",
  31214. 0x0e39,
  31215. "sbopomofo",
  31216. 0x3119,
  31217. "scaron",
  31218. 0x0161,
  31219. "scarondotaccent",
  31220. 0x1e67,
  31221. "scedilla",
  31222. 0x015f,
  31223. "schwa",
  31224. 0x0259,
  31225. "schwacyrillic",
  31226. 0x04d9,
  31227. "schwadieresiscyrillic",
  31228. 0x04db,
  31229. "schwahook",
  31230. 0x025a,
  31231. "scircle",
  31232. 0x24e2,
  31233. "scircumflex",
  31234. 0x015d,
  31235. "scommaaccent",
  31236. 0x0219,
  31237. "sdotaccent",
  31238. 0x1e61,
  31239. "sdotbelow",
  31240. 0x1e63,
  31241. "sdotbelowdotaccent",
  31242. 0x1e69,
  31243. "seagullbelowcmb",
  31244. 0x033c,
  31245. "second",
  31246. 0x2033,
  31247. "secondtonechinese",
  31248. 0x02ca,
  31249. "section",
  31250. 0x00a7,
  31251. "seenarabic",
  31252. 0x0633,
  31253. "seenfinalarabic",
  31254. 0xfeb2,
  31255. "seeninitialarabic",
  31256. 0xfeb3,
  31257. "seenmedialarabic",
  31258. 0xfeb4,
  31259. "segol",
  31260. 0x05b6,
  31261. "segol13",
  31262. 0x05b6,
  31263. "segol1f",
  31264. 0x05b6,
  31265. "segol2c",
  31266. 0x05b6,
  31267. "segolhebrew",
  31268. 0x05b6,
  31269. "segolnarrowhebrew",
  31270. 0x05b6,
  31271. "segolquarterhebrew",
  31272. 0x05b6,
  31273. "segoltahebrew",
  31274. 0x0592,
  31275. "segolwidehebrew",
  31276. 0x05b6,
  31277. "seharmenian",
  31278. 0x057d,
  31279. "sehiragana",
  31280. 0x305b,
  31281. "sekatakana",
  31282. 0x30bb,
  31283. "sekatakanahalfwidth",
  31284. 0xff7e,
  31285. "semicolon",
  31286. 0x003b,
  31287. "semicolonarabic",
  31288. 0x061b,
  31289. "semicolonmonospace",
  31290. 0xff1b,
  31291. "semicolonsmall",
  31292. 0xfe54,
  31293. "semivoicedmarkkana",
  31294. 0x309c,
  31295. "semivoicedmarkkanahalfwidth",
  31296. 0xff9f,
  31297. "sentisquare",
  31298. 0x3322,
  31299. "sentosquare",
  31300. 0x3323,
  31301. "seven",
  31302. 0x0037,
  31303. "sevenarabic",
  31304. 0x0667,
  31305. "sevenbengali",
  31306. 0x09ed,
  31307. "sevencircle",
  31308. 0x2466,
  31309. "sevencircleinversesansserif",
  31310. 0x2790,
  31311. "sevendeva",
  31312. 0x096d,
  31313. "seveneighths",
  31314. 0x215e,
  31315. "sevengujarati",
  31316. 0x0aed,
  31317. "sevengurmukhi",
  31318. 0x0a6d,
  31319. "sevenhackarabic",
  31320. 0x0667,
  31321. "sevenhangzhou",
  31322. 0x3027,
  31323. "sevenideographicparen",
  31324. 0x3226,
  31325. "seveninferior",
  31326. 0x2087,
  31327. "sevenmonospace",
  31328. 0xff17,
  31329. "sevenoldstyle",
  31330. 0xf737,
  31331. "sevenparen",
  31332. 0x247a,
  31333. "sevenperiod",
  31334. 0x248e,
  31335. "sevenpersian",
  31336. 0x06f7,
  31337. "sevenroman",
  31338. 0x2176,
  31339. "sevensuperior",
  31340. 0x2077,
  31341. "seventeencircle",
  31342. 0x2470,
  31343. "seventeenparen",
  31344. 0x2484,
  31345. "seventeenperiod",
  31346. 0x2498,
  31347. "seventhai",
  31348. 0x0e57,
  31349. "sfthyphen",
  31350. 0x00ad,
  31351. "shaarmenian",
  31352. 0x0577,
  31353. "shabengali",
  31354. 0x09b6,
  31355. "shacyrillic",
  31356. 0x0448,
  31357. "shaddaarabic",
  31358. 0x0651,
  31359. "shaddadammaarabic",
  31360. 0xfc61,
  31361. "shaddadammatanarabic",
  31362. 0xfc5e,
  31363. "shaddafathaarabic",
  31364. 0xfc60,
  31365. "shaddakasraarabic",
  31366. 0xfc62,
  31367. "shaddakasratanarabic",
  31368. 0xfc5f,
  31369. "shade",
  31370. 0x2592,
  31371. "shadedark",
  31372. 0x2593,
  31373. "shadelight",
  31374. 0x2591,
  31375. "shademedium",
  31376. 0x2592,
  31377. "shadeva",
  31378. 0x0936,
  31379. "shagujarati",
  31380. 0x0ab6,
  31381. "shagurmukhi",
  31382. 0x0a36,
  31383. "shalshelethebrew",
  31384. 0x0593,
  31385. "shbopomofo",
  31386. 0x3115,
  31387. "shchacyrillic",
  31388. 0x0449,
  31389. "sheenarabic",
  31390. 0x0634,
  31391. "sheenfinalarabic",
  31392. 0xfeb6,
  31393. "sheeninitialarabic",
  31394. 0xfeb7,
  31395. "sheenmedialarabic",
  31396. 0xfeb8,
  31397. "sheicoptic",
  31398. 0x03e3,
  31399. "sheqel",
  31400. 0x20aa,
  31401. "sheqelhebrew",
  31402. 0x20aa,
  31403. "sheva",
  31404. 0x05b0,
  31405. "sheva115",
  31406. 0x05b0,
  31407. "sheva15",
  31408. 0x05b0,
  31409. "sheva22",
  31410. 0x05b0,
  31411. "sheva2e",
  31412. 0x05b0,
  31413. "shevahebrew",
  31414. 0x05b0,
  31415. "shevanarrowhebrew",
  31416. 0x05b0,
  31417. "shevaquarterhebrew",
  31418. 0x05b0,
  31419. "shevawidehebrew",
  31420. 0x05b0,
  31421. "shhacyrillic",
  31422. 0x04bb,
  31423. "shimacoptic",
  31424. 0x03ed,
  31425. "shin",
  31426. 0x05e9,
  31427. "shindagesh",
  31428. 0xfb49,
  31429. "shindageshhebrew",
  31430. 0xfb49,
  31431. "shindageshshindot",
  31432. 0xfb2c,
  31433. "shindageshshindothebrew",
  31434. 0xfb2c,
  31435. "shindageshsindot",
  31436. 0xfb2d,
  31437. "shindageshsindothebrew",
  31438. 0xfb2d,
  31439. "shindothebrew",
  31440. 0x05c1,
  31441. "shinhebrew",
  31442. 0x05e9,
  31443. "shinshindot",
  31444. 0xfb2a,
  31445. "shinshindothebrew",
  31446. 0xfb2a,
  31447. "shinsindot",
  31448. 0xfb2b,
  31449. "shinsindothebrew",
  31450. 0xfb2b,
  31451. "shook",
  31452. 0x0282,
  31453. "sigma",
  31454. 0x03c3,
  31455. "sigma1",
  31456. 0x03c2,
  31457. "sigmafinal",
  31458. 0x03c2,
  31459. "sigmalunatesymbolgreek",
  31460. 0x03f2,
  31461. "sihiragana",
  31462. 0x3057,
  31463. "sikatakana",
  31464. 0x30b7,
  31465. "sikatakanahalfwidth",
  31466. 0xff7c,
  31467. "siluqhebrew",
  31468. 0x05bd,
  31469. "siluqlefthebrew",
  31470. 0x05bd,
  31471. "similar",
  31472. 0x223c,
  31473. "sindothebrew",
  31474. 0x05c2,
  31475. "siosacirclekorean",
  31476. 0x3274,
  31477. "siosaparenkorean",
  31478. 0x3214,
  31479. "sioscieuckorean",
  31480. 0x317e,
  31481. "sioscirclekorean",
  31482. 0x3266,
  31483. "sioskiyeokkorean",
  31484. 0x317a,
  31485. "sioskorean",
  31486. 0x3145,
  31487. "siosnieunkorean",
  31488. 0x317b,
  31489. "siosparenkorean",
  31490. 0x3206,
  31491. "siospieupkorean",
  31492. 0x317d,
  31493. "siostikeutkorean",
  31494. 0x317c,
  31495. "six",
  31496. 0x0036,
  31497. "sixarabic",
  31498. 0x0666,
  31499. "sixbengali",
  31500. 0x09ec,
  31501. "sixcircle",
  31502. 0x2465,
  31503. "sixcircleinversesansserif",
  31504. 0x278f,
  31505. "sixdeva",
  31506. 0x096c,
  31507. "sixgujarati",
  31508. 0x0aec,
  31509. "sixgurmukhi",
  31510. 0x0a6c,
  31511. "sixhackarabic",
  31512. 0x0666,
  31513. "sixhangzhou",
  31514. 0x3026,
  31515. "sixideographicparen",
  31516. 0x3225,
  31517. "sixinferior",
  31518. 0x2086,
  31519. "sixmonospace",
  31520. 0xff16,
  31521. "sixoldstyle",
  31522. 0xf736,
  31523. "sixparen",
  31524. 0x2479,
  31525. "sixperiod",
  31526. 0x248d,
  31527. "sixpersian",
  31528. 0x06f6,
  31529. "sixroman",
  31530. 0x2175,
  31531. "sixsuperior",
  31532. 0x2076,
  31533. "sixteencircle",
  31534. 0x246f,
  31535. "sixteencurrencydenominatorbengali",
  31536. 0x09f9,
  31537. "sixteenparen",
  31538. 0x2483,
  31539. "sixteenperiod",
  31540. 0x2497,
  31541. "sixthai",
  31542. 0x0e56,
  31543. "slash",
  31544. 0x002f,
  31545. "slashmonospace",
  31546. 0xff0f,
  31547. "slong",
  31548. 0x017f,
  31549. "slongdotaccent",
  31550. 0x1e9b,
  31551. "smileface",
  31552. 0x263a,
  31553. "smonospace",
  31554. 0xff53,
  31555. "sofpasuqhebrew",
  31556. 0x05c3,
  31557. "softhyphen",
  31558. 0x00ad,
  31559. "softsigncyrillic",
  31560. 0x044c,
  31561. "sohiragana",
  31562. 0x305d,
  31563. "sokatakana",
  31564. 0x30bd,
  31565. "sokatakanahalfwidth",
  31566. 0xff7f,
  31567. "soliduslongoverlaycmb",
  31568. 0x0338,
  31569. "solidusshortoverlaycmb",
  31570. 0x0337,
  31571. "sorusithai",
  31572. 0x0e29,
  31573. "sosalathai",
  31574. 0x0e28,
  31575. "sosothai",
  31576. 0x0e0b,
  31577. "sosuathai",
  31578. 0x0e2a,
  31579. "space",
  31580. 0x0020,
  31581. "spacehackarabic",
  31582. 0x0020,
  31583. "spade",
  31584. 0x2660,
  31585. "spadesuitblack",
  31586. 0x2660,
  31587. "spadesuitwhite",
  31588. 0x2664,
  31589. "sparen",
  31590. 0x24ae,
  31591. "squarebelowcmb",
  31592. 0x033b,
  31593. "squarecc",
  31594. 0x33c4,
  31595. "squarecm",
  31596. 0x339d,
  31597. "squarediagonalcrosshatchfill",
  31598. 0x25a9,
  31599. "squarehorizontalfill",
  31600. 0x25a4,
  31601. "squarekg",
  31602. 0x338f,
  31603. "squarekm",
  31604. 0x339e,
  31605. "squarekmcapital",
  31606. 0x33ce,
  31607. "squareln",
  31608. 0x33d1,
  31609. "squarelog",
  31610. 0x33d2,
  31611. "squaremg",
  31612. 0x338e,
  31613. "squaremil",
  31614. 0x33d5,
  31615. "squaremm",
  31616. 0x339c,
  31617. "squaremsquared",
  31618. 0x33a1,
  31619. "squareorthogonalcrosshatchfill",
  31620. 0x25a6,
  31621. "squareupperlefttolowerrightfill",
  31622. 0x25a7,
  31623. "squareupperrighttolowerleftfill",
  31624. 0x25a8,
  31625. "squareverticalfill",
  31626. 0x25a5,
  31627. "squarewhitewithsmallblack",
  31628. 0x25a3,
  31629. "srsquare",
  31630. 0x33db,
  31631. "ssabengali",
  31632. 0x09b7,
  31633. "ssadeva",
  31634. 0x0937,
  31635. "ssagujarati",
  31636. 0x0ab7,
  31637. "ssangcieuckorean",
  31638. 0x3149,
  31639. "ssanghieuhkorean",
  31640. 0x3185,
  31641. "ssangieungkorean",
  31642. 0x3180,
  31643. "ssangkiyeokkorean",
  31644. 0x3132,
  31645. "ssangnieunkorean",
  31646. 0x3165,
  31647. "ssangpieupkorean",
  31648. 0x3143,
  31649. "ssangsioskorean",
  31650. 0x3146,
  31651. "ssangtikeutkorean",
  31652. 0x3138,
  31653. "ssuperior",
  31654. 0xf6f2,
  31655. "sterling",
  31656. 0x00a3,
  31657. "sterlingmonospace",
  31658. 0xffe1,
  31659. "strokelongoverlaycmb",
  31660. 0x0336,
  31661. "strokeshortoverlaycmb",
  31662. 0x0335,
  31663. "subset",
  31664. 0x2282,
  31665. "subsetnotequal",
  31666. 0x228a,
  31667. "subsetorequal",
  31668. 0x2286,
  31669. "succeeds",
  31670. 0x227b,
  31671. "suchthat",
  31672. 0x220b,
  31673. "suhiragana",
  31674. 0x3059,
  31675. "sukatakana",
  31676. 0x30b9,
  31677. "sukatakanahalfwidth",
  31678. 0xff7d,
  31679. "sukunarabic",
  31680. 0x0652,
  31681. "summation",
  31682. 0x2211,
  31683. "sun",
  31684. 0x263c,
  31685. "superset",
  31686. 0x2283,
  31687. "supersetnotequal",
  31688. 0x228b,
  31689. "supersetorequal",
  31690. 0x2287,
  31691. "svsquare",
  31692. 0x33dc,
  31693. "syouwaerasquare",
  31694. 0x337c,
  31695. "t",
  31696. 0x0074,
  31697. "tabengali",
  31698. 0x09a4,
  31699. "tackdown",
  31700. 0x22a4,
  31701. "tackleft",
  31702. 0x22a3,
  31703. "tadeva",
  31704. 0x0924,
  31705. "tagujarati",
  31706. 0x0aa4,
  31707. "tagurmukhi",
  31708. 0x0a24,
  31709. "taharabic",
  31710. 0x0637,
  31711. "tahfinalarabic",
  31712. 0xfec2,
  31713. "tahinitialarabic",
  31714. 0xfec3,
  31715. "tahiragana",
  31716. 0x305f,
  31717. "tahmedialarabic",
  31718. 0xfec4,
  31719. "taisyouerasquare",
  31720. 0x337d,
  31721. "takatakana",
  31722. 0x30bf,
  31723. "takatakanahalfwidth",
  31724. 0xff80,
  31725. "tatweelarabic",
  31726. 0x0640,
  31727. "tau",
  31728. 0x03c4,
  31729. "tav",
  31730. 0x05ea,
  31731. "tavdages",
  31732. 0xfb4a,
  31733. "tavdagesh",
  31734. 0xfb4a,
  31735. "tavdageshhebrew",
  31736. 0xfb4a,
  31737. "tavhebrew",
  31738. 0x05ea,
  31739. "tbar",
  31740. 0x0167,
  31741. "tbopomofo",
  31742. 0x310a,
  31743. "tcaron",
  31744. 0x0165,
  31745. "tccurl",
  31746. 0x02a8,
  31747. "tcedilla",
  31748. 0x0163,
  31749. "tcheharabic",
  31750. 0x0686,
  31751. "tchehfinalarabic",
  31752. 0xfb7b,
  31753. "tchehinitialarabic",
  31754. 0xfb7c,
  31755. "tchehmedialarabic",
  31756. 0xfb7d,
  31757. "tcircle",
  31758. 0x24e3,
  31759. "tcircumflexbelow",
  31760. 0x1e71,
  31761. "tcommaaccent",
  31762. 0x0163,
  31763. "tdieresis",
  31764. 0x1e97,
  31765. "tdotaccent",
  31766. 0x1e6b,
  31767. "tdotbelow",
  31768. 0x1e6d,
  31769. "tecyrillic",
  31770. 0x0442,
  31771. "tedescendercyrillic",
  31772. 0x04ad,
  31773. "teharabic",
  31774. 0x062a,
  31775. "tehfinalarabic",
  31776. 0xfe96,
  31777. "tehhahinitialarabic",
  31778. 0xfca2,
  31779. "tehhahisolatedarabic",
  31780. 0xfc0c,
  31781. "tehinitialarabic",
  31782. 0xfe97,
  31783. "tehiragana",
  31784. 0x3066,
  31785. "tehjeeminitialarabic",
  31786. 0xfca1,
  31787. "tehjeemisolatedarabic",
  31788. 0xfc0b,
  31789. "tehmarbutaarabic",
  31790. 0x0629,
  31791. "tehmarbutafinalarabic",
  31792. 0xfe94,
  31793. "tehmedialarabic",
  31794. 0xfe98,
  31795. "tehmeeminitialarabic",
  31796. 0xfca4,
  31797. "tehmeemisolatedarabic",
  31798. 0xfc0e,
  31799. "tehnoonfinalarabic",
  31800. 0xfc73,
  31801. "tekatakana",
  31802. 0x30c6,
  31803. "tekatakanahalfwidth",
  31804. 0xff83,
  31805. "telephone",
  31806. 0x2121,
  31807. "telephoneblack",
  31808. 0x260e,
  31809. "telishagedolahebrew",
  31810. 0x05a0,
  31811. "telishaqetanahebrew",
  31812. 0x05a9,
  31813. "tencircle",
  31814. 0x2469,
  31815. "tenideographicparen",
  31816. 0x3229,
  31817. "tenparen",
  31818. 0x247d,
  31819. "tenperiod",
  31820. 0x2491,
  31821. "tenroman",
  31822. 0x2179,
  31823. "tesh",
  31824. 0x02a7,
  31825. "tet",
  31826. 0x05d8,
  31827. "tetdagesh",
  31828. 0xfb38,
  31829. "tetdageshhebrew",
  31830. 0xfb38,
  31831. "tethebrew",
  31832. 0x05d8,
  31833. "tetsecyrillic",
  31834. 0x04b5,
  31835. "tevirhebrew",
  31836. 0x059b,
  31837. "tevirlefthebrew",
  31838. 0x059b,
  31839. "thabengali",
  31840. 0x09a5,
  31841. "thadeva",
  31842. 0x0925,
  31843. "thagujarati",
  31844. 0x0aa5,
  31845. "thagurmukhi",
  31846. 0x0a25,
  31847. "thalarabic",
  31848. 0x0630,
  31849. "thalfinalarabic",
  31850. 0xfeac,
  31851. "thanthakhatlowleftthai",
  31852. 0xf898,
  31853. "thanthakhatlowrightthai",
  31854. 0xf897,
  31855. "thanthakhatthai",
  31856. 0x0e4c,
  31857. "thanthakhatupperleftthai",
  31858. 0xf896,
  31859. "theharabic",
  31860. 0x062b,
  31861. "thehfinalarabic",
  31862. 0xfe9a,
  31863. "thehinitialarabic",
  31864. 0xfe9b,
  31865. "thehmedialarabic",
  31866. 0xfe9c,
  31867. "thereexists",
  31868. 0x2203,
  31869. "therefore",
  31870. 0x2234,
  31871. "theta",
  31872. 0x03b8,
  31873. "theta1",
  31874. 0x03d1,
  31875. "thetasymbolgreek",
  31876. 0x03d1,
  31877. "thieuthacirclekorean",
  31878. 0x3279,
  31879. "thieuthaparenkorean",
  31880. 0x3219,
  31881. "thieuthcirclekorean",
  31882. 0x326b,
  31883. "thieuthkorean",
  31884. 0x314c,
  31885. "thieuthparenkorean",
  31886. 0x320b,
  31887. "thirteencircle",
  31888. 0x246c,
  31889. "thirteenparen",
  31890. 0x2480,
  31891. "thirteenperiod",
  31892. 0x2494,
  31893. "thonangmonthothai",
  31894. 0x0e11,
  31895. "thook",
  31896. 0x01ad,
  31897. "thophuthaothai",
  31898. 0x0e12,
  31899. "thorn",
  31900. 0x00fe,
  31901. "thothahanthai",
  31902. 0x0e17,
  31903. "thothanthai",
  31904. 0x0e10,
  31905. "thothongthai",
  31906. 0x0e18,
  31907. "thothungthai",
  31908. 0x0e16,
  31909. "thousandcyrillic",
  31910. 0x0482,
  31911. "thousandsseparatorarabic",
  31912. 0x066c,
  31913. "thousandsseparatorpersian",
  31914. 0x066c,
  31915. "three",
  31916. 0x0033,
  31917. "threearabic",
  31918. 0x0663,
  31919. "threebengali",
  31920. 0x09e9,
  31921. "threecircle",
  31922. 0x2462,
  31923. "threecircleinversesansserif",
  31924. 0x278c,
  31925. "threedeva",
  31926. 0x0969,
  31927. "threeeighths",
  31928. 0x215c,
  31929. "threegujarati",
  31930. 0x0ae9,
  31931. "threegurmukhi",
  31932. 0x0a69,
  31933. "threehackarabic",
  31934. 0x0663,
  31935. "threehangzhou",
  31936. 0x3023,
  31937. "threeideographicparen",
  31938. 0x3222,
  31939. "threeinferior",
  31940. 0x2083,
  31941. "threemonospace",
  31942. 0xff13,
  31943. "threenumeratorbengali",
  31944. 0x09f6,
  31945. "threeoldstyle",
  31946. 0xf733,
  31947. "threeparen",
  31948. 0x2476,
  31949. "threeperiod",
  31950. 0x248a,
  31951. "threepersian",
  31952. 0x06f3,
  31953. "threequarters",
  31954. 0x00be,
  31955. "threequartersemdash",
  31956. 0xf6de,
  31957. "threeroman",
  31958. 0x2172,
  31959. "threesuperior",
  31960. 0x00b3,
  31961. "threethai",
  31962. 0x0e53,
  31963. "thzsquare",
  31964. 0x3394,
  31965. "tihiragana",
  31966. 0x3061,
  31967. "tikatakana",
  31968. 0x30c1,
  31969. "tikatakanahalfwidth",
  31970. 0xff81,
  31971. "tikeutacirclekorean",
  31972. 0x3270,
  31973. "tikeutaparenkorean",
  31974. 0x3210,
  31975. "tikeutcirclekorean",
  31976. 0x3262,
  31977. "tikeutkorean",
  31978. 0x3137,
  31979. "tikeutparenkorean",
  31980. 0x3202,
  31981. "tilde",
  31982. 0x02dc,
  31983. "tildebelowcmb",
  31984. 0x0330,
  31985. "tildecmb",
  31986. 0x0303,
  31987. "tildecomb",
  31988. 0x0303,
  31989. "tildedoublecmb",
  31990. 0x0360,
  31991. "tildeoperator",
  31992. 0x223c,
  31993. "tildeoverlaycmb",
  31994. 0x0334,
  31995. "tildeverticalcmb",
  31996. 0x033e,
  31997. "timescircle",
  31998. 0x2297,
  31999. "tipehahebrew",
  32000. 0x0596,
  32001. "tipehalefthebrew",
  32002. 0x0596,
  32003. "tippigurmukhi",
  32004. 0x0a70,
  32005. "titlocyrilliccmb",
  32006. 0x0483,
  32007. "tiwnarmenian",
  32008. 0x057f,
  32009. "tlinebelow",
  32010. 0x1e6f,
  32011. "tmonospace",
  32012. 0xff54,
  32013. "toarmenian",
  32014. 0x0569,
  32015. "tohiragana",
  32016. 0x3068,
  32017. "tokatakana",
  32018. 0x30c8,
  32019. "tokatakanahalfwidth",
  32020. 0xff84,
  32021. "tonebarextrahighmod",
  32022. 0x02e5,
  32023. "tonebarextralowmod",
  32024. 0x02e9,
  32025. "tonebarhighmod",
  32026. 0x02e6,
  32027. "tonebarlowmod",
  32028. 0x02e8,
  32029. "tonebarmidmod",
  32030. 0x02e7,
  32031. "tonefive",
  32032. 0x01bd,
  32033. "tonesix",
  32034. 0x0185,
  32035. "tonetwo",
  32036. 0x01a8,
  32037. "tonos",
  32038. 0x0384,
  32039. "tonsquare",
  32040. 0x3327,
  32041. "topatakthai",
  32042. 0x0e0f,
  32043. "tortoiseshellbracketleft",
  32044. 0x3014,
  32045. "tortoiseshellbracketleftsmall",
  32046. 0xfe5d,
  32047. "tortoiseshellbracketleftvertical",
  32048. 0xfe39,
  32049. "tortoiseshellbracketright",
  32050. 0x3015,
  32051. "tortoiseshellbracketrightsmall",
  32052. 0xfe5e,
  32053. "tortoiseshellbracketrightvertical",
  32054. 0xfe3a,
  32055. "totaothai",
  32056. 0x0e15,
  32057. "tpalatalhook",
  32058. 0x01ab,
  32059. "tparen",
  32060. 0x24af,
  32061. "trademark",
  32062. 0x2122,
  32063. "trademarksans",
  32064. 0xf8ea,
  32065. "trademarkserif",
  32066. 0xf6db,
  32067. "tretroflexhook",
  32068. 0x0288,
  32069. "triagdn",
  32070. 0x25bc,
  32071. "triaglf",
  32072. 0x25c4,
  32073. "triagrt",
  32074. 0x25ba,
  32075. "triagup",
  32076. 0x25b2,
  32077. "ts",
  32078. 0x02a6,
  32079. "tsadi",
  32080. 0x05e6,
  32081. "tsadidagesh",
  32082. 0xfb46,
  32083. "tsadidageshhebrew",
  32084. 0xfb46,
  32085. "tsadihebrew",
  32086. 0x05e6,
  32087. "tsecyrillic",
  32088. 0x0446,
  32089. "tsere",
  32090. 0x05b5,
  32091. "tsere12",
  32092. 0x05b5,
  32093. "tsere1e",
  32094. 0x05b5,
  32095. "tsere2b",
  32096. 0x05b5,
  32097. "tserehebrew",
  32098. 0x05b5,
  32099. "tserenarrowhebrew",
  32100. 0x05b5,
  32101. "tserequarterhebrew",
  32102. 0x05b5,
  32103. "tserewidehebrew",
  32104. 0x05b5,
  32105. "tshecyrillic",
  32106. 0x045b,
  32107. "tsuperior",
  32108. 0xf6f3,
  32109. "ttabengali",
  32110. 0x099f,
  32111. "ttadeva",
  32112. 0x091f,
  32113. "ttagujarati",
  32114. 0x0a9f,
  32115. "ttagurmukhi",
  32116. 0x0a1f,
  32117. "tteharabic",
  32118. 0x0679,
  32119. "ttehfinalarabic",
  32120. 0xfb67,
  32121. "ttehinitialarabic",
  32122. 0xfb68,
  32123. "ttehmedialarabic",
  32124. 0xfb69,
  32125. "tthabengali",
  32126. 0x09a0,
  32127. "tthadeva",
  32128. 0x0920,
  32129. "tthagujarati",
  32130. 0x0aa0,
  32131. "tthagurmukhi",
  32132. 0x0a20,
  32133. "tturned",
  32134. 0x0287,
  32135. "tuhiragana",
  32136. 0x3064,
  32137. "tukatakana",
  32138. 0x30c4,
  32139. "tukatakanahalfwidth",
  32140. 0xff82,
  32141. "tusmallhiragana",
  32142. 0x3063,
  32143. "tusmallkatakana",
  32144. 0x30c3,
  32145. "tusmallkatakanahalfwidth",
  32146. 0xff6f,
  32147. "twelvecircle",
  32148. 0x246b,
  32149. "twelveparen",
  32150. 0x247f,
  32151. "twelveperiod",
  32152. 0x2493,
  32153. "twelveroman",
  32154. 0x217b,
  32155. "twentycircle",
  32156. 0x2473,
  32157. "twentyhangzhou",
  32158. 0x5344,
  32159. "twentyparen",
  32160. 0x2487,
  32161. "twentyperiod",
  32162. 0x249b,
  32163. "two",
  32164. 0x0032,
  32165. "twoarabic",
  32166. 0x0662,
  32167. "twobengali",
  32168. 0x09e8,
  32169. "twocircle",
  32170. 0x2461,
  32171. "twocircleinversesansserif",
  32172. 0x278b,
  32173. "twodeva",
  32174. 0x0968,
  32175. "twodotenleader",
  32176. 0x2025,
  32177. "twodotleader",
  32178. 0x2025,
  32179. "twodotleadervertical",
  32180. 0xfe30,
  32181. "twogujarati",
  32182. 0x0ae8,
  32183. "twogurmukhi",
  32184. 0x0a68,
  32185. "twohackarabic",
  32186. 0x0662,
  32187. "twohangzhou",
  32188. 0x3022,
  32189. "twoideographicparen",
  32190. 0x3221,
  32191. "twoinferior",
  32192. 0x2082,
  32193. "twomonospace",
  32194. 0xff12,
  32195. "twonumeratorbengali",
  32196. 0x09f5,
  32197. "twooldstyle",
  32198. 0xf732,
  32199. "twoparen",
  32200. 0x2475,
  32201. "twoperiod",
  32202. 0x2489,
  32203. "twopersian",
  32204. 0x06f2,
  32205. "tworoman",
  32206. 0x2171,
  32207. "twostroke",
  32208. 0x01bb,
  32209. "twosuperior",
  32210. 0x00b2,
  32211. "twothai",
  32212. 0x0e52,
  32213. "twothirds",
  32214. 0x2154,
  32215. "u",
  32216. 0x0075,
  32217. "uacute",
  32218. 0x00fa,
  32219. "ubar",
  32220. 0x0289,
  32221. "ubengali",
  32222. 0x0989,
  32223. "ubopomofo",
  32224. 0x3128,
  32225. "ubreve",
  32226. 0x016d,
  32227. "ucaron",
  32228. 0x01d4,
  32229. "ucircle",
  32230. 0x24e4,
  32231. "ucircumflex",
  32232. 0x00fb,
  32233. "ucircumflexbelow",
  32234. 0x1e77,
  32235. "ucyrillic",
  32236. 0x0443,
  32237. "udattadeva",
  32238. 0x0951,
  32239. "udblacute",
  32240. 0x0171,
  32241. "udblgrave",
  32242. 0x0215,
  32243. "udeva",
  32244. 0x0909,
  32245. "udieresis",
  32246. 0x00fc,
  32247. "udieresisacute",
  32248. 0x01d8,
  32249. "udieresisbelow",
  32250. 0x1e73,
  32251. "udieresiscaron",
  32252. 0x01da,
  32253. "udieresiscyrillic",
  32254. 0x04f1,
  32255. "udieresisgrave",
  32256. 0x01dc,
  32257. "udieresismacron",
  32258. 0x01d6,
  32259. "udotbelow",
  32260. 0x1ee5,
  32261. "ugrave",
  32262. 0x00f9,
  32263. "ugujarati",
  32264. 0x0a89,
  32265. "ugurmukhi",
  32266. 0x0a09,
  32267. "uhiragana",
  32268. 0x3046,
  32269. "uhookabove",
  32270. 0x1ee7,
  32271. "uhorn",
  32272. 0x01b0,
  32273. "uhornacute",
  32274. 0x1ee9,
  32275. "uhorndotbelow",
  32276. 0x1ef1,
  32277. "uhorngrave",
  32278. 0x1eeb,
  32279. "uhornhookabove",
  32280. 0x1eed,
  32281. "uhorntilde",
  32282. 0x1eef,
  32283. "uhungarumlaut",
  32284. 0x0171,
  32285. "uhungarumlautcyrillic",
  32286. 0x04f3,
  32287. "uinvertedbreve",
  32288. 0x0217,
  32289. "ukatakana",
  32290. 0x30a6,
  32291. "ukatakanahalfwidth",
  32292. 0xff73,
  32293. "ukcyrillic",
  32294. 0x0479,
  32295. "ukorean",
  32296. 0x315c,
  32297. "umacron",
  32298. 0x016b,
  32299. "umacroncyrillic",
  32300. 0x04ef,
  32301. "umacrondieresis",
  32302. 0x1e7b,
  32303. "umatragurmukhi",
  32304. 0x0a41,
  32305. "umonospace",
  32306. 0xff55,
  32307. "underscore",
  32308. 0x005f,
  32309. "underscoredbl",
  32310. 0x2017,
  32311. "underscoremonospace",
  32312. 0xff3f,
  32313. "underscorevertical",
  32314. 0xfe33,
  32315. "underscorewavy",
  32316. 0xfe4f,
  32317. "union",
  32318. 0x222a,
  32319. "universal",
  32320. 0x2200,
  32321. "uogonek",
  32322. 0x0173,
  32323. "uparen",
  32324. 0x24b0,
  32325. "upblock",
  32326. 0x2580,
  32327. "upperdothebrew",
  32328. 0x05c4,
  32329. "upsilon",
  32330. 0x03c5,
  32331. "upsilondieresis",
  32332. 0x03cb,
  32333. "upsilondieresistonos",
  32334. 0x03b0,
  32335. "upsilonlatin",
  32336. 0x028a,
  32337. "upsilontonos",
  32338. 0x03cd,
  32339. "uptackbelowcmb",
  32340. 0x031d,
  32341. "uptackmod",
  32342. 0x02d4,
  32343. "uragurmukhi",
  32344. 0x0a73,
  32345. "uring",
  32346. 0x016f,
  32347. "ushortcyrillic",
  32348. 0x045e,
  32349. "usmallhiragana",
  32350. 0x3045,
  32351. "usmallkatakana",
  32352. 0x30a5,
  32353. "usmallkatakanahalfwidth",
  32354. 0xff69,
  32355. "ustraightcyrillic",
  32356. 0x04af,
  32357. "ustraightstrokecyrillic",
  32358. 0x04b1,
  32359. "utilde",
  32360. 0x0169,
  32361. "utildeacute",
  32362. 0x1e79,
  32363. "utildebelow",
  32364. 0x1e75,
  32365. "uubengali",
  32366. 0x098a,
  32367. "uudeva",
  32368. 0x090a,
  32369. "uugujarati",
  32370. 0x0a8a,
  32371. "uugurmukhi",
  32372. 0x0a0a,
  32373. "uumatragurmukhi",
  32374. 0x0a42,
  32375. "uuvowelsignbengali",
  32376. 0x09c2,
  32377. "uuvowelsigndeva",
  32378. 0x0942,
  32379. "uuvowelsigngujarati",
  32380. 0x0ac2,
  32381. "uvowelsignbengali",
  32382. 0x09c1,
  32383. "uvowelsigndeva",
  32384. 0x0941,
  32385. "uvowelsigngujarati",
  32386. 0x0ac1,
  32387. "v",
  32388. 0x0076,
  32389. "vadeva",
  32390. 0x0935,
  32391. "vagujarati",
  32392. 0x0ab5,
  32393. "vagurmukhi",
  32394. 0x0a35,
  32395. "vakatakana",
  32396. 0x30f7,
  32397. "vav",
  32398. 0x05d5,
  32399. "vavdagesh",
  32400. 0xfb35,
  32401. "vavdagesh65",
  32402. 0xfb35,
  32403. "vavdageshhebrew",
  32404. 0xfb35,
  32405. "vavhebrew",
  32406. 0x05d5,
  32407. "vavholam",
  32408. 0xfb4b,
  32409. "vavholamhebrew",
  32410. 0xfb4b,
  32411. "vavvavhebrew",
  32412. 0x05f0,
  32413. "vavyodhebrew",
  32414. 0x05f1,
  32415. "vcircle",
  32416. 0x24e5,
  32417. "vdotbelow",
  32418. 0x1e7f,
  32419. "vecyrillic",
  32420. 0x0432,
  32421. "veharabic",
  32422. 0x06a4,
  32423. "vehfinalarabic",
  32424. 0xfb6b,
  32425. "vehinitialarabic",
  32426. 0xfb6c,
  32427. "vehmedialarabic",
  32428. 0xfb6d,
  32429. "vekatakana",
  32430. 0x30f9,
  32431. "venus",
  32432. 0x2640,
  32433. "verticalbar",
  32434. 0x007c,
  32435. "verticallineabovecmb",
  32436. 0x030d,
  32437. "verticallinebelowcmb",
  32438. 0x0329,
  32439. "verticallinelowmod",
  32440. 0x02cc,
  32441. "verticallinemod",
  32442. 0x02c8,
  32443. "vewarmenian",
  32444. 0x057e,
  32445. "vhook",
  32446. 0x028b,
  32447. "vikatakana",
  32448. 0x30f8,
  32449. "viramabengali",
  32450. 0x09cd,
  32451. "viramadeva",
  32452. 0x094d,
  32453. "viramagujarati",
  32454. 0x0acd,
  32455. "visargabengali",
  32456. 0x0983,
  32457. "visargadeva",
  32458. 0x0903,
  32459. "visargagujarati",
  32460. 0x0a83,
  32461. "vmonospace",
  32462. 0xff56,
  32463. "voarmenian",
  32464. 0x0578,
  32465. "voicediterationhiragana",
  32466. 0x309e,
  32467. "voicediterationkatakana",
  32468. 0x30fe,
  32469. "voicedmarkkana",
  32470. 0x309b,
  32471. "voicedmarkkanahalfwidth",
  32472. 0xff9e,
  32473. "vokatakana",
  32474. 0x30fa,
  32475. "vparen",
  32476. 0x24b1,
  32477. "vtilde",
  32478. 0x1e7d,
  32479. "vturned",
  32480. 0x028c,
  32481. "vuhiragana",
  32482. 0x3094,
  32483. "vukatakana",
  32484. 0x30f4,
  32485. "w",
  32486. 0x0077,
  32487. "wacute",
  32488. 0x1e83,
  32489. "waekorean",
  32490. 0x3159,
  32491. "wahiragana",
  32492. 0x308f,
  32493. "wakatakana",
  32494. 0x30ef,
  32495. "wakatakanahalfwidth",
  32496. 0xff9c,
  32497. "wakorean",
  32498. 0x3158,
  32499. "wasmallhiragana",
  32500. 0x308e,
  32501. "wasmallkatakana",
  32502. 0x30ee,
  32503. "wattosquare",
  32504. 0x3357,
  32505. "wavedash",
  32506. 0x301c,
  32507. "wavyunderscorevertical",
  32508. 0xfe34,
  32509. "wawarabic",
  32510. 0x0648,
  32511. "wawfinalarabic",
  32512. 0xfeee,
  32513. "wawhamzaabovearabic",
  32514. 0x0624,
  32515. "wawhamzaabovefinalarabic",
  32516. 0xfe86,
  32517. "wbsquare",
  32518. 0x33dd,
  32519. "wcircle",
  32520. 0x24e6,
  32521. "wcircumflex",
  32522. 0x0175,
  32523. "wdieresis",
  32524. 0x1e85,
  32525. "wdotaccent",
  32526. 0x1e87,
  32527. "wdotbelow",
  32528. 0x1e89,
  32529. "wehiragana",
  32530. 0x3091,
  32531. "weierstrass",
  32532. 0x2118,
  32533. "wekatakana",
  32534. 0x30f1,
  32535. "wekorean",
  32536. 0x315e,
  32537. "weokorean",
  32538. 0x315d,
  32539. "wgrave",
  32540. 0x1e81,
  32541. "whitebullet",
  32542. 0x25e6,
  32543. "whitecircle",
  32544. 0x25cb,
  32545. "whitecircleinverse",
  32546. 0x25d9,
  32547. "whitecornerbracketleft",
  32548. 0x300e,
  32549. "whitecornerbracketleftvertical",
  32550. 0xfe43,
  32551. "whitecornerbracketright",
  32552. 0x300f,
  32553. "whitecornerbracketrightvertical",
  32554. 0xfe44,
  32555. "whitediamond",
  32556. 0x25c7,
  32557. "whitediamondcontainingblacksmalldiamond",
  32558. 0x25c8,
  32559. "whitedownpointingsmalltriangle",
  32560. 0x25bf,
  32561. "whitedownpointingtriangle",
  32562. 0x25bd,
  32563. "whiteleftpointingsmalltriangle",
  32564. 0x25c3,
  32565. "whiteleftpointingtriangle",
  32566. 0x25c1,
  32567. "whitelenticularbracketleft",
  32568. 0x3016,
  32569. "whitelenticularbracketright",
  32570. 0x3017,
  32571. "whiterightpointingsmalltriangle",
  32572. 0x25b9,
  32573. "whiterightpointingtriangle",
  32574. 0x25b7,
  32575. "whitesmallsquare",
  32576. 0x25ab,
  32577. "whitesmilingface",
  32578. 0x263a,
  32579. "whitesquare",
  32580. 0x25a1,
  32581. "whitestar",
  32582. 0x2606,
  32583. "whitetelephone",
  32584. 0x260f,
  32585. "whitetortoiseshellbracketleft",
  32586. 0x3018,
  32587. "whitetortoiseshellbracketright",
  32588. 0x3019,
  32589. "whiteuppointingsmalltriangle",
  32590. 0x25b5,
  32591. "whiteuppointingtriangle",
  32592. 0x25b3,
  32593. "wihiragana",
  32594. 0x3090,
  32595. "wikatakana",
  32596. 0x30f0,
  32597. "wikorean",
  32598. 0x315f,
  32599. "wmonospace",
  32600. 0xff57,
  32601. "wohiragana",
  32602. 0x3092,
  32603. "wokatakana",
  32604. 0x30f2,
  32605. "wokatakanahalfwidth",
  32606. 0xff66,
  32607. "won",
  32608. 0x20a9,
  32609. "wonmonospace",
  32610. 0xffe6,
  32611. "wowaenthai",
  32612. 0x0e27,
  32613. "wparen",
  32614. 0x24b2,
  32615. "wring",
  32616. 0x1e98,
  32617. "wsuperior",
  32618. 0x02b7,
  32619. "wturned",
  32620. 0x028d,
  32621. "wynn",
  32622. 0x01bf,
  32623. "x",
  32624. 0x0078,
  32625. "xabovecmb",
  32626. 0x033d,
  32627. "xbopomofo",
  32628. 0x3112,
  32629. "xcircle",
  32630. 0x24e7,
  32631. "xdieresis",
  32632. 0x1e8d,
  32633. "xdotaccent",
  32634. 0x1e8b,
  32635. "xeharmenian",
  32636. 0x056d,
  32637. "xi",
  32638. 0x03be,
  32639. "xmonospace",
  32640. 0xff58,
  32641. "xparen",
  32642. 0x24b3,
  32643. "xsuperior",
  32644. 0x02e3,
  32645. "y",
  32646. 0x0079,
  32647. "yaadosquare",
  32648. 0x334e,
  32649. "yabengali",
  32650. 0x09af,
  32651. "yacute",
  32652. 0x00fd,
  32653. "yadeva",
  32654. 0x092f,
  32655. "yaekorean",
  32656. 0x3152,
  32657. "yagujarati",
  32658. 0x0aaf,
  32659. "yagurmukhi",
  32660. 0x0a2f,
  32661. "yahiragana",
  32662. 0x3084,
  32663. "yakatakana",
  32664. 0x30e4,
  32665. "yakatakanahalfwidth",
  32666. 0xff94,
  32667. "yakorean",
  32668. 0x3151,
  32669. "yamakkanthai",
  32670. 0x0e4e,
  32671. "yasmallhiragana",
  32672. 0x3083,
  32673. "yasmallkatakana",
  32674. 0x30e3,
  32675. "yasmallkatakanahalfwidth",
  32676. 0xff6c,
  32677. "yatcyrillic",
  32678. 0x0463,
  32679. "ycircle",
  32680. 0x24e8,
  32681. "ycircumflex",
  32682. 0x0177,
  32683. "ydieresis",
  32684. 0x00ff,
  32685. "ydotaccent",
  32686. 0x1e8f,
  32687. "ydotbelow",
  32688. 0x1ef5,
  32689. "yeharabic",
  32690. 0x064a,
  32691. "yehbarreearabic",
  32692. 0x06d2,
  32693. "yehbarreefinalarabic",
  32694. 0xfbaf,
  32695. "yehfinalarabic",
  32696. 0xfef2,
  32697. "yehhamzaabovearabic",
  32698. 0x0626,
  32699. "yehhamzaabovefinalarabic",
  32700. 0xfe8a,
  32701. "yehhamzaaboveinitialarabic",
  32702. 0xfe8b,
  32703. "yehhamzaabovemedialarabic",
  32704. 0xfe8c,
  32705. "yehinitialarabic",
  32706. 0xfef3,
  32707. "yehmedialarabic",
  32708. 0xfef4,
  32709. "yehmeeminitialarabic",
  32710. 0xfcdd,
  32711. "yehmeemisolatedarabic",
  32712. 0xfc58,
  32713. "yehnoonfinalarabic",
  32714. 0xfc94,
  32715. "yehthreedotsbelowarabic",
  32716. 0x06d1,
  32717. "yekorean",
  32718. 0x3156,
  32719. "yen",
  32720. 0x00a5,
  32721. "yenmonospace",
  32722. 0xffe5,
  32723. "yeokorean",
  32724. 0x3155,
  32725. "yeorinhieuhkorean",
  32726. 0x3186,
  32727. "yerahbenyomohebrew",
  32728. 0x05aa,
  32729. "yerahbenyomolefthebrew",
  32730. 0x05aa,
  32731. "yericyrillic",
  32732. 0x044b,
  32733. "yerudieresiscyrillic",
  32734. 0x04f9,
  32735. "yesieungkorean",
  32736. 0x3181,
  32737. "yesieungpansioskorean",
  32738. 0x3183,
  32739. "yesieungsioskorean",
  32740. 0x3182,
  32741. "yetivhebrew",
  32742. 0x059a,
  32743. "ygrave",
  32744. 0x1ef3,
  32745. "yhook",
  32746. 0x01b4,
  32747. "yhookabove",
  32748. 0x1ef7,
  32749. "yiarmenian",
  32750. 0x0575,
  32751. "yicyrillic",
  32752. 0x0457,
  32753. "yikorean",
  32754. 0x3162,
  32755. "yinyang",
  32756. 0x262f,
  32757. "yiwnarmenian",
  32758. 0x0582,
  32759. "ymonospace",
  32760. 0xff59,
  32761. "yod",
  32762. 0x05d9,
  32763. "yoddagesh",
  32764. 0xfb39,
  32765. "yoddageshhebrew",
  32766. 0xfb39,
  32767. "yodhebrew",
  32768. 0x05d9,
  32769. "yodyodhebrew",
  32770. 0x05f2,
  32771. "yodyodpatahhebrew",
  32772. 0xfb1f,
  32773. "yohiragana",
  32774. 0x3088,
  32775. "yoikorean",
  32776. 0x3189,
  32777. "yokatakana",
  32778. 0x30e8,
  32779. "yokatakanahalfwidth",
  32780. 0xff96,
  32781. "yokorean",
  32782. 0x315b,
  32783. "yosmallhiragana",
  32784. 0x3087,
  32785. "yosmallkatakana",
  32786. 0x30e7,
  32787. "yosmallkatakanahalfwidth",
  32788. 0xff6e,
  32789. "yotgreek",
  32790. 0x03f3,
  32791. "yoyaekorean",
  32792. 0x3188,
  32793. "yoyakorean",
  32794. 0x3187,
  32795. "yoyakthai",
  32796. 0x0e22,
  32797. "yoyingthai",
  32798. 0x0e0d,
  32799. "yparen",
  32800. 0x24b4,
  32801. "ypogegrammeni",
  32802. 0x037a,
  32803. "ypogegrammenigreekcmb",
  32804. 0x0345,
  32805. "yr",
  32806. 0x01a6,
  32807. "yring",
  32808. 0x1e99,
  32809. "ysuperior",
  32810. 0x02b8,
  32811. "ytilde",
  32812. 0x1ef9,
  32813. "yturned",
  32814. 0x028e,
  32815. "yuhiragana",
  32816. 0x3086,
  32817. "yuikorean",
  32818. 0x318c,
  32819. "yukatakana",
  32820. 0x30e6,
  32821. "yukatakanahalfwidth",
  32822. 0xff95,
  32823. "yukorean",
  32824. 0x3160,
  32825. "yusbigcyrillic",
  32826. 0x046b,
  32827. "yusbigiotifiedcyrillic",
  32828. 0x046d,
  32829. "yuslittlecyrillic",
  32830. 0x0467,
  32831. "yuslittleiotifiedcyrillic",
  32832. 0x0469,
  32833. "yusmallhiragana",
  32834. 0x3085,
  32835. "yusmallkatakana",
  32836. 0x30e5,
  32837. "yusmallkatakanahalfwidth",
  32838. 0xff6d,
  32839. "yuyekorean",
  32840. 0x318b,
  32841. "yuyeokorean",
  32842. 0x318a,
  32843. "yyabengali",
  32844. 0x09df,
  32845. "yyadeva",
  32846. 0x095f,
  32847. "z",
  32848. 0x007a,
  32849. "zaarmenian",
  32850. 0x0566,
  32851. "zacute",
  32852. 0x017a,
  32853. "zadeva",
  32854. 0x095b,
  32855. "zagurmukhi",
  32856. 0x0a5b,
  32857. "zaharabic",
  32858. 0x0638,
  32859. "zahfinalarabic",
  32860. 0xfec6,
  32861. "zahinitialarabic",
  32862. 0xfec7,
  32863. "zahiragana",
  32864. 0x3056,
  32865. "zahmedialarabic",
  32866. 0xfec8,
  32867. "zainarabic",
  32868. 0x0632,
  32869. "zainfinalarabic",
  32870. 0xfeb0,
  32871. "zakatakana",
  32872. 0x30b6,
  32873. "zaqefgadolhebrew",
  32874. 0x0595,
  32875. "zaqefqatanhebrew",
  32876. 0x0594,
  32877. "zarqahebrew",
  32878. 0x0598,
  32879. "zayin",
  32880. 0x05d6,
  32881. "zayindagesh",
  32882. 0xfb36,
  32883. "zayindageshhebrew",
  32884. 0xfb36,
  32885. "zayinhebrew",
  32886. 0x05d6,
  32887. "zbopomofo",
  32888. 0x3117,
  32889. "zcaron",
  32890. 0x017e,
  32891. "zcircle",
  32892. 0x24e9,
  32893. "zcircumflex",
  32894. 0x1e91,
  32895. "zcurl",
  32896. 0x0291,
  32897. "zdot",
  32898. 0x017c,
  32899. "zdotaccent",
  32900. 0x017c,
  32901. "zdotbelow",
  32902. 0x1e93,
  32903. "zecyrillic",
  32904. 0x0437,
  32905. "zedescendercyrillic",
  32906. 0x0499,
  32907. "zedieresiscyrillic",
  32908. 0x04df,
  32909. "zehiragana",
  32910. 0x305c,
  32911. "zekatakana",
  32912. 0x30bc,
  32913. "zero",
  32914. 0x0030,
  32915. "zeroarabic",
  32916. 0x0660,
  32917. "zerobengali",
  32918. 0x09e6,
  32919. "zerodeva",
  32920. 0x0966,
  32921. "zerogujarati",
  32922. 0x0ae6,
  32923. "zerogurmukhi",
  32924. 0x0a66,
  32925. "zerohackarabic",
  32926. 0x0660,
  32927. "zeroinferior",
  32928. 0x2080,
  32929. "zeromonospace",
  32930. 0xff10,
  32931. "zerooldstyle",
  32932. 0xf730,
  32933. "zeropersian",
  32934. 0x06f0,
  32935. "zerosuperior",
  32936. 0x2070,
  32937. "zerothai",
  32938. 0x0e50,
  32939. "zerowidthjoiner",
  32940. 0xfeff,
  32941. "zerowidthnonjoiner",
  32942. 0x200c,
  32943. "zerowidthspace",
  32944. 0x200b,
  32945. "zeta",
  32946. 0x03b6,
  32947. "zhbopomofo",
  32948. 0x3113,
  32949. "zhearmenian",
  32950. 0x056a,
  32951. "zhebrevecyrillic",
  32952. 0x04c2,
  32953. "zhecyrillic",
  32954. 0x0436,
  32955. "zhedescendercyrillic",
  32956. 0x0497,
  32957. "zhedieresiscyrillic",
  32958. 0x04dd,
  32959. "zihiragana",
  32960. 0x3058,
  32961. "zikatakana",
  32962. 0x30b8,
  32963. "zinorhebrew",
  32964. 0x05ae,
  32965. "zlinebelow",
  32966. 0x1e95,
  32967. "zmonospace",
  32968. 0xff5a,
  32969. "zohiragana",
  32970. 0x305e,
  32971. "zokatakana",
  32972. 0x30be,
  32973. "zparen",
  32974. 0x24b5,
  32975. "zretroflexhook",
  32976. 0x0290,
  32977. "zstroke",
  32978. 0x01b6,
  32979. "zuhiragana",
  32980. 0x305a,
  32981. "zukatakana",
  32982. 0x30ba,
  32983. ".notdef",
  32984. 0x0000,
  32985. "angbracketleftbig",
  32986. 0x2329,
  32987. "angbracketleftBig",
  32988. 0x2329,
  32989. "angbracketleftbigg",
  32990. 0x2329,
  32991. "angbracketleftBigg",
  32992. 0x2329,
  32993. "angbracketrightBig",
  32994. 0x232a,
  32995. "angbracketrightbig",
  32996. 0x232a,
  32997. "angbracketrightBigg",
  32998. 0x232a,
  32999. "angbracketrightbigg",
  33000. 0x232a,
  33001. "arrowhookleft",
  33002. 0x21aa,
  33003. "arrowhookright",
  33004. 0x21a9,
  33005. "arrowlefttophalf",
  33006. 0x21bc,
  33007. "arrowleftbothalf",
  33008. 0x21bd,
  33009. "arrownortheast",
  33010. 0x2197,
  33011. "arrownorthwest",
  33012. 0x2196,
  33013. "arrowrighttophalf",
  33014. 0x21c0,
  33015. "arrowrightbothalf",
  33016. 0x21c1,
  33017. "arrowsoutheast",
  33018. 0x2198,
  33019. "arrowsouthwest",
  33020. 0x2199,
  33021. "backslashbig",
  33022. 0x2216,
  33023. "backslashBig",
  33024. 0x2216,
  33025. "backslashBigg",
  33026. 0x2216,
  33027. "backslashbigg",
  33028. 0x2216,
  33029. "bardbl",
  33030. 0x2016,
  33031. "bracehtipdownleft",
  33032. 0xfe37,
  33033. "bracehtipdownright",
  33034. 0xfe37,
  33035. "bracehtipupleft",
  33036. 0xfe38,
  33037. "bracehtipupright",
  33038. 0xfe38,
  33039. "braceleftBig",
  33040. 0x007b,
  33041. "braceleftbig",
  33042. 0x007b,
  33043. "braceleftbigg",
  33044. 0x007b,
  33045. "braceleftBigg",
  33046. 0x007b,
  33047. "bracerightBig",
  33048. 0x007d,
  33049. "bracerightbig",
  33050. 0x007d,
  33051. "bracerightbigg",
  33052. 0x007d,
  33053. "bracerightBigg",
  33054. 0x007d,
  33055. "bracketleftbig",
  33056. 0x005b,
  33057. "bracketleftBig",
  33058. 0x005b,
  33059. "bracketleftbigg",
  33060. 0x005b,
  33061. "bracketleftBigg",
  33062. 0x005b,
  33063. "bracketrightBig",
  33064. 0x005d,
  33065. "bracketrightbig",
  33066. 0x005d,
  33067. "bracketrightbigg",
  33068. 0x005d,
  33069. "bracketrightBigg",
  33070. 0x005d,
  33071. "ceilingleftbig",
  33072. 0x2308,
  33073. "ceilingleftBig",
  33074. 0x2308,
  33075. "ceilingleftBigg",
  33076. 0x2308,
  33077. "ceilingleftbigg",
  33078. 0x2308,
  33079. "ceilingrightbig",
  33080. 0x2309,
  33081. "ceilingrightBig",
  33082. 0x2309,
  33083. "ceilingrightbigg",
  33084. 0x2309,
  33085. "ceilingrightBigg",
  33086. 0x2309,
  33087. "circledotdisplay",
  33088. 0x2299,
  33089. "circledottext",
  33090. 0x2299,
  33091. "circlemultiplydisplay",
  33092. 0x2297,
  33093. "circlemultiplytext",
  33094. 0x2297,
  33095. "circleplusdisplay",
  33096. 0x2295,
  33097. "circleplustext",
  33098. 0x2295,
  33099. "contintegraldisplay",
  33100. 0x222e,
  33101. "contintegraltext",
  33102. 0x222e,
  33103. "coproductdisplay",
  33104. 0x2210,
  33105. "coproducttext",
  33106. 0x2210,
  33107. "floorleftBig",
  33108. 0x230a,
  33109. "floorleftbig",
  33110. 0x230a,
  33111. "floorleftbigg",
  33112. 0x230a,
  33113. "floorleftBigg",
  33114. 0x230a,
  33115. "floorrightbig",
  33116. 0x230b,
  33117. "floorrightBig",
  33118. 0x230b,
  33119. "floorrightBigg",
  33120. 0x230b,
  33121. "floorrightbigg",
  33122. 0x230b,
  33123. "hatwide",
  33124. 0x0302,
  33125. "hatwider",
  33126. 0x0302,
  33127. "hatwidest",
  33128. 0x0302,
  33129. "intercal",
  33130. 0x1d40,
  33131. "integraldisplay",
  33132. 0x222b,
  33133. "integraltext",
  33134. 0x222b,
  33135. "intersectiondisplay",
  33136. 0x22c2,
  33137. "intersectiontext",
  33138. 0x22c2,
  33139. "logicalanddisplay",
  33140. 0x2227,
  33141. "logicalandtext",
  33142. 0x2227,
  33143. "logicalordisplay",
  33144. 0x2228,
  33145. "logicalortext",
  33146. 0x2228,
  33147. "parenleftBig",
  33148. 0x0028,
  33149. "parenleftbig",
  33150. 0x0028,
  33151. "parenleftBigg",
  33152. 0x0028,
  33153. "parenleftbigg",
  33154. 0x0028,
  33155. "parenrightBig",
  33156. 0x0029,
  33157. "parenrightbig",
  33158. 0x0029,
  33159. "parenrightBigg",
  33160. 0x0029,
  33161. "parenrightbigg",
  33162. 0x0029,
  33163. "prime",
  33164. 0x2032,
  33165. "productdisplay",
  33166. 0x220f,
  33167. "producttext",
  33168. 0x220f,
  33169. "radicalbig",
  33170. 0x221a,
  33171. "radicalBig",
  33172. 0x221a,
  33173. "radicalBigg",
  33174. 0x221a,
  33175. "radicalbigg",
  33176. 0x221a,
  33177. "radicalbt",
  33178. 0x221a,
  33179. "radicaltp",
  33180. 0x221a,
  33181. "radicalvertex",
  33182. 0x221a,
  33183. "slashbig",
  33184. 0x002f,
  33185. "slashBig",
  33186. 0x002f,
  33187. "slashBigg",
  33188. 0x002f,
  33189. "slashbigg",
  33190. 0x002f,
  33191. "summationdisplay",
  33192. 0x2211,
  33193. "summationtext",
  33194. 0x2211,
  33195. "tildewide",
  33196. 0x02dc,
  33197. "tildewider",
  33198. 0x02dc,
  33199. "tildewidest",
  33200. 0x02dc,
  33201. "uniondisplay",
  33202. 0x22c3,
  33203. "unionmultidisplay",
  33204. 0x228e,
  33205. "unionmultitext",
  33206. 0x228e,
  33207. "unionsqdisplay",
  33208. 0x2294,
  33209. "unionsqtext",
  33210. 0x2294,
  33211. "uniontext",
  33212. 0x22c3,
  33213. "vextenddouble",
  33214. 0x2225,
  33215. "vextendsingle",
  33216. 0x2223
  33217. ];
  33218. });
  33219. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  33220. return [
  33221. "space",
  33222. 0x0020,
  33223. "a1",
  33224. 0x2701,
  33225. "a2",
  33226. 0x2702,
  33227. "a202",
  33228. 0x2703,
  33229. "a3",
  33230. 0x2704,
  33231. "a4",
  33232. 0x260e,
  33233. "a5",
  33234. 0x2706,
  33235. "a119",
  33236. 0x2707,
  33237. "a118",
  33238. 0x2708,
  33239. "a117",
  33240. 0x2709,
  33241. "a11",
  33242. 0x261b,
  33243. "a12",
  33244. 0x261e,
  33245. "a13",
  33246. 0x270c,
  33247. "a14",
  33248. 0x270d,
  33249. "a15",
  33250. 0x270e,
  33251. "a16",
  33252. 0x270f,
  33253. "a105",
  33254. 0x2710,
  33255. "a17",
  33256. 0x2711,
  33257. "a18",
  33258. 0x2712,
  33259. "a19",
  33260. 0x2713,
  33261. "a20",
  33262. 0x2714,
  33263. "a21",
  33264. 0x2715,
  33265. "a22",
  33266. 0x2716,
  33267. "a23",
  33268. 0x2717,
  33269. "a24",
  33270. 0x2718,
  33271. "a25",
  33272. 0x2719,
  33273. "a26",
  33274. 0x271a,
  33275. "a27",
  33276. 0x271b,
  33277. "a28",
  33278. 0x271c,
  33279. "a6",
  33280. 0x271d,
  33281. "a7",
  33282. 0x271e,
  33283. "a8",
  33284. 0x271f,
  33285. "a9",
  33286. 0x2720,
  33287. "a10",
  33288. 0x2721,
  33289. "a29",
  33290. 0x2722,
  33291. "a30",
  33292. 0x2723,
  33293. "a31",
  33294. 0x2724,
  33295. "a32",
  33296. 0x2725,
  33297. "a33",
  33298. 0x2726,
  33299. "a34",
  33300. 0x2727,
  33301. "a35",
  33302. 0x2605,
  33303. "a36",
  33304. 0x2729,
  33305. "a37",
  33306. 0x272a,
  33307. "a38",
  33308. 0x272b,
  33309. "a39",
  33310. 0x272c,
  33311. "a40",
  33312. 0x272d,
  33313. "a41",
  33314. 0x272e,
  33315. "a42",
  33316. 0x272f,
  33317. "a43",
  33318. 0x2730,
  33319. "a44",
  33320. 0x2731,
  33321. "a45",
  33322. 0x2732,
  33323. "a46",
  33324. 0x2733,
  33325. "a47",
  33326. 0x2734,
  33327. "a48",
  33328. 0x2735,
  33329. "a49",
  33330. 0x2736,
  33331. "a50",
  33332. 0x2737,
  33333. "a51",
  33334. 0x2738,
  33335. "a52",
  33336. 0x2739,
  33337. "a53",
  33338. 0x273a,
  33339. "a54",
  33340. 0x273b,
  33341. "a55",
  33342. 0x273c,
  33343. "a56",
  33344. 0x273d,
  33345. "a57",
  33346. 0x273e,
  33347. "a58",
  33348. 0x273f,
  33349. "a59",
  33350. 0x2740,
  33351. "a60",
  33352. 0x2741,
  33353. "a61",
  33354. 0x2742,
  33355. "a62",
  33356. 0x2743,
  33357. "a63",
  33358. 0x2744,
  33359. "a64",
  33360. 0x2745,
  33361. "a65",
  33362. 0x2746,
  33363. "a66",
  33364. 0x2747,
  33365. "a67",
  33366. 0x2748,
  33367. "a68",
  33368. 0x2749,
  33369. "a69",
  33370. 0x274a,
  33371. "a70",
  33372. 0x274b,
  33373. "a71",
  33374. 0x25cf,
  33375. "a72",
  33376. 0x274d,
  33377. "a73",
  33378. 0x25a0,
  33379. "a74",
  33380. 0x274f,
  33381. "a203",
  33382. 0x2750,
  33383. "a75",
  33384. 0x2751,
  33385. "a204",
  33386. 0x2752,
  33387. "a76",
  33388. 0x25b2,
  33389. "a77",
  33390. 0x25bc,
  33391. "a78",
  33392. 0x25c6,
  33393. "a79",
  33394. 0x2756,
  33395. "a81",
  33396. 0x25d7,
  33397. "a82",
  33398. 0x2758,
  33399. "a83",
  33400. 0x2759,
  33401. "a84",
  33402. 0x275a,
  33403. "a97",
  33404. 0x275b,
  33405. "a98",
  33406. 0x275c,
  33407. "a99",
  33408. 0x275d,
  33409. "a100",
  33410. 0x275e,
  33411. "a101",
  33412. 0x2761,
  33413. "a102",
  33414. 0x2762,
  33415. "a103",
  33416. 0x2763,
  33417. "a104",
  33418. 0x2764,
  33419. "a106",
  33420. 0x2765,
  33421. "a107",
  33422. 0x2766,
  33423. "a108",
  33424. 0x2767,
  33425. "a112",
  33426. 0x2663,
  33427. "a111",
  33428. 0x2666,
  33429. "a110",
  33430. 0x2665,
  33431. "a109",
  33432. 0x2660,
  33433. "a120",
  33434. 0x2460,
  33435. "a121",
  33436. 0x2461,
  33437. "a122",
  33438. 0x2462,
  33439. "a123",
  33440. 0x2463,
  33441. "a124",
  33442. 0x2464,
  33443. "a125",
  33444. 0x2465,
  33445. "a126",
  33446. 0x2466,
  33447. "a127",
  33448. 0x2467,
  33449. "a128",
  33450. 0x2468,
  33451. "a129",
  33452. 0x2469,
  33453. "a130",
  33454. 0x2776,
  33455. "a131",
  33456. 0x2777,
  33457. "a132",
  33458. 0x2778,
  33459. "a133",
  33460. 0x2779,
  33461. "a134",
  33462. 0x277a,
  33463. "a135",
  33464. 0x277b,
  33465. "a136",
  33466. 0x277c,
  33467. "a137",
  33468. 0x277d,
  33469. "a138",
  33470. 0x277e,
  33471. "a139",
  33472. 0x277f,
  33473. "a140",
  33474. 0x2780,
  33475. "a141",
  33476. 0x2781,
  33477. "a142",
  33478. 0x2782,
  33479. "a143",
  33480. 0x2783,
  33481. "a144",
  33482. 0x2784,
  33483. "a145",
  33484. 0x2785,
  33485. "a146",
  33486. 0x2786,
  33487. "a147",
  33488. 0x2787,
  33489. "a148",
  33490. 0x2788,
  33491. "a149",
  33492. 0x2789,
  33493. "a150",
  33494. 0x278a,
  33495. "a151",
  33496. 0x278b,
  33497. "a152",
  33498. 0x278c,
  33499. "a153",
  33500. 0x278d,
  33501. "a154",
  33502. 0x278e,
  33503. "a155",
  33504. 0x278f,
  33505. "a156",
  33506. 0x2790,
  33507. "a157",
  33508. 0x2791,
  33509. "a158",
  33510. 0x2792,
  33511. "a159",
  33512. 0x2793,
  33513. "a160",
  33514. 0x2794,
  33515. "a161",
  33516. 0x2192,
  33517. "a163",
  33518. 0x2194,
  33519. "a164",
  33520. 0x2195,
  33521. "a196",
  33522. 0x2798,
  33523. "a165",
  33524. 0x2799,
  33525. "a192",
  33526. 0x279a,
  33527. "a166",
  33528. 0x279b,
  33529. "a167",
  33530. 0x279c,
  33531. "a168",
  33532. 0x279d,
  33533. "a169",
  33534. 0x279e,
  33535. "a170",
  33536. 0x279f,
  33537. "a171",
  33538. 0x27a0,
  33539. "a172",
  33540. 0x27a1,
  33541. "a173",
  33542. 0x27a2,
  33543. "a162",
  33544. 0x27a3,
  33545. "a174",
  33546. 0x27a4,
  33547. "a175",
  33548. 0x27a5,
  33549. "a176",
  33550. 0x27a6,
  33551. "a177",
  33552. 0x27a7,
  33553. "a178",
  33554. 0x27a8,
  33555. "a179",
  33556. 0x27a9,
  33557. "a193",
  33558. 0x27aa,
  33559. "a180",
  33560. 0x27ab,
  33561. "a199",
  33562. 0x27ac,
  33563. "a181",
  33564. 0x27ad,
  33565. "a200",
  33566. 0x27ae,
  33567. "a182",
  33568. 0x27af,
  33569. "a201",
  33570. 0x27b1,
  33571. "a183",
  33572. 0x27b2,
  33573. "a184",
  33574. 0x27b3,
  33575. "a197",
  33576. 0x27b4,
  33577. "a185",
  33578. 0x27b5,
  33579. "a194",
  33580. 0x27b6,
  33581. "a198",
  33582. 0x27b7,
  33583. "a186",
  33584. 0x27b8,
  33585. "a195",
  33586. 0x27b9,
  33587. "a187",
  33588. 0x27ba,
  33589. "a188",
  33590. 0x27bb,
  33591. "a189",
  33592. 0x27bc,
  33593. "a190",
  33594. 0x27bd,
  33595. "a191",
  33596. 0x27be,
  33597. "a89",
  33598. 0x2768,
  33599. "a90",
  33600. 0x2769,
  33601. "a93",
  33602. 0x276a,
  33603. "a94",
  33604. 0x276b,
  33605. "a91",
  33606. 0x276c,
  33607. "a92",
  33608. 0x276d,
  33609. "a205",
  33610. 0x276e,
  33611. "a85",
  33612. 0x276f,
  33613. "a206",
  33614. 0x2770,
  33615. "a86",
  33616. 0x2771,
  33617. "a87",
  33618. 0x2772,
  33619. "a88",
  33620. 0x2773,
  33621. "a95",
  33622. 0x2774,
  33623. "a96",
  33624. 0x2775,
  33625. ".notdef",
  33626. 0x0000
  33627. ];
  33628. });
  33629. /***/ }),
  33630. /* 38 */
  33631. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  33632. __w_pdfjs_require__.r(__webpack_exports__);
  33633. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  33634. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  33635. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  33636. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  33637. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  33638. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  33639. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  33640. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  33641. /* harmony export */ });
  33642. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  33643. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  33644. t[63721] = 0x00a9;
  33645. t[63193] = 0x00a9;
  33646. t[63720] = 0x00ae;
  33647. t[63194] = 0x00ae;
  33648. t[63722] = 0x2122;
  33649. t[63195] = 0x2122;
  33650. t[63729] = 0x23a7;
  33651. t[63730] = 0x23a8;
  33652. t[63731] = 0x23a9;
  33653. t[63740] = 0x23ab;
  33654. t[63741] = 0x23ac;
  33655. t[63742] = 0x23ad;
  33656. t[63726] = 0x23a1;
  33657. t[63727] = 0x23a2;
  33658. t[63728] = 0x23a3;
  33659. t[63737] = 0x23a4;
  33660. t[63738] = 0x23a5;
  33661. t[63739] = 0x23a6;
  33662. t[63723] = 0x239b;
  33663. t[63724] = 0x239c;
  33664. t[63725] = 0x239d;
  33665. t[63734] = 0x239e;
  33666. t[63735] = 0x239f;
  33667. t[63736] = 0x23a0;
  33668. });
  33669. function mapSpecialUnicodeValues(code) {
  33670. if (code >= 0xfff0 && code <= 0xffff) {
  33671. return 0;
  33672. } else if (code >= 0xf600 && code <= 0xf8ff) {
  33673. return getSpecialPUASymbols()[code] || code;
  33674. } else if (code === 0x00ad) {
  33675. return 0x002d;
  33676. }
  33677. return code;
  33678. }
  33679. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33680. let unicode = glyphsUnicodeMap[name];
  33681. if (unicode !== undefined) {
  33682. return unicode;
  33683. }
  33684. if (!name) {
  33685. return -1;
  33686. }
  33687. if (name[0] === "u") {
  33688. const nameLen = name.length;
  33689. let hexStr;
  33690. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  33691. hexStr = name.substring(3);
  33692. } else if (nameLen >= 5 && nameLen <= 7) {
  33693. hexStr = name.substring(1);
  33694. } else {
  33695. return -1;
  33696. }
  33697. if (hexStr === hexStr.toUpperCase()) {
  33698. unicode = parseInt(hexStr, 16);
  33699. if (unicode >= 0) {
  33700. return unicode;
  33701. }
  33702. }
  33703. }
  33704. return -1;
  33705. }
  33706. const UnicodeRanges = [
  33707. {
  33708. begin: 0x0000,
  33709. end: 0x007f
  33710. },
  33711. {
  33712. begin: 0x0080,
  33713. end: 0x00ff
  33714. },
  33715. {
  33716. begin: 0x0100,
  33717. end: 0x017f
  33718. },
  33719. {
  33720. begin: 0x0180,
  33721. end: 0x024f
  33722. },
  33723. {
  33724. begin: 0x0250,
  33725. end: 0x02af
  33726. },
  33727. {
  33728. begin: 0x02b0,
  33729. end: 0x02ff
  33730. },
  33731. {
  33732. begin: 0x0300,
  33733. end: 0x036f
  33734. },
  33735. {
  33736. begin: 0x0370,
  33737. end: 0x03ff
  33738. },
  33739. {
  33740. begin: 0x2c80,
  33741. end: 0x2cff
  33742. },
  33743. {
  33744. begin: 0x0400,
  33745. end: 0x04ff
  33746. },
  33747. {
  33748. begin: 0x0530,
  33749. end: 0x058f
  33750. },
  33751. {
  33752. begin: 0x0590,
  33753. end: 0x05ff
  33754. },
  33755. {
  33756. begin: 0xa500,
  33757. end: 0xa63f
  33758. },
  33759. {
  33760. begin: 0x0600,
  33761. end: 0x06ff
  33762. },
  33763. {
  33764. begin: 0x07c0,
  33765. end: 0x07ff
  33766. },
  33767. {
  33768. begin: 0x0900,
  33769. end: 0x097f
  33770. },
  33771. {
  33772. begin: 0x0980,
  33773. end: 0x09ff
  33774. },
  33775. {
  33776. begin: 0x0a00,
  33777. end: 0x0a7f
  33778. },
  33779. {
  33780. begin: 0x0a80,
  33781. end: 0x0aff
  33782. },
  33783. {
  33784. begin: 0x0b00,
  33785. end: 0x0b7f
  33786. },
  33787. {
  33788. begin: 0x0b80,
  33789. end: 0x0bff
  33790. },
  33791. {
  33792. begin: 0x0c00,
  33793. end: 0x0c7f
  33794. },
  33795. {
  33796. begin: 0x0c80,
  33797. end: 0x0cff
  33798. },
  33799. {
  33800. begin: 0x0d00,
  33801. end: 0x0d7f
  33802. },
  33803. {
  33804. begin: 0x0e00,
  33805. end: 0x0e7f
  33806. },
  33807. {
  33808. begin: 0x0e80,
  33809. end: 0x0eff
  33810. },
  33811. {
  33812. begin: 0x10a0,
  33813. end: 0x10ff
  33814. },
  33815. {
  33816. begin: 0x1b00,
  33817. end: 0x1b7f
  33818. },
  33819. {
  33820. begin: 0x1100,
  33821. end: 0x11ff
  33822. },
  33823. {
  33824. begin: 0x1e00,
  33825. end: 0x1eff
  33826. },
  33827. {
  33828. begin: 0x1f00,
  33829. end: 0x1fff
  33830. },
  33831. {
  33832. begin: 0x2000,
  33833. end: 0x206f
  33834. },
  33835. {
  33836. begin: 0x2070,
  33837. end: 0x209f
  33838. },
  33839. {
  33840. begin: 0x20a0,
  33841. end: 0x20cf
  33842. },
  33843. {
  33844. begin: 0x20d0,
  33845. end: 0x20ff
  33846. },
  33847. {
  33848. begin: 0x2100,
  33849. end: 0x214f
  33850. },
  33851. {
  33852. begin: 0x2150,
  33853. end: 0x218f
  33854. },
  33855. {
  33856. begin: 0x2190,
  33857. end: 0x21ff
  33858. },
  33859. {
  33860. begin: 0x2200,
  33861. end: 0x22ff
  33862. },
  33863. {
  33864. begin: 0x2300,
  33865. end: 0x23ff
  33866. },
  33867. {
  33868. begin: 0x2400,
  33869. end: 0x243f
  33870. },
  33871. {
  33872. begin: 0x2440,
  33873. end: 0x245f
  33874. },
  33875. {
  33876. begin: 0x2460,
  33877. end: 0x24ff
  33878. },
  33879. {
  33880. begin: 0x2500,
  33881. end: 0x257f
  33882. },
  33883. {
  33884. begin: 0x2580,
  33885. end: 0x259f
  33886. },
  33887. {
  33888. begin: 0x25a0,
  33889. end: 0x25ff
  33890. },
  33891. {
  33892. begin: 0x2600,
  33893. end: 0x26ff
  33894. },
  33895. {
  33896. begin: 0x2700,
  33897. end: 0x27bf
  33898. },
  33899. {
  33900. begin: 0x3000,
  33901. end: 0x303f
  33902. },
  33903. {
  33904. begin: 0x3040,
  33905. end: 0x309f
  33906. },
  33907. {
  33908. begin: 0x30a0,
  33909. end: 0x30ff
  33910. },
  33911. {
  33912. begin: 0x3100,
  33913. end: 0x312f
  33914. },
  33915. {
  33916. begin: 0x3130,
  33917. end: 0x318f
  33918. },
  33919. {
  33920. begin: 0xa840,
  33921. end: 0xa87f
  33922. },
  33923. {
  33924. begin: 0x3200,
  33925. end: 0x32ff
  33926. },
  33927. {
  33928. begin: 0x3300,
  33929. end: 0x33ff
  33930. },
  33931. {
  33932. begin: 0xac00,
  33933. end: 0xd7af
  33934. },
  33935. {
  33936. begin: 0xd800,
  33937. end: 0xdfff
  33938. },
  33939. {
  33940. begin: 0x10900,
  33941. end: 0x1091f
  33942. },
  33943. {
  33944. begin: 0x4e00,
  33945. end: 0x9fff
  33946. },
  33947. {
  33948. begin: 0xe000,
  33949. end: 0xf8ff
  33950. },
  33951. {
  33952. begin: 0x31c0,
  33953. end: 0x31ef
  33954. },
  33955. {
  33956. begin: 0xfb00,
  33957. end: 0xfb4f
  33958. },
  33959. {
  33960. begin: 0xfb50,
  33961. end: 0xfdff
  33962. },
  33963. {
  33964. begin: 0xfe20,
  33965. end: 0xfe2f
  33966. },
  33967. {
  33968. begin: 0xfe10,
  33969. end: 0xfe1f
  33970. },
  33971. {
  33972. begin: 0xfe50,
  33973. end: 0xfe6f
  33974. },
  33975. {
  33976. begin: 0xfe70,
  33977. end: 0xfeff
  33978. },
  33979. {
  33980. begin: 0xff00,
  33981. end: 0xffef
  33982. },
  33983. {
  33984. begin: 0xfff0,
  33985. end: 0xffff
  33986. },
  33987. {
  33988. begin: 0x0f00,
  33989. end: 0x0fff
  33990. },
  33991. {
  33992. begin: 0x0700,
  33993. end: 0x074f
  33994. },
  33995. {
  33996. begin: 0x0780,
  33997. end: 0x07bf
  33998. },
  33999. {
  34000. begin: 0x0d80,
  34001. end: 0x0dff
  34002. },
  34003. {
  34004. begin: 0x1000,
  34005. end: 0x109f
  34006. },
  34007. {
  34008. begin: 0x1200,
  34009. end: 0x137f
  34010. },
  34011. {
  34012. begin: 0x13a0,
  34013. end: 0x13ff
  34014. },
  34015. {
  34016. begin: 0x1400,
  34017. end: 0x167f
  34018. },
  34019. {
  34020. begin: 0x1680,
  34021. end: 0x169f
  34022. },
  34023. {
  34024. begin: 0x16a0,
  34025. end: 0x16ff
  34026. },
  34027. {
  34028. begin: 0x1780,
  34029. end: 0x17ff
  34030. },
  34031. {
  34032. begin: 0x1800,
  34033. end: 0x18af
  34034. },
  34035. {
  34036. begin: 0x2800,
  34037. end: 0x28ff
  34038. },
  34039. {
  34040. begin: 0xa000,
  34041. end: 0xa48f
  34042. },
  34043. {
  34044. begin: 0x1700,
  34045. end: 0x171f
  34046. },
  34047. {
  34048. begin: 0x10300,
  34049. end: 0x1032f
  34050. },
  34051. {
  34052. begin: 0x10330,
  34053. end: 0x1034f
  34054. },
  34055. {
  34056. begin: 0x10400,
  34057. end: 0x1044f
  34058. },
  34059. {
  34060. begin: 0x1d000,
  34061. end: 0x1d0ff
  34062. },
  34063. {
  34064. begin: 0x1d400,
  34065. end: 0x1d7ff
  34066. },
  34067. {
  34068. begin: 0xff000,
  34069. end: 0xffffd
  34070. },
  34071. {
  34072. begin: 0xfe00,
  34073. end: 0xfe0f
  34074. },
  34075. {
  34076. begin: 0xe0000,
  34077. end: 0xe007f
  34078. },
  34079. {
  34080. begin: 0x1900,
  34081. end: 0x194f
  34082. },
  34083. {
  34084. begin: 0x1950,
  34085. end: 0x197f
  34086. },
  34087. {
  34088. begin: 0x1980,
  34089. end: 0x19df
  34090. },
  34091. {
  34092. begin: 0x1a00,
  34093. end: 0x1a1f
  34094. },
  34095. {
  34096. begin: 0x2c00,
  34097. end: 0x2c5f
  34098. },
  34099. {
  34100. begin: 0x2d30,
  34101. end: 0x2d7f
  34102. },
  34103. {
  34104. begin: 0x4dc0,
  34105. end: 0x4dff
  34106. },
  34107. {
  34108. begin: 0xa800,
  34109. end: 0xa82f
  34110. },
  34111. {
  34112. begin: 0x10000,
  34113. end: 0x1007f
  34114. },
  34115. {
  34116. begin: 0x10140,
  34117. end: 0x1018f
  34118. },
  34119. {
  34120. begin: 0x10380,
  34121. end: 0x1039f
  34122. },
  34123. {
  34124. begin: 0x103a0,
  34125. end: 0x103df
  34126. },
  34127. {
  34128. begin: 0x10450,
  34129. end: 0x1047f
  34130. },
  34131. {
  34132. begin: 0x10480,
  34133. end: 0x104af
  34134. },
  34135. {
  34136. begin: 0x10800,
  34137. end: 0x1083f
  34138. },
  34139. {
  34140. begin: 0x10a00,
  34141. end: 0x10a5f
  34142. },
  34143. {
  34144. begin: 0x1d300,
  34145. end: 0x1d35f
  34146. },
  34147. {
  34148. begin: 0x12000,
  34149. end: 0x123ff
  34150. },
  34151. {
  34152. begin: 0x1d360,
  34153. end: 0x1d37f
  34154. },
  34155. {
  34156. begin: 0x1b80,
  34157. end: 0x1bbf
  34158. },
  34159. {
  34160. begin: 0x1c00,
  34161. end: 0x1c4f
  34162. },
  34163. {
  34164. begin: 0x1c50,
  34165. end: 0x1c7f
  34166. },
  34167. {
  34168. begin: 0xa880,
  34169. end: 0xa8df
  34170. },
  34171. {
  34172. begin: 0xa900,
  34173. end: 0xa92f
  34174. },
  34175. {
  34176. begin: 0xa930,
  34177. end: 0xa95f
  34178. },
  34179. {
  34180. begin: 0xaa00,
  34181. end: 0xaa5f
  34182. },
  34183. {
  34184. begin: 0x10190,
  34185. end: 0x101cf
  34186. },
  34187. {
  34188. begin: 0x101d0,
  34189. end: 0x101ff
  34190. },
  34191. {
  34192. begin: 0x102a0,
  34193. end: 0x102df
  34194. },
  34195. {
  34196. begin: 0x1f030,
  34197. end: 0x1f09f
  34198. }
  34199. ];
  34200. function getUnicodeRangeFor(value) {
  34201. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  34202. const range = UnicodeRanges[i];
  34203. if (value >= range.begin && value < range.end) {
  34204. return i;
  34205. }
  34206. }
  34207. return -1;
  34208. }
  34209. function isRTLRangeFor(value) {
  34210. let range = UnicodeRanges[13];
  34211. if (value >= range.begin && value < range.end) {
  34212. return true;
  34213. }
  34214. range = UnicodeRanges[11];
  34215. if (value >= range.begin && value < range.end) {
  34216. return true;
  34217. }
  34218. return false;
  34219. }
  34220. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  34221. return [
  34222. "\u00A8",
  34223. "\u0020\u0308",
  34224. "\u00AF",
  34225. "\u0020\u0304",
  34226. "\u00B4",
  34227. "\u0020\u0301",
  34228. "\u00B5",
  34229. "\u03BC",
  34230. "\u00B8",
  34231. "\u0020\u0327",
  34232. "\u0132",
  34233. "\u0049\u004A",
  34234. "\u0133",
  34235. "\u0069\u006A",
  34236. "\u013F",
  34237. "\u004C\u00B7",
  34238. "\u0140",
  34239. "\u006C\u00B7",
  34240. "\u0149",
  34241. "\u02BC\u006E",
  34242. "\u017F",
  34243. "\u0073",
  34244. "\u01C4",
  34245. "\u0044\u017D",
  34246. "\u01C5",
  34247. "\u0044\u017E",
  34248. "\u01C6",
  34249. "\u0064\u017E",
  34250. "\u01C7",
  34251. "\u004C\u004A",
  34252. "\u01C8",
  34253. "\u004C\u006A",
  34254. "\u01C9",
  34255. "\u006C\u006A",
  34256. "\u01CA",
  34257. "\u004E\u004A",
  34258. "\u01CB",
  34259. "\u004E\u006A",
  34260. "\u01CC",
  34261. "\u006E\u006A",
  34262. "\u01F1",
  34263. "\u0044\u005A",
  34264. "\u01F2",
  34265. "\u0044\u007A",
  34266. "\u01F3",
  34267. "\u0064\u007A",
  34268. "\u02D8",
  34269. "\u0020\u0306",
  34270. "\u02D9",
  34271. "\u0020\u0307",
  34272. "\u02DA",
  34273. "\u0020\u030A",
  34274. "\u02DB",
  34275. "\u0020\u0328",
  34276. "\u02DC",
  34277. "\u0020\u0303",
  34278. "\u02DD",
  34279. "\u0020\u030B",
  34280. "\u037A",
  34281. "\u0020\u0345",
  34282. "\u0384",
  34283. "\u0020\u0301",
  34284. "\u03D0",
  34285. "\u03B2",
  34286. "\u03D1",
  34287. "\u03B8",
  34288. "\u03D2",
  34289. "\u03A5",
  34290. "\u03D5",
  34291. "\u03C6",
  34292. "\u03D6",
  34293. "\u03C0",
  34294. "\u03F0",
  34295. "\u03BA",
  34296. "\u03F1",
  34297. "\u03C1",
  34298. "\u03F2",
  34299. "\u03C2",
  34300. "\u03F4",
  34301. "\u0398",
  34302. "\u03F5",
  34303. "\u03B5",
  34304. "\u03F9",
  34305. "\u03A3",
  34306. "\u0587",
  34307. "\u0565\u0582",
  34308. "\u0675",
  34309. "\u0627\u0674",
  34310. "\u0676",
  34311. "\u0648\u0674",
  34312. "\u0677",
  34313. "\u06C7\u0674",
  34314. "\u0678",
  34315. "\u064A\u0674",
  34316. "\u0E33",
  34317. "\u0E4D\u0E32",
  34318. "\u0EB3",
  34319. "\u0ECD\u0EB2",
  34320. "\u0EDC",
  34321. "\u0EAB\u0E99",
  34322. "\u0EDD",
  34323. "\u0EAB\u0EA1",
  34324. "\u0F77",
  34325. "\u0FB2\u0F81",
  34326. "\u0F79",
  34327. "\u0FB3\u0F81",
  34328. "\u1E9A",
  34329. "\u0061\u02BE",
  34330. "\u1FBD",
  34331. "\u0020\u0313",
  34332. "\u1FBF",
  34333. "\u0020\u0313",
  34334. "\u1FC0",
  34335. "\u0020\u0342",
  34336. "\u1FFE",
  34337. "\u0020\u0314",
  34338. "\u2002",
  34339. "\u0020",
  34340. "\u2003",
  34341. "\u0020",
  34342. "\u2004",
  34343. "\u0020",
  34344. "\u2005",
  34345. "\u0020",
  34346. "\u2006",
  34347. "\u0020",
  34348. "\u2008",
  34349. "\u0020",
  34350. "\u2009",
  34351. "\u0020",
  34352. "\u200A",
  34353. "\u0020",
  34354. "\u2017",
  34355. "\u0020\u0333",
  34356. "\u2024",
  34357. "\u002E",
  34358. "\u2025",
  34359. "\u002E\u002E",
  34360. "\u2026",
  34361. "\u002E\u002E\u002E",
  34362. "\u2033",
  34363. "\u2032\u2032",
  34364. "\u2034",
  34365. "\u2032\u2032\u2032",
  34366. "\u2036",
  34367. "\u2035\u2035",
  34368. "\u2037",
  34369. "\u2035\u2035\u2035",
  34370. "\u203C",
  34371. "\u0021\u0021",
  34372. "\u203E",
  34373. "\u0020\u0305",
  34374. "\u2047",
  34375. "\u003F\u003F",
  34376. "\u2048",
  34377. "\u003F\u0021",
  34378. "\u2049",
  34379. "\u0021\u003F",
  34380. "\u2057",
  34381. "\u2032\u2032\u2032\u2032",
  34382. "\u205F",
  34383. "\u0020",
  34384. "\u20A8",
  34385. "\u0052\u0073",
  34386. "\u2100",
  34387. "\u0061\u002F\u0063",
  34388. "\u2101",
  34389. "\u0061\u002F\u0073",
  34390. "\u2103",
  34391. "\u00B0\u0043",
  34392. "\u2105",
  34393. "\u0063\u002F\u006F",
  34394. "\u2106",
  34395. "\u0063\u002F\u0075",
  34396. "\u2107",
  34397. "\u0190",
  34398. "\u2109",
  34399. "\u00B0\u0046",
  34400. "\u2116",
  34401. "\u004E\u006F",
  34402. "\u2121",
  34403. "\u0054\u0045\u004C",
  34404. "\u2135",
  34405. "\u05D0",
  34406. "\u2136",
  34407. "\u05D1",
  34408. "\u2137",
  34409. "\u05D2",
  34410. "\u2138",
  34411. "\u05D3",
  34412. "\u213B",
  34413. "\u0046\u0041\u0058",
  34414. "\u2160",
  34415. "\u0049",
  34416. "\u2161",
  34417. "\u0049\u0049",
  34418. "\u2162",
  34419. "\u0049\u0049\u0049",
  34420. "\u2163",
  34421. "\u0049\u0056",
  34422. "\u2164",
  34423. "\u0056",
  34424. "\u2165",
  34425. "\u0056\u0049",
  34426. "\u2166",
  34427. "\u0056\u0049\u0049",
  34428. "\u2167",
  34429. "\u0056\u0049\u0049\u0049",
  34430. "\u2168",
  34431. "\u0049\u0058",
  34432. "\u2169",
  34433. "\u0058",
  34434. "\u216A",
  34435. "\u0058\u0049",
  34436. "\u216B",
  34437. "\u0058\u0049\u0049",
  34438. "\u216C",
  34439. "\u004C",
  34440. "\u216D",
  34441. "\u0043",
  34442. "\u216E",
  34443. "\u0044",
  34444. "\u216F",
  34445. "\u004D",
  34446. "\u2170",
  34447. "\u0069",
  34448. "\u2171",
  34449. "\u0069\u0069",
  34450. "\u2172",
  34451. "\u0069\u0069\u0069",
  34452. "\u2173",
  34453. "\u0069\u0076",
  34454. "\u2174",
  34455. "\u0076",
  34456. "\u2175",
  34457. "\u0076\u0069",
  34458. "\u2176",
  34459. "\u0076\u0069\u0069",
  34460. "\u2177",
  34461. "\u0076\u0069\u0069\u0069",
  34462. "\u2178",
  34463. "\u0069\u0078",
  34464. "\u2179",
  34465. "\u0078",
  34466. "\u217A",
  34467. "\u0078\u0069",
  34468. "\u217B",
  34469. "\u0078\u0069\u0069",
  34470. "\u217C",
  34471. "\u006C",
  34472. "\u217D",
  34473. "\u0063",
  34474. "\u217E",
  34475. "\u0064",
  34476. "\u217F",
  34477. "\u006D",
  34478. "\u222C",
  34479. "\u222B\u222B",
  34480. "\u222D",
  34481. "\u222B\u222B\u222B",
  34482. "\u222F",
  34483. "\u222E\u222E",
  34484. "\u2230",
  34485. "\u222E\u222E\u222E",
  34486. "\u2474",
  34487. "\u0028\u0031\u0029",
  34488. "\u2475",
  34489. "\u0028\u0032\u0029",
  34490. "\u2476",
  34491. "\u0028\u0033\u0029",
  34492. "\u2477",
  34493. "\u0028\u0034\u0029",
  34494. "\u2478",
  34495. "\u0028\u0035\u0029",
  34496. "\u2479",
  34497. "\u0028\u0036\u0029",
  34498. "\u247A",
  34499. "\u0028\u0037\u0029",
  34500. "\u247B",
  34501. "\u0028\u0038\u0029",
  34502. "\u247C",
  34503. "\u0028\u0039\u0029",
  34504. "\u247D",
  34505. "\u0028\u0031\u0030\u0029",
  34506. "\u247E",
  34507. "\u0028\u0031\u0031\u0029",
  34508. "\u247F",
  34509. "\u0028\u0031\u0032\u0029",
  34510. "\u2480",
  34511. "\u0028\u0031\u0033\u0029",
  34512. "\u2481",
  34513. "\u0028\u0031\u0034\u0029",
  34514. "\u2482",
  34515. "\u0028\u0031\u0035\u0029",
  34516. "\u2483",
  34517. "\u0028\u0031\u0036\u0029",
  34518. "\u2484",
  34519. "\u0028\u0031\u0037\u0029",
  34520. "\u2485",
  34521. "\u0028\u0031\u0038\u0029",
  34522. "\u2486",
  34523. "\u0028\u0031\u0039\u0029",
  34524. "\u2487",
  34525. "\u0028\u0032\u0030\u0029",
  34526. "\u2488",
  34527. "\u0031\u002E",
  34528. "\u2489",
  34529. "\u0032\u002E",
  34530. "\u248A",
  34531. "\u0033\u002E",
  34532. "\u248B",
  34533. "\u0034\u002E",
  34534. "\u248C",
  34535. "\u0035\u002E",
  34536. "\u248D",
  34537. "\u0036\u002E",
  34538. "\u248E",
  34539. "\u0037\u002E",
  34540. "\u248F",
  34541. "\u0038\u002E",
  34542. "\u2490",
  34543. "\u0039\u002E",
  34544. "\u2491",
  34545. "\u0031\u0030\u002E",
  34546. "\u2492",
  34547. "\u0031\u0031\u002E",
  34548. "\u2493",
  34549. "\u0031\u0032\u002E",
  34550. "\u2494",
  34551. "\u0031\u0033\u002E",
  34552. "\u2495",
  34553. "\u0031\u0034\u002E",
  34554. "\u2496",
  34555. "\u0031\u0035\u002E",
  34556. "\u2497",
  34557. "\u0031\u0036\u002E",
  34558. "\u2498",
  34559. "\u0031\u0037\u002E",
  34560. "\u2499",
  34561. "\u0031\u0038\u002E",
  34562. "\u249A",
  34563. "\u0031\u0039\u002E",
  34564. "\u249B",
  34565. "\u0032\u0030\u002E",
  34566. "\u249C",
  34567. "\u0028\u0061\u0029",
  34568. "\u249D",
  34569. "\u0028\u0062\u0029",
  34570. "\u249E",
  34571. "\u0028\u0063\u0029",
  34572. "\u249F",
  34573. "\u0028\u0064\u0029",
  34574. "\u24A0",
  34575. "\u0028\u0065\u0029",
  34576. "\u24A1",
  34577. "\u0028\u0066\u0029",
  34578. "\u24A2",
  34579. "\u0028\u0067\u0029",
  34580. "\u24A3",
  34581. "\u0028\u0068\u0029",
  34582. "\u24A4",
  34583. "\u0028\u0069\u0029",
  34584. "\u24A5",
  34585. "\u0028\u006A\u0029",
  34586. "\u24A6",
  34587. "\u0028\u006B\u0029",
  34588. "\u24A7",
  34589. "\u0028\u006C\u0029",
  34590. "\u24A8",
  34591. "\u0028\u006D\u0029",
  34592. "\u24A9",
  34593. "\u0028\u006E\u0029",
  34594. "\u24AA",
  34595. "\u0028\u006F\u0029",
  34596. "\u24AB",
  34597. "\u0028\u0070\u0029",
  34598. "\u24AC",
  34599. "\u0028\u0071\u0029",
  34600. "\u24AD",
  34601. "\u0028\u0072\u0029",
  34602. "\u24AE",
  34603. "\u0028\u0073\u0029",
  34604. "\u24AF",
  34605. "\u0028\u0074\u0029",
  34606. "\u24B0",
  34607. "\u0028\u0075\u0029",
  34608. "\u24B1",
  34609. "\u0028\u0076\u0029",
  34610. "\u24B2",
  34611. "\u0028\u0077\u0029",
  34612. "\u24B3",
  34613. "\u0028\u0078\u0029",
  34614. "\u24B4",
  34615. "\u0028\u0079\u0029",
  34616. "\u24B5",
  34617. "\u0028\u007A\u0029",
  34618. "\u2A0C",
  34619. "\u222B\u222B\u222B\u222B",
  34620. "\u2A74",
  34621. "\u003A\u003A\u003D",
  34622. "\u2A75",
  34623. "\u003D\u003D",
  34624. "\u2A76",
  34625. "\u003D\u003D\u003D",
  34626. "\u2E9F",
  34627. "\u6BCD",
  34628. "\u2EF3",
  34629. "\u9F9F",
  34630. "\u2F00",
  34631. "\u4E00",
  34632. "\u2F01",
  34633. "\u4E28",
  34634. "\u2F02",
  34635. "\u4E36",
  34636. "\u2F03",
  34637. "\u4E3F",
  34638. "\u2F04",
  34639. "\u4E59",
  34640. "\u2F05",
  34641. "\u4E85",
  34642. "\u2F06",
  34643. "\u4E8C",
  34644. "\u2F07",
  34645. "\u4EA0",
  34646. "\u2F08",
  34647. "\u4EBA",
  34648. "\u2F09",
  34649. "\u513F",
  34650. "\u2F0A",
  34651. "\u5165",
  34652. "\u2F0B",
  34653. "\u516B",
  34654. "\u2F0C",
  34655. "\u5182",
  34656. "\u2F0D",
  34657. "\u5196",
  34658. "\u2F0E",
  34659. "\u51AB",
  34660. "\u2F0F",
  34661. "\u51E0",
  34662. "\u2F10",
  34663. "\u51F5",
  34664. "\u2F11",
  34665. "\u5200",
  34666. "\u2F12",
  34667. "\u529B",
  34668. "\u2F13",
  34669. "\u52F9",
  34670. "\u2F14",
  34671. "\u5315",
  34672. "\u2F15",
  34673. "\u531A",
  34674. "\u2F16",
  34675. "\u5338",
  34676. "\u2F17",
  34677. "\u5341",
  34678. "\u2F18",
  34679. "\u535C",
  34680. "\u2F19",
  34681. "\u5369",
  34682. "\u2F1A",
  34683. "\u5382",
  34684. "\u2F1B",
  34685. "\u53B6",
  34686. "\u2F1C",
  34687. "\u53C8",
  34688. "\u2F1D",
  34689. "\u53E3",
  34690. "\u2F1E",
  34691. "\u56D7",
  34692. "\u2F1F",
  34693. "\u571F",
  34694. "\u2F20",
  34695. "\u58EB",
  34696. "\u2F21",
  34697. "\u5902",
  34698. "\u2F22",
  34699. "\u590A",
  34700. "\u2F23",
  34701. "\u5915",
  34702. "\u2F24",
  34703. "\u5927",
  34704. "\u2F25",
  34705. "\u5973",
  34706. "\u2F26",
  34707. "\u5B50",
  34708. "\u2F27",
  34709. "\u5B80",
  34710. "\u2F28",
  34711. "\u5BF8",
  34712. "\u2F29",
  34713. "\u5C0F",
  34714. "\u2F2A",
  34715. "\u5C22",
  34716. "\u2F2B",
  34717. "\u5C38",
  34718. "\u2F2C",
  34719. "\u5C6E",
  34720. "\u2F2D",
  34721. "\u5C71",
  34722. "\u2F2E",
  34723. "\u5DDB",
  34724. "\u2F2F",
  34725. "\u5DE5",
  34726. "\u2F30",
  34727. "\u5DF1",
  34728. "\u2F31",
  34729. "\u5DFE",
  34730. "\u2F32",
  34731. "\u5E72",
  34732. "\u2F33",
  34733. "\u5E7A",
  34734. "\u2F34",
  34735. "\u5E7F",
  34736. "\u2F35",
  34737. "\u5EF4",
  34738. "\u2F36",
  34739. "\u5EFE",
  34740. "\u2F37",
  34741. "\u5F0B",
  34742. "\u2F38",
  34743. "\u5F13",
  34744. "\u2F39",
  34745. "\u5F50",
  34746. "\u2F3A",
  34747. "\u5F61",
  34748. "\u2F3B",
  34749. "\u5F73",
  34750. "\u2F3C",
  34751. "\u5FC3",
  34752. "\u2F3D",
  34753. "\u6208",
  34754. "\u2F3E",
  34755. "\u6236",
  34756. "\u2F3F",
  34757. "\u624B",
  34758. "\u2F40",
  34759. "\u652F",
  34760. "\u2F41",
  34761. "\u6534",
  34762. "\u2F42",
  34763. "\u6587",
  34764. "\u2F43",
  34765. "\u6597",
  34766. "\u2F44",
  34767. "\u65A4",
  34768. "\u2F45",
  34769. "\u65B9",
  34770. "\u2F46",
  34771. "\u65E0",
  34772. "\u2F47",
  34773. "\u65E5",
  34774. "\u2F48",
  34775. "\u66F0",
  34776. "\u2F49",
  34777. "\u6708",
  34778. "\u2F4A",
  34779. "\u6728",
  34780. "\u2F4B",
  34781. "\u6B20",
  34782. "\u2F4C",
  34783. "\u6B62",
  34784. "\u2F4D",
  34785. "\u6B79",
  34786. "\u2F4E",
  34787. "\u6BB3",
  34788. "\u2F4F",
  34789. "\u6BCB",
  34790. "\u2F50",
  34791. "\u6BD4",
  34792. "\u2F51",
  34793. "\u6BDB",
  34794. "\u2F52",
  34795. "\u6C0F",
  34796. "\u2F53",
  34797. "\u6C14",
  34798. "\u2F54",
  34799. "\u6C34",
  34800. "\u2F55",
  34801. "\u706B",
  34802. "\u2F56",
  34803. "\u722A",
  34804. "\u2F57",
  34805. "\u7236",
  34806. "\u2F58",
  34807. "\u723B",
  34808. "\u2F59",
  34809. "\u723F",
  34810. "\u2F5A",
  34811. "\u7247",
  34812. "\u2F5B",
  34813. "\u7259",
  34814. "\u2F5C",
  34815. "\u725B",
  34816. "\u2F5D",
  34817. "\u72AC",
  34818. "\u2F5E",
  34819. "\u7384",
  34820. "\u2F5F",
  34821. "\u7389",
  34822. "\u2F60",
  34823. "\u74DC",
  34824. "\u2F61",
  34825. "\u74E6",
  34826. "\u2F62",
  34827. "\u7518",
  34828. "\u2F63",
  34829. "\u751F",
  34830. "\u2F64",
  34831. "\u7528",
  34832. "\u2F65",
  34833. "\u7530",
  34834. "\u2F66",
  34835. "\u758B",
  34836. "\u2F67",
  34837. "\u7592",
  34838. "\u2F68",
  34839. "\u7676",
  34840. "\u2F69",
  34841. "\u767D",
  34842. "\u2F6A",
  34843. "\u76AE",
  34844. "\u2F6B",
  34845. "\u76BF",
  34846. "\u2F6C",
  34847. "\u76EE",
  34848. "\u2F6D",
  34849. "\u77DB",
  34850. "\u2F6E",
  34851. "\u77E2",
  34852. "\u2F6F",
  34853. "\u77F3",
  34854. "\u2F70",
  34855. "\u793A",
  34856. "\u2F71",
  34857. "\u79B8",
  34858. "\u2F72",
  34859. "\u79BE",
  34860. "\u2F73",
  34861. "\u7A74",
  34862. "\u2F74",
  34863. "\u7ACB",
  34864. "\u2F75",
  34865. "\u7AF9",
  34866. "\u2F76",
  34867. "\u7C73",
  34868. "\u2F77",
  34869. "\u7CF8",
  34870. "\u2F78",
  34871. "\u7F36",
  34872. "\u2F79",
  34873. "\u7F51",
  34874. "\u2F7A",
  34875. "\u7F8A",
  34876. "\u2F7B",
  34877. "\u7FBD",
  34878. "\u2F7C",
  34879. "\u8001",
  34880. "\u2F7D",
  34881. "\u800C",
  34882. "\u2F7E",
  34883. "\u8012",
  34884. "\u2F7F",
  34885. "\u8033",
  34886. "\u2F80",
  34887. "\u807F",
  34888. "\u2F81",
  34889. "\u8089",
  34890. "\u2F82",
  34891. "\u81E3",
  34892. "\u2F83",
  34893. "\u81EA",
  34894. "\u2F84",
  34895. "\u81F3",
  34896. "\u2F85",
  34897. "\u81FC",
  34898. "\u2F86",
  34899. "\u820C",
  34900. "\u2F87",
  34901. "\u821B",
  34902. "\u2F88",
  34903. "\u821F",
  34904. "\u2F89",
  34905. "\u826E",
  34906. "\u2F8A",
  34907. "\u8272",
  34908. "\u2F8B",
  34909. "\u8278",
  34910. "\u2F8C",
  34911. "\u864D",
  34912. "\u2F8D",
  34913. "\u866B",
  34914. "\u2F8E",
  34915. "\u8840",
  34916. "\u2F8F",
  34917. "\u884C",
  34918. "\u2F90",
  34919. "\u8863",
  34920. "\u2F91",
  34921. "\u897E",
  34922. "\u2F92",
  34923. "\u898B",
  34924. "\u2F93",
  34925. "\u89D2",
  34926. "\u2F94",
  34927. "\u8A00",
  34928. "\u2F95",
  34929. "\u8C37",
  34930. "\u2F96",
  34931. "\u8C46",
  34932. "\u2F97",
  34933. "\u8C55",
  34934. "\u2F98",
  34935. "\u8C78",
  34936. "\u2F99",
  34937. "\u8C9D",
  34938. "\u2F9A",
  34939. "\u8D64",
  34940. "\u2F9B",
  34941. "\u8D70",
  34942. "\u2F9C",
  34943. "\u8DB3",
  34944. "\u2F9D",
  34945. "\u8EAB",
  34946. "\u2F9E",
  34947. "\u8ECA",
  34948. "\u2F9F",
  34949. "\u8F9B",
  34950. "\u2FA0",
  34951. "\u8FB0",
  34952. "\u2FA1",
  34953. "\u8FB5",
  34954. "\u2FA2",
  34955. "\u9091",
  34956. "\u2FA3",
  34957. "\u9149",
  34958. "\u2FA4",
  34959. "\u91C6",
  34960. "\u2FA5",
  34961. "\u91CC",
  34962. "\u2FA6",
  34963. "\u91D1",
  34964. "\u2FA7",
  34965. "\u9577",
  34966. "\u2FA8",
  34967. "\u9580",
  34968. "\u2FA9",
  34969. "\u961C",
  34970. "\u2FAA",
  34971. "\u96B6",
  34972. "\u2FAB",
  34973. "\u96B9",
  34974. "\u2FAC",
  34975. "\u96E8",
  34976. "\u2FAD",
  34977. "\u9751",
  34978. "\u2FAE",
  34979. "\u975E",
  34980. "\u2FAF",
  34981. "\u9762",
  34982. "\u2FB0",
  34983. "\u9769",
  34984. "\u2FB1",
  34985. "\u97CB",
  34986. "\u2FB2",
  34987. "\u97ED",
  34988. "\u2FB3",
  34989. "\u97F3",
  34990. "\u2FB4",
  34991. "\u9801",
  34992. "\u2FB5",
  34993. "\u98A8",
  34994. "\u2FB6",
  34995. "\u98DB",
  34996. "\u2FB7",
  34997. "\u98DF",
  34998. "\u2FB8",
  34999. "\u9996",
  35000. "\u2FB9",
  35001. "\u9999",
  35002. "\u2FBA",
  35003. "\u99AC",
  35004. "\u2FBB",
  35005. "\u9AA8",
  35006. "\u2FBC",
  35007. "\u9AD8",
  35008. "\u2FBD",
  35009. "\u9ADF",
  35010. "\u2FBE",
  35011. "\u9B25",
  35012. "\u2FBF",
  35013. "\u9B2F",
  35014. "\u2FC0",
  35015. "\u9B32",
  35016. "\u2FC1",
  35017. "\u9B3C",
  35018. "\u2FC2",
  35019. "\u9B5A",
  35020. "\u2FC3",
  35021. "\u9CE5",
  35022. "\u2FC4",
  35023. "\u9E75",
  35024. "\u2FC5",
  35025. "\u9E7F",
  35026. "\u2FC6",
  35027. "\u9EA5",
  35028. "\u2FC7",
  35029. "\u9EBB",
  35030. "\u2FC8",
  35031. "\u9EC3",
  35032. "\u2FC9",
  35033. "\u9ECD",
  35034. "\u2FCA",
  35035. "\u9ED1",
  35036. "\u2FCB",
  35037. "\u9EF9",
  35038. "\u2FCC",
  35039. "\u9EFD",
  35040. "\u2FCD",
  35041. "\u9F0E",
  35042. "\u2FCE",
  35043. "\u9F13",
  35044. "\u2FCF",
  35045. "\u9F20",
  35046. "\u2FD0",
  35047. "\u9F3B",
  35048. "\u2FD1",
  35049. "\u9F4A",
  35050. "\u2FD2",
  35051. "\u9F52",
  35052. "\u2FD3",
  35053. "\u9F8D",
  35054. "\u2FD4",
  35055. "\u9F9C",
  35056. "\u2FD5",
  35057. "\u9FA0",
  35058. "\u3036",
  35059. "\u3012",
  35060. "\u3038",
  35061. "\u5341",
  35062. "\u3039",
  35063. "\u5344",
  35064. "\u303A",
  35065. "\u5345",
  35066. "\u309B",
  35067. "\u0020\u3099",
  35068. "\u309C",
  35069. "\u0020\u309A",
  35070. "\u3131",
  35071. "\u1100",
  35072. "\u3132",
  35073. "\u1101",
  35074. "\u3133",
  35075. "\u11AA",
  35076. "\u3134",
  35077. "\u1102",
  35078. "\u3135",
  35079. "\u11AC",
  35080. "\u3136",
  35081. "\u11AD",
  35082. "\u3137",
  35083. "\u1103",
  35084. "\u3138",
  35085. "\u1104",
  35086. "\u3139",
  35087. "\u1105",
  35088. "\u313A",
  35089. "\u11B0",
  35090. "\u313B",
  35091. "\u11B1",
  35092. "\u313C",
  35093. "\u11B2",
  35094. "\u313D",
  35095. "\u11B3",
  35096. "\u313E",
  35097. "\u11B4",
  35098. "\u313F",
  35099. "\u11B5",
  35100. "\u3140",
  35101. "\u111A",
  35102. "\u3141",
  35103. "\u1106",
  35104. "\u3142",
  35105. "\u1107",
  35106. "\u3143",
  35107. "\u1108",
  35108. "\u3144",
  35109. "\u1121",
  35110. "\u3145",
  35111. "\u1109",
  35112. "\u3146",
  35113. "\u110A",
  35114. "\u3147",
  35115. "\u110B",
  35116. "\u3148",
  35117. "\u110C",
  35118. "\u3149",
  35119. "\u110D",
  35120. "\u314A",
  35121. "\u110E",
  35122. "\u314B",
  35123. "\u110F",
  35124. "\u314C",
  35125. "\u1110",
  35126. "\u314D",
  35127. "\u1111",
  35128. "\u314E",
  35129. "\u1112",
  35130. "\u314F",
  35131. "\u1161",
  35132. "\u3150",
  35133. "\u1162",
  35134. "\u3151",
  35135. "\u1163",
  35136. "\u3152",
  35137. "\u1164",
  35138. "\u3153",
  35139. "\u1165",
  35140. "\u3154",
  35141. "\u1166",
  35142. "\u3155",
  35143. "\u1167",
  35144. "\u3156",
  35145. "\u1168",
  35146. "\u3157",
  35147. "\u1169",
  35148. "\u3158",
  35149. "\u116A",
  35150. "\u3159",
  35151. "\u116B",
  35152. "\u315A",
  35153. "\u116C",
  35154. "\u315B",
  35155. "\u116D",
  35156. "\u315C",
  35157. "\u116E",
  35158. "\u315D",
  35159. "\u116F",
  35160. "\u315E",
  35161. "\u1170",
  35162. "\u315F",
  35163. "\u1171",
  35164. "\u3160",
  35165. "\u1172",
  35166. "\u3161",
  35167. "\u1173",
  35168. "\u3162",
  35169. "\u1174",
  35170. "\u3163",
  35171. "\u1175",
  35172. "\u3164",
  35173. "\u1160",
  35174. "\u3165",
  35175. "\u1114",
  35176. "\u3166",
  35177. "\u1115",
  35178. "\u3167",
  35179. "\u11C7",
  35180. "\u3168",
  35181. "\u11C8",
  35182. "\u3169",
  35183. "\u11CC",
  35184. "\u316A",
  35185. "\u11CE",
  35186. "\u316B",
  35187. "\u11D3",
  35188. "\u316C",
  35189. "\u11D7",
  35190. "\u316D",
  35191. "\u11D9",
  35192. "\u316E",
  35193. "\u111C",
  35194. "\u316F",
  35195. "\u11DD",
  35196. "\u3170",
  35197. "\u11DF",
  35198. "\u3171",
  35199. "\u111D",
  35200. "\u3172",
  35201. "\u111E",
  35202. "\u3173",
  35203. "\u1120",
  35204. "\u3174",
  35205. "\u1122",
  35206. "\u3175",
  35207. "\u1123",
  35208. "\u3176",
  35209. "\u1127",
  35210. "\u3177",
  35211. "\u1129",
  35212. "\u3178",
  35213. "\u112B",
  35214. "\u3179",
  35215. "\u112C",
  35216. "\u317A",
  35217. "\u112D",
  35218. "\u317B",
  35219. "\u112E",
  35220. "\u317C",
  35221. "\u112F",
  35222. "\u317D",
  35223. "\u1132",
  35224. "\u317E",
  35225. "\u1136",
  35226. "\u317F",
  35227. "\u1140",
  35228. "\u3180",
  35229. "\u1147",
  35230. "\u3181",
  35231. "\u114C",
  35232. "\u3182",
  35233. "\u11F1",
  35234. "\u3183",
  35235. "\u11F2",
  35236. "\u3184",
  35237. "\u1157",
  35238. "\u3185",
  35239. "\u1158",
  35240. "\u3186",
  35241. "\u1159",
  35242. "\u3187",
  35243. "\u1184",
  35244. "\u3188",
  35245. "\u1185",
  35246. "\u3189",
  35247. "\u1188",
  35248. "\u318A",
  35249. "\u1191",
  35250. "\u318B",
  35251. "\u1192",
  35252. "\u318C",
  35253. "\u1194",
  35254. "\u318D",
  35255. "\u119E",
  35256. "\u318E",
  35257. "\u11A1",
  35258. "\u3200",
  35259. "\u0028\u1100\u0029",
  35260. "\u3201",
  35261. "\u0028\u1102\u0029",
  35262. "\u3202",
  35263. "\u0028\u1103\u0029",
  35264. "\u3203",
  35265. "\u0028\u1105\u0029",
  35266. "\u3204",
  35267. "\u0028\u1106\u0029",
  35268. "\u3205",
  35269. "\u0028\u1107\u0029",
  35270. "\u3206",
  35271. "\u0028\u1109\u0029",
  35272. "\u3207",
  35273. "\u0028\u110B\u0029",
  35274. "\u3208",
  35275. "\u0028\u110C\u0029",
  35276. "\u3209",
  35277. "\u0028\u110E\u0029",
  35278. "\u320A",
  35279. "\u0028\u110F\u0029",
  35280. "\u320B",
  35281. "\u0028\u1110\u0029",
  35282. "\u320C",
  35283. "\u0028\u1111\u0029",
  35284. "\u320D",
  35285. "\u0028\u1112\u0029",
  35286. "\u320E",
  35287. "\u0028\u1100\u1161\u0029",
  35288. "\u320F",
  35289. "\u0028\u1102\u1161\u0029",
  35290. "\u3210",
  35291. "\u0028\u1103\u1161\u0029",
  35292. "\u3211",
  35293. "\u0028\u1105\u1161\u0029",
  35294. "\u3212",
  35295. "\u0028\u1106\u1161\u0029",
  35296. "\u3213",
  35297. "\u0028\u1107\u1161\u0029",
  35298. "\u3214",
  35299. "\u0028\u1109\u1161\u0029",
  35300. "\u3215",
  35301. "\u0028\u110B\u1161\u0029",
  35302. "\u3216",
  35303. "\u0028\u110C\u1161\u0029",
  35304. "\u3217",
  35305. "\u0028\u110E\u1161\u0029",
  35306. "\u3218",
  35307. "\u0028\u110F\u1161\u0029",
  35308. "\u3219",
  35309. "\u0028\u1110\u1161\u0029",
  35310. "\u321A",
  35311. "\u0028\u1111\u1161\u0029",
  35312. "\u321B",
  35313. "\u0028\u1112\u1161\u0029",
  35314. "\u321C",
  35315. "\u0028\u110C\u116E\u0029",
  35316. "\u321D",
  35317. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  35318. "\u321E",
  35319. "\u0028\u110B\u1169\u1112\u116E\u0029",
  35320. "\u3220",
  35321. "\u0028\u4E00\u0029",
  35322. "\u3221",
  35323. "\u0028\u4E8C\u0029",
  35324. "\u3222",
  35325. "\u0028\u4E09\u0029",
  35326. "\u3223",
  35327. "\u0028\u56DB\u0029",
  35328. "\u3224",
  35329. "\u0028\u4E94\u0029",
  35330. "\u3225",
  35331. "\u0028\u516D\u0029",
  35332. "\u3226",
  35333. "\u0028\u4E03\u0029",
  35334. "\u3227",
  35335. "\u0028\u516B\u0029",
  35336. "\u3228",
  35337. "\u0028\u4E5D\u0029",
  35338. "\u3229",
  35339. "\u0028\u5341\u0029",
  35340. "\u322A",
  35341. "\u0028\u6708\u0029",
  35342. "\u322B",
  35343. "\u0028\u706B\u0029",
  35344. "\u322C",
  35345. "\u0028\u6C34\u0029",
  35346. "\u322D",
  35347. "\u0028\u6728\u0029",
  35348. "\u322E",
  35349. "\u0028\u91D1\u0029",
  35350. "\u322F",
  35351. "\u0028\u571F\u0029",
  35352. "\u3230",
  35353. "\u0028\u65E5\u0029",
  35354. "\u3231",
  35355. "\u0028\u682A\u0029",
  35356. "\u3232",
  35357. "\u0028\u6709\u0029",
  35358. "\u3233",
  35359. "\u0028\u793E\u0029",
  35360. "\u3234",
  35361. "\u0028\u540D\u0029",
  35362. "\u3235",
  35363. "\u0028\u7279\u0029",
  35364. "\u3236",
  35365. "\u0028\u8CA1\u0029",
  35366. "\u3237",
  35367. "\u0028\u795D\u0029",
  35368. "\u3238",
  35369. "\u0028\u52B4\u0029",
  35370. "\u3239",
  35371. "\u0028\u4EE3\u0029",
  35372. "\u323A",
  35373. "\u0028\u547C\u0029",
  35374. "\u323B",
  35375. "\u0028\u5B66\u0029",
  35376. "\u323C",
  35377. "\u0028\u76E3\u0029",
  35378. "\u323D",
  35379. "\u0028\u4F01\u0029",
  35380. "\u323E",
  35381. "\u0028\u8CC7\u0029",
  35382. "\u323F",
  35383. "\u0028\u5354\u0029",
  35384. "\u3240",
  35385. "\u0028\u796D\u0029",
  35386. "\u3241",
  35387. "\u0028\u4F11\u0029",
  35388. "\u3242",
  35389. "\u0028\u81EA\u0029",
  35390. "\u3243",
  35391. "\u0028\u81F3\u0029",
  35392. "\u32C0",
  35393. "\u0031\u6708",
  35394. "\u32C1",
  35395. "\u0032\u6708",
  35396. "\u32C2",
  35397. "\u0033\u6708",
  35398. "\u32C3",
  35399. "\u0034\u6708",
  35400. "\u32C4",
  35401. "\u0035\u6708",
  35402. "\u32C5",
  35403. "\u0036\u6708",
  35404. "\u32C6",
  35405. "\u0037\u6708",
  35406. "\u32C7",
  35407. "\u0038\u6708",
  35408. "\u32C8",
  35409. "\u0039\u6708",
  35410. "\u32C9",
  35411. "\u0031\u0030\u6708",
  35412. "\u32CA",
  35413. "\u0031\u0031\u6708",
  35414. "\u32CB",
  35415. "\u0031\u0032\u6708",
  35416. "\u3358",
  35417. "\u0030\u70B9",
  35418. "\u3359",
  35419. "\u0031\u70B9",
  35420. "\u335A",
  35421. "\u0032\u70B9",
  35422. "\u335B",
  35423. "\u0033\u70B9",
  35424. "\u335C",
  35425. "\u0034\u70B9",
  35426. "\u335D",
  35427. "\u0035\u70B9",
  35428. "\u335E",
  35429. "\u0036\u70B9",
  35430. "\u335F",
  35431. "\u0037\u70B9",
  35432. "\u3360",
  35433. "\u0038\u70B9",
  35434. "\u3361",
  35435. "\u0039\u70B9",
  35436. "\u3362",
  35437. "\u0031\u0030\u70B9",
  35438. "\u3363",
  35439. "\u0031\u0031\u70B9",
  35440. "\u3364",
  35441. "\u0031\u0032\u70B9",
  35442. "\u3365",
  35443. "\u0031\u0033\u70B9",
  35444. "\u3366",
  35445. "\u0031\u0034\u70B9",
  35446. "\u3367",
  35447. "\u0031\u0035\u70B9",
  35448. "\u3368",
  35449. "\u0031\u0036\u70B9",
  35450. "\u3369",
  35451. "\u0031\u0037\u70B9",
  35452. "\u336A",
  35453. "\u0031\u0038\u70B9",
  35454. "\u336B",
  35455. "\u0031\u0039\u70B9",
  35456. "\u336C",
  35457. "\u0032\u0030\u70B9",
  35458. "\u336D",
  35459. "\u0032\u0031\u70B9",
  35460. "\u336E",
  35461. "\u0032\u0032\u70B9",
  35462. "\u336F",
  35463. "\u0032\u0033\u70B9",
  35464. "\u3370",
  35465. "\u0032\u0034\u70B9",
  35466. "\u33E0",
  35467. "\u0031\u65E5",
  35468. "\u33E1",
  35469. "\u0032\u65E5",
  35470. "\u33E2",
  35471. "\u0033\u65E5",
  35472. "\u33E3",
  35473. "\u0034\u65E5",
  35474. "\u33E4",
  35475. "\u0035\u65E5",
  35476. "\u33E5",
  35477. "\u0036\u65E5",
  35478. "\u33E6",
  35479. "\u0037\u65E5",
  35480. "\u33E7",
  35481. "\u0038\u65E5",
  35482. "\u33E8",
  35483. "\u0039\u65E5",
  35484. "\u33E9",
  35485. "\u0031\u0030\u65E5",
  35486. "\u33EA",
  35487. "\u0031\u0031\u65E5",
  35488. "\u33EB",
  35489. "\u0031\u0032\u65E5",
  35490. "\u33EC",
  35491. "\u0031\u0033\u65E5",
  35492. "\u33ED",
  35493. "\u0031\u0034\u65E5",
  35494. "\u33EE",
  35495. "\u0031\u0035\u65E5",
  35496. "\u33EF",
  35497. "\u0031\u0036\u65E5",
  35498. "\u33F0",
  35499. "\u0031\u0037\u65E5",
  35500. "\u33F1",
  35501. "\u0031\u0038\u65E5",
  35502. "\u33F2",
  35503. "\u0031\u0039\u65E5",
  35504. "\u33F3",
  35505. "\u0032\u0030\u65E5",
  35506. "\u33F4",
  35507. "\u0032\u0031\u65E5",
  35508. "\u33F5",
  35509. "\u0032\u0032\u65E5",
  35510. "\u33F6",
  35511. "\u0032\u0033\u65E5",
  35512. "\u33F7",
  35513. "\u0032\u0034\u65E5",
  35514. "\u33F8",
  35515. "\u0032\u0035\u65E5",
  35516. "\u33F9",
  35517. "\u0032\u0036\u65E5",
  35518. "\u33FA",
  35519. "\u0032\u0037\u65E5",
  35520. "\u33FB",
  35521. "\u0032\u0038\u65E5",
  35522. "\u33FC",
  35523. "\u0032\u0039\u65E5",
  35524. "\u33FD",
  35525. "\u0033\u0030\u65E5",
  35526. "\u33FE",
  35527. "\u0033\u0031\u65E5",
  35528. "\uFB00",
  35529. "\u0066\u0066",
  35530. "\uFB01",
  35531. "\u0066\u0069",
  35532. "\uFB02",
  35533. "\u0066\u006C",
  35534. "\uFB03",
  35535. "\u0066\u0066\u0069",
  35536. "\uFB04",
  35537. "\u0066\u0066\u006C",
  35538. "\uFB05",
  35539. "\u017F\u0074",
  35540. "\uFB06",
  35541. "\u0073\u0074",
  35542. "\uFB13",
  35543. "\u0574\u0576",
  35544. "\uFB14",
  35545. "\u0574\u0565",
  35546. "\uFB15",
  35547. "\u0574\u056B",
  35548. "\uFB16",
  35549. "\u057E\u0576",
  35550. "\uFB17",
  35551. "\u0574\u056D",
  35552. "\uFB4F",
  35553. "\u05D0\u05DC",
  35554. "\uFB50",
  35555. "\u0671",
  35556. "\uFB51",
  35557. "\u0671",
  35558. "\uFB52",
  35559. "\u067B",
  35560. "\uFB53",
  35561. "\u067B",
  35562. "\uFB54",
  35563. "\u067B",
  35564. "\uFB55",
  35565. "\u067B",
  35566. "\uFB56",
  35567. "\u067E",
  35568. "\uFB57",
  35569. "\u067E",
  35570. "\uFB58",
  35571. "\u067E",
  35572. "\uFB59",
  35573. "\u067E",
  35574. "\uFB5A",
  35575. "\u0680",
  35576. "\uFB5B",
  35577. "\u0680",
  35578. "\uFB5C",
  35579. "\u0680",
  35580. "\uFB5D",
  35581. "\u0680",
  35582. "\uFB5E",
  35583. "\u067A",
  35584. "\uFB5F",
  35585. "\u067A",
  35586. "\uFB60",
  35587. "\u067A",
  35588. "\uFB61",
  35589. "\u067A",
  35590. "\uFB62",
  35591. "\u067F",
  35592. "\uFB63",
  35593. "\u067F",
  35594. "\uFB64",
  35595. "\u067F",
  35596. "\uFB65",
  35597. "\u067F",
  35598. "\uFB66",
  35599. "\u0679",
  35600. "\uFB67",
  35601. "\u0679",
  35602. "\uFB68",
  35603. "\u0679",
  35604. "\uFB69",
  35605. "\u0679",
  35606. "\uFB6A",
  35607. "\u06A4",
  35608. "\uFB6B",
  35609. "\u06A4",
  35610. "\uFB6C",
  35611. "\u06A4",
  35612. "\uFB6D",
  35613. "\u06A4",
  35614. "\uFB6E",
  35615. "\u06A6",
  35616. "\uFB6F",
  35617. "\u06A6",
  35618. "\uFB70",
  35619. "\u06A6",
  35620. "\uFB71",
  35621. "\u06A6",
  35622. "\uFB72",
  35623. "\u0684",
  35624. "\uFB73",
  35625. "\u0684",
  35626. "\uFB74",
  35627. "\u0684",
  35628. "\uFB75",
  35629. "\u0684",
  35630. "\uFB76",
  35631. "\u0683",
  35632. "\uFB77",
  35633. "\u0683",
  35634. "\uFB78",
  35635. "\u0683",
  35636. "\uFB79",
  35637. "\u0683",
  35638. "\uFB7A",
  35639. "\u0686",
  35640. "\uFB7B",
  35641. "\u0686",
  35642. "\uFB7C",
  35643. "\u0686",
  35644. "\uFB7D",
  35645. "\u0686",
  35646. "\uFB7E",
  35647. "\u0687",
  35648. "\uFB7F",
  35649. "\u0687",
  35650. "\uFB80",
  35651. "\u0687",
  35652. "\uFB81",
  35653. "\u0687",
  35654. "\uFB82",
  35655. "\u068D",
  35656. "\uFB83",
  35657. "\u068D",
  35658. "\uFB84",
  35659. "\u068C",
  35660. "\uFB85",
  35661. "\u068C",
  35662. "\uFB86",
  35663. "\u068E",
  35664. "\uFB87",
  35665. "\u068E",
  35666. "\uFB88",
  35667. "\u0688",
  35668. "\uFB89",
  35669. "\u0688",
  35670. "\uFB8A",
  35671. "\u0698",
  35672. "\uFB8B",
  35673. "\u0698",
  35674. "\uFB8C",
  35675. "\u0691",
  35676. "\uFB8D",
  35677. "\u0691",
  35678. "\uFB8E",
  35679. "\u06A9",
  35680. "\uFB8F",
  35681. "\u06A9",
  35682. "\uFB90",
  35683. "\u06A9",
  35684. "\uFB91",
  35685. "\u06A9",
  35686. "\uFB92",
  35687. "\u06AF",
  35688. "\uFB93",
  35689. "\u06AF",
  35690. "\uFB94",
  35691. "\u06AF",
  35692. "\uFB95",
  35693. "\u06AF",
  35694. "\uFB96",
  35695. "\u06B3",
  35696. "\uFB97",
  35697. "\u06B3",
  35698. "\uFB98",
  35699. "\u06B3",
  35700. "\uFB99",
  35701. "\u06B3",
  35702. "\uFB9A",
  35703. "\u06B1",
  35704. "\uFB9B",
  35705. "\u06B1",
  35706. "\uFB9C",
  35707. "\u06B1",
  35708. "\uFB9D",
  35709. "\u06B1",
  35710. "\uFB9E",
  35711. "\u06BA",
  35712. "\uFB9F",
  35713. "\u06BA",
  35714. "\uFBA0",
  35715. "\u06BB",
  35716. "\uFBA1",
  35717. "\u06BB",
  35718. "\uFBA2",
  35719. "\u06BB",
  35720. "\uFBA3",
  35721. "\u06BB",
  35722. "\uFBA4",
  35723. "\u06C0",
  35724. "\uFBA5",
  35725. "\u06C0",
  35726. "\uFBA6",
  35727. "\u06C1",
  35728. "\uFBA7",
  35729. "\u06C1",
  35730. "\uFBA8",
  35731. "\u06C1",
  35732. "\uFBA9",
  35733. "\u06C1",
  35734. "\uFBAA",
  35735. "\u06BE",
  35736. "\uFBAB",
  35737. "\u06BE",
  35738. "\uFBAC",
  35739. "\u06BE",
  35740. "\uFBAD",
  35741. "\u06BE",
  35742. "\uFBAE",
  35743. "\u06D2",
  35744. "\uFBAF",
  35745. "\u06D2",
  35746. "\uFBB0",
  35747. "\u06D3",
  35748. "\uFBB1",
  35749. "\u06D3",
  35750. "\uFBD3",
  35751. "\u06AD",
  35752. "\uFBD4",
  35753. "\u06AD",
  35754. "\uFBD5",
  35755. "\u06AD",
  35756. "\uFBD6",
  35757. "\u06AD",
  35758. "\uFBD7",
  35759. "\u06C7",
  35760. "\uFBD8",
  35761. "\u06C7",
  35762. "\uFBD9",
  35763. "\u06C6",
  35764. "\uFBDA",
  35765. "\u06C6",
  35766. "\uFBDB",
  35767. "\u06C8",
  35768. "\uFBDC",
  35769. "\u06C8",
  35770. "\uFBDD",
  35771. "\u0677",
  35772. "\uFBDE",
  35773. "\u06CB",
  35774. "\uFBDF",
  35775. "\u06CB",
  35776. "\uFBE0",
  35777. "\u06C5",
  35778. "\uFBE1",
  35779. "\u06C5",
  35780. "\uFBE2",
  35781. "\u06C9",
  35782. "\uFBE3",
  35783. "\u06C9",
  35784. "\uFBE4",
  35785. "\u06D0",
  35786. "\uFBE5",
  35787. "\u06D0",
  35788. "\uFBE6",
  35789. "\u06D0",
  35790. "\uFBE7",
  35791. "\u06D0",
  35792. "\uFBE8",
  35793. "\u0649",
  35794. "\uFBE9",
  35795. "\u0649",
  35796. "\uFBEA",
  35797. "\u0626\u0627",
  35798. "\uFBEB",
  35799. "\u0626\u0627",
  35800. "\uFBEC",
  35801. "\u0626\u06D5",
  35802. "\uFBED",
  35803. "\u0626\u06D5",
  35804. "\uFBEE",
  35805. "\u0626\u0648",
  35806. "\uFBEF",
  35807. "\u0626\u0648",
  35808. "\uFBF0",
  35809. "\u0626\u06C7",
  35810. "\uFBF1",
  35811. "\u0626\u06C7",
  35812. "\uFBF2",
  35813. "\u0626\u06C6",
  35814. "\uFBF3",
  35815. "\u0626\u06C6",
  35816. "\uFBF4",
  35817. "\u0626\u06C8",
  35818. "\uFBF5",
  35819. "\u0626\u06C8",
  35820. "\uFBF6",
  35821. "\u0626\u06D0",
  35822. "\uFBF7",
  35823. "\u0626\u06D0",
  35824. "\uFBF8",
  35825. "\u0626\u06D0",
  35826. "\uFBF9",
  35827. "\u0626\u0649",
  35828. "\uFBFA",
  35829. "\u0626\u0649",
  35830. "\uFBFB",
  35831. "\u0626\u0649",
  35832. "\uFBFC",
  35833. "\u06CC",
  35834. "\uFBFD",
  35835. "\u06CC",
  35836. "\uFBFE",
  35837. "\u06CC",
  35838. "\uFBFF",
  35839. "\u06CC",
  35840. "\uFC00",
  35841. "\u0626\u062C",
  35842. "\uFC01",
  35843. "\u0626\u062D",
  35844. "\uFC02",
  35845. "\u0626\u0645",
  35846. "\uFC03",
  35847. "\u0626\u0649",
  35848. "\uFC04",
  35849. "\u0626\u064A",
  35850. "\uFC05",
  35851. "\u0628\u062C",
  35852. "\uFC06",
  35853. "\u0628\u062D",
  35854. "\uFC07",
  35855. "\u0628\u062E",
  35856. "\uFC08",
  35857. "\u0628\u0645",
  35858. "\uFC09",
  35859. "\u0628\u0649",
  35860. "\uFC0A",
  35861. "\u0628\u064A",
  35862. "\uFC0B",
  35863. "\u062A\u062C",
  35864. "\uFC0C",
  35865. "\u062A\u062D",
  35866. "\uFC0D",
  35867. "\u062A\u062E",
  35868. "\uFC0E",
  35869. "\u062A\u0645",
  35870. "\uFC0F",
  35871. "\u062A\u0649",
  35872. "\uFC10",
  35873. "\u062A\u064A",
  35874. "\uFC11",
  35875. "\u062B\u062C",
  35876. "\uFC12",
  35877. "\u062B\u0645",
  35878. "\uFC13",
  35879. "\u062B\u0649",
  35880. "\uFC14",
  35881. "\u062B\u064A",
  35882. "\uFC15",
  35883. "\u062C\u062D",
  35884. "\uFC16",
  35885. "\u062C\u0645",
  35886. "\uFC17",
  35887. "\u062D\u062C",
  35888. "\uFC18",
  35889. "\u062D\u0645",
  35890. "\uFC19",
  35891. "\u062E\u062C",
  35892. "\uFC1A",
  35893. "\u062E\u062D",
  35894. "\uFC1B",
  35895. "\u062E\u0645",
  35896. "\uFC1C",
  35897. "\u0633\u062C",
  35898. "\uFC1D",
  35899. "\u0633\u062D",
  35900. "\uFC1E",
  35901. "\u0633\u062E",
  35902. "\uFC1F",
  35903. "\u0633\u0645",
  35904. "\uFC20",
  35905. "\u0635\u062D",
  35906. "\uFC21",
  35907. "\u0635\u0645",
  35908. "\uFC22",
  35909. "\u0636\u062C",
  35910. "\uFC23",
  35911. "\u0636\u062D",
  35912. "\uFC24",
  35913. "\u0636\u062E",
  35914. "\uFC25",
  35915. "\u0636\u0645",
  35916. "\uFC26",
  35917. "\u0637\u062D",
  35918. "\uFC27",
  35919. "\u0637\u0645",
  35920. "\uFC28",
  35921. "\u0638\u0645",
  35922. "\uFC29",
  35923. "\u0639\u062C",
  35924. "\uFC2A",
  35925. "\u0639\u0645",
  35926. "\uFC2B",
  35927. "\u063A\u062C",
  35928. "\uFC2C",
  35929. "\u063A\u0645",
  35930. "\uFC2D",
  35931. "\u0641\u062C",
  35932. "\uFC2E",
  35933. "\u0641\u062D",
  35934. "\uFC2F",
  35935. "\u0641\u062E",
  35936. "\uFC30",
  35937. "\u0641\u0645",
  35938. "\uFC31",
  35939. "\u0641\u0649",
  35940. "\uFC32",
  35941. "\u0641\u064A",
  35942. "\uFC33",
  35943. "\u0642\u062D",
  35944. "\uFC34",
  35945. "\u0642\u0645",
  35946. "\uFC35",
  35947. "\u0642\u0649",
  35948. "\uFC36",
  35949. "\u0642\u064A",
  35950. "\uFC37",
  35951. "\u0643\u0627",
  35952. "\uFC38",
  35953. "\u0643\u062C",
  35954. "\uFC39",
  35955. "\u0643\u062D",
  35956. "\uFC3A",
  35957. "\u0643\u062E",
  35958. "\uFC3B",
  35959. "\u0643\u0644",
  35960. "\uFC3C",
  35961. "\u0643\u0645",
  35962. "\uFC3D",
  35963. "\u0643\u0649",
  35964. "\uFC3E",
  35965. "\u0643\u064A",
  35966. "\uFC3F",
  35967. "\u0644\u062C",
  35968. "\uFC40",
  35969. "\u0644\u062D",
  35970. "\uFC41",
  35971. "\u0644\u062E",
  35972. "\uFC42",
  35973. "\u0644\u0645",
  35974. "\uFC43",
  35975. "\u0644\u0649",
  35976. "\uFC44",
  35977. "\u0644\u064A",
  35978. "\uFC45",
  35979. "\u0645\u062C",
  35980. "\uFC46",
  35981. "\u0645\u062D",
  35982. "\uFC47",
  35983. "\u0645\u062E",
  35984. "\uFC48",
  35985. "\u0645\u0645",
  35986. "\uFC49",
  35987. "\u0645\u0649",
  35988. "\uFC4A",
  35989. "\u0645\u064A",
  35990. "\uFC4B",
  35991. "\u0646\u062C",
  35992. "\uFC4C",
  35993. "\u0646\u062D",
  35994. "\uFC4D",
  35995. "\u0646\u062E",
  35996. "\uFC4E",
  35997. "\u0646\u0645",
  35998. "\uFC4F",
  35999. "\u0646\u0649",
  36000. "\uFC50",
  36001. "\u0646\u064A",
  36002. "\uFC51",
  36003. "\u0647\u062C",
  36004. "\uFC52",
  36005. "\u0647\u0645",
  36006. "\uFC53",
  36007. "\u0647\u0649",
  36008. "\uFC54",
  36009. "\u0647\u064A",
  36010. "\uFC55",
  36011. "\u064A\u062C",
  36012. "\uFC56",
  36013. "\u064A\u062D",
  36014. "\uFC57",
  36015. "\u064A\u062E",
  36016. "\uFC58",
  36017. "\u064A\u0645",
  36018. "\uFC59",
  36019. "\u064A\u0649",
  36020. "\uFC5A",
  36021. "\u064A\u064A",
  36022. "\uFC5B",
  36023. "\u0630\u0670",
  36024. "\uFC5C",
  36025. "\u0631\u0670",
  36026. "\uFC5D",
  36027. "\u0649\u0670",
  36028. "\uFC5E",
  36029. "\u0020\u064C\u0651",
  36030. "\uFC5F",
  36031. "\u0020\u064D\u0651",
  36032. "\uFC60",
  36033. "\u0020\u064E\u0651",
  36034. "\uFC61",
  36035. "\u0020\u064F\u0651",
  36036. "\uFC62",
  36037. "\u0020\u0650\u0651",
  36038. "\uFC63",
  36039. "\u0020\u0651\u0670",
  36040. "\uFC64",
  36041. "\u0626\u0631",
  36042. "\uFC65",
  36043. "\u0626\u0632",
  36044. "\uFC66",
  36045. "\u0626\u0645",
  36046. "\uFC67",
  36047. "\u0626\u0646",
  36048. "\uFC68",
  36049. "\u0626\u0649",
  36050. "\uFC69",
  36051. "\u0626\u064A",
  36052. "\uFC6A",
  36053. "\u0628\u0631",
  36054. "\uFC6B",
  36055. "\u0628\u0632",
  36056. "\uFC6C",
  36057. "\u0628\u0645",
  36058. "\uFC6D",
  36059. "\u0628\u0646",
  36060. "\uFC6E",
  36061. "\u0628\u0649",
  36062. "\uFC6F",
  36063. "\u0628\u064A",
  36064. "\uFC70",
  36065. "\u062A\u0631",
  36066. "\uFC71",
  36067. "\u062A\u0632",
  36068. "\uFC72",
  36069. "\u062A\u0645",
  36070. "\uFC73",
  36071. "\u062A\u0646",
  36072. "\uFC74",
  36073. "\u062A\u0649",
  36074. "\uFC75",
  36075. "\u062A\u064A",
  36076. "\uFC76",
  36077. "\u062B\u0631",
  36078. "\uFC77",
  36079. "\u062B\u0632",
  36080. "\uFC78",
  36081. "\u062B\u0645",
  36082. "\uFC79",
  36083. "\u062B\u0646",
  36084. "\uFC7A",
  36085. "\u062B\u0649",
  36086. "\uFC7B",
  36087. "\u062B\u064A",
  36088. "\uFC7C",
  36089. "\u0641\u0649",
  36090. "\uFC7D",
  36091. "\u0641\u064A",
  36092. "\uFC7E",
  36093. "\u0642\u0649",
  36094. "\uFC7F",
  36095. "\u0642\u064A",
  36096. "\uFC80",
  36097. "\u0643\u0627",
  36098. "\uFC81",
  36099. "\u0643\u0644",
  36100. "\uFC82",
  36101. "\u0643\u0645",
  36102. "\uFC83",
  36103. "\u0643\u0649",
  36104. "\uFC84",
  36105. "\u0643\u064A",
  36106. "\uFC85",
  36107. "\u0644\u0645",
  36108. "\uFC86",
  36109. "\u0644\u0649",
  36110. "\uFC87",
  36111. "\u0644\u064A",
  36112. "\uFC88",
  36113. "\u0645\u0627",
  36114. "\uFC89",
  36115. "\u0645\u0645",
  36116. "\uFC8A",
  36117. "\u0646\u0631",
  36118. "\uFC8B",
  36119. "\u0646\u0632",
  36120. "\uFC8C",
  36121. "\u0646\u0645",
  36122. "\uFC8D",
  36123. "\u0646\u0646",
  36124. "\uFC8E",
  36125. "\u0646\u0649",
  36126. "\uFC8F",
  36127. "\u0646\u064A",
  36128. "\uFC90",
  36129. "\u0649\u0670",
  36130. "\uFC91",
  36131. "\u064A\u0631",
  36132. "\uFC92",
  36133. "\u064A\u0632",
  36134. "\uFC93",
  36135. "\u064A\u0645",
  36136. "\uFC94",
  36137. "\u064A\u0646",
  36138. "\uFC95",
  36139. "\u064A\u0649",
  36140. "\uFC96",
  36141. "\u064A\u064A",
  36142. "\uFC97",
  36143. "\u0626\u062C",
  36144. "\uFC98",
  36145. "\u0626\u062D",
  36146. "\uFC99",
  36147. "\u0626\u062E",
  36148. "\uFC9A",
  36149. "\u0626\u0645",
  36150. "\uFC9B",
  36151. "\u0626\u0647",
  36152. "\uFC9C",
  36153. "\u0628\u062C",
  36154. "\uFC9D",
  36155. "\u0628\u062D",
  36156. "\uFC9E",
  36157. "\u0628\u062E",
  36158. "\uFC9F",
  36159. "\u0628\u0645",
  36160. "\uFCA0",
  36161. "\u0628\u0647",
  36162. "\uFCA1",
  36163. "\u062A\u062C",
  36164. "\uFCA2",
  36165. "\u062A\u062D",
  36166. "\uFCA3",
  36167. "\u062A\u062E",
  36168. "\uFCA4",
  36169. "\u062A\u0645",
  36170. "\uFCA5",
  36171. "\u062A\u0647",
  36172. "\uFCA6",
  36173. "\u062B\u0645",
  36174. "\uFCA7",
  36175. "\u062C\u062D",
  36176. "\uFCA8",
  36177. "\u062C\u0645",
  36178. "\uFCA9",
  36179. "\u062D\u062C",
  36180. "\uFCAA",
  36181. "\u062D\u0645",
  36182. "\uFCAB",
  36183. "\u062E\u062C",
  36184. "\uFCAC",
  36185. "\u062E\u0645",
  36186. "\uFCAD",
  36187. "\u0633\u062C",
  36188. "\uFCAE",
  36189. "\u0633\u062D",
  36190. "\uFCAF",
  36191. "\u0633\u062E",
  36192. "\uFCB0",
  36193. "\u0633\u0645",
  36194. "\uFCB1",
  36195. "\u0635\u062D",
  36196. "\uFCB2",
  36197. "\u0635\u062E",
  36198. "\uFCB3",
  36199. "\u0635\u0645",
  36200. "\uFCB4",
  36201. "\u0636\u062C",
  36202. "\uFCB5",
  36203. "\u0636\u062D",
  36204. "\uFCB6",
  36205. "\u0636\u062E",
  36206. "\uFCB7",
  36207. "\u0636\u0645",
  36208. "\uFCB8",
  36209. "\u0637\u062D",
  36210. "\uFCB9",
  36211. "\u0638\u0645",
  36212. "\uFCBA",
  36213. "\u0639\u062C",
  36214. "\uFCBB",
  36215. "\u0639\u0645",
  36216. "\uFCBC",
  36217. "\u063A\u062C",
  36218. "\uFCBD",
  36219. "\u063A\u0645",
  36220. "\uFCBE",
  36221. "\u0641\u062C",
  36222. "\uFCBF",
  36223. "\u0641\u062D",
  36224. "\uFCC0",
  36225. "\u0641\u062E",
  36226. "\uFCC1",
  36227. "\u0641\u0645",
  36228. "\uFCC2",
  36229. "\u0642\u062D",
  36230. "\uFCC3",
  36231. "\u0642\u0645",
  36232. "\uFCC4",
  36233. "\u0643\u062C",
  36234. "\uFCC5",
  36235. "\u0643\u062D",
  36236. "\uFCC6",
  36237. "\u0643\u062E",
  36238. "\uFCC7",
  36239. "\u0643\u0644",
  36240. "\uFCC8",
  36241. "\u0643\u0645",
  36242. "\uFCC9",
  36243. "\u0644\u062C",
  36244. "\uFCCA",
  36245. "\u0644\u062D",
  36246. "\uFCCB",
  36247. "\u0644\u062E",
  36248. "\uFCCC",
  36249. "\u0644\u0645",
  36250. "\uFCCD",
  36251. "\u0644\u0647",
  36252. "\uFCCE",
  36253. "\u0645\u062C",
  36254. "\uFCCF",
  36255. "\u0645\u062D",
  36256. "\uFCD0",
  36257. "\u0645\u062E",
  36258. "\uFCD1",
  36259. "\u0645\u0645",
  36260. "\uFCD2",
  36261. "\u0646\u062C",
  36262. "\uFCD3",
  36263. "\u0646\u062D",
  36264. "\uFCD4",
  36265. "\u0646\u062E",
  36266. "\uFCD5",
  36267. "\u0646\u0645",
  36268. "\uFCD6",
  36269. "\u0646\u0647",
  36270. "\uFCD7",
  36271. "\u0647\u062C",
  36272. "\uFCD8",
  36273. "\u0647\u0645",
  36274. "\uFCD9",
  36275. "\u0647\u0670",
  36276. "\uFCDA",
  36277. "\u064A\u062C",
  36278. "\uFCDB",
  36279. "\u064A\u062D",
  36280. "\uFCDC",
  36281. "\u064A\u062E",
  36282. "\uFCDD",
  36283. "\u064A\u0645",
  36284. "\uFCDE",
  36285. "\u064A\u0647",
  36286. "\uFCDF",
  36287. "\u0626\u0645",
  36288. "\uFCE0",
  36289. "\u0626\u0647",
  36290. "\uFCE1",
  36291. "\u0628\u0645",
  36292. "\uFCE2",
  36293. "\u0628\u0647",
  36294. "\uFCE3",
  36295. "\u062A\u0645",
  36296. "\uFCE4",
  36297. "\u062A\u0647",
  36298. "\uFCE5",
  36299. "\u062B\u0645",
  36300. "\uFCE6",
  36301. "\u062B\u0647",
  36302. "\uFCE7",
  36303. "\u0633\u0645",
  36304. "\uFCE8",
  36305. "\u0633\u0647",
  36306. "\uFCE9",
  36307. "\u0634\u0645",
  36308. "\uFCEA",
  36309. "\u0634\u0647",
  36310. "\uFCEB",
  36311. "\u0643\u0644",
  36312. "\uFCEC",
  36313. "\u0643\u0645",
  36314. "\uFCED",
  36315. "\u0644\u0645",
  36316. "\uFCEE",
  36317. "\u0646\u0645",
  36318. "\uFCEF",
  36319. "\u0646\u0647",
  36320. "\uFCF0",
  36321. "\u064A\u0645",
  36322. "\uFCF1",
  36323. "\u064A\u0647",
  36324. "\uFCF2",
  36325. "\u0640\u064E\u0651",
  36326. "\uFCF3",
  36327. "\u0640\u064F\u0651",
  36328. "\uFCF4",
  36329. "\u0640\u0650\u0651",
  36330. "\uFCF5",
  36331. "\u0637\u0649",
  36332. "\uFCF6",
  36333. "\u0637\u064A",
  36334. "\uFCF7",
  36335. "\u0639\u0649",
  36336. "\uFCF8",
  36337. "\u0639\u064A",
  36338. "\uFCF9",
  36339. "\u063A\u0649",
  36340. "\uFCFA",
  36341. "\u063A\u064A",
  36342. "\uFCFB",
  36343. "\u0633\u0649",
  36344. "\uFCFC",
  36345. "\u0633\u064A",
  36346. "\uFCFD",
  36347. "\u0634\u0649",
  36348. "\uFCFE",
  36349. "\u0634\u064A",
  36350. "\uFCFF",
  36351. "\u062D\u0649",
  36352. "\uFD00",
  36353. "\u062D\u064A",
  36354. "\uFD01",
  36355. "\u062C\u0649",
  36356. "\uFD02",
  36357. "\u062C\u064A",
  36358. "\uFD03",
  36359. "\u062E\u0649",
  36360. "\uFD04",
  36361. "\u062E\u064A",
  36362. "\uFD05",
  36363. "\u0635\u0649",
  36364. "\uFD06",
  36365. "\u0635\u064A",
  36366. "\uFD07",
  36367. "\u0636\u0649",
  36368. "\uFD08",
  36369. "\u0636\u064A",
  36370. "\uFD09",
  36371. "\u0634\u062C",
  36372. "\uFD0A",
  36373. "\u0634\u062D",
  36374. "\uFD0B",
  36375. "\u0634\u062E",
  36376. "\uFD0C",
  36377. "\u0634\u0645",
  36378. "\uFD0D",
  36379. "\u0634\u0631",
  36380. "\uFD0E",
  36381. "\u0633\u0631",
  36382. "\uFD0F",
  36383. "\u0635\u0631",
  36384. "\uFD10",
  36385. "\u0636\u0631",
  36386. "\uFD11",
  36387. "\u0637\u0649",
  36388. "\uFD12",
  36389. "\u0637\u064A",
  36390. "\uFD13",
  36391. "\u0639\u0649",
  36392. "\uFD14",
  36393. "\u0639\u064A",
  36394. "\uFD15",
  36395. "\u063A\u0649",
  36396. "\uFD16",
  36397. "\u063A\u064A",
  36398. "\uFD17",
  36399. "\u0633\u0649",
  36400. "\uFD18",
  36401. "\u0633\u064A",
  36402. "\uFD19",
  36403. "\u0634\u0649",
  36404. "\uFD1A",
  36405. "\u0634\u064A",
  36406. "\uFD1B",
  36407. "\u062D\u0649",
  36408. "\uFD1C",
  36409. "\u062D\u064A",
  36410. "\uFD1D",
  36411. "\u062C\u0649",
  36412. "\uFD1E",
  36413. "\u062C\u064A",
  36414. "\uFD1F",
  36415. "\u062E\u0649",
  36416. "\uFD20",
  36417. "\u062E\u064A",
  36418. "\uFD21",
  36419. "\u0635\u0649",
  36420. "\uFD22",
  36421. "\u0635\u064A",
  36422. "\uFD23",
  36423. "\u0636\u0649",
  36424. "\uFD24",
  36425. "\u0636\u064A",
  36426. "\uFD25",
  36427. "\u0634\u062C",
  36428. "\uFD26",
  36429. "\u0634\u062D",
  36430. "\uFD27",
  36431. "\u0634\u062E",
  36432. "\uFD28",
  36433. "\u0634\u0645",
  36434. "\uFD29",
  36435. "\u0634\u0631",
  36436. "\uFD2A",
  36437. "\u0633\u0631",
  36438. "\uFD2B",
  36439. "\u0635\u0631",
  36440. "\uFD2C",
  36441. "\u0636\u0631",
  36442. "\uFD2D",
  36443. "\u0634\u062C",
  36444. "\uFD2E",
  36445. "\u0634\u062D",
  36446. "\uFD2F",
  36447. "\u0634\u062E",
  36448. "\uFD30",
  36449. "\u0634\u0645",
  36450. "\uFD31",
  36451. "\u0633\u0647",
  36452. "\uFD32",
  36453. "\u0634\u0647",
  36454. "\uFD33",
  36455. "\u0637\u0645",
  36456. "\uFD34",
  36457. "\u0633\u062C",
  36458. "\uFD35",
  36459. "\u0633\u062D",
  36460. "\uFD36",
  36461. "\u0633\u062E",
  36462. "\uFD37",
  36463. "\u0634\u062C",
  36464. "\uFD38",
  36465. "\u0634\u062D",
  36466. "\uFD39",
  36467. "\u0634\u062E",
  36468. "\uFD3A",
  36469. "\u0637\u0645",
  36470. "\uFD3B",
  36471. "\u0638\u0645",
  36472. "\uFD3C",
  36473. "\u0627\u064B",
  36474. "\uFD3D",
  36475. "\u0627\u064B",
  36476. "\uFD50",
  36477. "\u062A\u062C\u0645",
  36478. "\uFD51",
  36479. "\u062A\u062D\u062C",
  36480. "\uFD52",
  36481. "\u062A\u062D\u062C",
  36482. "\uFD53",
  36483. "\u062A\u062D\u0645",
  36484. "\uFD54",
  36485. "\u062A\u062E\u0645",
  36486. "\uFD55",
  36487. "\u062A\u0645\u062C",
  36488. "\uFD56",
  36489. "\u062A\u0645\u062D",
  36490. "\uFD57",
  36491. "\u062A\u0645\u062E",
  36492. "\uFD58",
  36493. "\u062C\u0645\u062D",
  36494. "\uFD59",
  36495. "\u062C\u0645\u062D",
  36496. "\uFD5A",
  36497. "\u062D\u0645\u064A",
  36498. "\uFD5B",
  36499. "\u062D\u0645\u0649",
  36500. "\uFD5C",
  36501. "\u0633\u062D\u062C",
  36502. "\uFD5D",
  36503. "\u0633\u062C\u062D",
  36504. "\uFD5E",
  36505. "\u0633\u062C\u0649",
  36506. "\uFD5F",
  36507. "\u0633\u0645\u062D",
  36508. "\uFD60",
  36509. "\u0633\u0645\u062D",
  36510. "\uFD61",
  36511. "\u0633\u0645\u062C",
  36512. "\uFD62",
  36513. "\u0633\u0645\u0645",
  36514. "\uFD63",
  36515. "\u0633\u0645\u0645",
  36516. "\uFD64",
  36517. "\u0635\u062D\u062D",
  36518. "\uFD65",
  36519. "\u0635\u062D\u062D",
  36520. "\uFD66",
  36521. "\u0635\u0645\u0645",
  36522. "\uFD67",
  36523. "\u0634\u062D\u0645",
  36524. "\uFD68",
  36525. "\u0634\u062D\u0645",
  36526. "\uFD69",
  36527. "\u0634\u062C\u064A",
  36528. "\uFD6A",
  36529. "\u0634\u0645\u062E",
  36530. "\uFD6B",
  36531. "\u0634\u0645\u062E",
  36532. "\uFD6C",
  36533. "\u0634\u0645\u0645",
  36534. "\uFD6D",
  36535. "\u0634\u0645\u0645",
  36536. "\uFD6E",
  36537. "\u0636\u062D\u0649",
  36538. "\uFD6F",
  36539. "\u0636\u062E\u0645",
  36540. "\uFD70",
  36541. "\u0636\u062E\u0645",
  36542. "\uFD71",
  36543. "\u0637\u0645\u062D",
  36544. "\uFD72",
  36545. "\u0637\u0645\u062D",
  36546. "\uFD73",
  36547. "\u0637\u0645\u0645",
  36548. "\uFD74",
  36549. "\u0637\u0645\u064A",
  36550. "\uFD75",
  36551. "\u0639\u062C\u0645",
  36552. "\uFD76",
  36553. "\u0639\u0645\u0645",
  36554. "\uFD77",
  36555. "\u0639\u0645\u0645",
  36556. "\uFD78",
  36557. "\u0639\u0645\u0649",
  36558. "\uFD79",
  36559. "\u063A\u0645\u0645",
  36560. "\uFD7A",
  36561. "\u063A\u0645\u064A",
  36562. "\uFD7B",
  36563. "\u063A\u0645\u0649",
  36564. "\uFD7C",
  36565. "\u0641\u062E\u0645",
  36566. "\uFD7D",
  36567. "\u0641\u062E\u0645",
  36568. "\uFD7E",
  36569. "\u0642\u0645\u062D",
  36570. "\uFD7F",
  36571. "\u0642\u0645\u0645",
  36572. "\uFD80",
  36573. "\u0644\u062D\u0645",
  36574. "\uFD81",
  36575. "\u0644\u062D\u064A",
  36576. "\uFD82",
  36577. "\u0644\u062D\u0649",
  36578. "\uFD83",
  36579. "\u0644\u062C\u062C",
  36580. "\uFD84",
  36581. "\u0644\u062C\u062C",
  36582. "\uFD85",
  36583. "\u0644\u062E\u0645",
  36584. "\uFD86",
  36585. "\u0644\u062E\u0645",
  36586. "\uFD87",
  36587. "\u0644\u0645\u062D",
  36588. "\uFD88",
  36589. "\u0644\u0645\u062D",
  36590. "\uFD89",
  36591. "\u0645\u062D\u062C",
  36592. "\uFD8A",
  36593. "\u0645\u062D\u0645",
  36594. "\uFD8B",
  36595. "\u0645\u062D\u064A",
  36596. "\uFD8C",
  36597. "\u0645\u062C\u062D",
  36598. "\uFD8D",
  36599. "\u0645\u062C\u0645",
  36600. "\uFD8E",
  36601. "\u0645\u062E\u062C",
  36602. "\uFD8F",
  36603. "\u0645\u062E\u0645",
  36604. "\uFD92",
  36605. "\u0645\u062C\u062E",
  36606. "\uFD93",
  36607. "\u0647\u0645\u062C",
  36608. "\uFD94",
  36609. "\u0647\u0645\u0645",
  36610. "\uFD95",
  36611. "\u0646\u062D\u0645",
  36612. "\uFD96",
  36613. "\u0646\u062D\u0649",
  36614. "\uFD97",
  36615. "\u0646\u062C\u0645",
  36616. "\uFD98",
  36617. "\u0646\u062C\u0645",
  36618. "\uFD99",
  36619. "\u0646\u062C\u0649",
  36620. "\uFD9A",
  36621. "\u0646\u0645\u064A",
  36622. "\uFD9B",
  36623. "\u0646\u0645\u0649",
  36624. "\uFD9C",
  36625. "\u064A\u0645\u0645",
  36626. "\uFD9D",
  36627. "\u064A\u0645\u0645",
  36628. "\uFD9E",
  36629. "\u0628\u062E\u064A",
  36630. "\uFD9F",
  36631. "\u062A\u062C\u064A",
  36632. "\uFDA0",
  36633. "\u062A\u062C\u0649",
  36634. "\uFDA1",
  36635. "\u062A\u062E\u064A",
  36636. "\uFDA2",
  36637. "\u062A\u062E\u0649",
  36638. "\uFDA3",
  36639. "\u062A\u0645\u064A",
  36640. "\uFDA4",
  36641. "\u062A\u0645\u0649",
  36642. "\uFDA5",
  36643. "\u062C\u0645\u064A",
  36644. "\uFDA6",
  36645. "\u062C\u062D\u0649",
  36646. "\uFDA7",
  36647. "\u062C\u0645\u0649",
  36648. "\uFDA8",
  36649. "\u0633\u062E\u0649",
  36650. "\uFDA9",
  36651. "\u0635\u062D\u064A",
  36652. "\uFDAA",
  36653. "\u0634\u062D\u064A",
  36654. "\uFDAB",
  36655. "\u0636\u062D\u064A",
  36656. "\uFDAC",
  36657. "\u0644\u062C\u064A",
  36658. "\uFDAD",
  36659. "\u0644\u0645\u064A",
  36660. "\uFDAE",
  36661. "\u064A\u062D\u064A",
  36662. "\uFDAF",
  36663. "\u064A\u062C\u064A",
  36664. "\uFDB0",
  36665. "\u064A\u0645\u064A",
  36666. "\uFDB1",
  36667. "\u0645\u0645\u064A",
  36668. "\uFDB2",
  36669. "\u0642\u0645\u064A",
  36670. "\uFDB3",
  36671. "\u0646\u062D\u064A",
  36672. "\uFDB4",
  36673. "\u0642\u0645\u062D",
  36674. "\uFDB5",
  36675. "\u0644\u062D\u0645",
  36676. "\uFDB6",
  36677. "\u0639\u0645\u064A",
  36678. "\uFDB7",
  36679. "\u0643\u0645\u064A",
  36680. "\uFDB8",
  36681. "\u0646\u062C\u062D",
  36682. "\uFDB9",
  36683. "\u0645\u062E\u064A",
  36684. "\uFDBA",
  36685. "\u0644\u062C\u0645",
  36686. "\uFDBB",
  36687. "\u0643\u0645\u0645",
  36688. "\uFDBC",
  36689. "\u0644\u062C\u0645",
  36690. "\uFDBD",
  36691. "\u0646\u062C\u062D",
  36692. "\uFDBE",
  36693. "\u062C\u062D\u064A",
  36694. "\uFDBF",
  36695. "\u062D\u062C\u064A",
  36696. "\uFDC0",
  36697. "\u0645\u062C\u064A",
  36698. "\uFDC1",
  36699. "\u0641\u0645\u064A",
  36700. "\uFDC2",
  36701. "\u0628\u062D\u064A",
  36702. "\uFDC3",
  36703. "\u0643\u0645\u0645",
  36704. "\uFDC4",
  36705. "\u0639\u062C\u0645",
  36706. "\uFDC5",
  36707. "\u0635\u0645\u0645",
  36708. "\uFDC6",
  36709. "\u0633\u062E\u064A",
  36710. "\uFDC7",
  36711. "\u0646\u062C\u064A",
  36712. "\uFE49",
  36713. "\u203E",
  36714. "\uFE4A",
  36715. "\u203E",
  36716. "\uFE4B",
  36717. "\u203E",
  36718. "\uFE4C",
  36719. "\u203E",
  36720. "\uFE4D",
  36721. "\u005F",
  36722. "\uFE4E",
  36723. "\u005F",
  36724. "\uFE4F",
  36725. "\u005F",
  36726. "\uFE80",
  36727. "\u0621",
  36728. "\uFE81",
  36729. "\u0622",
  36730. "\uFE82",
  36731. "\u0622",
  36732. "\uFE83",
  36733. "\u0623",
  36734. "\uFE84",
  36735. "\u0623",
  36736. "\uFE85",
  36737. "\u0624",
  36738. "\uFE86",
  36739. "\u0624",
  36740. "\uFE87",
  36741. "\u0625",
  36742. "\uFE88",
  36743. "\u0625",
  36744. "\uFE89",
  36745. "\u0626",
  36746. "\uFE8A",
  36747. "\u0626",
  36748. "\uFE8B",
  36749. "\u0626",
  36750. "\uFE8C",
  36751. "\u0626",
  36752. "\uFE8D",
  36753. "\u0627",
  36754. "\uFE8E",
  36755. "\u0627",
  36756. "\uFE8F",
  36757. "\u0628",
  36758. "\uFE90",
  36759. "\u0628",
  36760. "\uFE91",
  36761. "\u0628",
  36762. "\uFE92",
  36763. "\u0628",
  36764. "\uFE93",
  36765. "\u0629",
  36766. "\uFE94",
  36767. "\u0629",
  36768. "\uFE95",
  36769. "\u062A",
  36770. "\uFE96",
  36771. "\u062A",
  36772. "\uFE97",
  36773. "\u062A",
  36774. "\uFE98",
  36775. "\u062A",
  36776. "\uFE99",
  36777. "\u062B",
  36778. "\uFE9A",
  36779. "\u062B",
  36780. "\uFE9B",
  36781. "\u062B",
  36782. "\uFE9C",
  36783. "\u062B",
  36784. "\uFE9D",
  36785. "\u062C",
  36786. "\uFE9E",
  36787. "\u062C",
  36788. "\uFE9F",
  36789. "\u062C",
  36790. "\uFEA0",
  36791. "\u062C",
  36792. "\uFEA1",
  36793. "\u062D",
  36794. "\uFEA2",
  36795. "\u062D",
  36796. "\uFEA3",
  36797. "\u062D",
  36798. "\uFEA4",
  36799. "\u062D",
  36800. "\uFEA5",
  36801. "\u062E",
  36802. "\uFEA6",
  36803. "\u062E",
  36804. "\uFEA7",
  36805. "\u062E",
  36806. "\uFEA8",
  36807. "\u062E",
  36808. "\uFEA9",
  36809. "\u062F",
  36810. "\uFEAA",
  36811. "\u062F",
  36812. "\uFEAB",
  36813. "\u0630",
  36814. "\uFEAC",
  36815. "\u0630",
  36816. "\uFEAD",
  36817. "\u0631",
  36818. "\uFEAE",
  36819. "\u0631",
  36820. "\uFEAF",
  36821. "\u0632",
  36822. "\uFEB0",
  36823. "\u0632",
  36824. "\uFEB1",
  36825. "\u0633",
  36826. "\uFEB2",
  36827. "\u0633",
  36828. "\uFEB3",
  36829. "\u0633",
  36830. "\uFEB4",
  36831. "\u0633",
  36832. "\uFEB5",
  36833. "\u0634",
  36834. "\uFEB6",
  36835. "\u0634",
  36836. "\uFEB7",
  36837. "\u0634",
  36838. "\uFEB8",
  36839. "\u0634",
  36840. "\uFEB9",
  36841. "\u0635",
  36842. "\uFEBA",
  36843. "\u0635",
  36844. "\uFEBB",
  36845. "\u0635",
  36846. "\uFEBC",
  36847. "\u0635",
  36848. "\uFEBD",
  36849. "\u0636",
  36850. "\uFEBE",
  36851. "\u0636",
  36852. "\uFEBF",
  36853. "\u0636",
  36854. "\uFEC0",
  36855. "\u0636",
  36856. "\uFEC1",
  36857. "\u0637",
  36858. "\uFEC2",
  36859. "\u0637",
  36860. "\uFEC3",
  36861. "\u0637",
  36862. "\uFEC4",
  36863. "\u0637",
  36864. "\uFEC5",
  36865. "\u0638",
  36866. "\uFEC6",
  36867. "\u0638",
  36868. "\uFEC7",
  36869. "\u0638",
  36870. "\uFEC8",
  36871. "\u0638",
  36872. "\uFEC9",
  36873. "\u0639",
  36874. "\uFECA",
  36875. "\u0639",
  36876. "\uFECB",
  36877. "\u0639",
  36878. "\uFECC",
  36879. "\u0639",
  36880. "\uFECD",
  36881. "\u063A",
  36882. "\uFECE",
  36883. "\u063A",
  36884. "\uFECF",
  36885. "\u063A",
  36886. "\uFED0",
  36887. "\u063A",
  36888. "\uFED1",
  36889. "\u0641",
  36890. "\uFED2",
  36891. "\u0641",
  36892. "\uFED3",
  36893. "\u0641",
  36894. "\uFED4",
  36895. "\u0641",
  36896. "\uFED5",
  36897. "\u0642",
  36898. "\uFED6",
  36899. "\u0642",
  36900. "\uFED7",
  36901. "\u0642",
  36902. "\uFED8",
  36903. "\u0642",
  36904. "\uFED9",
  36905. "\u0643",
  36906. "\uFEDA",
  36907. "\u0643",
  36908. "\uFEDB",
  36909. "\u0643",
  36910. "\uFEDC",
  36911. "\u0643",
  36912. "\uFEDD",
  36913. "\u0644",
  36914. "\uFEDE",
  36915. "\u0644",
  36916. "\uFEDF",
  36917. "\u0644",
  36918. "\uFEE0",
  36919. "\u0644",
  36920. "\uFEE1",
  36921. "\u0645",
  36922. "\uFEE2",
  36923. "\u0645",
  36924. "\uFEE3",
  36925. "\u0645",
  36926. "\uFEE4",
  36927. "\u0645",
  36928. "\uFEE5",
  36929. "\u0646",
  36930. "\uFEE6",
  36931. "\u0646",
  36932. "\uFEE7",
  36933. "\u0646",
  36934. "\uFEE8",
  36935. "\u0646",
  36936. "\uFEE9",
  36937. "\u0647",
  36938. "\uFEEA",
  36939. "\u0647",
  36940. "\uFEEB",
  36941. "\u0647",
  36942. "\uFEEC",
  36943. "\u0647",
  36944. "\uFEED",
  36945. "\u0648",
  36946. "\uFEEE",
  36947. "\u0648",
  36948. "\uFEEF",
  36949. "\u0649",
  36950. "\uFEF0",
  36951. "\u0649",
  36952. "\uFEF1",
  36953. "\u064A",
  36954. "\uFEF2",
  36955. "\u064A",
  36956. "\uFEF3",
  36957. "\u064A",
  36958. "\uFEF4",
  36959. "\u064A",
  36960. "\uFEF5",
  36961. "\u0644\u0622",
  36962. "\uFEF6",
  36963. "\u0644\u0622",
  36964. "\uFEF7",
  36965. "\u0644\u0623",
  36966. "\uFEF8",
  36967. "\u0644\u0623",
  36968. "\uFEF9",
  36969. "\u0644\u0625",
  36970. "\uFEFA",
  36971. "\u0644\u0625",
  36972. "\uFEFB",
  36973. "\u0644\u0627",
  36974. "\uFEFC",
  36975. "\u0644\u0627"
  36976. ];
  36977. });
  36978. function reverseIfRtl(chars) {
  36979. const charsLength = chars.length;
  36980. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  36981. return chars;
  36982. }
  36983. const buf = [];
  36984. for (let ii = charsLength - 1; ii >= 0; ii--) {
  36985. buf.push(chars[ii]);
  36986. }
  36987. return buf.join("");
  36988. }
  36989. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  36990. const CategoryCache = new Map();
  36991. function getCharUnicodeCategory(char) {
  36992. const cachedCategory = CategoryCache.get(char);
  36993. if (cachedCategory) {
  36994. return cachedCategory;
  36995. }
  36996. const groups = char.match(SpecialCharRegExp);
  36997. const category = {
  36998. isWhitespace: !!(groups && groups[1]),
  36999. isZeroWidthDiacritic: !!(groups && groups[2]),
  37000. isInvisibleFormatMark: !!(groups && groups[3])
  37001. };
  37002. CategoryCache.set(char, category);
  37003. return category;
  37004. }
  37005. function clearUnicodeCaches() {
  37006. CategoryCache.clear();
  37007. }
  37008. /***/ }),
  37009. /* 39 */
  37010. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37011. Object.defineProperty(exports, "__esModule", ({
  37012. value: true
  37013. }));
  37014. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  37015. exports.getStandardFontName = getStandardFontName;
  37016. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  37017. var _core_utils = __w_pdfjs_require__(4);
  37018. var _fonts_utils = __w_pdfjs_require__(36);
  37019. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37020. t["Times-Roman"] = "Times-Roman";
  37021. t.Helvetica = "Helvetica";
  37022. t.Courier = "Courier";
  37023. t.Symbol = "Symbol";
  37024. t["Times-Bold"] = "Times-Bold";
  37025. t["Helvetica-Bold"] = "Helvetica-Bold";
  37026. t["Courier-Bold"] = "Courier-Bold";
  37027. t.ZapfDingbats = "ZapfDingbats";
  37028. t["Times-Italic"] = "Times-Italic";
  37029. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  37030. t["Courier-Oblique"] = "Courier-Oblique";
  37031. t["Times-BoldItalic"] = "Times-BoldItalic";
  37032. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  37033. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  37034. t.ArialNarrow = "Helvetica";
  37035. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  37036. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  37037. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  37038. t.ArialBlack = "Helvetica";
  37039. t["ArialBlack-Bold"] = "Helvetica-Bold";
  37040. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  37041. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  37042. t["Arial-Black"] = "Helvetica";
  37043. t["Arial-Black-Bold"] = "Helvetica-Bold";
  37044. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  37045. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  37046. t.Arial = "Helvetica";
  37047. t["Arial-Bold"] = "Helvetica-Bold";
  37048. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  37049. t["Arial-Italic"] = "Helvetica-Oblique";
  37050. t.ArialMT = "Helvetica";
  37051. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  37052. t["Arial-BoldMT"] = "Helvetica-Bold";
  37053. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  37054. t.ArialUnicodeMS = "Helvetica";
  37055. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  37056. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  37057. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  37058. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  37059. t["Courier-Italic"] = "Courier-Oblique";
  37060. t.CourierNew = "Courier";
  37061. t["CourierNew-Bold"] = "Courier-Bold";
  37062. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  37063. t["CourierNew-Italic"] = "Courier-Oblique";
  37064. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  37065. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  37066. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  37067. t.CourierNewPSMT = "Courier";
  37068. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  37069. t["Helvetica-Italic"] = "Helvetica-Oblique";
  37070. t["Symbol-Bold"] = "Symbol";
  37071. t["Symbol-BoldItalic"] = "Symbol";
  37072. t["Symbol-Italic"] = "Symbol";
  37073. t.TimesNewRoman = "Times-Roman";
  37074. t["TimesNewRoman-Bold"] = "Times-Bold";
  37075. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  37076. t["TimesNewRoman-Italic"] = "Times-Italic";
  37077. t.TimesNewRomanPS = "Times-Roman";
  37078. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  37079. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  37080. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  37081. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  37082. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  37083. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  37084. t.TimesNewRomanPSMT = "Times-Roman";
  37085. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  37086. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  37087. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  37088. });
  37089. exports.getStdFontMap = getStdFontMap;
  37090. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37091. t.Courier = "FoxitFixed.pfb";
  37092. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  37093. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  37094. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  37095. t.Helvetica = "FoxitSans.pfb";
  37096. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  37097. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  37098. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  37099. t["Times-Roman"] = "FoxitSerif.pfb";
  37100. t["Times-Bold"] = "FoxitSerifBold.pfb";
  37101. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  37102. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  37103. t.Symbol = "FoxitSymbol.pfb";
  37104. t.ZapfDingbats = "FoxitDingbats.pfb";
  37105. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  37106. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  37107. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  37108. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  37109. });
  37110. exports.getFontNameToFileMap = getFontNameToFileMap;
  37111. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37112. t.Calibri = "Helvetica";
  37113. t["Calibri-Bold"] = "Helvetica-Bold";
  37114. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  37115. t["Calibri-Italic"] = "Helvetica-Oblique";
  37116. t.CenturyGothic = "Helvetica";
  37117. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  37118. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  37119. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  37120. t.ComicSansMS = "Comic Sans MS";
  37121. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  37122. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  37123. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  37124. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  37125. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  37126. t["ItcSymbol-Book"] = "Helvetica";
  37127. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  37128. t["ItcSymbol-Medium"] = "Helvetica";
  37129. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  37130. t.LucidaConsole = "Courier";
  37131. t["LucidaConsole-Bold"] = "Courier-Bold";
  37132. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  37133. t["LucidaConsole-Italic"] = "Courier-Oblique";
  37134. t["LucidaSans-Demi"] = "Helvetica-Bold";
  37135. t["MS-Gothic"] = "MS Gothic";
  37136. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  37137. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  37138. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  37139. t["MS-Mincho"] = "MS Mincho";
  37140. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  37141. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  37142. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  37143. t["MS-PGothic"] = "MS PGothic";
  37144. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  37145. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  37146. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  37147. t["MS-PMincho"] = "MS PMincho";
  37148. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  37149. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  37150. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  37151. t.NuptialScript = "Times-Italic";
  37152. t.SegoeUISymbol = "Helvetica";
  37153. t.Wingdings = "ZapfDingbats";
  37154. t["Wingdings-Regular"] = "ZapfDingbats";
  37155. });
  37156. exports.getNonStdFontMap = getNonStdFontMap;
  37157. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37158. t["Adobe Jenson"] = true;
  37159. t["Adobe Text"] = true;
  37160. t.Albertus = true;
  37161. t.Aldus = true;
  37162. t.Alexandria = true;
  37163. t.Algerian = true;
  37164. t["American Typewriter"] = true;
  37165. t.Antiqua = true;
  37166. t.Apex = true;
  37167. t.Arno = true;
  37168. t.Aster = true;
  37169. t.Aurora = true;
  37170. t.Baskerville = true;
  37171. t.Bell = true;
  37172. t.Bembo = true;
  37173. t["Bembo Schoolbook"] = true;
  37174. t.Benguiat = true;
  37175. t["Berkeley Old Style"] = true;
  37176. t["Bernhard Modern"] = true;
  37177. t["Berthold City"] = true;
  37178. t.Bodoni = true;
  37179. t["Bauer Bodoni"] = true;
  37180. t["Book Antiqua"] = true;
  37181. t.Bookman = true;
  37182. t["Bordeaux Roman"] = true;
  37183. t["Californian FB"] = true;
  37184. t.Calisto = true;
  37185. t.Calvert = true;
  37186. t.Capitals = true;
  37187. t.Cambria = true;
  37188. t.Cartier = true;
  37189. t.Caslon = true;
  37190. t.Catull = true;
  37191. t.Centaur = true;
  37192. t["Century Old Style"] = true;
  37193. t["Century Schoolbook"] = true;
  37194. t.Chaparral = true;
  37195. t["Charis SIL"] = true;
  37196. t.Cheltenham = true;
  37197. t["Cholla Slab"] = true;
  37198. t.Clarendon = true;
  37199. t.Clearface = true;
  37200. t.Cochin = true;
  37201. t.Colonna = true;
  37202. t["Computer Modern"] = true;
  37203. t["Concrete Roman"] = true;
  37204. t.Constantia = true;
  37205. t["Cooper Black"] = true;
  37206. t.Corona = true;
  37207. t.Ecotype = true;
  37208. t.Egyptienne = true;
  37209. t.Elephant = true;
  37210. t.Excelsior = true;
  37211. t.Fairfield = true;
  37212. t["FF Scala"] = true;
  37213. t.Folkard = true;
  37214. t.Footlight = true;
  37215. t.FreeSerif = true;
  37216. t["Friz Quadrata"] = true;
  37217. t.Garamond = true;
  37218. t.Gentium = true;
  37219. t.Georgia = true;
  37220. t.Gloucester = true;
  37221. t["Goudy Old Style"] = true;
  37222. t["Goudy Schoolbook"] = true;
  37223. t["Goudy Pro Font"] = true;
  37224. t.Granjon = true;
  37225. t["Guardian Egyptian"] = true;
  37226. t.Heather = true;
  37227. t.Hercules = true;
  37228. t["High Tower Text"] = true;
  37229. t.Hiroshige = true;
  37230. t["Hoefler Text"] = true;
  37231. t["Humana Serif"] = true;
  37232. t.Imprint = true;
  37233. t["Ionic No. 5"] = true;
  37234. t.Janson = true;
  37235. t.Joanna = true;
  37236. t.Korinna = true;
  37237. t.Lexicon = true;
  37238. t.LiberationSerif = true;
  37239. t["Liberation Serif"] = true;
  37240. t["Linux Libertine"] = true;
  37241. t.Literaturnaya = true;
  37242. t.Lucida = true;
  37243. t["Lucida Bright"] = true;
  37244. t.Melior = true;
  37245. t.Memphis = true;
  37246. t.Miller = true;
  37247. t.Minion = true;
  37248. t.Modern = true;
  37249. t["Mona Lisa"] = true;
  37250. t["Mrs Eaves"] = true;
  37251. t["MS Serif"] = true;
  37252. t["Museo Slab"] = true;
  37253. t["New York"] = true;
  37254. t["Nimbus Roman"] = true;
  37255. t["NPS Rawlinson Roadway"] = true;
  37256. t.NuptialScript = true;
  37257. t.Palatino = true;
  37258. t.Perpetua = true;
  37259. t.Plantin = true;
  37260. t["Plantin Schoolbook"] = true;
  37261. t.Playbill = true;
  37262. t["Poor Richard"] = true;
  37263. t["Rawlinson Roadway"] = true;
  37264. t.Renault = true;
  37265. t.Requiem = true;
  37266. t.Rockwell = true;
  37267. t.Roman = true;
  37268. t["Rotis Serif"] = true;
  37269. t.Sabon = true;
  37270. t.Scala = true;
  37271. t.Seagull = true;
  37272. t.Sistina = true;
  37273. t.Souvenir = true;
  37274. t.STIX = true;
  37275. t["Stone Informal"] = true;
  37276. t["Stone Serif"] = true;
  37277. t.Sylfaen = true;
  37278. t.Times = true;
  37279. t.Trajan = true;
  37280. t["Trinité"] = true;
  37281. t["Trump Mediaeval"] = true;
  37282. t.Utopia = true;
  37283. t["Vale Type"] = true;
  37284. t["Bitstream Vera"] = true;
  37285. t["Vera Serif"] = true;
  37286. t.Versailles = true;
  37287. t.Wanted = true;
  37288. t.Weiss = true;
  37289. t["Wide Latin"] = true;
  37290. t.Windsor = true;
  37291. t.XITS = true;
  37292. });
  37293. exports.getSerifFonts = getSerifFonts;
  37294. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37295. t.Dingbats = true;
  37296. t.Symbol = true;
  37297. t.ZapfDingbats = true;
  37298. });
  37299. exports.getSymbolsFonts = getSymbolsFonts;
  37300. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37301. t[2] = 10;
  37302. t[3] = 32;
  37303. t[4] = 33;
  37304. t[5] = 34;
  37305. t[6] = 35;
  37306. t[7] = 36;
  37307. t[8] = 37;
  37308. t[9] = 38;
  37309. t[10] = 39;
  37310. t[11] = 40;
  37311. t[12] = 41;
  37312. t[13] = 42;
  37313. t[14] = 43;
  37314. t[15] = 44;
  37315. t[16] = 45;
  37316. t[17] = 46;
  37317. t[18] = 47;
  37318. t[19] = 48;
  37319. t[20] = 49;
  37320. t[21] = 50;
  37321. t[22] = 51;
  37322. t[23] = 52;
  37323. t[24] = 53;
  37324. t[25] = 54;
  37325. t[26] = 55;
  37326. t[27] = 56;
  37327. t[28] = 57;
  37328. t[29] = 58;
  37329. t[30] = 894;
  37330. t[31] = 60;
  37331. t[32] = 61;
  37332. t[33] = 62;
  37333. t[34] = 63;
  37334. t[35] = 64;
  37335. t[36] = 65;
  37336. t[37] = 66;
  37337. t[38] = 67;
  37338. t[39] = 68;
  37339. t[40] = 69;
  37340. t[41] = 70;
  37341. t[42] = 71;
  37342. t[43] = 72;
  37343. t[44] = 73;
  37344. t[45] = 74;
  37345. t[46] = 75;
  37346. t[47] = 76;
  37347. t[48] = 77;
  37348. t[49] = 78;
  37349. t[50] = 79;
  37350. t[51] = 80;
  37351. t[52] = 81;
  37352. t[53] = 82;
  37353. t[54] = 83;
  37354. t[55] = 84;
  37355. t[56] = 85;
  37356. t[57] = 86;
  37357. t[58] = 87;
  37358. t[59] = 88;
  37359. t[60] = 89;
  37360. t[61] = 90;
  37361. t[62] = 91;
  37362. t[63] = 92;
  37363. t[64] = 93;
  37364. t[65] = 94;
  37365. t[66] = 95;
  37366. t[67] = 96;
  37367. t[68] = 97;
  37368. t[69] = 98;
  37369. t[70] = 99;
  37370. t[71] = 100;
  37371. t[72] = 101;
  37372. t[73] = 102;
  37373. t[74] = 103;
  37374. t[75] = 104;
  37375. t[76] = 105;
  37376. t[77] = 106;
  37377. t[78] = 107;
  37378. t[79] = 108;
  37379. t[80] = 109;
  37380. t[81] = 110;
  37381. t[82] = 111;
  37382. t[83] = 112;
  37383. t[84] = 113;
  37384. t[85] = 114;
  37385. t[86] = 115;
  37386. t[87] = 116;
  37387. t[88] = 117;
  37388. t[89] = 118;
  37389. t[90] = 119;
  37390. t[91] = 120;
  37391. t[92] = 121;
  37392. t[93] = 122;
  37393. t[94] = 123;
  37394. t[95] = 124;
  37395. t[96] = 125;
  37396. t[97] = 126;
  37397. t[98] = 196;
  37398. t[99] = 197;
  37399. t[100] = 199;
  37400. t[101] = 201;
  37401. t[102] = 209;
  37402. t[103] = 214;
  37403. t[104] = 220;
  37404. t[105] = 225;
  37405. t[106] = 224;
  37406. t[107] = 226;
  37407. t[108] = 228;
  37408. t[109] = 227;
  37409. t[110] = 229;
  37410. t[111] = 231;
  37411. t[112] = 233;
  37412. t[113] = 232;
  37413. t[114] = 234;
  37414. t[115] = 235;
  37415. t[116] = 237;
  37416. t[117] = 236;
  37417. t[118] = 238;
  37418. t[119] = 239;
  37419. t[120] = 241;
  37420. t[121] = 243;
  37421. t[122] = 242;
  37422. t[123] = 244;
  37423. t[124] = 246;
  37424. t[125] = 245;
  37425. t[126] = 250;
  37426. t[127] = 249;
  37427. t[128] = 251;
  37428. t[129] = 252;
  37429. t[130] = 8224;
  37430. t[131] = 176;
  37431. t[132] = 162;
  37432. t[133] = 163;
  37433. t[134] = 167;
  37434. t[135] = 8226;
  37435. t[136] = 182;
  37436. t[137] = 223;
  37437. t[138] = 174;
  37438. t[139] = 169;
  37439. t[140] = 8482;
  37440. t[141] = 180;
  37441. t[142] = 168;
  37442. t[143] = 8800;
  37443. t[144] = 198;
  37444. t[145] = 216;
  37445. t[146] = 8734;
  37446. t[147] = 177;
  37447. t[148] = 8804;
  37448. t[149] = 8805;
  37449. t[150] = 165;
  37450. t[151] = 181;
  37451. t[152] = 8706;
  37452. t[153] = 8721;
  37453. t[154] = 8719;
  37454. t[156] = 8747;
  37455. t[157] = 170;
  37456. t[158] = 186;
  37457. t[159] = 8486;
  37458. t[160] = 230;
  37459. t[161] = 248;
  37460. t[162] = 191;
  37461. t[163] = 161;
  37462. t[164] = 172;
  37463. t[165] = 8730;
  37464. t[166] = 402;
  37465. t[167] = 8776;
  37466. t[168] = 8710;
  37467. t[169] = 171;
  37468. t[170] = 187;
  37469. t[171] = 8230;
  37470. t[179] = 8220;
  37471. t[180] = 8221;
  37472. t[181] = 8216;
  37473. t[182] = 8217;
  37474. t[200] = 193;
  37475. t[203] = 205;
  37476. t[210] = 218;
  37477. t[223] = 711;
  37478. t[224] = 321;
  37479. t[225] = 322;
  37480. t[226] = 352;
  37481. t[227] = 353;
  37482. t[228] = 381;
  37483. t[229] = 382;
  37484. t[233] = 221;
  37485. t[234] = 253;
  37486. t[252] = 263;
  37487. t[253] = 268;
  37488. t[254] = 269;
  37489. t[258] = 258;
  37490. t[260] = 260;
  37491. t[261] = 261;
  37492. t[265] = 280;
  37493. t[266] = 281;
  37494. t[267] = 282;
  37495. t[268] = 283;
  37496. t[269] = 313;
  37497. t[275] = 323;
  37498. t[276] = 324;
  37499. t[278] = 328;
  37500. t[283] = 344;
  37501. t[284] = 345;
  37502. t[285] = 346;
  37503. t[286] = 347;
  37504. t[292] = 367;
  37505. t[295] = 377;
  37506. t[296] = 378;
  37507. t[298] = 380;
  37508. t[305] = 963;
  37509. t[306] = 964;
  37510. t[307] = 966;
  37511. t[308] = 8215;
  37512. t[309] = 8252;
  37513. t[310] = 8319;
  37514. t[311] = 8359;
  37515. t[312] = 8592;
  37516. t[313] = 8593;
  37517. t[337] = 9552;
  37518. t[493] = 1039;
  37519. t[494] = 1040;
  37520. t[672] = 1488;
  37521. t[673] = 1489;
  37522. t[674] = 1490;
  37523. t[675] = 1491;
  37524. t[676] = 1492;
  37525. t[677] = 1493;
  37526. t[678] = 1494;
  37527. t[679] = 1495;
  37528. t[680] = 1496;
  37529. t[681] = 1497;
  37530. t[682] = 1498;
  37531. t[683] = 1499;
  37532. t[684] = 1500;
  37533. t[685] = 1501;
  37534. t[686] = 1502;
  37535. t[687] = 1503;
  37536. t[688] = 1504;
  37537. t[689] = 1505;
  37538. t[690] = 1506;
  37539. t[691] = 1507;
  37540. t[692] = 1508;
  37541. t[693] = 1509;
  37542. t[694] = 1510;
  37543. t[695] = 1511;
  37544. t[696] = 1512;
  37545. t[697] = 1513;
  37546. t[698] = 1514;
  37547. t[705] = 1524;
  37548. t[706] = 8362;
  37549. t[710] = 64288;
  37550. t[711] = 64298;
  37551. t[759] = 1617;
  37552. t[761] = 1776;
  37553. t[763] = 1778;
  37554. t[775] = 1652;
  37555. t[777] = 1764;
  37556. t[778] = 1780;
  37557. t[779] = 1781;
  37558. t[780] = 1782;
  37559. t[782] = 771;
  37560. t[783] = 64726;
  37561. t[786] = 8363;
  37562. t[788] = 8532;
  37563. t[790] = 768;
  37564. t[791] = 769;
  37565. t[792] = 768;
  37566. t[795] = 803;
  37567. t[797] = 64336;
  37568. t[798] = 64337;
  37569. t[799] = 64342;
  37570. t[800] = 64343;
  37571. t[801] = 64344;
  37572. t[802] = 64345;
  37573. t[803] = 64362;
  37574. t[804] = 64363;
  37575. t[805] = 64364;
  37576. t[2424] = 7821;
  37577. t[2425] = 7822;
  37578. t[2426] = 7823;
  37579. t[2427] = 7824;
  37580. t[2428] = 7825;
  37581. t[2429] = 7826;
  37582. t[2430] = 7827;
  37583. t[2433] = 7682;
  37584. t[2678] = 8045;
  37585. t[2679] = 8046;
  37586. t[2830] = 1552;
  37587. t[2838] = 686;
  37588. t[2840] = 751;
  37589. t[2842] = 753;
  37590. t[2843] = 754;
  37591. t[2844] = 755;
  37592. t[2846] = 757;
  37593. t[2856] = 767;
  37594. t[2857] = 848;
  37595. t[2858] = 849;
  37596. t[2862] = 853;
  37597. t[2863] = 854;
  37598. t[2864] = 855;
  37599. t[2865] = 861;
  37600. t[2866] = 862;
  37601. t[2906] = 7460;
  37602. t[2908] = 7462;
  37603. t[2909] = 7463;
  37604. t[2910] = 7464;
  37605. t[2912] = 7466;
  37606. t[2913] = 7467;
  37607. t[2914] = 7468;
  37608. t[2916] = 7470;
  37609. t[2917] = 7471;
  37610. t[2918] = 7472;
  37611. t[2920] = 7474;
  37612. t[2921] = 7475;
  37613. t[2922] = 7476;
  37614. t[2924] = 7478;
  37615. t[2925] = 7479;
  37616. t[2926] = 7480;
  37617. t[2928] = 7482;
  37618. t[2929] = 7483;
  37619. t[2930] = 7484;
  37620. t[2932] = 7486;
  37621. t[2933] = 7487;
  37622. t[2934] = 7488;
  37623. t[2936] = 7490;
  37624. t[2937] = 7491;
  37625. t[2938] = 7492;
  37626. t[2940] = 7494;
  37627. t[2941] = 7495;
  37628. t[2942] = 7496;
  37629. t[2944] = 7498;
  37630. t[2946] = 7500;
  37631. t[2948] = 7502;
  37632. t[2950] = 7504;
  37633. t[2951] = 7505;
  37634. t[2952] = 7506;
  37635. t[2954] = 7508;
  37636. t[2955] = 7509;
  37637. t[2956] = 7510;
  37638. t[2958] = 7512;
  37639. t[2959] = 7513;
  37640. t[2960] = 7514;
  37641. t[2962] = 7516;
  37642. t[2963] = 7517;
  37643. t[2964] = 7518;
  37644. t[2966] = 7520;
  37645. t[2967] = 7521;
  37646. t[2968] = 7522;
  37647. t[2970] = 7524;
  37648. t[2971] = 7525;
  37649. t[2972] = 7526;
  37650. t[2974] = 7528;
  37651. t[2975] = 7529;
  37652. t[2976] = 7530;
  37653. t[2978] = 1537;
  37654. t[2979] = 1538;
  37655. t[2980] = 1539;
  37656. t[2982] = 1549;
  37657. t[2983] = 1551;
  37658. t[2984] = 1552;
  37659. t[2986] = 1554;
  37660. t[2987] = 1555;
  37661. t[2988] = 1556;
  37662. t[2990] = 1623;
  37663. t[2991] = 1624;
  37664. t[2995] = 1775;
  37665. t[2999] = 1791;
  37666. t[3002] = 64290;
  37667. t[3003] = 64291;
  37668. t[3004] = 64292;
  37669. t[3006] = 64294;
  37670. t[3007] = 64295;
  37671. t[3008] = 64296;
  37672. t[3011] = 1900;
  37673. t[3014] = 8223;
  37674. t[3015] = 8244;
  37675. t[3017] = 7532;
  37676. t[3018] = 7533;
  37677. t[3019] = 7534;
  37678. t[3075] = 7590;
  37679. t[3076] = 7591;
  37680. t[3079] = 7594;
  37681. t[3080] = 7595;
  37682. t[3083] = 7598;
  37683. t[3084] = 7599;
  37684. t[3087] = 7602;
  37685. t[3088] = 7603;
  37686. t[3091] = 7606;
  37687. t[3092] = 7607;
  37688. t[3095] = 7610;
  37689. t[3096] = 7611;
  37690. t[3099] = 7614;
  37691. t[3100] = 7615;
  37692. t[3103] = 7618;
  37693. t[3104] = 7619;
  37694. t[3107] = 8337;
  37695. t[3108] = 8338;
  37696. t[3116] = 1884;
  37697. t[3119] = 1885;
  37698. t[3120] = 1885;
  37699. t[3123] = 1886;
  37700. t[3124] = 1886;
  37701. t[3127] = 1887;
  37702. t[3128] = 1887;
  37703. t[3131] = 1888;
  37704. t[3132] = 1888;
  37705. t[3135] = 1889;
  37706. t[3136] = 1889;
  37707. t[3139] = 1890;
  37708. t[3140] = 1890;
  37709. t[3143] = 1891;
  37710. t[3144] = 1891;
  37711. t[3147] = 1892;
  37712. t[3148] = 1892;
  37713. t[3153] = 580;
  37714. t[3154] = 581;
  37715. t[3157] = 584;
  37716. t[3158] = 585;
  37717. t[3161] = 588;
  37718. t[3162] = 589;
  37719. t[3165] = 891;
  37720. t[3166] = 892;
  37721. t[3169] = 1274;
  37722. t[3170] = 1275;
  37723. t[3173] = 1278;
  37724. t[3174] = 1279;
  37725. t[3181] = 7622;
  37726. t[3182] = 7623;
  37727. t[3282] = 11799;
  37728. t[3316] = 578;
  37729. t[3379] = 42785;
  37730. t[3393] = 1159;
  37731. t[3416] = 8377;
  37732. });
  37733. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37734. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37735. t[227] = 322;
  37736. t[264] = 261;
  37737. t[291] = 346;
  37738. });
  37739. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37740. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37741. t[1] = 32;
  37742. t[4] = 65;
  37743. t[5] = 192;
  37744. t[6] = 193;
  37745. t[9] = 196;
  37746. t[17] = 66;
  37747. t[18] = 67;
  37748. t[21] = 268;
  37749. t[24] = 68;
  37750. t[28] = 69;
  37751. t[29] = 200;
  37752. t[30] = 201;
  37753. t[32] = 282;
  37754. t[38] = 70;
  37755. t[39] = 71;
  37756. t[44] = 72;
  37757. t[47] = 73;
  37758. t[48] = 204;
  37759. t[49] = 205;
  37760. t[58] = 74;
  37761. t[60] = 75;
  37762. t[62] = 76;
  37763. t[68] = 77;
  37764. t[69] = 78;
  37765. t[75] = 79;
  37766. t[76] = 210;
  37767. t[80] = 214;
  37768. t[87] = 80;
  37769. t[89] = 81;
  37770. t[90] = 82;
  37771. t[92] = 344;
  37772. t[94] = 83;
  37773. t[97] = 352;
  37774. t[100] = 84;
  37775. t[104] = 85;
  37776. t[109] = 220;
  37777. t[115] = 86;
  37778. t[116] = 87;
  37779. t[121] = 88;
  37780. t[122] = 89;
  37781. t[124] = 221;
  37782. t[127] = 90;
  37783. t[129] = 381;
  37784. t[258] = 97;
  37785. t[259] = 224;
  37786. t[260] = 225;
  37787. t[263] = 228;
  37788. t[268] = 261;
  37789. t[271] = 98;
  37790. t[272] = 99;
  37791. t[273] = 263;
  37792. t[275] = 269;
  37793. t[282] = 100;
  37794. t[286] = 101;
  37795. t[287] = 232;
  37796. t[288] = 233;
  37797. t[290] = 283;
  37798. t[295] = 281;
  37799. t[296] = 102;
  37800. t[336] = 103;
  37801. t[346] = 104;
  37802. t[349] = 105;
  37803. t[350] = 236;
  37804. t[351] = 237;
  37805. t[361] = 106;
  37806. t[364] = 107;
  37807. t[367] = 108;
  37808. t[371] = 322;
  37809. t[373] = 109;
  37810. t[374] = 110;
  37811. t[381] = 111;
  37812. t[382] = 242;
  37813. t[383] = 243;
  37814. t[386] = 246;
  37815. t[393] = 112;
  37816. t[395] = 113;
  37817. t[396] = 114;
  37818. t[398] = 345;
  37819. t[400] = 115;
  37820. t[401] = 347;
  37821. t[403] = 353;
  37822. t[410] = 116;
  37823. t[437] = 117;
  37824. t[442] = 252;
  37825. t[448] = 118;
  37826. t[449] = 119;
  37827. t[454] = 120;
  37828. t[455] = 121;
  37829. t[457] = 253;
  37830. t[460] = 122;
  37831. t[462] = 382;
  37832. t[463] = 380;
  37833. t[853] = 44;
  37834. t[855] = 58;
  37835. t[856] = 46;
  37836. t[876] = 47;
  37837. t[878] = 45;
  37838. t[882] = 45;
  37839. t[894] = 40;
  37840. t[895] = 41;
  37841. t[896] = 91;
  37842. t[897] = 93;
  37843. t[923] = 64;
  37844. t[1004] = 48;
  37845. t[1005] = 49;
  37846. t[1006] = 50;
  37847. t[1007] = 51;
  37848. t[1008] = 52;
  37849. t[1009] = 53;
  37850. t[1010] = 54;
  37851. t[1011] = 55;
  37852. t[1012] = 56;
  37853. t[1013] = 57;
  37854. t[1081] = 37;
  37855. t[1085] = 43;
  37856. t[1086] = 45;
  37857. });
  37858. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37859. function getStandardFontName(name) {
  37860. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37861. const stdFontMap = getStdFontMap();
  37862. return stdFontMap[fontName];
  37863. }
  37864. /***/ }),
  37865. /* 40 */
  37866. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37867. Object.defineProperty(exports, "__esModule", ({
  37868. value: true
  37869. }));
  37870. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37871. var _util = __w_pdfjs_require__(2);
  37872. class ToUnicodeMap {
  37873. constructor(cmap = []) {
  37874. this._map = cmap;
  37875. }
  37876. get length() {
  37877. return this._map.length;
  37878. }
  37879. forEach(callback) {
  37880. for (const charCode in this._map) {
  37881. callback(charCode, this._map[charCode].charCodeAt(0));
  37882. }
  37883. }
  37884. has(i) {
  37885. return this._map[i] !== undefined;
  37886. }
  37887. get(i) {
  37888. return this._map[i];
  37889. }
  37890. charCodeOf(value) {
  37891. const map = this._map;
  37892. if (map.length <= 0x10000) {
  37893. return map.indexOf(value);
  37894. }
  37895. for (const charCode in map) {
  37896. if (map[charCode] === value) {
  37897. return charCode | 0;
  37898. }
  37899. }
  37900. return -1;
  37901. }
  37902. amend(map) {
  37903. for (const charCode in map) {
  37904. this._map[charCode] = map[charCode];
  37905. }
  37906. }
  37907. }
  37908. exports.ToUnicodeMap = ToUnicodeMap;
  37909. class IdentityToUnicodeMap {
  37910. constructor(firstChar, lastChar) {
  37911. this.firstChar = firstChar;
  37912. this.lastChar = lastChar;
  37913. }
  37914. get length() {
  37915. return this.lastChar + 1 - this.firstChar;
  37916. }
  37917. forEach(callback) {
  37918. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37919. callback(i, i);
  37920. }
  37921. }
  37922. has(i) {
  37923. return this.firstChar <= i && i <= this.lastChar;
  37924. }
  37925. get(i) {
  37926. if (this.firstChar <= i && i <= this.lastChar) {
  37927. return String.fromCharCode(i);
  37928. }
  37929. return undefined;
  37930. }
  37931. charCodeOf(v) {
  37932. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37933. }
  37934. amend(map) {
  37935. (0, _util.unreachable)("Should not call amend()");
  37936. }
  37937. }
  37938. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37939. /***/ }),
  37940. /* 41 */
  37941. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37942. Object.defineProperty(exports, "__esModule", ({
  37943. value: true
  37944. }));
  37945. exports.CFFFont = void 0;
  37946. var _cff_parser = __w_pdfjs_require__(33);
  37947. var _fonts_utils = __w_pdfjs_require__(36);
  37948. var _util = __w_pdfjs_require__(2);
  37949. class CFFFont {
  37950. constructor(file, properties) {
  37951. this.properties = properties;
  37952. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37953. this.cff = parser.parse();
  37954. this.cff.duplicateFirstGlyph();
  37955. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37956. this.seacs = this.cff.seacs;
  37957. try {
  37958. this.data = compiler.compile();
  37959. } catch (e) {
  37960. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37961. this.data = file;
  37962. }
  37963. this._createBuiltInEncoding();
  37964. }
  37965. get numGlyphs() {
  37966. return this.cff.charStrings.count;
  37967. }
  37968. getCharset() {
  37969. return this.cff.charset.charset;
  37970. }
  37971. getGlyphMapping() {
  37972. const cff = this.cff;
  37973. const properties = this.properties;
  37974. const {
  37975. cidToGidMap,
  37976. cMap
  37977. } = properties;
  37978. const charsets = cff.charset.charset;
  37979. let charCodeToGlyphId;
  37980. let glyphId;
  37981. if (properties.composite) {
  37982. let invCidToGidMap;
  37983. if (cidToGidMap && cidToGidMap.length > 0) {
  37984. invCidToGidMap = Object.create(null);
  37985. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  37986. const gid = cidToGidMap[i];
  37987. if (gid !== undefined) {
  37988. invCidToGidMap[gid] = i;
  37989. }
  37990. }
  37991. }
  37992. charCodeToGlyphId = Object.create(null);
  37993. let charCode;
  37994. if (cff.isCIDFont) {
  37995. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37996. const cid = charsets[glyphId];
  37997. charCode = cMap.charCodeOf(cid);
  37998. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  37999. charCode = invCidToGidMap[charCode];
  38000. }
  38001. charCodeToGlyphId[charCode] = glyphId;
  38002. }
  38003. } else {
  38004. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  38005. charCode = cMap.charCodeOf(glyphId);
  38006. charCodeToGlyphId[charCode] = glyphId;
  38007. }
  38008. }
  38009. return charCodeToGlyphId;
  38010. }
  38011. let encoding = cff.encoding ? cff.encoding.encoding : null;
  38012. if (properties.isInternalFont) {
  38013. encoding = properties.defaultEncoding;
  38014. }
  38015. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  38016. return charCodeToGlyphId;
  38017. }
  38018. hasGlyphId(id) {
  38019. return this.cff.hasGlyphId(id);
  38020. }
  38021. _createBuiltInEncoding() {
  38022. const {
  38023. charset,
  38024. encoding
  38025. } = this.cff;
  38026. if (!charset || !encoding) {
  38027. return;
  38028. }
  38029. const charsets = charset.charset,
  38030. encodings = encoding.encoding;
  38031. const map = [];
  38032. for (const charCode in encodings) {
  38033. const glyphId = encodings[charCode];
  38034. if (glyphId >= 0) {
  38035. const glyphName = charsets[glyphId];
  38036. if (glyphName) {
  38037. map[charCode] = glyphName;
  38038. }
  38039. }
  38040. }
  38041. if (map.length > 0) {
  38042. this.properties.builtInEncoding = map;
  38043. }
  38044. }
  38045. }
  38046. exports.CFFFont = CFFFont;
  38047. /***/ }),
  38048. /* 42 */
  38049. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38050. Object.defineProperty(exports, "__esModule", ({
  38051. value: true
  38052. }));
  38053. exports.FontRendererFactory = void 0;
  38054. var _util = __w_pdfjs_require__(2);
  38055. var _cff_parser = __w_pdfjs_require__(33);
  38056. var _glyphlist = __w_pdfjs_require__(37);
  38057. var _encodings = __w_pdfjs_require__(35);
  38058. var _stream = __w_pdfjs_require__(8);
  38059. function getUint32(data, offset) {
  38060. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  38061. }
  38062. function getUint16(data, offset) {
  38063. return data[offset] << 8 | data[offset + 1];
  38064. }
  38065. function getInt16(data, offset) {
  38066. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  38067. }
  38068. function getInt8(data, offset) {
  38069. return data[offset] << 24 >> 24;
  38070. }
  38071. function getFloat214(data, offset) {
  38072. return getInt16(data, offset) / 16384;
  38073. }
  38074. function getSubroutineBias(subrs) {
  38075. const numSubrs = subrs.length;
  38076. let bias = 32768;
  38077. if (numSubrs < 1240) {
  38078. bias = 107;
  38079. } else if (numSubrs < 33900) {
  38080. bias = 1131;
  38081. }
  38082. return bias;
  38083. }
  38084. function parseCmap(data, start, end) {
  38085. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  38086. const format = getUint16(data, start + offset);
  38087. let ranges, p, i;
  38088. if (format === 4) {
  38089. getUint16(data, start + offset + 2);
  38090. const segCount = getUint16(data, start + offset + 6) >> 1;
  38091. p = start + offset + 14;
  38092. ranges = [];
  38093. for (i = 0; i < segCount; i++, p += 2) {
  38094. ranges[i] = {
  38095. end: getUint16(data, p)
  38096. };
  38097. }
  38098. p += 2;
  38099. for (i = 0; i < segCount; i++, p += 2) {
  38100. ranges[i].start = getUint16(data, p);
  38101. }
  38102. for (i = 0; i < segCount; i++, p += 2) {
  38103. ranges[i].idDelta = getUint16(data, p);
  38104. }
  38105. for (i = 0; i < segCount; i++, p += 2) {
  38106. let idOffset = getUint16(data, p);
  38107. if (idOffset === 0) {
  38108. continue;
  38109. }
  38110. ranges[i].ids = [];
  38111. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38112. ranges[i].ids[j] = getUint16(data, p + idOffset);
  38113. idOffset += 2;
  38114. }
  38115. }
  38116. return ranges;
  38117. } else if (format === 12) {
  38118. const groups = getUint32(data, start + offset + 12);
  38119. p = start + offset + 16;
  38120. ranges = [];
  38121. for (i = 0; i < groups; i++) {
  38122. start = getUint32(data, p);
  38123. ranges.push({
  38124. start,
  38125. end: getUint32(data, p + 4),
  38126. idDelta: getUint32(data, p + 8) - start
  38127. });
  38128. p += 12;
  38129. }
  38130. return ranges;
  38131. }
  38132. throw new _util.FormatError(`unsupported cmap: ${format}`);
  38133. }
  38134. function parseCff(data, start, end, seacAnalysisEnabled) {
  38135. const properties = {};
  38136. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38137. const cff = parser.parse();
  38138. return {
  38139. glyphs: cff.charStrings.objects,
  38140. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38141. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  38142. isCFFCIDFont: cff.isCIDFont,
  38143. fdSelect: cff.fdSelect,
  38144. fdArray: cff.fdArray
  38145. };
  38146. }
  38147. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38148. let itemSize, itemDecode;
  38149. if (isGlyphLocationsLong) {
  38150. itemSize = 4;
  38151. itemDecode = getUint32;
  38152. } else {
  38153. itemSize = 2;
  38154. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  38155. }
  38156. const glyphs = [];
  38157. let startOffset = itemDecode(loca, 0);
  38158. for (let j = itemSize; j < loca.length; j += itemSize) {
  38159. const endOffset = itemDecode(loca, j);
  38160. glyphs.push(glyf.subarray(startOffset, endOffset));
  38161. startOffset = endOffset;
  38162. }
  38163. return glyphs;
  38164. }
  38165. function lookupCmap(ranges, unicode) {
  38166. const code = unicode.codePointAt(0);
  38167. let gid = 0,
  38168. l = 0,
  38169. r = ranges.length - 1;
  38170. while (l < r) {
  38171. const c = l + r + 1 >> 1;
  38172. if (code < ranges[c].start) {
  38173. r = c - 1;
  38174. } else {
  38175. l = c;
  38176. }
  38177. }
  38178. if (ranges[l].start <= code && code <= ranges[l].end) {
  38179. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  38180. }
  38181. return {
  38182. charCode: code,
  38183. glyphId: gid
  38184. };
  38185. }
  38186. function compileGlyf(code, cmds, font) {
  38187. function moveTo(x, y) {
  38188. cmds.push({
  38189. cmd: "moveTo",
  38190. args: [x, y]
  38191. });
  38192. }
  38193. function lineTo(x, y) {
  38194. cmds.push({
  38195. cmd: "lineTo",
  38196. args: [x, y]
  38197. });
  38198. }
  38199. function quadraticCurveTo(xa, ya, x, y) {
  38200. cmds.push({
  38201. cmd: "quadraticCurveTo",
  38202. args: [xa, ya, x, y]
  38203. });
  38204. }
  38205. let i = 0;
  38206. const numberOfContours = getInt16(code, i);
  38207. let flags;
  38208. let x = 0,
  38209. y = 0;
  38210. i += 10;
  38211. if (numberOfContours < 0) {
  38212. do {
  38213. flags = getUint16(code, i);
  38214. const glyphIndex = getUint16(code, i + 2);
  38215. i += 4;
  38216. let arg1, arg2;
  38217. if (flags & 0x01) {
  38218. if (flags & 0x02) {
  38219. arg1 = getInt16(code, i);
  38220. arg2 = getInt16(code, i + 2);
  38221. } else {
  38222. arg1 = getUint16(code, i);
  38223. arg2 = getUint16(code, i + 2);
  38224. }
  38225. i += 4;
  38226. } else {
  38227. if (flags & 0x02) {
  38228. arg1 = getInt8(code, i++);
  38229. arg2 = getInt8(code, i++);
  38230. } else {
  38231. arg1 = code[i++];
  38232. arg2 = code[i++];
  38233. }
  38234. }
  38235. if (flags & 0x02) {
  38236. x = arg1;
  38237. y = arg2;
  38238. } else {
  38239. x = 0;
  38240. y = 0;
  38241. }
  38242. let scaleX = 1,
  38243. scaleY = 1,
  38244. scale01 = 0,
  38245. scale10 = 0;
  38246. if (flags & 0x08) {
  38247. scaleX = scaleY = getFloat214(code, i);
  38248. i += 2;
  38249. } else if (flags & 0x40) {
  38250. scaleX = getFloat214(code, i);
  38251. scaleY = getFloat214(code, i + 2);
  38252. i += 4;
  38253. } else if (flags & 0x80) {
  38254. scaleX = getFloat214(code, i);
  38255. scale01 = getFloat214(code, i + 2);
  38256. scale10 = getFloat214(code, i + 4);
  38257. scaleY = getFloat214(code, i + 6);
  38258. i += 8;
  38259. }
  38260. const subglyph = font.glyphs[glyphIndex];
  38261. if (subglyph) {
  38262. cmds.push({
  38263. cmd: "save"
  38264. }, {
  38265. cmd: "transform",
  38266. args: [scaleX, scale01, scale10, scaleY, x, y]
  38267. });
  38268. if (!(flags & 0x02)) {}
  38269. compileGlyf(subglyph, cmds, font);
  38270. cmds.push({
  38271. cmd: "restore"
  38272. });
  38273. }
  38274. } while (flags & 0x20);
  38275. } else {
  38276. const endPtsOfContours = [];
  38277. let j, jj;
  38278. for (j = 0; j < numberOfContours; j++) {
  38279. endPtsOfContours.push(getUint16(code, i));
  38280. i += 2;
  38281. }
  38282. const instructionLength = getUint16(code, i);
  38283. i += 2 + instructionLength;
  38284. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  38285. const points = [];
  38286. while (points.length < numberOfPoints) {
  38287. flags = code[i++];
  38288. let repeat = 1;
  38289. if (flags & 0x08) {
  38290. repeat += code[i++];
  38291. }
  38292. while (repeat-- > 0) {
  38293. points.push({
  38294. flags
  38295. });
  38296. }
  38297. }
  38298. for (j = 0; j < numberOfPoints; j++) {
  38299. switch (points[j].flags & 0x12) {
  38300. case 0x00:
  38301. x += getInt16(code, i);
  38302. i += 2;
  38303. break;
  38304. case 0x02:
  38305. x -= code[i++];
  38306. break;
  38307. case 0x12:
  38308. x += code[i++];
  38309. break;
  38310. }
  38311. points[j].x = x;
  38312. }
  38313. for (j = 0; j < numberOfPoints; j++) {
  38314. switch (points[j].flags & 0x24) {
  38315. case 0x00:
  38316. y += getInt16(code, i);
  38317. i += 2;
  38318. break;
  38319. case 0x04:
  38320. y -= code[i++];
  38321. break;
  38322. case 0x24:
  38323. y += code[i++];
  38324. break;
  38325. }
  38326. points[j].y = y;
  38327. }
  38328. let startPoint = 0;
  38329. for (i = 0; i < numberOfContours; i++) {
  38330. const endPoint = endPtsOfContours[i];
  38331. const contour = points.slice(startPoint, endPoint + 1);
  38332. if (contour[0].flags & 1) {
  38333. contour.push(contour[0]);
  38334. } else if (contour.at(-1).flags & 1) {
  38335. contour.unshift(contour.at(-1));
  38336. } else {
  38337. const p = {
  38338. flags: 1,
  38339. x: (contour[0].x + contour.at(-1).x) / 2,
  38340. y: (contour[0].y + contour.at(-1).y) / 2
  38341. };
  38342. contour.unshift(p);
  38343. contour.push(p);
  38344. }
  38345. moveTo(contour[0].x, contour[0].y);
  38346. for (j = 1, jj = contour.length; j < jj; j++) {
  38347. if (contour[j].flags & 1) {
  38348. lineTo(contour[j].x, contour[j].y);
  38349. } else if (contour[j + 1].flags & 1) {
  38350. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38351. j++;
  38352. } else {
  38353. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38354. }
  38355. }
  38356. startPoint = endPoint + 1;
  38357. }
  38358. }
  38359. }
  38360. function compileCharString(charStringCode, cmds, font, glyphId) {
  38361. function moveTo(x, y) {
  38362. cmds.push({
  38363. cmd: "moveTo",
  38364. args: [x, y]
  38365. });
  38366. }
  38367. function lineTo(x, y) {
  38368. cmds.push({
  38369. cmd: "lineTo",
  38370. args: [x, y]
  38371. });
  38372. }
  38373. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38374. cmds.push({
  38375. cmd: "bezierCurveTo",
  38376. args: [x1, y1, x2, y2, x, y]
  38377. });
  38378. }
  38379. const stack = [];
  38380. let x = 0,
  38381. y = 0;
  38382. let stems = 0;
  38383. function parse(code) {
  38384. let i = 0;
  38385. while (i < code.length) {
  38386. let stackClean = false;
  38387. let v = code[i++];
  38388. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38389. switch (v) {
  38390. case 1:
  38391. stems += stack.length >> 1;
  38392. stackClean = true;
  38393. break;
  38394. case 3:
  38395. stems += stack.length >> 1;
  38396. stackClean = true;
  38397. break;
  38398. case 4:
  38399. y += stack.pop();
  38400. moveTo(x, y);
  38401. stackClean = true;
  38402. break;
  38403. case 5:
  38404. while (stack.length > 0) {
  38405. x += stack.shift();
  38406. y += stack.shift();
  38407. lineTo(x, y);
  38408. }
  38409. break;
  38410. case 6:
  38411. while (stack.length > 0) {
  38412. x += stack.shift();
  38413. lineTo(x, y);
  38414. if (stack.length === 0) {
  38415. break;
  38416. }
  38417. y += stack.shift();
  38418. lineTo(x, y);
  38419. }
  38420. break;
  38421. case 7:
  38422. while (stack.length > 0) {
  38423. y += stack.shift();
  38424. lineTo(x, y);
  38425. if (stack.length === 0) {
  38426. break;
  38427. }
  38428. x += stack.shift();
  38429. lineTo(x, y);
  38430. }
  38431. break;
  38432. case 8:
  38433. while (stack.length > 0) {
  38434. xa = x + stack.shift();
  38435. ya = y + stack.shift();
  38436. xb = xa + stack.shift();
  38437. yb = ya + stack.shift();
  38438. x = xb + stack.shift();
  38439. y = yb + stack.shift();
  38440. bezierCurveTo(xa, ya, xb, yb, x, y);
  38441. }
  38442. break;
  38443. case 10:
  38444. n = stack.pop();
  38445. subrCode = null;
  38446. if (font.isCFFCIDFont) {
  38447. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38448. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38449. const fontDict = font.fdArray[fdIndex];
  38450. let subrs;
  38451. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38452. subrs = fontDict.privateDict.subrsIndex.objects;
  38453. }
  38454. if (subrs) {
  38455. n += getSubroutineBias(subrs);
  38456. subrCode = subrs[n];
  38457. }
  38458. } else {
  38459. (0, _util.warn)("Invalid fd index for glyph index.");
  38460. }
  38461. } else {
  38462. subrCode = font.subrs[n + font.subrsBias];
  38463. }
  38464. if (subrCode) {
  38465. parse(subrCode);
  38466. }
  38467. break;
  38468. case 11:
  38469. return;
  38470. case 12:
  38471. v = code[i++];
  38472. switch (v) {
  38473. case 34:
  38474. xa = x + stack.shift();
  38475. xb = xa + stack.shift();
  38476. y1 = y + stack.shift();
  38477. x = xb + stack.shift();
  38478. bezierCurveTo(xa, y, xb, y1, x, y1);
  38479. xa = x + stack.shift();
  38480. xb = xa + stack.shift();
  38481. x = xb + stack.shift();
  38482. bezierCurveTo(xa, y1, xb, y, x, y);
  38483. break;
  38484. case 35:
  38485. xa = x + stack.shift();
  38486. ya = y + stack.shift();
  38487. xb = xa + stack.shift();
  38488. yb = ya + stack.shift();
  38489. x = xb + stack.shift();
  38490. y = yb + stack.shift();
  38491. bezierCurveTo(xa, ya, xb, yb, x, y);
  38492. xa = x + stack.shift();
  38493. ya = y + stack.shift();
  38494. xb = xa + stack.shift();
  38495. yb = ya + stack.shift();
  38496. x = xb + stack.shift();
  38497. y = yb + stack.shift();
  38498. bezierCurveTo(xa, ya, xb, yb, x, y);
  38499. stack.pop();
  38500. break;
  38501. case 36:
  38502. xa = x + stack.shift();
  38503. y1 = y + stack.shift();
  38504. xb = xa + stack.shift();
  38505. y2 = y1 + stack.shift();
  38506. x = xb + stack.shift();
  38507. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38508. xa = x + stack.shift();
  38509. xb = xa + stack.shift();
  38510. y3 = y2 + stack.shift();
  38511. x = xb + stack.shift();
  38512. bezierCurveTo(xa, y2, xb, y3, x, y);
  38513. break;
  38514. case 37:
  38515. const x0 = x,
  38516. y0 = y;
  38517. xa = x + stack.shift();
  38518. ya = y + stack.shift();
  38519. xb = xa + stack.shift();
  38520. yb = ya + stack.shift();
  38521. x = xb + stack.shift();
  38522. y = yb + stack.shift();
  38523. bezierCurveTo(xa, ya, xb, yb, x, y);
  38524. xa = x + stack.shift();
  38525. ya = y + stack.shift();
  38526. xb = xa + stack.shift();
  38527. yb = ya + stack.shift();
  38528. x = xb;
  38529. y = yb;
  38530. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38531. x += stack.shift();
  38532. } else {
  38533. y += stack.shift();
  38534. }
  38535. bezierCurveTo(xa, ya, xb, yb, x, y);
  38536. break;
  38537. default:
  38538. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38539. }
  38540. break;
  38541. case 14:
  38542. if (stack.length >= 4) {
  38543. const achar = stack.pop();
  38544. const bchar = stack.pop();
  38545. y = stack.pop();
  38546. x = stack.pop();
  38547. cmds.push({
  38548. cmd: "save"
  38549. }, {
  38550. cmd: "translate",
  38551. args: [x, y]
  38552. });
  38553. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38554. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38555. cmds.push({
  38556. cmd: "restore"
  38557. });
  38558. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38559. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38560. }
  38561. return;
  38562. case 18:
  38563. stems += stack.length >> 1;
  38564. stackClean = true;
  38565. break;
  38566. case 19:
  38567. stems += stack.length >> 1;
  38568. i += stems + 7 >> 3;
  38569. stackClean = true;
  38570. break;
  38571. case 20:
  38572. stems += stack.length >> 1;
  38573. i += stems + 7 >> 3;
  38574. stackClean = true;
  38575. break;
  38576. case 21:
  38577. y += stack.pop();
  38578. x += stack.pop();
  38579. moveTo(x, y);
  38580. stackClean = true;
  38581. break;
  38582. case 22:
  38583. x += stack.pop();
  38584. moveTo(x, y);
  38585. stackClean = true;
  38586. break;
  38587. case 23:
  38588. stems += stack.length >> 1;
  38589. stackClean = true;
  38590. break;
  38591. case 24:
  38592. while (stack.length > 2) {
  38593. xa = x + stack.shift();
  38594. ya = y + stack.shift();
  38595. xb = xa + stack.shift();
  38596. yb = ya + stack.shift();
  38597. x = xb + stack.shift();
  38598. y = yb + stack.shift();
  38599. bezierCurveTo(xa, ya, xb, yb, x, y);
  38600. }
  38601. x += stack.shift();
  38602. y += stack.shift();
  38603. lineTo(x, y);
  38604. break;
  38605. case 25:
  38606. while (stack.length > 6) {
  38607. x += stack.shift();
  38608. y += stack.shift();
  38609. lineTo(x, y);
  38610. }
  38611. xa = x + stack.shift();
  38612. ya = y + stack.shift();
  38613. xb = xa + stack.shift();
  38614. yb = ya + stack.shift();
  38615. x = xb + stack.shift();
  38616. y = yb + stack.shift();
  38617. bezierCurveTo(xa, ya, xb, yb, x, y);
  38618. break;
  38619. case 26:
  38620. if (stack.length % 2) {
  38621. x += stack.shift();
  38622. }
  38623. while (stack.length > 0) {
  38624. xa = x;
  38625. ya = y + stack.shift();
  38626. xb = xa + stack.shift();
  38627. yb = ya + stack.shift();
  38628. x = xb;
  38629. y = yb + stack.shift();
  38630. bezierCurveTo(xa, ya, xb, yb, x, y);
  38631. }
  38632. break;
  38633. case 27:
  38634. if (stack.length % 2) {
  38635. y += stack.shift();
  38636. }
  38637. while (stack.length > 0) {
  38638. xa = x + stack.shift();
  38639. ya = y;
  38640. xb = xa + stack.shift();
  38641. yb = ya + stack.shift();
  38642. x = xb + stack.shift();
  38643. y = yb;
  38644. bezierCurveTo(xa, ya, xb, yb, x, y);
  38645. }
  38646. break;
  38647. case 28:
  38648. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38649. i += 2;
  38650. break;
  38651. case 29:
  38652. n = stack.pop() + font.gsubrsBias;
  38653. subrCode = font.gsubrs[n];
  38654. if (subrCode) {
  38655. parse(subrCode);
  38656. }
  38657. break;
  38658. case 30:
  38659. while (stack.length > 0) {
  38660. xa = x;
  38661. ya = y + stack.shift();
  38662. xb = xa + stack.shift();
  38663. yb = ya + stack.shift();
  38664. x = xb + stack.shift();
  38665. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38666. bezierCurveTo(xa, ya, xb, yb, x, y);
  38667. if (stack.length === 0) {
  38668. break;
  38669. }
  38670. xa = x + stack.shift();
  38671. ya = y;
  38672. xb = xa + stack.shift();
  38673. yb = ya + stack.shift();
  38674. y = yb + stack.shift();
  38675. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38676. bezierCurveTo(xa, ya, xb, yb, x, y);
  38677. }
  38678. break;
  38679. case 31:
  38680. while (stack.length > 0) {
  38681. xa = x + stack.shift();
  38682. ya = y;
  38683. xb = xa + stack.shift();
  38684. yb = ya + stack.shift();
  38685. y = yb + stack.shift();
  38686. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38687. bezierCurveTo(xa, ya, xb, yb, x, y);
  38688. if (stack.length === 0) {
  38689. break;
  38690. }
  38691. xa = x;
  38692. ya = y + stack.shift();
  38693. xb = xa + stack.shift();
  38694. yb = ya + stack.shift();
  38695. x = xb + stack.shift();
  38696. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38697. bezierCurveTo(xa, ya, xb, yb, x, y);
  38698. }
  38699. break;
  38700. default:
  38701. if (v < 32) {
  38702. throw new _util.FormatError(`unknown operator: ${v}`);
  38703. }
  38704. if (v < 247) {
  38705. stack.push(v - 139);
  38706. } else if (v < 251) {
  38707. stack.push((v - 247) * 256 + code[i++] + 108);
  38708. } else if (v < 255) {
  38709. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38710. } else {
  38711. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38712. i += 4;
  38713. }
  38714. break;
  38715. }
  38716. if (stackClean) {
  38717. stack.length = 0;
  38718. }
  38719. }
  38720. }
  38721. parse(charStringCode);
  38722. }
  38723. const NOOP = [];
  38724. class CompiledFont {
  38725. constructor(fontMatrix) {
  38726. if (this.constructor === CompiledFont) {
  38727. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38728. }
  38729. this.fontMatrix = fontMatrix;
  38730. this.compiledGlyphs = Object.create(null);
  38731. this.compiledCharCodeToGlyphId = Object.create(null);
  38732. }
  38733. getPathJs(unicode) {
  38734. const {
  38735. charCode,
  38736. glyphId
  38737. } = lookupCmap(this.cmap, unicode);
  38738. let fn = this.compiledGlyphs[glyphId];
  38739. if (!fn) {
  38740. try {
  38741. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38742. this.compiledGlyphs[glyphId] = fn;
  38743. } catch (ex) {
  38744. this.compiledGlyphs[glyphId] = NOOP;
  38745. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38746. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38747. }
  38748. throw ex;
  38749. }
  38750. }
  38751. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38752. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38753. }
  38754. return fn;
  38755. }
  38756. compileGlyph(code, glyphId) {
  38757. if (!code || code.length === 0 || code[0] === 14) {
  38758. return NOOP;
  38759. }
  38760. let fontMatrix = this.fontMatrix;
  38761. if (this.isCFFCIDFont) {
  38762. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38763. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38764. const fontDict = this.fdArray[fdIndex];
  38765. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38766. } else {
  38767. (0, _util.warn)("Invalid fd index for glyph index.");
  38768. }
  38769. }
  38770. const cmds = [{
  38771. cmd: "save"
  38772. }, {
  38773. cmd: "transform",
  38774. args: fontMatrix.slice()
  38775. }, {
  38776. cmd: "scale",
  38777. args: ["size", "-size"]
  38778. }];
  38779. this.compileGlyphImpl(code, cmds, glyphId);
  38780. cmds.push({
  38781. cmd: "restore"
  38782. });
  38783. return cmds;
  38784. }
  38785. compileGlyphImpl() {
  38786. (0, _util.unreachable)("Children classes should implement this.");
  38787. }
  38788. hasBuiltPath(unicode) {
  38789. const {
  38790. charCode,
  38791. glyphId
  38792. } = lookupCmap(this.cmap, unicode);
  38793. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38794. }
  38795. }
  38796. class TrueTypeCompiled extends CompiledFont {
  38797. constructor(glyphs, cmap, fontMatrix) {
  38798. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38799. this.glyphs = glyphs;
  38800. this.cmap = cmap;
  38801. }
  38802. compileGlyphImpl(code, cmds) {
  38803. compileGlyf(code, cmds, this);
  38804. }
  38805. }
  38806. class Type2Compiled extends CompiledFont {
  38807. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38808. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38809. this.glyphs = cffInfo.glyphs;
  38810. this.gsubrs = cffInfo.gsubrs || [];
  38811. this.subrs = cffInfo.subrs || [];
  38812. this.cmap = cmap;
  38813. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38814. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38815. this.subrsBias = getSubroutineBias(this.subrs);
  38816. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38817. this.fdSelect = cffInfo.fdSelect;
  38818. this.fdArray = cffInfo.fdArray;
  38819. }
  38820. compileGlyphImpl(code, cmds, glyphId) {
  38821. compileCharString(code, cmds, this, glyphId);
  38822. }
  38823. }
  38824. class FontRendererFactory {
  38825. static create(font, seacAnalysisEnabled) {
  38826. const data = new Uint8Array(font.data);
  38827. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38828. const numTables = getUint16(data, 4);
  38829. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38830. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38831. const offset = getUint32(data, p + 8);
  38832. const length = getUint32(data, p + 12);
  38833. switch (tag) {
  38834. case "cmap":
  38835. cmap = parseCmap(data, offset, offset + length);
  38836. break;
  38837. case "glyf":
  38838. glyf = data.subarray(offset, offset + length);
  38839. break;
  38840. case "loca":
  38841. loca = data.subarray(offset, offset + length);
  38842. break;
  38843. case "head":
  38844. unitsPerEm = getUint16(data, offset + 18);
  38845. indexToLocFormat = getUint16(data, offset + 50);
  38846. break;
  38847. case "CFF ":
  38848. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38849. break;
  38850. }
  38851. }
  38852. if (glyf) {
  38853. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38854. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38855. }
  38856. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38857. }
  38858. }
  38859. exports.FontRendererFactory = FontRendererFactory;
  38860. /***/ }),
  38861. /* 43 */
  38862. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38863. Object.defineProperty(exports, "__esModule", ({
  38864. value: true
  38865. }));
  38866. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38867. var _core_utils = __w_pdfjs_require__(4);
  38868. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38869. t.Courier = 600;
  38870. t["Courier-Bold"] = 600;
  38871. t["Courier-BoldOblique"] = 600;
  38872. t["Courier-Oblique"] = 600;
  38873. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38874. t.space = 278;
  38875. t.exclam = 278;
  38876. t.quotedbl = 355;
  38877. t.numbersign = 556;
  38878. t.dollar = 556;
  38879. t.percent = 889;
  38880. t.ampersand = 667;
  38881. t.quoteright = 222;
  38882. t.parenleft = 333;
  38883. t.parenright = 333;
  38884. t.asterisk = 389;
  38885. t.plus = 584;
  38886. t.comma = 278;
  38887. t.hyphen = 333;
  38888. t.period = 278;
  38889. t.slash = 278;
  38890. t.zero = 556;
  38891. t.one = 556;
  38892. t.two = 556;
  38893. t.three = 556;
  38894. t.four = 556;
  38895. t.five = 556;
  38896. t.six = 556;
  38897. t.seven = 556;
  38898. t.eight = 556;
  38899. t.nine = 556;
  38900. t.colon = 278;
  38901. t.semicolon = 278;
  38902. t.less = 584;
  38903. t.equal = 584;
  38904. t.greater = 584;
  38905. t.question = 556;
  38906. t.at = 1015;
  38907. t.A = 667;
  38908. t.B = 667;
  38909. t.C = 722;
  38910. t.D = 722;
  38911. t.E = 667;
  38912. t.F = 611;
  38913. t.G = 778;
  38914. t.H = 722;
  38915. t.I = 278;
  38916. t.J = 500;
  38917. t.K = 667;
  38918. t.L = 556;
  38919. t.M = 833;
  38920. t.N = 722;
  38921. t.O = 778;
  38922. t.P = 667;
  38923. t.Q = 778;
  38924. t.R = 722;
  38925. t.S = 667;
  38926. t.T = 611;
  38927. t.U = 722;
  38928. t.V = 667;
  38929. t.W = 944;
  38930. t.X = 667;
  38931. t.Y = 667;
  38932. t.Z = 611;
  38933. t.bracketleft = 278;
  38934. t.backslash = 278;
  38935. t.bracketright = 278;
  38936. t.asciicircum = 469;
  38937. t.underscore = 556;
  38938. t.quoteleft = 222;
  38939. t.a = 556;
  38940. t.b = 556;
  38941. t.c = 500;
  38942. t.d = 556;
  38943. t.e = 556;
  38944. t.f = 278;
  38945. t.g = 556;
  38946. t.h = 556;
  38947. t.i = 222;
  38948. t.j = 222;
  38949. t.k = 500;
  38950. t.l = 222;
  38951. t.m = 833;
  38952. t.n = 556;
  38953. t.o = 556;
  38954. t.p = 556;
  38955. t.q = 556;
  38956. t.r = 333;
  38957. t.s = 500;
  38958. t.t = 278;
  38959. t.u = 556;
  38960. t.v = 500;
  38961. t.w = 722;
  38962. t.x = 500;
  38963. t.y = 500;
  38964. t.z = 500;
  38965. t.braceleft = 334;
  38966. t.bar = 260;
  38967. t.braceright = 334;
  38968. t.asciitilde = 584;
  38969. t.exclamdown = 333;
  38970. t.cent = 556;
  38971. t.sterling = 556;
  38972. t.fraction = 167;
  38973. t.yen = 556;
  38974. t.florin = 556;
  38975. t.section = 556;
  38976. t.currency = 556;
  38977. t.quotesingle = 191;
  38978. t.quotedblleft = 333;
  38979. t.guillemotleft = 556;
  38980. t.guilsinglleft = 333;
  38981. t.guilsinglright = 333;
  38982. t.fi = 500;
  38983. t.fl = 500;
  38984. t.endash = 556;
  38985. t.dagger = 556;
  38986. t.daggerdbl = 556;
  38987. t.periodcentered = 278;
  38988. t.paragraph = 537;
  38989. t.bullet = 350;
  38990. t.quotesinglbase = 222;
  38991. t.quotedblbase = 333;
  38992. t.quotedblright = 333;
  38993. t.guillemotright = 556;
  38994. t.ellipsis = 1000;
  38995. t.perthousand = 1000;
  38996. t.questiondown = 611;
  38997. t.grave = 333;
  38998. t.acute = 333;
  38999. t.circumflex = 333;
  39000. t.tilde = 333;
  39001. t.macron = 333;
  39002. t.breve = 333;
  39003. t.dotaccent = 333;
  39004. t.dieresis = 333;
  39005. t.ring = 333;
  39006. t.cedilla = 333;
  39007. t.hungarumlaut = 333;
  39008. t.ogonek = 333;
  39009. t.caron = 333;
  39010. t.emdash = 1000;
  39011. t.AE = 1000;
  39012. t.ordfeminine = 370;
  39013. t.Lslash = 556;
  39014. t.Oslash = 778;
  39015. t.OE = 1000;
  39016. t.ordmasculine = 365;
  39017. t.ae = 889;
  39018. t.dotlessi = 278;
  39019. t.lslash = 222;
  39020. t.oslash = 611;
  39021. t.oe = 944;
  39022. t.germandbls = 611;
  39023. t.Idieresis = 278;
  39024. t.eacute = 556;
  39025. t.abreve = 556;
  39026. t.uhungarumlaut = 556;
  39027. t.ecaron = 556;
  39028. t.Ydieresis = 667;
  39029. t.divide = 584;
  39030. t.Yacute = 667;
  39031. t.Acircumflex = 667;
  39032. t.aacute = 556;
  39033. t.Ucircumflex = 722;
  39034. t.yacute = 500;
  39035. t.scommaaccent = 500;
  39036. t.ecircumflex = 556;
  39037. t.Uring = 722;
  39038. t.Udieresis = 722;
  39039. t.aogonek = 556;
  39040. t.Uacute = 722;
  39041. t.uogonek = 556;
  39042. t.Edieresis = 667;
  39043. t.Dcroat = 722;
  39044. t.commaaccent = 250;
  39045. t.copyright = 737;
  39046. t.Emacron = 667;
  39047. t.ccaron = 500;
  39048. t.aring = 556;
  39049. t.Ncommaaccent = 722;
  39050. t.lacute = 222;
  39051. t.agrave = 556;
  39052. t.Tcommaaccent = 611;
  39053. t.Cacute = 722;
  39054. t.atilde = 556;
  39055. t.Edotaccent = 667;
  39056. t.scaron = 500;
  39057. t.scedilla = 500;
  39058. t.iacute = 278;
  39059. t.lozenge = 471;
  39060. t.Rcaron = 722;
  39061. t.Gcommaaccent = 778;
  39062. t.ucircumflex = 556;
  39063. t.acircumflex = 556;
  39064. t.Amacron = 667;
  39065. t.rcaron = 333;
  39066. t.ccedilla = 500;
  39067. t.Zdotaccent = 611;
  39068. t.Thorn = 667;
  39069. t.Omacron = 778;
  39070. t.Racute = 722;
  39071. t.Sacute = 667;
  39072. t.dcaron = 643;
  39073. t.Umacron = 722;
  39074. t.uring = 556;
  39075. t.threesuperior = 333;
  39076. t.Ograve = 778;
  39077. t.Agrave = 667;
  39078. t.Abreve = 667;
  39079. t.multiply = 584;
  39080. t.uacute = 556;
  39081. t.Tcaron = 611;
  39082. t.partialdiff = 476;
  39083. t.ydieresis = 500;
  39084. t.Nacute = 722;
  39085. t.icircumflex = 278;
  39086. t.Ecircumflex = 667;
  39087. t.adieresis = 556;
  39088. t.edieresis = 556;
  39089. t.cacute = 500;
  39090. t.nacute = 556;
  39091. t.umacron = 556;
  39092. t.Ncaron = 722;
  39093. t.Iacute = 278;
  39094. t.plusminus = 584;
  39095. t.brokenbar = 260;
  39096. t.registered = 737;
  39097. t.Gbreve = 778;
  39098. t.Idotaccent = 278;
  39099. t.summation = 600;
  39100. t.Egrave = 667;
  39101. t.racute = 333;
  39102. t.omacron = 556;
  39103. t.Zacute = 611;
  39104. t.Zcaron = 611;
  39105. t.greaterequal = 549;
  39106. t.Eth = 722;
  39107. t.Ccedilla = 722;
  39108. t.lcommaaccent = 222;
  39109. t.tcaron = 317;
  39110. t.eogonek = 556;
  39111. t.Uogonek = 722;
  39112. t.Aacute = 667;
  39113. t.Adieresis = 667;
  39114. t.egrave = 556;
  39115. t.zacute = 500;
  39116. t.iogonek = 222;
  39117. t.Oacute = 778;
  39118. t.oacute = 556;
  39119. t.amacron = 556;
  39120. t.sacute = 500;
  39121. t.idieresis = 278;
  39122. t.Ocircumflex = 778;
  39123. t.Ugrave = 722;
  39124. t.Delta = 612;
  39125. t.thorn = 556;
  39126. t.twosuperior = 333;
  39127. t.Odieresis = 778;
  39128. t.mu = 556;
  39129. t.igrave = 278;
  39130. t.ohungarumlaut = 556;
  39131. t.Eogonek = 667;
  39132. t.dcroat = 556;
  39133. t.threequarters = 834;
  39134. t.Scedilla = 667;
  39135. t.lcaron = 299;
  39136. t.Kcommaaccent = 667;
  39137. t.Lacute = 556;
  39138. t.trademark = 1000;
  39139. t.edotaccent = 556;
  39140. t.Igrave = 278;
  39141. t.Imacron = 278;
  39142. t.Lcaron = 556;
  39143. t.onehalf = 834;
  39144. t.lessequal = 549;
  39145. t.ocircumflex = 556;
  39146. t.ntilde = 556;
  39147. t.Uhungarumlaut = 722;
  39148. t.Eacute = 667;
  39149. t.emacron = 556;
  39150. t.gbreve = 556;
  39151. t.onequarter = 834;
  39152. t.Scaron = 667;
  39153. t.Scommaaccent = 667;
  39154. t.Ohungarumlaut = 778;
  39155. t.degree = 400;
  39156. t.ograve = 556;
  39157. t.Ccaron = 722;
  39158. t.ugrave = 556;
  39159. t.radical = 453;
  39160. t.Dcaron = 722;
  39161. t.rcommaaccent = 333;
  39162. t.Ntilde = 722;
  39163. t.otilde = 556;
  39164. t.Rcommaaccent = 722;
  39165. t.Lcommaaccent = 556;
  39166. t.Atilde = 667;
  39167. t.Aogonek = 667;
  39168. t.Aring = 667;
  39169. t.Otilde = 778;
  39170. t.zdotaccent = 500;
  39171. t.Ecaron = 667;
  39172. t.Iogonek = 278;
  39173. t.kcommaaccent = 500;
  39174. t.minus = 584;
  39175. t.Icircumflex = 278;
  39176. t.ncaron = 556;
  39177. t.tcommaaccent = 278;
  39178. t.logicalnot = 584;
  39179. t.odieresis = 556;
  39180. t.udieresis = 556;
  39181. t.notequal = 549;
  39182. t.gcommaaccent = 556;
  39183. t.eth = 556;
  39184. t.zcaron = 500;
  39185. t.ncommaaccent = 556;
  39186. t.onesuperior = 333;
  39187. t.imacron = 278;
  39188. t.Euro = 556;
  39189. });
  39190. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39191. t.space = 278;
  39192. t.exclam = 333;
  39193. t.quotedbl = 474;
  39194. t.numbersign = 556;
  39195. t.dollar = 556;
  39196. t.percent = 889;
  39197. t.ampersand = 722;
  39198. t.quoteright = 278;
  39199. t.parenleft = 333;
  39200. t.parenright = 333;
  39201. t.asterisk = 389;
  39202. t.plus = 584;
  39203. t.comma = 278;
  39204. t.hyphen = 333;
  39205. t.period = 278;
  39206. t.slash = 278;
  39207. t.zero = 556;
  39208. t.one = 556;
  39209. t.two = 556;
  39210. t.three = 556;
  39211. t.four = 556;
  39212. t.five = 556;
  39213. t.six = 556;
  39214. t.seven = 556;
  39215. t.eight = 556;
  39216. t.nine = 556;
  39217. t.colon = 333;
  39218. t.semicolon = 333;
  39219. t.less = 584;
  39220. t.equal = 584;
  39221. t.greater = 584;
  39222. t.question = 611;
  39223. t.at = 975;
  39224. t.A = 722;
  39225. t.B = 722;
  39226. t.C = 722;
  39227. t.D = 722;
  39228. t.E = 667;
  39229. t.F = 611;
  39230. t.G = 778;
  39231. t.H = 722;
  39232. t.I = 278;
  39233. t.J = 556;
  39234. t.K = 722;
  39235. t.L = 611;
  39236. t.M = 833;
  39237. t.N = 722;
  39238. t.O = 778;
  39239. t.P = 667;
  39240. t.Q = 778;
  39241. t.R = 722;
  39242. t.S = 667;
  39243. t.T = 611;
  39244. t.U = 722;
  39245. t.V = 667;
  39246. t.W = 944;
  39247. t.X = 667;
  39248. t.Y = 667;
  39249. t.Z = 611;
  39250. t.bracketleft = 333;
  39251. t.backslash = 278;
  39252. t.bracketright = 333;
  39253. t.asciicircum = 584;
  39254. t.underscore = 556;
  39255. t.quoteleft = 278;
  39256. t.a = 556;
  39257. t.b = 611;
  39258. t.c = 556;
  39259. t.d = 611;
  39260. t.e = 556;
  39261. t.f = 333;
  39262. t.g = 611;
  39263. t.h = 611;
  39264. t.i = 278;
  39265. t.j = 278;
  39266. t.k = 556;
  39267. t.l = 278;
  39268. t.m = 889;
  39269. t.n = 611;
  39270. t.o = 611;
  39271. t.p = 611;
  39272. t.q = 611;
  39273. t.r = 389;
  39274. t.s = 556;
  39275. t.t = 333;
  39276. t.u = 611;
  39277. t.v = 556;
  39278. t.w = 778;
  39279. t.x = 556;
  39280. t.y = 556;
  39281. t.z = 500;
  39282. t.braceleft = 389;
  39283. t.bar = 280;
  39284. t.braceright = 389;
  39285. t.asciitilde = 584;
  39286. t.exclamdown = 333;
  39287. t.cent = 556;
  39288. t.sterling = 556;
  39289. t.fraction = 167;
  39290. t.yen = 556;
  39291. t.florin = 556;
  39292. t.section = 556;
  39293. t.currency = 556;
  39294. t.quotesingle = 238;
  39295. t.quotedblleft = 500;
  39296. t.guillemotleft = 556;
  39297. t.guilsinglleft = 333;
  39298. t.guilsinglright = 333;
  39299. t.fi = 611;
  39300. t.fl = 611;
  39301. t.endash = 556;
  39302. t.dagger = 556;
  39303. t.daggerdbl = 556;
  39304. t.periodcentered = 278;
  39305. t.paragraph = 556;
  39306. t.bullet = 350;
  39307. t.quotesinglbase = 278;
  39308. t.quotedblbase = 500;
  39309. t.quotedblright = 500;
  39310. t.guillemotright = 556;
  39311. t.ellipsis = 1000;
  39312. t.perthousand = 1000;
  39313. t.questiondown = 611;
  39314. t.grave = 333;
  39315. t.acute = 333;
  39316. t.circumflex = 333;
  39317. t.tilde = 333;
  39318. t.macron = 333;
  39319. t.breve = 333;
  39320. t.dotaccent = 333;
  39321. t.dieresis = 333;
  39322. t.ring = 333;
  39323. t.cedilla = 333;
  39324. t.hungarumlaut = 333;
  39325. t.ogonek = 333;
  39326. t.caron = 333;
  39327. t.emdash = 1000;
  39328. t.AE = 1000;
  39329. t.ordfeminine = 370;
  39330. t.Lslash = 611;
  39331. t.Oslash = 778;
  39332. t.OE = 1000;
  39333. t.ordmasculine = 365;
  39334. t.ae = 889;
  39335. t.dotlessi = 278;
  39336. t.lslash = 278;
  39337. t.oslash = 611;
  39338. t.oe = 944;
  39339. t.germandbls = 611;
  39340. t.Idieresis = 278;
  39341. t.eacute = 556;
  39342. t.abreve = 556;
  39343. t.uhungarumlaut = 611;
  39344. t.ecaron = 556;
  39345. t.Ydieresis = 667;
  39346. t.divide = 584;
  39347. t.Yacute = 667;
  39348. t.Acircumflex = 722;
  39349. t.aacute = 556;
  39350. t.Ucircumflex = 722;
  39351. t.yacute = 556;
  39352. t.scommaaccent = 556;
  39353. t.ecircumflex = 556;
  39354. t.Uring = 722;
  39355. t.Udieresis = 722;
  39356. t.aogonek = 556;
  39357. t.Uacute = 722;
  39358. t.uogonek = 611;
  39359. t.Edieresis = 667;
  39360. t.Dcroat = 722;
  39361. t.commaaccent = 250;
  39362. t.copyright = 737;
  39363. t.Emacron = 667;
  39364. t.ccaron = 556;
  39365. t.aring = 556;
  39366. t.Ncommaaccent = 722;
  39367. t.lacute = 278;
  39368. t.agrave = 556;
  39369. t.Tcommaaccent = 611;
  39370. t.Cacute = 722;
  39371. t.atilde = 556;
  39372. t.Edotaccent = 667;
  39373. t.scaron = 556;
  39374. t.scedilla = 556;
  39375. t.iacute = 278;
  39376. t.lozenge = 494;
  39377. t.Rcaron = 722;
  39378. t.Gcommaaccent = 778;
  39379. t.ucircumflex = 611;
  39380. t.acircumflex = 556;
  39381. t.Amacron = 722;
  39382. t.rcaron = 389;
  39383. t.ccedilla = 556;
  39384. t.Zdotaccent = 611;
  39385. t.Thorn = 667;
  39386. t.Omacron = 778;
  39387. t.Racute = 722;
  39388. t.Sacute = 667;
  39389. t.dcaron = 743;
  39390. t.Umacron = 722;
  39391. t.uring = 611;
  39392. t.threesuperior = 333;
  39393. t.Ograve = 778;
  39394. t.Agrave = 722;
  39395. t.Abreve = 722;
  39396. t.multiply = 584;
  39397. t.uacute = 611;
  39398. t.Tcaron = 611;
  39399. t.partialdiff = 494;
  39400. t.ydieresis = 556;
  39401. t.Nacute = 722;
  39402. t.icircumflex = 278;
  39403. t.Ecircumflex = 667;
  39404. t.adieresis = 556;
  39405. t.edieresis = 556;
  39406. t.cacute = 556;
  39407. t.nacute = 611;
  39408. t.umacron = 611;
  39409. t.Ncaron = 722;
  39410. t.Iacute = 278;
  39411. t.plusminus = 584;
  39412. t.brokenbar = 280;
  39413. t.registered = 737;
  39414. t.Gbreve = 778;
  39415. t.Idotaccent = 278;
  39416. t.summation = 600;
  39417. t.Egrave = 667;
  39418. t.racute = 389;
  39419. t.omacron = 611;
  39420. t.Zacute = 611;
  39421. t.Zcaron = 611;
  39422. t.greaterequal = 549;
  39423. t.Eth = 722;
  39424. t.Ccedilla = 722;
  39425. t.lcommaaccent = 278;
  39426. t.tcaron = 389;
  39427. t.eogonek = 556;
  39428. t.Uogonek = 722;
  39429. t.Aacute = 722;
  39430. t.Adieresis = 722;
  39431. t.egrave = 556;
  39432. t.zacute = 500;
  39433. t.iogonek = 278;
  39434. t.Oacute = 778;
  39435. t.oacute = 611;
  39436. t.amacron = 556;
  39437. t.sacute = 556;
  39438. t.idieresis = 278;
  39439. t.Ocircumflex = 778;
  39440. t.Ugrave = 722;
  39441. t.Delta = 612;
  39442. t.thorn = 611;
  39443. t.twosuperior = 333;
  39444. t.Odieresis = 778;
  39445. t.mu = 611;
  39446. t.igrave = 278;
  39447. t.ohungarumlaut = 611;
  39448. t.Eogonek = 667;
  39449. t.dcroat = 611;
  39450. t.threequarters = 834;
  39451. t.Scedilla = 667;
  39452. t.lcaron = 400;
  39453. t.Kcommaaccent = 722;
  39454. t.Lacute = 611;
  39455. t.trademark = 1000;
  39456. t.edotaccent = 556;
  39457. t.Igrave = 278;
  39458. t.Imacron = 278;
  39459. t.Lcaron = 611;
  39460. t.onehalf = 834;
  39461. t.lessequal = 549;
  39462. t.ocircumflex = 611;
  39463. t.ntilde = 611;
  39464. t.Uhungarumlaut = 722;
  39465. t.Eacute = 667;
  39466. t.emacron = 556;
  39467. t.gbreve = 611;
  39468. t.onequarter = 834;
  39469. t.Scaron = 667;
  39470. t.Scommaaccent = 667;
  39471. t.Ohungarumlaut = 778;
  39472. t.degree = 400;
  39473. t.ograve = 611;
  39474. t.Ccaron = 722;
  39475. t.ugrave = 611;
  39476. t.radical = 549;
  39477. t.Dcaron = 722;
  39478. t.rcommaaccent = 389;
  39479. t.Ntilde = 722;
  39480. t.otilde = 611;
  39481. t.Rcommaaccent = 722;
  39482. t.Lcommaaccent = 611;
  39483. t.Atilde = 722;
  39484. t.Aogonek = 722;
  39485. t.Aring = 722;
  39486. t.Otilde = 778;
  39487. t.zdotaccent = 500;
  39488. t.Ecaron = 667;
  39489. t.Iogonek = 278;
  39490. t.kcommaaccent = 556;
  39491. t.minus = 584;
  39492. t.Icircumflex = 278;
  39493. t.ncaron = 611;
  39494. t.tcommaaccent = 333;
  39495. t.logicalnot = 584;
  39496. t.odieresis = 611;
  39497. t.udieresis = 611;
  39498. t.notequal = 549;
  39499. t.gcommaaccent = 611;
  39500. t.eth = 611;
  39501. t.zcaron = 500;
  39502. t.ncommaaccent = 611;
  39503. t.onesuperior = 333;
  39504. t.imacron = 278;
  39505. t.Euro = 556;
  39506. });
  39507. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39508. t.space = 278;
  39509. t.exclam = 333;
  39510. t.quotedbl = 474;
  39511. t.numbersign = 556;
  39512. t.dollar = 556;
  39513. t.percent = 889;
  39514. t.ampersand = 722;
  39515. t.quoteright = 278;
  39516. t.parenleft = 333;
  39517. t.parenright = 333;
  39518. t.asterisk = 389;
  39519. t.plus = 584;
  39520. t.comma = 278;
  39521. t.hyphen = 333;
  39522. t.period = 278;
  39523. t.slash = 278;
  39524. t.zero = 556;
  39525. t.one = 556;
  39526. t.two = 556;
  39527. t.three = 556;
  39528. t.four = 556;
  39529. t.five = 556;
  39530. t.six = 556;
  39531. t.seven = 556;
  39532. t.eight = 556;
  39533. t.nine = 556;
  39534. t.colon = 333;
  39535. t.semicolon = 333;
  39536. t.less = 584;
  39537. t.equal = 584;
  39538. t.greater = 584;
  39539. t.question = 611;
  39540. t.at = 975;
  39541. t.A = 722;
  39542. t.B = 722;
  39543. t.C = 722;
  39544. t.D = 722;
  39545. t.E = 667;
  39546. t.F = 611;
  39547. t.G = 778;
  39548. t.H = 722;
  39549. t.I = 278;
  39550. t.J = 556;
  39551. t.K = 722;
  39552. t.L = 611;
  39553. t.M = 833;
  39554. t.N = 722;
  39555. t.O = 778;
  39556. t.P = 667;
  39557. t.Q = 778;
  39558. t.R = 722;
  39559. t.S = 667;
  39560. t.T = 611;
  39561. t.U = 722;
  39562. t.V = 667;
  39563. t.W = 944;
  39564. t.X = 667;
  39565. t.Y = 667;
  39566. t.Z = 611;
  39567. t.bracketleft = 333;
  39568. t.backslash = 278;
  39569. t.bracketright = 333;
  39570. t.asciicircum = 584;
  39571. t.underscore = 556;
  39572. t.quoteleft = 278;
  39573. t.a = 556;
  39574. t.b = 611;
  39575. t.c = 556;
  39576. t.d = 611;
  39577. t.e = 556;
  39578. t.f = 333;
  39579. t.g = 611;
  39580. t.h = 611;
  39581. t.i = 278;
  39582. t.j = 278;
  39583. t.k = 556;
  39584. t.l = 278;
  39585. t.m = 889;
  39586. t.n = 611;
  39587. t.o = 611;
  39588. t.p = 611;
  39589. t.q = 611;
  39590. t.r = 389;
  39591. t.s = 556;
  39592. t.t = 333;
  39593. t.u = 611;
  39594. t.v = 556;
  39595. t.w = 778;
  39596. t.x = 556;
  39597. t.y = 556;
  39598. t.z = 500;
  39599. t.braceleft = 389;
  39600. t.bar = 280;
  39601. t.braceright = 389;
  39602. t.asciitilde = 584;
  39603. t.exclamdown = 333;
  39604. t.cent = 556;
  39605. t.sterling = 556;
  39606. t.fraction = 167;
  39607. t.yen = 556;
  39608. t.florin = 556;
  39609. t.section = 556;
  39610. t.currency = 556;
  39611. t.quotesingle = 238;
  39612. t.quotedblleft = 500;
  39613. t.guillemotleft = 556;
  39614. t.guilsinglleft = 333;
  39615. t.guilsinglright = 333;
  39616. t.fi = 611;
  39617. t.fl = 611;
  39618. t.endash = 556;
  39619. t.dagger = 556;
  39620. t.daggerdbl = 556;
  39621. t.periodcentered = 278;
  39622. t.paragraph = 556;
  39623. t.bullet = 350;
  39624. t.quotesinglbase = 278;
  39625. t.quotedblbase = 500;
  39626. t.quotedblright = 500;
  39627. t.guillemotright = 556;
  39628. t.ellipsis = 1000;
  39629. t.perthousand = 1000;
  39630. t.questiondown = 611;
  39631. t.grave = 333;
  39632. t.acute = 333;
  39633. t.circumflex = 333;
  39634. t.tilde = 333;
  39635. t.macron = 333;
  39636. t.breve = 333;
  39637. t.dotaccent = 333;
  39638. t.dieresis = 333;
  39639. t.ring = 333;
  39640. t.cedilla = 333;
  39641. t.hungarumlaut = 333;
  39642. t.ogonek = 333;
  39643. t.caron = 333;
  39644. t.emdash = 1000;
  39645. t.AE = 1000;
  39646. t.ordfeminine = 370;
  39647. t.Lslash = 611;
  39648. t.Oslash = 778;
  39649. t.OE = 1000;
  39650. t.ordmasculine = 365;
  39651. t.ae = 889;
  39652. t.dotlessi = 278;
  39653. t.lslash = 278;
  39654. t.oslash = 611;
  39655. t.oe = 944;
  39656. t.germandbls = 611;
  39657. t.Idieresis = 278;
  39658. t.eacute = 556;
  39659. t.abreve = 556;
  39660. t.uhungarumlaut = 611;
  39661. t.ecaron = 556;
  39662. t.Ydieresis = 667;
  39663. t.divide = 584;
  39664. t.Yacute = 667;
  39665. t.Acircumflex = 722;
  39666. t.aacute = 556;
  39667. t.Ucircumflex = 722;
  39668. t.yacute = 556;
  39669. t.scommaaccent = 556;
  39670. t.ecircumflex = 556;
  39671. t.Uring = 722;
  39672. t.Udieresis = 722;
  39673. t.aogonek = 556;
  39674. t.Uacute = 722;
  39675. t.uogonek = 611;
  39676. t.Edieresis = 667;
  39677. t.Dcroat = 722;
  39678. t.commaaccent = 250;
  39679. t.copyright = 737;
  39680. t.Emacron = 667;
  39681. t.ccaron = 556;
  39682. t.aring = 556;
  39683. t.Ncommaaccent = 722;
  39684. t.lacute = 278;
  39685. t.agrave = 556;
  39686. t.Tcommaaccent = 611;
  39687. t.Cacute = 722;
  39688. t.atilde = 556;
  39689. t.Edotaccent = 667;
  39690. t.scaron = 556;
  39691. t.scedilla = 556;
  39692. t.iacute = 278;
  39693. t.lozenge = 494;
  39694. t.Rcaron = 722;
  39695. t.Gcommaaccent = 778;
  39696. t.ucircumflex = 611;
  39697. t.acircumflex = 556;
  39698. t.Amacron = 722;
  39699. t.rcaron = 389;
  39700. t.ccedilla = 556;
  39701. t.Zdotaccent = 611;
  39702. t.Thorn = 667;
  39703. t.Omacron = 778;
  39704. t.Racute = 722;
  39705. t.Sacute = 667;
  39706. t.dcaron = 743;
  39707. t.Umacron = 722;
  39708. t.uring = 611;
  39709. t.threesuperior = 333;
  39710. t.Ograve = 778;
  39711. t.Agrave = 722;
  39712. t.Abreve = 722;
  39713. t.multiply = 584;
  39714. t.uacute = 611;
  39715. t.Tcaron = 611;
  39716. t.partialdiff = 494;
  39717. t.ydieresis = 556;
  39718. t.Nacute = 722;
  39719. t.icircumflex = 278;
  39720. t.Ecircumflex = 667;
  39721. t.adieresis = 556;
  39722. t.edieresis = 556;
  39723. t.cacute = 556;
  39724. t.nacute = 611;
  39725. t.umacron = 611;
  39726. t.Ncaron = 722;
  39727. t.Iacute = 278;
  39728. t.plusminus = 584;
  39729. t.brokenbar = 280;
  39730. t.registered = 737;
  39731. t.Gbreve = 778;
  39732. t.Idotaccent = 278;
  39733. t.summation = 600;
  39734. t.Egrave = 667;
  39735. t.racute = 389;
  39736. t.omacron = 611;
  39737. t.Zacute = 611;
  39738. t.Zcaron = 611;
  39739. t.greaterequal = 549;
  39740. t.Eth = 722;
  39741. t.Ccedilla = 722;
  39742. t.lcommaaccent = 278;
  39743. t.tcaron = 389;
  39744. t.eogonek = 556;
  39745. t.Uogonek = 722;
  39746. t.Aacute = 722;
  39747. t.Adieresis = 722;
  39748. t.egrave = 556;
  39749. t.zacute = 500;
  39750. t.iogonek = 278;
  39751. t.Oacute = 778;
  39752. t.oacute = 611;
  39753. t.amacron = 556;
  39754. t.sacute = 556;
  39755. t.idieresis = 278;
  39756. t.Ocircumflex = 778;
  39757. t.Ugrave = 722;
  39758. t.Delta = 612;
  39759. t.thorn = 611;
  39760. t.twosuperior = 333;
  39761. t.Odieresis = 778;
  39762. t.mu = 611;
  39763. t.igrave = 278;
  39764. t.ohungarumlaut = 611;
  39765. t.Eogonek = 667;
  39766. t.dcroat = 611;
  39767. t.threequarters = 834;
  39768. t.Scedilla = 667;
  39769. t.lcaron = 400;
  39770. t.Kcommaaccent = 722;
  39771. t.Lacute = 611;
  39772. t.trademark = 1000;
  39773. t.edotaccent = 556;
  39774. t.Igrave = 278;
  39775. t.Imacron = 278;
  39776. t.Lcaron = 611;
  39777. t.onehalf = 834;
  39778. t.lessequal = 549;
  39779. t.ocircumflex = 611;
  39780. t.ntilde = 611;
  39781. t.Uhungarumlaut = 722;
  39782. t.Eacute = 667;
  39783. t.emacron = 556;
  39784. t.gbreve = 611;
  39785. t.onequarter = 834;
  39786. t.Scaron = 667;
  39787. t.Scommaaccent = 667;
  39788. t.Ohungarumlaut = 778;
  39789. t.degree = 400;
  39790. t.ograve = 611;
  39791. t.Ccaron = 722;
  39792. t.ugrave = 611;
  39793. t.radical = 549;
  39794. t.Dcaron = 722;
  39795. t.rcommaaccent = 389;
  39796. t.Ntilde = 722;
  39797. t.otilde = 611;
  39798. t.Rcommaaccent = 722;
  39799. t.Lcommaaccent = 611;
  39800. t.Atilde = 722;
  39801. t.Aogonek = 722;
  39802. t.Aring = 722;
  39803. t.Otilde = 778;
  39804. t.zdotaccent = 500;
  39805. t.Ecaron = 667;
  39806. t.Iogonek = 278;
  39807. t.kcommaaccent = 556;
  39808. t.minus = 584;
  39809. t.Icircumflex = 278;
  39810. t.ncaron = 611;
  39811. t.tcommaaccent = 333;
  39812. t.logicalnot = 584;
  39813. t.odieresis = 611;
  39814. t.udieresis = 611;
  39815. t.notequal = 549;
  39816. t.gcommaaccent = 611;
  39817. t.eth = 611;
  39818. t.zcaron = 500;
  39819. t.ncommaaccent = 611;
  39820. t.onesuperior = 333;
  39821. t.imacron = 278;
  39822. t.Euro = 556;
  39823. });
  39824. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39825. t.space = 278;
  39826. t.exclam = 278;
  39827. t.quotedbl = 355;
  39828. t.numbersign = 556;
  39829. t.dollar = 556;
  39830. t.percent = 889;
  39831. t.ampersand = 667;
  39832. t.quoteright = 222;
  39833. t.parenleft = 333;
  39834. t.parenright = 333;
  39835. t.asterisk = 389;
  39836. t.plus = 584;
  39837. t.comma = 278;
  39838. t.hyphen = 333;
  39839. t.period = 278;
  39840. t.slash = 278;
  39841. t.zero = 556;
  39842. t.one = 556;
  39843. t.two = 556;
  39844. t.three = 556;
  39845. t.four = 556;
  39846. t.five = 556;
  39847. t.six = 556;
  39848. t.seven = 556;
  39849. t.eight = 556;
  39850. t.nine = 556;
  39851. t.colon = 278;
  39852. t.semicolon = 278;
  39853. t.less = 584;
  39854. t.equal = 584;
  39855. t.greater = 584;
  39856. t.question = 556;
  39857. t.at = 1015;
  39858. t.A = 667;
  39859. t.B = 667;
  39860. t.C = 722;
  39861. t.D = 722;
  39862. t.E = 667;
  39863. t.F = 611;
  39864. t.G = 778;
  39865. t.H = 722;
  39866. t.I = 278;
  39867. t.J = 500;
  39868. t.K = 667;
  39869. t.L = 556;
  39870. t.M = 833;
  39871. t.N = 722;
  39872. t.O = 778;
  39873. t.P = 667;
  39874. t.Q = 778;
  39875. t.R = 722;
  39876. t.S = 667;
  39877. t.T = 611;
  39878. t.U = 722;
  39879. t.V = 667;
  39880. t.W = 944;
  39881. t.X = 667;
  39882. t.Y = 667;
  39883. t.Z = 611;
  39884. t.bracketleft = 278;
  39885. t.backslash = 278;
  39886. t.bracketright = 278;
  39887. t.asciicircum = 469;
  39888. t.underscore = 556;
  39889. t.quoteleft = 222;
  39890. t.a = 556;
  39891. t.b = 556;
  39892. t.c = 500;
  39893. t.d = 556;
  39894. t.e = 556;
  39895. t.f = 278;
  39896. t.g = 556;
  39897. t.h = 556;
  39898. t.i = 222;
  39899. t.j = 222;
  39900. t.k = 500;
  39901. t.l = 222;
  39902. t.m = 833;
  39903. t.n = 556;
  39904. t.o = 556;
  39905. t.p = 556;
  39906. t.q = 556;
  39907. t.r = 333;
  39908. t.s = 500;
  39909. t.t = 278;
  39910. t.u = 556;
  39911. t.v = 500;
  39912. t.w = 722;
  39913. t.x = 500;
  39914. t.y = 500;
  39915. t.z = 500;
  39916. t.braceleft = 334;
  39917. t.bar = 260;
  39918. t.braceright = 334;
  39919. t.asciitilde = 584;
  39920. t.exclamdown = 333;
  39921. t.cent = 556;
  39922. t.sterling = 556;
  39923. t.fraction = 167;
  39924. t.yen = 556;
  39925. t.florin = 556;
  39926. t.section = 556;
  39927. t.currency = 556;
  39928. t.quotesingle = 191;
  39929. t.quotedblleft = 333;
  39930. t.guillemotleft = 556;
  39931. t.guilsinglleft = 333;
  39932. t.guilsinglright = 333;
  39933. t.fi = 500;
  39934. t.fl = 500;
  39935. t.endash = 556;
  39936. t.dagger = 556;
  39937. t.daggerdbl = 556;
  39938. t.periodcentered = 278;
  39939. t.paragraph = 537;
  39940. t.bullet = 350;
  39941. t.quotesinglbase = 222;
  39942. t.quotedblbase = 333;
  39943. t.quotedblright = 333;
  39944. t.guillemotright = 556;
  39945. t.ellipsis = 1000;
  39946. t.perthousand = 1000;
  39947. t.questiondown = 611;
  39948. t.grave = 333;
  39949. t.acute = 333;
  39950. t.circumflex = 333;
  39951. t.tilde = 333;
  39952. t.macron = 333;
  39953. t.breve = 333;
  39954. t.dotaccent = 333;
  39955. t.dieresis = 333;
  39956. t.ring = 333;
  39957. t.cedilla = 333;
  39958. t.hungarumlaut = 333;
  39959. t.ogonek = 333;
  39960. t.caron = 333;
  39961. t.emdash = 1000;
  39962. t.AE = 1000;
  39963. t.ordfeminine = 370;
  39964. t.Lslash = 556;
  39965. t.Oslash = 778;
  39966. t.OE = 1000;
  39967. t.ordmasculine = 365;
  39968. t.ae = 889;
  39969. t.dotlessi = 278;
  39970. t.lslash = 222;
  39971. t.oslash = 611;
  39972. t.oe = 944;
  39973. t.germandbls = 611;
  39974. t.Idieresis = 278;
  39975. t.eacute = 556;
  39976. t.abreve = 556;
  39977. t.uhungarumlaut = 556;
  39978. t.ecaron = 556;
  39979. t.Ydieresis = 667;
  39980. t.divide = 584;
  39981. t.Yacute = 667;
  39982. t.Acircumflex = 667;
  39983. t.aacute = 556;
  39984. t.Ucircumflex = 722;
  39985. t.yacute = 500;
  39986. t.scommaaccent = 500;
  39987. t.ecircumflex = 556;
  39988. t.Uring = 722;
  39989. t.Udieresis = 722;
  39990. t.aogonek = 556;
  39991. t.Uacute = 722;
  39992. t.uogonek = 556;
  39993. t.Edieresis = 667;
  39994. t.Dcroat = 722;
  39995. t.commaaccent = 250;
  39996. t.copyright = 737;
  39997. t.Emacron = 667;
  39998. t.ccaron = 500;
  39999. t.aring = 556;
  40000. t.Ncommaaccent = 722;
  40001. t.lacute = 222;
  40002. t.agrave = 556;
  40003. t.Tcommaaccent = 611;
  40004. t.Cacute = 722;
  40005. t.atilde = 556;
  40006. t.Edotaccent = 667;
  40007. t.scaron = 500;
  40008. t.scedilla = 500;
  40009. t.iacute = 278;
  40010. t.lozenge = 471;
  40011. t.Rcaron = 722;
  40012. t.Gcommaaccent = 778;
  40013. t.ucircumflex = 556;
  40014. t.acircumflex = 556;
  40015. t.Amacron = 667;
  40016. t.rcaron = 333;
  40017. t.ccedilla = 500;
  40018. t.Zdotaccent = 611;
  40019. t.Thorn = 667;
  40020. t.Omacron = 778;
  40021. t.Racute = 722;
  40022. t.Sacute = 667;
  40023. t.dcaron = 643;
  40024. t.Umacron = 722;
  40025. t.uring = 556;
  40026. t.threesuperior = 333;
  40027. t.Ograve = 778;
  40028. t.Agrave = 667;
  40029. t.Abreve = 667;
  40030. t.multiply = 584;
  40031. t.uacute = 556;
  40032. t.Tcaron = 611;
  40033. t.partialdiff = 476;
  40034. t.ydieresis = 500;
  40035. t.Nacute = 722;
  40036. t.icircumflex = 278;
  40037. t.Ecircumflex = 667;
  40038. t.adieresis = 556;
  40039. t.edieresis = 556;
  40040. t.cacute = 500;
  40041. t.nacute = 556;
  40042. t.umacron = 556;
  40043. t.Ncaron = 722;
  40044. t.Iacute = 278;
  40045. t.plusminus = 584;
  40046. t.brokenbar = 260;
  40047. t.registered = 737;
  40048. t.Gbreve = 778;
  40049. t.Idotaccent = 278;
  40050. t.summation = 600;
  40051. t.Egrave = 667;
  40052. t.racute = 333;
  40053. t.omacron = 556;
  40054. t.Zacute = 611;
  40055. t.Zcaron = 611;
  40056. t.greaterequal = 549;
  40057. t.Eth = 722;
  40058. t.Ccedilla = 722;
  40059. t.lcommaaccent = 222;
  40060. t.tcaron = 317;
  40061. t.eogonek = 556;
  40062. t.Uogonek = 722;
  40063. t.Aacute = 667;
  40064. t.Adieresis = 667;
  40065. t.egrave = 556;
  40066. t.zacute = 500;
  40067. t.iogonek = 222;
  40068. t.Oacute = 778;
  40069. t.oacute = 556;
  40070. t.amacron = 556;
  40071. t.sacute = 500;
  40072. t.idieresis = 278;
  40073. t.Ocircumflex = 778;
  40074. t.Ugrave = 722;
  40075. t.Delta = 612;
  40076. t.thorn = 556;
  40077. t.twosuperior = 333;
  40078. t.Odieresis = 778;
  40079. t.mu = 556;
  40080. t.igrave = 278;
  40081. t.ohungarumlaut = 556;
  40082. t.Eogonek = 667;
  40083. t.dcroat = 556;
  40084. t.threequarters = 834;
  40085. t.Scedilla = 667;
  40086. t.lcaron = 299;
  40087. t.Kcommaaccent = 667;
  40088. t.Lacute = 556;
  40089. t.trademark = 1000;
  40090. t.edotaccent = 556;
  40091. t.Igrave = 278;
  40092. t.Imacron = 278;
  40093. t.Lcaron = 556;
  40094. t.onehalf = 834;
  40095. t.lessequal = 549;
  40096. t.ocircumflex = 556;
  40097. t.ntilde = 556;
  40098. t.Uhungarumlaut = 722;
  40099. t.Eacute = 667;
  40100. t.emacron = 556;
  40101. t.gbreve = 556;
  40102. t.onequarter = 834;
  40103. t.Scaron = 667;
  40104. t.Scommaaccent = 667;
  40105. t.Ohungarumlaut = 778;
  40106. t.degree = 400;
  40107. t.ograve = 556;
  40108. t.Ccaron = 722;
  40109. t.ugrave = 556;
  40110. t.radical = 453;
  40111. t.Dcaron = 722;
  40112. t.rcommaaccent = 333;
  40113. t.Ntilde = 722;
  40114. t.otilde = 556;
  40115. t.Rcommaaccent = 722;
  40116. t.Lcommaaccent = 556;
  40117. t.Atilde = 667;
  40118. t.Aogonek = 667;
  40119. t.Aring = 667;
  40120. t.Otilde = 778;
  40121. t.zdotaccent = 500;
  40122. t.Ecaron = 667;
  40123. t.Iogonek = 278;
  40124. t.kcommaaccent = 500;
  40125. t.minus = 584;
  40126. t.Icircumflex = 278;
  40127. t.ncaron = 556;
  40128. t.tcommaaccent = 278;
  40129. t.logicalnot = 584;
  40130. t.odieresis = 556;
  40131. t.udieresis = 556;
  40132. t.notequal = 549;
  40133. t.gcommaaccent = 556;
  40134. t.eth = 556;
  40135. t.zcaron = 500;
  40136. t.ncommaaccent = 556;
  40137. t.onesuperior = 333;
  40138. t.imacron = 278;
  40139. t.Euro = 556;
  40140. });
  40141. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  40142. t.space = 250;
  40143. t.exclam = 333;
  40144. t.universal = 713;
  40145. t.numbersign = 500;
  40146. t.existential = 549;
  40147. t.percent = 833;
  40148. t.ampersand = 778;
  40149. t.suchthat = 439;
  40150. t.parenleft = 333;
  40151. t.parenright = 333;
  40152. t.asteriskmath = 500;
  40153. t.plus = 549;
  40154. t.comma = 250;
  40155. t.minus = 549;
  40156. t.period = 250;
  40157. t.slash = 278;
  40158. t.zero = 500;
  40159. t.one = 500;
  40160. t.two = 500;
  40161. t.three = 500;
  40162. t.four = 500;
  40163. t.five = 500;
  40164. t.six = 500;
  40165. t.seven = 500;
  40166. t.eight = 500;
  40167. t.nine = 500;
  40168. t.colon = 278;
  40169. t.semicolon = 278;
  40170. t.less = 549;
  40171. t.equal = 549;
  40172. t.greater = 549;
  40173. t.question = 444;
  40174. t.congruent = 549;
  40175. t.Alpha = 722;
  40176. t.Beta = 667;
  40177. t.Chi = 722;
  40178. t.Delta = 612;
  40179. t.Epsilon = 611;
  40180. t.Phi = 763;
  40181. t.Gamma = 603;
  40182. t.Eta = 722;
  40183. t.Iota = 333;
  40184. t.theta1 = 631;
  40185. t.Kappa = 722;
  40186. t.Lambda = 686;
  40187. t.Mu = 889;
  40188. t.Nu = 722;
  40189. t.Omicron = 722;
  40190. t.Pi = 768;
  40191. t.Theta = 741;
  40192. t.Rho = 556;
  40193. t.Sigma = 592;
  40194. t.Tau = 611;
  40195. t.Upsilon = 690;
  40196. t.sigma1 = 439;
  40197. t.Omega = 768;
  40198. t.Xi = 645;
  40199. t.Psi = 795;
  40200. t.Zeta = 611;
  40201. t.bracketleft = 333;
  40202. t.therefore = 863;
  40203. t.bracketright = 333;
  40204. t.perpendicular = 658;
  40205. t.underscore = 500;
  40206. t.radicalex = 500;
  40207. t.alpha = 631;
  40208. t.beta = 549;
  40209. t.chi = 549;
  40210. t.delta = 494;
  40211. t.epsilon = 439;
  40212. t.phi = 521;
  40213. t.gamma = 411;
  40214. t.eta = 603;
  40215. t.iota = 329;
  40216. t.phi1 = 603;
  40217. t.kappa = 549;
  40218. t.lambda = 549;
  40219. t.mu = 576;
  40220. t.nu = 521;
  40221. t.omicron = 549;
  40222. t.pi = 549;
  40223. t.theta = 521;
  40224. t.rho = 549;
  40225. t.sigma = 603;
  40226. t.tau = 439;
  40227. t.upsilon = 576;
  40228. t.omega1 = 713;
  40229. t.omega = 686;
  40230. t.xi = 493;
  40231. t.psi = 686;
  40232. t.zeta = 494;
  40233. t.braceleft = 480;
  40234. t.bar = 200;
  40235. t.braceright = 480;
  40236. t.similar = 549;
  40237. t.Euro = 750;
  40238. t.Upsilon1 = 620;
  40239. t.minute = 247;
  40240. t.lessequal = 549;
  40241. t.fraction = 167;
  40242. t.infinity = 713;
  40243. t.florin = 500;
  40244. t.club = 753;
  40245. t.diamond = 753;
  40246. t.heart = 753;
  40247. t.spade = 753;
  40248. t.arrowboth = 1042;
  40249. t.arrowleft = 987;
  40250. t.arrowup = 603;
  40251. t.arrowright = 987;
  40252. t.arrowdown = 603;
  40253. t.degree = 400;
  40254. t.plusminus = 549;
  40255. t.second = 411;
  40256. t.greaterequal = 549;
  40257. t.multiply = 549;
  40258. t.proportional = 713;
  40259. t.partialdiff = 494;
  40260. t.bullet = 460;
  40261. t.divide = 549;
  40262. t.notequal = 549;
  40263. t.equivalence = 549;
  40264. t.approxequal = 549;
  40265. t.ellipsis = 1000;
  40266. t.arrowvertex = 603;
  40267. t.arrowhorizex = 1000;
  40268. t.carriagereturn = 658;
  40269. t.aleph = 823;
  40270. t.Ifraktur = 686;
  40271. t.Rfraktur = 795;
  40272. t.weierstrass = 987;
  40273. t.circlemultiply = 768;
  40274. t.circleplus = 768;
  40275. t.emptyset = 823;
  40276. t.intersection = 768;
  40277. t.union = 768;
  40278. t.propersuperset = 713;
  40279. t.reflexsuperset = 713;
  40280. t.notsubset = 713;
  40281. t.propersubset = 713;
  40282. t.reflexsubset = 713;
  40283. t.element = 713;
  40284. t.notelement = 713;
  40285. t.angle = 768;
  40286. t.gradient = 713;
  40287. t.registerserif = 790;
  40288. t.copyrightserif = 790;
  40289. t.trademarkserif = 890;
  40290. t.product = 823;
  40291. t.radical = 549;
  40292. t.dotmath = 250;
  40293. t.logicalnot = 713;
  40294. t.logicaland = 603;
  40295. t.logicalor = 603;
  40296. t.arrowdblboth = 1042;
  40297. t.arrowdblleft = 987;
  40298. t.arrowdblup = 603;
  40299. t.arrowdblright = 987;
  40300. t.arrowdbldown = 603;
  40301. t.lozenge = 494;
  40302. t.angleleft = 329;
  40303. t.registersans = 790;
  40304. t.copyrightsans = 790;
  40305. t.trademarksans = 786;
  40306. t.summation = 713;
  40307. t.parenlefttp = 384;
  40308. t.parenleftex = 384;
  40309. t.parenleftbt = 384;
  40310. t.bracketlefttp = 384;
  40311. t.bracketleftex = 384;
  40312. t.bracketleftbt = 384;
  40313. t.bracelefttp = 494;
  40314. t.braceleftmid = 494;
  40315. t.braceleftbt = 494;
  40316. t.braceex = 494;
  40317. t.angleright = 329;
  40318. t.integral = 274;
  40319. t.integraltp = 686;
  40320. t.integralex = 686;
  40321. t.integralbt = 686;
  40322. t.parenrighttp = 384;
  40323. t.parenrightex = 384;
  40324. t.parenrightbt = 384;
  40325. t.bracketrighttp = 384;
  40326. t.bracketrightex = 384;
  40327. t.bracketrightbt = 384;
  40328. t.bracerighttp = 494;
  40329. t.bracerightmid = 494;
  40330. t.bracerightbt = 494;
  40331. t.apple = 790;
  40332. });
  40333. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40334. t.space = 250;
  40335. t.exclam = 333;
  40336. t.quotedbl = 408;
  40337. t.numbersign = 500;
  40338. t.dollar = 500;
  40339. t.percent = 833;
  40340. t.ampersand = 778;
  40341. t.quoteright = 333;
  40342. t.parenleft = 333;
  40343. t.parenright = 333;
  40344. t.asterisk = 500;
  40345. t.plus = 564;
  40346. t.comma = 250;
  40347. t.hyphen = 333;
  40348. t.period = 250;
  40349. t.slash = 278;
  40350. t.zero = 500;
  40351. t.one = 500;
  40352. t.two = 500;
  40353. t.three = 500;
  40354. t.four = 500;
  40355. t.five = 500;
  40356. t.six = 500;
  40357. t.seven = 500;
  40358. t.eight = 500;
  40359. t.nine = 500;
  40360. t.colon = 278;
  40361. t.semicolon = 278;
  40362. t.less = 564;
  40363. t.equal = 564;
  40364. t.greater = 564;
  40365. t.question = 444;
  40366. t.at = 921;
  40367. t.A = 722;
  40368. t.B = 667;
  40369. t.C = 667;
  40370. t.D = 722;
  40371. t.E = 611;
  40372. t.F = 556;
  40373. t.G = 722;
  40374. t.H = 722;
  40375. t.I = 333;
  40376. t.J = 389;
  40377. t.K = 722;
  40378. t.L = 611;
  40379. t.M = 889;
  40380. t.N = 722;
  40381. t.O = 722;
  40382. t.P = 556;
  40383. t.Q = 722;
  40384. t.R = 667;
  40385. t.S = 556;
  40386. t.T = 611;
  40387. t.U = 722;
  40388. t.V = 722;
  40389. t.W = 944;
  40390. t.X = 722;
  40391. t.Y = 722;
  40392. t.Z = 611;
  40393. t.bracketleft = 333;
  40394. t.backslash = 278;
  40395. t.bracketright = 333;
  40396. t.asciicircum = 469;
  40397. t.underscore = 500;
  40398. t.quoteleft = 333;
  40399. t.a = 444;
  40400. t.b = 500;
  40401. t.c = 444;
  40402. t.d = 500;
  40403. t.e = 444;
  40404. t.f = 333;
  40405. t.g = 500;
  40406. t.h = 500;
  40407. t.i = 278;
  40408. t.j = 278;
  40409. t.k = 500;
  40410. t.l = 278;
  40411. t.m = 778;
  40412. t.n = 500;
  40413. t.o = 500;
  40414. t.p = 500;
  40415. t.q = 500;
  40416. t.r = 333;
  40417. t.s = 389;
  40418. t.t = 278;
  40419. t.u = 500;
  40420. t.v = 500;
  40421. t.w = 722;
  40422. t.x = 500;
  40423. t.y = 500;
  40424. t.z = 444;
  40425. t.braceleft = 480;
  40426. t.bar = 200;
  40427. t.braceright = 480;
  40428. t.asciitilde = 541;
  40429. t.exclamdown = 333;
  40430. t.cent = 500;
  40431. t.sterling = 500;
  40432. t.fraction = 167;
  40433. t.yen = 500;
  40434. t.florin = 500;
  40435. t.section = 500;
  40436. t.currency = 500;
  40437. t.quotesingle = 180;
  40438. t.quotedblleft = 444;
  40439. t.guillemotleft = 500;
  40440. t.guilsinglleft = 333;
  40441. t.guilsinglright = 333;
  40442. t.fi = 556;
  40443. t.fl = 556;
  40444. t.endash = 500;
  40445. t.dagger = 500;
  40446. t.daggerdbl = 500;
  40447. t.periodcentered = 250;
  40448. t.paragraph = 453;
  40449. t.bullet = 350;
  40450. t.quotesinglbase = 333;
  40451. t.quotedblbase = 444;
  40452. t.quotedblright = 444;
  40453. t.guillemotright = 500;
  40454. t.ellipsis = 1000;
  40455. t.perthousand = 1000;
  40456. t.questiondown = 444;
  40457. t.grave = 333;
  40458. t.acute = 333;
  40459. t.circumflex = 333;
  40460. t.tilde = 333;
  40461. t.macron = 333;
  40462. t.breve = 333;
  40463. t.dotaccent = 333;
  40464. t.dieresis = 333;
  40465. t.ring = 333;
  40466. t.cedilla = 333;
  40467. t.hungarumlaut = 333;
  40468. t.ogonek = 333;
  40469. t.caron = 333;
  40470. t.emdash = 1000;
  40471. t.AE = 889;
  40472. t.ordfeminine = 276;
  40473. t.Lslash = 611;
  40474. t.Oslash = 722;
  40475. t.OE = 889;
  40476. t.ordmasculine = 310;
  40477. t.ae = 667;
  40478. t.dotlessi = 278;
  40479. t.lslash = 278;
  40480. t.oslash = 500;
  40481. t.oe = 722;
  40482. t.germandbls = 500;
  40483. t.Idieresis = 333;
  40484. t.eacute = 444;
  40485. t.abreve = 444;
  40486. t.uhungarumlaut = 500;
  40487. t.ecaron = 444;
  40488. t.Ydieresis = 722;
  40489. t.divide = 564;
  40490. t.Yacute = 722;
  40491. t.Acircumflex = 722;
  40492. t.aacute = 444;
  40493. t.Ucircumflex = 722;
  40494. t.yacute = 500;
  40495. t.scommaaccent = 389;
  40496. t.ecircumflex = 444;
  40497. t.Uring = 722;
  40498. t.Udieresis = 722;
  40499. t.aogonek = 444;
  40500. t.Uacute = 722;
  40501. t.uogonek = 500;
  40502. t.Edieresis = 611;
  40503. t.Dcroat = 722;
  40504. t.commaaccent = 250;
  40505. t.copyright = 760;
  40506. t.Emacron = 611;
  40507. t.ccaron = 444;
  40508. t.aring = 444;
  40509. t.Ncommaaccent = 722;
  40510. t.lacute = 278;
  40511. t.agrave = 444;
  40512. t.Tcommaaccent = 611;
  40513. t.Cacute = 667;
  40514. t.atilde = 444;
  40515. t.Edotaccent = 611;
  40516. t.scaron = 389;
  40517. t.scedilla = 389;
  40518. t.iacute = 278;
  40519. t.lozenge = 471;
  40520. t.Rcaron = 667;
  40521. t.Gcommaaccent = 722;
  40522. t.ucircumflex = 500;
  40523. t.acircumflex = 444;
  40524. t.Amacron = 722;
  40525. t.rcaron = 333;
  40526. t.ccedilla = 444;
  40527. t.Zdotaccent = 611;
  40528. t.Thorn = 556;
  40529. t.Omacron = 722;
  40530. t.Racute = 667;
  40531. t.Sacute = 556;
  40532. t.dcaron = 588;
  40533. t.Umacron = 722;
  40534. t.uring = 500;
  40535. t.threesuperior = 300;
  40536. t.Ograve = 722;
  40537. t.Agrave = 722;
  40538. t.Abreve = 722;
  40539. t.multiply = 564;
  40540. t.uacute = 500;
  40541. t.Tcaron = 611;
  40542. t.partialdiff = 476;
  40543. t.ydieresis = 500;
  40544. t.Nacute = 722;
  40545. t.icircumflex = 278;
  40546. t.Ecircumflex = 611;
  40547. t.adieresis = 444;
  40548. t.edieresis = 444;
  40549. t.cacute = 444;
  40550. t.nacute = 500;
  40551. t.umacron = 500;
  40552. t.Ncaron = 722;
  40553. t.Iacute = 333;
  40554. t.plusminus = 564;
  40555. t.brokenbar = 200;
  40556. t.registered = 760;
  40557. t.Gbreve = 722;
  40558. t.Idotaccent = 333;
  40559. t.summation = 600;
  40560. t.Egrave = 611;
  40561. t.racute = 333;
  40562. t.omacron = 500;
  40563. t.Zacute = 611;
  40564. t.Zcaron = 611;
  40565. t.greaterequal = 549;
  40566. t.Eth = 722;
  40567. t.Ccedilla = 667;
  40568. t.lcommaaccent = 278;
  40569. t.tcaron = 326;
  40570. t.eogonek = 444;
  40571. t.Uogonek = 722;
  40572. t.Aacute = 722;
  40573. t.Adieresis = 722;
  40574. t.egrave = 444;
  40575. t.zacute = 444;
  40576. t.iogonek = 278;
  40577. t.Oacute = 722;
  40578. t.oacute = 500;
  40579. t.amacron = 444;
  40580. t.sacute = 389;
  40581. t.idieresis = 278;
  40582. t.Ocircumflex = 722;
  40583. t.Ugrave = 722;
  40584. t.Delta = 612;
  40585. t.thorn = 500;
  40586. t.twosuperior = 300;
  40587. t.Odieresis = 722;
  40588. t.mu = 500;
  40589. t.igrave = 278;
  40590. t.ohungarumlaut = 500;
  40591. t.Eogonek = 611;
  40592. t.dcroat = 500;
  40593. t.threequarters = 750;
  40594. t.Scedilla = 556;
  40595. t.lcaron = 344;
  40596. t.Kcommaaccent = 722;
  40597. t.Lacute = 611;
  40598. t.trademark = 980;
  40599. t.edotaccent = 444;
  40600. t.Igrave = 333;
  40601. t.Imacron = 333;
  40602. t.Lcaron = 611;
  40603. t.onehalf = 750;
  40604. t.lessequal = 549;
  40605. t.ocircumflex = 500;
  40606. t.ntilde = 500;
  40607. t.Uhungarumlaut = 722;
  40608. t.Eacute = 611;
  40609. t.emacron = 444;
  40610. t.gbreve = 500;
  40611. t.onequarter = 750;
  40612. t.Scaron = 556;
  40613. t.Scommaaccent = 556;
  40614. t.Ohungarumlaut = 722;
  40615. t.degree = 400;
  40616. t.ograve = 500;
  40617. t.Ccaron = 667;
  40618. t.ugrave = 500;
  40619. t.radical = 453;
  40620. t.Dcaron = 722;
  40621. t.rcommaaccent = 333;
  40622. t.Ntilde = 722;
  40623. t.otilde = 500;
  40624. t.Rcommaaccent = 667;
  40625. t.Lcommaaccent = 611;
  40626. t.Atilde = 722;
  40627. t.Aogonek = 722;
  40628. t.Aring = 722;
  40629. t.Otilde = 722;
  40630. t.zdotaccent = 444;
  40631. t.Ecaron = 611;
  40632. t.Iogonek = 333;
  40633. t.kcommaaccent = 500;
  40634. t.minus = 564;
  40635. t.Icircumflex = 333;
  40636. t.ncaron = 500;
  40637. t.tcommaaccent = 278;
  40638. t.logicalnot = 564;
  40639. t.odieresis = 500;
  40640. t.udieresis = 500;
  40641. t.notequal = 549;
  40642. t.gcommaaccent = 500;
  40643. t.eth = 500;
  40644. t.zcaron = 444;
  40645. t.ncommaaccent = 500;
  40646. t.onesuperior = 300;
  40647. t.imacron = 278;
  40648. t.Euro = 500;
  40649. });
  40650. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40651. t.space = 250;
  40652. t.exclam = 333;
  40653. t.quotedbl = 555;
  40654. t.numbersign = 500;
  40655. t.dollar = 500;
  40656. t.percent = 1000;
  40657. t.ampersand = 833;
  40658. t.quoteright = 333;
  40659. t.parenleft = 333;
  40660. t.parenright = 333;
  40661. t.asterisk = 500;
  40662. t.plus = 570;
  40663. t.comma = 250;
  40664. t.hyphen = 333;
  40665. t.period = 250;
  40666. t.slash = 278;
  40667. t.zero = 500;
  40668. t.one = 500;
  40669. t.two = 500;
  40670. t.three = 500;
  40671. t.four = 500;
  40672. t.five = 500;
  40673. t.six = 500;
  40674. t.seven = 500;
  40675. t.eight = 500;
  40676. t.nine = 500;
  40677. t.colon = 333;
  40678. t.semicolon = 333;
  40679. t.less = 570;
  40680. t.equal = 570;
  40681. t.greater = 570;
  40682. t.question = 500;
  40683. t.at = 930;
  40684. t.A = 722;
  40685. t.B = 667;
  40686. t.C = 722;
  40687. t.D = 722;
  40688. t.E = 667;
  40689. t.F = 611;
  40690. t.G = 778;
  40691. t.H = 778;
  40692. t.I = 389;
  40693. t.J = 500;
  40694. t.K = 778;
  40695. t.L = 667;
  40696. t.M = 944;
  40697. t.N = 722;
  40698. t.O = 778;
  40699. t.P = 611;
  40700. t.Q = 778;
  40701. t.R = 722;
  40702. t.S = 556;
  40703. t.T = 667;
  40704. t.U = 722;
  40705. t.V = 722;
  40706. t.W = 1000;
  40707. t.X = 722;
  40708. t.Y = 722;
  40709. t.Z = 667;
  40710. t.bracketleft = 333;
  40711. t.backslash = 278;
  40712. t.bracketright = 333;
  40713. t.asciicircum = 581;
  40714. t.underscore = 500;
  40715. t.quoteleft = 333;
  40716. t.a = 500;
  40717. t.b = 556;
  40718. t.c = 444;
  40719. t.d = 556;
  40720. t.e = 444;
  40721. t.f = 333;
  40722. t.g = 500;
  40723. t.h = 556;
  40724. t.i = 278;
  40725. t.j = 333;
  40726. t.k = 556;
  40727. t.l = 278;
  40728. t.m = 833;
  40729. t.n = 556;
  40730. t.o = 500;
  40731. t.p = 556;
  40732. t.q = 556;
  40733. t.r = 444;
  40734. t.s = 389;
  40735. t.t = 333;
  40736. t.u = 556;
  40737. t.v = 500;
  40738. t.w = 722;
  40739. t.x = 500;
  40740. t.y = 500;
  40741. t.z = 444;
  40742. t.braceleft = 394;
  40743. t.bar = 220;
  40744. t.braceright = 394;
  40745. t.asciitilde = 520;
  40746. t.exclamdown = 333;
  40747. t.cent = 500;
  40748. t.sterling = 500;
  40749. t.fraction = 167;
  40750. t.yen = 500;
  40751. t.florin = 500;
  40752. t.section = 500;
  40753. t.currency = 500;
  40754. t.quotesingle = 278;
  40755. t.quotedblleft = 500;
  40756. t.guillemotleft = 500;
  40757. t.guilsinglleft = 333;
  40758. t.guilsinglright = 333;
  40759. t.fi = 556;
  40760. t.fl = 556;
  40761. t.endash = 500;
  40762. t.dagger = 500;
  40763. t.daggerdbl = 500;
  40764. t.periodcentered = 250;
  40765. t.paragraph = 540;
  40766. t.bullet = 350;
  40767. t.quotesinglbase = 333;
  40768. t.quotedblbase = 500;
  40769. t.quotedblright = 500;
  40770. t.guillemotright = 500;
  40771. t.ellipsis = 1000;
  40772. t.perthousand = 1000;
  40773. t.questiondown = 500;
  40774. t.grave = 333;
  40775. t.acute = 333;
  40776. t.circumflex = 333;
  40777. t.tilde = 333;
  40778. t.macron = 333;
  40779. t.breve = 333;
  40780. t.dotaccent = 333;
  40781. t.dieresis = 333;
  40782. t.ring = 333;
  40783. t.cedilla = 333;
  40784. t.hungarumlaut = 333;
  40785. t.ogonek = 333;
  40786. t.caron = 333;
  40787. t.emdash = 1000;
  40788. t.AE = 1000;
  40789. t.ordfeminine = 300;
  40790. t.Lslash = 667;
  40791. t.Oslash = 778;
  40792. t.OE = 1000;
  40793. t.ordmasculine = 330;
  40794. t.ae = 722;
  40795. t.dotlessi = 278;
  40796. t.lslash = 278;
  40797. t.oslash = 500;
  40798. t.oe = 722;
  40799. t.germandbls = 556;
  40800. t.Idieresis = 389;
  40801. t.eacute = 444;
  40802. t.abreve = 500;
  40803. t.uhungarumlaut = 556;
  40804. t.ecaron = 444;
  40805. t.Ydieresis = 722;
  40806. t.divide = 570;
  40807. t.Yacute = 722;
  40808. t.Acircumflex = 722;
  40809. t.aacute = 500;
  40810. t.Ucircumflex = 722;
  40811. t.yacute = 500;
  40812. t.scommaaccent = 389;
  40813. t.ecircumflex = 444;
  40814. t.Uring = 722;
  40815. t.Udieresis = 722;
  40816. t.aogonek = 500;
  40817. t.Uacute = 722;
  40818. t.uogonek = 556;
  40819. t.Edieresis = 667;
  40820. t.Dcroat = 722;
  40821. t.commaaccent = 250;
  40822. t.copyright = 747;
  40823. t.Emacron = 667;
  40824. t.ccaron = 444;
  40825. t.aring = 500;
  40826. t.Ncommaaccent = 722;
  40827. t.lacute = 278;
  40828. t.agrave = 500;
  40829. t.Tcommaaccent = 667;
  40830. t.Cacute = 722;
  40831. t.atilde = 500;
  40832. t.Edotaccent = 667;
  40833. t.scaron = 389;
  40834. t.scedilla = 389;
  40835. t.iacute = 278;
  40836. t.lozenge = 494;
  40837. t.Rcaron = 722;
  40838. t.Gcommaaccent = 778;
  40839. t.ucircumflex = 556;
  40840. t.acircumflex = 500;
  40841. t.Amacron = 722;
  40842. t.rcaron = 444;
  40843. t.ccedilla = 444;
  40844. t.Zdotaccent = 667;
  40845. t.Thorn = 611;
  40846. t.Omacron = 778;
  40847. t.Racute = 722;
  40848. t.Sacute = 556;
  40849. t.dcaron = 672;
  40850. t.Umacron = 722;
  40851. t.uring = 556;
  40852. t.threesuperior = 300;
  40853. t.Ograve = 778;
  40854. t.Agrave = 722;
  40855. t.Abreve = 722;
  40856. t.multiply = 570;
  40857. t.uacute = 556;
  40858. t.Tcaron = 667;
  40859. t.partialdiff = 494;
  40860. t.ydieresis = 500;
  40861. t.Nacute = 722;
  40862. t.icircumflex = 278;
  40863. t.Ecircumflex = 667;
  40864. t.adieresis = 500;
  40865. t.edieresis = 444;
  40866. t.cacute = 444;
  40867. t.nacute = 556;
  40868. t.umacron = 556;
  40869. t.Ncaron = 722;
  40870. t.Iacute = 389;
  40871. t.plusminus = 570;
  40872. t.brokenbar = 220;
  40873. t.registered = 747;
  40874. t.Gbreve = 778;
  40875. t.Idotaccent = 389;
  40876. t.summation = 600;
  40877. t.Egrave = 667;
  40878. t.racute = 444;
  40879. t.omacron = 500;
  40880. t.Zacute = 667;
  40881. t.Zcaron = 667;
  40882. t.greaterequal = 549;
  40883. t.Eth = 722;
  40884. t.Ccedilla = 722;
  40885. t.lcommaaccent = 278;
  40886. t.tcaron = 416;
  40887. t.eogonek = 444;
  40888. t.Uogonek = 722;
  40889. t.Aacute = 722;
  40890. t.Adieresis = 722;
  40891. t.egrave = 444;
  40892. t.zacute = 444;
  40893. t.iogonek = 278;
  40894. t.Oacute = 778;
  40895. t.oacute = 500;
  40896. t.amacron = 500;
  40897. t.sacute = 389;
  40898. t.idieresis = 278;
  40899. t.Ocircumflex = 778;
  40900. t.Ugrave = 722;
  40901. t.Delta = 612;
  40902. t.thorn = 556;
  40903. t.twosuperior = 300;
  40904. t.Odieresis = 778;
  40905. t.mu = 556;
  40906. t.igrave = 278;
  40907. t.ohungarumlaut = 500;
  40908. t.Eogonek = 667;
  40909. t.dcroat = 556;
  40910. t.threequarters = 750;
  40911. t.Scedilla = 556;
  40912. t.lcaron = 394;
  40913. t.Kcommaaccent = 778;
  40914. t.Lacute = 667;
  40915. t.trademark = 1000;
  40916. t.edotaccent = 444;
  40917. t.Igrave = 389;
  40918. t.Imacron = 389;
  40919. t.Lcaron = 667;
  40920. t.onehalf = 750;
  40921. t.lessequal = 549;
  40922. t.ocircumflex = 500;
  40923. t.ntilde = 556;
  40924. t.Uhungarumlaut = 722;
  40925. t.Eacute = 667;
  40926. t.emacron = 444;
  40927. t.gbreve = 500;
  40928. t.onequarter = 750;
  40929. t.Scaron = 556;
  40930. t.Scommaaccent = 556;
  40931. t.Ohungarumlaut = 778;
  40932. t.degree = 400;
  40933. t.ograve = 500;
  40934. t.Ccaron = 722;
  40935. t.ugrave = 556;
  40936. t.radical = 549;
  40937. t.Dcaron = 722;
  40938. t.rcommaaccent = 444;
  40939. t.Ntilde = 722;
  40940. t.otilde = 500;
  40941. t.Rcommaaccent = 722;
  40942. t.Lcommaaccent = 667;
  40943. t.Atilde = 722;
  40944. t.Aogonek = 722;
  40945. t.Aring = 722;
  40946. t.Otilde = 778;
  40947. t.zdotaccent = 444;
  40948. t.Ecaron = 667;
  40949. t.Iogonek = 389;
  40950. t.kcommaaccent = 556;
  40951. t.minus = 570;
  40952. t.Icircumflex = 389;
  40953. t.ncaron = 556;
  40954. t.tcommaaccent = 333;
  40955. t.logicalnot = 570;
  40956. t.odieresis = 500;
  40957. t.udieresis = 556;
  40958. t.notequal = 549;
  40959. t.gcommaaccent = 500;
  40960. t.eth = 500;
  40961. t.zcaron = 444;
  40962. t.ncommaaccent = 556;
  40963. t.onesuperior = 300;
  40964. t.imacron = 278;
  40965. t.Euro = 500;
  40966. });
  40967. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40968. t.space = 250;
  40969. t.exclam = 389;
  40970. t.quotedbl = 555;
  40971. t.numbersign = 500;
  40972. t.dollar = 500;
  40973. t.percent = 833;
  40974. t.ampersand = 778;
  40975. t.quoteright = 333;
  40976. t.parenleft = 333;
  40977. t.parenright = 333;
  40978. t.asterisk = 500;
  40979. t.plus = 570;
  40980. t.comma = 250;
  40981. t.hyphen = 333;
  40982. t.period = 250;
  40983. t.slash = 278;
  40984. t.zero = 500;
  40985. t.one = 500;
  40986. t.two = 500;
  40987. t.three = 500;
  40988. t.four = 500;
  40989. t.five = 500;
  40990. t.six = 500;
  40991. t.seven = 500;
  40992. t.eight = 500;
  40993. t.nine = 500;
  40994. t.colon = 333;
  40995. t.semicolon = 333;
  40996. t.less = 570;
  40997. t.equal = 570;
  40998. t.greater = 570;
  40999. t.question = 500;
  41000. t.at = 832;
  41001. t.A = 667;
  41002. t.B = 667;
  41003. t.C = 667;
  41004. t.D = 722;
  41005. t.E = 667;
  41006. t.F = 667;
  41007. t.G = 722;
  41008. t.H = 778;
  41009. t.I = 389;
  41010. t.J = 500;
  41011. t.K = 667;
  41012. t.L = 611;
  41013. t.M = 889;
  41014. t.N = 722;
  41015. t.O = 722;
  41016. t.P = 611;
  41017. t.Q = 722;
  41018. t.R = 667;
  41019. t.S = 556;
  41020. t.T = 611;
  41021. t.U = 722;
  41022. t.V = 667;
  41023. t.W = 889;
  41024. t.X = 667;
  41025. t.Y = 611;
  41026. t.Z = 611;
  41027. t.bracketleft = 333;
  41028. t.backslash = 278;
  41029. t.bracketright = 333;
  41030. t.asciicircum = 570;
  41031. t.underscore = 500;
  41032. t.quoteleft = 333;
  41033. t.a = 500;
  41034. t.b = 500;
  41035. t.c = 444;
  41036. t.d = 500;
  41037. t.e = 444;
  41038. t.f = 333;
  41039. t.g = 500;
  41040. t.h = 556;
  41041. t.i = 278;
  41042. t.j = 278;
  41043. t.k = 500;
  41044. t.l = 278;
  41045. t.m = 778;
  41046. t.n = 556;
  41047. t.o = 500;
  41048. t.p = 500;
  41049. t.q = 500;
  41050. t.r = 389;
  41051. t.s = 389;
  41052. t.t = 278;
  41053. t.u = 556;
  41054. t.v = 444;
  41055. t.w = 667;
  41056. t.x = 500;
  41057. t.y = 444;
  41058. t.z = 389;
  41059. t.braceleft = 348;
  41060. t.bar = 220;
  41061. t.braceright = 348;
  41062. t.asciitilde = 570;
  41063. t.exclamdown = 389;
  41064. t.cent = 500;
  41065. t.sterling = 500;
  41066. t.fraction = 167;
  41067. t.yen = 500;
  41068. t.florin = 500;
  41069. t.section = 500;
  41070. t.currency = 500;
  41071. t.quotesingle = 278;
  41072. t.quotedblleft = 500;
  41073. t.guillemotleft = 500;
  41074. t.guilsinglleft = 333;
  41075. t.guilsinglright = 333;
  41076. t.fi = 556;
  41077. t.fl = 556;
  41078. t.endash = 500;
  41079. t.dagger = 500;
  41080. t.daggerdbl = 500;
  41081. t.periodcentered = 250;
  41082. t.paragraph = 500;
  41083. t.bullet = 350;
  41084. t.quotesinglbase = 333;
  41085. t.quotedblbase = 500;
  41086. t.quotedblright = 500;
  41087. t.guillemotright = 500;
  41088. t.ellipsis = 1000;
  41089. t.perthousand = 1000;
  41090. t.questiondown = 500;
  41091. t.grave = 333;
  41092. t.acute = 333;
  41093. t.circumflex = 333;
  41094. t.tilde = 333;
  41095. t.macron = 333;
  41096. t.breve = 333;
  41097. t.dotaccent = 333;
  41098. t.dieresis = 333;
  41099. t.ring = 333;
  41100. t.cedilla = 333;
  41101. t.hungarumlaut = 333;
  41102. t.ogonek = 333;
  41103. t.caron = 333;
  41104. t.emdash = 1000;
  41105. t.AE = 944;
  41106. t.ordfeminine = 266;
  41107. t.Lslash = 611;
  41108. t.Oslash = 722;
  41109. t.OE = 944;
  41110. t.ordmasculine = 300;
  41111. t.ae = 722;
  41112. t.dotlessi = 278;
  41113. t.lslash = 278;
  41114. t.oslash = 500;
  41115. t.oe = 722;
  41116. t.germandbls = 500;
  41117. t.Idieresis = 389;
  41118. t.eacute = 444;
  41119. t.abreve = 500;
  41120. t.uhungarumlaut = 556;
  41121. t.ecaron = 444;
  41122. t.Ydieresis = 611;
  41123. t.divide = 570;
  41124. t.Yacute = 611;
  41125. t.Acircumflex = 667;
  41126. t.aacute = 500;
  41127. t.Ucircumflex = 722;
  41128. t.yacute = 444;
  41129. t.scommaaccent = 389;
  41130. t.ecircumflex = 444;
  41131. t.Uring = 722;
  41132. t.Udieresis = 722;
  41133. t.aogonek = 500;
  41134. t.Uacute = 722;
  41135. t.uogonek = 556;
  41136. t.Edieresis = 667;
  41137. t.Dcroat = 722;
  41138. t.commaaccent = 250;
  41139. t.copyright = 747;
  41140. t.Emacron = 667;
  41141. t.ccaron = 444;
  41142. t.aring = 500;
  41143. t.Ncommaaccent = 722;
  41144. t.lacute = 278;
  41145. t.agrave = 500;
  41146. t.Tcommaaccent = 611;
  41147. t.Cacute = 667;
  41148. t.atilde = 500;
  41149. t.Edotaccent = 667;
  41150. t.scaron = 389;
  41151. t.scedilla = 389;
  41152. t.iacute = 278;
  41153. t.lozenge = 494;
  41154. t.Rcaron = 667;
  41155. t.Gcommaaccent = 722;
  41156. t.ucircumflex = 556;
  41157. t.acircumflex = 500;
  41158. t.Amacron = 667;
  41159. t.rcaron = 389;
  41160. t.ccedilla = 444;
  41161. t.Zdotaccent = 611;
  41162. t.Thorn = 611;
  41163. t.Omacron = 722;
  41164. t.Racute = 667;
  41165. t.Sacute = 556;
  41166. t.dcaron = 608;
  41167. t.Umacron = 722;
  41168. t.uring = 556;
  41169. t.threesuperior = 300;
  41170. t.Ograve = 722;
  41171. t.Agrave = 667;
  41172. t.Abreve = 667;
  41173. t.multiply = 570;
  41174. t.uacute = 556;
  41175. t.Tcaron = 611;
  41176. t.partialdiff = 494;
  41177. t.ydieresis = 444;
  41178. t.Nacute = 722;
  41179. t.icircumflex = 278;
  41180. t.Ecircumflex = 667;
  41181. t.adieresis = 500;
  41182. t.edieresis = 444;
  41183. t.cacute = 444;
  41184. t.nacute = 556;
  41185. t.umacron = 556;
  41186. t.Ncaron = 722;
  41187. t.Iacute = 389;
  41188. t.plusminus = 570;
  41189. t.brokenbar = 220;
  41190. t.registered = 747;
  41191. t.Gbreve = 722;
  41192. t.Idotaccent = 389;
  41193. t.summation = 600;
  41194. t.Egrave = 667;
  41195. t.racute = 389;
  41196. t.omacron = 500;
  41197. t.Zacute = 611;
  41198. t.Zcaron = 611;
  41199. t.greaterequal = 549;
  41200. t.Eth = 722;
  41201. t.Ccedilla = 667;
  41202. t.lcommaaccent = 278;
  41203. t.tcaron = 366;
  41204. t.eogonek = 444;
  41205. t.Uogonek = 722;
  41206. t.Aacute = 667;
  41207. t.Adieresis = 667;
  41208. t.egrave = 444;
  41209. t.zacute = 389;
  41210. t.iogonek = 278;
  41211. t.Oacute = 722;
  41212. t.oacute = 500;
  41213. t.amacron = 500;
  41214. t.sacute = 389;
  41215. t.idieresis = 278;
  41216. t.Ocircumflex = 722;
  41217. t.Ugrave = 722;
  41218. t.Delta = 612;
  41219. t.thorn = 500;
  41220. t.twosuperior = 300;
  41221. t.Odieresis = 722;
  41222. t.mu = 576;
  41223. t.igrave = 278;
  41224. t.ohungarumlaut = 500;
  41225. t.Eogonek = 667;
  41226. t.dcroat = 500;
  41227. t.threequarters = 750;
  41228. t.Scedilla = 556;
  41229. t.lcaron = 382;
  41230. t.Kcommaaccent = 667;
  41231. t.Lacute = 611;
  41232. t.trademark = 1000;
  41233. t.edotaccent = 444;
  41234. t.Igrave = 389;
  41235. t.Imacron = 389;
  41236. t.Lcaron = 611;
  41237. t.onehalf = 750;
  41238. t.lessequal = 549;
  41239. t.ocircumflex = 500;
  41240. t.ntilde = 556;
  41241. t.Uhungarumlaut = 722;
  41242. t.Eacute = 667;
  41243. t.emacron = 444;
  41244. t.gbreve = 500;
  41245. t.onequarter = 750;
  41246. t.Scaron = 556;
  41247. t.Scommaaccent = 556;
  41248. t.Ohungarumlaut = 722;
  41249. t.degree = 400;
  41250. t.ograve = 500;
  41251. t.Ccaron = 667;
  41252. t.ugrave = 556;
  41253. t.radical = 549;
  41254. t.Dcaron = 722;
  41255. t.rcommaaccent = 389;
  41256. t.Ntilde = 722;
  41257. t.otilde = 500;
  41258. t.Rcommaaccent = 667;
  41259. t.Lcommaaccent = 611;
  41260. t.Atilde = 667;
  41261. t.Aogonek = 667;
  41262. t.Aring = 667;
  41263. t.Otilde = 722;
  41264. t.zdotaccent = 389;
  41265. t.Ecaron = 667;
  41266. t.Iogonek = 389;
  41267. t.kcommaaccent = 500;
  41268. t.minus = 606;
  41269. t.Icircumflex = 389;
  41270. t.ncaron = 556;
  41271. t.tcommaaccent = 278;
  41272. t.logicalnot = 606;
  41273. t.odieresis = 500;
  41274. t.udieresis = 556;
  41275. t.notequal = 549;
  41276. t.gcommaaccent = 500;
  41277. t.eth = 500;
  41278. t.zcaron = 389;
  41279. t.ncommaaccent = 556;
  41280. t.onesuperior = 300;
  41281. t.imacron = 278;
  41282. t.Euro = 500;
  41283. });
  41284. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41285. t.space = 250;
  41286. t.exclam = 333;
  41287. t.quotedbl = 420;
  41288. t.numbersign = 500;
  41289. t.dollar = 500;
  41290. t.percent = 833;
  41291. t.ampersand = 778;
  41292. t.quoteright = 333;
  41293. t.parenleft = 333;
  41294. t.parenright = 333;
  41295. t.asterisk = 500;
  41296. t.plus = 675;
  41297. t.comma = 250;
  41298. t.hyphen = 333;
  41299. t.period = 250;
  41300. t.slash = 278;
  41301. t.zero = 500;
  41302. t.one = 500;
  41303. t.two = 500;
  41304. t.three = 500;
  41305. t.four = 500;
  41306. t.five = 500;
  41307. t.six = 500;
  41308. t.seven = 500;
  41309. t.eight = 500;
  41310. t.nine = 500;
  41311. t.colon = 333;
  41312. t.semicolon = 333;
  41313. t.less = 675;
  41314. t.equal = 675;
  41315. t.greater = 675;
  41316. t.question = 500;
  41317. t.at = 920;
  41318. t.A = 611;
  41319. t.B = 611;
  41320. t.C = 667;
  41321. t.D = 722;
  41322. t.E = 611;
  41323. t.F = 611;
  41324. t.G = 722;
  41325. t.H = 722;
  41326. t.I = 333;
  41327. t.J = 444;
  41328. t.K = 667;
  41329. t.L = 556;
  41330. t.M = 833;
  41331. t.N = 667;
  41332. t.O = 722;
  41333. t.P = 611;
  41334. t.Q = 722;
  41335. t.R = 611;
  41336. t.S = 500;
  41337. t.T = 556;
  41338. t.U = 722;
  41339. t.V = 611;
  41340. t.W = 833;
  41341. t.X = 611;
  41342. t.Y = 556;
  41343. t.Z = 556;
  41344. t.bracketleft = 389;
  41345. t.backslash = 278;
  41346. t.bracketright = 389;
  41347. t.asciicircum = 422;
  41348. t.underscore = 500;
  41349. t.quoteleft = 333;
  41350. t.a = 500;
  41351. t.b = 500;
  41352. t.c = 444;
  41353. t.d = 500;
  41354. t.e = 444;
  41355. t.f = 278;
  41356. t.g = 500;
  41357. t.h = 500;
  41358. t.i = 278;
  41359. t.j = 278;
  41360. t.k = 444;
  41361. t.l = 278;
  41362. t.m = 722;
  41363. t.n = 500;
  41364. t.o = 500;
  41365. t.p = 500;
  41366. t.q = 500;
  41367. t.r = 389;
  41368. t.s = 389;
  41369. t.t = 278;
  41370. t.u = 500;
  41371. t.v = 444;
  41372. t.w = 667;
  41373. t.x = 444;
  41374. t.y = 444;
  41375. t.z = 389;
  41376. t.braceleft = 400;
  41377. t.bar = 275;
  41378. t.braceright = 400;
  41379. t.asciitilde = 541;
  41380. t.exclamdown = 389;
  41381. t.cent = 500;
  41382. t.sterling = 500;
  41383. t.fraction = 167;
  41384. t.yen = 500;
  41385. t.florin = 500;
  41386. t.section = 500;
  41387. t.currency = 500;
  41388. t.quotesingle = 214;
  41389. t.quotedblleft = 556;
  41390. t.guillemotleft = 500;
  41391. t.guilsinglleft = 333;
  41392. t.guilsinglright = 333;
  41393. t.fi = 500;
  41394. t.fl = 500;
  41395. t.endash = 500;
  41396. t.dagger = 500;
  41397. t.daggerdbl = 500;
  41398. t.periodcentered = 250;
  41399. t.paragraph = 523;
  41400. t.bullet = 350;
  41401. t.quotesinglbase = 333;
  41402. t.quotedblbase = 556;
  41403. t.quotedblright = 556;
  41404. t.guillemotright = 500;
  41405. t.ellipsis = 889;
  41406. t.perthousand = 1000;
  41407. t.questiondown = 500;
  41408. t.grave = 333;
  41409. t.acute = 333;
  41410. t.circumflex = 333;
  41411. t.tilde = 333;
  41412. t.macron = 333;
  41413. t.breve = 333;
  41414. t.dotaccent = 333;
  41415. t.dieresis = 333;
  41416. t.ring = 333;
  41417. t.cedilla = 333;
  41418. t.hungarumlaut = 333;
  41419. t.ogonek = 333;
  41420. t.caron = 333;
  41421. t.emdash = 889;
  41422. t.AE = 889;
  41423. t.ordfeminine = 276;
  41424. t.Lslash = 556;
  41425. t.Oslash = 722;
  41426. t.OE = 944;
  41427. t.ordmasculine = 310;
  41428. t.ae = 667;
  41429. t.dotlessi = 278;
  41430. t.lslash = 278;
  41431. t.oslash = 500;
  41432. t.oe = 667;
  41433. t.germandbls = 500;
  41434. t.Idieresis = 333;
  41435. t.eacute = 444;
  41436. t.abreve = 500;
  41437. t.uhungarumlaut = 500;
  41438. t.ecaron = 444;
  41439. t.Ydieresis = 556;
  41440. t.divide = 675;
  41441. t.Yacute = 556;
  41442. t.Acircumflex = 611;
  41443. t.aacute = 500;
  41444. t.Ucircumflex = 722;
  41445. t.yacute = 444;
  41446. t.scommaaccent = 389;
  41447. t.ecircumflex = 444;
  41448. t.Uring = 722;
  41449. t.Udieresis = 722;
  41450. t.aogonek = 500;
  41451. t.Uacute = 722;
  41452. t.uogonek = 500;
  41453. t.Edieresis = 611;
  41454. t.Dcroat = 722;
  41455. t.commaaccent = 250;
  41456. t.copyright = 760;
  41457. t.Emacron = 611;
  41458. t.ccaron = 444;
  41459. t.aring = 500;
  41460. t.Ncommaaccent = 667;
  41461. t.lacute = 278;
  41462. t.agrave = 500;
  41463. t.Tcommaaccent = 556;
  41464. t.Cacute = 667;
  41465. t.atilde = 500;
  41466. t.Edotaccent = 611;
  41467. t.scaron = 389;
  41468. t.scedilla = 389;
  41469. t.iacute = 278;
  41470. t.lozenge = 471;
  41471. t.Rcaron = 611;
  41472. t.Gcommaaccent = 722;
  41473. t.ucircumflex = 500;
  41474. t.acircumflex = 500;
  41475. t.Amacron = 611;
  41476. t.rcaron = 389;
  41477. t.ccedilla = 444;
  41478. t.Zdotaccent = 556;
  41479. t.Thorn = 611;
  41480. t.Omacron = 722;
  41481. t.Racute = 611;
  41482. t.Sacute = 500;
  41483. t.dcaron = 544;
  41484. t.Umacron = 722;
  41485. t.uring = 500;
  41486. t.threesuperior = 300;
  41487. t.Ograve = 722;
  41488. t.Agrave = 611;
  41489. t.Abreve = 611;
  41490. t.multiply = 675;
  41491. t.uacute = 500;
  41492. t.Tcaron = 556;
  41493. t.partialdiff = 476;
  41494. t.ydieresis = 444;
  41495. t.Nacute = 667;
  41496. t.icircumflex = 278;
  41497. t.Ecircumflex = 611;
  41498. t.adieresis = 500;
  41499. t.edieresis = 444;
  41500. t.cacute = 444;
  41501. t.nacute = 500;
  41502. t.umacron = 500;
  41503. t.Ncaron = 667;
  41504. t.Iacute = 333;
  41505. t.plusminus = 675;
  41506. t.brokenbar = 275;
  41507. t.registered = 760;
  41508. t.Gbreve = 722;
  41509. t.Idotaccent = 333;
  41510. t.summation = 600;
  41511. t.Egrave = 611;
  41512. t.racute = 389;
  41513. t.omacron = 500;
  41514. t.Zacute = 556;
  41515. t.Zcaron = 556;
  41516. t.greaterequal = 549;
  41517. t.Eth = 722;
  41518. t.Ccedilla = 667;
  41519. t.lcommaaccent = 278;
  41520. t.tcaron = 300;
  41521. t.eogonek = 444;
  41522. t.Uogonek = 722;
  41523. t.Aacute = 611;
  41524. t.Adieresis = 611;
  41525. t.egrave = 444;
  41526. t.zacute = 389;
  41527. t.iogonek = 278;
  41528. t.Oacute = 722;
  41529. t.oacute = 500;
  41530. t.amacron = 500;
  41531. t.sacute = 389;
  41532. t.idieresis = 278;
  41533. t.Ocircumflex = 722;
  41534. t.Ugrave = 722;
  41535. t.Delta = 612;
  41536. t.thorn = 500;
  41537. t.twosuperior = 300;
  41538. t.Odieresis = 722;
  41539. t.mu = 500;
  41540. t.igrave = 278;
  41541. t.ohungarumlaut = 500;
  41542. t.Eogonek = 611;
  41543. t.dcroat = 500;
  41544. t.threequarters = 750;
  41545. t.Scedilla = 500;
  41546. t.lcaron = 300;
  41547. t.Kcommaaccent = 667;
  41548. t.Lacute = 556;
  41549. t.trademark = 980;
  41550. t.edotaccent = 444;
  41551. t.Igrave = 333;
  41552. t.Imacron = 333;
  41553. t.Lcaron = 611;
  41554. t.onehalf = 750;
  41555. t.lessequal = 549;
  41556. t.ocircumflex = 500;
  41557. t.ntilde = 500;
  41558. t.Uhungarumlaut = 722;
  41559. t.Eacute = 611;
  41560. t.emacron = 444;
  41561. t.gbreve = 500;
  41562. t.onequarter = 750;
  41563. t.Scaron = 500;
  41564. t.Scommaaccent = 500;
  41565. t.Ohungarumlaut = 722;
  41566. t.degree = 400;
  41567. t.ograve = 500;
  41568. t.Ccaron = 667;
  41569. t.ugrave = 500;
  41570. t.radical = 453;
  41571. t.Dcaron = 722;
  41572. t.rcommaaccent = 389;
  41573. t.Ntilde = 667;
  41574. t.otilde = 500;
  41575. t.Rcommaaccent = 611;
  41576. t.Lcommaaccent = 556;
  41577. t.Atilde = 611;
  41578. t.Aogonek = 611;
  41579. t.Aring = 611;
  41580. t.Otilde = 722;
  41581. t.zdotaccent = 389;
  41582. t.Ecaron = 611;
  41583. t.Iogonek = 333;
  41584. t.kcommaaccent = 444;
  41585. t.minus = 675;
  41586. t.Icircumflex = 333;
  41587. t.ncaron = 500;
  41588. t.tcommaaccent = 278;
  41589. t.logicalnot = 675;
  41590. t.odieresis = 500;
  41591. t.udieresis = 500;
  41592. t.notequal = 549;
  41593. t.gcommaaccent = 500;
  41594. t.eth = 500;
  41595. t.zcaron = 389;
  41596. t.ncommaaccent = 500;
  41597. t.onesuperior = 300;
  41598. t.imacron = 278;
  41599. t.Euro = 500;
  41600. });
  41601. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41602. t.space = 278;
  41603. t.a1 = 974;
  41604. t.a2 = 961;
  41605. t.a202 = 974;
  41606. t.a3 = 980;
  41607. t.a4 = 719;
  41608. t.a5 = 789;
  41609. t.a119 = 790;
  41610. t.a118 = 791;
  41611. t.a117 = 690;
  41612. t.a11 = 960;
  41613. t.a12 = 939;
  41614. t.a13 = 549;
  41615. t.a14 = 855;
  41616. t.a15 = 911;
  41617. t.a16 = 933;
  41618. t.a105 = 911;
  41619. t.a17 = 945;
  41620. t.a18 = 974;
  41621. t.a19 = 755;
  41622. t.a20 = 846;
  41623. t.a21 = 762;
  41624. t.a22 = 761;
  41625. t.a23 = 571;
  41626. t.a24 = 677;
  41627. t.a25 = 763;
  41628. t.a26 = 760;
  41629. t.a27 = 759;
  41630. t.a28 = 754;
  41631. t.a6 = 494;
  41632. t.a7 = 552;
  41633. t.a8 = 537;
  41634. t.a9 = 577;
  41635. t.a10 = 692;
  41636. t.a29 = 786;
  41637. t.a30 = 788;
  41638. t.a31 = 788;
  41639. t.a32 = 790;
  41640. t.a33 = 793;
  41641. t.a34 = 794;
  41642. t.a35 = 816;
  41643. t.a36 = 823;
  41644. t.a37 = 789;
  41645. t.a38 = 841;
  41646. t.a39 = 823;
  41647. t.a40 = 833;
  41648. t.a41 = 816;
  41649. t.a42 = 831;
  41650. t.a43 = 923;
  41651. t.a44 = 744;
  41652. t.a45 = 723;
  41653. t.a46 = 749;
  41654. t.a47 = 790;
  41655. t.a48 = 792;
  41656. t.a49 = 695;
  41657. t.a50 = 776;
  41658. t.a51 = 768;
  41659. t.a52 = 792;
  41660. t.a53 = 759;
  41661. t.a54 = 707;
  41662. t.a55 = 708;
  41663. t.a56 = 682;
  41664. t.a57 = 701;
  41665. t.a58 = 826;
  41666. t.a59 = 815;
  41667. t.a60 = 789;
  41668. t.a61 = 789;
  41669. t.a62 = 707;
  41670. t.a63 = 687;
  41671. t.a64 = 696;
  41672. t.a65 = 689;
  41673. t.a66 = 786;
  41674. t.a67 = 787;
  41675. t.a68 = 713;
  41676. t.a69 = 791;
  41677. t.a70 = 785;
  41678. t.a71 = 791;
  41679. t.a72 = 873;
  41680. t.a73 = 761;
  41681. t.a74 = 762;
  41682. t.a203 = 762;
  41683. t.a75 = 759;
  41684. t.a204 = 759;
  41685. t.a76 = 892;
  41686. t.a77 = 892;
  41687. t.a78 = 788;
  41688. t.a79 = 784;
  41689. t.a81 = 438;
  41690. t.a82 = 138;
  41691. t.a83 = 277;
  41692. t.a84 = 415;
  41693. t.a97 = 392;
  41694. t.a98 = 392;
  41695. t.a99 = 668;
  41696. t.a100 = 668;
  41697. t.a89 = 390;
  41698. t.a90 = 390;
  41699. t.a93 = 317;
  41700. t.a94 = 317;
  41701. t.a91 = 276;
  41702. t.a92 = 276;
  41703. t.a205 = 509;
  41704. t.a85 = 509;
  41705. t.a206 = 410;
  41706. t.a86 = 410;
  41707. t.a87 = 234;
  41708. t.a88 = 234;
  41709. t.a95 = 334;
  41710. t.a96 = 334;
  41711. t.a101 = 732;
  41712. t.a102 = 544;
  41713. t.a103 = 544;
  41714. t.a104 = 910;
  41715. t.a106 = 667;
  41716. t.a107 = 760;
  41717. t.a108 = 760;
  41718. t.a112 = 776;
  41719. t.a111 = 595;
  41720. t.a110 = 694;
  41721. t.a109 = 626;
  41722. t.a120 = 788;
  41723. t.a121 = 788;
  41724. t.a122 = 788;
  41725. t.a123 = 788;
  41726. t.a124 = 788;
  41727. t.a125 = 788;
  41728. t.a126 = 788;
  41729. t.a127 = 788;
  41730. t.a128 = 788;
  41731. t.a129 = 788;
  41732. t.a130 = 788;
  41733. t.a131 = 788;
  41734. t.a132 = 788;
  41735. t.a133 = 788;
  41736. t.a134 = 788;
  41737. t.a135 = 788;
  41738. t.a136 = 788;
  41739. t.a137 = 788;
  41740. t.a138 = 788;
  41741. t.a139 = 788;
  41742. t.a140 = 788;
  41743. t.a141 = 788;
  41744. t.a142 = 788;
  41745. t.a143 = 788;
  41746. t.a144 = 788;
  41747. t.a145 = 788;
  41748. t.a146 = 788;
  41749. t.a147 = 788;
  41750. t.a148 = 788;
  41751. t.a149 = 788;
  41752. t.a150 = 788;
  41753. t.a151 = 788;
  41754. t.a152 = 788;
  41755. t.a153 = 788;
  41756. t.a154 = 788;
  41757. t.a155 = 788;
  41758. t.a156 = 788;
  41759. t.a157 = 788;
  41760. t.a158 = 788;
  41761. t.a159 = 788;
  41762. t.a160 = 894;
  41763. t.a161 = 838;
  41764. t.a163 = 1016;
  41765. t.a164 = 458;
  41766. t.a196 = 748;
  41767. t.a165 = 924;
  41768. t.a192 = 748;
  41769. t.a166 = 918;
  41770. t.a167 = 927;
  41771. t.a168 = 928;
  41772. t.a169 = 928;
  41773. t.a170 = 834;
  41774. t.a171 = 873;
  41775. t.a172 = 828;
  41776. t.a173 = 924;
  41777. t.a162 = 924;
  41778. t.a174 = 917;
  41779. t.a175 = 930;
  41780. t.a176 = 931;
  41781. t.a177 = 463;
  41782. t.a178 = 883;
  41783. t.a179 = 836;
  41784. t.a193 = 836;
  41785. t.a180 = 867;
  41786. t.a199 = 867;
  41787. t.a181 = 696;
  41788. t.a200 = 696;
  41789. t.a182 = 874;
  41790. t.a201 = 874;
  41791. t.a183 = 760;
  41792. t.a184 = 946;
  41793. t.a197 = 771;
  41794. t.a185 = 865;
  41795. t.a194 = 771;
  41796. t.a198 = 888;
  41797. t.a186 = 967;
  41798. t.a195 = 888;
  41799. t.a187 = 831;
  41800. t.a188 = 873;
  41801. t.a189 = 927;
  41802. t.a190 = 970;
  41803. t.a191 = 918;
  41804. });
  41805. });
  41806. exports.getMetrics = getMetrics;
  41807. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41808. t.Courier = {
  41809. ascent: 629,
  41810. descent: -157,
  41811. capHeight: 562,
  41812. xHeight: -426
  41813. };
  41814. t["Courier-Bold"] = {
  41815. ascent: 629,
  41816. descent: -157,
  41817. capHeight: 562,
  41818. xHeight: 439
  41819. };
  41820. t["Courier-Oblique"] = {
  41821. ascent: 629,
  41822. descent: -157,
  41823. capHeight: 562,
  41824. xHeight: 426
  41825. };
  41826. t["Courier-BoldOblique"] = {
  41827. ascent: 629,
  41828. descent: -157,
  41829. capHeight: 562,
  41830. xHeight: 426
  41831. };
  41832. t.Helvetica = {
  41833. ascent: 718,
  41834. descent: -207,
  41835. capHeight: 718,
  41836. xHeight: 523
  41837. };
  41838. t["Helvetica-Bold"] = {
  41839. ascent: 718,
  41840. descent: -207,
  41841. capHeight: 718,
  41842. xHeight: 532
  41843. };
  41844. t["Helvetica-Oblique"] = {
  41845. ascent: 718,
  41846. descent: -207,
  41847. capHeight: 718,
  41848. xHeight: 523
  41849. };
  41850. t["Helvetica-BoldOblique"] = {
  41851. ascent: 718,
  41852. descent: -207,
  41853. capHeight: 718,
  41854. xHeight: 532
  41855. };
  41856. t["Times-Roman"] = {
  41857. ascent: 683,
  41858. descent: -217,
  41859. capHeight: 662,
  41860. xHeight: 450
  41861. };
  41862. t["Times-Bold"] = {
  41863. ascent: 683,
  41864. descent: -217,
  41865. capHeight: 676,
  41866. xHeight: 461
  41867. };
  41868. t["Times-Italic"] = {
  41869. ascent: 683,
  41870. descent: -217,
  41871. capHeight: 653,
  41872. xHeight: 441
  41873. };
  41874. t["Times-BoldItalic"] = {
  41875. ascent: 683,
  41876. descent: -217,
  41877. capHeight: 669,
  41878. xHeight: 462
  41879. };
  41880. t.Symbol = {
  41881. ascent: Math.NaN,
  41882. descent: Math.NaN,
  41883. capHeight: Math.NaN,
  41884. xHeight: Math.NaN
  41885. };
  41886. t.ZapfDingbats = {
  41887. ascent: Math.NaN,
  41888. descent: Math.NaN,
  41889. capHeight: Math.NaN,
  41890. xHeight: Math.NaN
  41891. };
  41892. });
  41893. exports.getFontBasicMetrics = getFontBasicMetrics;
  41894. /***/ }),
  41895. /* 44 */
  41896. /***/ ((__unused_webpack_module, exports) => {
  41897. Object.defineProperty(exports, "__esModule", ({
  41898. value: true
  41899. }));
  41900. exports.GlyfTable = void 0;
  41901. const ON_CURVE_POINT = 1 << 0;
  41902. const X_SHORT_VECTOR = 1 << 1;
  41903. const Y_SHORT_VECTOR = 1 << 2;
  41904. const REPEAT_FLAG = 1 << 3;
  41905. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41906. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41907. const OVERLAP_SIMPLE = 1 << 6;
  41908. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41909. const ARGS_ARE_XY_VALUES = 1 << 1;
  41910. const WE_HAVE_A_SCALE = 1 << 3;
  41911. const MORE_COMPONENTS = 1 << 5;
  41912. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41913. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41914. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41915. class GlyfTable {
  41916. constructor({
  41917. glyfTable,
  41918. isGlyphLocationsLong,
  41919. locaTable,
  41920. numGlyphs
  41921. }) {
  41922. this.glyphs = [];
  41923. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41924. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41925. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41926. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41927. let pos = 0;
  41928. for (let i = 0; i < numGlyphs; i++) {
  41929. pos += offsetSize;
  41930. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41931. if (next === prev) {
  41932. this.glyphs.push(new Glyph({}));
  41933. continue;
  41934. }
  41935. const glyph = Glyph.parse(prev, glyf);
  41936. this.glyphs.push(glyph);
  41937. prev = next;
  41938. }
  41939. }
  41940. getSize() {
  41941. return this.glyphs.reduce((a, g) => {
  41942. const size = g.getSize();
  41943. return a + (size + 3 & ~3);
  41944. }, 0);
  41945. }
  41946. write() {
  41947. const totalSize = this.getSize();
  41948. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41949. const isLocationLong = totalSize > 0x1fffe;
  41950. const offsetSize = isLocationLong ? 4 : 2;
  41951. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41952. if (isLocationLong) {
  41953. locaTable.setUint32(0, 0);
  41954. } else {
  41955. locaTable.setUint16(0, 0);
  41956. }
  41957. let pos = 0;
  41958. let locaIndex = 0;
  41959. for (const glyph of this.glyphs) {
  41960. pos += glyph.write(pos, glyfTable);
  41961. pos = pos + 3 & ~3;
  41962. locaIndex += offsetSize;
  41963. if (isLocationLong) {
  41964. locaTable.setUint32(locaIndex, pos);
  41965. } else {
  41966. locaTable.setUint16(locaIndex, pos >> 1);
  41967. }
  41968. }
  41969. return {
  41970. isLocationLong,
  41971. loca: new Uint8Array(locaTable.buffer),
  41972. glyf: new Uint8Array(glyfTable.buffer)
  41973. };
  41974. }
  41975. scale(factors) {
  41976. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41977. this.glyphs[i].scale(factors[i]);
  41978. }
  41979. }
  41980. }
  41981. exports.GlyfTable = GlyfTable;
  41982. class Glyph {
  41983. constructor({
  41984. header = null,
  41985. simple = null,
  41986. composites = null
  41987. }) {
  41988. this.header = header;
  41989. this.simple = simple;
  41990. this.composites = composites;
  41991. }
  41992. static parse(pos, glyf) {
  41993. const [read, header] = GlyphHeader.parse(pos, glyf);
  41994. pos += read;
  41995. if (header.numberOfContours < 0) {
  41996. const composites = [];
  41997. while (true) {
  41998. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41999. pos += n;
  42000. composites.push(composite);
  42001. if (!(composite.flags & MORE_COMPONENTS)) {
  42002. break;
  42003. }
  42004. }
  42005. return new Glyph({
  42006. header,
  42007. composites
  42008. });
  42009. }
  42010. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  42011. return new Glyph({
  42012. header,
  42013. simple
  42014. });
  42015. }
  42016. getSize() {
  42017. if (!this.header) {
  42018. return 0;
  42019. }
  42020. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  42021. return this.header.getSize() + size;
  42022. }
  42023. write(pos, buf) {
  42024. if (!this.header) {
  42025. return 0;
  42026. }
  42027. const spos = pos;
  42028. pos += this.header.write(pos, buf);
  42029. if (this.simple) {
  42030. pos += this.simple.write(pos, buf);
  42031. } else {
  42032. for (const composite of this.composites) {
  42033. pos += composite.write(pos, buf);
  42034. }
  42035. }
  42036. return pos - spos;
  42037. }
  42038. scale(factor) {
  42039. if (!this.header) {
  42040. return;
  42041. }
  42042. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  42043. this.header.scale(xMiddle, factor);
  42044. if (this.simple) {
  42045. this.simple.scale(xMiddle, factor);
  42046. } else {
  42047. for (const composite of this.composites) {
  42048. composite.scale(xMiddle, factor);
  42049. }
  42050. }
  42051. }
  42052. }
  42053. class GlyphHeader {
  42054. constructor({
  42055. numberOfContours,
  42056. xMin,
  42057. yMin,
  42058. xMax,
  42059. yMax
  42060. }) {
  42061. this.numberOfContours = numberOfContours;
  42062. this.xMin = xMin;
  42063. this.yMin = yMin;
  42064. this.xMax = xMax;
  42065. this.yMax = yMax;
  42066. }
  42067. static parse(pos, glyf) {
  42068. return [10, new GlyphHeader({
  42069. numberOfContours: glyf.getInt16(pos),
  42070. xMin: glyf.getInt16(pos + 2),
  42071. yMin: glyf.getInt16(pos + 4),
  42072. xMax: glyf.getInt16(pos + 6),
  42073. yMax: glyf.getInt16(pos + 8)
  42074. })];
  42075. }
  42076. getSize() {
  42077. return 10;
  42078. }
  42079. write(pos, buf) {
  42080. buf.setInt16(pos, this.numberOfContours);
  42081. buf.setInt16(pos + 2, this.xMin);
  42082. buf.setInt16(pos + 4, this.yMin);
  42083. buf.setInt16(pos + 6, this.xMax);
  42084. buf.setInt16(pos + 8, this.yMax);
  42085. return 10;
  42086. }
  42087. scale(x, factor) {
  42088. this.xMin = Math.round(x + (this.xMin - x) * factor);
  42089. this.xMax = Math.round(x + (this.xMax - x) * factor);
  42090. }
  42091. }
  42092. class Contour {
  42093. constructor({
  42094. flags,
  42095. xCoordinates,
  42096. yCoordinates
  42097. }) {
  42098. this.xCoordinates = xCoordinates;
  42099. this.yCoordinates = yCoordinates;
  42100. this.flags = flags;
  42101. }
  42102. }
  42103. class SimpleGlyph {
  42104. constructor({
  42105. contours,
  42106. instructions
  42107. }) {
  42108. this.contours = contours;
  42109. this.instructions = instructions;
  42110. }
  42111. static parse(pos, glyf, numberOfContours) {
  42112. const endPtsOfContours = [];
  42113. for (let i = 0; i < numberOfContours; i++) {
  42114. const endPt = glyf.getUint16(pos);
  42115. pos += 2;
  42116. endPtsOfContours.push(endPt);
  42117. }
  42118. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  42119. const instructionLength = glyf.getUint16(pos);
  42120. pos += 2;
  42121. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42122. pos += instructionLength;
  42123. const flags = [];
  42124. for (let i = 0; i < numberOfPt; pos++, i++) {
  42125. let flag = glyf.getUint8(pos);
  42126. flags.push(flag);
  42127. if (flag & REPEAT_FLAG) {
  42128. const count = glyf.getUint8(++pos);
  42129. flag ^= REPEAT_FLAG;
  42130. for (let m = 0; m < count; m++) {
  42131. flags.push(flag);
  42132. }
  42133. i += count;
  42134. }
  42135. }
  42136. const allXCoordinates = [];
  42137. let xCoordinates = [];
  42138. let yCoordinates = [];
  42139. let pointFlags = [];
  42140. const contours = [];
  42141. let endPtsOfContoursIndex = 0;
  42142. let lastCoordinate = 0;
  42143. for (let i = 0; i < numberOfPt; i++) {
  42144. const flag = flags[i];
  42145. if (flag & X_SHORT_VECTOR) {
  42146. const x = glyf.getUint8(pos++);
  42147. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  42148. xCoordinates.push(lastCoordinate);
  42149. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  42150. xCoordinates.push(lastCoordinate);
  42151. } else {
  42152. lastCoordinate += glyf.getInt16(pos);
  42153. pos += 2;
  42154. xCoordinates.push(lastCoordinate);
  42155. }
  42156. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42157. endPtsOfContoursIndex++;
  42158. allXCoordinates.push(xCoordinates);
  42159. xCoordinates = [];
  42160. }
  42161. }
  42162. lastCoordinate = 0;
  42163. endPtsOfContoursIndex = 0;
  42164. for (let i = 0; i < numberOfPt; i++) {
  42165. const flag = flags[i];
  42166. if (flag & Y_SHORT_VECTOR) {
  42167. const y = glyf.getUint8(pos++);
  42168. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  42169. yCoordinates.push(lastCoordinate);
  42170. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  42171. yCoordinates.push(lastCoordinate);
  42172. } else {
  42173. lastCoordinate += glyf.getInt16(pos);
  42174. pos += 2;
  42175. yCoordinates.push(lastCoordinate);
  42176. }
  42177. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  42178. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42179. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  42180. endPtsOfContoursIndex++;
  42181. contours.push(new Contour({
  42182. flags: pointFlags,
  42183. xCoordinates,
  42184. yCoordinates
  42185. }));
  42186. yCoordinates = [];
  42187. pointFlags = [];
  42188. }
  42189. }
  42190. return new SimpleGlyph({
  42191. contours,
  42192. instructions
  42193. });
  42194. }
  42195. getSize() {
  42196. let size = this.contours.length * 2 + 2 + this.instructions.length;
  42197. let lastX = 0;
  42198. let lastY = 0;
  42199. for (const contour of this.contours) {
  42200. size += contour.flags.length;
  42201. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42202. const x = contour.xCoordinates[i];
  42203. const y = contour.yCoordinates[i];
  42204. let abs = Math.abs(x - lastX);
  42205. if (abs > 255) {
  42206. size += 2;
  42207. } else if (abs > 0) {
  42208. size += 1;
  42209. }
  42210. lastX = x;
  42211. abs = Math.abs(y - lastY);
  42212. if (abs > 255) {
  42213. size += 2;
  42214. } else if (abs > 0) {
  42215. size += 1;
  42216. }
  42217. lastY = y;
  42218. }
  42219. }
  42220. return size;
  42221. }
  42222. write(pos, buf) {
  42223. const spos = pos;
  42224. const xCoordinates = [];
  42225. const yCoordinates = [];
  42226. const flags = [];
  42227. let lastX = 0;
  42228. let lastY = 0;
  42229. for (const contour of this.contours) {
  42230. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42231. let flag = contour.flags[i];
  42232. const x = contour.xCoordinates[i];
  42233. let delta = x - lastX;
  42234. if (delta === 0) {
  42235. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  42236. xCoordinates.push(0);
  42237. } else {
  42238. const abs = Math.abs(delta);
  42239. if (abs <= 255) {
  42240. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  42241. xCoordinates.push(abs);
  42242. } else {
  42243. xCoordinates.push(delta);
  42244. }
  42245. }
  42246. lastX = x;
  42247. const y = contour.yCoordinates[i];
  42248. delta = y - lastY;
  42249. if (delta === 0) {
  42250. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  42251. yCoordinates.push(0);
  42252. } else {
  42253. const abs = Math.abs(delta);
  42254. if (abs <= 255) {
  42255. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  42256. yCoordinates.push(abs);
  42257. } else {
  42258. yCoordinates.push(delta);
  42259. }
  42260. }
  42261. lastY = y;
  42262. flags.push(flag);
  42263. }
  42264. buf.setUint16(pos, xCoordinates.length - 1);
  42265. pos += 2;
  42266. }
  42267. buf.setUint16(pos, this.instructions.length);
  42268. pos += 2;
  42269. if (this.instructions.length) {
  42270. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42271. pos += this.instructions.length;
  42272. }
  42273. for (const flag of flags) {
  42274. buf.setUint8(pos++, flag);
  42275. }
  42276. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  42277. const x = xCoordinates[i];
  42278. const flag = flags[i];
  42279. if (flag & X_SHORT_VECTOR) {
  42280. buf.setUint8(pos++, x);
  42281. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  42282. buf.setInt16(pos, x);
  42283. pos += 2;
  42284. }
  42285. }
  42286. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  42287. const y = yCoordinates[i];
  42288. const flag = flags[i];
  42289. if (flag & Y_SHORT_VECTOR) {
  42290. buf.setUint8(pos++, y);
  42291. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  42292. buf.setInt16(pos, y);
  42293. pos += 2;
  42294. }
  42295. }
  42296. return pos - spos;
  42297. }
  42298. scale(x, factor) {
  42299. for (const contour of this.contours) {
  42300. if (contour.xCoordinates.length === 0) {
  42301. continue;
  42302. }
  42303. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42304. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  42305. }
  42306. }
  42307. }
  42308. }
  42309. class CompositeGlyph {
  42310. constructor({
  42311. flags,
  42312. glyphIndex,
  42313. argument1,
  42314. argument2,
  42315. transf,
  42316. instructions
  42317. }) {
  42318. this.flags = flags;
  42319. this.glyphIndex = glyphIndex;
  42320. this.argument1 = argument1;
  42321. this.argument2 = argument2;
  42322. this.transf = transf;
  42323. this.instructions = instructions;
  42324. }
  42325. static parse(pos, glyf) {
  42326. const spos = pos;
  42327. const transf = [];
  42328. let flags = glyf.getUint16(pos);
  42329. const glyphIndex = glyf.getUint16(pos + 2);
  42330. pos += 4;
  42331. let argument1, argument2;
  42332. if (flags & ARG_1_AND_2_ARE_WORDS) {
  42333. if (flags & ARGS_ARE_XY_VALUES) {
  42334. argument1 = glyf.getInt16(pos);
  42335. argument2 = glyf.getInt16(pos + 2);
  42336. } else {
  42337. argument1 = glyf.getUint16(pos);
  42338. argument2 = glyf.getUint16(pos + 2);
  42339. }
  42340. pos += 4;
  42341. flags ^= ARG_1_AND_2_ARE_WORDS;
  42342. } else {
  42343. if (flags & ARGS_ARE_XY_VALUES) {
  42344. argument1 = glyf.getInt8(pos);
  42345. argument2 = glyf.getInt8(pos + 1);
  42346. } else {
  42347. argument1 = glyf.getUint8(pos);
  42348. argument2 = glyf.getUint8(pos + 1);
  42349. }
  42350. pos += 2;
  42351. }
  42352. if (flags & WE_HAVE_A_SCALE) {
  42353. transf.push(glyf.getUint16(pos));
  42354. pos += 2;
  42355. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  42356. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  42357. pos += 4;
  42358. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  42359. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  42360. pos += 8;
  42361. }
  42362. let instructions = null;
  42363. if (flags & WE_HAVE_INSTRUCTIONS) {
  42364. const instructionLength = glyf.getUint16(pos);
  42365. pos += 2;
  42366. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42367. pos += instructionLength;
  42368. }
  42369. return [pos - spos, new CompositeGlyph({
  42370. flags,
  42371. glyphIndex,
  42372. argument1,
  42373. argument2,
  42374. transf,
  42375. instructions
  42376. })];
  42377. }
  42378. getSize() {
  42379. let size = 2 + 2 + this.transf.length * 2;
  42380. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42381. size += 2 + this.instructions.length;
  42382. }
  42383. size += 2;
  42384. if (this.flags & 2) {
  42385. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42386. size += 2;
  42387. }
  42388. } else {
  42389. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42390. size += 2;
  42391. }
  42392. }
  42393. return size;
  42394. }
  42395. write(pos, buf) {
  42396. const spos = pos;
  42397. if (this.flags & ARGS_ARE_XY_VALUES) {
  42398. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42399. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42400. }
  42401. } else {
  42402. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42403. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42404. }
  42405. }
  42406. buf.setUint16(pos, this.flags);
  42407. buf.setUint16(pos + 2, this.glyphIndex);
  42408. pos += 4;
  42409. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42410. if (this.flags & ARGS_ARE_XY_VALUES) {
  42411. buf.setInt16(pos, this.argument1);
  42412. buf.setInt16(pos + 2, this.argument2);
  42413. } else {
  42414. buf.setUint16(pos, this.argument1);
  42415. buf.setUint16(pos + 2, this.argument2);
  42416. }
  42417. pos += 4;
  42418. } else {
  42419. buf.setUint8(pos, this.argument1);
  42420. buf.setUint8(pos + 1, this.argument2);
  42421. pos += 2;
  42422. }
  42423. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42424. buf.setUint16(pos, this.instructions.length);
  42425. pos += 2;
  42426. if (this.instructions.length) {
  42427. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42428. pos += this.instructions.length;
  42429. }
  42430. }
  42431. return pos - spos;
  42432. }
  42433. scale(x, factor) {}
  42434. }
  42435. /***/ }),
  42436. /* 45 */
  42437. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42438. Object.defineProperty(exports, "__esModule", ({
  42439. value: true
  42440. }));
  42441. exports.OpenTypeFileBuilder = void 0;
  42442. var _core_utils = __w_pdfjs_require__(4);
  42443. var _util = __w_pdfjs_require__(2);
  42444. function writeInt16(dest, offset, num) {
  42445. dest[offset] = num >> 8 & 0xff;
  42446. dest[offset + 1] = num & 0xff;
  42447. }
  42448. function writeInt32(dest, offset, num) {
  42449. dest[offset] = num >> 24 & 0xff;
  42450. dest[offset + 1] = num >> 16 & 0xff;
  42451. dest[offset + 2] = num >> 8 & 0xff;
  42452. dest[offset + 3] = num & 0xff;
  42453. }
  42454. function writeData(dest, offset, data) {
  42455. if (data instanceof Uint8Array) {
  42456. dest.set(data, offset);
  42457. } else if (typeof data === "string") {
  42458. for (let i = 0, ii = data.length; i < ii; i++) {
  42459. dest[offset++] = data.charCodeAt(i) & 0xff;
  42460. }
  42461. } else {
  42462. for (const num of data) {
  42463. dest[offset++] = num & 0xff;
  42464. }
  42465. }
  42466. }
  42467. const OTF_HEADER_SIZE = 12;
  42468. const OTF_TABLE_ENTRY_SIZE = 16;
  42469. class OpenTypeFileBuilder {
  42470. constructor(sfnt) {
  42471. this.sfnt = sfnt;
  42472. this.tables = Object.create(null);
  42473. }
  42474. static getSearchParams(entriesCount, entrySize) {
  42475. let maxPower2 = 1,
  42476. log2 = 0;
  42477. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42478. maxPower2 <<= 1;
  42479. log2++;
  42480. }
  42481. const searchRange = maxPower2 * entrySize;
  42482. return {
  42483. range: searchRange,
  42484. entry: log2,
  42485. rangeShift: entrySize * entriesCount - searchRange
  42486. };
  42487. }
  42488. toArray() {
  42489. let sfnt = this.sfnt;
  42490. const tables = this.tables;
  42491. const tablesNames = Object.keys(tables);
  42492. tablesNames.sort();
  42493. const numTables = tablesNames.length;
  42494. let i, j, jj, table, tableName;
  42495. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42496. const tableOffsets = [offset];
  42497. for (i = 0; i < numTables; i++) {
  42498. table = tables[tablesNames[i]];
  42499. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42500. offset += paddedLength;
  42501. tableOffsets.push(offset);
  42502. }
  42503. const file = new Uint8Array(offset);
  42504. for (i = 0; i < numTables; i++) {
  42505. table = tables[tablesNames[i]];
  42506. writeData(file, tableOffsets[i], table);
  42507. }
  42508. if (sfnt === "true") {
  42509. sfnt = (0, _util.string32)(0x00010000);
  42510. }
  42511. file[0] = sfnt.charCodeAt(0) & 0xff;
  42512. file[1] = sfnt.charCodeAt(1) & 0xff;
  42513. file[2] = sfnt.charCodeAt(2) & 0xff;
  42514. file[3] = sfnt.charCodeAt(3) & 0xff;
  42515. writeInt16(file, 4, numTables);
  42516. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42517. writeInt16(file, 6, searchParams.range);
  42518. writeInt16(file, 8, searchParams.entry);
  42519. writeInt16(file, 10, searchParams.rangeShift);
  42520. offset = OTF_HEADER_SIZE;
  42521. for (i = 0; i < numTables; i++) {
  42522. tableName = tablesNames[i];
  42523. file[offset] = tableName.charCodeAt(0) & 0xff;
  42524. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42525. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42526. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42527. let checksum = 0;
  42528. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42529. const quad = (0, _core_utils.readUint32)(file, j);
  42530. checksum = checksum + quad >>> 0;
  42531. }
  42532. writeInt32(file, offset + 4, checksum);
  42533. writeInt32(file, offset + 8, tableOffsets[i]);
  42534. writeInt32(file, offset + 12, tables[tableName].length);
  42535. offset += OTF_TABLE_ENTRY_SIZE;
  42536. }
  42537. return file;
  42538. }
  42539. addTable(tag, data) {
  42540. if (tag in this.tables) {
  42541. throw new Error("Table " + tag + " already exists");
  42542. }
  42543. this.tables[tag] = data;
  42544. }
  42545. }
  42546. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42547. /***/ }),
  42548. /* 46 */
  42549. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42550. Object.defineProperty(exports, "__esModule", ({
  42551. value: true
  42552. }));
  42553. exports.Type1Font = void 0;
  42554. var _cff_parser = __w_pdfjs_require__(33);
  42555. var _util = __w_pdfjs_require__(2);
  42556. var _fonts_utils = __w_pdfjs_require__(36);
  42557. var _core_utils = __w_pdfjs_require__(4);
  42558. var _stream = __w_pdfjs_require__(8);
  42559. var _type1_parser = __w_pdfjs_require__(47);
  42560. function findBlock(streamBytes, signature, startIndex) {
  42561. const streamBytesLength = streamBytes.length;
  42562. const signatureLength = signature.length;
  42563. const scanLength = streamBytesLength - signatureLength;
  42564. let i = startIndex,
  42565. found = false;
  42566. while (i < scanLength) {
  42567. let j = 0;
  42568. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42569. j++;
  42570. }
  42571. if (j >= signatureLength) {
  42572. i += j;
  42573. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42574. i++;
  42575. }
  42576. found = true;
  42577. break;
  42578. }
  42579. i++;
  42580. }
  42581. return {
  42582. found,
  42583. length: i
  42584. };
  42585. }
  42586. function getHeaderBlock(stream, suggestedLength) {
  42587. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42588. const streamStartPos = stream.pos;
  42589. let headerBytes, headerBytesLength, block;
  42590. try {
  42591. headerBytes = stream.getBytes(suggestedLength);
  42592. headerBytesLength = headerBytes.length;
  42593. } catch (ex) {}
  42594. if (headerBytesLength === suggestedLength) {
  42595. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42596. if (block.found && block.length === suggestedLength) {
  42597. return {
  42598. stream: new _stream.Stream(headerBytes),
  42599. length: suggestedLength
  42600. };
  42601. }
  42602. }
  42603. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42604. stream.pos = streamStartPos;
  42605. const SCAN_BLOCK_LENGTH = 2048;
  42606. let actualLength;
  42607. while (true) {
  42608. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42609. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42610. if (block.length === 0) {
  42611. break;
  42612. }
  42613. stream.pos += block.length;
  42614. if (block.found) {
  42615. actualLength = stream.pos - streamStartPos;
  42616. break;
  42617. }
  42618. }
  42619. stream.pos = streamStartPos;
  42620. if (actualLength) {
  42621. return {
  42622. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42623. length: actualLength
  42624. };
  42625. }
  42626. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42627. return {
  42628. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42629. length: suggestedLength
  42630. };
  42631. }
  42632. function getEexecBlock(stream, suggestedLength) {
  42633. const eexecBytes = stream.getBytes();
  42634. if (eexecBytes.length === 0) {
  42635. throw new _util.FormatError("getEexecBlock - no font program found.");
  42636. }
  42637. return {
  42638. stream: new _stream.Stream(eexecBytes),
  42639. length: eexecBytes.length
  42640. };
  42641. }
  42642. class Type1Font {
  42643. constructor(name, file, properties) {
  42644. const PFB_HEADER_SIZE = 6;
  42645. let headerBlockLength = properties.length1;
  42646. let eexecBlockLength = properties.length2;
  42647. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42648. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42649. if (pfbHeaderPresent) {
  42650. file.skip(PFB_HEADER_SIZE);
  42651. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42652. }
  42653. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42654. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42655. headerBlockParser.extractFontHeader(properties);
  42656. if (pfbHeaderPresent) {
  42657. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42658. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42659. }
  42660. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42661. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42662. const data = eexecBlockParser.extractFontProgram(properties);
  42663. for (const key in data.properties) {
  42664. properties[key] = data.properties[key];
  42665. }
  42666. const charstrings = data.charstrings;
  42667. const type2Charstrings = this.getType2Charstrings(charstrings);
  42668. const subrs = this.getType2Subrs(data.subrs);
  42669. this.charstrings = charstrings;
  42670. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42671. this.seacs = this.getSeacs(data.charstrings);
  42672. }
  42673. get numGlyphs() {
  42674. return this.charstrings.length + 1;
  42675. }
  42676. getCharset() {
  42677. const charset = [".notdef"];
  42678. for (const {
  42679. glyphName
  42680. } of this.charstrings) {
  42681. charset.push(glyphName);
  42682. }
  42683. return charset;
  42684. }
  42685. getGlyphMapping(properties) {
  42686. const charstrings = this.charstrings;
  42687. if (properties.composite) {
  42688. const charCodeToGlyphId = Object.create(null);
  42689. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42690. const charCode = properties.cMap.charCodeOf(glyphId);
  42691. charCodeToGlyphId[charCode] = glyphId + 1;
  42692. }
  42693. return charCodeToGlyphId;
  42694. }
  42695. const glyphNames = [".notdef"];
  42696. let builtInEncoding, glyphId;
  42697. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42698. glyphNames.push(charstrings[glyphId].glyphName);
  42699. }
  42700. const encoding = properties.builtInEncoding;
  42701. if (encoding) {
  42702. builtInEncoding = Object.create(null);
  42703. for (const charCode in encoding) {
  42704. glyphId = glyphNames.indexOf(encoding[charCode]);
  42705. if (glyphId >= 0) {
  42706. builtInEncoding[charCode] = glyphId;
  42707. }
  42708. }
  42709. }
  42710. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42711. }
  42712. hasGlyphId(id) {
  42713. if (id < 0 || id >= this.numGlyphs) {
  42714. return false;
  42715. }
  42716. if (id === 0) {
  42717. return true;
  42718. }
  42719. const glyph = this.charstrings[id - 1];
  42720. return glyph.charstring.length > 0;
  42721. }
  42722. getSeacs(charstrings) {
  42723. const seacMap = [];
  42724. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42725. const charstring = charstrings[i];
  42726. if (charstring.seac) {
  42727. seacMap[i + 1] = charstring.seac;
  42728. }
  42729. }
  42730. return seacMap;
  42731. }
  42732. getType2Charstrings(type1Charstrings) {
  42733. const type2Charstrings = [];
  42734. for (const type1Charstring of type1Charstrings) {
  42735. type2Charstrings.push(type1Charstring.charstring);
  42736. }
  42737. return type2Charstrings;
  42738. }
  42739. getType2Subrs(type1Subrs) {
  42740. let bias = 0;
  42741. const count = type1Subrs.length;
  42742. if (count < 1133) {
  42743. bias = 107;
  42744. } else if (count < 33769) {
  42745. bias = 1131;
  42746. } else {
  42747. bias = 32768;
  42748. }
  42749. const type2Subrs = [];
  42750. let i;
  42751. for (i = 0; i < bias; i++) {
  42752. type2Subrs.push([0x0b]);
  42753. }
  42754. for (i = 0; i < count; i++) {
  42755. type2Subrs.push(type1Subrs[i]);
  42756. }
  42757. return type2Subrs;
  42758. }
  42759. wrap(name, glyphs, charstrings, subrs, properties) {
  42760. const cff = new _cff_parser.CFF();
  42761. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42762. cff.names = [name];
  42763. const topDict = new _cff_parser.CFFTopDict();
  42764. topDict.setByName("version", 391);
  42765. topDict.setByName("Notice", 392);
  42766. topDict.setByName("FullName", 393);
  42767. topDict.setByName("FamilyName", 394);
  42768. topDict.setByName("Weight", 395);
  42769. topDict.setByName("Encoding", null);
  42770. topDict.setByName("FontMatrix", properties.fontMatrix);
  42771. topDict.setByName("FontBBox", properties.bbox);
  42772. topDict.setByName("charset", null);
  42773. topDict.setByName("CharStrings", null);
  42774. topDict.setByName("Private", null);
  42775. cff.topDict = topDict;
  42776. const strings = new _cff_parser.CFFStrings();
  42777. strings.add("Version 0.11");
  42778. strings.add("See original notice");
  42779. strings.add(name);
  42780. strings.add(name);
  42781. strings.add("Medium");
  42782. cff.strings = strings;
  42783. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42784. const count = glyphs.length;
  42785. const charsetArray = [".notdef"];
  42786. let i, ii;
  42787. for (i = 0; i < count; i++) {
  42788. const glyphName = charstrings[i].glyphName;
  42789. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42790. if (index === -1) {
  42791. strings.add(glyphName);
  42792. }
  42793. charsetArray.push(glyphName);
  42794. }
  42795. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42796. const charStringsIndex = new _cff_parser.CFFIndex();
  42797. charStringsIndex.add([0x8b, 0x0e]);
  42798. for (i = 0; i < count; i++) {
  42799. charStringsIndex.add(glyphs[i]);
  42800. }
  42801. cff.charStrings = charStringsIndex;
  42802. const privateDict = new _cff_parser.CFFPrivateDict();
  42803. privateDict.setByName("Subrs", null);
  42804. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42805. for (i = 0, ii = fields.length; i < ii; i++) {
  42806. const field = fields[i];
  42807. if (!(field in properties.privateData)) {
  42808. continue;
  42809. }
  42810. const value = properties.privateData[field];
  42811. if (Array.isArray(value)) {
  42812. for (let j = value.length - 1; j > 0; j--) {
  42813. value[j] -= value[j - 1];
  42814. }
  42815. }
  42816. privateDict.setByName(field, value);
  42817. }
  42818. cff.topDict.privateDict = privateDict;
  42819. const subrIndex = new _cff_parser.CFFIndex();
  42820. for (i = 0, ii = subrs.length; i < ii; i++) {
  42821. subrIndex.add(subrs[i]);
  42822. }
  42823. privateDict.subrsIndex = subrIndex;
  42824. const compiler = new _cff_parser.CFFCompiler(cff);
  42825. return compiler.compile();
  42826. }
  42827. }
  42828. exports.Type1Font = Type1Font;
  42829. /***/ }),
  42830. /* 47 */
  42831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42832. Object.defineProperty(exports, "__esModule", ({
  42833. value: true
  42834. }));
  42835. exports.Type1Parser = void 0;
  42836. var _encodings = __w_pdfjs_require__(35);
  42837. var _core_utils = __w_pdfjs_require__(4);
  42838. var _stream = __w_pdfjs_require__(8);
  42839. var _util = __w_pdfjs_require__(2);
  42840. const HINTING_ENABLED = false;
  42841. const COMMAND_MAP = {
  42842. hstem: [1],
  42843. vstem: [3],
  42844. vmoveto: [4],
  42845. rlineto: [5],
  42846. hlineto: [6],
  42847. vlineto: [7],
  42848. rrcurveto: [8],
  42849. callsubr: [10],
  42850. flex: [12, 35],
  42851. drop: [12, 18],
  42852. endchar: [14],
  42853. rmoveto: [21],
  42854. hmoveto: [22],
  42855. vhcurveto: [30],
  42856. hvcurveto: [31]
  42857. };
  42858. class Type1CharString {
  42859. constructor() {
  42860. this.width = 0;
  42861. this.lsb = 0;
  42862. this.flexing = false;
  42863. this.output = [];
  42864. this.stack = [];
  42865. }
  42866. convert(encoded, subrs, seacAnalysisEnabled) {
  42867. const count = encoded.length;
  42868. let error = false;
  42869. let wx, sbx, subrNumber;
  42870. for (let i = 0; i < count; i++) {
  42871. let value = encoded[i];
  42872. if (value < 32) {
  42873. if (value === 12) {
  42874. value = (value << 8) + encoded[++i];
  42875. }
  42876. switch (value) {
  42877. case 1:
  42878. if (!HINTING_ENABLED) {
  42879. this.stack = [];
  42880. break;
  42881. }
  42882. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42883. break;
  42884. case 3:
  42885. if (!HINTING_ENABLED) {
  42886. this.stack = [];
  42887. break;
  42888. }
  42889. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42890. break;
  42891. case 4:
  42892. if (this.flexing) {
  42893. if (this.stack.length < 1) {
  42894. error = true;
  42895. break;
  42896. }
  42897. const dy = this.stack.pop();
  42898. this.stack.push(0, dy);
  42899. break;
  42900. }
  42901. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42902. break;
  42903. case 5:
  42904. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42905. break;
  42906. case 6:
  42907. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42908. break;
  42909. case 7:
  42910. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42911. break;
  42912. case 8:
  42913. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42914. break;
  42915. case 9:
  42916. this.stack = [];
  42917. break;
  42918. case 10:
  42919. if (this.stack.length < 1) {
  42920. error = true;
  42921. break;
  42922. }
  42923. subrNumber = this.stack.pop();
  42924. if (!subrs[subrNumber]) {
  42925. error = true;
  42926. break;
  42927. }
  42928. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42929. break;
  42930. case 11:
  42931. return error;
  42932. case 13:
  42933. if (this.stack.length < 2) {
  42934. error = true;
  42935. break;
  42936. }
  42937. wx = this.stack.pop();
  42938. sbx = this.stack.pop();
  42939. this.lsb = sbx;
  42940. this.width = wx;
  42941. this.stack.push(wx, sbx);
  42942. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42943. break;
  42944. case 14:
  42945. this.output.push(COMMAND_MAP.endchar[0]);
  42946. break;
  42947. case 21:
  42948. if (this.flexing) {
  42949. break;
  42950. }
  42951. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42952. break;
  42953. case 22:
  42954. if (this.flexing) {
  42955. this.stack.push(0);
  42956. break;
  42957. }
  42958. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42959. break;
  42960. case 30:
  42961. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42962. break;
  42963. case 31:
  42964. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42965. break;
  42966. case (12 << 8) + 0:
  42967. this.stack = [];
  42968. break;
  42969. case (12 << 8) + 1:
  42970. if (!HINTING_ENABLED) {
  42971. this.stack = [];
  42972. break;
  42973. }
  42974. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42975. break;
  42976. case (12 << 8) + 2:
  42977. if (!HINTING_ENABLED) {
  42978. this.stack = [];
  42979. break;
  42980. }
  42981. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42982. break;
  42983. case (12 << 8) + 6:
  42984. if (seacAnalysisEnabled) {
  42985. const asb = this.stack.at(-5);
  42986. this.seac = this.stack.splice(-4, 4);
  42987. this.seac[0] += this.lsb - asb;
  42988. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42989. } else {
  42990. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42991. }
  42992. break;
  42993. case (12 << 8) + 7:
  42994. if (this.stack.length < 4) {
  42995. error = true;
  42996. break;
  42997. }
  42998. this.stack.pop();
  42999. wx = this.stack.pop();
  43000. const sby = this.stack.pop();
  43001. sbx = this.stack.pop();
  43002. this.lsb = sbx;
  43003. this.width = wx;
  43004. this.stack.push(wx, sbx, sby);
  43005. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  43006. break;
  43007. case (12 << 8) + 12:
  43008. if (this.stack.length < 2) {
  43009. error = true;
  43010. break;
  43011. }
  43012. const num2 = this.stack.pop();
  43013. const num1 = this.stack.pop();
  43014. this.stack.push(num1 / num2);
  43015. break;
  43016. case (12 << 8) + 16:
  43017. if (this.stack.length < 2) {
  43018. error = true;
  43019. break;
  43020. }
  43021. subrNumber = this.stack.pop();
  43022. const numArgs = this.stack.pop();
  43023. if (subrNumber === 0 && numArgs === 3) {
  43024. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  43025. 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]);
  43026. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  43027. this.flexing = false;
  43028. this.stack.push(flexArgs[15], flexArgs[16]);
  43029. } else if (subrNumber === 1 && numArgs === 0) {
  43030. this.flexing = true;
  43031. }
  43032. break;
  43033. case (12 << 8) + 17:
  43034. break;
  43035. case (12 << 8) + 33:
  43036. this.stack = [];
  43037. break;
  43038. default:
  43039. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  43040. break;
  43041. }
  43042. if (error) {
  43043. break;
  43044. }
  43045. continue;
  43046. } else if (value <= 246) {
  43047. value -= 139;
  43048. } else if (value <= 250) {
  43049. value = (value - 247) * 256 + encoded[++i] + 108;
  43050. } else if (value <= 254) {
  43051. value = -((value - 251) * 256) - encoded[++i] - 108;
  43052. } else {
  43053. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  43054. }
  43055. this.stack.push(value);
  43056. }
  43057. return error;
  43058. }
  43059. executeCommand(howManyArgs, command, keepStack) {
  43060. const stackLength = this.stack.length;
  43061. if (howManyArgs > stackLength) {
  43062. return true;
  43063. }
  43064. const start = stackLength - howManyArgs;
  43065. for (let i = start; i < stackLength; i++) {
  43066. let value = this.stack[i];
  43067. if (Number.isInteger(value)) {
  43068. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  43069. } else {
  43070. value = 65536 * value | 0;
  43071. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  43072. }
  43073. }
  43074. this.output.push(...command);
  43075. if (keepStack) {
  43076. this.stack.splice(start, howManyArgs);
  43077. } else {
  43078. this.stack.length = 0;
  43079. }
  43080. return false;
  43081. }
  43082. }
  43083. const EEXEC_ENCRYPT_KEY = 55665;
  43084. const CHAR_STRS_ENCRYPT_KEY = 4330;
  43085. function isHexDigit(code) {
  43086. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  43087. }
  43088. function decrypt(data, key, discardNumber) {
  43089. if (discardNumber >= data.length) {
  43090. return new Uint8Array(0);
  43091. }
  43092. const c1 = 52845,
  43093. c2 = 22719;
  43094. let r = key | 0,
  43095. i,
  43096. j;
  43097. for (i = 0; i < discardNumber; i++) {
  43098. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  43099. }
  43100. const count = data.length - discardNumber;
  43101. const decrypted = new Uint8Array(count);
  43102. for (i = discardNumber, j = 0; j < count; i++, j++) {
  43103. const value = data[i];
  43104. decrypted[j] = value ^ r >> 8;
  43105. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43106. }
  43107. return decrypted;
  43108. }
  43109. function decryptAscii(data, key, discardNumber) {
  43110. const c1 = 52845,
  43111. c2 = 22719;
  43112. let r = key | 0;
  43113. const count = data.length,
  43114. maybeLength = count >>> 1;
  43115. const decrypted = new Uint8Array(maybeLength);
  43116. let i, j;
  43117. for (i = 0, j = 0; i < count; i++) {
  43118. const digit1 = data[i];
  43119. if (!isHexDigit(digit1)) {
  43120. continue;
  43121. }
  43122. i++;
  43123. let digit2;
  43124. while (i < count && !isHexDigit(digit2 = data[i])) {
  43125. i++;
  43126. }
  43127. if (i < count) {
  43128. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  43129. decrypted[j++] = value ^ r >> 8;
  43130. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43131. }
  43132. }
  43133. return decrypted.slice(discardNumber, j);
  43134. }
  43135. function isSpecial(c) {
  43136. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  43137. }
  43138. class Type1Parser {
  43139. constructor(stream, encrypted, seacAnalysisEnabled) {
  43140. if (encrypted) {
  43141. const data = stream.getBytes();
  43142. 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]));
  43143. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  43144. }
  43145. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  43146. this.stream = stream;
  43147. this.nextChar();
  43148. }
  43149. readNumberArray() {
  43150. this.getToken();
  43151. const array = [];
  43152. while (true) {
  43153. const token = this.getToken();
  43154. if (token === null || token === "]" || token === "}") {
  43155. break;
  43156. }
  43157. array.push(parseFloat(token || 0));
  43158. }
  43159. return array;
  43160. }
  43161. readNumber() {
  43162. const token = this.getToken();
  43163. return parseFloat(token || 0);
  43164. }
  43165. readInt() {
  43166. const token = this.getToken();
  43167. return parseInt(token || 0, 10) | 0;
  43168. }
  43169. readBoolean() {
  43170. const token = this.getToken();
  43171. return token === "true" ? 1 : 0;
  43172. }
  43173. nextChar() {
  43174. return this.currentChar = this.stream.getByte();
  43175. }
  43176. prevChar() {
  43177. this.stream.skip(-2);
  43178. return this.currentChar = this.stream.getByte();
  43179. }
  43180. getToken() {
  43181. let comment = false;
  43182. let ch = this.currentChar;
  43183. while (true) {
  43184. if (ch === -1) {
  43185. return null;
  43186. }
  43187. if (comment) {
  43188. if (ch === 0x0a || ch === 0x0d) {
  43189. comment = false;
  43190. }
  43191. } else if (ch === 0x25) {
  43192. comment = true;
  43193. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  43194. break;
  43195. }
  43196. ch = this.nextChar();
  43197. }
  43198. if (isSpecial(ch)) {
  43199. this.nextChar();
  43200. return String.fromCharCode(ch);
  43201. }
  43202. let token = "";
  43203. do {
  43204. token += String.fromCharCode(ch);
  43205. ch = this.nextChar();
  43206. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  43207. return token;
  43208. }
  43209. readCharStrings(bytes, lenIV) {
  43210. if (lenIV === -1) {
  43211. return bytes;
  43212. }
  43213. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  43214. }
  43215. extractFontProgram(properties) {
  43216. const stream = this.stream;
  43217. const subrs = [],
  43218. charstrings = [];
  43219. const privateData = Object.create(null);
  43220. privateData.lenIV = 4;
  43221. const program = {
  43222. subrs: [],
  43223. charstrings: [],
  43224. properties: {
  43225. privateData
  43226. }
  43227. };
  43228. let token, length, data, lenIV;
  43229. while ((token = this.getToken()) !== null) {
  43230. if (token !== "/") {
  43231. continue;
  43232. }
  43233. token = this.getToken();
  43234. switch (token) {
  43235. case "CharStrings":
  43236. this.getToken();
  43237. this.getToken();
  43238. this.getToken();
  43239. this.getToken();
  43240. while (true) {
  43241. token = this.getToken();
  43242. if (token === null || token === "end") {
  43243. break;
  43244. }
  43245. if (token !== "/") {
  43246. continue;
  43247. }
  43248. const glyph = this.getToken();
  43249. length = this.readInt();
  43250. this.getToken();
  43251. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43252. lenIV = program.properties.privateData.lenIV;
  43253. const encoded = this.readCharStrings(data, lenIV);
  43254. this.nextChar();
  43255. token = this.getToken();
  43256. if (token === "noaccess") {
  43257. this.getToken();
  43258. } else if (token === "/") {
  43259. this.prevChar();
  43260. }
  43261. charstrings.push({
  43262. glyph,
  43263. encoded
  43264. });
  43265. }
  43266. break;
  43267. case "Subrs":
  43268. this.readInt();
  43269. this.getToken();
  43270. while (this.getToken() === "dup") {
  43271. const index = this.readInt();
  43272. length = this.readInt();
  43273. this.getToken();
  43274. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43275. lenIV = program.properties.privateData.lenIV;
  43276. const encoded = this.readCharStrings(data, lenIV);
  43277. this.nextChar();
  43278. token = this.getToken();
  43279. if (token === "noaccess") {
  43280. this.getToken();
  43281. }
  43282. subrs[index] = encoded;
  43283. }
  43284. break;
  43285. case "BlueValues":
  43286. case "OtherBlues":
  43287. case "FamilyBlues":
  43288. case "FamilyOtherBlues":
  43289. const blueArray = this.readNumberArray();
  43290. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  43291. program.properties.privateData[token] = blueArray;
  43292. }
  43293. break;
  43294. case "StemSnapH":
  43295. case "StemSnapV":
  43296. program.properties.privateData[token] = this.readNumberArray();
  43297. break;
  43298. case "StdHW":
  43299. case "StdVW":
  43300. program.properties.privateData[token] = this.readNumberArray()[0];
  43301. break;
  43302. case "BlueShift":
  43303. case "lenIV":
  43304. case "BlueFuzz":
  43305. case "BlueScale":
  43306. case "LanguageGroup":
  43307. case "ExpansionFactor":
  43308. program.properties.privateData[token] = this.readNumber();
  43309. break;
  43310. case "ForceBold":
  43311. program.properties.privateData[token] = this.readBoolean();
  43312. break;
  43313. }
  43314. }
  43315. for (const {
  43316. encoded,
  43317. glyph
  43318. } of charstrings) {
  43319. const charString = new Type1CharString();
  43320. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  43321. let output = charString.output;
  43322. if (error) {
  43323. output = [14];
  43324. }
  43325. const charStringObject = {
  43326. glyphName: glyph,
  43327. charstring: output,
  43328. width: charString.width,
  43329. lsb: charString.lsb,
  43330. seac: charString.seac
  43331. };
  43332. if (glyph === ".notdef") {
  43333. program.charstrings.unshift(charStringObject);
  43334. } else {
  43335. program.charstrings.push(charStringObject);
  43336. }
  43337. if (properties.builtInEncoding) {
  43338. const index = properties.builtInEncoding.indexOf(glyph);
  43339. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  43340. properties.widths[index] = charString.width;
  43341. }
  43342. }
  43343. }
  43344. return program;
  43345. }
  43346. extractFontHeader(properties) {
  43347. let token;
  43348. while ((token = this.getToken()) !== null) {
  43349. if (token !== "/") {
  43350. continue;
  43351. }
  43352. token = this.getToken();
  43353. switch (token) {
  43354. case "FontMatrix":
  43355. const matrix = this.readNumberArray();
  43356. properties.fontMatrix = matrix;
  43357. break;
  43358. case "Encoding":
  43359. const encodingArg = this.getToken();
  43360. let encoding;
  43361. if (!/^\d+$/.test(encodingArg)) {
  43362. encoding = (0, _encodings.getEncoding)(encodingArg);
  43363. } else {
  43364. encoding = [];
  43365. const size = parseInt(encodingArg, 10) | 0;
  43366. this.getToken();
  43367. for (let j = 0; j < size; j++) {
  43368. token = this.getToken();
  43369. while (token !== "dup" && token !== "def") {
  43370. token = this.getToken();
  43371. if (token === null) {
  43372. return;
  43373. }
  43374. }
  43375. if (token === "def") {
  43376. break;
  43377. }
  43378. const index = this.readInt();
  43379. this.getToken();
  43380. const glyph = this.getToken();
  43381. encoding[index] = glyph;
  43382. this.getToken();
  43383. }
  43384. }
  43385. properties.builtInEncoding = encoding;
  43386. break;
  43387. case "FontBBox":
  43388. const fontBBox = this.readNumberArray();
  43389. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  43390. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43391. properties.ascentScaled = true;
  43392. break;
  43393. }
  43394. }
  43395. }
  43396. }
  43397. exports.Type1Parser = Type1Parser;
  43398. /***/ }),
  43399. /* 48 */
  43400. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43401. Object.defineProperty(exports, "__esModule", ({
  43402. value: true
  43403. }));
  43404. exports.Pattern = void 0;
  43405. exports.getTilingPatternIR = getTilingPatternIR;
  43406. var _util = __w_pdfjs_require__(2);
  43407. var _base_stream = __w_pdfjs_require__(5);
  43408. var _colorspace = __w_pdfjs_require__(12);
  43409. var _core_utils = __w_pdfjs_require__(4);
  43410. const ShadingType = {
  43411. FUNCTION_BASED: 1,
  43412. AXIAL: 2,
  43413. RADIAL: 3,
  43414. FREE_FORM_MESH: 4,
  43415. LATTICE_FORM_MESH: 5,
  43416. COONS_PATCH_MESH: 6,
  43417. TENSOR_PATCH_MESH: 7
  43418. };
  43419. class Pattern {
  43420. constructor() {
  43421. (0, _util.unreachable)("Cannot initialize Pattern.");
  43422. }
  43423. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43424. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43425. const type = dict.get("ShadingType");
  43426. try {
  43427. switch (type) {
  43428. case ShadingType.AXIAL:
  43429. case ShadingType.RADIAL:
  43430. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43431. case ShadingType.FREE_FORM_MESH:
  43432. case ShadingType.LATTICE_FORM_MESH:
  43433. case ShadingType.COONS_PATCH_MESH:
  43434. case ShadingType.TENSOR_PATCH_MESH:
  43435. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43436. default:
  43437. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43438. }
  43439. } catch (ex) {
  43440. if (ex instanceof _core_utils.MissingDataException) {
  43441. throw ex;
  43442. }
  43443. handler.send("UnsupportedFeature", {
  43444. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43445. });
  43446. (0, _util.warn)(ex);
  43447. return new DummyShading();
  43448. }
  43449. }
  43450. }
  43451. exports.Pattern = Pattern;
  43452. class BaseShading {
  43453. static get SMALL_NUMBER() {
  43454. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43455. }
  43456. constructor() {
  43457. if (this.constructor === BaseShading) {
  43458. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43459. }
  43460. }
  43461. getIR() {
  43462. (0, _util.unreachable)("Abstract method `getIR` called.");
  43463. }
  43464. }
  43465. class RadialAxialShading extends BaseShading {
  43466. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43467. super();
  43468. this.coordsArr = dict.getArray("Coords");
  43469. this.shadingType = dict.get("ShadingType");
  43470. const cs = _colorspace.ColorSpace.parse({
  43471. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43472. xref,
  43473. resources,
  43474. pdfFunctionFactory,
  43475. localColorSpaceCache
  43476. });
  43477. const bbox = dict.getArray("BBox");
  43478. if (Array.isArray(bbox) && bbox.length === 4) {
  43479. this.bbox = _util.Util.normalizeRect(bbox);
  43480. } else {
  43481. this.bbox = null;
  43482. }
  43483. let t0 = 0.0,
  43484. t1 = 1.0;
  43485. if (dict.has("Domain")) {
  43486. const domainArr = dict.getArray("Domain");
  43487. t0 = domainArr[0];
  43488. t1 = domainArr[1];
  43489. }
  43490. let extendStart = false,
  43491. extendEnd = false;
  43492. if (dict.has("Extend")) {
  43493. const extendArr = dict.getArray("Extend");
  43494. extendStart = extendArr[0];
  43495. extendEnd = extendArr[1];
  43496. }
  43497. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43498. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43499. const distance = Math.hypot(x1 - x2, y1 - y2);
  43500. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43501. (0, _util.warn)("Unsupported radial gradient.");
  43502. }
  43503. }
  43504. this.extendStart = extendStart;
  43505. this.extendEnd = extendEnd;
  43506. const fnObj = dict.getRaw("Function");
  43507. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43508. const NUMBER_OF_SAMPLES = 10;
  43509. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43510. const colorStops = this.colorStops = [];
  43511. if (t0 >= t1 || step <= 0) {
  43512. (0, _util.info)("Bad shading domain.");
  43513. return;
  43514. }
  43515. const color = new Float32Array(cs.numComps),
  43516. ratio = new Float32Array(1);
  43517. let rgbColor;
  43518. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43519. ratio[0] = t0 + i * step;
  43520. fn(ratio, 0, color, 0);
  43521. rgbColor = cs.getRgb(color, 0);
  43522. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43523. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43524. }
  43525. let background = "transparent";
  43526. if (dict.has("Background")) {
  43527. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43528. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43529. }
  43530. if (!extendStart) {
  43531. colorStops.unshift([0, background]);
  43532. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43533. }
  43534. if (!extendEnd) {
  43535. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43536. colorStops.push([1, background]);
  43537. }
  43538. this.colorStops = colorStops;
  43539. }
  43540. getIR() {
  43541. const coordsArr = this.coordsArr;
  43542. const shadingType = this.shadingType;
  43543. let type, p0, p1, r0, r1;
  43544. if (shadingType === ShadingType.AXIAL) {
  43545. p0 = [coordsArr[0], coordsArr[1]];
  43546. p1 = [coordsArr[2], coordsArr[3]];
  43547. r0 = null;
  43548. r1 = null;
  43549. type = "axial";
  43550. } else if (shadingType === ShadingType.RADIAL) {
  43551. p0 = [coordsArr[0], coordsArr[1]];
  43552. p1 = [coordsArr[3], coordsArr[4]];
  43553. r0 = coordsArr[2];
  43554. r1 = coordsArr[5];
  43555. type = "radial";
  43556. } else {
  43557. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43558. }
  43559. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43560. }
  43561. }
  43562. class MeshStreamReader {
  43563. constructor(stream, context) {
  43564. this.stream = stream;
  43565. this.context = context;
  43566. this.buffer = 0;
  43567. this.bufferLength = 0;
  43568. const numComps = context.numComps;
  43569. this.tmpCompsBuf = new Float32Array(numComps);
  43570. const csNumComps = context.colorSpace.numComps;
  43571. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43572. }
  43573. get hasData() {
  43574. if (this.stream.end) {
  43575. return this.stream.pos < this.stream.end;
  43576. }
  43577. if (this.bufferLength > 0) {
  43578. return true;
  43579. }
  43580. const nextByte = this.stream.getByte();
  43581. if (nextByte < 0) {
  43582. return false;
  43583. }
  43584. this.buffer = nextByte;
  43585. this.bufferLength = 8;
  43586. return true;
  43587. }
  43588. readBits(n) {
  43589. let buffer = this.buffer;
  43590. let bufferLength = this.bufferLength;
  43591. if (n === 32) {
  43592. if (bufferLength === 0) {
  43593. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43594. }
  43595. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43596. const nextByte = this.stream.getByte();
  43597. this.buffer = nextByte & (1 << bufferLength) - 1;
  43598. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43599. }
  43600. if (n === 8 && bufferLength === 0) {
  43601. return this.stream.getByte();
  43602. }
  43603. while (bufferLength < n) {
  43604. buffer = buffer << 8 | this.stream.getByte();
  43605. bufferLength += 8;
  43606. }
  43607. bufferLength -= n;
  43608. this.bufferLength = bufferLength;
  43609. this.buffer = buffer & (1 << bufferLength) - 1;
  43610. return buffer >> bufferLength;
  43611. }
  43612. align() {
  43613. this.buffer = 0;
  43614. this.bufferLength = 0;
  43615. }
  43616. readFlag() {
  43617. return this.readBits(this.context.bitsPerFlag);
  43618. }
  43619. readCoordinate() {
  43620. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43621. const xi = this.readBits(bitsPerCoordinate);
  43622. const yi = this.readBits(bitsPerCoordinate);
  43623. const decode = this.context.decode;
  43624. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43625. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43626. }
  43627. readComponents() {
  43628. const numComps = this.context.numComps;
  43629. const bitsPerComponent = this.context.bitsPerComponent;
  43630. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43631. const decode = this.context.decode;
  43632. const components = this.tmpCompsBuf;
  43633. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43634. const ci = this.readBits(bitsPerComponent);
  43635. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43636. }
  43637. const color = this.tmpCsCompsBuf;
  43638. if (this.context.colorFn) {
  43639. this.context.colorFn(components, 0, color, 0);
  43640. }
  43641. return this.context.colorSpace.getRgb(color, 0);
  43642. }
  43643. }
  43644. const getB = function getBClosure() {
  43645. function buildB(count) {
  43646. const lut = [];
  43647. for (let i = 0; i <= count; i++) {
  43648. const t = i / count,
  43649. t_ = 1 - t;
  43650. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43651. }
  43652. return lut;
  43653. }
  43654. const cache = [];
  43655. return function (count) {
  43656. if (!cache[count]) {
  43657. cache[count] = buildB(count);
  43658. }
  43659. return cache[count];
  43660. };
  43661. }();
  43662. class MeshShading extends BaseShading {
  43663. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43664. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43665. }
  43666. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43667. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43668. }
  43669. static get TRIANGLE_DENSITY() {
  43670. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43671. }
  43672. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43673. super();
  43674. if (!(stream instanceof _base_stream.BaseStream)) {
  43675. throw new _util.FormatError("Mesh data is not a stream");
  43676. }
  43677. const dict = stream.dict;
  43678. this.shadingType = dict.get("ShadingType");
  43679. const bbox = dict.getArray("BBox");
  43680. if (Array.isArray(bbox) && bbox.length === 4) {
  43681. this.bbox = _util.Util.normalizeRect(bbox);
  43682. } else {
  43683. this.bbox = null;
  43684. }
  43685. const cs = _colorspace.ColorSpace.parse({
  43686. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43687. xref,
  43688. resources,
  43689. pdfFunctionFactory,
  43690. localColorSpaceCache
  43691. });
  43692. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43693. const fnObj = dict.getRaw("Function");
  43694. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43695. this.coords = [];
  43696. this.colors = [];
  43697. this.figures = [];
  43698. const decodeContext = {
  43699. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43700. bitsPerComponent: dict.get("BitsPerComponent"),
  43701. bitsPerFlag: dict.get("BitsPerFlag"),
  43702. decode: dict.getArray("Decode"),
  43703. colorFn: fn,
  43704. colorSpace: cs,
  43705. numComps: fn ? 1 : cs.numComps
  43706. };
  43707. const reader = new MeshStreamReader(stream, decodeContext);
  43708. let patchMesh = false;
  43709. switch (this.shadingType) {
  43710. case ShadingType.FREE_FORM_MESH:
  43711. this._decodeType4Shading(reader);
  43712. break;
  43713. case ShadingType.LATTICE_FORM_MESH:
  43714. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43715. if (verticesPerRow < 2) {
  43716. throw new _util.FormatError("Invalid VerticesPerRow");
  43717. }
  43718. this._decodeType5Shading(reader, verticesPerRow);
  43719. break;
  43720. case ShadingType.COONS_PATCH_MESH:
  43721. this._decodeType6Shading(reader);
  43722. patchMesh = true;
  43723. break;
  43724. case ShadingType.TENSOR_PATCH_MESH:
  43725. this._decodeType7Shading(reader);
  43726. patchMesh = true;
  43727. break;
  43728. default:
  43729. (0, _util.unreachable)("Unsupported mesh type.");
  43730. break;
  43731. }
  43732. if (patchMesh) {
  43733. this._updateBounds();
  43734. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43735. this._buildFigureFromPatch(i);
  43736. }
  43737. }
  43738. this._updateBounds();
  43739. this._packData();
  43740. }
  43741. _decodeType4Shading(reader) {
  43742. const coords = this.coords;
  43743. const colors = this.colors;
  43744. const operators = [];
  43745. const ps = [];
  43746. let verticesLeft = 0;
  43747. while (reader.hasData) {
  43748. const f = reader.readFlag();
  43749. const coord = reader.readCoordinate();
  43750. const color = reader.readComponents();
  43751. if (verticesLeft === 0) {
  43752. if (!(0 <= f && f <= 2)) {
  43753. throw new _util.FormatError("Unknown type4 flag");
  43754. }
  43755. switch (f) {
  43756. case 0:
  43757. verticesLeft = 3;
  43758. break;
  43759. case 1:
  43760. ps.push(ps.at(-2), ps.at(-1));
  43761. verticesLeft = 1;
  43762. break;
  43763. case 2:
  43764. ps.push(ps.at(-3), ps.at(-1));
  43765. verticesLeft = 1;
  43766. break;
  43767. }
  43768. operators.push(f);
  43769. }
  43770. ps.push(coords.length);
  43771. coords.push(coord);
  43772. colors.push(color);
  43773. verticesLeft--;
  43774. reader.align();
  43775. }
  43776. this.figures.push({
  43777. type: "triangles",
  43778. coords: new Int32Array(ps),
  43779. colors: new Int32Array(ps)
  43780. });
  43781. }
  43782. _decodeType5Shading(reader, verticesPerRow) {
  43783. const coords = this.coords;
  43784. const colors = this.colors;
  43785. const ps = [];
  43786. while (reader.hasData) {
  43787. const coord = reader.readCoordinate();
  43788. const color = reader.readComponents();
  43789. ps.push(coords.length);
  43790. coords.push(coord);
  43791. colors.push(color);
  43792. }
  43793. this.figures.push({
  43794. type: "lattice",
  43795. coords: new Int32Array(ps),
  43796. colors: new Int32Array(ps),
  43797. verticesPerRow
  43798. });
  43799. }
  43800. _decodeType6Shading(reader) {
  43801. const coords = this.coords;
  43802. const colors = this.colors;
  43803. const ps = new Int32Array(16);
  43804. const cs = new Int32Array(4);
  43805. while (reader.hasData) {
  43806. const f = reader.readFlag();
  43807. if (!(0 <= f && f <= 3)) {
  43808. throw new _util.FormatError("Unknown type6 flag");
  43809. }
  43810. const pi = coords.length;
  43811. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43812. coords.push(reader.readCoordinate());
  43813. }
  43814. const ci = colors.length;
  43815. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43816. colors.push(reader.readComponents());
  43817. }
  43818. let tmp1, tmp2, tmp3, tmp4;
  43819. switch (f) {
  43820. case 0:
  43821. ps[12] = pi + 3;
  43822. ps[13] = pi + 4;
  43823. ps[14] = pi + 5;
  43824. ps[15] = pi + 6;
  43825. ps[8] = pi + 2;
  43826. ps[11] = pi + 7;
  43827. ps[4] = pi + 1;
  43828. ps[7] = pi + 8;
  43829. ps[0] = pi;
  43830. ps[1] = pi + 11;
  43831. ps[2] = pi + 10;
  43832. ps[3] = pi + 9;
  43833. cs[2] = ci + 1;
  43834. cs[3] = ci + 2;
  43835. cs[0] = ci;
  43836. cs[1] = ci + 3;
  43837. break;
  43838. case 1:
  43839. tmp1 = ps[12];
  43840. tmp2 = ps[13];
  43841. tmp3 = ps[14];
  43842. tmp4 = ps[15];
  43843. ps[12] = tmp4;
  43844. ps[13] = pi + 0;
  43845. ps[14] = pi + 1;
  43846. ps[15] = pi + 2;
  43847. ps[8] = tmp3;
  43848. ps[11] = pi + 3;
  43849. ps[4] = tmp2;
  43850. ps[7] = pi + 4;
  43851. ps[0] = tmp1;
  43852. ps[1] = pi + 7;
  43853. ps[2] = pi + 6;
  43854. ps[3] = pi + 5;
  43855. tmp1 = cs[2];
  43856. tmp2 = cs[3];
  43857. cs[2] = tmp2;
  43858. cs[3] = ci;
  43859. cs[0] = tmp1;
  43860. cs[1] = ci + 1;
  43861. break;
  43862. case 2:
  43863. tmp1 = ps[15];
  43864. tmp2 = ps[11];
  43865. ps[12] = ps[3];
  43866. ps[13] = pi + 0;
  43867. ps[14] = pi + 1;
  43868. ps[15] = pi + 2;
  43869. ps[8] = ps[7];
  43870. ps[11] = pi + 3;
  43871. ps[4] = tmp2;
  43872. ps[7] = pi + 4;
  43873. ps[0] = tmp1;
  43874. ps[1] = pi + 7;
  43875. ps[2] = pi + 6;
  43876. ps[3] = pi + 5;
  43877. tmp1 = cs[3];
  43878. cs[2] = cs[1];
  43879. cs[3] = ci;
  43880. cs[0] = tmp1;
  43881. cs[1] = ci + 1;
  43882. break;
  43883. case 3:
  43884. ps[12] = ps[0];
  43885. ps[13] = pi + 0;
  43886. ps[14] = pi + 1;
  43887. ps[15] = pi + 2;
  43888. ps[8] = ps[1];
  43889. ps[11] = pi + 3;
  43890. ps[4] = ps[2];
  43891. ps[7] = pi + 4;
  43892. ps[0] = ps[3];
  43893. ps[1] = pi + 7;
  43894. ps[2] = pi + 6;
  43895. ps[3] = pi + 5;
  43896. cs[2] = cs[0];
  43897. cs[3] = ci;
  43898. cs[0] = cs[1];
  43899. cs[1] = ci + 1;
  43900. break;
  43901. }
  43902. ps[5] = coords.length;
  43903. 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]);
  43904. ps[6] = coords.length;
  43905. 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]);
  43906. ps[9] = coords.length;
  43907. 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]);
  43908. ps[10] = coords.length;
  43909. 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]);
  43910. this.figures.push({
  43911. type: "patch",
  43912. coords: new Int32Array(ps),
  43913. colors: new Int32Array(cs)
  43914. });
  43915. }
  43916. }
  43917. _decodeType7Shading(reader) {
  43918. const coords = this.coords;
  43919. const colors = this.colors;
  43920. const ps = new Int32Array(16);
  43921. const cs = new Int32Array(4);
  43922. while (reader.hasData) {
  43923. const f = reader.readFlag();
  43924. if (!(0 <= f && f <= 3)) {
  43925. throw new _util.FormatError("Unknown type7 flag");
  43926. }
  43927. const pi = coords.length;
  43928. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43929. coords.push(reader.readCoordinate());
  43930. }
  43931. const ci = colors.length;
  43932. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43933. colors.push(reader.readComponents());
  43934. }
  43935. let tmp1, tmp2, tmp3, tmp4;
  43936. switch (f) {
  43937. case 0:
  43938. ps[12] = pi + 3;
  43939. ps[13] = pi + 4;
  43940. ps[14] = pi + 5;
  43941. ps[15] = pi + 6;
  43942. ps[8] = pi + 2;
  43943. ps[9] = pi + 13;
  43944. ps[10] = pi + 14;
  43945. ps[11] = pi + 7;
  43946. ps[4] = pi + 1;
  43947. ps[5] = pi + 12;
  43948. ps[6] = pi + 15;
  43949. ps[7] = pi + 8;
  43950. ps[0] = pi;
  43951. ps[1] = pi + 11;
  43952. ps[2] = pi + 10;
  43953. ps[3] = pi + 9;
  43954. cs[2] = ci + 1;
  43955. cs[3] = ci + 2;
  43956. cs[0] = ci;
  43957. cs[1] = ci + 3;
  43958. break;
  43959. case 1:
  43960. tmp1 = ps[12];
  43961. tmp2 = ps[13];
  43962. tmp3 = ps[14];
  43963. tmp4 = ps[15];
  43964. ps[12] = tmp4;
  43965. ps[13] = pi + 0;
  43966. ps[14] = pi + 1;
  43967. ps[15] = pi + 2;
  43968. ps[8] = tmp3;
  43969. ps[9] = pi + 9;
  43970. ps[10] = pi + 10;
  43971. ps[11] = pi + 3;
  43972. ps[4] = tmp2;
  43973. ps[5] = pi + 8;
  43974. ps[6] = pi + 11;
  43975. ps[7] = pi + 4;
  43976. ps[0] = tmp1;
  43977. ps[1] = pi + 7;
  43978. ps[2] = pi + 6;
  43979. ps[3] = pi + 5;
  43980. tmp1 = cs[2];
  43981. tmp2 = cs[3];
  43982. cs[2] = tmp2;
  43983. cs[3] = ci;
  43984. cs[0] = tmp1;
  43985. cs[1] = ci + 1;
  43986. break;
  43987. case 2:
  43988. tmp1 = ps[15];
  43989. tmp2 = ps[11];
  43990. ps[12] = ps[3];
  43991. ps[13] = pi + 0;
  43992. ps[14] = pi + 1;
  43993. ps[15] = pi + 2;
  43994. ps[8] = ps[7];
  43995. ps[9] = pi + 9;
  43996. ps[10] = pi + 10;
  43997. ps[11] = pi + 3;
  43998. ps[4] = tmp2;
  43999. ps[5] = pi + 8;
  44000. ps[6] = pi + 11;
  44001. ps[7] = pi + 4;
  44002. ps[0] = tmp1;
  44003. ps[1] = pi + 7;
  44004. ps[2] = pi + 6;
  44005. ps[3] = pi + 5;
  44006. tmp1 = cs[3];
  44007. cs[2] = cs[1];
  44008. cs[3] = ci;
  44009. cs[0] = tmp1;
  44010. cs[1] = ci + 1;
  44011. break;
  44012. case 3:
  44013. ps[12] = ps[0];
  44014. ps[13] = pi + 0;
  44015. ps[14] = pi + 1;
  44016. ps[15] = pi + 2;
  44017. ps[8] = ps[1];
  44018. ps[9] = pi + 9;
  44019. ps[10] = pi + 10;
  44020. ps[11] = pi + 3;
  44021. ps[4] = ps[2];
  44022. ps[5] = pi + 8;
  44023. ps[6] = pi + 11;
  44024. ps[7] = pi + 4;
  44025. ps[0] = ps[3];
  44026. ps[1] = pi + 7;
  44027. ps[2] = pi + 6;
  44028. ps[3] = pi + 5;
  44029. cs[2] = cs[0];
  44030. cs[3] = ci;
  44031. cs[0] = cs[1];
  44032. cs[1] = ci + 1;
  44033. break;
  44034. }
  44035. this.figures.push({
  44036. type: "patch",
  44037. coords: new Int32Array(ps),
  44038. colors: new Int32Array(cs)
  44039. });
  44040. }
  44041. }
  44042. _buildFigureFromPatch(index) {
  44043. const figure = this.figures[index];
  44044. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  44045. const coords = this.coords,
  44046. colors = this.colors;
  44047. const pi = figure.coords;
  44048. const ci = figure.colors;
  44049. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44050. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44051. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44052. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44053. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  44054. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  44055. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  44056. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  44057. const verticesPerRow = splitXBy + 1;
  44058. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  44059. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  44060. let k = 0;
  44061. const cl = new Uint8Array(3),
  44062. cr = new Uint8Array(3);
  44063. const c0 = colors[ci[0]],
  44064. c1 = colors[ci[1]],
  44065. c2 = colors[ci[2]],
  44066. c3 = colors[ci[3]];
  44067. const bRow = getB(splitYBy),
  44068. bCol = getB(splitXBy);
  44069. for (let row = 0; row <= splitYBy; row++) {
  44070. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  44071. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  44072. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  44073. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  44074. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  44075. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  44076. for (let col = 0; col <= splitXBy; col++, k++) {
  44077. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  44078. continue;
  44079. }
  44080. let x = 0,
  44081. y = 0;
  44082. let q = 0;
  44083. for (let i = 0; i <= 3; i++) {
  44084. for (let j = 0; j <= 3; j++, q++) {
  44085. const m = bRow[row][i] * bCol[col][j];
  44086. x += coords[pi[q]][0] * m;
  44087. y += coords[pi[q]][1] * m;
  44088. }
  44089. }
  44090. figureCoords[k] = coords.length;
  44091. coords.push([x, y]);
  44092. figureColors[k] = colors.length;
  44093. const newColor = new Uint8Array(3);
  44094. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  44095. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  44096. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  44097. colors.push(newColor);
  44098. }
  44099. }
  44100. figureCoords[0] = pi[0];
  44101. figureColors[0] = ci[0];
  44102. figureCoords[splitXBy] = pi[3];
  44103. figureColors[splitXBy] = ci[1];
  44104. figureCoords[verticesPerRow * splitYBy] = pi[12];
  44105. figureColors[verticesPerRow * splitYBy] = ci[2];
  44106. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  44107. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  44108. this.figures[index] = {
  44109. type: "lattice",
  44110. coords: figureCoords,
  44111. colors: figureColors,
  44112. verticesPerRow
  44113. };
  44114. }
  44115. _updateBounds() {
  44116. let minX = this.coords[0][0],
  44117. minY = this.coords[0][1],
  44118. maxX = minX,
  44119. maxY = minY;
  44120. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  44121. const x = this.coords[i][0],
  44122. y = this.coords[i][1];
  44123. minX = minX > x ? x : minX;
  44124. minY = minY > y ? y : minY;
  44125. maxX = maxX < x ? x : maxX;
  44126. maxY = maxY < y ? y : maxY;
  44127. }
  44128. this.bounds = [minX, minY, maxX, maxY];
  44129. }
  44130. _packData() {
  44131. let i, ii, j, jj;
  44132. const coords = this.coords;
  44133. const coordsPacked = new Float32Array(coords.length * 2);
  44134. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  44135. const xy = coords[i];
  44136. coordsPacked[j++] = xy[0];
  44137. coordsPacked[j++] = xy[1];
  44138. }
  44139. this.coords = coordsPacked;
  44140. const colors = this.colors;
  44141. const colorsPacked = new Uint8Array(colors.length * 3);
  44142. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  44143. const c = colors[i];
  44144. colorsPacked[j++] = c[0];
  44145. colorsPacked[j++] = c[1];
  44146. colorsPacked[j++] = c[2];
  44147. }
  44148. this.colors = colorsPacked;
  44149. const figures = this.figures;
  44150. for (i = 0, ii = figures.length; i < ii; i++) {
  44151. const figure = figures[i],
  44152. ps = figure.coords,
  44153. cs = figure.colors;
  44154. for (j = 0, jj = ps.length; j < jj; j++) {
  44155. ps[j] *= 2;
  44156. cs[j] *= 3;
  44157. }
  44158. }
  44159. }
  44160. getIR() {
  44161. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  44162. }
  44163. }
  44164. class DummyShading extends BaseShading {
  44165. getIR() {
  44166. return ["Dummy"];
  44167. }
  44168. }
  44169. function getTilingPatternIR(operatorList, dict, color) {
  44170. const matrix = dict.getArray("Matrix");
  44171. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  44172. const xstep = dict.get("XStep");
  44173. const ystep = dict.get("YStep");
  44174. const paintType = dict.get("PaintType");
  44175. const tilingType = dict.get("TilingType");
  44176. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  44177. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  44178. }
  44179. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  44180. }
  44181. /***/ }),
  44182. /* 49 */
  44183. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44184. Object.defineProperty(exports, "__esModule", ({
  44185. value: true
  44186. }));
  44187. exports.getXfaFontDict = getXfaFontDict;
  44188. exports.getXfaFontName = getXfaFontName;
  44189. var _calibri_factors = __w_pdfjs_require__(50);
  44190. var _primitives = __w_pdfjs_require__(3);
  44191. var _helvetica_factors = __w_pdfjs_require__(51);
  44192. var _liberationsans_widths = __w_pdfjs_require__(52);
  44193. var _myriadpro_factors = __w_pdfjs_require__(53);
  44194. var _segoeui_factors = __w_pdfjs_require__(54);
  44195. var _core_utils = __w_pdfjs_require__(4);
  44196. var _fonts_utils = __w_pdfjs_require__(36);
  44197. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  44198. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  44199. name: "LiberationSans-Regular",
  44200. factors: _myriadpro_factors.MyriadProRegularFactors,
  44201. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44202. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44203. metrics: _myriadpro_factors.MyriadProRegularMetrics
  44204. };
  44205. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  44206. name: "LiberationSans-Bold",
  44207. factors: _myriadpro_factors.MyriadProBoldFactors,
  44208. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44209. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44210. metrics: _myriadpro_factors.MyriadProBoldMetrics
  44211. };
  44212. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  44213. name: "LiberationSans-Italic",
  44214. factors: _myriadpro_factors.MyriadProItalicFactors,
  44215. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44216. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44217. metrics: _myriadpro_factors.MyriadProItalicMetrics
  44218. };
  44219. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  44220. name: "LiberationSans-BoldItalic",
  44221. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  44222. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44223. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44224. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  44225. };
  44226. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  44227. name: "LiberationSans-Regular",
  44228. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44229. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  44230. };
  44231. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  44232. name: "LiberationSans-Bold",
  44233. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44234. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  44235. };
  44236. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  44237. name: "LiberationSans-Italic",
  44238. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44239. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  44240. };
  44241. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  44242. name: "LiberationSans-BoldItalic",
  44243. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44244. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  44245. };
  44246. t["Calibri-Regular"] = {
  44247. name: "LiberationSans-Regular",
  44248. factors: _calibri_factors.CalibriRegularFactors,
  44249. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44250. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44251. metrics: _calibri_factors.CalibriRegularMetrics
  44252. };
  44253. t["Calibri-Bold"] = {
  44254. name: "LiberationSans-Bold",
  44255. factors: _calibri_factors.CalibriBoldFactors,
  44256. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44257. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44258. metrics: _calibri_factors.CalibriBoldMetrics
  44259. };
  44260. t["Calibri-Italic"] = {
  44261. name: "LiberationSans-Italic",
  44262. factors: _calibri_factors.CalibriItalicFactors,
  44263. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44264. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44265. metrics: _calibri_factors.CalibriItalicMetrics
  44266. };
  44267. t["Calibri-BoldItalic"] = {
  44268. name: "LiberationSans-BoldItalic",
  44269. factors: _calibri_factors.CalibriBoldItalicFactors,
  44270. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44271. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44272. metrics: _calibri_factors.CalibriBoldItalicMetrics
  44273. };
  44274. t["Segoeui-Regular"] = {
  44275. name: "LiberationSans-Regular",
  44276. factors: _segoeui_factors.SegoeuiRegularFactors,
  44277. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44278. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44279. metrics: _segoeui_factors.SegoeuiRegularMetrics
  44280. };
  44281. t["Segoeui-Bold"] = {
  44282. name: "LiberationSans-Bold",
  44283. factors: _segoeui_factors.SegoeuiBoldFactors,
  44284. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44285. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44286. metrics: _segoeui_factors.SegoeuiBoldMetrics
  44287. };
  44288. t["Segoeui-Italic"] = {
  44289. name: "LiberationSans-Italic",
  44290. factors: _segoeui_factors.SegoeuiItalicFactors,
  44291. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44292. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44293. metrics: _segoeui_factors.SegoeuiItalicMetrics
  44294. };
  44295. t["Segoeui-BoldItalic"] = {
  44296. name: "LiberationSans-BoldItalic",
  44297. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  44298. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44299. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44300. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  44301. };
  44302. t["Helvetica-Regular"] = t.Helvetica = {
  44303. name: "LiberationSans-Regular",
  44304. factors: _helvetica_factors.HelveticaRegularFactors,
  44305. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44306. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44307. metrics: _helvetica_factors.HelveticaRegularMetrics
  44308. };
  44309. t["Helvetica-Bold"] = {
  44310. name: "LiberationSans-Bold",
  44311. factors: _helvetica_factors.HelveticaBoldFactors,
  44312. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44313. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44314. metrics: _helvetica_factors.HelveticaBoldMetrics
  44315. };
  44316. t["Helvetica-Italic"] = {
  44317. name: "LiberationSans-Italic",
  44318. factors: _helvetica_factors.HelveticaItalicFactors,
  44319. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44320. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44321. metrics: _helvetica_factors.HelveticaItalicMetrics
  44322. };
  44323. t["Helvetica-BoldItalic"] = {
  44324. name: "LiberationSans-BoldItalic",
  44325. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  44326. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44327. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44328. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  44329. };
  44330. });
  44331. function getXfaFontName(name) {
  44332. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  44333. const fontMap = getXFAFontMap();
  44334. return fontMap[fontName];
  44335. }
  44336. function getXfaFontWidths(name) {
  44337. const info = getXfaFontName(name);
  44338. if (!info) {
  44339. return null;
  44340. }
  44341. const {
  44342. baseWidths,
  44343. baseMapping,
  44344. factors
  44345. } = info;
  44346. let rescaledBaseWidths;
  44347. if (!factors) {
  44348. rescaledBaseWidths = baseWidths;
  44349. } else {
  44350. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  44351. }
  44352. let currentCode = -2;
  44353. let currentArray;
  44354. const newWidths = [];
  44355. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  44356. if (unicode === -1) {
  44357. continue;
  44358. }
  44359. if (unicode === currentCode + 1) {
  44360. currentArray.push(rescaledBaseWidths[glyphIndex]);
  44361. currentCode += 1;
  44362. } else {
  44363. currentCode = unicode;
  44364. currentArray = [rescaledBaseWidths[glyphIndex]];
  44365. newWidths.push(unicode, currentArray);
  44366. }
  44367. }
  44368. return newWidths;
  44369. }
  44370. function getXfaFontDict(name) {
  44371. const widths = getXfaFontWidths(name);
  44372. const dict = new _primitives.Dict(null);
  44373. dict.set("BaseFont", _primitives.Name.get(name));
  44374. dict.set("Type", _primitives.Name.get("Font"));
  44375. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  44376. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  44377. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  44378. dict.set("W", widths);
  44379. dict.set("FirstChar", widths[0]);
  44380. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  44381. const descriptor = new _primitives.Dict(null);
  44382. dict.set("FontDescriptor", descriptor);
  44383. const systemInfo = new _primitives.Dict(null);
  44384. systemInfo.set("Ordering", "Identity");
  44385. systemInfo.set("Registry", "Adobe");
  44386. systemInfo.set("Supplement", 0);
  44387. dict.set("CIDSystemInfo", systemInfo);
  44388. return dict;
  44389. }
  44390. /***/ }),
  44391. /* 50 */
  44392. /***/ ((__unused_webpack_module, exports) => {
  44393. Object.defineProperty(exports, "__esModule", ({
  44394. value: true
  44395. }));
  44396. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  44397. 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];
  44398. exports.CalibriBoldFactors = CalibriBoldFactors;
  44399. const CalibriBoldMetrics = {
  44400. lineHeight: 1.2207,
  44401. lineGap: 0.2207
  44402. };
  44403. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  44404. 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];
  44405. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  44406. const CalibriBoldItalicMetrics = {
  44407. lineHeight: 1.2207,
  44408. lineGap: 0.2207
  44409. };
  44410. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  44411. 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];
  44412. exports.CalibriItalicFactors = CalibriItalicFactors;
  44413. const CalibriItalicMetrics = {
  44414. lineHeight: 1.2207,
  44415. lineGap: 0.2207
  44416. };
  44417. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  44418. 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];
  44419. exports.CalibriRegularFactors = CalibriRegularFactors;
  44420. const CalibriRegularMetrics = {
  44421. lineHeight: 1.2207,
  44422. lineGap: 0.2207
  44423. };
  44424. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  44425. /***/ }),
  44426. /* 51 */
  44427. /***/ ((__unused_webpack_module, exports) => {
  44428. Object.defineProperty(exports, "__esModule", ({
  44429. value: true
  44430. }));
  44431. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  44432. 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];
  44433. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  44434. const HelveticaBoldMetrics = {
  44435. lineHeight: 1.2,
  44436. lineGap: 0.2
  44437. };
  44438. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  44439. 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];
  44440. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  44441. const HelveticaBoldItalicMetrics = {
  44442. lineHeight: 1.35,
  44443. lineGap: 0.2
  44444. };
  44445. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  44446. 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];
  44447. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  44448. const HelveticaItalicMetrics = {
  44449. lineHeight: 1.35,
  44450. lineGap: 0.2
  44451. };
  44452. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  44453. 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];
  44454. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  44455. const HelveticaRegularMetrics = {
  44456. lineHeight: 1.2,
  44457. lineGap: 0.2
  44458. };
  44459. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  44460. /***/ }),
  44461. /* 52 */
  44462. /***/ ((__unused_webpack_module, exports) => {
  44463. Object.defineProperty(exports, "__esModule", ({
  44464. value: true
  44465. }));
  44466. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  44467. 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];
  44468. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  44469. 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];
  44470. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  44471. 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];
  44472. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  44473. 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];
  44474. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  44475. 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];
  44476. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  44477. 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];
  44478. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  44479. 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];
  44480. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  44481. 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];
  44482. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  44483. /***/ }),
  44484. /* 53 */
  44485. /***/ ((__unused_webpack_module, exports) => {
  44486. Object.defineProperty(exports, "__esModule", ({
  44487. value: true
  44488. }));
  44489. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  44490. 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];
  44491. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  44492. const MyriadProBoldMetrics = {
  44493. lineHeight: 1.2,
  44494. lineGap: 0.2
  44495. };
  44496. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  44497. 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];
  44498. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  44499. const MyriadProBoldItalicMetrics = {
  44500. lineHeight: 1.2,
  44501. lineGap: 0.2
  44502. };
  44503. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  44504. 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];
  44505. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  44506. const MyriadProItalicMetrics = {
  44507. lineHeight: 1.2,
  44508. lineGap: 0.2
  44509. };
  44510. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  44511. 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];
  44512. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  44513. const MyriadProRegularMetrics = {
  44514. lineHeight: 1.2,
  44515. lineGap: 0.2
  44516. };
  44517. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  44518. /***/ }),
  44519. /* 54 */
  44520. /***/ ((__unused_webpack_module, exports) => {
  44521. Object.defineProperty(exports, "__esModule", ({
  44522. value: true
  44523. }));
  44524. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  44525. 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];
  44526. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  44527. const SegoeuiBoldMetrics = {
  44528. lineHeight: 1.33008,
  44529. lineGap: 0
  44530. };
  44531. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  44532. 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];
  44533. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  44534. const SegoeuiBoldItalicMetrics = {
  44535. lineHeight: 1.33008,
  44536. lineGap: 0
  44537. };
  44538. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  44539. 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];
  44540. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  44541. const SegoeuiItalicMetrics = {
  44542. lineHeight: 1.33008,
  44543. lineGap: 0
  44544. };
  44545. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  44546. 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];
  44547. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  44548. const SegoeuiRegularMetrics = {
  44549. lineHeight: 1.33008,
  44550. lineGap: 0
  44551. };
  44552. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  44553. /***/ }),
  44554. /* 55 */
  44555. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44556. Object.defineProperty(exports, "__esModule", ({
  44557. value: true
  44558. }));
  44559. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44560. exports.isPDFFunction = isPDFFunction;
  44561. var _primitives = __w_pdfjs_require__(3);
  44562. var _util = __w_pdfjs_require__(2);
  44563. var _ps_parser = __w_pdfjs_require__(56);
  44564. var _base_stream = __w_pdfjs_require__(5);
  44565. var _image_utils = __w_pdfjs_require__(57);
  44566. class PDFFunctionFactory {
  44567. constructor({
  44568. xref,
  44569. isEvalSupported = true
  44570. }) {
  44571. this.xref = xref;
  44572. this.isEvalSupported = isEvalSupported !== false;
  44573. }
  44574. create(fn) {
  44575. const cachedFunction = this.getCached(fn);
  44576. if (cachedFunction) {
  44577. return cachedFunction;
  44578. }
  44579. const parsedFunction = PDFFunction.parse({
  44580. xref: this.xref,
  44581. isEvalSupported: this.isEvalSupported,
  44582. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44583. });
  44584. this._cache(fn, parsedFunction);
  44585. return parsedFunction;
  44586. }
  44587. createFromArray(fnObj) {
  44588. const cachedFunction = this.getCached(fnObj);
  44589. if (cachedFunction) {
  44590. return cachedFunction;
  44591. }
  44592. const parsedFunction = PDFFunction.parseArray({
  44593. xref: this.xref,
  44594. isEvalSupported: this.isEvalSupported,
  44595. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44596. });
  44597. this._cache(fnObj, parsedFunction);
  44598. return parsedFunction;
  44599. }
  44600. getCached(cacheKey) {
  44601. let fnRef;
  44602. if (cacheKey instanceof _primitives.Ref) {
  44603. fnRef = cacheKey;
  44604. } else if (cacheKey instanceof _primitives.Dict) {
  44605. fnRef = cacheKey.objId;
  44606. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44607. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44608. }
  44609. if (fnRef) {
  44610. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44611. if (localFunction) {
  44612. return localFunction;
  44613. }
  44614. }
  44615. return null;
  44616. }
  44617. _cache(cacheKey, parsedFunction) {
  44618. if (!parsedFunction) {
  44619. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44620. }
  44621. let fnRef;
  44622. if (cacheKey instanceof _primitives.Ref) {
  44623. fnRef = cacheKey;
  44624. } else if (cacheKey instanceof _primitives.Dict) {
  44625. fnRef = cacheKey.objId;
  44626. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44627. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44628. }
  44629. if (fnRef) {
  44630. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44631. }
  44632. }
  44633. get _localFunctionCache() {
  44634. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44635. }
  44636. }
  44637. exports.PDFFunctionFactory = PDFFunctionFactory;
  44638. function toNumberArray(arr) {
  44639. if (!Array.isArray(arr)) {
  44640. return null;
  44641. }
  44642. const length = arr.length;
  44643. for (let i = 0; i < length; i++) {
  44644. if (typeof arr[i] !== "number") {
  44645. const result = new Array(length);
  44646. for (let j = 0; j < length; j++) {
  44647. result[j] = +arr[j];
  44648. }
  44649. return result;
  44650. }
  44651. }
  44652. return arr;
  44653. }
  44654. class PDFFunction {
  44655. static getSampleArray(size, outputSize, bps, stream) {
  44656. let i, ii;
  44657. let length = 1;
  44658. for (i = 0, ii = size.length; i < ii; i++) {
  44659. length *= size[i];
  44660. }
  44661. length *= outputSize;
  44662. const array = new Array(length);
  44663. let codeSize = 0;
  44664. let codeBuf = 0;
  44665. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44666. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44667. let strIdx = 0;
  44668. for (i = 0; i < length; i++) {
  44669. while (codeSize < bps) {
  44670. codeBuf <<= 8;
  44671. codeBuf |= strBytes[strIdx++];
  44672. codeSize += 8;
  44673. }
  44674. codeSize -= bps;
  44675. array[i] = (codeBuf >> codeSize) * sampleMul;
  44676. codeBuf &= (1 << codeSize) - 1;
  44677. }
  44678. return array;
  44679. }
  44680. static parse({
  44681. xref,
  44682. isEvalSupported,
  44683. fn
  44684. }) {
  44685. const dict = fn.dict || fn;
  44686. const typeNum = dict.get("FunctionType");
  44687. switch (typeNum) {
  44688. case 0:
  44689. return this.constructSampled({
  44690. xref,
  44691. isEvalSupported,
  44692. fn,
  44693. dict
  44694. });
  44695. case 1:
  44696. break;
  44697. case 2:
  44698. return this.constructInterpolated({
  44699. xref,
  44700. isEvalSupported,
  44701. dict
  44702. });
  44703. case 3:
  44704. return this.constructStiched({
  44705. xref,
  44706. isEvalSupported,
  44707. dict
  44708. });
  44709. case 4:
  44710. return this.constructPostScript({
  44711. xref,
  44712. isEvalSupported,
  44713. fn,
  44714. dict
  44715. });
  44716. }
  44717. throw new _util.FormatError("Unknown type of function");
  44718. }
  44719. static parseArray({
  44720. xref,
  44721. isEvalSupported,
  44722. fnObj
  44723. }) {
  44724. if (!Array.isArray(fnObj)) {
  44725. return this.parse({
  44726. xref,
  44727. isEvalSupported,
  44728. fn: fnObj
  44729. });
  44730. }
  44731. const fnArray = [];
  44732. for (const fn of fnObj) {
  44733. fnArray.push(this.parse({
  44734. xref,
  44735. isEvalSupported,
  44736. fn: xref.fetchIfRef(fn)
  44737. }));
  44738. }
  44739. return function (src, srcOffset, dest, destOffset) {
  44740. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44741. fnArray[i](src, srcOffset, dest, destOffset + i);
  44742. }
  44743. };
  44744. }
  44745. static constructSampled({
  44746. xref,
  44747. isEvalSupported,
  44748. fn,
  44749. dict
  44750. }) {
  44751. function toMultiArray(arr) {
  44752. const inputLength = arr.length;
  44753. const out = [];
  44754. let index = 0;
  44755. for (let i = 0; i < inputLength; i += 2) {
  44756. out[index++] = [arr[i], arr[i + 1]];
  44757. }
  44758. return out;
  44759. }
  44760. function interpolate(x, xmin, xmax, ymin, ymax) {
  44761. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44762. }
  44763. let domain = toNumberArray(dict.getArray("Domain"));
  44764. let range = toNumberArray(dict.getArray("Range"));
  44765. if (!domain || !range) {
  44766. throw new _util.FormatError("No domain or range");
  44767. }
  44768. const inputSize = domain.length / 2;
  44769. const outputSize = range.length / 2;
  44770. domain = toMultiArray(domain);
  44771. range = toMultiArray(range);
  44772. const size = toNumberArray(dict.getArray("Size"));
  44773. const bps = dict.get("BitsPerSample");
  44774. const order = dict.get("Order") || 1;
  44775. if (order !== 1) {
  44776. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44777. }
  44778. let encode = toNumberArray(dict.getArray("Encode"));
  44779. if (!encode) {
  44780. encode = [];
  44781. for (let i = 0; i < inputSize; ++i) {
  44782. encode.push([0, size[i] - 1]);
  44783. }
  44784. } else {
  44785. encode = toMultiArray(encode);
  44786. }
  44787. let decode = toNumberArray(dict.getArray("Decode"));
  44788. if (!decode) {
  44789. decode = range;
  44790. } else {
  44791. decode = toMultiArray(decode);
  44792. }
  44793. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44794. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44795. const cubeVertices = 1 << inputSize;
  44796. const cubeN = new Float64Array(cubeVertices);
  44797. const cubeVertex = new Uint32Array(cubeVertices);
  44798. let i, j;
  44799. for (j = 0; j < cubeVertices; j++) {
  44800. cubeN[j] = 1;
  44801. }
  44802. let k = outputSize,
  44803. pos = 1;
  44804. for (i = 0; i < inputSize; ++i) {
  44805. const domain_2i = domain[i][0];
  44806. const domain_2i_1 = domain[i][1];
  44807. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44808. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44809. const size_i = size[i];
  44810. e = Math.min(Math.max(e, 0), size_i - 1);
  44811. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44812. const n0 = e0 + 1 - e;
  44813. const n1 = e - e0;
  44814. const offset0 = e0 * k;
  44815. const offset1 = offset0 + k;
  44816. for (j = 0; j < cubeVertices; j++) {
  44817. if (j & pos) {
  44818. cubeN[j] *= n1;
  44819. cubeVertex[j] += offset1;
  44820. } else {
  44821. cubeN[j] *= n0;
  44822. cubeVertex[j] += offset0;
  44823. }
  44824. }
  44825. k *= size_i;
  44826. pos <<= 1;
  44827. }
  44828. for (j = 0; j < outputSize; ++j) {
  44829. let rj = 0;
  44830. for (i = 0; i < cubeVertices; i++) {
  44831. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44832. }
  44833. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44834. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44835. }
  44836. };
  44837. }
  44838. static constructInterpolated({
  44839. xref,
  44840. isEvalSupported,
  44841. dict
  44842. }) {
  44843. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44844. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44845. const n = dict.get("N");
  44846. const diff = [];
  44847. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44848. diff.push(c1[i] - c0[i]);
  44849. }
  44850. const length = diff.length;
  44851. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44852. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44853. for (let j = 0; j < length; ++j) {
  44854. dest[destOffset + j] = c0[j] + x * diff[j];
  44855. }
  44856. };
  44857. }
  44858. static constructStiched({
  44859. xref,
  44860. isEvalSupported,
  44861. dict
  44862. }) {
  44863. const domain = toNumberArray(dict.getArray("Domain"));
  44864. if (!domain) {
  44865. throw new _util.FormatError("No domain");
  44866. }
  44867. const inputSize = domain.length / 2;
  44868. if (inputSize !== 1) {
  44869. throw new _util.FormatError("Bad domain for stiched function");
  44870. }
  44871. const fns = [];
  44872. for (const fn of dict.get("Functions")) {
  44873. fns.push(this.parse({
  44874. xref,
  44875. isEvalSupported,
  44876. fn: xref.fetchIfRef(fn)
  44877. }));
  44878. }
  44879. const bounds = toNumberArray(dict.getArray("Bounds"));
  44880. const encode = toNumberArray(dict.getArray("Encode"));
  44881. const tmpBuf = new Float32Array(1);
  44882. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44883. const clip = function constructStichedFromIRClip(v, min, max) {
  44884. if (v > max) {
  44885. v = max;
  44886. } else if (v < min) {
  44887. v = min;
  44888. }
  44889. return v;
  44890. };
  44891. const v = clip(src[srcOffset], domain[0], domain[1]);
  44892. const length = bounds.length;
  44893. let i;
  44894. for (i = 0; i < length; ++i) {
  44895. if (v < bounds[i]) {
  44896. break;
  44897. }
  44898. }
  44899. let dmin = domain[0];
  44900. if (i > 0) {
  44901. dmin = bounds[i - 1];
  44902. }
  44903. let dmax = domain[1];
  44904. if (i < bounds.length) {
  44905. dmax = bounds[i];
  44906. }
  44907. const rmin = encode[2 * i];
  44908. const rmax = encode[2 * i + 1];
  44909. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44910. fns[i](tmpBuf, 0, dest, destOffset);
  44911. };
  44912. }
  44913. static constructPostScript({
  44914. xref,
  44915. isEvalSupported,
  44916. fn,
  44917. dict
  44918. }) {
  44919. const domain = toNumberArray(dict.getArray("Domain"));
  44920. const range = toNumberArray(dict.getArray("Range"));
  44921. if (!domain) {
  44922. throw new _util.FormatError("No domain.");
  44923. }
  44924. if (!range) {
  44925. throw new _util.FormatError("No range.");
  44926. }
  44927. const lexer = new _ps_parser.PostScriptLexer(fn);
  44928. const parser = new _ps_parser.PostScriptParser(lexer);
  44929. const code = parser.parse();
  44930. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44931. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44932. if (compiled) {
  44933. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44934. }
  44935. }
  44936. (0, _util.info)("Unable to compile PS function");
  44937. const numOutputs = range.length >> 1;
  44938. const numInputs = domain.length >> 1;
  44939. const evaluator = new PostScriptEvaluator(code);
  44940. const cache = Object.create(null);
  44941. const MAX_CACHE_SIZE = 2048 * 4;
  44942. let cache_available = MAX_CACHE_SIZE;
  44943. const tmpBuf = new Float32Array(numInputs);
  44944. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44945. let i, value;
  44946. let key = "";
  44947. const input = tmpBuf;
  44948. for (i = 0; i < numInputs; i++) {
  44949. value = src[srcOffset + i];
  44950. input[i] = value;
  44951. key += value + "_";
  44952. }
  44953. const cachedValue = cache[key];
  44954. if (cachedValue !== undefined) {
  44955. dest.set(cachedValue, destOffset);
  44956. return;
  44957. }
  44958. const output = new Float32Array(numOutputs);
  44959. const stack = evaluator.execute(input);
  44960. const stackIndex = stack.length - numOutputs;
  44961. for (i = 0; i < numOutputs; i++) {
  44962. value = stack[stackIndex + i];
  44963. let bound = range[i * 2];
  44964. if (value < bound) {
  44965. value = bound;
  44966. } else {
  44967. bound = range[i * 2 + 1];
  44968. if (value > bound) {
  44969. value = bound;
  44970. }
  44971. }
  44972. output[i] = value;
  44973. }
  44974. if (cache_available > 0) {
  44975. cache_available--;
  44976. cache[key] = output;
  44977. }
  44978. dest.set(output, destOffset);
  44979. };
  44980. }
  44981. }
  44982. function isPDFFunction(v) {
  44983. let fnDict;
  44984. if (typeof v !== "object") {
  44985. return false;
  44986. } else if (v instanceof _primitives.Dict) {
  44987. fnDict = v;
  44988. } else if (v instanceof _base_stream.BaseStream) {
  44989. fnDict = v.dict;
  44990. } else {
  44991. return false;
  44992. }
  44993. return fnDict.has("FunctionType");
  44994. }
  44995. class PostScriptStack {
  44996. static get MAX_STACK_SIZE() {
  44997. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  44998. }
  44999. constructor(initialStack) {
  45000. this.stack = initialStack ? Array.from(initialStack) : [];
  45001. }
  45002. push(value) {
  45003. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  45004. throw new Error("PostScript function stack overflow.");
  45005. }
  45006. this.stack.push(value);
  45007. }
  45008. pop() {
  45009. if (this.stack.length <= 0) {
  45010. throw new Error("PostScript function stack underflow.");
  45011. }
  45012. return this.stack.pop();
  45013. }
  45014. copy(n) {
  45015. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  45016. throw new Error("PostScript function stack overflow.");
  45017. }
  45018. const stack = this.stack;
  45019. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  45020. stack.push(stack[i]);
  45021. }
  45022. }
  45023. index(n) {
  45024. this.push(this.stack[this.stack.length - n - 1]);
  45025. }
  45026. roll(n, p) {
  45027. const stack = this.stack;
  45028. const l = stack.length - n;
  45029. const r = stack.length - 1;
  45030. const c = l + (p - Math.floor(p / n) * n);
  45031. for (let i = l, j = r; i < j; i++, j--) {
  45032. const t = stack[i];
  45033. stack[i] = stack[j];
  45034. stack[j] = t;
  45035. }
  45036. for (let i = l, j = c - 1; i < j; i++, j--) {
  45037. const t = stack[i];
  45038. stack[i] = stack[j];
  45039. stack[j] = t;
  45040. }
  45041. for (let i = c, j = r; i < j; i++, j--) {
  45042. const t = stack[i];
  45043. stack[i] = stack[j];
  45044. stack[j] = t;
  45045. }
  45046. }
  45047. }
  45048. class PostScriptEvaluator {
  45049. constructor(operators) {
  45050. this.operators = operators;
  45051. }
  45052. execute(initialStack) {
  45053. const stack = new PostScriptStack(initialStack);
  45054. let counter = 0;
  45055. const operators = this.operators;
  45056. const length = operators.length;
  45057. let operator, a, b;
  45058. while (counter < length) {
  45059. operator = operators[counter++];
  45060. if (typeof operator === "number") {
  45061. stack.push(operator);
  45062. continue;
  45063. }
  45064. switch (operator) {
  45065. case "jz":
  45066. b = stack.pop();
  45067. a = stack.pop();
  45068. if (!a) {
  45069. counter = b;
  45070. }
  45071. break;
  45072. case "j":
  45073. a = stack.pop();
  45074. counter = a;
  45075. break;
  45076. case "abs":
  45077. a = stack.pop();
  45078. stack.push(Math.abs(a));
  45079. break;
  45080. case "add":
  45081. b = stack.pop();
  45082. a = stack.pop();
  45083. stack.push(a + b);
  45084. break;
  45085. case "and":
  45086. b = stack.pop();
  45087. a = stack.pop();
  45088. if (typeof a === "boolean" && typeof b === "boolean") {
  45089. stack.push(a && b);
  45090. } else {
  45091. stack.push(a & b);
  45092. }
  45093. break;
  45094. case "atan":
  45095. a = stack.pop();
  45096. stack.push(Math.atan(a));
  45097. break;
  45098. case "bitshift":
  45099. b = stack.pop();
  45100. a = stack.pop();
  45101. if (a > 0) {
  45102. stack.push(a << b);
  45103. } else {
  45104. stack.push(a >> b);
  45105. }
  45106. break;
  45107. case "ceiling":
  45108. a = stack.pop();
  45109. stack.push(Math.ceil(a));
  45110. break;
  45111. case "copy":
  45112. a = stack.pop();
  45113. stack.copy(a);
  45114. break;
  45115. case "cos":
  45116. a = stack.pop();
  45117. stack.push(Math.cos(a));
  45118. break;
  45119. case "cvi":
  45120. a = stack.pop() | 0;
  45121. stack.push(a);
  45122. break;
  45123. case "cvr":
  45124. break;
  45125. case "div":
  45126. b = stack.pop();
  45127. a = stack.pop();
  45128. stack.push(a / b);
  45129. break;
  45130. case "dup":
  45131. stack.copy(1);
  45132. break;
  45133. case "eq":
  45134. b = stack.pop();
  45135. a = stack.pop();
  45136. stack.push(a === b);
  45137. break;
  45138. case "exch":
  45139. stack.roll(2, 1);
  45140. break;
  45141. case "exp":
  45142. b = stack.pop();
  45143. a = stack.pop();
  45144. stack.push(a ** b);
  45145. break;
  45146. case "false":
  45147. stack.push(false);
  45148. break;
  45149. case "floor":
  45150. a = stack.pop();
  45151. stack.push(Math.floor(a));
  45152. break;
  45153. case "ge":
  45154. b = stack.pop();
  45155. a = stack.pop();
  45156. stack.push(a >= b);
  45157. break;
  45158. case "gt":
  45159. b = stack.pop();
  45160. a = stack.pop();
  45161. stack.push(a > b);
  45162. break;
  45163. case "idiv":
  45164. b = stack.pop();
  45165. a = stack.pop();
  45166. stack.push(a / b | 0);
  45167. break;
  45168. case "index":
  45169. a = stack.pop();
  45170. stack.index(a);
  45171. break;
  45172. case "le":
  45173. b = stack.pop();
  45174. a = stack.pop();
  45175. stack.push(a <= b);
  45176. break;
  45177. case "ln":
  45178. a = stack.pop();
  45179. stack.push(Math.log(a));
  45180. break;
  45181. case "log":
  45182. a = stack.pop();
  45183. stack.push(Math.log(a) / Math.LN10);
  45184. break;
  45185. case "lt":
  45186. b = stack.pop();
  45187. a = stack.pop();
  45188. stack.push(a < b);
  45189. break;
  45190. case "mod":
  45191. b = stack.pop();
  45192. a = stack.pop();
  45193. stack.push(a % b);
  45194. break;
  45195. case "mul":
  45196. b = stack.pop();
  45197. a = stack.pop();
  45198. stack.push(a * b);
  45199. break;
  45200. case "ne":
  45201. b = stack.pop();
  45202. a = stack.pop();
  45203. stack.push(a !== b);
  45204. break;
  45205. case "neg":
  45206. a = stack.pop();
  45207. stack.push(-a);
  45208. break;
  45209. case "not":
  45210. a = stack.pop();
  45211. if (typeof a === "boolean") {
  45212. stack.push(!a);
  45213. } else {
  45214. stack.push(~a);
  45215. }
  45216. break;
  45217. case "or":
  45218. b = stack.pop();
  45219. a = stack.pop();
  45220. if (typeof a === "boolean" && typeof b === "boolean") {
  45221. stack.push(a || b);
  45222. } else {
  45223. stack.push(a | b);
  45224. }
  45225. break;
  45226. case "pop":
  45227. stack.pop();
  45228. break;
  45229. case "roll":
  45230. b = stack.pop();
  45231. a = stack.pop();
  45232. stack.roll(a, b);
  45233. break;
  45234. case "round":
  45235. a = stack.pop();
  45236. stack.push(Math.round(a));
  45237. break;
  45238. case "sin":
  45239. a = stack.pop();
  45240. stack.push(Math.sin(a));
  45241. break;
  45242. case "sqrt":
  45243. a = stack.pop();
  45244. stack.push(Math.sqrt(a));
  45245. break;
  45246. case "sub":
  45247. b = stack.pop();
  45248. a = stack.pop();
  45249. stack.push(a - b);
  45250. break;
  45251. case "true":
  45252. stack.push(true);
  45253. break;
  45254. case "truncate":
  45255. a = stack.pop();
  45256. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  45257. stack.push(a);
  45258. break;
  45259. case "xor":
  45260. b = stack.pop();
  45261. a = stack.pop();
  45262. if (typeof a === "boolean" && typeof b === "boolean") {
  45263. stack.push(a !== b);
  45264. } else {
  45265. stack.push(a ^ b);
  45266. }
  45267. break;
  45268. default:
  45269. throw new _util.FormatError(`Unknown operator ${operator}`);
  45270. }
  45271. }
  45272. return stack.stack;
  45273. }
  45274. }
  45275. exports.PostScriptEvaluator = PostScriptEvaluator;
  45276. class AstNode {
  45277. constructor(type) {
  45278. this.type = type;
  45279. }
  45280. visit(visitor) {
  45281. (0, _util.unreachable)("abstract method");
  45282. }
  45283. }
  45284. class AstArgument extends AstNode {
  45285. constructor(index, min, max) {
  45286. super("args");
  45287. this.index = index;
  45288. this.min = min;
  45289. this.max = max;
  45290. }
  45291. visit(visitor) {
  45292. visitor.visitArgument(this);
  45293. }
  45294. }
  45295. class AstLiteral extends AstNode {
  45296. constructor(number) {
  45297. super("literal");
  45298. this.number = number;
  45299. this.min = number;
  45300. this.max = number;
  45301. }
  45302. visit(visitor) {
  45303. visitor.visitLiteral(this);
  45304. }
  45305. }
  45306. class AstBinaryOperation extends AstNode {
  45307. constructor(op, arg1, arg2, min, max) {
  45308. super("binary");
  45309. this.op = op;
  45310. this.arg1 = arg1;
  45311. this.arg2 = arg2;
  45312. this.min = min;
  45313. this.max = max;
  45314. }
  45315. visit(visitor) {
  45316. visitor.visitBinaryOperation(this);
  45317. }
  45318. }
  45319. class AstMin extends AstNode {
  45320. constructor(arg, max) {
  45321. super("max");
  45322. this.arg = arg;
  45323. this.min = arg.min;
  45324. this.max = max;
  45325. }
  45326. visit(visitor) {
  45327. visitor.visitMin(this);
  45328. }
  45329. }
  45330. class AstVariable extends AstNode {
  45331. constructor(index, min, max) {
  45332. super("var");
  45333. this.index = index;
  45334. this.min = min;
  45335. this.max = max;
  45336. }
  45337. visit(visitor) {
  45338. visitor.visitVariable(this);
  45339. }
  45340. }
  45341. class AstVariableDefinition extends AstNode {
  45342. constructor(variable, arg) {
  45343. super("definition");
  45344. this.variable = variable;
  45345. this.arg = arg;
  45346. }
  45347. visit(visitor) {
  45348. visitor.visitVariableDefinition(this);
  45349. }
  45350. }
  45351. class ExpressionBuilderVisitor {
  45352. constructor() {
  45353. this.parts = [];
  45354. }
  45355. visitArgument(arg) {
  45356. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  45357. }
  45358. visitVariable(variable) {
  45359. this.parts.push("v", variable.index);
  45360. }
  45361. visitLiteral(literal) {
  45362. this.parts.push(literal.number);
  45363. }
  45364. visitBinaryOperation(operation) {
  45365. this.parts.push("(");
  45366. operation.arg1.visit(this);
  45367. this.parts.push(" ", operation.op, " ");
  45368. operation.arg2.visit(this);
  45369. this.parts.push(")");
  45370. }
  45371. visitVariableDefinition(definition) {
  45372. this.parts.push("var ");
  45373. definition.variable.visit(this);
  45374. this.parts.push(" = ");
  45375. definition.arg.visit(this);
  45376. this.parts.push(";");
  45377. }
  45378. visitMin(max) {
  45379. this.parts.push("Math.min(");
  45380. max.arg.visit(this);
  45381. this.parts.push(", ", max.max, ")");
  45382. }
  45383. toString() {
  45384. return this.parts.join("");
  45385. }
  45386. }
  45387. function buildAddOperation(num1, num2) {
  45388. if (num2.type === "literal" && num2.number === 0) {
  45389. return num1;
  45390. }
  45391. if (num1.type === "literal" && num1.number === 0) {
  45392. return num2;
  45393. }
  45394. if (num2.type === "literal" && num1.type === "literal") {
  45395. return new AstLiteral(num1.number + num2.number);
  45396. }
  45397. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  45398. }
  45399. function buildMulOperation(num1, num2) {
  45400. if (num2.type === "literal") {
  45401. if (num2.number === 0) {
  45402. return new AstLiteral(0);
  45403. } else if (num2.number === 1) {
  45404. return num1;
  45405. } else if (num1.type === "literal") {
  45406. return new AstLiteral(num1.number * num2.number);
  45407. }
  45408. }
  45409. if (num1.type === "literal") {
  45410. if (num1.number === 0) {
  45411. return new AstLiteral(0);
  45412. } else if (num1.number === 1) {
  45413. return num2;
  45414. }
  45415. }
  45416. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45417. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45418. return new AstBinaryOperation("*", num1, num2, min, max);
  45419. }
  45420. function buildSubOperation(num1, num2) {
  45421. if (num2.type === "literal") {
  45422. if (num2.number === 0) {
  45423. return num1;
  45424. } else if (num1.type === "literal") {
  45425. return new AstLiteral(num1.number - num2.number);
  45426. }
  45427. }
  45428. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  45429. return num2.arg2;
  45430. }
  45431. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  45432. }
  45433. function buildMinOperation(num1, max) {
  45434. if (num1.min >= max) {
  45435. return new AstLiteral(max);
  45436. } else if (num1.max <= max) {
  45437. return num1;
  45438. }
  45439. return new AstMin(num1, max);
  45440. }
  45441. class PostScriptCompiler {
  45442. compile(code, domain, range) {
  45443. const stack = [];
  45444. const instructions = [];
  45445. const inputSize = domain.length >> 1,
  45446. outputSize = range.length >> 1;
  45447. let lastRegister = 0;
  45448. let n, j;
  45449. let num1, num2, ast1, ast2, tmpVar, item;
  45450. for (let i = 0; i < inputSize; i++) {
  45451. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  45452. }
  45453. for (let i = 0, ii = code.length; i < ii; i++) {
  45454. item = code[i];
  45455. if (typeof item === "number") {
  45456. stack.push(new AstLiteral(item));
  45457. continue;
  45458. }
  45459. switch (item) {
  45460. case "add":
  45461. if (stack.length < 2) {
  45462. return null;
  45463. }
  45464. num2 = stack.pop();
  45465. num1 = stack.pop();
  45466. stack.push(buildAddOperation(num1, num2));
  45467. break;
  45468. case "cvr":
  45469. if (stack.length < 1) {
  45470. return null;
  45471. }
  45472. break;
  45473. case "mul":
  45474. if (stack.length < 2) {
  45475. return null;
  45476. }
  45477. num2 = stack.pop();
  45478. num1 = stack.pop();
  45479. stack.push(buildMulOperation(num1, num2));
  45480. break;
  45481. case "sub":
  45482. if (stack.length < 2) {
  45483. return null;
  45484. }
  45485. num2 = stack.pop();
  45486. num1 = stack.pop();
  45487. stack.push(buildSubOperation(num1, num2));
  45488. break;
  45489. case "exch":
  45490. if (stack.length < 2) {
  45491. return null;
  45492. }
  45493. ast1 = stack.pop();
  45494. ast2 = stack.pop();
  45495. stack.push(ast1, ast2);
  45496. break;
  45497. case "pop":
  45498. if (stack.length < 1) {
  45499. return null;
  45500. }
  45501. stack.pop();
  45502. break;
  45503. case "index":
  45504. if (stack.length < 1) {
  45505. return null;
  45506. }
  45507. num1 = stack.pop();
  45508. if (num1.type !== "literal") {
  45509. return null;
  45510. }
  45511. n = num1.number;
  45512. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45513. return null;
  45514. }
  45515. ast1 = stack[stack.length - n - 1];
  45516. if (ast1.type === "literal" || ast1.type === "var") {
  45517. stack.push(ast1);
  45518. break;
  45519. }
  45520. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45521. stack[stack.length - n - 1] = tmpVar;
  45522. stack.push(tmpVar);
  45523. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45524. break;
  45525. case "dup":
  45526. if (stack.length < 1) {
  45527. return null;
  45528. }
  45529. 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]) {
  45530. num1 = stack.pop();
  45531. stack.push(buildMinOperation(num1, code[i + 1]));
  45532. i += 6;
  45533. break;
  45534. }
  45535. ast1 = stack.at(-1);
  45536. if (ast1.type === "literal" || ast1.type === "var") {
  45537. stack.push(ast1);
  45538. break;
  45539. }
  45540. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45541. stack[stack.length - 1] = tmpVar;
  45542. stack.push(tmpVar);
  45543. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45544. break;
  45545. case "roll":
  45546. if (stack.length < 2) {
  45547. return null;
  45548. }
  45549. num2 = stack.pop();
  45550. num1 = stack.pop();
  45551. if (num2.type !== "literal" || num1.type !== "literal") {
  45552. return null;
  45553. }
  45554. j = num2.number;
  45555. n = num1.number;
  45556. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45557. return null;
  45558. }
  45559. j = (j % n + n) % n;
  45560. if (j === 0) {
  45561. break;
  45562. }
  45563. stack.push(...stack.splice(stack.length - n, n - j));
  45564. break;
  45565. default:
  45566. return null;
  45567. }
  45568. }
  45569. if (stack.length !== outputSize) {
  45570. return null;
  45571. }
  45572. const result = [];
  45573. for (const instruction of instructions) {
  45574. const statementBuilder = new ExpressionBuilderVisitor();
  45575. instruction.visit(statementBuilder);
  45576. result.push(statementBuilder.toString());
  45577. }
  45578. for (let i = 0, ii = stack.length; i < ii; i++) {
  45579. const expr = stack[i],
  45580. statementBuilder = new ExpressionBuilderVisitor();
  45581. expr.visit(statementBuilder);
  45582. const min = range[i * 2],
  45583. max = range[i * 2 + 1];
  45584. const out = [statementBuilder.toString()];
  45585. if (min > expr.min) {
  45586. out.unshift("Math.max(", min, ", ");
  45587. out.push(")");
  45588. }
  45589. if (max < expr.max) {
  45590. out.unshift("Math.min(", max, ", ");
  45591. out.push(")");
  45592. }
  45593. out.unshift("dest[destOffset + ", i, "] = ");
  45594. out.push(";");
  45595. result.push(out.join(""));
  45596. }
  45597. return result.join("\n");
  45598. }
  45599. }
  45600. exports.PostScriptCompiler = PostScriptCompiler;
  45601. /***/ }),
  45602. /* 56 */
  45603. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45604. Object.defineProperty(exports, "__esModule", ({
  45605. value: true
  45606. }));
  45607. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45608. var _util = __w_pdfjs_require__(2);
  45609. var _primitives = __w_pdfjs_require__(3);
  45610. var _core_utils = __w_pdfjs_require__(4);
  45611. class PostScriptParser {
  45612. constructor(lexer) {
  45613. this.lexer = lexer;
  45614. this.operators = [];
  45615. this.token = null;
  45616. this.prev = null;
  45617. }
  45618. nextToken() {
  45619. this.prev = this.token;
  45620. this.token = this.lexer.getToken();
  45621. }
  45622. accept(type) {
  45623. if (this.token.type === type) {
  45624. this.nextToken();
  45625. return true;
  45626. }
  45627. return false;
  45628. }
  45629. expect(type) {
  45630. if (this.accept(type)) {
  45631. return true;
  45632. }
  45633. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45634. }
  45635. parse() {
  45636. this.nextToken();
  45637. this.expect(PostScriptTokenTypes.LBRACE);
  45638. this.parseBlock();
  45639. this.expect(PostScriptTokenTypes.RBRACE);
  45640. return this.operators;
  45641. }
  45642. parseBlock() {
  45643. while (true) {
  45644. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45645. this.operators.push(this.prev.value);
  45646. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45647. this.operators.push(this.prev.value);
  45648. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45649. this.parseCondition();
  45650. } else {
  45651. return;
  45652. }
  45653. }
  45654. }
  45655. parseCondition() {
  45656. const conditionLocation = this.operators.length;
  45657. this.operators.push(null, null);
  45658. this.parseBlock();
  45659. this.expect(PostScriptTokenTypes.RBRACE);
  45660. if (this.accept(PostScriptTokenTypes.IF)) {
  45661. this.operators[conditionLocation] = this.operators.length;
  45662. this.operators[conditionLocation + 1] = "jz";
  45663. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45664. const jumpLocation = this.operators.length;
  45665. this.operators.push(null, null);
  45666. const endOfTrue = this.operators.length;
  45667. this.parseBlock();
  45668. this.expect(PostScriptTokenTypes.RBRACE);
  45669. this.expect(PostScriptTokenTypes.IFELSE);
  45670. this.operators[jumpLocation] = this.operators.length;
  45671. this.operators[jumpLocation + 1] = "j";
  45672. this.operators[conditionLocation] = endOfTrue;
  45673. this.operators[conditionLocation + 1] = "jz";
  45674. } else {
  45675. throw new _util.FormatError("PS Function: error parsing conditional.");
  45676. }
  45677. }
  45678. }
  45679. exports.PostScriptParser = PostScriptParser;
  45680. const PostScriptTokenTypes = {
  45681. LBRACE: 0,
  45682. RBRACE: 1,
  45683. NUMBER: 2,
  45684. OPERATOR: 3,
  45685. IF: 4,
  45686. IFELSE: 5
  45687. };
  45688. class PostScriptToken {
  45689. static get opCache() {
  45690. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45691. }
  45692. constructor(type, value) {
  45693. this.type = type;
  45694. this.value = value;
  45695. }
  45696. static getOperator(op) {
  45697. const opValue = PostScriptToken.opCache[op];
  45698. if (opValue) {
  45699. return opValue;
  45700. }
  45701. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45702. }
  45703. static get LBRACE() {
  45704. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45705. }
  45706. static get RBRACE() {
  45707. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45708. }
  45709. static get IF() {
  45710. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45711. }
  45712. static get IFELSE() {
  45713. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45714. }
  45715. }
  45716. class PostScriptLexer {
  45717. constructor(stream) {
  45718. this.stream = stream;
  45719. this.nextChar();
  45720. this.strBuf = [];
  45721. }
  45722. nextChar() {
  45723. return this.currentChar = this.stream.getByte();
  45724. }
  45725. getToken() {
  45726. let comment = false;
  45727. let ch = this.currentChar;
  45728. while (true) {
  45729. if (ch < 0) {
  45730. return _primitives.EOF;
  45731. }
  45732. if (comment) {
  45733. if (ch === 0x0a || ch === 0x0d) {
  45734. comment = false;
  45735. }
  45736. } else if (ch === 0x25) {
  45737. comment = true;
  45738. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45739. break;
  45740. }
  45741. ch = this.nextChar();
  45742. }
  45743. switch (ch | 0) {
  45744. case 0x30:
  45745. case 0x31:
  45746. case 0x32:
  45747. case 0x33:
  45748. case 0x34:
  45749. case 0x35:
  45750. case 0x36:
  45751. case 0x37:
  45752. case 0x38:
  45753. case 0x39:
  45754. case 0x2b:
  45755. case 0x2d:
  45756. case 0x2e:
  45757. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45758. case 0x7b:
  45759. this.nextChar();
  45760. return PostScriptToken.LBRACE;
  45761. case 0x7d:
  45762. this.nextChar();
  45763. return PostScriptToken.RBRACE;
  45764. }
  45765. const strBuf = this.strBuf;
  45766. strBuf.length = 0;
  45767. strBuf[0] = String.fromCharCode(ch);
  45768. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45769. strBuf.push(String.fromCharCode(ch));
  45770. }
  45771. const str = strBuf.join("");
  45772. switch (str.toLowerCase()) {
  45773. case "if":
  45774. return PostScriptToken.IF;
  45775. case "ifelse":
  45776. return PostScriptToken.IFELSE;
  45777. default:
  45778. return PostScriptToken.getOperator(str);
  45779. }
  45780. }
  45781. getNumber() {
  45782. let ch = this.currentChar;
  45783. const strBuf = this.strBuf;
  45784. strBuf.length = 0;
  45785. strBuf[0] = String.fromCharCode(ch);
  45786. while ((ch = this.nextChar()) >= 0) {
  45787. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45788. strBuf.push(String.fromCharCode(ch));
  45789. } else {
  45790. break;
  45791. }
  45792. }
  45793. const value = parseFloat(strBuf.join(""));
  45794. if (isNaN(value)) {
  45795. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45796. }
  45797. return value;
  45798. }
  45799. }
  45800. exports.PostScriptLexer = PostScriptLexer;
  45801. /***/ }),
  45802. /* 57 */
  45803. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45804. Object.defineProperty(exports, "__esModule", ({
  45805. value: true
  45806. }));
  45807. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45808. var _util = __w_pdfjs_require__(2);
  45809. var _primitives = __w_pdfjs_require__(3);
  45810. class BaseLocalCache {
  45811. constructor(options) {
  45812. if (this.constructor === BaseLocalCache) {
  45813. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45814. }
  45815. this._onlyRefs = (options && options.onlyRefs) === true;
  45816. if (!this._onlyRefs) {
  45817. this._nameRefMap = new Map();
  45818. this._imageMap = new Map();
  45819. }
  45820. this._imageCache = new _primitives.RefSetCache();
  45821. }
  45822. getByName(name) {
  45823. if (this._onlyRefs) {
  45824. (0, _util.unreachable)("Should not call `getByName` method.");
  45825. }
  45826. const ref = this._nameRefMap.get(name);
  45827. if (ref) {
  45828. return this.getByRef(ref);
  45829. }
  45830. return this._imageMap.get(name) || null;
  45831. }
  45832. getByRef(ref) {
  45833. return this._imageCache.get(ref) || null;
  45834. }
  45835. set(name, ref, data) {
  45836. (0, _util.unreachable)("Abstract method `set` called.");
  45837. }
  45838. }
  45839. class LocalImageCache extends BaseLocalCache {
  45840. set(name, ref = null, data) {
  45841. if (typeof name !== "string") {
  45842. throw new Error('LocalImageCache.set - expected "name" argument.');
  45843. }
  45844. if (ref) {
  45845. if (this._imageCache.has(ref)) {
  45846. return;
  45847. }
  45848. this._nameRefMap.set(name, ref);
  45849. this._imageCache.put(ref, data);
  45850. return;
  45851. }
  45852. if (this._imageMap.has(name)) {
  45853. return;
  45854. }
  45855. this._imageMap.set(name, data);
  45856. }
  45857. }
  45858. exports.LocalImageCache = LocalImageCache;
  45859. class LocalColorSpaceCache extends BaseLocalCache {
  45860. set(name = null, ref = null, data) {
  45861. if (typeof name !== "string" && !ref) {
  45862. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45863. }
  45864. if (ref) {
  45865. if (this._imageCache.has(ref)) {
  45866. return;
  45867. }
  45868. if (name !== null) {
  45869. this._nameRefMap.set(name, ref);
  45870. }
  45871. this._imageCache.put(ref, data);
  45872. return;
  45873. }
  45874. if (this._imageMap.has(name)) {
  45875. return;
  45876. }
  45877. this._imageMap.set(name, data);
  45878. }
  45879. }
  45880. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45881. class LocalFunctionCache extends BaseLocalCache {
  45882. constructor(options) {
  45883. super({
  45884. onlyRefs: true
  45885. });
  45886. }
  45887. set(name = null, ref, data) {
  45888. if (!ref) {
  45889. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45890. }
  45891. if (this._imageCache.has(ref)) {
  45892. return;
  45893. }
  45894. this._imageCache.put(ref, data);
  45895. }
  45896. }
  45897. exports.LocalFunctionCache = LocalFunctionCache;
  45898. class LocalGStateCache extends BaseLocalCache {
  45899. set(name, ref = null, data) {
  45900. if (typeof name !== "string") {
  45901. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45902. }
  45903. if (ref) {
  45904. if (this._imageCache.has(ref)) {
  45905. return;
  45906. }
  45907. this._nameRefMap.set(name, ref);
  45908. this._imageCache.put(ref, data);
  45909. return;
  45910. }
  45911. if (this._imageMap.has(name)) {
  45912. return;
  45913. }
  45914. this._imageMap.set(name, data);
  45915. }
  45916. }
  45917. exports.LocalGStateCache = LocalGStateCache;
  45918. class LocalTilingPatternCache extends BaseLocalCache {
  45919. constructor(options) {
  45920. super({
  45921. onlyRefs: true
  45922. });
  45923. }
  45924. set(name = null, ref, data) {
  45925. if (!ref) {
  45926. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45927. }
  45928. if (this._imageCache.has(ref)) {
  45929. return;
  45930. }
  45931. this._imageCache.put(ref, data);
  45932. }
  45933. }
  45934. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45935. class GlobalImageCache {
  45936. static get NUM_PAGES_THRESHOLD() {
  45937. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45938. }
  45939. static get MIN_IMAGES_TO_CACHE() {
  45940. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45941. }
  45942. static get MAX_BYTE_SIZE() {
  45943. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45944. }
  45945. constructor() {
  45946. this._refCache = new _primitives.RefSetCache();
  45947. this._imageCache = new _primitives.RefSetCache();
  45948. }
  45949. get _byteSize() {
  45950. let byteSize = 0;
  45951. for (const imageData of this._imageCache) {
  45952. byteSize += imageData.byteSize;
  45953. }
  45954. return byteSize;
  45955. }
  45956. get _cacheLimitReached() {
  45957. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45958. return false;
  45959. }
  45960. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45961. return false;
  45962. }
  45963. return true;
  45964. }
  45965. shouldCache(ref, pageIndex) {
  45966. const pageIndexSet = this._refCache.get(ref);
  45967. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45968. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45969. return false;
  45970. }
  45971. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  45972. return false;
  45973. }
  45974. return true;
  45975. }
  45976. addPageIndex(ref, pageIndex) {
  45977. let pageIndexSet = this._refCache.get(ref);
  45978. if (!pageIndexSet) {
  45979. pageIndexSet = new Set();
  45980. this._refCache.put(ref, pageIndexSet);
  45981. }
  45982. pageIndexSet.add(pageIndex);
  45983. }
  45984. addByteSize(ref, byteSize) {
  45985. const imageData = this._imageCache.get(ref);
  45986. if (!imageData) {
  45987. return;
  45988. }
  45989. if (imageData.byteSize) {
  45990. return;
  45991. }
  45992. imageData.byteSize = byteSize;
  45993. }
  45994. getData(ref, pageIndex) {
  45995. const pageIndexSet = this._refCache.get(ref);
  45996. if (!pageIndexSet) {
  45997. return null;
  45998. }
  45999. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  46000. return null;
  46001. }
  46002. const imageData = this._imageCache.get(ref);
  46003. if (!imageData) {
  46004. return null;
  46005. }
  46006. pageIndexSet.add(pageIndex);
  46007. return imageData;
  46008. }
  46009. setData(ref, data) {
  46010. if (!this._refCache.has(ref)) {
  46011. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  46012. }
  46013. if (this._imageCache.has(ref)) {
  46014. return;
  46015. }
  46016. if (this._cacheLimitReached) {
  46017. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  46018. return;
  46019. }
  46020. this._imageCache.put(ref, data);
  46021. }
  46022. clear(onlyData = false) {
  46023. if (!onlyData) {
  46024. this._refCache.clear();
  46025. }
  46026. this._imageCache.clear();
  46027. }
  46028. }
  46029. exports.GlobalImageCache = GlobalImageCache;
  46030. /***/ }),
  46031. /* 58 */
  46032. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46033. Object.defineProperty(exports, "__esModule", ({
  46034. value: true
  46035. }));
  46036. exports.bidi = bidi;
  46037. var _util = __w_pdfjs_require__(2);
  46038. 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"];
  46039. 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"];
  46040. function isOdd(i) {
  46041. return (i & 1) !== 0;
  46042. }
  46043. function isEven(i) {
  46044. return (i & 1) === 0;
  46045. }
  46046. function findUnequal(arr, start, value) {
  46047. let j, jj;
  46048. for (j = start, jj = arr.length; j < jj; ++j) {
  46049. if (arr[j] !== value) {
  46050. return j;
  46051. }
  46052. }
  46053. return j;
  46054. }
  46055. function setValues(arr, start, end, value) {
  46056. for (let j = start; j < end; ++j) {
  46057. arr[j] = value;
  46058. }
  46059. }
  46060. function reverseValues(arr, start, end) {
  46061. for (let i = start, j = end - 1; i < j; ++i, --j) {
  46062. const temp = arr[i];
  46063. arr[i] = arr[j];
  46064. arr[j] = temp;
  46065. }
  46066. }
  46067. function createBidiText(str, isLTR, vertical = false) {
  46068. let dir = "ltr";
  46069. if (vertical) {
  46070. dir = "ttb";
  46071. } else if (!isLTR) {
  46072. dir = "rtl";
  46073. }
  46074. return {
  46075. str,
  46076. dir
  46077. };
  46078. }
  46079. const chars = [];
  46080. const types = [];
  46081. function bidi(str, startLevel = -1, vertical = false) {
  46082. let isLTR = true;
  46083. const strLength = str.length;
  46084. if (strLength === 0 || vertical) {
  46085. return createBidiText(str, isLTR, vertical);
  46086. }
  46087. chars.length = strLength;
  46088. types.length = strLength;
  46089. let numBidi = 0;
  46090. let i, ii;
  46091. for (i = 0; i < strLength; ++i) {
  46092. chars[i] = str.charAt(i);
  46093. const charCode = str.charCodeAt(i);
  46094. let charType = "L";
  46095. if (charCode <= 0x00ff) {
  46096. charType = baseTypes[charCode];
  46097. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  46098. charType = "R";
  46099. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  46100. charType = arabicTypes[charCode & 0xff];
  46101. if (!charType) {
  46102. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  46103. }
  46104. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  46105. charType = "AL";
  46106. }
  46107. if (charType === "R" || charType === "AL" || charType === "AN") {
  46108. numBidi++;
  46109. }
  46110. types[i] = charType;
  46111. }
  46112. if (numBidi === 0) {
  46113. isLTR = true;
  46114. return createBidiText(str, isLTR);
  46115. }
  46116. if (startLevel === -1) {
  46117. if (numBidi / strLength < 0.3 && strLength > 4) {
  46118. isLTR = true;
  46119. startLevel = 0;
  46120. } else {
  46121. isLTR = false;
  46122. startLevel = 1;
  46123. }
  46124. }
  46125. const levels = [];
  46126. for (i = 0; i < strLength; ++i) {
  46127. levels[i] = startLevel;
  46128. }
  46129. const e = isOdd(startLevel) ? "R" : "L";
  46130. const sor = e;
  46131. const eor = sor;
  46132. let lastType = sor;
  46133. for (i = 0; i < strLength; ++i) {
  46134. if (types[i] === "NSM") {
  46135. types[i] = lastType;
  46136. } else {
  46137. lastType = types[i];
  46138. }
  46139. }
  46140. lastType = sor;
  46141. let t;
  46142. for (i = 0; i < strLength; ++i) {
  46143. t = types[i];
  46144. if (t === "EN") {
  46145. types[i] = lastType === "AL" ? "AN" : "EN";
  46146. } else if (t === "R" || t === "L" || t === "AL") {
  46147. lastType = t;
  46148. }
  46149. }
  46150. for (i = 0; i < strLength; ++i) {
  46151. t = types[i];
  46152. if (t === "AL") {
  46153. types[i] = "R";
  46154. }
  46155. }
  46156. for (i = 1; i < strLength - 1; ++i) {
  46157. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  46158. types[i] = "EN";
  46159. }
  46160. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  46161. types[i] = types[i - 1];
  46162. }
  46163. }
  46164. for (i = 0; i < strLength; ++i) {
  46165. if (types[i] === "EN") {
  46166. for (let j = i - 1; j >= 0; --j) {
  46167. if (types[j] !== "ET") {
  46168. break;
  46169. }
  46170. types[j] = "EN";
  46171. }
  46172. for (let j = i + 1; j < strLength; ++j) {
  46173. if (types[j] !== "ET") {
  46174. break;
  46175. }
  46176. types[j] = "EN";
  46177. }
  46178. }
  46179. }
  46180. for (i = 0; i < strLength; ++i) {
  46181. t = types[i];
  46182. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  46183. types[i] = "ON";
  46184. }
  46185. }
  46186. lastType = sor;
  46187. for (i = 0; i < strLength; ++i) {
  46188. t = types[i];
  46189. if (t === "EN") {
  46190. types[i] = lastType === "L" ? "L" : "EN";
  46191. } else if (t === "R" || t === "L") {
  46192. lastType = t;
  46193. }
  46194. }
  46195. for (i = 0; i < strLength; ++i) {
  46196. if (types[i] === "ON") {
  46197. const end = findUnequal(types, i + 1, "ON");
  46198. let before = sor;
  46199. if (i > 0) {
  46200. before = types[i - 1];
  46201. }
  46202. let after = eor;
  46203. if (end + 1 < strLength) {
  46204. after = types[end + 1];
  46205. }
  46206. if (before !== "L") {
  46207. before = "R";
  46208. }
  46209. if (after !== "L") {
  46210. after = "R";
  46211. }
  46212. if (before === after) {
  46213. setValues(types, i, end, before);
  46214. }
  46215. i = end - 1;
  46216. }
  46217. }
  46218. for (i = 0; i < strLength; ++i) {
  46219. if (types[i] === "ON") {
  46220. types[i] = e;
  46221. }
  46222. }
  46223. for (i = 0; i < strLength; ++i) {
  46224. t = types[i];
  46225. if (isEven(levels[i])) {
  46226. if (t === "R") {
  46227. levels[i] += 1;
  46228. } else if (t === "AN" || t === "EN") {
  46229. levels[i] += 2;
  46230. }
  46231. } else {
  46232. if (t === "L" || t === "AN" || t === "EN") {
  46233. levels[i] += 1;
  46234. }
  46235. }
  46236. }
  46237. let highestLevel = -1;
  46238. let lowestOddLevel = 99;
  46239. let level;
  46240. for (i = 0, ii = levels.length; i < ii; ++i) {
  46241. level = levels[i];
  46242. if (highestLevel < level) {
  46243. highestLevel = level;
  46244. }
  46245. if (lowestOddLevel > level && isOdd(level)) {
  46246. lowestOddLevel = level;
  46247. }
  46248. }
  46249. for (level = highestLevel; level >= lowestOddLevel; --level) {
  46250. let start = -1;
  46251. for (i = 0, ii = levels.length; i < ii; ++i) {
  46252. if (levels[i] < level) {
  46253. if (start >= 0) {
  46254. reverseValues(chars, start, i);
  46255. start = -1;
  46256. }
  46257. } else if (start < 0) {
  46258. start = i;
  46259. }
  46260. }
  46261. if (start >= 0) {
  46262. reverseValues(chars, start, levels.length);
  46263. }
  46264. }
  46265. for (i = 0, ii = chars.length; i < ii; ++i) {
  46266. const ch = chars[i];
  46267. if (ch === "<" || ch === ">") {
  46268. chars[i] = "";
  46269. }
  46270. }
  46271. return createBidiText(chars.join(""), isLTR);
  46272. }
  46273. /***/ }),
  46274. /* 59 */
  46275. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46276. Object.defineProperty(exports, "__esModule", ({
  46277. value: true
  46278. }));
  46279. exports.MurmurHash3_64 = void 0;
  46280. var _util = __w_pdfjs_require__(2);
  46281. const SEED = 0xc3d2e1f0;
  46282. const MASK_HIGH = 0xffff0000;
  46283. const MASK_LOW = 0xffff;
  46284. class MurmurHash3_64 {
  46285. constructor(seed) {
  46286. this.h1 = seed ? seed & 0xffffffff : SEED;
  46287. this.h2 = seed ? seed & 0xffffffff : SEED;
  46288. }
  46289. update(input) {
  46290. let data, length;
  46291. if (typeof input === "string") {
  46292. data = new Uint8Array(input.length * 2);
  46293. length = 0;
  46294. for (let i = 0, ii = input.length; i < ii; i++) {
  46295. const code = input.charCodeAt(i);
  46296. if (code <= 0xff) {
  46297. data[length++] = code;
  46298. } else {
  46299. data[length++] = code >>> 8;
  46300. data[length++] = code & 0xff;
  46301. }
  46302. }
  46303. } else if ((0, _util.isArrayBuffer)(input)) {
  46304. data = input.slice();
  46305. length = data.byteLength;
  46306. } else {
  46307. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  46308. }
  46309. const blockCounts = length >> 2;
  46310. const tailLength = length - blockCounts * 4;
  46311. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  46312. let k1 = 0,
  46313. k2 = 0;
  46314. let h1 = this.h1,
  46315. h2 = this.h2;
  46316. const C1 = 0xcc9e2d51,
  46317. C2 = 0x1b873593;
  46318. const C1_LOW = C1 & MASK_LOW,
  46319. C2_LOW = C2 & MASK_LOW;
  46320. for (let i = 0; i < blockCounts; i++) {
  46321. if (i & 1) {
  46322. k1 = dataUint32[i];
  46323. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46324. k1 = k1 << 15 | k1 >>> 17;
  46325. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46326. h1 ^= k1;
  46327. h1 = h1 << 13 | h1 >>> 19;
  46328. h1 = h1 * 5 + 0xe6546b64;
  46329. } else {
  46330. k2 = dataUint32[i];
  46331. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  46332. k2 = k2 << 15 | k2 >>> 17;
  46333. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  46334. h2 ^= k2;
  46335. h2 = h2 << 13 | h2 >>> 19;
  46336. h2 = h2 * 5 + 0xe6546b64;
  46337. }
  46338. }
  46339. k1 = 0;
  46340. switch (tailLength) {
  46341. case 3:
  46342. k1 ^= data[blockCounts * 4 + 2] << 16;
  46343. case 2:
  46344. k1 ^= data[blockCounts * 4 + 1] << 8;
  46345. case 1:
  46346. k1 ^= data[blockCounts * 4];
  46347. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46348. k1 = k1 << 15 | k1 >>> 17;
  46349. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46350. if (blockCounts & 1) {
  46351. h1 ^= k1;
  46352. } else {
  46353. h2 ^= k1;
  46354. }
  46355. }
  46356. this.h1 = h1;
  46357. this.h2 = h2;
  46358. }
  46359. hexdigest() {
  46360. let h1 = this.h1,
  46361. h2 = this.h2;
  46362. h1 ^= h2 >>> 1;
  46363. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  46364. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  46365. h1 ^= h2 >>> 1;
  46366. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  46367. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  46368. h1 ^= h2 >>> 1;
  46369. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  46370. }
  46371. }
  46372. exports.MurmurHash3_64 = MurmurHash3_64;
  46373. /***/ }),
  46374. /* 60 */
  46375. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46376. Object.defineProperty(exports, "__esModule", ({
  46377. value: true
  46378. }));
  46379. exports.OperatorList = void 0;
  46380. var _util = __w_pdfjs_require__(2);
  46381. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  46382. let state = parentState;
  46383. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  46384. const item = pattern[i];
  46385. state = state[item] || (state[item] = []);
  46386. }
  46387. state[pattern.at(-1)] = {
  46388. checkFn,
  46389. iterateFn,
  46390. processFn
  46391. };
  46392. }
  46393. const InitialState = [];
  46394. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46395. const fnArray = context.fnArray;
  46396. const iFirstSave = context.iCurr - 3;
  46397. const pos = (i - iFirstSave) % 4;
  46398. switch (pos) {
  46399. case 0:
  46400. return fnArray[i] === _util.OPS.save;
  46401. case 1:
  46402. return fnArray[i] === _util.OPS.transform;
  46403. case 2:
  46404. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46405. case 3:
  46406. return fnArray[i] === _util.OPS.restore;
  46407. }
  46408. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46409. }, function foundInlineImageGroup(context, i) {
  46410. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46411. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46412. const MAX_WIDTH = 1000;
  46413. const IMAGE_PADDING = 1;
  46414. const fnArray = context.fnArray,
  46415. argsArray = context.argsArray;
  46416. const curr = context.iCurr;
  46417. const iFirstSave = curr - 3;
  46418. const iFirstTransform = curr - 2;
  46419. const iFirstPIIXO = curr - 1;
  46420. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46421. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46422. return i - (i - iFirstSave) % 4;
  46423. }
  46424. let maxX = 0;
  46425. const map = [];
  46426. let maxLineHeight = 0;
  46427. let currentX = IMAGE_PADDING,
  46428. currentY = IMAGE_PADDING;
  46429. for (let q = 0; q < count; q++) {
  46430. const transform = argsArray[iFirstTransform + (q << 2)];
  46431. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46432. if (currentX + img.width > MAX_WIDTH) {
  46433. maxX = Math.max(maxX, currentX);
  46434. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46435. currentX = 0;
  46436. maxLineHeight = 0;
  46437. }
  46438. map.push({
  46439. transform,
  46440. x: currentX,
  46441. y: currentY,
  46442. w: img.width,
  46443. h: img.height
  46444. });
  46445. currentX += img.width + 2 * IMAGE_PADDING;
  46446. maxLineHeight = Math.max(maxLineHeight, img.height);
  46447. }
  46448. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46449. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46450. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  46451. const imgRowSize = imgWidth << 2;
  46452. for (let q = 0; q < count; q++) {
  46453. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46454. const rowSize = map[q].w << 2;
  46455. let dataOffset = 0;
  46456. let offset = map[q].x + map[q].y * imgWidth << 2;
  46457. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46458. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46459. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46460. dataOffset += rowSize;
  46461. offset += imgRowSize;
  46462. }
  46463. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46464. while (offset >= 0) {
  46465. data[offset - 4] = data[offset];
  46466. data[offset - 3] = data[offset + 1];
  46467. data[offset - 2] = data[offset + 2];
  46468. data[offset - 1] = data[offset + 3];
  46469. data[offset + rowSize] = data[offset + rowSize - 4];
  46470. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46471. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46472. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46473. offset -= imgRowSize;
  46474. }
  46475. }
  46476. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46477. argsArray.splice(iFirstSave, count * 4, [{
  46478. width: imgWidth,
  46479. height: imgHeight,
  46480. kind: _util.ImageKind.RGBA_32BPP,
  46481. data: imgData
  46482. }, map]);
  46483. return iFirstSave + 1;
  46484. });
  46485. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46486. const fnArray = context.fnArray;
  46487. const iFirstSave = context.iCurr - 3;
  46488. const pos = (i - iFirstSave) % 4;
  46489. switch (pos) {
  46490. case 0:
  46491. return fnArray[i] === _util.OPS.save;
  46492. case 1:
  46493. return fnArray[i] === _util.OPS.transform;
  46494. case 2:
  46495. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46496. case 3:
  46497. return fnArray[i] === _util.OPS.restore;
  46498. }
  46499. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46500. }, function foundImageMaskGroup(context, i) {
  46501. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46502. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46503. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46504. const fnArray = context.fnArray,
  46505. argsArray = context.argsArray;
  46506. const curr = context.iCurr;
  46507. const iFirstSave = curr - 3;
  46508. const iFirstTransform = curr - 2;
  46509. const iFirstPIMXO = curr - 1;
  46510. let count = Math.floor((i - iFirstSave) / 4);
  46511. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46512. return i - (i - iFirstSave) % 4;
  46513. }
  46514. let isSameImage = false;
  46515. let iTransform, transformArgs;
  46516. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46517. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46518. firstTransformArg1 = argsArray[iFirstTransform][1],
  46519. firstTransformArg2 = argsArray[iFirstTransform][2],
  46520. firstTransformArg3 = argsArray[iFirstTransform][3];
  46521. if (firstTransformArg1 === firstTransformArg2) {
  46522. isSameImage = true;
  46523. iTransform = iFirstTransform + 4;
  46524. let iPIMXO = iFirstPIMXO + 4;
  46525. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46526. transformArgs = argsArray[iTransform];
  46527. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46528. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46529. isSameImage = false;
  46530. } else {
  46531. count = q;
  46532. }
  46533. break;
  46534. }
  46535. }
  46536. }
  46537. if (isSameImage) {
  46538. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46539. const positions = new Float32Array(count * 2);
  46540. iTransform = iFirstTransform;
  46541. for (let q = 0; q < count; q++, iTransform += 4) {
  46542. transformArgs = argsArray[iTransform];
  46543. positions[q << 1] = transformArgs[4];
  46544. positions[(q << 1) + 1] = transformArgs[5];
  46545. }
  46546. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46547. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46548. } else {
  46549. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46550. const images = [];
  46551. for (let q = 0; q < count; q++) {
  46552. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46553. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46554. images.push({
  46555. data: maskParams.data,
  46556. width: maskParams.width,
  46557. height: maskParams.height,
  46558. interpolate: maskParams.interpolate,
  46559. count: maskParams.count,
  46560. transform: transformArgs
  46561. });
  46562. }
  46563. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46564. argsArray.splice(iFirstSave, count * 4, [images]);
  46565. }
  46566. return iFirstSave + 1;
  46567. });
  46568. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46569. const argsArray = context.argsArray;
  46570. const iFirstTransform = context.iCurr - 2;
  46571. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46572. }, function iterateImageGroup(context, i) {
  46573. const fnArray = context.fnArray,
  46574. argsArray = context.argsArray;
  46575. const iFirstSave = context.iCurr - 3;
  46576. const pos = (i - iFirstSave) % 4;
  46577. switch (pos) {
  46578. case 0:
  46579. return fnArray[i] === _util.OPS.save;
  46580. case 1:
  46581. if (fnArray[i] !== _util.OPS.transform) {
  46582. return false;
  46583. }
  46584. const iFirstTransform = context.iCurr - 2;
  46585. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46586. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46587. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46588. return false;
  46589. }
  46590. return true;
  46591. case 2:
  46592. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46593. return false;
  46594. }
  46595. const iFirstPIXO = context.iCurr - 1;
  46596. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46597. if (argsArray[i][0] !== firstPIXOArg0) {
  46598. return false;
  46599. }
  46600. return true;
  46601. case 3:
  46602. return fnArray[i] === _util.OPS.restore;
  46603. }
  46604. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46605. }, function (context, i) {
  46606. const MIN_IMAGES_IN_BLOCK = 3;
  46607. const MAX_IMAGES_IN_BLOCK = 1000;
  46608. const fnArray = context.fnArray,
  46609. argsArray = context.argsArray;
  46610. const curr = context.iCurr;
  46611. const iFirstSave = curr - 3;
  46612. const iFirstTransform = curr - 2;
  46613. const iFirstPIXO = curr - 1;
  46614. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46615. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46616. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46617. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46618. if (count < MIN_IMAGES_IN_BLOCK) {
  46619. return i - (i - iFirstSave) % 4;
  46620. }
  46621. const positions = new Float32Array(count * 2);
  46622. let iTransform = iFirstTransform;
  46623. for (let q = 0; q < count; q++, iTransform += 4) {
  46624. const transformArgs = argsArray[iTransform];
  46625. positions[q << 1] = transformArgs[4];
  46626. positions[(q << 1) + 1] = transformArgs[5];
  46627. }
  46628. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46629. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46630. argsArray.splice(iFirstSave, count * 4, args);
  46631. return iFirstSave + 1;
  46632. });
  46633. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46634. const fnArray = context.fnArray,
  46635. argsArray = context.argsArray;
  46636. const iFirstSave = context.iCurr - 4;
  46637. const pos = (i - iFirstSave) % 5;
  46638. switch (pos) {
  46639. case 0:
  46640. return fnArray[i] === _util.OPS.beginText;
  46641. case 1:
  46642. return fnArray[i] === _util.OPS.setFont;
  46643. case 2:
  46644. return fnArray[i] === _util.OPS.setTextMatrix;
  46645. case 3:
  46646. if (fnArray[i] !== _util.OPS.showText) {
  46647. return false;
  46648. }
  46649. const iFirstSetFont = context.iCurr - 3;
  46650. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46651. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46652. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46653. return false;
  46654. }
  46655. return true;
  46656. case 4:
  46657. return fnArray[i] === _util.OPS.endText;
  46658. }
  46659. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46660. }, function (context, i) {
  46661. const MIN_CHARS_IN_BLOCK = 3;
  46662. const MAX_CHARS_IN_BLOCK = 1000;
  46663. const fnArray = context.fnArray,
  46664. argsArray = context.argsArray;
  46665. const curr = context.iCurr;
  46666. const iFirstBeginText = curr - 4;
  46667. const iFirstSetFont = curr - 3;
  46668. const iFirstSetTextMatrix = curr - 2;
  46669. const iFirstShowText = curr - 1;
  46670. const iFirstEndText = curr;
  46671. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46672. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46673. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46674. if (count < MIN_CHARS_IN_BLOCK) {
  46675. return i - (i - iFirstBeginText) % 5;
  46676. }
  46677. let iFirst = iFirstBeginText;
  46678. 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) {
  46679. count++;
  46680. iFirst -= 5;
  46681. }
  46682. let iEndText = iFirst + 4;
  46683. for (let q = 1; q < count; q++) {
  46684. fnArray.splice(iEndText, 3);
  46685. argsArray.splice(iEndText, 3);
  46686. iEndText += 2;
  46687. }
  46688. return iEndText + 1;
  46689. });
  46690. class NullOptimizer {
  46691. constructor(queue) {
  46692. this.queue = queue;
  46693. }
  46694. _optimize() {}
  46695. push(fn, args) {
  46696. this.queue.fnArray.push(fn);
  46697. this.queue.argsArray.push(args);
  46698. this._optimize();
  46699. }
  46700. flush() {}
  46701. reset() {}
  46702. }
  46703. class QueueOptimizer extends NullOptimizer {
  46704. constructor(queue) {
  46705. super(queue);
  46706. this.state = null;
  46707. this.context = {
  46708. iCurr: 0,
  46709. fnArray: queue.fnArray,
  46710. argsArray: queue.argsArray
  46711. };
  46712. this.match = null;
  46713. this.lastProcessed = 0;
  46714. }
  46715. _optimize() {
  46716. const fnArray = this.queue.fnArray;
  46717. let i = this.lastProcessed,
  46718. ii = fnArray.length;
  46719. let state = this.state;
  46720. let match = this.match;
  46721. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46722. this.lastProcessed = ii;
  46723. return;
  46724. }
  46725. const context = this.context;
  46726. while (i < ii) {
  46727. if (match) {
  46728. const iterate = (0, match.iterateFn)(context, i);
  46729. if (iterate) {
  46730. i++;
  46731. continue;
  46732. }
  46733. i = (0, match.processFn)(context, i + 1);
  46734. ii = fnArray.length;
  46735. match = null;
  46736. state = null;
  46737. if (i >= ii) {
  46738. break;
  46739. }
  46740. }
  46741. state = (state || InitialState)[fnArray[i]];
  46742. if (!state || Array.isArray(state)) {
  46743. i++;
  46744. continue;
  46745. }
  46746. context.iCurr = i;
  46747. i++;
  46748. if (state.checkFn && !(0, state.checkFn)(context)) {
  46749. state = null;
  46750. continue;
  46751. }
  46752. match = state;
  46753. state = null;
  46754. }
  46755. this.state = state;
  46756. this.match = match;
  46757. this.lastProcessed = i;
  46758. }
  46759. flush() {
  46760. while (this.match) {
  46761. const length = this.queue.fnArray.length;
  46762. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46763. this.match = null;
  46764. this.state = null;
  46765. this._optimize();
  46766. }
  46767. }
  46768. reset() {
  46769. this.state = null;
  46770. this.match = null;
  46771. this.lastProcessed = 0;
  46772. }
  46773. }
  46774. class OperatorList {
  46775. static get CHUNK_SIZE() {
  46776. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46777. }
  46778. static get CHUNK_SIZE_ABOUT() {
  46779. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46780. }
  46781. constructor(intent = 0, streamSink) {
  46782. this._streamSink = streamSink;
  46783. this.fnArray = [];
  46784. this.argsArray = [];
  46785. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46786. this.optimizer = new QueueOptimizer(this);
  46787. } else {
  46788. this.optimizer = new NullOptimizer(this);
  46789. }
  46790. this.dependencies = new Set();
  46791. this._totalLength = 0;
  46792. this.weight = 0;
  46793. this._resolved = streamSink ? null : Promise.resolve();
  46794. }
  46795. get length() {
  46796. return this.argsArray.length;
  46797. }
  46798. get ready() {
  46799. return this._resolved || this._streamSink.ready;
  46800. }
  46801. get totalLength() {
  46802. return this._totalLength + this.length;
  46803. }
  46804. addOp(fn, args) {
  46805. this.optimizer.push(fn, args);
  46806. this.weight++;
  46807. if (this._streamSink) {
  46808. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46809. this.flush();
  46810. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46811. this.flush();
  46812. }
  46813. }
  46814. }
  46815. addImageOps(fn, args, optionalContent) {
  46816. if (optionalContent !== undefined) {
  46817. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46818. }
  46819. this.addOp(fn, args);
  46820. if (optionalContent !== undefined) {
  46821. this.addOp(_util.OPS.endMarkedContent, []);
  46822. }
  46823. }
  46824. addDependency(dependency) {
  46825. if (this.dependencies.has(dependency)) {
  46826. return;
  46827. }
  46828. this.dependencies.add(dependency);
  46829. this.addOp(_util.OPS.dependency, [dependency]);
  46830. }
  46831. addDependencies(dependencies) {
  46832. for (const dependency of dependencies) {
  46833. this.addDependency(dependency);
  46834. }
  46835. }
  46836. addOpList(opList) {
  46837. if (!(opList instanceof OperatorList)) {
  46838. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46839. return;
  46840. }
  46841. for (const dependency of opList.dependencies) {
  46842. this.dependencies.add(dependency);
  46843. }
  46844. for (let i = 0, ii = opList.length; i < ii; i++) {
  46845. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46846. }
  46847. }
  46848. getIR() {
  46849. return {
  46850. fnArray: this.fnArray,
  46851. argsArray: this.argsArray,
  46852. length: this.length
  46853. };
  46854. }
  46855. get _transfers() {
  46856. const transfers = [];
  46857. const {
  46858. fnArray,
  46859. argsArray,
  46860. length
  46861. } = this;
  46862. for (let i = 0; i < length; i++) {
  46863. switch (fnArray[i]) {
  46864. case _util.OPS.paintInlineImageXObject:
  46865. case _util.OPS.paintInlineImageXObjectGroup:
  46866. case _util.OPS.paintImageMaskXObject:
  46867. const arg = argsArray[i][0];
  46868. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46869. transfers.push(arg.data.buffer);
  46870. }
  46871. break;
  46872. }
  46873. }
  46874. return transfers;
  46875. }
  46876. flush(lastChunk = false, separateAnnots = null) {
  46877. this.optimizer.flush();
  46878. const length = this.length;
  46879. this._totalLength += length;
  46880. this._streamSink.enqueue({
  46881. fnArray: this.fnArray,
  46882. argsArray: this.argsArray,
  46883. lastChunk,
  46884. separateAnnots,
  46885. length
  46886. }, 1, this._transfers);
  46887. this.dependencies.clear();
  46888. this.fnArray.length = 0;
  46889. this.argsArray.length = 0;
  46890. this.weight = 0;
  46891. this.optimizer.reset();
  46892. }
  46893. }
  46894. exports.OperatorList = OperatorList;
  46895. /***/ }),
  46896. /* 61 */
  46897. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46898. Object.defineProperty(exports, "__esModule", ({
  46899. value: true
  46900. }));
  46901. exports.PDFImage = void 0;
  46902. var _util = __w_pdfjs_require__(2);
  46903. var _image_utils = __w_pdfjs_require__(62);
  46904. var _base_stream = __w_pdfjs_require__(5);
  46905. var _colorspace = __w_pdfjs_require__(12);
  46906. var _decode_stream = __w_pdfjs_require__(17);
  46907. var _jpeg_stream = __w_pdfjs_require__(25);
  46908. var _jpx = __w_pdfjs_require__(28);
  46909. var _primitives = __w_pdfjs_require__(3);
  46910. function decodeAndClamp(value, addend, coefficient, max) {
  46911. value = addend + value * coefficient;
  46912. if (value < 0) {
  46913. value = 0;
  46914. } else if (value > max) {
  46915. value = max;
  46916. }
  46917. return value;
  46918. }
  46919. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46920. const length = w2 * h2;
  46921. let dest;
  46922. if (bpc <= 8) {
  46923. dest = new Uint8Array(length);
  46924. } else if (bpc <= 16) {
  46925. dest = new Uint16Array(length);
  46926. } else {
  46927. dest = new Uint32Array(length);
  46928. }
  46929. const xRatio = w1 / w2;
  46930. const yRatio = h1 / h2;
  46931. let i,
  46932. j,
  46933. py,
  46934. newIndex = 0,
  46935. oldIndex;
  46936. const xScaled = new Uint16Array(w2);
  46937. const w1Scanline = w1;
  46938. for (i = 0; i < w2; i++) {
  46939. xScaled[i] = Math.floor(i * xRatio);
  46940. }
  46941. for (i = 0; i < h2; i++) {
  46942. py = Math.floor(i * yRatio) * w1Scanline;
  46943. for (j = 0; j < w2; j++) {
  46944. oldIndex = py + xScaled[j];
  46945. dest[newIndex++] = src[oldIndex];
  46946. }
  46947. }
  46948. return dest;
  46949. }
  46950. class PDFImage {
  46951. constructor({
  46952. xref,
  46953. res,
  46954. image,
  46955. isInline = false,
  46956. smask = null,
  46957. mask = null,
  46958. isMask = false,
  46959. pdfFunctionFactory,
  46960. localColorSpaceCache
  46961. }) {
  46962. this.image = image;
  46963. const dict = image.dict;
  46964. const filter = dict.get("F", "Filter");
  46965. let filterName;
  46966. if (filter instanceof _primitives.Name) {
  46967. filterName = filter.name;
  46968. } else if (Array.isArray(filter)) {
  46969. const filterZero = xref.fetchIfRef(filter[0]);
  46970. if (filterZero instanceof _primitives.Name) {
  46971. filterName = filterZero.name;
  46972. }
  46973. }
  46974. switch (filterName) {
  46975. case "JPXDecode":
  46976. const jpxImage = new _jpx.JpxImage();
  46977. jpxImage.parseImageProperties(image.stream);
  46978. image.stream.reset();
  46979. image.width = jpxImage.width;
  46980. image.height = jpxImage.height;
  46981. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46982. image.numComps = jpxImage.componentsCount;
  46983. break;
  46984. case "JBIG2Decode":
  46985. image.bitsPerComponent = 1;
  46986. image.numComps = 1;
  46987. break;
  46988. }
  46989. let width = dict.get("W", "Width");
  46990. let height = dict.get("H", "Height");
  46991. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46992. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46993. width = image.width;
  46994. height = image.height;
  46995. }
  46996. if (width < 1 || height < 1) {
  46997. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46998. }
  46999. this.width = width;
  47000. this.height = height;
  47001. this.interpolate = dict.get("I", "Interpolate");
  47002. this.imageMask = dict.get("IM", "ImageMask") || false;
  47003. this.matte = dict.get("Matte") || false;
  47004. let bitsPerComponent = image.bitsPerComponent;
  47005. if (!bitsPerComponent) {
  47006. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  47007. if (!bitsPerComponent) {
  47008. if (this.imageMask) {
  47009. bitsPerComponent = 1;
  47010. } else {
  47011. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  47012. }
  47013. }
  47014. }
  47015. this.bpc = bitsPerComponent;
  47016. if (!this.imageMask) {
  47017. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  47018. if (!colorSpace) {
  47019. (0, _util.info)("JPX images (which do not require color spaces)");
  47020. switch (image.numComps) {
  47021. case 1:
  47022. colorSpace = _primitives.Name.get("DeviceGray");
  47023. break;
  47024. case 3:
  47025. colorSpace = _primitives.Name.get("DeviceRGB");
  47026. break;
  47027. case 4:
  47028. colorSpace = _primitives.Name.get("DeviceCMYK");
  47029. break;
  47030. default:
  47031. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  47032. }
  47033. }
  47034. this.colorSpace = _colorspace.ColorSpace.parse({
  47035. cs: colorSpace,
  47036. xref,
  47037. resources: isInline ? res : null,
  47038. pdfFunctionFactory,
  47039. localColorSpaceCache
  47040. });
  47041. this.numComps = this.colorSpace.numComps;
  47042. }
  47043. this.decode = dict.getArray("D", "Decode");
  47044. this.needsDecode = false;
  47045. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  47046. this.needsDecode = true;
  47047. const max = (1 << bitsPerComponent) - 1;
  47048. this.decodeCoefficients = [];
  47049. this.decodeAddends = [];
  47050. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  47051. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  47052. const dmin = this.decode[i];
  47053. const dmax = this.decode[i + 1];
  47054. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  47055. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  47056. }
  47057. }
  47058. if (smask) {
  47059. this.smask = new PDFImage({
  47060. xref,
  47061. res,
  47062. image: smask,
  47063. isInline,
  47064. pdfFunctionFactory,
  47065. localColorSpaceCache
  47066. });
  47067. } else if (mask) {
  47068. if (mask instanceof _base_stream.BaseStream) {
  47069. const maskDict = mask.dict,
  47070. imageMask = maskDict.get("IM", "ImageMask");
  47071. if (!imageMask) {
  47072. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  47073. } else {
  47074. this.mask = new PDFImage({
  47075. xref,
  47076. res,
  47077. image: mask,
  47078. isInline,
  47079. isMask: true,
  47080. pdfFunctionFactory,
  47081. localColorSpaceCache
  47082. });
  47083. }
  47084. } else {
  47085. this.mask = mask;
  47086. }
  47087. }
  47088. }
  47089. static async buildImage({
  47090. xref,
  47091. res,
  47092. image,
  47093. isInline = false,
  47094. pdfFunctionFactory,
  47095. localColorSpaceCache
  47096. }) {
  47097. const imageData = image;
  47098. let smaskData = null;
  47099. let maskData = null;
  47100. const smask = image.dict.get("SMask");
  47101. const mask = image.dict.get("Mask");
  47102. if (smask) {
  47103. if (smask instanceof _base_stream.BaseStream) {
  47104. smaskData = smask;
  47105. } else {
  47106. (0, _util.warn)("Unsupported /SMask format.");
  47107. }
  47108. } else if (mask) {
  47109. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  47110. maskData = mask;
  47111. } else {
  47112. (0, _util.warn)("Unsupported /Mask format.");
  47113. }
  47114. }
  47115. return new PDFImage({
  47116. xref,
  47117. res,
  47118. image: imageData,
  47119. isInline,
  47120. smask: smaskData,
  47121. mask: maskData,
  47122. pdfFunctionFactory,
  47123. localColorSpaceCache
  47124. });
  47125. }
  47126. static createRawMask({
  47127. imgArray,
  47128. width,
  47129. height,
  47130. imageIsFromDecodeStream,
  47131. inverseDecode,
  47132. interpolate
  47133. }) {
  47134. const computedLength = (width + 7 >> 3) * height;
  47135. const actualLength = imgArray.byteLength;
  47136. const haveFullData = computedLength === actualLength;
  47137. let data, i;
  47138. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  47139. data = imgArray;
  47140. } else if (!inverseDecode) {
  47141. data = new Uint8Array(imgArray);
  47142. } else {
  47143. data = new Uint8Array(computedLength);
  47144. data.set(imgArray);
  47145. data.fill(0xff, actualLength);
  47146. }
  47147. if (inverseDecode) {
  47148. for (i = 0; i < actualLength; i++) {
  47149. data[i] ^= 0xff;
  47150. }
  47151. }
  47152. return {
  47153. data,
  47154. width,
  47155. height,
  47156. interpolate
  47157. };
  47158. }
  47159. static createMask({
  47160. imgArray,
  47161. width,
  47162. height,
  47163. imageIsFromDecodeStream,
  47164. inverseDecode,
  47165. interpolate,
  47166. isOffscreenCanvasSupported = true
  47167. }) {
  47168. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  47169. if (isSingleOpaquePixel) {
  47170. return {
  47171. isSingleOpaquePixel
  47172. };
  47173. }
  47174. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  47175. const canvas = new OffscreenCanvas(width, height);
  47176. const ctx = canvas.getContext("2d");
  47177. const imgData = ctx.createImageData(width, height);
  47178. (0, _image_utils.applyMaskImageData)({
  47179. src: imgArray,
  47180. dest: imgData.data,
  47181. width,
  47182. height,
  47183. inverseDecode
  47184. });
  47185. ctx.putImageData(imgData, 0, 0);
  47186. const bitmap = canvas.transferToImageBitmap();
  47187. return {
  47188. data: null,
  47189. width,
  47190. height,
  47191. interpolate,
  47192. bitmap
  47193. };
  47194. }
  47195. return this.createRawMask({
  47196. imgArray,
  47197. width,
  47198. height,
  47199. inverseDecode,
  47200. imageIsFromDecodeStream,
  47201. interpolate
  47202. });
  47203. }
  47204. get drawWidth() {
  47205. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  47206. }
  47207. get drawHeight() {
  47208. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  47209. }
  47210. decodeBuffer(buffer) {
  47211. const bpc = this.bpc;
  47212. const numComps = this.numComps;
  47213. const decodeAddends = this.decodeAddends;
  47214. const decodeCoefficients = this.decodeCoefficients;
  47215. const max = (1 << bpc) - 1;
  47216. let i, ii;
  47217. if (bpc === 1) {
  47218. for (i = 0, ii = buffer.length; i < ii; i++) {
  47219. buffer[i] = +!buffer[i];
  47220. }
  47221. return;
  47222. }
  47223. let index = 0;
  47224. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  47225. for (let j = 0; j < numComps; j++) {
  47226. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  47227. index++;
  47228. }
  47229. }
  47230. }
  47231. getComponents(buffer) {
  47232. const bpc = this.bpc;
  47233. if (bpc === 8) {
  47234. return buffer;
  47235. }
  47236. const width = this.width;
  47237. const height = this.height;
  47238. const numComps = this.numComps;
  47239. const length = width * height * numComps;
  47240. let bufferPos = 0;
  47241. let output;
  47242. if (bpc <= 8) {
  47243. output = new Uint8Array(length);
  47244. } else if (bpc <= 16) {
  47245. output = new Uint16Array(length);
  47246. } else {
  47247. output = new Uint32Array(length);
  47248. }
  47249. const rowComps = width * numComps;
  47250. const max = (1 << bpc) - 1;
  47251. let i = 0,
  47252. ii,
  47253. buf;
  47254. if (bpc === 1) {
  47255. let mask, loop1End, loop2End;
  47256. for (let j = 0; j < height; j++) {
  47257. loop1End = i + (rowComps & ~7);
  47258. loop2End = i + rowComps;
  47259. while (i < loop1End) {
  47260. buf = buffer[bufferPos++];
  47261. output[i] = buf >> 7 & 1;
  47262. output[i + 1] = buf >> 6 & 1;
  47263. output[i + 2] = buf >> 5 & 1;
  47264. output[i + 3] = buf >> 4 & 1;
  47265. output[i + 4] = buf >> 3 & 1;
  47266. output[i + 5] = buf >> 2 & 1;
  47267. output[i + 6] = buf >> 1 & 1;
  47268. output[i + 7] = buf & 1;
  47269. i += 8;
  47270. }
  47271. if (i < loop2End) {
  47272. buf = buffer[bufferPos++];
  47273. mask = 128;
  47274. while (i < loop2End) {
  47275. output[i++] = +!!(buf & mask);
  47276. mask >>= 1;
  47277. }
  47278. }
  47279. }
  47280. } else {
  47281. let bits = 0;
  47282. buf = 0;
  47283. for (i = 0, ii = length; i < ii; ++i) {
  47284. if (i % rowComps === 0) {
  47285. buf = 0;
  47286. bits = 0;
  47287. }
  47288. while (bits < bpc) {
  47289. buf = buf << 8 | buffer[bufferPos++];
  47290. bits += 8;
  47291. }
  47292. const remainingBits = bits - bpc;
  47293. let value = buf >> remainingBits;
  47294. if (value < 0) {
  47295. value = 0;
  47296. } else if (value > max) {
  47297. value = max;
  47298. }
  47299. output[i] = value;
  47300. buf &= (1 << remainingBits) - 1;
  47301. bits = remainingBits;
  47302. }
  47303. }
  47304. return output;
  47305. }
  47306. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  47307. const smask = this.smask;
  47308. const mask = this.mask;
  47309. let alphaBuf, sw, sh, i, ii, j;
  47310. if (smask) {
  47311. sw = smask.width;
  47312. sh = smask.height;
  47313. alphaBuf = new Uint8ClampedArray(sw * sh);
  47314. smask.fillGrayBuffer(alphaBuf);
  47315. if (sw !== width || sh !== height) {
  47316. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  47317. }
  47318. } else if (mask) {
  47319. if (mask instanceof PDFImage) {
  47320. sw = mask.width;
  47321. sh = mask.height;
  47322. alphaBuf = new Uint8ClampedArray(sw * sh);
  47323. mask.numComps = 1;
  47324. mask.fillGrayBuffer(alphaBuf);
  47325. for (i = 0, ii = sw * sh; i < ii; ++i) {
  47326. alphaBuf[i] = 255 - alphaBuf[i];
  47327. }
  47328. if (sw !== width || sh !== height) {
  47329. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  47330. }
  47331. } else if (Array.isArray(mask)) {
  47332. alphaBuf = new Uint8ClampedArray(width * height);
  47333. const numComps = this.numComps;
  47334. for (i = 0, ii = width * height; i < ii; ++i) {
  47335. let opacity = 0;
  47336. const imageOffset = i * numComps;
  47337. for (j = 0; j < numComps; ++j) {
  47338. const color = image[imageOffset + j];
  47339. const maskOffset = j * 2;
  47340. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  47341. opacity = 255;
  47342. break;
  47343. }
  47344. }
  47345. alphaBuf[i] = opacity;
  47346. }
  47347. } else {
  47348. throw new _util.FormatError("Unknown mask format.");
  47349. }
  47350. }
  47351. if (alphaBuf) {
  47352. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47353. rgbaBuf[j] = alphaBuf[i];
  47354. }
  47355. } else {
  47356. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47357. rgbaBuf[j] = 255;
  47358. }
  47359. }
  47360. }
  47361. undoPreblend(buffer, width, height) {
  47362. const matte = this.smask && this.smask.matte;
  47363. if (!matte) {
  47364. return;
  47365. }
  47366. const matteRgb = this.colorSpace.getRgb(matte, 0);
  47367. const matteR = matteRgb[0];
  47368. const matteG = matteRgb[1];
  47369. const matteB = matteRgb[2];
  47370. const length = width * height * 4;
  47371. for (let i = 0; i < length; i += 4) {
  47372. const alpha = buffer[i + 3];
  47373. if (alpha === 0) {
  47374. buffer[i] = 255;
  47375. buffer[i + 1] = 255;
  47376. buffer[i + 2] = 255;
  47377. continue;
  47378. }
  47379. const k = 255 / alpha;
  47380. buffer[i] = (buffer[i] - matteR) * k + matteR;
  47381. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  47382. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  47383. }
  47384. }
  47385. createImageData(forceRGBA = false) {
  47386. const drawWidth = this.drawWidth;
  47387. const drawHeight = this.drawHeight;
  47388. const imgData = {
  47389. width: drawWidth,
  47390. height: drawHeight,
  47391. interpolate: this.interpolate,
  47392. kind: 0,
  47393. data: null
  47394. };
  47395. const numComps = this.numComps;
  47396. const originalWidth = this.width;
  47397. const originalHeight = this.height;
  47398. const bpc = this.bpc;
  47399. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47400. if (!forceRGBA) {
  47401. let kind;
  47402. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47403. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47404. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47405. kind = _util.ImageKind.RGB_24BPP;
  47406. }
  47407. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47408. imgData.kind = kind;
  47409. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  47410. if (this.needsDecode) {
  47411. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47412. const buffer = imgData.data;
  47413. for (let i = 0, ii = buffer.length; i < ii; i++) {
  47414. buffer[i] ^= 0xff;
  47415. }
  47416. }
  47417. return imgData;
  47418. }
  47419. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47420. let imageLength = originalHeight * rowBytes;
  47421. switch (this.colorSpace.name) {
  47422. case "DeviceGray":
  47423. imageLength *= 3;
  47424. case "DeviceRGB":
  47425. case "DeviceCMYK":
  47426. imgData.kind = _util.ImageKind.RGB_24BPP;
  47427. imgData.data = this.getImageBytes(imageLength, {
  47428. drawWidth,
  47429. drawHeight,
  47430. forceRGB: true
  47431. });
  47432. return imgData;
  47433. }
  47434. }
  47435. }
  47436. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  47437. internal: true
  47438. });
  47439. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47440. const comps = this.getComponents(imgArray);
  47441. let alpha01, maybeUndoPreblend;
  47442. if (!forceRGBA && !this.smask && !this.mask) {
  47443. imgData.kind = _util.ImageKind.RGB_24BPP;
  47444. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47445. alpha01 = 0;
  47446. maybeUndoPreblend = false;
  47447. } else {
  47448. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47449. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47450. alpha01 = 1;
  47451. maybeUndoPreblend = true;
  47452. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47453. }
  47454. if (this.needsDecode) {
  47455. this.decodeBuffer(comps);
  47456. }
  47457. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47458. if (maybeUndoPreblend) {
  47459. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47460. }
  47461. return imgData;
  47462. }
  47463. fillGrayBuffer(buffer) {
  47464. const numComps = this.numComps;
  47465. if (numComps !== 1) {
  47466. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47467. }
  47468. const width = this.width;
  47469. const height = this.height;
  47470. const bpc = this.bpc;
  47471. const rowBytes = width * numComps * bpc + 7 >> 3;
  47472. const imgArray = this.getImageBytes(height * rowBytes, {
  47473. internal: true
  47474. });
  47475. const comps = this.getComponents(imgArray);
  47476. let i, length;
  47477. if (bpc === 1) {
  47478. length = width * height;
  47479. if (this.needsDecode) {
  47480. for (i = 0; i < length; ++i) {
  47481. buffer[i] = comps[i] - 1 & 255;
  47482. }
  47483. } else {
  47484. for (i = 0; i < length; ++i) {
  47485. buffer[i] = -comps[i] & 255;
  47486. }
  47487. }
  47488. return;
  47489. }
  47490. if (this.needsDecode) {
  47491. this.decodeBuffer(comps);
  47492. }
  47493. length = width * height;
  47494. const scale = 255 / ((1 << bpc) - 1);
  47495. for (i = 0; i < length; ++i) {
  47496. buffer[i] = scale * comps[i];
  47497. }
  47498. }
  47499. getImageBytes(length, {
  47500. drawWidth,
  47501. drawHeight,
  47502. forceRGB = false,
  47503. internal = false
  47504. }) {
  47505. this.image.reset();
  47506. this.image.drawWidth = drawWidth || this.width;
  47507. this.image.drawHeight = drawHeight || this.height;
  47508. this.image.forceRGB = !!forceRGB;
  47509. const imageBytes = this.image.getBytes(length);
  47510. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47511. return imageBytes;
  47512. }
  47513. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47514. return new Uint8Array(imageBytes);
  47515. }
  47516. }
  47517. exports.PDFImage = PDFImage;
  47518. /***/ }),
  47519. /* 62 */
  47520. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47521. Object.defineProperty(exports, "__esModule", ({
  47522. value: true
  47523. }));
  47524. exports.applyMaskImageData = applyMaskImageData;
  47525. var _util = __w_pdfjs_require__(2);
  47526. function applyMaskImageData({
  47527. src,
  47528. srcPos = 0,
  47529. dest,
  47530. destPos = 0,
  47531. width,
  47532. height,
  47533. inverseDecode = false
  47534. }) {
  47535. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47536. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47537. const widthInSource = width >> 3;
  47538. const widthRemainder = width & 7;
  47539. const srcLength = src.length;
  47540. dest = new Uint32Array(dest.buffer);
  47541. for (let i = 0; i < height; i++) {
  47542. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47543. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47544. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47545. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47546. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47547. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47548. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47549. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47550. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47551. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47552. }
  47553. if (widthRemainder === 0) {
  47554. continue;
  47555. }
  47556. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47557. for (let j = 0; j < widthRemainder; j++) {
  47558. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47559. }
  47560. }
  47561. return {
  47562. srcPos,
  47563. destPos
  47564. };
  47565. }
  47566. /***/ }),
  47567. /* 63 */
  47568. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47569. Object.defineProperty(exports, "__esModule", ({
  47570. value: true
  47571. }));
  47572. exports.incrementalUpdate = incrementalUpdate;
  47573. exports.writeDict = writeDict;
  47574. exports.writeObject = writeObject;
  47575. var _util = __w_pdfjs_require__(2);
  47576. var _primitives = __w_pdfjs_require__(3);
  47577. var _core_utils = __w_pdfjs_require__(4);
  47578. var _xml_parser = __w_pdfjs_require__(64);
  47579. var _base_stream = __w_pdfjs_require__(5);
  47580. var _crypto = __w_pdfjs_require__(65);
  47581. function writeObject(ref, obj, buffer, transform) {
  47582. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47583. if (obj instanceof _primitives.Dict) {
  47584. writeDict(obj, buffer, transform);
  47585. } else if (obj instanceof _base_stream.BaseStream) {
  47586. writeStream(obj, buffer, transform);
  47587. }
  47588. buffer.push("\nendobj\n");
  47589. }
  47590. function writeDict(dict, buffer, transform) {
  47591. buffer.push("<<");
  47592. for (const key of dict.getKeys()) {
  47593. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47594. writeValue(dict.getRaw(key), buffer, transform);
  47595. }
  47596. buffer.push(">>");
  47597. }
  47598. function writeStream(stream, buffer, transform) {
  47599. writeDict(stream.dict, buffer, transform);
  47600. buffer.push(" stream\n");
  47601. let string = stream.getString();
  47602. if (transform !== null) {
  47603. string = transform.encryptString(string);
  47604. }
  47605. buffer.push(string, "\nendstream");
  47606. }
  47607. function writeArray(array, buffer, transform) {
  47608. buffer.push("[");
  47609. let first = true;
  47610. for (const val of array) {
  47611. if (!first) {
  47612. buffer.push(" ");
  47613. } else {
  47614. first = false;
  47615. }
  47616. writeValue(val, buffer, transform);
  47617. }
  47618. buffer.push("]");
  47619. }
  47620. function writeValue(value, buffer, transform) {
  47621. if (value instanceof _primitives.Name) {
  47622. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47623. } else if (value instanceof _primitives.Ref) {
  47624. buffer.push(`${value.num} ${value.gen} R`);
  47625. } else if (Array.isArray(value)) {
  47626. writeArray(value, buffer, transform);
  47627. } else if (typeof value === "string") {
  47628. if (transform !== null) {
  47629. value = transform.encryptString(value);
  47630. }
  47631. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  47632. } else if (typeof value === "number") {
  47633. buffer.push((0, _core_utils.numberToString)(value));
  47634. } else if (typeof value === "boolean") {
  47635. buffer.push(value.toString());
  47636. } else if (value instanceof _primitives.Dict) {
  47637. writeDict(value, buffer, transform);
  47638. } else if (value instanceof _base_stream.BaseStream) {
  47639. writeStream(value, buffer, transform);
  47640. } else if (value === null) {
  47641. buffer.push("null");
  47642. } else {
  47643. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47644. }
  47645. }
  47646. function writeInt(number, size, offset, buffer) {
  47647. for (let i = size + offset - 1; i > offset - 1; i--) {
  47648. buffer[i] = number & 0xff;
  47649. number >>= 8;
  47650. }
  47651. return offset + size;
  47652. }
  47653. function writeString(string, offset, buffer) {
  47654. for (let i = 0, len = string.length; i < len; i++) {
  47655. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47656. }
  47657. }
  47658. function computeMD5(filesize, xrefInfo) {
  47659. const time = Math.floor(Date.now() / 1000);
  47660. const filename = xrefInfo.filename || "";
  47661. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47662. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47663. for (const value of Object.values(xrefInfo.info)) {
  47664. md5Buffer.push(value);
  47665. md5BufferLen += value.length;
  47666. }
  47667. const array = new Uint8Array(md5BufferLen);
  47668. let offset = 0;
  47669. for (const str of md5Buffer) {
  47670. writeString(str, offset, array);
  47671. offset += str.length;
  47672. }
  47673. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47674. }
  47675. function writeXFADataForAcroform(str, newRefs) {
  47676. const xml = new _xml_parser.SimpleXMLParser({
  47677. hasAttributes: true
  47678. }).parseFromString(str);
  47679. for (const {
  47680. xfa
  47681. } of newRefs) {
  47682. if (!xfa) {
  47683. continue;
  47684. }
  47685. const {
  47686. path,
  47687. value
  47688. } = xfa;
  47689. if (!path) {
  47690. continue;
  47691. }
  47692. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47693. if (node) {
  47694. if (Array.isArray(value)) {
  47695. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47696. } else {
  47697. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47698. }
  47699. } else {
  47700. (0, _util.warn)(`Node not found for path: ${path}`);
  47701. }
  47702. }
  47703. const buffer = [];
  47704. xml.documentElement.dump(buffer);
  47705. return buffer.join("");
  47706. }
  47707. function updateAcroform({
  47708. xref,
  47709. acroForm,
  47710. acroFormRef,
  47711. hasXfa,
  47712. hasXfaDatasetsEntry,
  47713. xfaDatasetsRef,
  47714. needAppearances,
  47715. newRefs
  47716. }) {
  47717. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  47718. (0, _util.warn)("XFA - Cannot save it");
  47719. }
  47720. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  47721. return;
  47722. }
  47723. const dict = new _primitives.Dict(xref);
  47724. for (const key of acroForm.getKeys()) {
  47725. dict.set(key, acroForm.getRaw(key));
  47726. }
  47727. if (hasXfa && !hasXfaDatasetsEntry) {
  47728. const newXfa = acroForm.get("XFA").slice();
  47729. newXfa.splice(2, 0, "datasets");
  47730. newXfa.splice(3, 0, xfaDatasetsRef);
  47731. dict.set("XFA", newXfa);
  47732. }
  47733. if (needAppearances) {
  47734. dict.set("NeedAppearances", true);
  47735. }
  47736. const encrypt = xref.encrypt;
  47737. let transform = null;
  47738. if (encrypt) {
  47739. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47740. }
  47741. const buffer = [];
  47742. writeObject(acroFormRef, dict, buffer, transform);
  47743. newRefs.push({
  47744. ref: acroFormRef,
  47745. data: buffer.join("")
  47746. });
  47747. }
  47748. function updateXFA({
  47749. xfaData,
  47750. xfaDatasetsRef,
  47751. newRefs,
  47752. xref
  47753. }) {
  47754. if (xfaData === null) {
  47755. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47756. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47757. }
  47758. const encrypt = xref.encrypt;
  47759. if (encrypt) {
  47760. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47761. xfaData = transform.encryptString(xfaData);
  47762. }
  47763. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47764. newRefs.push({
  47765. ref: xfaDatasetsRef,
  47766. data
  47767. });
  47768. }
  47769. function incrementalUpdate({
  47770. originalData,
  47771. xrefInfo,
  47772. newRefs,
  47773. xref = null,
  47774. hasXfa = false,
  47775. xfaDatasetsRef = null,
  47776. hasXfaDatasetsEntry = false,
  47777. needAppearances,
  47778. acroFormRef = null,
  47779. acroForm = null,
  47780. xfaData = null
  47781. }) {
  47782. updateAcroform({
  47783. xref,
  47784. acroForm,
  47785. acroFormRef,
  47786. hasXfa,
  47787. hasXfaDatasetsEntry,
  47788. xfaDatasetsRef,
  47789. needAppearances,
  47790. newRefs
  47791. });
  47792. if (hasXfa) {
  47793. updateXFA({
  47794. xfaData,
  47795. xfaDatasetsRef,
  47796. newRefs,
  47797. xref
  47798. });
  47799. }
  47800. const newXref = new _primitives.Dict(null);
  47801. const refForXrefTable = xrefInfo.newRef;
  47802. let buffer, baseOffset;
  47803. const lastByte = originalData.at(-1);
  47804. if (lastByte === 0x0a || lastByte === 0x0d) {
  47805. buffer = [];
  47806. baseOffset = originalData.length;
  47807. } else {
  47808. buffer = ["\n"];
  47809. baseOffset = originalData.length + 1;
  47810. }
  47811. newXref.set("Size", refForXrefTable.num + 1);
  47812. newXref.set("Prev", xrefInfo.startXRef);
  47813. newXref.set("Type", _primitives.Name.get("XRef"));
  47814. if (xrefInfo.rootRef !== null) {
  47815. newXref.set("Root", xrefInfo.rootRef);
  47816. }
  47817. if (xrefInfo.infoRef !== null) {
  47818. newXref.set("Info", xrefInfo.infoRef);
  47819. }
  47820. if (xrefInfo.encryptRef !== null) {
  47821. newXref.set("Encrypt", xrefInfo.encryptRef);
  47822. }
  47823. newRefs.push({
  47824. ref: refForXrefTable,
  47825. data: ""
  47826. });
  47827. newRefs = newRefs.sort((a, b) => {
  47828. return a.ref.num - b.ref.num;
  47829. });
  47830. const xrefTableData = [[0, 1, 0xffff]];
  47831. const indexes = [0, 1];
  47832. let maxOffset = 0;
  47833. for (const {
  47834. ref,
  47835. data
  47836. } of newRefs) {
  47837. maxOffset = Math.max(maxOffset, baseOffset);
  47838. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47839. baseOffset += data.length;
  47840. indexes.push(ref.num, 1);
  47841. buffer.push(data);
  47842. }
  47843. newXref.set("Index", indexes);
  47844. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47845. const md5 = computeMD5(baseOffset, xrefInfo);
  47846. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47847. }
  47848. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47849. const sizes = [1, offsetSize, 2];
  47850. const structSize = sizes[0] + sizes[1] + sizes[2];
  47851. const tableLength = structSize * xrefTableData.length;
  47852. newXref.set("W", sizes);
  47853. newXref.set("Length", tableLength);
  47854. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47855. writeDict(newXref, buffer, null);
  47856. buffer.push(" stream\n");
  47857. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47858. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47859. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47860. array.set(originalData);
  47861. let offset = originalData.length;
  47862. for (const str of buffer) {
  47863. writeString(str, offset, array);
  47864. offset += str.length;
  47865. }
  47866. for (const [type, objOffset, gen] of xrefTableData) {
  47867. offset = writeInt(type, sizes[0], offset, array);
  47868. offset = writeInt(objOffset, sizes[1], offset, array);
  47869. offset = writeInt(gen, sizes[2], offset, array);
  47870. }
  47871. writeString(footer, offset, array);
  47872. return array;
  47873. }
  47874. /***/ }),
  47875. /* 64 */
  47876. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47877. Object.defineProperty(exports, "__esModule", ({
  47878. value: true
  47879. }));
  47880. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47881. var _core_utils = __w_pdfjs_require__(4);
  47882. const XMLParserErrorCode = {
  47883. NoError: 0,
  47884. EndOfDocument: -1,
  47885. UnterminatedCdat: -2,
  47886. UnterminatedXmlDeclaration: -3,
  47887. UnterminatedDoctypeDeclaration: -4,
  47888. UnterminatedComment: -5,
  47889. MalformedElement: -6,
  47890. OutOfMemory: -7,
  47891. UnterminatedAttributeValue: -8,
  47892. UnterminatedElement: -9,
  47893. ElementNeverBegun: -10
  47894. };
  47895. exports.XMLParserErrorCode = XMLParserErrorCode;
  47896. function isWhitespace(s, index) {
  47897. const ch = s[index];
  47898. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47899. }
  47900. function isWhitespaceString(s) {
  47901. for (let i = 0, ii = s.length; i < ii; i++) {
  47902. if (!isWhitespace(s, i)) {
  47903. return false;
  47904. }
  47905. }
  47906. return true;
  47907. }
  47908. class XMLParserBase {
  47909. _resolveEntities(s) {
  47910. return s.replace(/&([^;]+);/g, (all, entity) => {
  47911. if (entity.substring(0, 2) === "#x") {
  47912. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47913. } else if (entity.substring(0, 1) === "#") {
  47914. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47915. }
  47916. switch (entity) {
  47917. case "lt":
  47918. return "<";
  47919. case "gt":
  47920. return ">";
  47921. case "amp":
  47922. return "&";
  47923. case "quot":
  47924. return '"';
  47925. case "apos":
  47926. return "'";
  47927. }
  47928. return this.onResolveEntity(entity);
  47929. });
  47930. }
  47931. _parseContent(s, start) {
  47932. const attributes = [];
  47933. let pos = start;
  47934. function skipWs() {
  47935. while (pos < s.length && isWhitespace(s, pos)) {
  47936. ++pos;
  47937. }
  47938. }
  47939. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47940. ++pos;
  47941. }
  47942. const name = s.substring(start, pos);
  47943. skipWs();
  47944. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47945. skipWs();
  47946. let attrName = "",
  47947. attrValue = "";
  47948. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47949. attrName += s[pos];
  47950. ++pos;
  47951. }
  47952. skipWs();
  47953. if (s[pos] !== "=") {
  47954. return null;
  47955. }
  47956. ++pos;
  47957. skipWs();
  47958. const attrEndChar = s[pos];
  47959. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47960. return null;
  47961. }
  47962. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47963. if (attrEndIndex < 0) {
  47964. return null;
  47965. }
  47966. attrValue = s.substring(pos, attrEndIndex);
  47967. attributes.push({
  47968. name: attrName,
  47969. value: this._resolveEntities(attrValue)
  47970. });
  47971. pos = attrEndIndex + 1;
  47972. skipWs();
  47973. }
  47974. return {
  47975. name,
  47976. attributes,
  47977. parsed: pos - start
  47978. };
  47979. }
  47980. _parseProcessingInstruction(s, start) {
  47981. let pos = start;
  47982. function skipWs() {
  47983. while (pos < s.length && isWhitespace(s, pos)) {
  47984. ++pos;
  47985. }
  47986. }
  47987. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47988. ++pos;
  47989. }
  47990. const name = s.substring(start, pos);
  47991. skipWs();
  47992. const attrStart = pos;
  47993. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47994. ++pos;
  47995. }
  47996. const value = s.substring(attrStart, pos);
  47997. return {
  47998. name,
  47999. value,
  48000. parsed: pos - start
  48001. };
  48002. }
  48003. parseXml(s) {
  48004. let i = 0;
  48005. while (i < s.length) {
  48006. const ch = s[i];
  48007. let j = i;
  48008. if (ch === "<") {
  48009. ++j;
  48010. const ch2 = s[j];
  48011. let q;
  48012. switch (ch2) {
  48013. case "/":
  48014. ++j;
  48015. q = s.indexOf(">", j);
  48016. if (q < 0) {
  48017. this.onError(XMLParserErrorCode.UnterminatedElement);
  48018. return;
  48019. }
  48020. this.onEndElement(s.substring(j, q));
  48021. j = q + 1;
  48022. break;
  48023. case "?":
  48024. ++j;
  48025. const pi = this._parseProcessingInstruction(s, j);
  48026. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  48027. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  48028. return;
  48029. }
  48030. this.onPi(pi.name, pi.value);
  48031. j += pi.parsed + 2;
  48032. break;
  48033. case "!":
  48034. if (s.substring(j + 1, j + 3) === "--") {
  48035. q = s.indexOf("-->", j + 3);
  48036. if (q < 0) {
  48037. this.onError(XMLParserErrorCode.UnterminatedComment);
  48038. return;
  48039. }
  48040. this.onComment(s.substring(j + 3, q));
  48041. j = q + 3;
  48042. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  48043. q = s.indexOf("]]>", j + 8);
  48044. if (q < 0) {
  48045. this.onError(XMLParserErrorCode.UnterminatedCdat);
  48046. return;
  48047. }
  48048. this.onCdata(s.substring(j + 8, q));
  48049. j = q + 3;
  48050. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  48051. const q2 = s.indexOf("[", j + 8);
  48052. let complexDoctype = false;
  48053. q = s.indexOf(">", j + 8);
  48054. if (q < 0) {
  48055. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48056. return;
  48057. }
  48058. if (q2 > 0 && q > q2) {
  48059. q = s.indexOf("]>", j + 8);
  48060. if (q < 0) {
  48061. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48062. return;
  48063. }
  48064. complexDoctype = true;
  48065. }
  48066. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  48067. this.onDoctype(doctypeContent);
  48068. j = q + (complexDoctype ? 2 : 1);
  48069. } else {
  48070. this.onError(XMLParserErrorCode.MalformedElement);
  48071. return;
  48072. }
  48073. break;
  48074. default:
  48075. const content = this._parseContent(s, j);
  48076. if (content === null) {
  48077. this.onError(XMLParserErrorCode.MalformedElement);
  48078. return;
  48079. }
  48080. let isClosed = false;
  48081. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  48082. isClosed = true;
  48083. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  48084. this.onError(XMLParserErrorCode.UnterminatedElement);
  48085. return;
  48086. }
  48087. this.onBeginElement(content.name, content.attributes, isClosed);
  48088. j += content.parsed + (isClosed ? 2 : 1);
  48089. break;
  48090. }
  48091. } else {
  48092. while (j < s.length && s[j] !== "<") {
  48093. j++;
  48094. }
  48095. const text = s.substring(i, j);
  48096. this.onText(this._resolveEntities(text));
  48097. }
  48098. i = j;
  48099. }
  48100. }
  48101. onResolveEntity(name) {
  48102. return `&${name};`;
  48103. }
  48104. onPi(name, value) {}
  48105. onComment(text) {}
  48106. onCdata(text) {}
  48107. onDoctype(doctypeContent) {}
  48108. onText(text) {}
  48109. onBeginElement(name, attributes, isEmpty) {}
  48110. onEndElement(name) {}
  48111. onError(code) {}
  48112. }
  48113. exports.XMLParserBase = XMLParserBase;
  48114. class SimpleDOMNode {
  48115. constructor(nodeName, nodeValue) {
  48116. this.nodeName = nodeName;
  48117. this.nodeValue = nodeValue;
  48118. Object.defineProperty(this, "parentNode", {
  48119. value: null,
  48120. writable: true
  48121. });
  48122. }
  48123. get firstChild() {
  48124. return this.childNodes && this.childNodes[0];
  48125. }
  48126. get nextSibling() {
  48127. const childNodes = this.parentNode.childNodes;
  48128. if (!childNodes) {
  48129. return undefined;
  48130. }
  48131. const index = childNodes.indexOf(this);
  48132. if (index === -1) {
  48133. return undefined;
  48134. }
  48135. return childNodes[index + 1];
  48136. }
  48137. get textContent() {
  48138. if (!this.childNodes) {
  48139. return this.nodeValue || "";
  48140. }
  48141. return this.childNodes.map(function (child) {
  48142. return child.textContent;
  48143. }).join("");
  48144. }
  48145. get children() {
  48146. return this.childNodes || [];
  48147. }
  48148. hasChildNodes() {
  48149. return this.childNodes && this.childNodes.length > 0;
  48150. }
  48151. searchNode(paths, pos) {
  48152. if (pos >= paths.length) {
  48153. return this;
  48154. }
  48155. const component = paths[pos];
  48156. const stack = [];
  48157. let node = this;
  48158. while (true) {
  48159. if (component.name === node.nodeName) {
  48160. if (component.pos === 0) {
  48161. const res = node.searchNode(paths, pos + 1);
  48162. if (res !== null) {
  48163. return res;
  48164. }
  48165. } else if (stack.length === 0) {
  48166. return null;
  48167. } else {
  48168. const [parent] = stack.pop();
  48169. let siblingPos = 0;
  48170. for (const child of parent.childNodes) {
  48171. if (component.name === child.nodeName) {
  48172. if (siblingPos === component.pos) {
  48173. return child.searchNode(paths, pos + 1);
  48174. }
  48175. siblingPos++;
  48176. }
  48177. }
  48178. return node.searchNode(paths, pos + 1);
  48179. }
  48180. }
  48181. if (node.childNodes && node.childNodes.length !== 0) {
  48182. stack.push([node, 0]);
  48183. node = node.childNodes[0];
  48184. } else if (stack.length === 0) {
  48185. return null;
  48186. } else {
  48187. while (stack.length !== 0) {
  48188. const [parent, currentPos] = stack.pop();
  48189. const newPos = currentPos + 1;
  48190. if (newPos < parent.childNodes.length) {
  48191. stack.push([parent, newPos]);
  48192. node = parent.childNodes[newPos];
  48193. break;
  48194. }
  48195. }
  48196. if (stack.length === 0) {
  48197. return null;
  48198. }
  48199. }
  48200. }
  48201. }
  48202. dump(buffer) {
  48203. if (this.nodeName === "#text") {
  48204. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  48205. return;
  48206. }
  48207. buffer.push(`<${this.nodeName}`);
  48208. if (this.attributes) {
  48209. for (const attribute of this.attributes) {
  48210. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  48211. }
  48212. }
  48213. if (this.hasChildNodes()) {
  48214. buffer.push(">");
  48215. for (const child of this.childNodes) {
  48216. child.dump(buffer);
  48217. }
  48218. buffer.push(`</${this.nodeName}>`);
  48219. } else if (this.nodeValue) {
  48220. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  48221. } else {
  48222. buffer.push("/>");
  48223. }
  48224. }
  48225. }
  48226. exports.SimpleDOMNode = SimpleDOMNode;
  48227. class SimpleXMLParser extends XMLParserBase {
  48228. constructor({
  48229. hasAttributes = false,
  48230. lowerCaseName = false
  48231. }) {
  48232. super();
  48233. this._currentFragment = null;
  48234. this._stack = null;
  48235. this._errorCode = XMLParserErrorCode.NoError;
  48236. this._hasAttributes = hasAttributes;
  48237. this._lowerCaseName = lowerCaseName;
  48238. }
  48239. parseFromString(data) {
  48240. this._currentFragment = [];
  48241. this._stack = [];
  48242. this._errorCode = XMLParserErrorCode.NoError;
  48243. this.parseXml(data);
  48244. if (this._errorCode !== XMLParserErrorCode.NoError) {
  48245. return undefined;
  48246. }
  48247. const [documentElement] = this._currentFragment;
  48248. if (!documentElement) {
  48249. return undefined;
  48250. }
  48251. return {
  48252. documentElement
  48253. };
  48254. }
  48255. onText(text) {
  48256. if (isWhitespaceString(text)) {
  48257. return;
  48258. }
  48259. const node = new SimpleDOMNode("#text", text);
  48260. this._currentFragment.push(node);
  48261. }
  48262. onCdata(text) {
  48263. const node = new SimpleDOMNode("#text", text);
  48264. this._currentFragment.push(node);
  48265. }
  48266. onBeginElement(name, attributes, isEmpty) {
  48267. if (this._lowerCaseName) {
  48268. name = name.toLowerCase();
  48269. }
  48270. const node = new SimpleDOMNode(name);
  48271. node.childNodes = [];
  48272. if (this._hasAttributes) {
  48273. node.attributes = attributes;
  48274. }
  48275. this._currentFragment.push(node);
  48276. if (isEmpty) {
  48277. return;
  48278. }
  48279. this._stack.push(this._currentFragment);
  48280. this._currentFragment = node.childNodes;
  48281. }
  48282. onEndElement(name) {
  48283. this._currentFragment = this._stack.pop() || [];
  48284. const lastElement = this._currentFragment.at(-1);
  48285. if (!lastElement) {
  48286. return null;
  48287. }
  48288. for (const childNode of lastElement.childNodes) {
  48289. childNode.parentNode = lastElement;
  48290. }
  48291. return lastElement;
  48292. }
  48293. onError(code) {
  48294. this._errorCode = code;
  48295. }
  48296. }
  48297. exports.SimpleXMLParser = SimpleXMLParser;
  48298. /***/ }),
  48299. /* 65 */
  48300. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48301. Object.defineProperty(exports, "__esModule", ({
  48302. value: true
  48303. }));
  48304. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48305. exports.calculateSHA384 = calculateSHA384;
  48306. exports.calculateSHA512 = void 0;
  48307. var _util = __w_pdfjs_require__(2);
  48308. var _primitives = __w_pdfjs_require__(3);
  48309. var _decrypt_stream = __w_pdfjs_require__(66);
  48310. class ARCFourCipher {
  48311. constructor(key) {
  48312. this.a = 0;
  48313. this.b = 0;
  48314. const s = new Uint8Array(256);
  48315. const keyLength = key.length;
  48316. for (let i = 0; i < 256; ++i) {
  48317. s[i] = i;
  48318. }
  48319. for (let i = 0, j = 0; i < 256; ++i) {
  48320. const tmp = s[i];
  48321. j = j + tmp + key[i % keyLength] & 0xff;
  48322. s[i] = s[j];
  48323. s[j] = tmp;
  48324. }
  48325. this.s = s;
  48326. }
  48327. encryptBlock(data) {
  48328. let a = this.a,
  48329. b = this.b;
  48330. const s = this.s;
  48331. const n = data.length;
  48332. const output = new Uint8Array(n);
  48333. for (let i = 0; i < n; ++i) {
  48334. a = a + 1 & 0xff;
  48335. const tmp = s[a];
  48336. b = b + tmp & 0xff;
  48337. const tmp2 = s[b];
  48338. s[a] = tmp2;
  48339. s[b] = tmp;
  48340. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48341. }
  48342. this.a = a;
  48343. this.b = b;
  48344. return output;
  48345. }
  48346. decryptBlock(data) {
  48347. return this.encryptBlock(data);
  48348. }
  48349. encrypt(data) {
  48350. return this.encryptBlock(data);
  48351. }
  48352. }
  48353. exports.ARCFourCipher = ARCFourCipher;
  48354. const calculateMD5 = function calculateMD5Closure() {
  48355. 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]);
  48356. 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]);
  48357. function hash(data, offset, length) {
  48358. let h0 = 1732584193,
  48359. h1 = -271733879,
  48360. h2 = -1732584194,
  48361. h3 = 271733878;
  48362. const paddedLength = length + 72 & ~63;
  48363. const padded = new Uint8Array(paddedLength);
  48364. let i, j;
  48365. for (i = 0; i < length; ++i) {
  48366. padded[i] = data[offset++];
  48367. }
  48368. padded[i++] = 0x80;
  48369. const n = paddedLength - 8;
  48370. while (i < n) {
  48371. padded[i++] = 0;
  48372. }
  48373. padded[i++] = length << 3 & 0xff;
  48374. padded[i++] = length >> 5 & 0xff;
  48375. padded[i++] = length >> 13 & 0xff;
  48376. padded[i++] = length >> 21 & 0xff;
  48377. padded[i++] = length >>> 29 & 0xff;
  48378. padded[i++] = 0;
  48379. padded[i++] = 0;
  48380. padded[i++] = 0;
  48381. const w = new Int32Array(16);
  48382. for (i = 0; i < paddedLength;) {
  48383. for (j = 0; j < 16; ++j, i += 4) {
  48384. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48385. }
  48386. let a = h0,
  48387. b = h1,
  48388. c = h2,
  48389. d = h3,
  48390. f,
  48391. g;
  48392. for (j = 0; j < 64; ++j) {
  48393. if (j < 16) {
  48394. f = b & c | ~b & d;
  48395. g = j;
  48396. } else if (j < 32) {
  48397. f = d & b | ~d & c;
  48398. g = 5 * j + 1 & 15;
  48399. } else if (j < 48) {
  48400. f = b ^ c ^ d;
  48401. g = 3 * j + 5 & 15;
  48402. } else {
  48403. f = c ^ (b | ~d);
  48404. g = 7 * j & 15;
  48405. }
  48406. const tmp = d,
  48407. rotateArg = a + f + k[j] + w[g] | 0,
  48408. rotate = r[j];
  48409. d = c;
  48410. c = b;
  48411. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48412. a = tmp;
  48413. }
  48414. h0 = h0 + a | 0;
  48415. h1 = h1 + b | 0;
  48416. h2 = h2 + c | 0;
  48417. h3 = h3 + d | 0;
  48418. }
  48419. 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]);
  48420. }
  48421. return hash;
  48422. }();
  48423. exports.calculateMD5 = calculateMD5;
  48424. class Word64 {
  48425. constructor(highInteger, lowInteger) {
  48426. this.high = highInteger | 0;
  48427. this.low = lowInteger | 0;
  48428. }
  48429. and(word) {
  48430. this.high &= word.high;
  48431. this.low &= word.low;
  48432. }
  48433. xor(word) {
  48434. this.high ^= word.high;
  48435. this.low ^= word.low;
  48436. }
  48437. or(word) {
  48438. this.high |= word.high;
  48439. this.low |= word.low;
  48440. }
  48441. shiftRight(places) {
  48442. if (places >= 32) {
  48443. this.low = this.high >>> places - 32 | 0;
  48444. this.high = 0;
  48445. } else {
  48446. this.low = this.low >>> places | this.high << 32 - places;
  48447. this.high = this.high >>> places | 0;
  48448. }
  48449. }
  48450. shiftLeft(places) {
  48451. if (places >= 32) {
  48452. this.high = this.low << places - 32;
  48453. this.low = 0;
  48454. } else {
  48455. this.high = this.high << places | this.low >>> 32 - places;
  48456. this.low <<= places;
  48457. }
  48458. }
  48459. rotateRight(places) {
  48460. let low, high;
  48461. if (places & 32) {
  48462. high = this.low;
  48463. low = this.high;
  48464. } else {
  48465. low = this.low;
  48466. high = this.high;
  48467. }
  48468. places &= 31;
  48469. this.low = low >>> places | high << 32 - places;
  48470. this.high = high >>> places | low << 32 - places;
  48471. }
  48472. not() {
  48473. this.high = ~this.high;
  48474. this.low = ~this.low;
  48475. }
  48476. add(word) {
  48477. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48478. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48479. if (lowAdd > 0xffffffff) {
  48480. highAdd += 1;
  48481. }
  48482. this.low = lowAdd | 0;
  48483. this.high = highAdd | 0;
  48484. }
  48485. copyTo(bytes, offset) {
  48486. bytes[offset] = this.high >>> 24 & 0xff;
  48487. bytes[offset + 1] = this.high >> 16 & 0xff;
  48488. bytes[offset + 2] = this.high >> 8 & 0xff;
  48489. bytes[offset + 3] = this.high & 0xff;
  48490. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48491. bytes[offset + 5] = this.low >> 16 & 0xff;
  48492. bytes[offset + 6] = this.low >> 8 & 0xff;
  48493. bytes[offset + 7] = this.low & 0xff;
  48494. }
  48495. assign(word) {
  48496. this.high = word.high;
  48497. this.low = word.low;
  48498. }
  48499. }
  48500. const calculateSHA256 = function calculateSHA256Closure() {
  48501. function rotr(x, n) {
  48502. return x >>> n | x << 32 - n;
  48503. }
  48504. function ch(x, y, z) {
  48505. return x & y ^ ~x & z;
  48506. }
  48507. function maj(x, y, z) {
  48508. return x & y ^ x & z ^ y & z;
  48509. }
  48510. function sigma(x) {
  48511. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48512. }
  48513. function sigmaPrime(x) {
  48514. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48515. }
  48516. function littleSigma(x) {
  48517. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48518. }
  48519. function littleSigmaPrime(x) {
  48520. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48521. }
  48522. 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];
  48523. function hash(data, offset, length) {
  48524. let h0 = 0x6a09e667,
  48525. h1 = 0xbb67ae85,
  48526. h2 = 0x3c6ef372,
  48527. h3 = 0xa54ff53a,
  48528. h4 = 0x510e527f,
  48529. h5 = 0x9b05688c,
  48530. h6 = 0x1f83d9ab,
  48531. h7 = 0x5be0cd19;
  48532. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48533. const padded = new Uint8Array(paddedLength);
  48534. let i, j;
  48535. for (i = 0; i < length; ++i) {
  48536. padded[i] = data[offset++];
  48537. }
  48538. padded[i++] = 0x80;
  48539. const n = paddedLength - 8;
  48540. while (i < n) {
  48541. padded[i++] = 0;
  48542. }
  48543. padded[i++] = 0;
  48544. padded[i++] = 0;
  48545. padded[i++] = 0;
  48546. padded[i++] = length >>> 29 & 0xff;
  48547. padded[i++] = length >> 21 & 0xff;
  48548. padded[i++] = length >> 13 & 0xff;
  48549. padded[i++] = length >> 5 & 0xff;
  48550. padded[i++] = length << 3 & 0xff;
  48551. const w = new Uint32Array(64);
  48552. for (i = 0; i < paddedLength;) {
  48553. for (j = 0; j < 16; ++j) {
  48554. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48555. i += 4;
  48556. }
  48557. for (j = 16; j < 64; ++j) {
  48558. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48559. }
  48560. let a = h0,
  48561. b = h1,
  48562. c = h2,
  48563. d = h3,
  48564. e = h4,
  48565. f = h5,
  48566. g = h6,
  48567. h = h7,
  48568. t1,
  48569. t2;
  48570. for (j = 0; j < 64; ++j) {
  48571. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48572. t2 = sigma(a) + maj(a, b, c);
  48573. h = g;
  48574. g = f;
  48575. f = e;
  48576. e = d + t1 | 0;
  48577. d = c;
  48578. c = b;
  48579. b = a;
  48580. a = t1 + t2 | 0;
  48581. }
  48582. h0 = h0 + a | 0;
  48583. h1 = h1 + b | 0;
  48584. h2 = h2 + c | 0;
  48585. h3 = h3 + d | 0;
  48586. h4 = h4 + e | 0;
  48587. h5 = h5 + f | 0;
  48588. h6 = h6 + g | 0;
  48589. h7 = h7 + h | 0;
  48590. }
  48591. 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]);
  48592. }
  48593. return hash;
  48594. }();
  48595. exports.calculateSHA256 = calculateSHA256;
  48596. const calculateSHA512 = function calculateSHA512Closure() {
  48597. function ch(result, x, y, z, tmp) {
  48598. result.assign(x);
  48599. result.and(y);
  48600. tmp.assign(x);
  48601. tmp.not();
  48602. tmp.and(z);
  48603. result.xor(tmp);
  48604. }
  48605. function maj(result, x, y, z, tmp) {
  48606. result.assign(x);
  48607. result.and(y);
  48608. tmp.assign(x);
  48609. tmp.and(z);
  48610. result.xor(tmp);
  48611. tmp.assign(y);
  48612. tmp.and(z);
  48613. result.xor(tmp);
  48614. }
  48615. function sigma(result, x, tmp) {
  48616. result.assign(x);
  48617. result.rotateRight(28);
  48618. tmp.assign(x);
  48619. tmp.rotateRight(34);
  48620. result.xor(tmp);
  48621. tmp.assign(x);
  48622. tmp.rotateRight(39);
  48623. result.xor(tmp);
  48624. }
  48625. function sigmaPrime(result, x, tmp) {
  48626. result.assign(x);
  48627. result.rotateRight(14);
  48628. tmp.assign(x);
  48629. tmp.rotateRight(18);
  48630. result.xor(tmp);
  48631. tmp.assign(x);
  48632. tmp.rotateRight(41);
  48633. result.xor(tmp);
  48634. }
  48635. function littleSigma(result, x, tmp) {
  48636. result.assign(x);
  48637. result.rotateRight(1);
  48638. tmp.assign(x);
  48639. tmp.rotateRight(8);
  48640. result.xor(tmp);
  48641. tmp.assign(x);
  48642. tmp.shiftRight(7);
  48643. result.xor(tmp);
  48644. }
  48645. function littleSigmaPrime(result, x, tmp) {
  48646. result.assign(x);
  48647. result.rotateRight(19);
  48648. tmp.assign(x);
  48649. tmp.rotateRight(61);
  48650. result.xor(tmp);
  48651. tmp.assign(x);
  48652. tmp.shiftRight(6);
  48653. result.xor(tmp);
  48654. }
  48655. 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)];
  48656. function hash(data, offset, length, mode384 = false) {
  48657. let h0, h1, h2, h3, h4, h5, h6, h7;
  48658. if (!mode384) {
  48659. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48660. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48661. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48662. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48663. h4 = new Word64(0x510e527f, 0xade682d1);
  48664. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48665. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48666. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48667. } else {
  48668. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48669. h1 = new Word64(0x629a292a, 0x367cd507);
  48670. h2 = new Word64(0x9159015a, 0x3070dd17);
  48671. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48672. h4 = new Word64(0x67332667, 0xffc00b31);
  48673. h5 = new Word64(0x8eb44a87, 0x68581511);
  48674. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48675. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48676. }
  48677. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48678. const padded = new Uint8Array(paddedLength);
  48679. let i, j;
  48680. for (i = 0; i < length; ++i) {
  48681. padded[i] = data[offset++];
  48682. }
  48683. padded[i++] = 0x80;
  48684. const n = paddedLength - 16;
  48685. while (i < n) {
  48686. padded[i++] = 0;
  48687. }
  48688. padded[i++] = 0;
  48689. padded[i++] = 0;
  48690. padded[i++] = 0;
  48691. padded[i++] = 0;
  48692. padded[i++] = 0;
  48693. padded[i++] = 0;
  48694. padded[i++] = 0;
  48695. padded[i++] = 0;
  48696. padded[i++] = 0;
  48697. padded[i++] = 0;
  48698. padded[i++] = 0;
  48699. padded[i++] = length >>> 29 & 0xff;
  48700. padded[i++] = length >> 21 & 0xff;
  48701. padded[i++] = length >> 13 & 0xff;
  48702. padded[i++] = length >> 5 & 0xff;
  48703. padded[i++] = length << 3 & 0xff;
  48704. const w = new Array(80);
  48705. for (i = 0; i < 80; i++) {
  48706. w[i] = new Word64(0, 0);
  48707. }
  48708. let a = new Word64(0, 0),
  48709. b = new Word64(0, 0),
  48710. c = new Word64(0, 0);
  48711. let d = new Word64(0, 0),
  48712. e = new Word64(0, 0),
  48713. f = new Word64(0, 0);
  48714. let g = new Word64(0, 0),
  48715. h = new Word64(0, 0);
  48716. const t1 = new Word64(0, 0),
  48717. t2 = new Word64(0, 0);
  48718. const tmp1 = new Word64(0, 0),
  48719. tmp2 = new Word64(0, 0);
  48720. let tmp3;
  48721. for (i = 0; i < paddedLength;) {
  48722. for (j = 0; j < 16; ++j) {
  48723. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48724. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48725. i += 8;
  48726. }
  48727. for (j = 16; j < 80; ++j) {
  48728. tmp3 = w[j];
  48729. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48730. tmp3.add(w[j - 7]);
  48731. littleSigma(tmp1, w[j - 15], tmp2);
  48732. tmp3.add(tmp1);
  48733. tmp3.add(w[j - 16]);
  48734. }
  48735. a.assign(h0);
  48736. b.assign(h1);
  48737. c.assign(h2);
  48738. d.assign(h3);
  48739. e.assign(h4);
  48740. f.assign(h5);
  48741. g.assign(h6);
  48742. h.assign(h7);
  48743. for (j = 0; j < 80; ++j) {
  48744. t1.assign(h);
  48745. sigmaPrime(tmp1, e, tmp2);
  48746. t1.add(tmp1);
  48747. ch(tmp1, e, f, g, tmp2);
  48748. t1.add(tmp1);
  48749. t1.add(k[j]);
  48750. t1.add(w[j]);
  48751. sigma(t2, a, tmp2);
  48752. maj(tmp1, a, b, c, tmp2);
  48753. t2.add(tmp1);
  48754. tmp3 = h;
  48755. h = g;
  48756. g = f;
  48757. f = e;
  48758. d.add(t1);
  48759. e = d;
  48760. d = c;
  48761. c = b;
  48762. b = a;
  48763. tmp3.assign(t1);
  48764. tmp3.add(t2);
  48765. a = tmp3;
  48766. }
  48767. h0.add(a);
  48768. h1.add(b);
  48769. h2.add(c);
  48770. h3.add(d);
  48771. h4.add(e);
  48772. h5.add(f);
  48773. h6.add(g);
  48774. h7.add(h);
  48775. }
  48776. let result;
  48777. if (!mode384) {
  48778. result = new Uint8Array(64);
  48779. h0.copyTo(result, 0);
  48780. h1.copyTo(result, 8);
  48781. h2.copyTo(result, 16);
  48782. h3.copyTo(result, 24);
  48783. h4.copyTo(result, 32);
  48784. h5.copyTo(result, 40);
  48785. h6.copyTo(result, 48);
  48786. h7.copyTo(result, 56);
  48787. } else {
  48788. result = new Uint8Array(48);
  48789. h0.copyTo(result, 0);
  48790. h1.copyTo(result, 8);
  48791. h2.copyTo(result, 16);
  48792. h3.copyTo(result, 24);
  48793. h4.copyTo(result, 32);
  48794. h5.copyTo(result, 40);
  48795. }
  48796. return result;
  48797. }
  48798. return hash;
  48799. }();
  48800. exports.calculateSHA512 = calculateSHA512;
  48801. function calculateSHA384(data, offset, length) {
  48802. return calculateSHA512(data, offset, length, true);
  48803. }
  48804. class NullCipher {
  48805. decryptBlock(data) {
  48806. return data;
  48807. }
  48808. encrypt(data) {
  48809. return data;
  48810. }
  48811. }
  48812. class AESBaseCipher {
  48813. constructor() {
  48814. if (this.constructor === AESBaseCipher) {
  48815. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48816. }
  48817. 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]);
  48818. 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]);
  48819. 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]);
  48820. this._mixCol = new Uint8Array(256);
  48821. for (let i = 0; i < 256; i++) {
  48822. if (i < 128) {
  48823. this._mixCol[i] = i << 1;
  48824. } else {
  48825. this._mixCol[i] = i << 1 ^ 0x1b;
  48826. }
  48827. }
  48828. this.buffer = new Uint8Array(16);
  48829. this.bufferPosition = 0;
  48830. }
  48831. _expandKey(cipherKey) {
  48832. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48833. }
  48834. _decrypt(input, key) {
  48835. let t, u, v;
  48836. const state = new Uint8Array(16);
  48837. state.set(input);
  48838. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48839. state[j] ^= key[k];
  48840. }
  48841. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48842. t = state[13];
  48843. state[13] = state[9];
  48844. state[9] = state[5];
  48845. state[5] = state[1];
  48846. state[1] = t;
  48847. t = state[14];
  48848. u = state[10];
  48849. state[14] = state[6];
  48850. state[10] = state[2];
  48851. state[6] = t;
  48852. state[2] = u;
  48853. t = state[15];
  48854. u = state[11];
  48855. v = state[7];
  48856. state[15] = state[3];
  48857. state[11] = t;
  48858. state[7] = u;
  48859. state[3] = v;
  48860. for (let j = 0; j < 16; ++j) {
  48861. state[j] = this._inv_s[state[j]];
  48862. }
  48863. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48864. state[j] ^= key[k];
  48865. }
  48866. for (let j = 0; j < 16; j += 4) {
  48867. const s0 = this._mix[state[j]];
  48868. const s1 = this._mix[state[j + 1]];
  48869. const s2 = this._mix[state[j + 2]];
  48870. const s3 = this._mix[state[j + 3]];
  48871. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48872. state[j] = t >>> 24 & 0xff;
  48873. state[j + 1] = t >> 16 & 0xff;
  48874. state[j + 2] = t >> 8 & 0xff;
  48875. state[j + 3] = t & 0xff;
  48876. }
  48877. }
  48878. t = state[13];
  48879. state[13] = state[9];
  48880. state[9] = state[5];
  48881. state[5] = state[1];
  48882. state[1] = t;
  48883. t = state[14];
  48884. u = state[10];
  48885. state[14] = state[6];
  48886. state[10] = state[2];
  48887. state[6] = t;
  48888. state[2] = u;
  48889. t = state[15];
  48890. u = state[11];
  48891. v = state[7];
  48892. state[15] = state[3];
  48893. state[11] = t;
  48894. state[7] = u;
  48895. state[3] = v;
  48896. for (let j = 0; j < 16; ++j) {
  48897. state[j] = this._inv_s[state[j]];
  48898. state[j] ^= key[j];
  48899. }
  48900. return state;
  48901. }
  48902. _encrypt(input, key) {
  48903. const s = this._s;
  48904. let t, u, v;
  48905. const state = new Uint8Array(16);
  48906. state.set(input);
  48907. for (let j = 0; j < 16; ++j) {
  48908. state[j] ^= key[j];
  48909. }
  48910. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48911. for (let j = 0; j < 16; ++j) {
  48912. state[j] = s[state[j]];
  48913. }
  48914. v = state[1];
  48915. state[1] = state[5];
  48916. state[5] = state[9];
  48917. state[9] = state[13];
  48918. state[13] = v;
  48919. v = state[2];
  48920. u = state[6];
  48921. state[2] = state[10];
  48922. state[6] = state[14];
  48923. state[10] = v;
  48924. state[14] = u;
  48925. v = state[3];
  48926. u = state[7];
  48927. t = state[11];
  48928. state[3] = state[15];
  48929. state[7] = v;
  48930. state[11] = u;
  48931. state[15] = t;
  48932. for (let j = 0; j < 16; j += 4) {
  48933. const s0 = state[j + 0];
  48934. const s1 = state[j + 1];
  48935. const s2 = state[j + 2];
  48936. const s3 = state[j + 3];
  48937. t = s0 ^ s1 ^ s2 ^ s3;
  48938. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48939. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48940. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48941. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48942. }
  48943. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48944. state[j] ^= key[k];
  48945. }
  48946. }
  48947. for (let j = 0; j < 16; ++j) {
  48948. state[j] = s[state[j]];
  48949. }
  48950. v = state[1];
  48951. state[1] = state[5];
  48952. state[5] = state[9];
  48953. state[9] = state[13];
  48954. state[13] = v;
  48955. v = state[2];
  48956. u = state[6];
  48957. state[2] = state[10];
  48958. state[6] = state[14];
  48959. state[10] = v;
  48960. state[14] = u;
  48961. v = state[3];
  48962. u = state[7];
  48963. t = state[11];
  48964. state[3] = state[15];
  48965. state[7] = v;
  48966. state[11] = u;
  48967. state[15] = t;
  48968. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48969. state[j] ^= key[k];
  48970. }
  48971. return state;
  48972. }
  48973. _decryptBlock2(data, finalize) {
  48974. const sourceLength = data.length;
  48975. let buffer = this.buffer,
  48976. bufferLength = this.bufferPosition;
  48977. const result = [];
  48978. let iv = this.iv;
  48979. for (let i = 0; i < sourceLength; ++i) {
  48980. buffer[bufferLength] = data[i];
  48981. ++bufferLength;
  48982. if (bufferLength < 16) {
  48983. continue;
  48984. }
  48985. const plain = this._decrypt(buffer, this._key);
  48986. for (let j = 0; j < 16; ++j) {
  48987. plain[j] ^= iv[j];
  48988. }
  48989. iv = buffer;
  48990. result.push(plain);
  48991. buffer = new Uint8Array(16);
  48992. bufferLength = 0;
  48993. }
  48994. this.buffer = buffer;
  48995. this.bufferLength = bufferLength;
  48996. this.iv = iv;
  48997. if (result.length === 0) {
  48998. return new Uint8Array(0);
  48999. }
  49000. let outputLength = 16 * result.length;
  49001. if (finalize) {
  49002. const lastBlock = result.at(-1);
  49003. let psLen = lastBlock[15];
  49004. if (psLen <= 16) {
  49005. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49006. if (lastBlock[i] !== psLen) {
  49007. psLen = 0;
  49008. break;
  49009. }
  49010. }
  49011. outputLength -= psLen;
  49012. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49013. }
  49014. }
  49015. const output = new Uint8Array(outputLength);
  49016. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49017. output.set(result[i], j);
  49018. }
  49019. return output;
  49020. }
  49021. decryptBlock(data, finalize, iv = null) {
  49022. const sourceLength = data.length;
  49023. const buffer = this.buffer;
  49024. let bufferLength = this.bufferPosition;
  49025. if (iv) {
  49026. this.iv = iv;
  49027. } else {
  49028. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49029. buffer[bufferLength] = data[i];
  49030. }
  49031. if (bufferLength < 16) {
  49032. this.bufferLength = bufferLength;
  49033. return new Uint8Array(0);
  49034. }
  49035. this.iv = buffer;
  49036. data = data.subarray(16);
  49037. }
  49038. this.buffer = new Uint8Array(16);
  49039. this.bufferLength = 0;
  49040. this.decryptBlock = this._decryptBlock2;
  49041. return this.decryptBlock(data, finalize);
  49042. }
  49043. encrypt(data, iv) {
  49044. const sourceLength = data.length;
  49045. let buffer = this.buffer,
  49046. bufferLength = this.bufferPosition;
  49047. const result = [];
  49048. if (!iv) {
  49049. iv = new Uint8Array(16);
  49050. }
  49051. for (let i = 0; i < sourceLength; ++i) {
  49052. buffer[bufferLength] = data[i];
  49053. ++bufferLength;
  49054. if (bufferLength < 16) {
  49055. continue;
  49056. }
  49057. for (let j = 0; j < 16; ++j) {
  49058. buffer[j] ^= iv[j];
  49059. }
  49060. const cipher = this._encrypt(buffer, this._key);
  49061. iv = cipher;
  49062. result.push(cipher);
  49063. buffer = new Uint8Array(16);
  49064. bufferLength = 0;
  49065. }
  49066. this.buffer = buffer;
  49067. this.bufferLength = bufferLength;
  49068. this.iv = iv;
  49069. if (result.length === 0) {
  49070. return new Uint8Array(0);
  49071. }
  49072. const outputLength = 16 * result.length;
  49073. const output = new Uint8Array(outputLength);
  49074. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49075. output.set(result[i], j);
  49076. }
  49077. return output;
  49078. }
  49079. }
  49080. class AES128Cipher extends AESBaseCipher {
  49081. constructor(key) {
  49082. super();
  49083. this._cyclesOfRepetition = 10;
  49084. this._keySize = 160;
  49085. 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]);
  49086. this._key = this._expandKey(key);
  49087. }
  49088. _expandKey(cipherKey) {
  49089. const b = 176;
  49090. const s = this._s;
  49091. const rcon = this._rcon;
  49092. const result = new Uint8Array(b);
  49093. result.set(cipherKey);
  49094. for (let j = 16, i = 1; j < b; ++i) {
  49095. let t1 = result[j - 3];
  49096. let t2 = result[j - 2];
  49097. let t3 = result[j - 1];
  49098. let t4 = result[j - 4];
  49099. t1 = s[t1];
  49100. t2 = s[t2];
  49101. t3 = s[t3];
  49102. t4 = s[t4];
  49103. t1 ^= rcon[i];
  49104. for (let n = 0; n < 4; ++n) {
  49105. result[j] = t1 ^= result[j - 16];
  49106. j++;
  49107. result[j] = t2 ^= result[j - 16];
  49108. j++;
  49109. result[j] = t3 ^= result[j - 16];
  49110. j++;
  49111. result[j] = t4 ^= result[j - 16];
  49112. j++;
  49113. }
  49114. }
  49115. return result;
  49116. }
  49117. }
  49118. exports.AES128Cipher = AES128Cipher;
  49119. class AES256Cipher extends AESBaseCipher {
  49120. constructor(key) {
  49121. super();
  49122. this._cyclesOfRepetition = 14;
  49123. this._keySize = 224;
  49124. this._key = this._expandKey(key);
  49125. }
  49126. _expandKey(cipherKey) {
  49127. const b = 240;
  49128. const s = this._s;
  49129. const result = new Uint8Array(b);
  49130. result.set(cipherKey);
  49131. let r = 1;
  49132. let t1, t2, t3, t4;
  49133. for (let j = 32, i = 1; j < b; ++i) {
  49134. if (j % 32 === 16) {
  49135. t1 = s[t1];
  49136. t2 = s[t2];
  49137. t3 = s[t3];
  49138. t4 = s[t4];
  49139. } else if (j % 32 === 0) {
  49140. t1 = result[j - 3];
  49141. t2 = result[j - 2];
  49142. t3 = result[j - 1];
  49143. t4 = result[j - 4];
  49144. t1 = s[t1];
  49145. t2 = s[t2];
  49146. t3 = s[t3];
  49147. t4 = s[t4];
  49148. t1 ^= r;
  49149. if ((r <<= 1) >= 256) {
  49150. r = (r ^ 0x1b) & 0xff;
  49151. }
  49152. }
  49153. for (let n = 0; n < 4; ++n) {
  49154. result[j] = t1 ^= result[j - 32];
  49155. j++;
  49156. result[j] = t2 ^= result[j - 32];
  49157. j++;
  49158. result[j] = t3 ^= result[j - 32];
  49159. j++;
  49160. result[j] = t4 ^= result[j - 32];
  49161. j++;
  49162. }
  49163. }
  49164. return result;
  49165. }
  49166. }
  49167. exports.AES256Cipher = AES256Cipher;
  49168. class PDF17 {
  49169. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49170. const hashData = new Uint8Array(password.length + 56);
  49171. hashData.set(password, 0);
  49172. hashData.set(ownerValidationSalt, password.length);
  49173. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49174. const result = calculateSHA256(hashData, 0, hashData.length);
  49175. return (0, _util.isArrayEqual)(result, ownerPassword);
  49176. }
  49177. checkUserPassword(password, userValidationSalt, userPassword) {
  49178. const hashData = new Uint8Array(password.length + 8);
  49179. hashData.set(password, 0);
  49180. hashData.set(userValidationSalt, password.length);
  49181. const result = calculateSHA256(hashData, 0, hashData.length);
  49182. return (0, _util.isArrayEqual)(result, userPassword);
  49183. }
  49184. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49185. const hashData = new Uint8Array(password.length + 56);
  49186. hashData.set(password, 0);
  49187. hashData.set(ownerKeySalt, password.length);
  49188. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49189. const key = calculateSHA256(hashData, 0, hashData.length);
  49190. const cipher = new AES256Cipher(key);
  49191. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49192. }
  49193. getUserKey(password, userKeySalt, userEncryption) {
  49194. const hashData = new Uint8Array(password.length + 8);
  49195. hashData.set(password, 0);
  49196. hashData.set(userKeySalt, password.length);
  49197. const key = calculateSHA256(hashData, 0, hashData.length);
  49198. const cipher = new AES256Cipher(key);
  49199. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49200. }
  49201. }
  49202. exports.PDF17 = PDF17;
  49203. const PDF20 = function PDF20Closure() {
  49204. function calculatePDF20Hash(password, input, userBytes) {
  49205. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49206. let e = [0];
  49207. let i = 0;
  49208. while (i < 64 || e.at(-1) > i - 32) {
  49209. const combinedLength = password.length + k.length + userBytes.length,
  49210. combinedArray = new Uint8Array(combinedLength);
  49211. let writeOffset = 0;
  49212. combinedArray.set(password, writeOffset);
  49213. writeOffset += password.length;
  49214. combinedArray.set(k, writeOffset);
  49215. writeOffset += k.length;
  49216. combinedArray.set(userBytes, writeOffset);
  49217. const k1 = new Uint8Array(combinedLength * 64);
  49218. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49219. k1.set(combinedArray, pos);
  49220. }
  49221. const cipher = new AES128Cipher(k.subarray(0, 16));
  49222. e = cipher.encrypt(k1, k.subarray(16, 32));
  49223. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  49224. if (remainder === 0) {
  49225. k = calculateSHA256(e, 0, e.length);
  49226. } else if (remainder === 1) {
  49227. k = calculateSHA384(e, 0, e.length);
  49228. } else if (remainder === 2) {
  49229. k = calculateSHA512(e, 0, e.length);
  49230. }
  49231. i++;
  49232. }
  49233. return k.subarray(0, 32);
  49234. }
  49235. class PDF20 {
  49236. hash(password, concatBytes, userBytes) {
  49237. return calculatePDF20Hash(password, concatBytes, userBytes);
  49238. }
  49239. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49240. const hashData = new Uint8Array(password.length + 56);
  49241. hashData.set(password, 0);
  49242. hashData.set(ownerValidationSalt, password.length);
  49243. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49244. const result = calculatePDF20Hash(password, hashData, userBytes);
  49245. return (0, _util.isArrayEqual)(result, ownerPassword);
  49246. }
  49247. checkUserPassword(password, userValidationSalt, userPassword) {
  49248. const hashData = new Uint8Array(password.length + 8);
  49249. hashData.set(password, 0);
  49250. hashData.set(userValidationSalt, password.length);
  49251. const result = calculatePDF20Hash(password, hashData, []);
  49252. return (0, _util.isArrayEqual)(result, userPassword);
  49253. }
  49254. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49255. const hashData = new Uint8Array(password.length + 56);
  49256. hashData.set(password, 0);
  49257. hashData.set(ownerKeySalt, password.length);
  49258. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49259. const key = calculatePDF20Hash(password, hashData, userBytes);
  49260. const cipher = new AES256Cipher(key);
  49261. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49262. }
  49263. getUserKey(password, userKeySalt, userEncryption) {
  49264. const hashData = new Uint8Array(password.length + 8);
  49265. hashData.set(password, 0);
  49266. hashData.set(userKeySalt, password.length);
  49267. const key = calculatePDF20Hash(password, hashData, []);
  49268. const cipher = new AES256Cipher(key);
  49269. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49270. }
  49271. }
  49272. return PDF20;
  49273. }();
  49274. exports.PDF20 = PDF20;
  49275. class CipherTransform {
  49276. constructor(stringCipherConstructor, streamCipherConstructor) {
  49277. this.StringCipherConstructor = stringCipherConstructor;
  49278. this.StreamCipherConstructor = streamCipherConstructor;
  49279. }
  49280. createStream(stream, length) {
  49281. const cipher = new this.StreamCipherConstructor();
  49282. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49283. return cipher.decryptBlock(data, finalize);
  49284. });
  49285. }
  49286. decryptString(s) {
  49287. const cipher = new this.StringCipherConstructor();
  49288. let data = (0, _util.stringToBytes)(s);
  49289. data = cipher.decryptBlock(data, true);
  49290. return (0, _util.bytesToString)(data);
  49291. }
  49292. encryptString(s) {
  49293. const cipher = new this.StringCipherConstructor();
  49294. if (cipher instanceof AESBaseCipher) {
  49295. const strLen = s.length;
  49296. const pad = 16 - strLen % 16;
  49297. s += String.fromCharCode(pad).repeat(pad);
  49298. const iv = new Uint8Array(16);
  49299. if (typeof crypto !== "undefined") {
  49300. crypto.getRandomValues(iv);
  49301. } else {
  49302. for (let i = 0; i < 16; i++) {
  49303. iv[i] = Math.floor(256 * Math.random());
  49304. }
  49305. }
  49306. let data = (0, _util.stringToBytes)(s);
  49307. data = cipher.encrypt(data, iv);
  49308. const buf = new Uint8Array(16 + data.length);
  49309. buf.set(iv);
  49310. buf.set(data, 16);
  49311. return (0, _util.bytesToString)(buf);
  49312. }
  49313. let data = (0, _util.stringToBytes)(s);
  49314. data = cipher.encrypt(data);
  49315. return (0, _util.bytesToString)(data);
  49316. }
  49317. }
  49318. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49319. 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]);
  49320. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49321. if (password) {
  49322. const passwordLength = Math.min(127, password.length);
  49323. password = password.subarray(0, passwordLength);
  49324. } else {
  49325. password = [];
  49326. }
  49327. let pdfAlgorithm;
  49328. if (revision === 6) {
  49329. pdfAlgorithm = new PDF20();
  49330. } else {
  49331. pdfAlgorithm = new PDF17();
  49332. }
  49333. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49334. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49335. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49336. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49337. }
  49338. return null;
  49339. }
  49340. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49341. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49342. const hashData = new Uint8Array(hashDataSize);
  49343. let i = 0,
  49344. j,
  49345. n;
  49346. if (password) {
  49347. n = Math.min(32, password.length);
  49348. for (; i < n; ++i) {
  49349. hashData[i] = password[i];
  49350. }
  49351. }
  49352. j = 0;
  49353. while (i < 32) {
  49354. hashData[i++] = defaultPasswordBytes[j++];
  49355. }
  49356. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49357. hashData[i++] = ownerPassword[j];
  49358. }
  49359. hashData[i++] = flags & 0xff;
  49360. hashData[i++] = flags >> 8 & 0xff;
  49361. hashData[i++] = flags >> 16 & 0xff;
  49362. hashData[i++] = flags >>> 24 & 0xff;
  49363. for (j = 0, n = fileId.length; j < n; ++j) {
  49364. hashData[i++] = fileId[j];
  49365. }
  49366. if (revision >= 4 && !encryptMetadata) {
  49367. hashData[i++] = 0xff;
  49368. hashData[i++] = 0xff;
  49369. hashData[i++] = 0xff;
  49370. hashData[i++] = 0xff;
  49371. }
  49372. let hash = calculateMD5(hashData, 0, i);
  49373. const keyLengthInBytes = keyLength >> 3;
  49374. if (revision >= 3) {
  49375. for (j = 0; j < 50; ++j) {
  49376. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49377. }
  49378. }
  49379. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49380. let cipher, checkData;
  49381. if (revision >= 3) {
  49382. for (i = 0; i < 32; ++i) {
  49383. hashData[i] = defaultPasswordBytes[i];
  49384. }
  49385. for (j = 0, n = fileId.length; j < n; ++j) {
  49386. hashData[i++] = fileId[j];
  49387. }
  49388. cipher = new ARCFourCipher(encryptionKey);
  49389. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49390. n = encryptionKey.length;
  49391. const derivedKey = new Uint8Array(n);
  49392. for (j = 1; j <= 19; ++j) {
  49393. for (let k = 0; k < n; ++k) {
  49394. derivedKey[k] = encryptionKey[k] ^ j;
  49395. }
  49396. cipher = new ARCFourCipher(derivedKey);
  49397. checkData = cipher.encryptBlock(checkData);
  49398. }
  49399. for (j = 0, n = checkData.length; j < n; ++j) {
  49400. if (userPassword[j] !== checkData[j]) {
  49401. return null;
  49402. }
  49403. }
  49404. } else {
  49405. cipher = new ARCFourCipher(encryptionKey);
  49406. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49407. for (j = 0, n = checkData.length; j < n; ++j) {
  49408. if (userPassword[j] !== checkData[j]) {
  49409. return null;
  49410. }
  49411. }
  49412. }
  49413. return encryptionKey;
  49414. }
  49415. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49416. const hashData = new Uint8Array(32);
  49417. let i = 0;
  49418. const n = Math.min(32, password.length);
  49419. for (; i < n; ++i) {
  49420. hashData[i] = password[i];
  49421. }
  49422. let j = 0;
  49423. while (i < 32) {
  49424. hashData[i++] = defaultPasswordBytes[j++];
  49425. }
  49426. let hash = calculateMD5(hashData, 0, i);
  49427. const keyLengthInBytes = keyLength >> 3;
  49428. if (revision >= 3) {
  49429. for (j = 0; j < 50; ++j) {
  49430. hash = calculateMD5(hash, 0, hash.length);
  49431. }
  49432. }
  49433. let cipher, userPassword;
  49434. if (revision >= 3) {
  49435. userPassword = ownerPassword;
  49436. const derivedKey = new Uint8Array(keyLengthInBytes);
  49437. for (j = 19; j >= 0; j--) {
  49438. for (let k = 0; k < keyLengthInBytes; ++k) {
  49439. derivedKey[k] = hash[k] ^ j;
  49440. }
  49441. cipher = new ARCFourCipher(derivedKey);
  49442. userPassword = cipher.encryptBlock(userPassword);
  49443. }
  49444. } else {
  49445. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49446. userPassword = cipher.encryptBlock(ownerPassword);
  49447. }
  49448. return userPassword;
  49449. }
  49450. const identityName = _primitives.Name.get("Identity");
  49451. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49452. const key = new Uint8Array(encryptionKey.length + 9);
  49453. const n = encryptionKey.length;
  49454. let i;
  49455. for (i = 0; i < n; ++i) {
  49456. key[i] = encryptionKey[i];
  49457. }
  49458. key[i++] = num & 0xff;
  49459. key[i++] = num >> 8 & 0xff;
  49460. key[i++] = num >> 16 & 0xff;
  49461. key[i++] = gen & 0xff;
  49462. key[i++] = gen >> 8 & 0xff;
  49463. if (isAes) {
  49464. key[i++] = 0x73;
  49465. key[i++] = 0x41;
  49466. key[i++] = 0x6c;
  49467. key[i++] = 0x54;
  49468. }
  49469. const hash = calculateMD5(key, 0, i);
  49470. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49471. }
  49472. function buildCipherConstructor(cf, name, num, gen, key) {
  49473. if (!(name instanceof _primitives.Name)) {
  49474. throw new _util.FormatError("Invalid crypt filter name.");
  49475. }
  49476. const cryptFilter = cf.get(name.name);
  49477. let cfm;
  49478. if (cryptFilter !== null && cryptFilter !== undefined) {
  49479. cfm = cryptFilter.get("CFM");
  49480. }
  49481. if (!cfm || cfm.name === "None") {
  49482. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49483. return new NullCipher();
  49484. };
  49485. }
  49486. if (cfm.name === "V2") {
  49487. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49488. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49489. };
  49490. }
  49491. if (cfm.name === "AESV2") {
  49492. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49493. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49494. };
  49495. }
  49496. if (cfm.name === "AESV3") {
  49497. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49498. return new AES256Cipher(key);
  49499. };
  49500. }
  49501. throw new _util.FormatError("Unknown crypto method");
  49502. }
  49503. class CipherTransformFactory {
  49504. constructor(dict, fileId, password) {
  49505. const filter = dict.get("Filter");
  49506. if (!(0, _primitives.isName)(filter, "Standard")) {
  49507. throw new _util.FormatError("unknown encryption method");
  49508. }
  49509. this.filterName = filter.name;
  49510. this.dict = dict;
  49511. const algorithm = dict.get("V");
  49512. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49513. throw new _util.FormatError("unsupported encryption algorithm");
  49514. }
  49515. this.algorithm = algorithm;
  49516. let keyLength = dict.get("Length");
  49517. if (!keyLength) {
  49518. if (algorithm <= 3) {
  49519. keyLength = 40;
  49520. } else {
  49521. const cfDict = dict.get("CF");
  49522. const streamCryptoName = dict.get("StmF");
  49523. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49524. cfDict.suppressEncryption = true;
  49525. const handlerDict = cfDict.get(streamCryptoName.name);
  49526. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49527. if (keyLength < 40) {
  49528. keyLength <<= 3;
  49529. }
  49530. }
  49531. }
  49532. }
  49533. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49534. throw new _util.FormatError("invalid key length");
  49535. }
  49536. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49537. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49538. const flags = dict.get("P");
  49539. const revision = dict.get("R");
  49540. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49541. this.encryptMetadata = encryptMetadata;
  49542. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49543. let passwordBytes;
  49544. if (password) {
  49545. if (revision === 6) {
  49546. try {
  49547. password = (0, _util.utf8StringToString)(password);
  49548. } catch (ex) {
  49549. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49550. }
  49551. }
  49552. passwordBytes = (0, _util.stringToBytes)(password);
  49553. }
  49554. let encryptionKey;
  49555. if (algorithm !== 5) {
  49556. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49557. } else {
  49558. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49559. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49560. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49561. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49562. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49563. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49564. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49565. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49566. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49567. }
  49568. if (!encryptionKey && !password) {
  49569. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49570. } else if (!encryptionKey && password) {
  49571. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49572. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49573. }
  49574. if (!encryptionKey) {
  49575. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49576. }
  49577. this.encryptionKey = encryptionKey;
  49578. if (algorithm >= 4) {
  49579. const cf = dict.get("CF");
  49580. if (cf instanceof _primitives.Dict) {
  49581. cf.suppressEncryption = true;
  49582. }
  49583. this.cf = cf;
  49584. this.stmf = dict.get("StmF") || identityName;
  49585. this.strf = dict.get("StrF") || identityName;
  49586. this.eff = dict.get("EFF") || this.stmf;
  49587. }
  49588. }
  49589. createCipherTransform(num, gen) {
  49590. if (this.algorithm === 4 || this.algorithm === 5) {
  49591. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49592. }
  49593. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49594. const cipherConstructor = function buildCipherCipherConstructor() {
  49595. return new ARCFourCipher(key);
  49596. };
  49597. return new CipherTransform(cipherConstructor, cipherConstructor);
  49598. }
  49599. }
  49600. return CipherTransformFactory;
  49601. }();
  49602. exports.CipherTransformFactory = CipherTransformFactory;
  49603. /***/ }),
  49604. /* 66 */
  49605. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49606. Object.defineProperty(exports, "__esModule", ({
  49607. value: true
  49608. }));
  49609. exports.DecryptStream = void 0;
  49610. var _decode_stream = __w_pdfjs_require__(17);
  49611. const chunkSize = 512;
  49612. class DecryptStream extends _decode_stream.DecodeStream {
  49613. constructor(str, maybeLength, decrypt) {
  49614. super(maybeLength);
  49615. this.str = str;
  49616. this.dict = str.dict;
  49617. this.decrypt = decrypt;
  49618. this.nextChunk = null;
  49619. this.initialized = false;
  49620. }
  49621. readBlock() {
  49622. let chunk;
  49623. if (this.initialized) {
  49624. chunk = this.nextChunk;
  49625. } else {
  49626. chunk = this.str.getBytes(chunkSize);
  49627. this.initialized = true;
  49628. }
  49629. if (!chunk || chunk.length === 0) {
  49630. this.eof = true;
  49631. return;
  49632. }
  49633. this.nextChunk = this.str.getBytes(chunkSize);
  49634. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49635. const decrypt = this.decrypt;
  49636. chunk = decrypt(chunk, !hasMoreData);
  49637. const bufferLength = this.bufferLength,
  49638. newLength = bufferLength + chunk.length,
  49639. buffer = this.ensureBuffer(newLength);
  49640. buffer.set(chunk, bufferLength);
  49641. this.bufferLength = newLength;
  49642. }
  49643. }
  49644. exports.DecryptStream = DecryptStream;
  49645. /***/ }),
  49646. /* 67 */
  49647. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49648. Object.defineProperty(exports, "__esModule", ({
  49649. value: true
  49650. }));
  49651. exports.Catalog = void 0;
  49652. var _core_utils = __w_pdfjs_require__(4);
  49653. var _util = __w_pdfjs_require__(2);
  49654. var _primitives = __w_pdfjs_require__(3);
  49655. var _name_number_tree = __w_pdfjs_require__(68);
  49656. var _base_stream = __w_pdfjs_require__(5);
  49657. var _cleanup_helper = __w_pdfjs_require__(69);
  49658. var _colorspace = __w_pdfjs_require__(12);
  49659. var _file_spec = __w_pdfjs_require__(70);
  49660. var _image_utils = __w_pdfjs_require__(57);
  49661. var _metadata_parser = __w_pdfjs_require__(71);
  49662. var _struct_tree = __w_pdfjs_require__(72);
  49663. function fetchDestination(dest) {
  49664. if (dest instanceof _primitives.Dict) {
  49665. dest = dest.get("D");
  49666. }
  49667. return Array.isArray(dest) ? dest : null;
  49668. }
  49669. class Catalog {
  49670. constructor(pdfManager, xref) {
  49671. this.pdfManager = pdfManager;
  49672. this.xref = xref;
  49673. this._catDict = xref.getCatalogObj();
  49674. if (!(this._catDict instanceof _primitives.Dict)) {
  49675. throw new _util.FormatError("Catalog object is not a dictionary.");
  49676. }
  49677. this.toplevelPagesDict;
  49678. this._actualNumPages = null;
  49679. this.fontCache = new _primitives.RefSetCache();
  49680. this.builtInCMapCache = new Map();
  49681. this.standardFontDataCache = new Map();
  49682. this.globalImageCache = new _image_utils.GlobalImageCache();
  49683. this.pageKidsCountCache = new _primitives.RefSetCache();
  49684. this.pageIndexCache = new _primitives.RefSetCache();
  49685. this.nonBlendModesSet = new _primitives.RefSet();
  49686. }
  49687. get version() {
  49688. const version = this._catDict.get("Version");
  49689. if (version instanceof _primitives.Name) {
  49690. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  49691. return (0, _util.shadow)(this, "version", version.name);
  49692. }
  49693. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  49694. }
  49695. return (0, _util.shadow)(this, "version", null);
  49696. }
  49697. get lang() {
  49698. const lang = this._catDict.get("Lang");
  49699. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49700. }
  49701. get needsRendering() {
  49702. const needsRendering = this._catDict.get("NeedsRendering");
  49703. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49704. }
  49705. get collection() {
  49706. let collection = null;
  49707. try {
  49708. const obj = this._catDict.get("Collection");
  49709. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49710. collection = obj;
  49711. }
  49712. } catch (ex) {
  49713. if (ex instanceof _core_utils.MissingDataException) {
  49714. throw ex;
  49715. }
  49716. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49717. }
  49718. return (0, _util.shadow)(this, "collection", collection);
  49719. }
  49720. get acroForm() {
  49721. let acroForm = null;
  49722. try {
  49723. const obj = this._catDict.get("AcroForm");
  49724. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49725. acroForm = obj;
  49726. }
  49727. } catch (ex) {
  49728. if (ex instanceof _core_utils.MissingDataException) {
  49729. throw ex;
  49730. }
  49731. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49732. }
  49733. return (0, _util.shadow)(this, "acroForm", acroForm);
  49734. }
  49735. get acroFormRef() {
  49736. const value = this._catDict.getRaw("AcroForm");
  49737. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49738. }
  49739. get metadata() {
  49740. const streamRef = this._catDict.getRaw("Metadata");
  49741. if (!(streamRef instanceof _primitives.Ref)) {
  49742. return (0, _util.shadow)(this, "metadata", null);
  49743. }
  49744. let metadata = null;
  49745. try {
  49746. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49747. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49748. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49749. const type = stream.dict.get("Type");
  49750. const subtype = stream.dict.get("Subtype");
  49751. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49752. const data = (0, _util.stringToUTF8String)(stream.getString());
  49753. if (data) {
  49754. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49755. }
  49756. }
  49757. }
  49758. } catch (ex) {
  49759. if (ex instanceof _core_utils.MissingDataException) {
  49760. throw ex;
  49761. }
  49762. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49763. }
  49764. return (0, _util.shadow)(this, "metadata", metadata);
  49765. }
  49766. get markInfo() {
  49767. let markInfo = null;
  49768. try {
  49769. markInfo = this._readMarkInfo();
  49770. } catch (ex) {
  49771. if (ex instanceof _core_utils.MissingDataException) {
  49772. throw ex;
  49773. }
  49774. (0, _util.warn)("Unable to read mark info.");
  49775. }
  49776. return (0, _util.shadow)(this, "markInfo", markInfo);
  49777. }
  49778. _readMarkInfo() {
  49779. const obj = this._catDict.get("MarkInfo");
  49780. if (!(obj instanceof _primitives.Dict)) {
  49781. return null;
  49782. }
  49783. const markInfo = {
  49784. Marked: false,
  49785. UserProperties: false,
  49786. Suspects: false
  49787. };
  49788. for (const key in markInfo) {
  49789. const value = obj.get(key);
  49790. if (typeof value === "boolean") {
  49791. markInfo[key] = value;
  49792. }
  49793. }
  49794. return markInfo;
  49795. }
  49796. get structTreeRoot() {
  49797. let structTree = null;
  49798. try {
  49799. structTree = this._readStructTreeRoot();
  49800. } catch (ex) {
  49801. if (ex instanceof _core_utils.MissingDataException) {
  49802. throw ex;
  49803. }
  49804. (0, _util.warn)("Unable read to structTreeRoot info.");
  49805. }
  49806. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49807. }
  49808. _readStructTreeRoot() {
  49809. const obj = this._catDict.get("StructTreeRoot");
  49810. if (!(obj instanceof _primitives.Dict)) {
  49811. return null;
  49812. }
  49813. const root = new _struct_tree.StructTreeRoot(obj);
  49814. root.init();
  49815. return root;
  49816. }
  49817. get toplevelPagesDict() {
  49818. const pagesObj = this._catDict.get("Pages");
  49819. if (!(pagesObj instanceof _primitives.Dict)) {
  49820. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49821. }
  49822. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49823. }
  49824. get documentOutline() {
  49825. let obj = null;
  49826. try {
  49827. obj = this._readDocumentOutline();
  49828. } catch (ex) {
  49829. if (ex instanceof _core_utils.MissingDataException) {
  49830. throw ex;
  49831. }
  49832. (0, _util.warn)("Unable to read document outline.");
  49833. }
  49834. return (0, _util.shadow)(this, "documentOutline", obj);
  49835. }
  49836. _readDocumentOutline() {
  49837. let obj = this._catDict.get("Outlines");
  49838. if (!(obj instanceof _primitives.Dict)) {
  49839. return null;
  49840. }
  49841. obj = obj.getRaw("First");
  49842. if (!(obj instanceof _primitives.Ref)) {
  49843. return null;
  49844. }
  49845. const root = {
  49846. items: []
  49847. };
  49848. const queue = [{
  49849. obj,
  49850. parent: root
  49851. }];
  49852. const processed = new _primitives.RefSet();
  49853. processed.put(obj);
  49854. const xref = this.xref,
  49855. blackColor = new Uint8ClampedArray(3);
  49856. while (queue.length > 0) {
  49857. const i = queue.shift();
  49858. const outlineDict = xref.fetchIfRef(i.obj);
  49859. if (outlineDict === null) {
  49860. continue;
  49861. }
  49862. if (!outlineDict.has("Title")) {
  49863. throw new _util.FormatError("Invalid outline item encountered.");
  49864. }
  49865. const data = {
  49866. url: null,
  49867. dest: null,
  49868. action: null
  49869. };
  49870. Catalog.parseDestDictionary({
  49871. destDict: outlineDict,
  49872. resultObj: data,
  49873. docBaseUrl: this.pdfManager.docBaseUrl,
  49874. docAttachments: this.attachments
  49875. });
  49876. const title = outlineDict.get("Title");
  49877. const flags = outlineDict.get("F") || 0;
  49878. const color = outlineDict.getArray("C");
  49879. const count = outlineDict.get("Count");
  49880. let rgbColor = blackColor;
  49881. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49882. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49883. }
  49884. const outlineItem = {
  49885. action: data.action,
  49886. attachment: data.attachment,
  49887. dest: data.dest,
  49888. url: data.url,
  49889. unsafeUrl: data.unsafeUrl,
  49890. newWindow: data.newWindow,
  49891. setOCGState: data.setOCGState,
  49892. title: (0, _util.stringToPDFString)(title),
  49893. color: rgbColor,
  49894. count: Number.isInteger(count) ? count : undefined,
  49895. bold: !!(flags & 2),
  49896. italic: !!(flags & 1),
  49897. items: []
  49898. };
  49899. i.parent.items.push(outlineItem);
  49900. obj = outlineDict.getRaw("First");
  49901. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49902. queue.push({
  49903. obj,
  49904. parent: outlineItem
  49905. });
  49906. processed.put(obj);
  49907. }
  49908. obj = outlineDict.getRaw("Next");
  49909. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49910. queue.push({
  49911. obj,
  49912. parent: i.parent
  49913. });
  49914. processed.put(obj);
  49915. }
  49916. }
  49917. return root.items.length > 0 ? root.items : null;
  49918. }
  49919. get permissions() {
  49920. let permissions = null;
  49921. try {
  49922. permissions = this._readPermissions();
  49923. } catch (ex) {
  49924. if (ex instanceof _core_utils.MissingDataException) {
  49925. throw ex;
  49926. }
  49927. (0, _util.warn)("Unable to read permissions.");
  49928. }
  49929. return (0, _util.shadow)(this, "permissions", permissions);
  49930. }
  49931. _readPermissions() {
  49932. const encrypt = this.xref.trailer.get("Encrypt");
  49933. if (!(encrypt instanceof _primitives.Dict)) {
  49934. return null;
  49935. }
  49936. let flags = encrypt.get("P");
  49937. if (typeof flags !== "number") {
  49938. return null;
  49939. }
  49940. flags += 2 ** 32;
  49941. const permissions = [];
  49942. for (const key in _util.PermissionFlag) {
  49943. const value = _util.PermissionFlag[key];
  49944. if (flags & value) {
  49945. permissions.push(value);
  49946. }
  49947. }
  49948. return permissions;
  49949. }
  49950. get optionalContentConfig() {
  49951. let config = null;
  49952. try {
  49953. const properties = this._catDict.get("OCProperties");
  49954. if (!properties) {
  49955. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49956. }
  49957. const defaultConfig = properties.get("D");
  49958. if (!defaultConfig) {
  49959. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49960. }
  49961. const groupsData = properties.get("OCGs");
  49962. if (!Array.isArray(groupsData)) {
  49963. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49964. }
  49965. const groups = [];
  49966. const groupRefs = [];
  49967. for (const groupRef of groupsData) {
  49968. if (!(groupRef instanceof _primitives.Ref)) {
  49969. continue;
  49970. }
  49971. groupRefs.push(groupRef);
  49972. const group = this.xref.fetchIfRef(groupRef);
  49973. groups.push({
  49974. id: groupRef.toString(),
  49975. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  49976. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  49977. });
  49978. }
  49979. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  49980. config.groups = groups;
  49981. } catch (ex) {
  49982. if (ex instanceof _core_utils.MissingDataException) {
  49983. throw ex;
  49984. }
  49985. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  49986. }
  49987. return (0, _util.shadow)(this, "optionalContentConfig", config);
  49988. }
  49989. _readOptionalContentConfig(config, contentGroupRefs) {
  49990. function parseOnOff(refs) {
  49991. const onParsed = [];
  49992. if (Array.isArray(refs)) {
  49993. for (const value of refs) {
  49994. if (!(value instanceof _primitives.Ref)) {
  49995. continue;
  49996. }
  49997. if (contentGroupRefs.includes(value)) {
  49998. onParsed.push(value.toString());
  49999. }
  50000. }
  50001. }
  50002. return onParsed;
  50003. }
  50004. function parseOrder(refs, nestedLevels = 0) {
  50005. if (!Array.isArray(refs)) {
  50006. return null;
  50007. }
  50008. const order = [];
  50009. for (const value of refs) {
  50010. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  50011. parsedOrderRefs.put(value);
  50012. order.push(value.toString());
  50013. continue;
  50014. }
  50015. const nestedOrder = parseNestedOrder(value, nestedLevels);
  50016. if (nestedOrder) {
  50017. order.push(nestedOrder);
  50018. }
  50019. }
  50020. if (nestedLevels > 0) {
  50021. return order;
  50022. }
  50023. const hiddenGroups = [];
  50024. for (const groupRef of contentGroupRefs) {
  50025. if (parsedOrderRefs.has(groupRef)) {
  50026. continue;
  50027. }
  50028. hiddenGroups.push(groupRef.toString());
  50029. }
  50030. if (hiddenGroups.length) {
  50031. order.push({
  50032. name: null,
  50033. order: hiddenGroups
  50034. });
  50035. }
  50036. return order;
  50037. }
  50038. function parseNestedOrder(ref, nestedLevels) {
  50039. if (++nestedLevels > MAX_NESTED_LEVELS) {
  50040. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  50041. return null;
  50042. }
  50043. const value = xref.fetchIfRef(ref);
  50044. if (!Array.isArray(value)) {
  50045. return null;
  50046. }
  50047. const nestedName = xref.fetchIfRef(value[0]);
  50048. if (typeof nestedName !== "string") {
  50049. return null;
  50050. }
  50051. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  50052. if (!nestedOrder || !nestedOrder.length) {
  50053. return null;
  50054. }
  50055. return {
  50056. name: (0, _util.stringToPDFString)(nestedName),
  50057. order: nestedOrder
  50058. };
  50059. }
  50060. const xref = this.xref,
  50061. parsedOrderRefs = new _primitives.RefSet(),
  50062. MAX_NESTED_LEVELS = 10;
  50063. return {
  50064. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  50065. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  50066. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  50067. on: parseOnOff(config.get("ON")),
  50068. off: parseOnOff(config.get("OFF")),
  50069. order: parseOrder(config.get("Order")),
  50070. groups: null
  50071. };
  50072. }
  50073. setActualNumPages(num = null) {
  50074. this._actualNumPages = num;
  50075. }
  50076. get hasActualNumPages() {
  50077. return this._actualNumPages !== null;
  50078. }
  50079. get _pagesCount() {
  50080. const obj = this.toplevelPagesDict.get("Count");
  50081. if (!Number.isInteger(obj)) {
  50082. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  50083. }
  50084. return (0, _util.shadow)(this, "_pagesCount", obj);
  50085. }
  50086. get numPages() {
  50087. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  50088. }
  50089. get destinations() {
  50090. const obj = this._readDests(),
  50091. dests = Object.create(null);
  50092. if (obj instanceof _name_number_tree.NameTree) {
  50093. for (const [key, value] of obj.getAll()) {
  50094. const dest = fetchDestination(value);
  50095. if (dest) {
  50096. dests[(0, _util.stringToPDFString)(key)] = dest;
  50097. }
  50098. }
  50099. } else if (obj instanceof _primitives.Dict) {
  50100. obj.forEach(function (key, value) {
  50101. const dest = fetchDestination(value);
  50102. if (dest) {
  50103. dests[key] = dest;
  50104. }
  50105. });
  50106. }
  50107. return (0, _util.shadow)(this, "destinations", dests);
  50108. }
  50109. getDestination(id) {
  50110. const obj = this._readDests();
  50111. if (obj instanceof _name_number_tree.NameTree) {
  50112. const dest = fetchDestination(obj.get(id));
  50113. if (dest) {
  50114. return dest;
  50115. }
  50116. const allDest = this.destinations[id];
  50117. if (allDest) {
  50118. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  50119. return allDest;
  50120. }
  50121. } else if (obj instanceof _primitives.Dict) {
  50122. const dest = fetchDestination(obj.get(id));
  50123. if (dest) {
  50124. return dest;
  50125. }
  50126. }
  50127. return null;
  50128. }
  50129. _readDests() {
  50130. const obj = this._catDict.get("Names");
  50131. if (obj && obj.has("Dests")) {
  50132. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  50133. } else if (this._catDict.has("Dests")) {
  50134. return this._catDict.get("Dests");
  50135. }
  50136. return undefined;
  50137. }
  50138. get pageLabels() {
  50139. let obj = null;
  50140. try {
  50141. obj = this._readPageLabels();
  50142. } catch (ex) {
  50143. if (ex instanceof _core_utils.MissingDataException) {
  50144. throw ex;
  50145. }
  50146. (0, _util.warn)("Unable to read page labels.");
  50147. }
  50148. return (0, _util.shadow)(this, "pageLabels", obj);
  50149. }
  50150. _readPageLabels() {
  50151. const obj = this._catDict.getRaw("PageLabels");
  50152. if (!obj) {
  50153. return null;
  50154. }
  50155. const pageLabels = new Array(this.numPages);
  50156. let style = null,
  50157. prefix = "";
  50158. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  50159. const nums = numberTree.getAll();
  50160. let currentLabel = "",
  50161. currentIndex = 1;
  50162. for (let i = 0, ii = this.numPages; i < ii; i++) {
  50163. const labelDict = nums.get(i);
  50164. if (labelDict !== undefined) {
  50165. if (!(labelDict instanceof _primitives.Dict)) {
  50166. throw new _util.FormatError("PageLabel is not a dictionary.");
  50167. }
  50168. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  50169. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  50170. }
  50171. if (labelDict.has("S")) {
  50172. const s = labelDict.get("S");
  50173. if (!(s instanceof _primitives.Name)) {
  50174. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  50175. }
  50176. style = s.name;
  50177. } else {
  50178. style = null;
  50179. }
  50180. if (labelDict.has("P")) {
  50181. const p = labelDict.get("P");
  50182. if (typeof p !== "string") {
  50183. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  50184. }
  50185. prefix = (0, _util.stringToPDFString)(p);
  50186. } else {
  50187. prefix = "";
  50188. }
  50189. if (labelDict.has("St")) {
  50190. const st = labelDict.get("St");
  50191. if (!(Number.isInteger(st) && st >= 1)) {
  50192. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  50193. }
  50194. currentIndex = st;
  50195. } else {
  50196. currentIndex = 1;
  50197. }
  50198. }
  50199. switch (style) {
  50200. case "D":
  50201. currentLabel = currentIndex;
  50202. break;
  50203. case "R":
  50204. case "r":
  50205. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  50206. break;
  50207. case "A":
  50208. case "a":
  50209. const LIMIT = 26;
  50210. const A_UPPER_CASE = 0x41,
  50211. A_LOWER_CASE = 0x61;
  50212. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  50213. const letterIndex = currentIndex - 1;
  50214. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  50215. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  50216. break;
  50217. default:
  50218. if (style) {
  50219. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  50220. }
  50221. currentLabel = "";
  50222. }
  50223. pageLabels[i] = prefix + currentLabel;
  50224. currentIndex++;
  50225. }
  50226. return pageLabels;
  50227. }
  50228. get pageLayout() {
  50229. const obj = this._catDict.get("PageLayout");
  50230. let pageLayout = "";
  50231. if (obj instanceof _primitives.Name) {
  50232. switch (obj.name) {
  50233. case "SinglePage":
  50234. case "OneColumn":
  50235. case "TwoColumnLeft":
  50236. case "TwoColumnRight":
  50237. case "TwoPageLeft":
  50238. case "TwoPageRight":
  50239. pageLayout = obj.name;
  50240. }
  50241. }
  50242. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  50243. }
  50244. get pageMode() {
  50245. const obj = this._catDict.get("PageMode");
  50246. let pageMode = "UseNone";
  50247. if (obj instanceof _primitives.Name) {
  50248. switch (obj.name) {
  50249. case "UseNone":
  50250. case "UseOutlines":
  50251. case "UseThumbs":
  50252. case "FullScreen":
  50253. case "UseOC":
  50254. case "UseAttachments":
  50255. pageMode = obj.name;
  50256. }
  50257. }
  50258. return (0, _util.shadow)(this, "pageMode", pageMode);
  50259. }
  50260. get viewerPreferences() {
  50261. const obj = this._catDict.get("ViewerPreferences");
  50262. if (!(obj instanceof _primitives.Dict)) {
  50263. return (0, _util.shadow)(this, "viewerPreferences", null);
  50264. }
  50265. let prefs = null;
  50266. for (const key of obj.getKeys()) {
  50267. const value = obj.get(key);
  50268. let prefValue;
  50269. switch (key) {
  50270. case "HideToolbar":
  50271. case "HideMenubar":
  50272. case "HideWindowUI":
  50273. case "FitWindow":
  50274. case "CenterWindow":
  50275. case "DisplayDocTitle":
  50276. case "PickTrayByPDFSize":
  50277. if (typeof value === "boolean") {
  50278. prefValue = value;
  50279. }
  50280. break;
  50281. case "NonFullScreenPageMode":
  50282. if (value instanceof _primitives.Name) {
  50283. switch (value.name) {
  50284. case "UseNone":
  50285. case "UseOutlines":
  50286. case "UseThumbs":
  50287. case "UseOC":
  50288. prefValue = value.name;
  50289. break;
  50290. default:
  50291. prefValue = "UseNone";
  50292. }
  50293. }
  50294. break;
  50295. case "Direction":
  50296. if (value instanceof _primitives.Name) {
  50297. switch (value.name) {
  50298. case "L2R":
  50299. case "R2L":
  50300. prefValue = value.name;
  50301. break;
  50302. default:
  50303. prefValue = "L2R";
  50304. }
  50305. }
  50306. break;
  50307. case "ViewArea":
  50308. case "ViewClip":
  50309. case "PrintArea":
  50310. case "PrintClip":
  50311. if (value instanceof _primitives.Name) {
  50312. switch (value.name) {
  50313. case "MediaBox":
  50314. case "CropBox":
  50315. case "BleedBox":
  50316. case "TrimBox":
  50317. case "ArtBox":
  50318. prefValue = value.name;
  50319. break;
  50320. default:
  50321. prefValue = "CropBox";
  50322. }
  50323. }
  50324. break;
  50325. case "PrintScaling":
  50326. if (value instanceof _primitives.Name) {
  50327. switch (value.name) {
  50328. case "None":
  50329. case "AppDefault":
  50330. prefValue = value.name;
  50331. break;
  50332. default:
  50333. prefValue = "AppDefault";
  50334. }
  50335. }
  50336. break;
  50337. case "Duplex":
  50338. if (value instanceof _primitives.Name) {
  50339. switch (value.name) {
  50340. case "Simplex":
  50341. case "DuplexFlipShortEdge":
  50342. case "DuplexFlipLongEdge":
  50343. prefValue = value.name;
  50344. break;
  50345. default:
  50346. prefValue = "None";
  50347. }
  50348. }
  50349. break;
  50350. case "PrintPageRange":
  50351. if (Array.isArray(value) && value.length % 2 === 0) {
  50352. const isValid = value.every((page, i, arr) => {
  50353. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  50354. });
  50355. if (isValid) {
  50356. prefValue = value;
  50357. }
  50358. }
  50359. break;
  50360. case "NumCopies":
  50361. if (Number.isInteger(value) && value > 0) {
  50362. prefValue = value;
  50363. }
  50364. break;
  50365. default:
  50366. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  50367. continue;
  50368. }
  50369. if (prefValue === undefined) {
  50370. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  50371. continue;
  50372. }
  50373. if (!prefs) {
  50374. prefs = Object.create(null);
  50375. }
  50376. prefs[key] = prefValue;
  50377. }
  50378. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  50379. }
  50380. get openAction() {
  50381. const obj = this._catDict.get("OpenAction");
  50382. const openAction = Object.create(null);
  50383. if (obj instanceof _primitives.Dict) {
  50384. const destDict = new _primitives.Dict(this.xref);
  50385. destDict.set("A", obj);
  50386. const resultObj = {
  50387. url: null,
  50388. dest: null,
  50389. action: null
  50390. };
  50391. Catalog.parseDestDictionary({
  50392. destDict,
  50393. resultObj
  50394. });
  50395. if (Array.isArray(resultObj.dest)) {
  50396. openAction.dest = resultObj.dest;
  50397. } else if (resultObj.action) {
  50398. openAction.action = resultObj.action;
  50399. }
  50400. } else if (Array.isArray(obj)) {
  50401. openAction.dest = obj;
  50402. }
  50403. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  50404. }
  50405. get attachments() {
  50406. const obj = this._catDict.get("Names");
  50407. let attachments = null;
  50408. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  50409. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  50410. for (const [key, value] of nameTree.getAll()) {
  50411. const fs = new _file_spec.FileSpec(value, this.xref);
  50412. if (!attachments) {
  50413. attachments = Object.create(null);
  50414. }
  50415. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  50416. }
  50417. }
  50418. return (0, _util.shadow)(this, "attachments", attachments);
  50419. }
  50420. get xfaImages() {
  50421. const obj = this._catDict.get("Names");
  50422. let xfaImages = null;
  50423. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  50424. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  50425. for (const [key, value] of nameTree.getAll()) {
  50426. if (!xfaImages) {
  50427. xfaImages = new _primitives.Dict(this.xref);
  50428. }
  50429. xfaImages.set((0, _util.stringToPDFString)(key), value);
  50430. }
  50431. }
  50432. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  50433. }
  50434. _collectJavaScript() {
  50435. const obj = this._catDict.get("Names");
  50436. let javaScript = null;
  50437. function appendIfJavaScriptDict(name, jsDict) {
  50438. if (!(jsDict instanceof _primitives.Dict)) {
  50439. return;
  50440. }
  50441. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  50442. return;
  50443. }
  50444. let js = jsDict.get("JS");
  50445. if (js instanceof _base_stream.BaseStream) {
  50446. js = js.getString();
  50447. } else if (typeof js !== "string") {
  50448. return;
  50449. }
  50450. if (javaScript === null) {
  50451. javaScript = new Map();
  50452. }
  50453. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  50454. javaScript.set(name, js);
  50455. }
  50456. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  50457. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  50458. for (const [key, value] of nameTree.getAll()) {
  50459. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  50460. }
  50461. }
  50462. const openAction = this._catDict.get("OpenAction");
  50463. if (openAction) {
  50464. appendIfJavaScriptDict("OpenAction", openAction);
  50465. }
  50466. return javaScript;
  50467. }
  50468. get javaScript() {
  50469. const javaScript = this._collectJavaScript();
  50470. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  50471. }
  50472. get jsActions() {
  50473. const javaScript = this._collectJavaScript();
  50474. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  50475. if (javaScript) {
  50476. if (!actions) {
  50477. actions = Object.create(null);
  50478. }
  50479. for (const [key, val] of javaScript) {
  50480. if (key in actions) {
  50481. actions[key].push(val);
  50482. } else {
  50483. actions[key] = [val];
  50484. }
  50485. }
  50486. }
  50487. return (0, _util.shadow)(this, "jsActions", actions);
  50488. }
  50489. async fontFallback(id, handler) {
  50490. const translatedFonts = await Promise.all(this.fontCache);
  50491. for (const translatedFont of translatedFonts) {
  50492. if (translatedFont.loadedName === id) {
  50493. translatedFont.fallback(handler);
  50494. return;
  50495. }
  50496. }
  50497. }
  50498. async cleanup(manuallyTriggered = false) {
  50499. (0, _cleanup_helper.clearGlobalCaches)();
  50500. this.globalImageCache.clear(manuallyTriggered);
  50501. this.pageKidsCountCache.clear();
  50502. this.pageIndexCache.clear();
  50503. this.nonBlendModesSet.clear();
  50504. const translatedFonts = await Promise.all(this.fontCache);
  50505. for (const {
  50506. dict
  50507. } of translatedFonts) {
  50508. delete dict.cacheKey;
  50509. }
  50510. this.fontCache.clear();
  50511. this.builtInCMapCache.clear();
  50512. this.standardFontDataCache.clear();
  50513. }
  50514. async getPageDict(pageIndex) {
  50515. const nodesToVisit = [this.toplevelPagesDict];
  50516. const visitedNodes = new _primitives.RefSet();
  50517. const pagesRef = this._catDict.getRaw("Pages");
  50518. if (pagesRef instanceof _primitives.Ref) {
  50519. visitedNodes.put(pagesRef);
  50520. }
  50521. const xref = this.xref,
  50522. pageKidsCountCache = this.pageKidsCountCache,
  50523. pageIndexCache = this.pageIndexCache;
  50524. let currentPageIndex = 0;
  50525. while (nodesToVisit.length) {
  50526. const currentNode = nodesToVisit.pop();
  50527. if (currentNode instanceof _primitives.Ref) {
  50528. const count = pageKidsCountCache.get(currentNode);
  50529. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50530. currentPageIndex += count;
  50531. continue;
  50532. }
  50533. if (visitedNodes.has(currentNode)) {
  50534. throw new _util.FormatError("Pages tree contains circular reference.");
  50535. }
  50536. visitedNodes.put(currentNode);
  50537. const obj = await xref.fetchAsync(currentNode);
  50538. if (obj instanceof _primitives.Dict) {
  50539. let type = obj.getRaw("Type");
  50540. if (type instanceof _primitives.Ref) {
  50541. type = await xref.fetchAsync(type);
  50542. }
  50543. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50544. if (!pageKidsCountCache.has(currentNode)) {
  50545. pageKidsCountCache.put(currentNode, 1);
  50546. }
  50547. if (!pageIndexCache.has(currentNode)) {
  50548. pageIndexCache.put(currentNode, currentPageIndex);
  50549. }
  50550. if (currentPageIndex === pageIndex) {
  50551. return [obj, currentNode];
  50552. }
  50553. currentPageIndex++;
  50554. continue;
  50555. }
  50556. }
  50557. nodesToVisit.push(obj);
  50558. continue;
  50559. }
  50560. if (!(currentNode instanceof _primitives.Dict)) {
  50561. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50562. }
  50563. const {
  50564. objId
  50565. } = currentNode;
  50566. let count = currentNode.getRaw("Count");
  50567. if (count instanceof _primitives.Ref) {
  50568. count = await xref.fetchAsync(count);
  50569. }
  50570. if (Number.isInteger(count) && count >= 0) {
  50571. if (objId && !pageKidsCountCache.has(objId)) {
  50572. pageKidsCountCache.put(objId, count);
  50573. }
  50574. if (currentPageIndex + count <= pageIndex) {
  50575. currentPageIndex += count;
  50576. continue;
  50577. }
  50578. }
  50579. let kids = currentNode.getRaw("Kids");
  50580. if (kids instanceof _primitives.Ref) {
  50581. kids = await xref.fetchAsync(kids);
  50582. }
  50583. if (!Array.isArray(kids)) {
  50584. let type = currentNode.getRaw("Type");
  50585. if (type instanceof _primitives.Ref) {
  50586. type = await xref.fetchAsync(type);
  50587. }
  50588. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50589. if (currentPageIndex === pageIndex) {
  50590. return [currentNode, null];
  50591. }
  50592. currentPageIndex++;
  50593. continue;
  50594. }
  50595. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50596. }
  50597. for (let last = kids.length - 1; last >= 0; last--) {
  50598. nodesToVisit.push(kids[last]);
  50599. }
  50600. }
  50601. throw new Error(`Page index ${pageIndex} not found.`);
  50602. }
  50603. async getAllPageDicts(recoveryMode = false) {
  50604. const {
  50605. ignoreErrors
  50606. } = this.pdfManager.evaluatorOptions;
  50607. const queue = [{
  50608. currentNode: this.toplevelPagesDict,
  50609. posInKids: 0
  50610. }];
  50611. const visitedNodes = new _primitives.RefSet();
  50612. const pagesRef = this._catDict.getRaw("Pages");
  50613. if (pagesRef instanceof _primitives.Ref) {
  50614. visitedNodes.put(pagesRef);
  50615. }
  50616. const map = new Map(),
  50617. xref = this.xref,
  50618. pageIndexCache = this.pageIndexCache;
  50619. let pageIndex = 0;
  50620. function addPageDict(pageDict, pageRef) {
  50621. if (pageRef && !pageIndexCache.has(pageRef)) {
  50622. pageIndexCache.put(pageRef, pageIndex);
  50623. }
  50624. map.set(pageIndex++, [pageDict, pageRef]);
  50625. }
  50626. function addPageError(error) {
  50627. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50628. throw error;
  50629. }
  50630. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  50631. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  50632. error = _primitives.Dict.empty;
  50633. }
  50634. map.set(pageIndex++, [error, null]);
  50635. }
  50636. while (queue.length > 0) {
  50637. const queueItem = queue.at(-1);
  50638. const {
  50639. currentNode,
  50640. posInKids
  50641. } = queueItem;
  50642. let kids = currentNode.getRaw("Kids");
  50643. if (kids instanceof _primitives.Ref) {
  50644. try {
  50645. kids = await xref.fetchAsync(kids);
  50646. } catch (ex) {
  50647. addPageError(ex);
  50648. break;
  50649. }
  50650. }
  50651. if (!Array.isArray(kids)) {
  50652. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50653. break;
  50654. }
  50655. if (posInKids >= kids.length) {
  50656. queue.pop();
  50657. continue;
  50658. }
  50659. const kidObj = kids[posInKids];
  50660. let obj;
  50661. if (kidObj instanceof _primitives.Ref) {
  50662. if (visitedNodes.has(kidObj)) {
  50663. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50664. break;
  50665. }
  50666. visitedNodes.put(kidObj);
  50667. try {
  50668. obj = await xref.fetchAsync(kidObj);
  50669. } catch (ex) {
  50670. addPageError(ex);
  50671. break;
  50672. }
  50673. } else {
  50674. obj = kidObj;
  50675. }
  50676. if (!(obj instanceof _primitives.Dict)) {
  50677. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50678. break;
  50679. }
  50680. let type = obj.getRaw("Type");
  50681. if (type instanceof _primitives.Ref) {
  50682. try {
  50683. type = await xref.fetchAsync(type);
  50684. } catch (ex) {
  50685. addPageError(ex);
  50686. break;
  50687. }
  50688. }
  50689. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50690. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50691. } else {
  50692. queue.push({
  50693. currentNode: obj,
  50694. posInKids: 0
  50695. });
  50696. }
  50697. queueItem.posInKids++;
  50698. }
  50699. return map;
  50700. }
  50701. getPageIndex(pageRef) {
  50702. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50703. if (cachedPageIndex !== undefined) {
  50704. return Promise.resolve(cachedPageIndex);
  50705. }
  50706. const xref = this.xref;
  50707. function pagesBeforeRef(kidRef) {
  50708. let total = 0,
  50709. parentRef;
  50710. return xref.fetchAsync(kidRef).then(function (node) {
  50711. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50712. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50713. }
  50714. if (!node) {
  50715. return null;
  50716. }
  50717. if (!(node instanceof _primitives.Dict)) {
  50718. throw new _util.FormatError("Node must be a dictionary.");
  50719. }
  50720. parentRef = node.getRaw("Parent");
  50721. return node.getAsync("Parent");
  50722. }).then(function (parent) {
  50723. if (!parent) {
  50724. return null;
  50725. }
  50726. if (!(parent instanceof _primitives.Dict)) {
  50727. throw new _util.FormatError("Parent must be a dictionary.");
  50728. }
  50729. return parent.getAsync("Kids");
  50730. }).then(function (kids) {
  50731. if (!kids) {
  50732. return null;
  50733. }
  50734. const kidPromises = [];
  50735. let found = false;
  50736. for (const kid of kids) {
  50737. if (!(kid instanceof _primitives.Ref)) {
  50738. throw new _util.FormatError("Kid must be a reference.");
  50739. }
  50740. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50741. found = true;
  50742. break;
  50743. }
  50744. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50745. if (!(obj instanceof _primitives.Dict)) {
  50746. throw new _util.FormatError("Kid node must be a dictionary.");
  50747. }
  50748. if (obj.has("Count")) {
  50749. total += obj.get("Count");
  50750. } else {
  50751. total++;
  50752. }
  50753. }));
  50754. }
  50755. if (!found) {
  50756. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50757. }
  50758. return Promise.all(kidPromises).then(function () {
  50759. return [total, parentRef];
  50760. });
  50761. });
  50762. }
  50763. let total = 0;
  50764. const next = ref => pagesBeforeRef(ref).then(args => {
  50765. if (!args) {
  50766. this.pageIndexCache.put(pageRef, total);
  50767. return total;
  50768. }
  50769. const [count, parentRef] = args;
  50770. total += count;
  50771. return next(parentRef);
  50772. });
  50773. return next(pageRef);
  50774. }
  50775. get baseUrl() {
  50776. const uri = this._catDict.get("URI");
  50777. if (uri instanceof _primitives.Dict) {
  50778. const base = uri.get("Base");
  50779. if (typeof base === "string") {
  50780. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50781. tryConvertEncoding: true
  50782. });
  50783. if (absoluteUrl) {
  50784. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50785. }
  50786. }
  50787. }
  50788. return (0, _util.shadow)(this, "baseUrl", null);
  50789. }
  50790. static parseDestDictionary(params) {
  50791. const destDict = params.destDict;
  50792. if (!(destDict instanceof _primitives.Dict)) {
  50793. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50794. return;
  50795. }
  50796. const resultObj = params.resultObj;
  50797. if (typeof resultObj !== "object") {
  50798. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50799. return;
  50800. }
  50801. const docBaseUrl = params.docBaseUrl || null;
  50802. const docAttachments = params.docAttachments || null;
  50803. let action = destDict.get("A"),
  50804. url,
  50805. dest;
  50806. if (!(action instanceof _primitives.Dict)) {
  50807. if (destDict.has("Dest")) {
  50808. action = destDict.get("Dest");
  50809. } else {
  50810. action = destDict.get("AA");
  50811. if (action instanceof _primitives.Dict) {
  50812. if (action.has("D")) {
  50813. action = action.get("D");
  50814. } else if (action.has("U")) {
  50815. action = action.get("U");
  50816. }
  50817. }
  50818. }
  50819. }
  50820. if (action instanceof _primitives.Dict) {
  50821. const actionType = action.get("S");
  50822. if (!(actionType instanceof _primitives.Name)) {
  50823. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50824. return;
  50825. }
  50826. const actionName = actionType.name;
  50827. switch (actionName) {
  50828. case "ResetForm":
  50829. const flags = action.get("Flags");
  50830. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50831. const fields = [];
  50832. const refs = [];
  50833. for (const obj of action.get("Fields") || []) {
  50834. if (obj instanceof _primitives.Ref) {
  50835. refs.push(obj.toString());
  50836. } else if (typeof obj === "string") {
  50837. fields.push((0, _util.stringToPDFString)(obj));
  50838. }
  50839. }
  50840. resultObj.resetForm = {
  50841. fields,
  50842. refs,
  50843. include
  50844. };
  50845. break;
  50846. case "URI":
  50847. url = action.get("URI");
  50848. if (url instanceof _primitives.Name) {
  50849. url = "/" + url.name;
  50850. }
  50851. break;
  50852. case "GoTo":
  50853. dest = action.get("D");
  50854. break;
  50855. case "Launch":
  50856. case "GoToR":
  50857. const urlDict = action.get("F");
  50858. if (urlDict instanceof _primitives.Dict) {
  50859. url = urlDict.get("F") || null;
  50860. } else if (typeof urlDict === "string") {
  50861. url = urlDict;
  50862. }
  50863. let remoteDest = action.get("D");
  50864. if (remoteDest) {
  50865. if (remoteDest instanceof _primitives.Name) {
  50866. remoteDest = remoteDest.name;
  50867. }
  50868. if (typeof url === "string") {
  50869. const baseUrl = url.split("#")[0];
  50870. if (typeof remoteDest === "string") {
  50871. url = baseUrl + "#" + remoteDest;
  50872. } else if (Array.isArray(remoteDest)) {
  50873. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50874. }
  50875. }
  50876. }
  50877. const newWindow = action.get("NewWindow");
  50878. if (typeof newWindow === "boolean") {
  50879. resultObj.newWindow = newWindow;
  50880. }
  50881. break;
  50882. case "GoToE":
  50883. const target = action.get("T");
  50884. let attachment;
  50885. if (docAttachments && target instanceof _primitives.Dict) {
  50886. const relationship = target.get("R");
  50887. const name = target.get("N");
  50888. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  50889. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  50890. }
  50891. }
  50892. if (attachment) {
  50893. resultObj.attachment = attachment;
  50894. } else {
  50895. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  50896. }
  50897. break;
  50898. case "Named":
  50899. const namedAction = action.get("N");
  50900. if (namedAction instanceof _primitives.Name) {
  50901. resultObj.action = namedAction.name;
  50902. }
  50903. break;
  50904. case "SetOCGState":
  50905. const state = action.get("State");
  50906. const preserveRB = action.get("PreserveRB");
  50907. if (!Array.isArray(state) || state.length === 0) {
  50908. break;
  50909. }
  50910. const stateArr = [];
  50911. for (const elem of state) {
  50912. if (elem instanceof _primitives.Name) {
  50913. switch (elem.name) {
  50914. case "ON":
  50915. case "OFF":
  50916. case "Toggle":
  50917. stateArr.push(elem.name);
  50918. break;
  50919. }
  50920. } else if (elem instanceof _primitives.Ref) {
  50921. stateArr.push(elem.toString());
  50922. }
  50923. }
  50924. if (stateArr.length !== state.length) {
  50925. break;
  50926. }
  50927. resultObj.setOCGState = {
  50928. state: stateArr,
  50929. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  50930. };
  50931. break;
  50932. case "JavaScript":
  50933. const jsAction = action.get("JS");
  50934. let js;
  50935. if (jsAction instanceof _base_stream.BaseStream) {
  50936. js = jsAction.getString();
  50937. } else if (typeof jsAction === "string") {
  50938. js = jsAction;
  50939. }
  50940. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50941. if (jsURL) {
  50942. url = jsURL.url;
  50943. resultObj.newWindow = jsURL.newWindow;
  50944. break;
  50945. }
  50946. default:
  50947. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50948. break;
  50949. }
  50950. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50951. break;
  50952. }
  50953. } else if (destDict.has("Dest")) {
  50954. dest = destDict.get("Dest");
  50955. }
  50956. if (typeof url === "string") {
  50957. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50958. addDefaultProtocol: true,
  50959. tryConvertEncoding: true
  50960. });
  50961. if (absoluteUrl) {
  50962. resultObj.url = absoluteUrl.href;
  50963. }
  50964. resultObj.unsafeUrl = url;
  50965. }
  50966. if (dest) {
  50967. if (dest instanceof _primitives.Name) {
  50968. dest = dest.name;
  50969. }
  50970. if (typeof dest === "string") {
  50971. resultObj.dest = (0, _util.stringToPDFString)(dest);
  50972. } else if (Array.isArray(dest)) {
  50973. resultObj.dest = dest;
  50974. }
  50975. }
  50976. }
  50977. }
  50978. exports.Catalog = Catalog;
  50979. /***/ }),
  50980. /* 68 */
  50981. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50982. Object.defineProperty(exports, "__esModule", ({
  50983. value: true
  50984. }));
  50985. exports.NumberTree = exports.NameTree = void 0;
  50986. var _primitives = __w_pdfjs_require__(3);
  50987. var _util = __w_pdfjs_require__(2);
  50988. class NameOrNumberTree {
  50989. constructor(root, xref, type) {
  50990. if (this.constructor === NameOrNumberTree) {
  50991. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  50992. }
  50993. this.root = root;
  50994. this.xref = xref;
  50995. this._type = type;
  50996. }
  50997. getAll() {
  50998. const map = new Map();
  50999. if (!this.root) {
  51000. return map;
  51001. }
  51002. const xref = this.xref;
  51003. const processed = new _primitives.RefSet();
  51004. processed.put(this.root);
  51005. const queue = [this.root];
  51006. while (queue.length > 0) {
  51007. const obj = xref.fetchIfRef(queue.shift());
  51008. if (!(obj instanceof _primitives.Dict)) {
  51009. continue;
  51010. }
  51011. if (obj.has("Kids")) {
  51012. const kids = obj.get("Kids");
  51013. if (!Array.isArray(kids)) {
  51014. continue;
  51015. }
  51016. for (const kid of kids) {
  51017. if (processed.has(kid)) {
  51018. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  51019. }
  51020. queue.push(kid);
  51021. processed.put(kid);
  51022. }
  51023. continue;
  51024. }
  51025. const entries = obj.get(this._type);
  51026. if (!Array.isArray(entries)) {
  51027. continue;
  51028. }
  51029. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  51030. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  51031. }
  51032. }
  51033. return map;
  51034. }
  51035. get(key) {
  51036. if (!this.root) {
  51037. return null;
  51038. }
  51039. const xref = this.xref;
  51040. let kidsOrEntries = xref.fetchIfRef(this.root);
  51041. let loopCount = 0;
  51042. const MAX_LEVELS = 10;
  51043. while (kidsOrEntries.has("Kids")) {
  51044. if (++loopCount > MAX_LEVELS) {
  51045. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  51046. return null;
  51047. }
  51048. const kids = kidsOrEntries.get("Kids");
  51049. if (!Array.isArray(kids)) {
  51050. return null;
  51051. }
  51052. let l = 0,
  51053. r = kids.length - 1;
  51054. while (l <= r) {
  51055. const m = l + r >> 1;
  51056. const kid = xref.fetchIfRef(kids[m]);
  51057. const limits = kid.get("Limits");
  51058. if (key < xref.fetchIfRef(limits[0])) {
  51059. r = m - 1;
  51060. } else if (key > xref.fetchIfRef(limits[1])) {
  51061. l = m + 1;
  51062. } else {
  51063. kidsOrEntries = kid;
  51064. break;
  51065. }
  51066. }
  51067. if (l > r) {
  51068. return null;
  51069. }
  51070. }
  51071. const entries = kidsOrEntries.get(this._type);
  51072. if (Array.isArray(entries)) {
  51073. let l = 0,
  51074. r = entries.length - 2;
  51075. while (l <= r) {
  51076. const tmp = l + r >> 1,
  51077. m = tmp + (tmp & 1);
  51078. const currentKey = xref.fetchIfRef(entries[m]);
  51079. if (key < currentKey) {
  51080. r = m - 2;
  51081. } else if (key > currentKey) {
  51082. l = m + 2;
  51083. } else {
  51084. return xref.fetchIfRef(entries[m + 1]);
  51085. }
  51086. }
  51087. }
  51088. return null;
  51089. }
  51090. }
  51091. class NameTree extends NameOrNumberTree {
  51092. constructor(root, xref) {
  51093. super(root, xref, "Names");
  51094. }
  51095. }
  51096. exports.NameTree = NameTree;
  51097. class NumberTree extends NameOrNumberTree {
  51098. constructor(root, xref) {
  51099. super(root, xref, "Nums");
  51100. }
  51101. }
  51102. exports.NumberTree = NumberTree;
  51103. /***/ }),
  51104. /* 69 */
  51105. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51106. Object.defineProperty(exports, "__esModule", ({
  51107. value: true
  51108. }));
  51109. exports.clearGlobalCaches = clearGlobalCaches;
  51110. var _primitives = __w_pdfjs_require__(3);
  51111. var _unicode = __w_pdfjs_require__(38);
  51112. function clearGlobalCaches() {
  51113. (0, _primitives.clearPrimitiveCaches)();
  51114. (0, _unicode.clearUnicodeCaches)();
  51115. }
  51116. /***/ }),
  51117. /* 70 */
  51118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51119. Object.defineProperty(exports, "__esModule", ({
  51120. value: true
  51121. }));
  51122. exports.FileSpec = void 0;
  51123. var _util = __w_pdfjs_require__(2);
  51124. var _base_stream = __w_pdfjs_require__(5);
  51125. var _primitives = __w_pdfjs_require__(3);
  51126. function pickPlatformItem(dict) {
  51127. if (dict.has("UF")) {
  51128. return dict.get("UF");
  51129. } else if (dict.has("F")) {
  51130. return dict.get("F");
  51131. } else if (dict.has("Unix")) {
  51132. return dict.get("Unix");
  51133. } else if (dict.has("Mac")) {
  51134. return dict.get("Mac");
  51135. } else if (dict.has("DOS")) {
  51136. return dict.get("DOS");
  51137. }
  51138. return null;
  51139. }
  51140. class FileSpec {
  51141. constructor(root, xref) {
  51142. if (!(root instanceof _primitives.Dict)) {
  51143. return;
  51144. }
  51145. this.xref = xref;
  51146. this.root = root;
  51147. if (root.has("FS")) {
  51148. this.fs = root.get("FS");
  51149. }
  51150. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  51151. if (root.has("RF")) {
  51152. (0, _util.warn)("Related file specifications are not supported");
  51153. }
  51154. this.contentAvailable = true;
  51155. if (!root.has("EF")) {
  51156. this.contentAvailable = false;
  51157. (0, _util.warn)("Non-embedded file specifications are not supported");
  51158. }
  51159. }
  51160. get filename() {
  51161. if (!this._filename && this.root) {
  51162. const filename = pickPlatformItem(this.root) || "unnamed";
  51163. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  51164. }
  51165. return this._filename;
  51166. }
  51167. get content() {
  51168. if (!this.contentAvailable) {
  51169. return null;
  51170. }
  51171. if (!this.contentRef && this.root) {
  51172. this.contentRef = pickPlatformItem(this.root.get("EF"));
  51173. }
  51174. let content = null;
  51175. if (this.contentRef) {
  51176. const fileObj = this.xref.fetchIfRef(this.contentRef);
  51177. if (fileObj instanceof _base_stream.BaseStream) {
  51178. content = fileObj.getBytes();
  51179. } else {
  51180. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  51181. }
  51182. } else {
  51183. (0, _util.warn)("Embedded file specification does not have a content");
  51184. }
  51185. return content;
  51186. }
  51187. get serializable() {
  51188. return {
  51189. filename: this.filename,
  51190. content: this.content
  51191. };
  51192. }
  51193. }
  51194. exports.FileSpec = FileSpec;
  51195. /***/ }),
  51196. /* 71 */
  51197. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51198. Object.defineProperty(exports, "__esModule", ({
  51199. value: true
  51200. }));
  51201. exports.MetadataParser = void 0;
  51202. var _xml_parser = __w_pdfjs_require__(64);
  51203. class MetadataParser {
  51204. constructor(data) {
  51205. data = this._repair(data);
  51206. const parser = new _xml_parser.SimpleXMLParser({
  51207. lowerCaseName: true
  51208. });
  51209. const xmlDocument = parser.parseFromString(data);
  51210. this._metadataMap = new Map();
  51211. this._data = data;
  51212. if (xmlDocument) {
  51213. this._parse(xmlDocument);
  51214. }
  51215. }
  51216. _repair(data) {
  51217. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  51218. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  51219. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  51220. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  51221. switch (name) {
  51222. case "amp":
  51223. return "&";
  51224. case "apos":
  51225. return "'";
  51226. case "gt":
  51227. return ">";
  51228. case "lt":
  51229. return "<";
  51230. case "quot":
  51231. return '"';
  51232. }
  51233. throw new Error(`_repair: ${name} isn't defined.`);
  51234. });
  51235. const charBuf = [];
  51236. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  51237. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  51238. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  51239. charBuf.push(String.fromCharCode(code));
  51240. } else {
  51241. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  51242. }
  51243. }
  51244. return ">" + charBuf.join("");
  51245. });
  51246. }
  51247. _getSequence(entry) {
  51248. const name = entry.nodeName;
  51249. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  51250. return null;
  51251. }
  51252. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  51253. }
  51254. _parseArray(entry) {
  51255. if (!entry.hasChildNodes()) {
  51256. return;
  51257. }
  51258. const [seqNode] = entry.childNodes;
  51259. const sequence = this._getSequence(seqNode) || [];
  51260. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  51261. }
  51262. _parse(xmlDocument) {
  51263. let rdf = xmlDocument.documentElement;
  51264. if (rdf.nodeName !== "rdf:rdf") {
  51265. rdf = rdf.firstChild;
  51266. while (rdf && rdf.nodeName !== "rdf:rdf") {
  51267. rdf = rdf.nextSibling;
  51268. }
  51269. }
  51270. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  51271. return;
  51272. }
  51273. for (const desc of rdf.childNodes) {
  51274. if (desc.nodeName !== "rdf:description") {
  51275. continue;
  51276. }
  51277. for (const entry of desc.childNodes) {
  51278. const name = entry.nodeName;
  51279. switch (name) {
  51280. case "#text":
  51281. continue;
  51282. case "dc:creator":
  51283. case "dc:subject":
  51284. this._parseArray(entry);
  51285. continue;
  51286. }
  51287. this._metadataMap.set(name, entry.textContent.trim());
  51288. }
  51289. }
  51290. }
  51291. get serializable() {
  51292. return {
  51293. parsedData: this._metadataMap,
  51294. rawData: this._data
  51295. };
  51296. }
  51297. }
  51298. exports.MetadataParser = MetadataParser;
  51299. /***/ }),
  51300. /* 72 */
  51301. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51302. Object.defineProperty(exports, "__esModule", ({
  51303. value: true
  51304. }));
  51305. exports.StructTreeRoot = exports.StructTreePage = void 0;
  51306. var _primitives = __w_pdfjs_require__(3);
  51307. var _util = __w_pdfjs_require__(2);
  51308. var _name_number_tree = __w_pdfjs_require__(68);
  51309. const MAX_DEPTH = 40;
  51310. const StructElementType = {
  51311. PAGE_CONTENT: "PAGE_CONTENT",
  51312. STREAM_CONTENT: "STREAM_CONTENT",
  51313. OBJECT: "OBJECT",
  51314. ELEMENT: "ELEMENT"
  51315. };
  51316. class StructTreeRoot {
  51317. constructor(rootDict) {
  51318. this.dict = rootDict;
  51319. this.roleMap = new Map();
  51320. }
  51321. init() {
  51322. this.readRoleMap();
  51323. }
  51324. readRoleMap() {
  51325. const roleMapDict = this.dict.get("RoleMap");
  51326. if (!(roleMapDict instanceof _primitives.Dict)) {
  51327. return;
  51328. }
  51329. roleMapDict.forEach((key, value) => {
  51330. if (!(value instanceof _primitives.Name)) {
  51331. return;
  51332. }
  51333. this.roleMap.set(key, value.name);
  51334. });
  51335. }
  51336. }
  51337. exports.StructTreeRoot = StructTreeRoot;
  51338. class StructElementNode {
  51339. constructor(tree, dict) {
  51340. this.tree = tree;
  51341. this.dict = dict;
  51342. this.kids = [];
  51343. this.parseKids();
  51344. }
  51345. get role() {
  51346. const nameObj = this.dict.get("S");
  51347. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  51348. const {
  51349. root
  51350. } = this.tree;
  51351. if (root.roleMap.has(name)) {
  51352. return root.roleMap.get(name);
  51353. }
  51354. return name;
  51355. }
  51356. parseKids() {
  51357. let pageObjId = null;
  51358. const objRef = this.dict.getRaw("Pg");
  51359. if (objRef instanceof _primitives.Ref) {
  51360. pageObjId = objRef.toString();
  51361. }
  51362. const kids = this.dict.get("K");
  51363. if (Array.isArray(kids)) {
  51364. for (const kid of kids) {
  51365. const element = this.parseKid(pageObjId, kid);
  51366. if (element) {
  51367. this.kids.push(element);
  51368. }
  51369. }
  51370. } else {
  51371. const element = this.parseKid(pageObjId, kids);
  51372. if (element) {
  51373. this.kids.push(element);
  51374. }
  51375. }
  51376. }
  51377. parseKid(pageObjId, kid) {
  51378. if (Number.isInteger(kid)) {
  51379. if (this.tree.pageDict.objId !== pageObjId) {
  51380. return null;
  51381. }
  51382. return new StructElement({
  51383. type: StructElementType.PAGE_CONTENT,
  51384. mcid: kid,
  51385. pageObjId
  51386. });
  51387. }
  51388. let kidDict = null;
  51389. if (kid instanceof _primitives.Ref) {
  51390. kidDict = this.dict.xref.fetch(kid);
  51391. } else if (kid instanceof _primitives.Dict) {
  51392. kidDict = kid;
  51393. }
  51394. if (!kidDict) {
  51395. return null;
  51396. }
  51397. const pageRef = kidDict.getRaw("Pg");
  51398. if (pageRef instanceof _primitives.Ref) {
  51399. pageObjId = pageRef.toString();
  51400. }
  51401. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  51402. if (type === "MCR") {
  51403. if (this.tree.pageDict.objId !== pageObjId) {
  51404. return null;
  51405. }
  51406. return new StructElement({
  51407. type: StructElementType.STREAM_CONTENT,
  51408. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  51409. pageObjId,
  51410. mcid: kidDict.get("MCID")
  51411. });
  51412. }
  51413. if (type === "OBJR") {
  51414. if (this.tree.pageDict.objId !== pageObjId) {
  51415. return null;
  51416. }
  51417. return new StructElement({
  51418. type: StructElementType.OBJECT,
  51419. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  51420. pageObjId
  51421. });
  51422. }
  51423. return new StructElement({
  51424. type: StructElementType.ELEMENT,
  51425. dict: kidDict
  51426. });
  51427. }
  51428. }
  51429. class StructElement {
  51430. constructor({
  51431. type,
  51432. dict = null,
  51433. mcid = null,
  51434. pageObjId = null,
  51435. refObjId = null
  51436. }) {
  51437. this.type = type;
  51438. this.dict = dict;
  51439. this.mcid = mcid;
  51440. this.pageObjId = pageObjId;
  51441. this.refObjId = refObjId;
  51442. this.parentNode = null;
  51443. }
  51444. }
  51445. class StructTreePage {
  51446. constructor(structTreeRoot, pageDict) {
  51447. this.root = structTreeRoot;
  51448. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  51449. this.pageDict = pageDict;
  51450. this.nodes = [];
  51451. }
  51452. parse() {
  51453. if (!this.root || !this.rootDict) {
  51454. return;
  51455. }
  51456. const parentTree = this.rootDict.get("ParentTree");
  51457. if (!parentTree) {
  51458. return;
  51459. }
  51460. const id = this.pageDict.get("StructParents");
  51461. if (!Number.isInteger(id)) {
  51462. return;
  51463. }
  51464. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  51465. const parentArray = numberTree.get(id);
  51466. if (!Array.isArray(parentArray)) {
  51467. return;
  51468. }
  51469. const map = new Map();
  51470. for (const ref of parentArray) {
  51471. if (ref instanceof _primitives.Ref) {
  51472. this.addNode(this.rootDict.xref.fetch(ref), map);
  51473. }
  51474. }
  51475. }
  51476. addNode(dict, map, level = 0) {
  51477. if (level > MAX_DEPTH) {
  51478. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  51479. return null;
  51480. }
  51481. if (map.has(dict)) {
  51482. return map.get(dict);
  51483. }
  51484. const element = new StructElementNode(this, dict);
  51485. map.set(dict, element);
  51486. const parent = dict.get("P");
  51487. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  51488. if (!this.addTopLevelNode(dict, element)) {
  51489. map.delete(dict);
  51490. }
  51491. return element;
  51492. }
  51493. const parentNode = this.addNode(parent, map, level + 1);
  51494. if (!parentNode) {
  51495. return element;
  51496. }
  51497. let save = false;
  51498. for (const kid of parentNode.kids) {
  51499. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  51500. kid.parentNode = element;
  51501. save = true;
  51502. }
  51503. }
  51504. if (!save) {
  51505. map.delete(dict);
  51506. }
  51507. return element;
  51508. }
  51509. addTopLevelNode(dict, element) {
  51510. const obj = this.rootDict.get("K");
  51511. if (!obj) {
  51512. return false;
  51513. }
  51514. if (obj instanceof _primitives.Dict) {
  51515. if (obj.objId !== dict.objId) {
  51516. return false;
  51517. }
  51518. this.nodes[0] = element;
  51519. return true;
  51520. }
  51521. if (!Array.isArray(obj)) {
  51522. return true;
  51523. }
  51524. let save = false;
  51525. for (let i = 0; i < obj.length; i++) {
  51526. const kidRef = obj[i];
  51527. if (kidRef && kidRef.toString() === dict.objId) {
  51528. this.nodes[i] = element;
  51529. save = true;
  51530. }
  51531. }
  51532. return save;
  51533. }
  51534. get serializable() {
  51535. function nodeToSerializable(node, parent, level = 0) {
  51536. if (level > MAX_DEPTH) {
  51537. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51538. return;
  51539. }
  51540. const obj = Object.create(null);
  51541. obj.role = node.role;
  51542. obj.children = [];
  51543. parent.children.push(obj);
  51544. const alt = node.dict.get("Alt");
  51545. if (typeof alt === "string") {
  51546. obj.alt = (0, _util.stringToPDFString)(alt);
  51547. }
  51548. const lang = node.dict.get("Lang");
  51549. if (typeof lang === "string") {
  51550. obj.lang = (0, _util.stringToPDFString)(lang);
  51551. }
  51552. for (const kid of node.kids) {
  51553. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51554. if (kidElement) {
  51555. nodeToSerializable(kidElement, obj, level + 1);
  51556. continue;
  51557. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51558. obj.children.push({
  51559. type: "content",
  51560. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51561. });
  51562. } else if (kid.type === StructElementType.OBJECT) {
  51563. obj.children.push({
  51564. type: "object",
  51565. id: kid.refObjId
  51566. });
  51567. }
  51568. }
  51569. }
  51570. const root = Object.create(null);
  51571. root.children = [];
  51572. root.role = "Root";
  51573. for (const child of this.nodes) {
  51574. if (!child) {
  51575. continue;
  51576. }
  51577. nodeToSerializable(child, root);
  51578. }
  51579. return root;
  51580. }
  51581. }
  51582. exports.StructTreePage = StructTreePage;
  51583. /***/ }),
  51584. /* 73 */
  51585. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51586. Object.defineProperty(exports, "__esModule", ({
  51587. value: true
  51588. }));
  51589. exports.ObjectLoader = void 0;
  51590. var _primitives = __w_pdfjs_require__(3);
  51591. var _base_stream = __w_pdfjs_require__(5);
  51592. var _core_utils = __w_pdfjs_require__(4);
  51593. var _util = __w_pdfjs_require__(2);
  51594. function mayHaveChildren(value) {
  51595. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51596. }
  51597. function addChildren(node, nodesToVisit) {
  51598. if (node instanceof _primitives.Dict) {
  51599. node = node.getRawValues();
  51600. } else if (node instanceof _base_stream.BaseStream) {
  51601. node = node.dict.getRawValues();
  51602. } else if (!Array.isArray(node)) {
  51603. return;
  51604. }
  51605. for (const rawValue of node) {
  51606. if (mayHaveChildren(rawValue)) {
  51607. nodesToVisit.push(rawValue);
  51608. }
  51609. }
  51610. }
  51611. class ObjectLoader {
  51612. constructor(dict, keys, xref) {
  51613. this.dict = dict;
  51614. this.keys = keys;
  51615. this.xref = xref;
  51616. this.refSet = null;
  51617. }
  51618. async load() {
  51619. if (this.xref.stream.isDataLoaded) {
  51620. return undefined;
  51621. }
  51622. const {
  51623. keys,
  51624. dict
  51625. } = this;
  51626. this.refSet = new _primitives.RefSet();
  51627. const nodesToVisit = [];
  51628. for (const key of keys) {
  51629. const rawValue = dict.getRaw(key);
  51630. if (rawValue !== undefined) {
  51631. nodesToVisit.push(rawValue);
  51632. }
  51633. }
  51634. return this._walk(nodesToVisit);
  51635. }
  51636. async _walk(nodesToVisit) {
  51637. const nodesToRevisit = [];
  51638. const pendingRequests = [];
  51639. while (nodesToVisit.length) {
  51640. let currentNode = nodesToVisit.pop();
  51641. if (currentNode instanceof _primitives.Ref) {
  51642. if (this.refSet.has(currentNode)) {
  51643. continue;
  51644. }
  51645. try {
  51646. this.refSet.put(currentNode);
  51647. currentNode = this.xref.fetch(currentNode);
  51648. } catch (ex) {
  51649. if (!(ex instanceof _core_utils.MissingDataException)) {
  51650. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51651. this.refSet = null;
  51652. const {
  51653. manager
  51654. } = this.xref.stream;
  51655. return manager.requestAllChunks();
  51656. }
  51657. nodesToRevisit.push(currentNode);
  51658. pendingRequests.push({
  51659. begin: ex.begin,
  51660. end: ex.end
  51661. });
  51662. }
  51663. }
  51664. if (currentNode instanceof _base_stream.BaseStream) {
  51665. const baseStreams = currentNode.getBaseStreams();
  51666. if (baseStreams) {
  51667. let foundMissingData = false;
  51668. for (const stream of baseStreams) {
  51669. if (stream.isDataLoaded) {
  51670. continue;
  51671. }
  51672. foundMissingData = true;
  51673. pendingRequests.push({
  51674. begin: stream.start,
  51675. end: stream.end
  51676. });
  51677. }
  51678. if (foundMissingData) {
  51679. nodesToRevisit.push(currentNode);
  51680. }
  51681. }
  51682. }
  51683. addChildren(currentNode, nodesToVisit);
  51684. }
  51685. if (pendingRequests.length) {
  51686. await this.xref.stream.manager.requestRanges(pendingRequests);
  51687. for (const node of nodesToRevisit) {
  51688. if (node instanceof _primitives.Ref) {
  51689. this.refSet.remove(node);
  51690. }
  51691. }
  51692. return this._walk(nodesToRevisit);
  51693. }
  51694. this.refSet = null;
  51695. return undefined;
  51696. }
  51697. }
  51698. exports.ObjectLoader = ObjectLoader;
  51699. /***/ }),
  51700. /* 74 */
  51701. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51702. Object.defineProperty(exports, "__esModule", ({
  51703. value: true
  51704. }));
  51705. exports.XFAFactory = void 0;
  51706. var _xfa_object = __w_pdfjs_require__(75);
  51707. var _bind = __w_pdfjs_require__(79);
  51708. var _data = __w_pdfjs_require__(85);
  51709. var _fonts = __w_pdfjs_require__(83);
  51710. var _utils = __w_pdfjs_require__(76);
  51711. var _util = __w_pdfjs_require__(2);
  51712. var _parser = __w_pdfjs_require__(86);
  51713. var _xhtml = __w_pdfjs_require__(96);
  51714. class XFAFactory {
  51715. constructor(data) {
  51716. try {
  51717. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51718. const binder = new _bind.Binder(this.root);
  51719. this.form = binder.bind();
  51720. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51721. this.form[_xfa_object.$globalData].template = this.form;
  51722. } catch (e) {
  51723. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51724. }
  51725. }
  51726. isValid() {
  51727. return this.root && this.form;
  51728. }
  51729. _createPagesHelper() {
  51730. const iterator = this.form[_xfa_object.$toPages]();
  51731. return new Promise((resolve, reject) => {
  51732. const nextIteration = () => {
  51733. try {
  51734. const value = iterator.next();
  51735. if (value.done) {
  51736. resolve(value.value);
  51737. } else {
  51738. setTimeout(nextIteration, 0);
  51739. }
  51740. } catch (e) {
  51741. reject(e);
  51742. }
  51743. };
  51744. setTimeout(nextIteration, 0);
  51745. });
  51746. }
  51747. async _createPages() {
  51748. try {
  51749. this.pages = await this._createPagesHelper();
  51750. this.dims = this.pages.children.map(c => {
  51751. const {
  51752. width,
  51753. height
  51754. } = c.attributes.style;
  51755. return [0, 0, parseInt(width), parseInt(height)];
  51756. });
  51757. } catch (e) {
  51758. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51759. }
  51760. }
  51761. getBoundingBox(pageIndex) {
  51762. return this.dims[pageIndex];
  51763. }
  51764. async getNumPages() {
  51765. if (!this.pages) {
  51766. await this._createPages();
  51767. }
  51768. return this.dims.length;
  51769. }
  51770. setImages(images) {
  51771. this.form[_xfa_object.$globalData].images = images;
  51772. }
  51773. setFonts(fonts) {
  51774. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51775. const missingFonts = [];
  51776. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51777. typeface = (0, _utils.stripQuotes)(typeface);
  51778. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51779. if (!font) {
  51780. missingFonts.push(typeface);
  51781. }
  51782. }
  51783. if (missingFonts.length > 0) {
  51784. return missingFonts;
  51785. }
  51786. return null;
  51787. }
  51788. appendFonts(fonts, reallyMissingFonts) {
  51789. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51790. }
  51791. async getPages() {
  51792. if (!this.pages) {
  51793. await this._createPages();
  51794. }
  51795. const pages = this.pages;
  51796. this.pages = null;
  51797. return pages;
  51798. }
  51799. serializeData(storage) {
  51800. return this.dataHandler.serialize(storage);
  51801. }
  51802. static _createDocument(data) {
  51803. if (!data["/xdp:xdp"]) {
  51804. return data["xdp:xdp"];
  51805. }
  51806. return Object.values(data).join("");
  51807. }
  51808. static getRichTextAsHtml(rc) {
  51809. if (!rc || typeof rc !== "string") {
  51810. return null;
  51811. }
  51812. try {
  51813. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51814. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51815. const newRoot = _xhtml.XhtmlNamespace.body({});
  51816. newRoot[_xfa_object.$appendChild](root);
  51817. root = newRoot;
  51818. }
  51819. const result = root[_xfa_object.$toHTML]();
  51820. if (!result.success) {
  51821. return null;
  51822. }
  51823. const {
  51824. html
  51825. } = result;
  51826. const {
  51827. attributes
  51828. } = html;
  51829. if (attributes) {
  51830. if (attributes.class) {
  51831. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51832. }
  51833. attributes.dir = "auto";
  51834. }
  51835. return {
  51836. html,
  51837. str: root[_xfa_object.$text]()
  51838. };
  51839. } catch (e) {
  51840. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51841. }
  51842. return null;
  51843. }
  51844. }
  51845. exports.XFAFactory = XFAFactory;
  51846. /***/ }),
  51847. /* 75 */
  51848. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51849. Object.defineProperty(exports, "__esModule", ({
  51850. value: true
  51851. }));
  51852. 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;
  51853. var _utils = __w_pdfjs_require__(76);
  51854. var _util = __w_pdfjs_require__(2);
  51855. var _core_utils = __w_pdfjs_require__(4);
  51856. var _namespaces = __w_pdfjs_require__(77);
  51857. var _som = __w_pdfjs_require__(78);
  51858. const $acceptWhitespace = Symbol();
  51859. exports.$acceptWhitespace = $acceptWhitespace;
  51860. const $addHTML = Symbol();
  51861. exports.$addHTML = $addHTML;
  51862. const $appendChild = Symbol();
  51863. exports.$appendChild = $appendChild;
  51864. const $childrenToHTML = Symbol();
  51865. exports.$childrenToHTML = $childrenToHTML;
  51866. const $clean = Symbol();
  51867. exports.$clean = $clean;
  51868. const $cleanPage = Symbol();
  51869. exports.$cleanPage = $cleanPage;
  51870. const $cleanup = Symbol();
  51871. exports.$cleanup = $cleanup;
  51872. const $clone = Symbol();
  51873. exports.$clone = $clone;
  51874. const $consumed = Symbol();
  51875. exports.$consumed = $consumed;
  51876. const $content = Symbol("content");
  51877. exports.$content = $content;
  51878. const $data = Symbol("data");
  51879. exports.$data = $data;
  51880. const $dump = Symbol();
  51881. exports.$dump = $dump;
  51882. const $extra = Symbol("extra");
  51883. exports.$extra = $extra;
  51884. const $finalize = Symbol();
  51885. exports.$finalize = $finalize;
  51886. const $flushHTML = Symbol();
  51887. exports.$flushHTML = $flushHTML;
  51888. const $getAttributeIt = Symbol();
  51889. exports.$getAttributeIt = $getAttributeIt;
  51890. const $getAttributes = Symbol();
  51891. exports.$getAttributes = $getAttributes;
  51892. const $getAvailableSpace = Symbol();
  51893. exports.$getAvailableSpace = $getAvailableSpace;
  51894. const $getChildrenByClass = Symbol();
  51895. exports.$getChildrenByClass = $getChildrenByClass;
  51896. const $getChildrenByName = Symbol();
  51897. exports.$getChildrenByName = $getChildrenByName;
  51898. const $getChildrenByNameIt = Symbol();
  51899. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51900. const $getDataValue = Symbol();
  51901. exports.$getDataValue = $getDataValue;
  51902. const $getExtra = Symbol();
  51903. exports.$getExtra = $getExtra;
  51904. const $getRealChildrenByNameIt = Symbol();
  51905. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51906. const $getChildren = Symbol();
  51907. exports.$getChildren = $getChildren;
  51908. const $getContainedChildren = Symbol();
  51909. exports.$getContainedChildren = $getContainedChildren;
  51910. const $getNextPage = Symbol();
  51911. exports.$getNextPage = $getNextPage;
  51912. const $getSubformParent = Symbol();
  51913. exports.$getSubformParent = $getSubformParent;
  51914. const $getParent = Symbol();
  51915. exports.$getParent = $getParent;
  51916. const $getTemplateRoot = Symbol();
  51917. exports.$getTemplateRoot = $getTemplateRoot;
  51918. const $globalData = Symbol();
  51919. exports.$globalData = $globalData;
  51920. const $hasSettableValue = Symbol();
  51921. exports.$hasSettableValue = $hasSettableValue;
  51922. const $ids = Symbol();
  51923. exports.$ids = $ids;
  51924. const $indexOf = Symbol();
  51925. exports.$indexOf = $indexOf;
  51926. const $insertAt = Symbol();
  51927. exports.$insertAt = $insertAt;
  51928. const $isCDATAXml = Symbol();
  51929. exports.$isCDATAXml = $isCDATAXml;
  51930. const $isBindable = Symbol();
  51931. exports.$isBindable = $isBindable;
  51932. const $isDataValue = Symbol();
  51933. exports.$isDataValue = $isDataValue;
  51934. const $isDescendent = Symbol();
  51935. exports.$isDescendent = $isDescendent;
  51936. const $isNsAgnostic = Symbol();
  51937. exports.$isNsAgnostic = $isNsAgnostic;
  51938. const $isSplittable = Symbol();
  51939. exports.$isSplittable = $isSplittable;
  51940. const $isThereMoreWidth = Symbol();
  51941. exports.$isThereMoreWidth = $isThereMoreWidth;
  51942. const $isTransparent = Symbol();
  51943. exports.$isTransparent = $isTransparent;
  51944. const $isUsable = Symbol();
  51945. exports.$isUsable = $isUsable;
  51946. const $lastAttribute = Symbol();
  51947. const $namespaceId = Symbol("namespaceId");
  51948. exports.$namespaceId = $namespaceId;
  51949. const $nodeName = Symbol("nodeName");
  51950. exports.$nodeName = $nodeName;
  51951. const $nsAttributes = Symbol();
  51952. exports.$nsAttributes = $nsAttributes;
  51953. const $onChild = Symbol();
  51954. exports.$onChild = $onChild;
  51955. const $onChildCheck = Symbol();
  51956. exports.$onChildCheck = $onChildCheck;
  51957. const $onText = Symbol();
  51958. exports.$onText = $onText;
  51959. const $pushGlyphs = Symbol();
  51960. exports.$pushGlyphs = $pushGlyphs;
  51961. const $popPara = Symbol();
  51962. exports.$popPara = $popPara;
  51963. const $pushPara = Symbol();
  51964. exports.$pushPara = $pushPara;
  51965. const $removeChild = Symbol();
  51966. exports.$removeChild = $removeChild;
  51967. const $root = Symbol("root");
  51968. exports.$root = $root;
  51969. const $resolvePrototypes = Symbol();
  51970. exports.$resolvePrototypes = $resolvePrototypes;
  51971. const $searchNode = Symbol();
  51972. exports.$searchNode = $searchNode;
  51973. const $setId = Symbol();
  51974. exports.$setId = $setId;
  51975. const $setSetAttributes = Symbol();
  51976. exports.$setSetAttributes = $setSetAttributes;
  51977. const $setValue = Symbol();
  51978. exports.$setValue = $setValue;
  51979. const $tabIndex = Symbol();
  51980. exports.$tabIndex = $tabIndex;
  51981. const $text = Symbol();
  51982. exports.$text = $text;
  51983. const $toPages = Symbol();
  51984. exports.$toPages = $toPages;
  51985. const $toHTML = Symbol();
  51986. exports.$toHTML = $toHTML;
  51987. const $toString = Symbol();
  51988. exports.$toString = $toString;
  51989. const $toStyle = Symbol();
  51990. exports.$toStyle = $toStyle;
  51991. const $uid = Symbol("uid");
  51992. exports.$uid = $uid;
  51993. const _applyPrototype = Symbol();
  51994. const _attributes = Symbol();
  51995. const _attributeNames = Symbol();
  51996. const _children = Symbol("_children");
  51997. const _cloneAttribute = Symbol();
  51998. const _dataValue = Symbol();
  51999. const _defaultValue = Symbol();
  52000. const _filteredChildrenGenerator = Symbol();
  52001. const _getPrototype = Symbol();
  52002. const _getUnsetAttributes = Symbol();
  52003. const _hasChildren = Symbol();
  52004. const _max = Symbol();
  52005. const _options = Symbol();
  52006. const _parent = Symbol("parent");
  52007. const _resolvePrototypesHelper = Symbol();
  52008. const _setAttributes = Symbol();
  52009. const _validator = Symbol();
  52010. let uid = 0;
  52011. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52012. class XFAObject {
  52013. constructor(nsId, name, hasChildren = false) {
  52014. this[$namespaceId] = nsId;
  52015. this[$nodeName] = name;
  52016. this[_hasChildren] = hasChildren;
  52017. this[_parent] = null;
  52018. this[_children] = [];
  52019. this[$uid] = `${name}${uid++}`;
  52020. this[$globalData] = null;
  52021. }
  52022. [$onChild](child) {
  52023. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  52024. return false;
  52025. }
  52026. const name = child[$nodeName];
  52027. const node = this[name];
  52028. if (node instanceof XFAObjectArray) {
  52029. if (node.push(child)) {
  52030. this[$appendChild](child);
  52031. return true;
  52032. }
  52033. } else {
  52034. if (node !== null) {
  52035. this[$removeChild](node);
  52036. }
  52037. this[name] = child;
  52038. this[$appendChild](child);
  52039. return true;
  52040. }
  52041. let id = "";
  52042. if (this.id) {
  52043. id = ` (id: ${this.id})`;
  52044. } else if (this.name) {
  52045. id = ` (name: ${this.name} ${this.h.value})`;
  52046. }
  52047. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  52048. return false;
  52049. }
  52050. [$onChildCheck](child) {
  52051. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  52052. }
  52053. [$isNsAgnostic]() {
  52054. return false;
  52055. }
  52056. [$acceptWhitespace]() {
  52057. return false;
  52058. }
  52059. [$isCDATAXml]() {
  52060. return false;
  52061. }
  52062. [$isBindable]() {
  52063. return false;
  52064. }
  52065. [$popPara]() {
  52066. if (this.para) {
  52067. this[$getTemplateRoot]()[$extra].paraStack.pop();
  52068. }
  52069. }
  52070. [$pushPara]() {
  52071. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  52072. }
  52073. [$setId](ids) {
  52074. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  52075. ids.set(this.id, this);
  52076. }
  52077. }
  52078. [$getTemplateRoot]() {
  52079. return this[$globalData].template;
  52080. }
  52081. [$isSplittable]() {
  52082. return false;
  52083. }
  52084. [$isThereMoreWidth]() {
  52085. return false;
  52086. }
  52087. [$appendChild](child) {
  52088. child[_parent] = this;
  52089. this[_children].push(child);
  52090. if (!child[$globalData] && this[$globalData]) {
  52091. child[$globalData] = this[$globalData];
  52092. }
  52093. }
  52094. [$removeChild](child) {
  52095. const i = this[_children].indexOf(child);
  52096. this[_children].splice(i, 1);
  52097. }
  52098. [$hasSettableValue]() {
  52099. return this.hasOwnProperty("value");
  52100. }
  52101. [$setValue](_) {}
  52102. [$onText](_) {}
  52103. [$finalize]() {}
  52104. [$clean](builder) {
  52105. delete this[_hasChildren];
  52106. if (this[$cleanup]) {
  52107. builder.clean(this[$cleanup]);
  52108. delete this[$cleanup];
  52109. }
  52110. }
  52111. [$indexOf](child) {
  52112. return this[_children].indexOf(child);
  52113. }
  52114. [$insertAt](i, child) {
  52115. child[_parent] = this;
  52116. this[_children].splice(i, 0, child);
  52117. if (!child[$globalData] && this[$globalData]) {
  52118. child[$globalData] = this[$globalData];
  52119. }
  52120. }
  52121. [$isTransparent]() {
  52122. return !this.name;
  52123. }
  52124. [$lastAttribute]() {
  52125. return "";
  52126. }
  52127. [$text]() {
  52128. if (this[_children].length === 0) {
  52129. return this[$content];
  52130. }
  52131. return this[_children].map(c => c[$text]()).join("");
  52132. }
  52133. get [_attributeNames]() {
  52134. const proto = Object.getPrototypeOf(this);
  52135. if (!proto._attributes) {
  52136. const attributes = proto._attributes = new Set();
  52137. for (const name of Object.getOwnPropertyNames(this)) {
  52138. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  52139. break;
  52140. }
  52141. attributes.add(name);
  52142. }
  52143. }
  52144. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  52145. }
  52146. [$isDescendent](parent) {
  52147. let node = this;
  52148. while (node) {
  52149. if (node === parent) {
  52150. return true;
  52151. }
  52152. node = node[$getParent]();
  52153. }
  52154. return false;
  52155. }
  52156. [$getParent]() {
  52157. return this[_parent];
  52158. }
  52159. [$getSubformParent]() {
  52160. return this[$getParent]();
  52161. }
  52162. [$getChildren](name = null) {
  52163. if (!name) {
  52164. return this[_children];
  52165. }
  52166. return this[name];
  52167. }
  52168. [$dump]() {
  52169. const dumped = Object.create(null);
  52170. if (this[$content]) {
  52171. dumped.$content = this[$content];
  52172. }
  52173. for (const name of Object.getOwnPropertyNames(this)) {
  52174. const value = this[name];
  52175. if (value === null) {
  52176. continue;
  52177. }
  52178. if (value instanceof XFAObject) {
  52179. dumped[name] = value[$dump]();
  52180. } else if (value instanceof XFAObjectArray) {
  52181. if (!value.isEmpty()) {
  52182. dumped[name] = value.dump();
  52183. }
  52184. } else {
  52185. dumped[name] = value;
  52186. }
  52187. }
  52188. return dumped;
  52189. }
  52190. [$toStyle]() {
  52191. return null;
  52192. }
  52193. [$toHTML]() {
  52194. return _utils.HTMLResult.EMPTY;
  52195. }
  52196. *[$getContainedChildren]() {
  52197. for (const node of this[$getChildren]()) {
  52198. yield node;
  52199. }
  52200. }
  52201. *[_filteredChildrenGenerator](filter, include) {
  52202. for (const node of this[$getContainedChildren]()) {
  52203. if (!filter || include === filter.has(node[$nodeName])) {
  52204. const availableSpace = this[$getAvailableSpace]();
  52205. const res = node[$toHTML](availableSpace);
  52206. if (!res.success) {
  52207. this[$extra].failingNode = node;
  52208. }
  52209. yield res;
  52210. }
  52211. }
  52212. }
  52213. [$flushHTML]() {
  52214. return null;
  52215. }
  52216. [$addHTML](html, bbox) {
  52217. this[$extra].children.push(html);
  52218. }
  52219. [$getAvailableSpace]() {}
  52220. [$childrenToHTML]({
  52221. filter = null,
  52222. include = true
  52223. }) {
  52224. if (!this[$extra].generator) {
  52225. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  52226. } else {
  52227. const availableSpace = this[$getAvailableSpace]();
  52228. const res = this[$extra].failingNode[$toHTML](availableSpace);
  52229. if (!res.success) {
  52230. return res;
  52231. }
  52232. if (res.html) {
  52233. this[$addHTML](res.html, res.bbox);
  52234. }
  52235. delete this[$extra].failingNode;
  52236. }
  52237. while (true) {
  52238. const gen = this[$extra].generator.next();
  52239. if (gen.done) {
  52240. break;
  52241. }
  52242. const res = gen.value;
  52243. if (!res.success) {
  52244. return res;
  52245. }
  52246. if (res.html) {
  52247. this[$addHTML](res.html, res.bbox);
  52248. }
  52249. }
  52250. this[$extra].generator = null;
  52251. return _utils.HTMLResult.EMPTY;
  52252. }
  52253. [$setSetAttributes](attributes) {
  52254. this[_setAttributes] = new Set(Object.keys(attributes));
  52255. }
  52256. [_getUnsetAttributes](protoAttributes) {
  52257. const allAttr = this[_attributeNames];
  52258. const setAttr = this[_setAttributes];
  52259. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  52260. }
  52261. [$resolvePrototypes](ids, ancestors = new Set()) {
  52262. for (const child of this[_children]) {
  52263. child[_resolvePrototypesHelper](ids, ancestors);
  52264. }
  52265. }
  52266. [_resolvePrototypesHelper](ids, ancestors) {
  52267. const proto = this[_getPrototype](ids, ancestors);
  52268. if (proto) {
  52269. this[_applyPrototype](proto, ids, ancestors);
  52270. } else {
  52271. this[$resolvePrototypes](ids, ancestors);
  52272. }
  52273. }
  52274. [_getPrototype](ids, ancestors) {
  52275. const {
  52276. use,
  52277. usehref
  52278. } = this;
  52279. if (!use && !usehref) {
  52280. return null;
  52281. }
  52282. let proto = null;
  52283. let somExpression = null;
  52284. let id = null;
  52285. let ref = use;
  52286. if (usehref) {
  52287. ref = usehref;
  52288. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  52289. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  52290. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  52291. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  52292. } else if (usehref.startsWith("#")) {
  52293. id = usehref.slice(1);
  52294. } else if (usehref.startsWith(".#")) {
  52295. id = usehref.slice(2);
  52296. }
  52297. } else if (use.startsWith("#")) {
  52298. id = use.slice(1);
  52299. } else {
  52300. somExpression = use;
  52301. }
  52302. this.use = this.usehref = "";
  52303. if (id) {
  52304. proto = ids.get(id);
  52305. } else {
  52306. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  52307. if (proto) {
  52308. proto = proto[0];
  52309. }
  52310. }
  52311. if (!proto) {
  52312. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  52313. return null;
  52314. }
  52315. if (proto[$nodeName] !== this[$nodeName]) {
  52316. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  52317. return null;
  52318. }
  52319. if (ancestors.has(proto)) {
  52320. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52321. return null;
  52322. }
  52323. ancestors.add(proto);
  52324. const protoProto = proto[_getPrototype](ids, ancestors);
  52325. if (protoProto) {
  52326. proto[_applyPrototype](protoProto, ids, ancestors);
  52327. }
  52328. proto[$resolvePrototypes](ids, ancestors);
  52329. ancestors.delete(proto);
  52330. return proto;
  52331. }
  52332. [_applyPrototype](proto, ids, ancestors) {
  52333. if (ancestors.has(proto)) {
  52334. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52335. return;
  52336. }
  52337. if (!this[$content] && proto[$content]) {
  52338. this[$content] = proto[$content];
  52339. }
  52340. const newAncestors = new Set(ancestors);
  52341. newAncestors.add(proto);
  52342. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  52343. this[unsetAttrName] = proto[unsetAttrName];
  52344. if (this[_setAttributes]) {
  52345. this[_setAttributes].add(unsetAttrName);
  52346. }
  52347. }
  52348. for (const name of Object.getOwnPropertyNames(this)) {
  52349. if (this[_attributeNames].has(name)) {
  52350. continue;
  52351. }
  52352. const value = this[name];
  52353. const protoValue = proto[name];
  52354. if (value instanceof XFAObjectArray) {
  52355. for (const child of value[_children]) {
  52356. child[_resolvePrototypesHelper](ids, ancestors);
  52357. }
  52358. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  52359. const child = proto[_children][i][$clone]();
  52360. if (value.push(child)) {
  52361. child[_parent] = this;
  52362. this[_children].push(child);
  52363. child[_resolvePrototypesHelper](ids, ancestors);
  52364. } else {
  52365. break;
  52366. }
  52367. }
  52368. continue;
  52369. }
  52370. if (value !== null) {
  52371. value[$resolvePrototypes](ids, ancestors);
  52372. if (protoValue) {
  52373. value[_applyPrototype](protoValue, ids, ancestors);
  52374. }
  52375. continue;
  52376. }
  52377. if (protoValue !== null) {
  52378. const child = protoValue[$clone]();
  52379. child[_parent] = this;
  52380. this[name] = child;
  52381. this[_children].push(child);
  52382. child[_resolvePrototypesHelper](ids, ancestors);
  52383. }
  52384. }
  52385. }
  52386. static [_cloneAttribute](obj) {
  52387. if (Array.isArray(obj)) {
  52388. return obj.map(x => XFAObject[_cloneAttribute](x));
  52389. }
  52390. if (typeof obj === "object" && obj !== null) {
  52391. return Object.assign({}, obj);
  52392. }
  52393. return obj;
  52394. }
  52395. [$clone]() {
  52396. const clone = Object.create(Object.getPrototypeOf(this));
  52397. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  52398. try {
  52399. clone[$symbol] = this[$symbol];
  52400. } catch (_) {
  52401. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  52402. }
  52403. }
  52404. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  52405. clone[_children] = [];
  52406. for (const name of Object.getOwnPropertyNames(this)) {
  52407. if (this[_attributeNames].has(name)) {
  52408. clone[name] = XFAObject[_cloneAttribute](this[name]);
  52409. continue;
  52410. }
  52411. const value = this[name];
  52412. if (value instanceof XFAObjectArray) {
  52413. clone[name] = new XFAObjectArray(value[_max]);
  52414. } else {
  52415. clone[name] = null;
  52416. }
  52417. }
  52418. for (const child of this[_children]) {
  52419. const name = child[$nodeName];
  52420. const clonedChild = child[$clone]();
  52421. clone[_children].push(clonedChild);
  52422. clonedChild[_parent] = clone;
  52423. if (clone[name] === null) {
  52424. clone[name] = clonedChild;
  52425. } else {
  52426. clone[name][_children].push(clonedChild);
  52427. }
  52428. }
  52429. return clone;
  52430. }
  52431. [$getChildren](name = null) {
  52432. if (!name) {
  52433. return this[_children];
  52434. }
  52435. return this[_children].filter(c => c[$nodeName] === name);
  52436. }
  52437. [$getChildrenByClass](name) {
  52438. return this[name];
  52439. }
  52440. [$getChildrenByName](name, allTransparent, first = true) {
  52441. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  52442. }
  52443. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  52444. if (name === "parent") {
  52445. yield this[_parent];
  52446. return;
  52447. }
  52448. for (const child of this[_children]) {
  52449. if (child[$nodeName] === name) {
  52450. yield child;
  52451. }
  52452. if (child.name === name) {
  52453. yield child;
  52454. }
  52455. if (allTransparent || child[$isTransparent]()) {
  52456. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  52457. }
  52458. }
  52459. if (first && this[_attributeNames].has(name)) {
  52460. yield new XFAAttribute(this, name, this[name]);
  52461. }
  52462. }
  52463. }
  52464. exports.XFAObject = XFAObject;
  52465. class XFAObjectArray {
  52466. constructor(max = Infinity) {
  52467. this[_max] = max;
  52468. this[_children] = [];
  52469. }
  52470. push(child) {
  52471. const len = this[_children].length;
  52472. if (len <= this[_max]) {
  52473. this[_children].push(child);
  52474. return true;
  52475. }
  52476. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  52477. return false;
  52478. }
  52479. isEmpty() {
  52480. return this[_children].length === 0;
  52481. }
  52482. dump() {
  52483. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  52484. }
  52485. [$clone]() {
  52486. const clone = new XFAObjectArray(this[_max]);
  52487. clone[_children] = this[_children].map(c => c[$clone]());
  52488. return clone;
  52489. }
  52490. get children() {
  52491. return this[_children];
  52492. }
  52493. clear() {
  52494. this[_children].length = 0;
  52495. }
  52496. }
  52497. exports.XFAObjectArray = XFAObjectArray;
  52498. class XFAAttribute {
  52499. constructor(node, name, value) {
  52500. this[_parent] = node;
  52501. this[$nodeName] = name;
  52502. this[$content] = value;
  52503. this[$consumed] = false;
  52504. this[$uid] = `attribute${uid++}`;
  52505. }
  52506. [$getParent]() {
  52507. return this[_parent];
  52508. }
  52509. [$isDataValue]() {
  52510. return true;
  52511. }
  52512. [$getDataValue]() {
  52513. return this[$content].trim();
  52514. }
  52515. [$setValue](value) {
  52516. value = value.value || "";
  52517. this[$content] = value.toString();
  52518. }
  52519. [$text]() {
  52520. return this[$content];
  52521. }
  52522. [$isDescendent](parent) {
  52523. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  52524. }
  52525. }
  52526. exports.XFAAttribute = XFAAttribute;
  52527. class XmlObject extends XFAObject {
  52528. constructor(nsId, name, attributes = {}) {
  52529. super(nsId, name);
  52530. this[$content] = "";
  52531. this[_dataValue] = null;
  52532. if (name !== "#text") {
  52533. const map = new Map();
  52534. this[_attributes] = map;
  52535. for (const [attrName, value] of Object.entries(attributes)) {
  52536. map.set(attrName, new XFAAttribute(this, attrName, value));
  52537. }
  52538. if (attributes.hasOwnProperty($nsAttributes)) {
  52539. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52540. if (dataNode !== undefined) {
  52541. if (dataNode === "dataGroup") {
  52542. this[_dataValue] = false;
  52543. } else if (dataNode === "dataValue") {
  52544. this[_dataValue] = true;
  52545. }
  52546. }
  52547. }
  52548. }
  52549. this[$consumed] = false;
  52550. }
  52551. [$toString](buf) {
  52552. const tagName = this[$nodeName];
  52553. if (tagName === "#text") {
  52554. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52555. return;
  52556. }
  52557. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52558. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52559. buf.push(`<${prefix}${utf8TagName}`);
  52560. for (const [name, value] of this[_attributes].entries()) {
  52561. const utf8Name = (0, _util.utf8StringToString)(name);
  52562. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52563. }
  52564. if (this[_dataValue] !== null) {
  52565. if (this[_dataValue]) {
  52566. buf.push(` xfa:dataNode="dataValue"`);
  52567. } else {
  52568. buf.push(` xfa:dataNode="dataGroup"`);
  52569. }
  52570. }
  52571. if (!this[$content] && this[_children].length === 0) {
  52572. buf.push("/>");
  52573. return;
  52574. }
  52575. buf.push(">");
  52576. if (this[$content]) {
  52577. if (typeof this[$content] === "string") {
  52578. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52579. } else {
  52580. this[$content][$toString](buf);
  52581. }
  52582. } else {
  52583. for (const child of this[_children]) {
  52584. child[$toString](buf);
  52585. }
  52586. }
  52587. buf.push(`</${prefix}${utf8TagName}>`);
  52588. }
  52589. [$onChild](child) {
  52590. if (this[$content]) {
  52591. const node = new XmlObject(this[$namespaceId], "#text");
  52592. this[$appendChild](node);
  52593. node[$content] = this[$content];
  52594. this[$content] = "";
  52595. }
  52596. this[$appendChild](child);
  52597. return true;
  52598. }
  52599. [$onText](str) {
  52600. this[$content] += str;
  52601. }
  52602. [$finalize]() {
  52603. if (this[$content] && this[_children].length > 0) {
  52604. const node = new XmlObject(this[$namespaceId], "#text");
  52605. this[$appendChild](node);
  52606. node[$content] = this[$content];
  52607. delete this[$content];
  52608. }
  52609. }
  52610. [$toHTML]() {
  52611. if (this[$nodeName] === "#text") {
  52612. return _utils.HTMLResult.success({
  52613. name: "#text",
  52614. value: this[$content]
  52615. });
  52616. }
  52617. return _utils.HTMLResult.EMPTY;
  52618. }
  52619. [$getChildren](name = null) {
  52620. if (!name) {
  52621. return this[_children];
  52622. }
  52623. return this[_children].filter(c => c[$nodeName] === name);
  52624. }
  52625. [$getAttributes]() {
  52626. return this[_attributes];
  52627. }
  52628. [$getChildrenByClass](name) {
  52629. const value = this[_attributes].get(name);
  52630. if (value !== undefined) {
  52631. return value;
  52632. }
  52633. return this[$getChildren](name);
  52634. }
  52635. *[$getChildrenByNameIt](name, allTransparent) {
  52636. const value = this[_attributes].get(name);
  52637. if (value) {
  52638. yield value;
  52639. }
  52640. for (const child of this[_children]) {
  52641. if (child[$nodeName] === name) {
  52642. yield child;
  52643. }
  52644. if (allTransparent) {
  52645. yield* child[$getChildrenByNameIt](name, allTransparent);
  52646. }
  52647. }
  52648. }
  52649. *[$getAttributeIt](name, skipConsumed) {
  52650. const value = this[_attributes].get(name);
  52651. if (value && (!skipConsumed || !value[$consumed])) {
  52652. yield value;
  52653. }
  52654. for (const child of this[_children]) {
  52655. yield* child[$getAttributeIt](name, skipConsumed);
  52656. }
  52657. }
  52658. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52659. for (const child of this[_children]) {
  52660. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52661. yield child;
  52662. }
  52663. if (allTransparent) {
  52664. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52665. }
  52666. }
  52667. }
  52668. [$isDataValue]() {
  52669. if (this[_dataValue] === null) {
  52670. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52671. }
  52672. return this[_dataValue];
  52673. }
  52674. [$getDataValue]() {
  52675. if (this[_dataValue] === null) {
  52676. if (this[_children].length === 0) {
  52677. return this[$content].trim();
  52678. }
  52679. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52680. return this[_children][0][$text]().trim();
  52681. }
  52682. return null;
  52683. }
  52684. return this[$content].trim();
  52685. }
  52686. [$setValue](value) {
  52687. value = value.value || "";
  52688. this[$content] = value.toString();
  52689. }
  52690. [$dump](hasNS = false) {
  52691. const dumped = Object.create(null);
  52692. if (hasNS) {
  52693. dumped.$ns = this[$namespaceId];
  52694. }
  52695. if (this[$content]) {
  52696. dumped.$content = this[$content];
  52697. }
  52698. dumped.$name = this[$nodeName];
  52699. dumped.children = [];
  52700. for (const child of this[_children]) {
  52701. dumped.children.push(child[$dump](hasNS));
  52702. }
  52703. dumped.attributes = Object.create(null);
  52704. for (const [name, value] of this[_attributes]) {
  52705. dumped.attributes[name] = value[$content];
  52706. }
  52707. return dumped;
  52708. }
  52709. }
  52710. exports.XmlObject = XmlObject;
  52711. class ContentObject extends XFAObject {
  52712. constructor(nsId, name) {
  52713. super(nsId, name);
  52714. this[$content] = "";
  52715. }
  52716. [$onText](text) {
  52717. this[$content] += text;
  52718. }
  52719. [$finalize]() {}
  52720. }
  52721. exports.ContentObject = ContentObject;
  52722. class OptionObject extends ContentObject {
  52723. constructor(nsId, name, options) {
  52724. super(nsId, name);
  52725. this[_options] = options;
  52726. }
  52727. [$finalize]() {
  52728. this[$content] = (0, _utils.getKeyword)({
  52729. data: this[$content],
  52730. defaultValue: this[_options][0],
  52731. validate: k => this[_options].includes(k)
  52732. });
  52733. }
  52734. [$clean](builder) {
  52735. super[$clean](builder);
  52736. delete this[_options];
  52737. }
  52738. }
  52739. exports.OptionObject = OptionObject;
  52740. class StringObject extends ContentObject {
  52741. [$finalize]() {
  52742. this[$content] = this[$content].trim();
  52743. }
  52744. }
  52745. exports.StringObject = StringObject;
  52746. class IntegerObject extends ContentObject {
  52747. constructor(nsId, name, defaultValue, validator) {
  52748. super(nsId, name);
  52749. this[_defaultValue] = defaultValue;
  52750. this[_validator] = validator;
  52751. }
  52752. [$finalize]() {
  52753. this[$content] = (0, _utils.getInteger)({
  52754. data: this[$content],
  52755. defaultValue: this[_defaultValue],
  52756. validate: this[_validator]
  52757. });
  52758. }
  52759. [$clean](builder) {
  52760. super[$clean](builder);
  52761. delete this[_defaultValue];
  52762. delete this[_validator];
  52763. }
  52764. }
  52765. exports.IntegerObject = IntegerObject;
  52766. class Option01 extends IntegerObject {
  52767. constructor(nsId, name) {
  52768. super(nsId, name, 0, n => n === 1);
  52769. }
  52770. }
  52771. exports.Option01 = Option01;
  52772. class Option10 extends IntegerObject {
  52773. constructor(nsId, name) {
  52774. super(nsId, name, 1, n => n === 0);
  52775. }
  52776. }
  52777. exports.Option10 = Option10;
  52778. /***/ }),
  52779. /* 76 */
  52780. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52781. Object.defineProperty(exports, "__esModule", ({
  52782. value: true
  52783. }));
  52784. exports.HTMLResult = void 0;
  52785. exports.getBBox = getBBox;
  52786. exports.getColor = getColor;
  52787. exports.getFloat = getFloat;
  52788. exports.getInteger = getInteger;
  52789. exports.getKeyword = getKeyword;
  52790. exports.getMeasurement = getMeasurement;
  52791. exports.getRatio = getRatio;
  52792. exports.getRelevant = getRelevant;
  52793. exports.getStringOption = getStringOption;
  52794. exports.stripQuotes = stripQuotes;
  52795. var _util = __w_pdfjs_require__(2);
  52796. const dimConverters = {
  52797. pt: x => x,
  52798. cm: x => x / 2.54 * 72,
  52799. mm: x => x / (10 * 2.54) * 72,
  52800. in: x => x * 72,
  52801. px: x => x
  52802. };
  52803. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52804. function stripQuotes(str) {
  52805. if (str.startsWith("'") || str.startsWith('"')) {
  52806. return str.slice(1, str.length - 1);
  52807. }
  52808. return str;
  52809. }
  52810. function getInteger({
  52811. data,
  52812. defaultValue,
  52813. validate
  52814. }) {
  52815. if (!data) {
  52816. return defaultValue;
  52817. }
  52818. data = data.trim();
  52819. const n = parseInt(data, 10);
  52820. if (!isNaN(n) && validate(n)) {
  52821. return n;
  52822. }
  52823. return defaultValue;
  52824. }
  52825. function getFloat({
  52826. data,
  52827. defaultValue,
  52828. validate
  52829. }) {
  52830. if (!data) {
  52831. return defaultValue;
  52832. }
  52833. data = data.trim();
  52834. const n = parseFloat(data);
  52835. if (!isNaN(n) && validate(n)) {
  52836. return n;
  52837. }
  52838. return defaultValue;
  52839. }
  52840. function getKeyword({
  52841. data,
  52842. defaultValue,
  52843. validate
  52844. }) {
  52845. if (!data) {
  52846. return defaultValue;
  52847. }
  52848. data = data.trim();
  52849. if (validate(data)) {
  52850. return data;
  52851. }
  52852. return defaultValue;
  52853. }
  52854. function getStringOption(data, options) {
  52855. return getKeyword({
  52856. data,
  52857. defaultValue: options[0],
  52858. validate: k => options.includes(k)
  52859. });
  52860. }
  52861. function getMeasurement(str, def = "0") {
  52862. def = def || "0";
  52863. if (!str) {
  52864. return getMeasurement(def);
  52865. }
  52866. const match = str.trim().match(measurementPattern);
  52867. if (!match) {
  52868. return getMeasurement(def);
  52869. }
  52870. const [, valueStr, unit] = match;
  52871. const value = parseFloat(valueStr);
  52872. if (isNaN(value)) {
  52873. return getMeasurement(def);
  52874. }
  52875. if (value === 0) {
  52876. return 0;
  52877. }
  52878. const conv = dimConverters[unit];
  52879. if (conv) {
  52880. return conv(value);
  52881. }
  52882. return value;
  52883. }
  52884. function getRatio(data) {
  52885. if (!data) {
  52886. return {
  52887. num: 1,
  52888. den: 1
  52889. };
  52890. }
  52891. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52892. if (ratio.length === 1) {
  52893. ratio.push(1);
  52894. }
  52895. if (ratio.length === 0) {
  52896. return {
  52897. num: 1,
  52898. den: 1
  52899. };
  52900. }
  52901. const [num, den] = ratio;
  52902. return {
  52903. num,
  52904. den
  52905. };
  52906. }
  52907. function getRelevant(data) {
  52908. if (!data) {
  52909. return [];
  52910. }
  52911. return data.trim().split(/\s+/).map(e => {
  52912. return {
  52913. excluded: e[0] === "-",
  52914. viewname: e.substring(1)
  52915. };
  52916. });
  52917. }
  52918. function getColor(data, def = [0, 0, 0]) {
  52919. let [r, g, b] = def;
  52920. if (!data) {
  52921. return {
  52922. r,
  52923. g,
  52924. b
  52925. };
  52926. }
  52927. 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);
  52928. if (color.length < 3) {
  52929. return {
  52930. r,
  52931. g,
  52932. b
  52933. };
  52934. }
  52935. [r, g, b] = color;
  52936. return {
  52937. r,
  52938. g,
  52939. b
  52940. };
  52941. }
  52942. function getBBox(data) {
  52943. const def = -1;
  52944. if (!data) {
  52945. return {
  52946. x: def,
  52947. y: def,
  52948. width: def,
  52949. height: def
  52950. };
  52951. }
  52952. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52953. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52954. return {
  52955. x: def,
  52956. y: def,
  52957. width: def,
  52958. height: def
  52959. };
  52960. }
  52961. const [x, y, width, height] = bbox;
  52962. return {
  52963. x,
  52964. y,
  52965. width,
  52966. height
  52967. };
  52968. }
  52969. class HTMLResult {
  52970. static get FAILURE() {
  52971. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  52972. }
  52973. static get EMPTY() {
  52974. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  52975. }
  52976. constructor(success, html, bbox, breakNode) {
  52977. this.success = success;
  52978. this.html = html;
  52979. this.bbox = bbox;
  52980. this.breakNode = breakNode;
  52981. }
  52982. isBreak() {
  52983. return !!this.breakNode;
  52984. }
  52985. static breakNode(node) {
  52986. return new HTMLResult(false, null, null, node);
  52987. }
  52988. static success(html, bbox = null) {
  52989. return new HTMLResult(true, html, bbox, null);
  52990. }
  52991. }
  52992. exports.HTMLResult = HTMLResult;
  52993. /***/ }),
  52994. /* 77 */
  52995. /***/ ((__unused_webpack_module, exports) => {
  52996. Object.defineProperty(exports, "__esModule", ({
  52997. value: true
  52998. }));
  52999. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  53000. const $buildXFAObject = Symbol();
  53001. exports.$buildXFAObject = $buildXFAObject;
  53002. const NamespaceIds = {
  53003. config: {
  53004. id: 0,
  53005. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  53006. },
  53007. connectionSet: {
  53008. id: 1,
  53009. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  53010. },
  53011. datasets: {
  53012. id: 2,
  53013. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  53014. },
  53015. form: {
  53016. id: 3,
  53017. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  53018. },
  53019. localeSet: {
  53020. id: 4,
  53021. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  53022. },
  53023. pdf: {
  53024. id: 5,
  53025. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  53026. },
  53027. signature: {
  53028. id: 6,
  53029. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  53030. },
  53031. sourceSet: {
  53032. id: 7,
  53033. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  53034. },
  53035. stylesheet: {
  53036. id: 8,
  53037. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  53038. },
  53039. template: {
  53040. id: 9,
  53041. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  53042. },
  53043. xdc: {
  53044. id: 10,
  53045. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  53046. },
  53047. xdp: {
  53048. id: 11,
  53049. check: ns => ns === "http://ns.adobe.com/xdp/"
  53050. },
  53051. xfdf: {
  53052. id: 12,
  53053. check: ns => ns === "http://ns.adobe.com/xfdf/"
  53054. },
  53055. xhtml: {
  53056. id: 13,
  53057. check: ns => ns === "http://www.w3.org/1999/xhtml"
  53058. },
  53059. xmpmeta: {
  53060. id: 14,
  53061. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  53062. }
  53063. };
  53064. exports.NamespaceIds = NamespaceIds;
  53065. /***/ }),
  53066. /* 78 */
  53067. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53068. Object.defineProperty(exports, "__esModule", ({
  53069. value: true
  53070. }));
  53071. exports.createDataNode = createDataNode;
  53072. exports.searchNode = searchNode;
  53073. var _xfa_object = __w_pdfjs_require__(75);
  53074. var _namespaces = __w_pdfjs_require__(77);
  53075. var _util = __w_pdfjs_require__(2);
  53076. const namePattern = /^[^.[]+/;
  53077. const indexPattern = /^[^\]]+/;
  53078. const operators = {
  53079. dot: 0,
  53080. dotDot: 1,
  53081. dotHash: 2,
  53082. dotBracket: 3,
  53083. dotParen: 4
  53084. };
  53085. 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]]);
  53086. const somCache = new WeakMap();
  53087. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53088. function parseIndex(index) {
  53089. index = index.trim();
  53090. if (index === "*") {
  53091. return Infinity;
  53092. }
  53093. return parseInt(index, 10) || 0;
  53094. }
  53095. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  53096. let match = expr.match(namePattern);
  53097. if (!match) {
  53098. return null;
  53099. }
  53100. let [name] = match;
  53101. const parsed = [{
  53102. name,
  53103. cacheName: "." + name,
  53104. index: 0,
  53105. js: null,
  53106. formCalc: null,
  53107. operator: operators.dot
  53108. }];
  53109. let pos = name.length;
  53110. while (pos < expr.length) {
  53111. const spos = pos;
  53112. const char = expr.charAt(pos++);
  53113. if (char === "[") {
  53114. match = expr.slice(pos).match(indexPattern);
  53115. if (!match) {
  53116. (0, _util.warn)("XFA - Invalid index in SOM expression");
  53117. return null;
  53118. }
  53119. parsed.at(-1).index = parseIndex(match[0]);
  53120. pos += match[0].length + 1;
  53121. continue;
  53122. }
  53123. let operator;
  53124. switch (expr.charAt(pos)) {
  53125. case ".":
  53126. if (!dotDotAllowed) {
  53127. return null;
  53128. }
  53129. pos++;
  53130. operator = operators.dotDot;
  53131. break;
  53132. case "#":
  53133. pos++;
  53134. operator = operators.dotHash;
  53135. break;
  53136. case "[":
  53137. if (noExpr) {
  53138. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  53139. return null;
  53140. }
  53141. operator = operators.dotBracket;
  53142. break;
  53143. case "(":
  53144. if (noExpr) {
  53145. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  53146. return null;
  53147. }
  53148. operator = operators.dotParen;
  53149. break;
  53150. default:
  53151. operator = operators.dot;
  53152. break;
  53153. }
  53154. match = expr.slice(pos).match(namePattern);
  53155. if (!match) {
  53156. break;
  53157. }
  53158. [name] = match;
  53159. pos += name.length;
  53160. parsed.push({
  53161. name,
  53162. cacheName: expr.slice(spos, pos),
  53163. operator,
  53164. index: 0,
  53165. js: null,
  53166. formCalc: null
  53167. });
  53168. }
  53169. return parsed;
  53170. }
  53171. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  53172. const parsed = parseExpression(expr, dotDotAllowed);
  53173. if (!parsed) {
  53174. return null;
  53175. }
  53176. const fn = shortcuts.get(parsed[0].name);
  53177. let i = 0;
  53178. let isQualified;
  53179. if (fn) {
  53180. isQualified = true;
  53181. root = [fn(root, container)];
  53182. i = 1;
  53183. } else {
  53184. isQualified = container === null;
  53185. root = [container || root];
  53186. }
  53187. for (let ii = parsed.length; i < ii; i++) {
  53188. const {
  53189. name,
  53190. cacheName,
  53191. operator,
  53192. index
  53193. } = parsed[i];
  53194. const nodes = [];
  53195. for (const node of root) {
  53196. if (!(node instanceof _xfa_object.XFAObject)) {
  53197. continue;
  53198. }
  53199. let children, cached;
  53200. if (useCache) {
  53201. cached = somCache.get(node);
  53202. if (!cached) {
  53203. cached = new Map();
  53204. somCache.set(node, cached);
  53205. }
  53206. children = cached.get(cacheName);
  53207. }
  53208. if (!children) {
  53209. switch (operator) {
  53210. case operators.dot:
  53211. children = node[_xfa_object.$getChildrenByName](name, false);
  53212. break;
  53213. case operators.dotDot:
  53214. children = node[_xfa_object.$getChildrenByName](name, true);
  53215. break;
  53216. case operators.dotHash:
  53217. children = node[_xfa_object.$getChildrenByClass](name);
  53218. if (children instanceof _xfa_object.XFAObjectArray) {
  53219. children = children.children;
  53220. } else {
  53221. children = [children];
  53222. }
  53223. break;
  53224. default:
  53225. break;
  53226. }
  53227. if (useCache) {
  53228. cached.set(cacheName, children);
  53229. }
  53230. }
  53231. if (children.length > 0) {
  53232. nodes.push(children);
  53233. }
  53234. }
  53235. if (nodes.length === 0 && !isQualified && i === 0) {
  53236. const parent = container[_xfa_object.$getParent]();
  53237. container = parent;
  53238. if (!container) {
  53239. return null;
  53240. }
  53241. i = -1;
  53242. root = [container];
  53243. continue;
  53244. }
  53245. if (isFinite(index)) {
  53246. root = nodes.filter(node => index < node.length).map(node => node[index]);
  53247. } else {
  53248. root = nodes.flat();
  53249. }
  53250. }
  53251. if (root.length === 0) {
  53252. return null;
  53253. }
  53254. return root;
  53255. }
  53256. function createNodes(root, path) {
  53257. let node = null;
  53258. for (const {
  53259. name,
  53260. index
  53261. } of path) {
  53262. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  53263. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  53264. node = new _xfa_object.XmlObject(nsId, name);
  53265. root[_xfa_object.$appendChild](node);
  53266. }
  53267. root = node;
  53268. }
  53269. return node;
  53270. }
  53271. function createDataNode(root, container, expr) {
  53272. const parsed = parseExpression(expr);
  53273. if (!parsed) {
  53274. return null;
  53275. }
  53276. if (parsed.some(x => x.operator === operators.dotDot)) {
  53277. return null;
  53278. }
  53279. const fn = shortcuts.get(parsed[0].name);
  53280. let i = 0;
  53281. if (fn) {
  53282. root = fn(root, container);
  53283. i = 1;
  53284. } else {
  53285. root = container || root;
  53286. }
  53287. for (let ii = parsed.length; i < ii; i++) {
  53288. const {
  53289. name,
  53290. operator,
  53291. index
  53292. } = parsed[i];
  53293. if (!isFinite(index)) {
  53294. parsed[i].index = 0;
  53295. return createNodes(root, parsed.slice(i));
  53296. }
  53297. let children;
  53298. switch (operator) {
  53299. case operators.dot:
  53300. children = root[_xfa_object.$getChildrenByName](name, false);
  53301. break;
  53302. case operators.dotDot:
  53303. children = root[_xfa_object.$getChildrenByName](name, true);
  53304. break;
  53305. case operators.dotHash:
  53306. children = root[_xfa_object.$getChildrenByClass](name);
  53307. if (children instanceof _xfa_object.XFAObjectArray) {
  53308. children = children.children;
  53309. } else {
  53310. children = [children];
  53311. }
  53312. break;
  53313. default:
  53314. break;
  53315. }
  53316. if (children.length === 0) {
  53317. return createNodes(root, parsed.slice(i));
  53318. }
  53319. if (index < children.length) {
  53320. const child = children[index];
  53321. if (!(child instanceof _xfa_object.XFAObject)) {
  53322. (0, _util.warn)(`XFA - Cannot create a node.`);
  53323. return null;
  53324. }
  53325. root = child;
  53326. } else {
  53327. parsed[i].index = index - children.length;
  53328. return createNodes(root, parsed.slice(i));
  53329. }
  53330. }
  53331. return null;
  53332. }
  53333. /***/ }),
  53334. /* 79 */
  53335. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53336. Object.defineProperty(exports, "__esModule", ({
  53337. value: true
  53338. }));
  53339. exports.Binder = void 0;
  53340. var _xfa_object = __w_pdfjs_require__(75);
  53341. var _template = __w_pdfjs_require__(80);
  53342. var _som = __w_pdfjs_require__(78);
  53343. var _namespaces = __w_pdfjs_require__(77);
  53344. var _util = __w_pdfjs_require__(2);
  53345. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53346. function createText(content) {
  53347. const node = new _template.Text({});
  53348. node[_xfa_object.$content] = content;
  53349. return node;
  53350. }
  53351. class Binder {
  53352. constructor(root) {
  53353. this.root = root;
  53354. this.datasets = root.datasets;
  53355. if (root.datasets && root.datasets.data) {
  53356. this.data = root.datasets.data;
  53357. } else {
  53358. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  53359. }
  53360. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  53361. this.root.form = this.form = root.template[_xfa_object.$clone]();
  53362. }
  53363. _isConsumeData() {
  53364. return !this.emptyMerge && this._mergeMode;
  53365. }
  53366. _isMatchTemplate() {
  53367. return !this._isConsumeData();
  53368. }
  53369. bind() {
  53370. this._bindElement(this.form, this.data);
  53371. return this.form;
  53372. }
  53373. getData() {
  53374. return this.data;
  53375. }
  53376. _bindValue(formNode, data, picture) {
  53377. formNode[_xfa_object.$data] = data;
  53378. if (formNode[_xfa_object.$hasSettableValue]()) {
  53379. if (data[_xfa_object.$isDataValue]()) {
  53380. const value = data[_xfa_object.$getDataValue]();
  53381. formNode[_xfa_object.$setValue](createText(value));
  53382. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  53383. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  53384. formNode[_xfa_object.$setValue](createText(value));
  53385. } else if (this._isConsumeData()) {
  53386. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53387. }
  53388. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  53389. this._bindElement(formNode, data);
  53390. } else {
  53391. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53392. }
  53393. }
  53394. _findDataByNameToConsume(name, isValue, dataNode, global) {
  53395. if (!name) {
  53396. return null;
  53397. }
  53398. let generator, match;
  53399. for (let i = 0; i < 3; i++) {
  53400. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  53401. while (true) {
  53402. match = generator.next().value;
  53403. if (!match) {
  53404. break;
  53405. }
  53406. if (isValue === match[_xfa_object.$isDataValue]()) {
  53407. return match;
  53408. }
  53409. }
  53410. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  53411. break;
  53412. }
  53413. dataNode = dataNode[_xfa_object.$getParent]();
  53414. }
  53415. if (!global) {
  53416. return null;
  53417. }
  53418. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  53419. match = generator.next().value;
  53420. if (match) {
  53421. return match;
  53422. }
  53423. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  53424. match = generator.next().value;
  53425. if (match && match[_xfa_object.$isDataValue]()) {
  53426. return match;
  53427. }
  53428. return null;
  53429. }
  53430. _setProperties(formNode, dataNode) {
  53431. if (!formNode.hasOwnProperty("setProperty")) {
  53432. return;
  53433. }
  53434. for (const {
  53435. ref,
  53436. target,
  53437. connection
  53438. } of formNode.setProperty.children) {
  53439. if (connection) {
  53440. continue;
  53441. }
  53442. if (!ref) {
  53443. continue;
  53444. }
  53445. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53446. if (!nodes) {
  53447. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53448. continue;
  53449. }
  53450. const [node] = nodes;
  53451. if (!node[_xfa_object.$isDescendent](this.data)) {
  53452. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  53453. continue;
  53454. }
  53455. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  53456. if (!targetNodes) {
  53457. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  53458. continue;
  53459. }
  53460. const [targetNode] = targetNodes;
  53461. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  53462. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  53463. continue;
  53464. }
  53465. const targetParent = targetNode[_xfa_object.$getParent]();
  53466. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  53467. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  53468. continue;
  53469. }
  53470. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  53471. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  53472. continue;
  53473. }
  53474. const content = node[_xfa_object.$text]();
  53475. const name = targetNode[_xfa_object.$nodeName];
  53476. if (targetNode instanceof _xfa_object.XFAAttribute) {
  53477. const attrs = Object.create(null);
  53478. attrs[name] = content;
  53479. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  53480. targetParent[name] = obj[name];
  53481. continue;
  53482. }
  53483. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  53484. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  53485. continue;
  53486. }
  53487. targetNode[_xfa_object.$data] = node;
  53488. targetNode[_xfa_object.$content] = content;
  53489. targetNode[_xfa_object.$finalize]();
  53490. }
  53491. }
  53492. _bindItems(formNode, dataNode) {
  53493. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  53494. return;
  53495. }
  53496. for (const item of formNode.items.children) {
  53497. formNode[_xfa_object.$removeChild](item);
  53498. }
  53499. formNode.items.clear();
  53500. const labels = new _template.Items({});
  53501. const values = new _template.Items({});
  53502. formNode[_xfa_object.$appendChild](labels);
  53503. formNode.items.push(labels);
  53504. formNode[_xfa_object.$appendChild](values);
  53505. formNode.items.push(values);
  53506. for (const {
  53507. ref,
  53508. labelRef,
  53509. valueRef,
  53510. connection
  53511. } of formNode.bindItems.children) {
  53512. if (connection) {
  53513. continue;
  53514. }
  53515. if (!ref) {
  53516. continue;
  53517. }
  53518. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53519. if (!nodes) {
  53520. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53521. continue;
  53522. }
  53523. for (const node of nodes) {
  53524. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  53525. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  53526. continue;
  53527. }
  53528. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  53529. if (!labelNodes) {
  53530. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  53531. continue;
  53532. }
  53533. const [labelNode] = labelNodes;
  53534. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53535. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53536. continue;
  53537. }
  53538. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53539. if (!valueNodes) {
  53540. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53541. continue;
  53542. }
  53543. const [valueNode] = valueNodes;
  53544. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53545. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53546. continue;
  53547. }
  53548. const label = createText(labelNode[_xfa_object.$text]());
  53549. const value = createText(valueNode[_xfa_object.$text]());
  53550. labels[_xfa_object.$appendChild](label);
  53551. labels.text.push(label);
  53552. values[_xfa_object.$appendChild](value);
  53553. values.text.push(value);
  53554. }
  53555. }
  53556. }
  53557. _bindOccurrences(formNode, matches, picture) {
  53558. let baseClone;
  53559. if (matches.length > 1) {
  53560. baseClone = formNode[_xfa_object.$clone]();
  53561. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53562. baseClone.occur = null;
  53563. }
  53564. this._bindValue(formNode, matches[0], picture);
  53565. this._setProperties(formNode, matches[0]);
  53566. this._bindItems(formNode, matches[0]);
  53567. if (matches.length === 1) {
  53568. return;
  53569. }
  53570. const parent = formNode[_xfa_object.$getParent]();
  53571. const name = formNode[_xfa_object.$nodeName];
  53572. const pos = parent[_xfa_object.$indexOf](formNode);
  53573. for (let i = 1, ii = matches.length; i < ii; i++) {
  53574. const match = matches[i];
  53575. const clone = baseClone[_xfa_object.$clone]();
  53576. parent[name].push(clone);
  53577. parent[_xfa_object.$insertAt](pos + i, clone);
  53578. this._bindValue(clone, match, picture);
  53579. this._setProperties(clone, match);
  53580. this._bindItems(clone, match);
  53581. }
  53582. }
  53583. _createOccurrences(formNode) {
  53584. if (!this.emptyMerge) {
  53585. return;
  53586. }
  53587. const {
  53588. occur
  53589. } = formNode;
  53590. if (!occur || occur.initial <= 1) {
  53591. return;
  53592. }
  53593. const parent = formNode[_xfa_object.$getParent]();
  53594. const name = formNode[_xfa_object.$nodeName];
  53595. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53596. return;
  53597. }
  53598. let currentNumber;
  53599. if (formNode.name) {
  53600. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53601. } else {
  53602. currentNumber = parent[name].children.length;
  53603. }
  53604. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53605. const ii = occur.initial - currentNumber;
  53606. if (ii) {
  53607. const nodeClone = formNode[_xfa_object.$clone]();
  53608. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53609. nodeClone.occur = null;
  53610. parent[name].push(nodeClone);
  53611. parent[_xfa_object.$insertAt](pos, nodeClone);
  53612. for (let i = 1; i < ii; i++) {
  53613. const clone = nodeClone[_xfa_object.$clone]();
  53614. parent[name].push(clone);
  53615. parent[_xfa_object.$insertAt](pos + i, clone);
  53616. }
  53617. }
  53618. }
  53619. _getOccurInfo(formNode) {
  53620. const {
  53621. name,
  53622. occur
  53623. } = formNode;
  53624. if (!occur || !name) {
  53625. return [1, 1];
  53626. }
  53627. const max = occur.max === -1 ? Infinity : occur.max;
  53628. return [occur.min, max];
  53629. }
  53630. _setAndBind(formNode, dataNode) {
  53631. this._setProperties(formNode, dataNode);
  53632. this._bindItems(formNode, dataNode);
  53633. this._bindElement(formNode, dataNode);
  53634. }
  53635. _bindElement(formNode, dataNode) {
  53636. const uselessNodes = [];
  53637. this._createOccurrences(formNode);
  53638. for (const child of formNode[_xfa_object.$getChildren]()) {
  53639. if (child[_xfa_object.$data]) {
  53640. continue;
  53641. }
  53642. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53643. this._mergeMode = child.mergeMode === "consumeData";
  53644. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53645. if (dataChildren.length > 0) {
  53646. this._bindOccurrences(child, [dataChildren[0]], null);
  53647. } else if (this.emptyMerge) {
  53648. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53649. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53650. dataNode[_xfa_object.$appendChild](dataChild);
  53651. this._bindElement(child, dataChild);
  53652. }
  53653. continue;
  53654. }
  53655. if (!child[_xfa_object.$isBindable]()) {
  53656. continue;
  53657. }
  53658. let global = false;
  53659. let picture = null;
  53660. let ref = null;
  53661. let match = null;
  53662. if (child.bind) {
  53663. switch (child.bind.match) {
  53664. case "none":
  53665. this._setAndBind(child, dataNode);
  53666. continue;
  53667. case "global":
  53668. global = true;
  53669. break;
  53670. case "dataRef":
  53671. if (!child.bind.ref) {
  53672. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53673. this._setAndBind(child, dataNode);
  53674. continue;
  53675. }
  53676. ref = child.bind.ref;
  53677. break;
  53678. default:
  53679. break;
  53680. }
  53681. if (child.bind.picture) {
  53682. picture = child.bind.picture[_xfa_object.$content];
  53683. }
  53684. }
  53685. const [min, max] = this._getOccurInfo(child);
  53686. if (ref) {
  53687. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53688. if (match === null) {
  53689. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53690. if (!match) {
  53691. continue;
  53692. }
  53693. if (this._isConsumeData()) {
  53694. match[_xfa_object.$consumed] = true;
  53695. }
  53696. this._setAndBind(child, match);
  53697. continue;
  53698. } else {
  53699. if (this._isConsumeData()) {
  53700. match = match.filter(node => !node[_xfa_object.$consumed]);
  53701. }
  53702. if (match.length > max) {
  53703. match = match.slice(0, max);
  53704. } else if (match.length === 0) {
  53705. match = null;
  53706. }
  53707. if (match && this._isConsumeData()) {
  53708. match.forEach(node => {
  53709. node[_xfa_object.$consumed] = true;
  53710. });
  53711. }
  53712. }
  53713. } else {
  53714. if (!child.name) {
  53715. this._setAndBind(child, dataNode);
  53716. continue;
  53717. }
  53718. if (this._isConsumeData()) {
  53719. const matches = [];
  53720. while (matches.length < max) {
  53721. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53722. if (!found) {
  53723. break;
  53724. }
  53725. found[_xfa_object.$consumed] = true;
  53726. matches.push(found);
  53727. }
  53728. match = matches.length > 0 ? matches : null;
  53729. } else {
  53730. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53731. if (!match) {
  53732. if (min === 0) {
  53733. uselessNodes.push(child);
  53734. continue;
  53735. }
  53736. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53737. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53738. if (this.emptyMerge) {
  53739. match[_xfa_object.$consumed] = true;
  53740. }
  53741. dataNode[_xfa_object.$appendChild](match);
  53742. this._setAndBind(child, match);
  53743. continue;
  53744. }
  53745. if (this.emptyMerge) {
  53746. match[_xfa_object.$consumed] = true;
  53747. }
  53748. match = [match];
  53749. }
  53750. }
  53751. if (match) {
  53752. this._bindOccurrences(child, match, picture);
  53753. } else if (min > 0) {
  53754. this._setAndBind(child, dataNode);
  53755. } else {
  53756. uselessNodes.push(child);
  53757. }
  53758. }
  53759. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53760. }
  53761. }
  53762. exports.Binder = Binder;
  53763. /***/ }),
  53764. /* 80 */
  53765. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53766. Object.defineProperty(exports, "__esModule", ({
  53767. value: true
  53768. }));
  53769. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53770. var _xfa_object = __w_pdfjs_require__(75);
  53771. var _namespaces = __w_pdfjs_require__(77);
  53772. var _layout = __w_pdfjs_require__(81);
  53773. var _html_utils = __w_pdfjs_require__(82);
  53774. var _utils = __w_pdfjs_require__(76);
  53775. var _util = __w_pdfjs_require__(2);
  53776. var _fonts = __w_pdfjs_require__(83);
  53777. var _core_utils = __w_pdfjs_require__(4);
  53778. var _som = __w_pdfjs_require__(78);
  53779. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53780. const SVG_NS = "http://www.w3.org/2000/svg";
  53781. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53782. const MAX_EMPTY_PAGES = 3;
  53783. const DEFAULT_TAB_INDEX = 5000;
  53784. const HEADING_PATTERN = /^H(\d+)$/;
  53785. 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"]);
  53786. 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"]];
  53787. function getBorderDims(node) {
  53788. if (!node || !node.border) {
  53789. return {
  53790. w: 0,
  53791. h: 0
  53792. };
  53793. }
  53794. const borderExtra = node.border[_xfa_object.$getExtra]();
  53795. if (!borderExtra) {
  53796. return {
  53797. w: 0,
  53798. h: 0
  53799. };
  53800. }
  53801. return {
  53802. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53803. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53804. };
  53805. }
  53806. function hasMargin(node) {
  53807. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53808. }
  53809. function _setValue(templateNode, value) {
  53810. if (!templateNode.value) {
  53811. const nodeValue = new Value({});
  53812. templateNode[_xfa_object.$appendChild](nodeValue);
  53813. templateNode.value = nodeValue;
  53814. }
  53815. templateNode.value[_xfa_object.$setValue](value);
  53816. }
  53817. function* getContainedChildren(node) {
  53818. for (const child of node[_xfa_object.$getChildren]()) {
  53819. if (child instanceof SubformSet) {
  53820. yield* child[_xfa_object.$getContainedChildren]();
  53821. continue;
  53822. }
  53823. yield child;
  53824. }
  53825. }
  53826. function isRequired(node) {
  53827. return node.validate && node.validate.nullTest === "error";
  53828. }
  53829. function setTabIndex(node) {
  53830. while (node) {
  53831. if (!node.traversal) {
  53832. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53833. return;
  53834. }
  53835. if (node[_xfa_object.$tabIndex]) {
  53836. return;
  53837. }
  53838. let next = null;
  53839. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53840. if (child.operation === "next") {
  53841. next = child;
  53842. break;
  53843. }
  53844. }
  53845. if (!next || !next.ref) {
  53846. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53847. return;
  53848. }
  53849. const root = node[_xfa_object.$getTemplateRoot]();
  53850. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53851. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53852. if (!ref) {
  53853. return;
  53854. }
  53855. node = ref[0];
  53856. }
  53857. }
  53858. function applyAssist(obj, attributes) {
  53859. const assist = obj.assist;
  53860. if (assist) {
  53861. const assistTitle = assist[_xfa_object.$toHTML]();
  53862. if (assistTitle) {
  53863. attributes.title = assistTitle;
  53864. }
  53865. const role = assist.role;
  53866. const match = role.match(HEADING_PATTERN);
  53867. if (match) {
  53868. const ariaRole = "heading";
  53869. const ariaLevel = match[1];
  53870. attributes.role = ariaRole;
  53871. attributes["aria-level"] = ariaLevel;
  53872. }
  53873. }
  53874. if (obj.layout === "table") {
  53875. attributes.role = "table";
  53876. } else if (obj.layout === "row") {
  53877. attributes.role = "row";
  53878. } else {
  53879. const parent = obj[_xfa_object.$getParent]();
  53880. if (parent.layout === "row") {
  53881. if (parent.assist && parent.assist.role === "TH") {
  53882. attributes.role = "columnheader";
  53883. } else {
  53884. attributes.role = "cell";
  53885. }
  53886. }
  53887. }
  53888. }
  53889. function ariaLabel(obj) {
  53890. if (!obj.assist) {
  53891. return null;
  53892. }
  53893. const assist = obj.assist;
  53894. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53895. return assist.speak[_xfa_object.$content];
  53896. }
  53897. if (assist.toolTip) {
  53898. return assist.toolTip[_xfa_object.$content];
  53899. }
  53900. return null;
  53901. }
  53902. function valueToHtml(value) {
  53903. return _utils.HTMLResult.success({
  53904. name: "div",
  53905. attributes: {
  53906. class: ["xfaRich"],
  53907. style: Object.create(null)
  53908. },
  53909. children: [{
  53910. name: "span",
  53911. attributes: {
  53912. style: Object.create(null)
  53913. },
  53914. value
  53915. }]
  53916. });
  53917. }
  53918. function setFirstUnsplittable(node) {
  53919. const root = node[_xfa_object.$getTemplateRoot]();
  53920. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53921. root[_xfa_object.$extra].firstUnsplittable = node;
  53922. root[_xfa_object.$extra].noLayoutFailure = true;
  53923. }
  53924. }
  53925. function unsetFirstUnsplittable(node) {
  53926. const root = node[_xfa_object.$getTemplateRoot]();
  53927. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53928. root[_xfa_object.$extra].noLayoutFailure = false;
  53929. }
  53930. }
  53931. function handleBreak(node) {
  53932. if (node[_xfa_object.$extra]) {
  53933. return false;
  53934. }
  53935. node[_xfa_object.$extra] = Object.create(null);
  53936. if (node.targetType === "auto") {
  53937. return false;
  53938. }
  53939. const root = node[_xfa_object.$getTemplateRoot]();
  53940. let target = null;
  53941. if (node.target) {
  53942. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53943. if (!target) {
  53944. return false;
  53945. }
  53946. target = target[0];
  53947. }
  53948. const {
  53949. currentPageArea,
  53950. currentContentArea
  53951. } = root[_xfa_object.$extra];
  53952. if (node.targetType === "pageArea") {
  53953. if (!(target instanceof PageArea)) {
  53954. target = null;
  53955. }
  53956. if (node.startNew) {
  53957. node[_xfa_object.$extra].target = target || currentPageArea;
  53958. return true;
  53959. } else if (target && target !== currentPageArea) {
  53960. node[_xfa_object.$extra].target = target;
  53961. return true;
  53962. }
  53963. return false;
  53964. }
  53965. if (!(target instanceof ContentArea)) {
  53966. target = null;
  53967. }
  53968. const pageArea = target && target[_xfa_object.$getParent]();
  53969. let index;
  53970. let nextPageArea = pageArea;
  53971. if (node.startNew) {
  53972. if (target) {
  53973. const contentAreas = pageArea.contentArea.children;
  53974. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  53975. const indexForTarget = contentAreas.indexOf(target);
  53976. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  53977. nextPageArea = null;
  53978. }
  53979. index = indexForTarget - 1;
  53980. } else {
  53981. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  53982. }
  53983. } else if (target && target !== currentContentArea) {
  53984. const contentAreas = pageArea.contentArea.children;
  53985. index = contentAreas.indexOf(target) - 1;
  53986. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  53987. } else {
  53988. return false;
  53989. }
  53990. node[_xfa_object.$extra].target = nextPageArea;
  53991. node[_xfa_object.$extra].index = index;
  53992. return true;
  53993. }
  53994. function handleOverflow(node, extraNode, space) {
  53995. const root = node[_xfa_object.$getTemplateRoot]();
  53996. const saved = root[_xfa_object.$extra].noLayoutFailure;
  53997. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  53998. extraNode[_xfa_object.$getSubformParent] = () => node;
  53999. root[_xfa_object.$extra].noLayoutFailure = true;
  54000. const res = extraNode[_xfa_object.$toHTML](space);
  54001. node[_xfa_object.$addHTML](res.html, res.bbox);
  54002. root[_xfa_object.$extra].noLayoutFailure = saved;
  54003. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  54004. }
  54005. class AppearanceFilter extends _xfa_object.StringObject {
  54006. constructor(attributes) {
  54007. super(TEMPLATE_NS_ID, "appearanceFilter");
  54008. this.id = attributes.id || "";
  54009. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54010. this.use = attributes.use || "";
  54011. this.usehref = attributes.usehref || "";
  54012. }
  54013. }
  54014. class Arc extends _xfa_object.XFAObject {
  54015. constructor(attributes) {
  54016. super(TEMPLATE_NS_ID, "arc", true);
  54017. this.circular = (0, _utils.getInteger)({
  54018. data: attributes.circular,
  54019. defaultValue: 0,
  54020. validate: x => x === 1
  54021. });
  54022. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54023. this.id = attributes.id || "";
  54024. this.startAngle = (0, _utils.getFloat)({
  54025. data: attributes.startAngle,
  54026. defaultValue: 0,
  54027. validate: x => true
  54028. });
  54029. this.sweepAngle = (0, _utils.getFloat)({
  54030. data: attributes.sweepAngle,
  54031. defaultValue: 360,
  54032. validate: x => true
  54033. });
  54034. this.use = attributes.use || "";
  54035. this.usehref = attributes.usehref || "";
  54036. this.edge = null;
  54037. this.fill = null;
  54038. }
  54039. [_xfa_object.$toHTML]() {
  54040. const edge = this.edge || new Edge({});
  54041. const edgeStyle = edge[_xfa_object.$toStyle]();
  54042. const style = Object.create(null);
  54043. if (this.fill && this.fill.presence === "visible") {
  54044. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54045. } else {
  54046. style.fill = "transparent";
  54047. }
  54048. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  54049. style.stroke = edgeStyle.color;
  54050. let arc;
  54051. const attributes = {
  54052. xmlns: SVG_NS,
  54053. style: {
  54054. width: "100%",
  54055. height: "100%",
  54056. overflow: "visible"
  54057. }
  54058. };
  54059. if (this.sweepAngle === 360) {
  54060. arc = {
  54061. name: "ellipse",
  54062. attributes: {
  54063. xmlns: SVG_NS,
  54064. cx: "50%",
  54065. cy: "50%",
  54066. rx: "50%",
  54067. ry: "50%",
  54068. style
  54069. }
  54070. };
  54071. } else {
  54072. const startAngle = this.startAngle * Math.PI / 180;
  54073. const sweepAngle = this.sweepAngle * Math.PI / 180;
  54074. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  54075. 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))];
  54076. arc = {
  54077. name: "path",
  54078. attributes: {
  54079. xmlns: SVG_NS,
  54080. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  54081. vectorEffect: "non-scaling-stroke",
  54082. style
  54083. }
  54084. };
  54085. Object.assign(attributes, {
  54086. viewBox: "0 0 100 100",
  54087. preserveAspectRatio: "none"
  54088. });
  54089. }
  54090. const svg = {
  54091. name: "svg",
  54092. children: [arc],
  54093. attributes
  54094. };
  54095. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54096. if (hasMargin(parent)) {
  54097. return _utils.HTMLResult.success({
  54098. name: "div",
  54099. attributes: {
  54100. style: {
  54101. display: "inline",
  54102. width: "100%",
  54103. height: "100%"
  54104. }
  54105. },
  54106. children: [svg]
  54107. });
  54108. }
  54109. svg.attributes.style.position = "absolute";
  54110. return _utils.HTMLResult.success(svg);
  54111. }
  54112. }
  54113. class Area extends _xfa_object.XFAObject {
  54114. constructor(attributes) {
  54115. super(TEMPLATE_NS_ID, "area", true);
  54116. this.colSpan = (0, _utils.getInteger)({
  54117. data: attributes.colSpan,
  54118. defaultValue: 1,
  54119. validate: n => n >= 1 || n === -1
  54120. });
  54121. this.id = attributes.id || "";
  54122. this.name = attributes.name || "";
  54123. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54124. this.use = attributes.use || "";
  54125. this.usehref = attributes.usehref || "";
  54126. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54127. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54128. this.desc = null;
  54129. this.extras = null;
  54130. this.area = new _xfa_object.XFAObjectArray();
  54131. this.draw = new _xfa_object.XFAObjectArray();
  54132. this.exObject = new _xfa_object.XFAObjectArray();
  54133. this.exclGroup = new _xfa_object.XFAObjectArray();
  54134. this.field = new _xfa_object.XFAObjectArray();
  54135. this.subform = new _xfa_object.XFAObjectArray();
  54136. this.subformSet = new _xfa_object.XFAObjectArray();
  54137. }
  54138. *[_xfa_object.$getContainedChildren]() {
  54139. yield* getContainedChildren(this);
  54140. }
  54141. [_xfa_object.$isTransparent]() {
  54142. return true;
  54143. }
  54144. [_xfa_object.$isBindable]() {
  54145. return true;
  54146. }
  54147. [_xfa_object.$addHTML](html, bbox) {
  54148. const [x, y, w, h] = bbox;
  54149. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  54150. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  54151. this[_xfa_object.$extra].children.push(html);
  54152. }
  54153. [_xfa_object.$getAvailableSpace]() {
  54154. return this[_xfa_object.$extra].availableSpace;
  54155. }
  54156. [_xfa_object.$toHTML](availableSpace) {
  54157. const style = (0, _html_utils.toStyle)(this, "position");
  54158. const attributes = {
  54159. style,
  54160. id: this[_xfa_object.$uid],
  54161. class: ["xfaArea"]
  54162. };
  54163. if ((0, _html_utils.isPrintOnly)(this)) {
  54164. attributes.class.push("xfaPrintOnly");
  54165. }
  54166. if (this.name) {
  54167. attributes.xfaName = this.name;
  54168. }
  54169. const children = [];
  54170. this[_xfa_object.$extra] = {
  54171. children,
  54172. width: 0,
  54173. height: 0,
  54174. availableSpace
  54175. };
  54176. const result = this[_xfa_object.$childrenToHTML]({
  54177. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  54178. include: true
  54179. });
  54180. if (!result.success) {
  54181. if (result.isBreak()) {
  54182. return result;
  54183. }
  54184. delete this[_xfa_object.$extra];
  54185. return _utils.HTMLResult.FAILURE;
  54186. }
  54187. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  54188. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  54189. const html = {
  54190. name: "div",
  54191. attributes,
  54192. children
  54193. };
  54194. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  54195. delete this[_xfa_object.$extra];
  54196. return _utils.HTMLResult.success(html, bbox);
  54197. }
  54198. }
  54199. class Assist extends _xfa_object.XFAObject {
  54200. constructor(attributes) {
  54201. super(TEMPLATE_NS_ID, "assist", true);
  54202. this.id = attributes.id || "";
  54203. this.role = attributes.role || "";
  54204. this.use = attributes.use || "";
  54205. this.usehref = attributes.usehref || "";
  54206. this.speak = null;
  54207. this.toolTip = null;
  54208. }
  54209. [_xfa_object.$toHTML]() {
  54210. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  54211. }
  54212. }
  54213. class Barcode extends _xfa_object.XFAObject {
  54214. constructor(attributes) {
  54215. super(TEMPLATE_NS_ID, "barcode", true);
  54216. this.charEncoding = (0, _utils.getKeyword)({
  54217. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  54218. defaultValue: "",
  54219. 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}/)
  54220. });
  54221. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  54222. this.dataColumnCount = (0, _utils.getInteger)({
  54223. data: attributes.dataColumnCount,
  54224. defaultValue: -1,
  54225. validate: x => x >= 0
  54226. });
  54227. this.dataLength = (0, _utils.getInteger)({
  54228. data: attributes.dataLength,
  54229. defaultValue: -1,
  54230. validate: x => x >= 0
  54231. });
  54232. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  54233. this.dataRowCount = (0, _utils.getInteger)({
  54234. data: attributes.dataRowCount,
  54235. defaultValue: -1,
  54236. validate: x => x >= 0
  54237. });
  54238. this.endChar = attributes.endChar || "";
  54239. this.errorCorrectionLevel = (0, _utils.getInteger)({
  54240. data: attributes.errorCorrectionLevel,
  54241. defaultValue: -1,
  54242. validate: x => x >= 0 && x <= 8
  54243. });
  54244. this.id = attributes.id || "";
  54245. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  54246. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  54247. this.printCheckDigit = (0, _utils.getInteger)({
  54248. data: attributes.printCheckDigit,
  54249. defaultValue: 0,
  54250. validate: x => x === 1
  54251. });
  54252. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  54253. this.startChar = attributes.startChar || "";
  54254. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  54255. this.truncate = (0, _utils.getInteger)({
  54256. data: attributes.truncate,
  54257. defaultValue: 0,
  54258. validate: x => x === 1
  54259. });
  54260. 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"]);
  54261. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  54262. this.use = attributes.use || "";
  54263. this.usehref = attributes.usehref || "";
  54264. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  54265. this.encrypt = null;
  54266. this.extras = null;
  54267. }
  54268. }
  54269. class Bind extends _xfa_object.XFAObject {
  54270. constructor(attributes) {
  54271. super(TEMPLATE_NS_ID, "bind", true);
  54272. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  54273. this.ref = attributes.ref || "";
  54274. this.picture = null;
  54275. }
  54276. }
  54277. class BindItems extends _xfa_object.XFAObject {
  54278. constructor(attributes) {
  54279. super(TEMPLATE_NS_ID, "bindItems");
  54280. this.connection = attributes.connection || "";
  54281. this.labelRef = attributes.labelRef || "";
  54282. this.ref = attributes.ref || "";
  54283. this.valueRef = attributes.valueRef || "";
  54284. }
  54285. }
  54286. exports.BindItems = BindItems;
  54287. class Bookend extends _xfa_object.XFAObject {
  54288. constructor(attributes) {
  54289. super(TEMPLATE_NS_ID, "bookend");
  54290. this.id = attributes.id || "";
  54291. this.leader = attributes.leader || "";
  54292. this.trailer = attributes.trailer || "";
  54293. this.use = attributes.use || "";
  54294. this.usehref = attributes.usehref || "";
  54295. }
  54296. }
  54297. class BooleanElement extends _xfa_object.Option01 {
  54298. constructor(attributes) {
  54299. super(TEMPLATE_NS_ID, "boolean");
  54300. this.id = attributes.id || "";
  54301. this.name = attributes.name || "";
  54302. this.use = attributes.use || "";
  54303. this.usehref = attributes.usehref || "";
  54304. }
  54305. [_xfa_object.$toHTML](availableSpace) {
  54306. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  54307. }
  54308. }
  54309. class Border extends _xfa_object.XFAObject {
  54310. constructor(attributes) {
  54311. super(TEMPLATE_NS_ID, "border", true);
  54312. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  54313. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54314. this.id = attributes.id || "";
  54315. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54316. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54317. this.use = attributes.use || "";
  54318. this.usehref = attributes.usehref || "";
  54319. this.corner = new _xfa_object.XFAObjectArray(4);
  54320. this.edge = new _xfa_object.XFAObjectArray(4);
  54321. this.extras = null;
  54322. this.fill = null;
  54323. this.margin = null;
  54324. }
  54325. [_xfa_object.$getExtra]() {
  54326. if (!this[_xfa_object.$extra]) {
  54327. const edges = this.edge.children.slice();
  54328. if (edges.length < 4) {
  54329. const defaultEdge = edges.at(-1) || new Edge({});
  54330. for (let i = edges.length; i < 4; i++) {
  54331. edges.push(defaultEdge);
  54332. }
  54333. }
  54334. const widths = edges.map(edge => edge.thickness);
  54335. const insets = [0, 0, 0, 0];
  54336. if (this.margin) {
  54337. insets[0] = this.margin.topInset;
  54338. insets[1] = this.margin.rightInset;
  54339. insets[2] = this.margin.bottomInset;
  54340. insets[3] = this.margin.leftInset;
  54341. }
  54342. this[_xfa_object.$extra] = {
  54343. widths,
  54344. insets,
  54345. edges
  54346. };
  54347. }
  54348. return this[_xfa_object.$extra];
  54349. }
  54350. [_xfa_object.$toStyle]() {
  54351. const {
  54352. edges
  54353. } = this[_xfa_object.$getExtra]();
  54354. const edgeStyles = edges.map(node => {
  54355. const style = node[_xfa_object.$toStyle]();
  54356. style.color = style.color || "#000000";
  54357. return style;
  54358. });
  54359. const style = Object.create(null);
  54360. if (this.margin) {
  54361. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  54362. }
  54363. if (this.fill && this.fill.presence === "visible") {
  54364. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54365. }
  54366. if (this.corner.children.some(node => node.radius !== 0)) {
  54367. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  54368. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  54369. const last = cornerStyles.at(-1);
  54370. for (let i = cornerStyles.length; i < 4; i++) {
  54371. cornerStyles.push(last);
  54372. }
  54373. }
  54374. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  54375. }
  54376. switch (this.presence) {
  54377. case "invisible":
  54378. case "hidden":
  54379. style.borderStyle = "";
  54380. break;
  54381. case "inactive":
  54382. style.borderStyle = "none";
  54383. break;
  54384. default:
  54385. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  54386. break;
  54387. }
  54388. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  54389. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  54390. return style;
  54391. }
  54392. }
  54393. class Break extends _xfa_object.XFAObject {
  54394. constructor(attributes) {
  54395. super(TEMPLATE_NS_ID, "break", true);
  54396. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54397. this.afterTarget = attributes.afterTarget || "";
  54398. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54399. this.beforeTarget = attributes.beforeTarget || "";
  54400. this.bookendLeader = attributes.bookendLeader || "";
  54401. this.bookendTrailer = attributes.bookendTrailer || "";
  54402. this.id = attributes.id || "";
  54403. this.overflowLeader = attributes.overflowLeader || "";
  54404. this.overflowTarget = attributes.overflowTarget || "";
  54405. this.overflowTrailer = attributes.overflowTrailer || "";
  54406. this.startNew = (0, _utils.getInteger)({
  54407. data: attributes.startNew,
  54408. defaultValue: 0,
  54409. validate: x => x === 1
  54410. });
  54411. this.use = attributes.use || "";
  54412. this.usehref = attributes.usehref || "";
  54413. this.extras = null;
  54414. }
  54415. }
  54416. class BreakAfter extends _xfa_object.XFAObject {
  54417. constructor(attributes) {
  54418. super(TEMPLATE_NS_ID, "breakAfter", true);
  54419. this.id = attributes.id || "";
  54420. this.leader = attributes.leader || "";
  54421. this.startNew = (0, _utils.getInteger)({
  54422. data: attributes.startNew,
  54423. defaultValue: 0,
  54424. validate: x => x === 1
  54425. });
  54426. this.target = attributes.target || "";
  54427. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54428. this.trailer = attributes.trailer || "";
  54429. this.use = attributes.use || "";
  54430. this.usehref = attributes.usehref || "";
  54431. this.script = null;
  54432. }
  54433. }
  54434. class BreakBefore extends _xfa_object.XFAObject {
  54435. constructor(attributes) {
  54436. super(TEMPLATE_NS_ID, "breakBefore", true);
  54437. this.id = attributes.id || "";
  54438. this.leader = attributes.leader || "";
  54439. this.startNew = (0, _utils.getInteger)({
  54440. data: attributes.startNew,
  54441. defaultValue: 0,
  54442. validate: x => x === 1
  54443. });
  54444. this.target = attributes.target || "";
  54445. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54446. this.trailer = attributes.trailer || "";
  54447. this.use = attributes.use || "";
  54448. this.usehref = attributes.usehref || "";
  54449. this.script = null;
  54450. }
  54451. [_xfa_object.$toHTML](availableSpace) {
  54452. this[_xfa_object.$extra] = {};
  54453. return _utils.HTMLResult.FAILURE;
  54454. }
  54455. }
  54456. class Button extends _xfa_object.XFAObject {
  54457. constructor(attributes) {
  54458. super(TEMPLATE_NS_ID, "button", true);
  54459. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  54460. this.id = attributes.id || "";
  54461. this.use = attributes.use || "";
  54462. this.usehref = attributes.usehref || "";
  54463. this.extras = null;
  54464. }
  54465. [_xfa_object.$toHTML](availableSpace) {
  54466. const parent = this[_xfa_object.$getParent]();
  54467. const grandpa = parent[_xfa_object.$getParent]();
  54468. const htmlButton = {
  54469. name: "button",
  54470. attributes: {
  54471. id: this[_xfa_object.$uid],
  54472. class: ["xfaButton"],
  54473. style: {}
  54474. },
  54475. children: []
  54476. };
  54477. for (const event of grandpa.event.children) {
  54478. if (event.activity !== "click" || !event.script) {
  54479. continue;
  54480. }
  54481. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  54482. if (!jsURL) {
  54483. continue;
  54484. }
  54485. const href = (0, _html_utils.fixURL)(jsURL.url);
  54486. if (!href) {
  54487. continue;
  54488. }
  54489. htmlButton.children.push({
  54490. name: "a",
  54491. attributes: {
  54492. id: "link" + this[_xfa_object.$uid],
  54493. href,
  54494. newWindow: jsURL.newWindow,
  54495. class: ["xfaLink"],
  54496. style: {}
  54497. },
  54498. children: []
  54499. });
  54500. }
  54501. return _utils.HTMLResult.success(htmlButton);
  54502. }
  54503. }
  54504. class Calculate extends _xfa_object.XFAObject {
  54505. constructor(attributes) {
  54506. super(TEMPLATE_NS_ID, "calculate", true);
  54507. this.id = attributes.id || "";
  54508. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  54509. this.use = attributes.use || "";
  54510. this.usehref = attributes.usehref || "";
  54511. this.extras = null;
  54512. this.message = null;
  54513. this.script = null;
  54514. }
  54515. }
  54516. class Caption extends _xfa_object.XFAObject {
  54517. constructor(attributes) {
  54518. super(TEMPLATE_NS_ID, "caption", true);
  54519. this.id = attributes.id || "";
  54520. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  54521. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54522. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  54523. this.use = attributes.use || "";
  54524. this.usehref = attributes.usehref || "";
  54525. this.extras = null;
  54526. this.font = null;
  54527. this.margin = null;
  54528. this.para = null;
  54529. this.value = null;
  54530. }
  54531. [_xfa_object.$setValue](value) {
  54532. _setValue(this, value);
  54533. }
  54534. [_xfa_object.$getExtra](availableSpace) {
  54535. if (!this[_xfa_object.$extra]) {
  54536. let {
  54537. width,
  54538. height
  54539. } = availableSpace;
  54540. switch (this.placement) {
  54541. case "left":
  54542. case "right":
  54543. case "inline":
  54544. width = this.reserve <= 0 ? width : this.reserve;
  54545. break;
  54546. case "top":
  54547. case "bottom":
  54548. height = this.reserve <= 0 ? height : this.reserve;
  54549. break;
  54550. }
  54551. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54552. width,
  54553. height
  54554. });
  54555. }
  54556. return this[_xfa_object.$extra];
  54557. }
  54558. [_xfa_object.$toHTML](availableSpace) {
  54559. if (!this.value) {
  54560. return _utils.HTMLResult.EMPTY;
  54561. }
  54562. this[_xfa_object.$pushPara]();
  54563. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54564. if (!value) {
  54565. this[_xfa_object.$popPara]();
  54566. return _utils.HTMLResult.EMPTY;
  54567. }
  54568. const savedReserve = this.reserve;
  54569. if (this.reserve <= 0) {
  54570. const {
  54571. w,
  54572. h
  54573. } = this[_xfa_object.$getExtra](availableSpace);
  54574. switch (this.placement) {
  54575. case "left":
  54576. case "right":
  54577. case "inline":
  54578. this.reserve = w;
  54579. break;
  54580. case "top":
  54581. case "bottom":
  54582. this.reserve = h;
  54583. break;
  54584. }
  54585. }
  54586. const children = [];
  54587. if (typeof value === "string") {
  54588. children.push({
  54589. name: "#text",
  54590. value
  54591. });
  54592. } else {
  54593. children.push(value);
  54594. }
  54595. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54596. switch (this.placement) {
  54597. case "left":
  54598. case "right":
  54599. if (this.reserve > 0) {
  54600. style.width = (0, _html_utils.measureToString)(this.reserve);
  54601. }
  54602. break;
  54603. case "top":
  54604. case "bottom":
  54605. if (this.reserve > 0) {
  54606. style.height = (0, _html_utils.measureToString)(this.reserve);
  54607. }
  54608. break;
  54609. }
  54610. (0, _html_utils.setPara)(this, null, value);
  54611. this[_xfa_object.$popPara]();
  54612. this.reserve = savedReserve;
  54613. return _utils.HTMLResult.success({
  54614. name: "div",
  54615. attributes: {
  54616. style,
  54617. class: ["xfaCaption"]
  54618. },
  54619. children
  54620. });
  54621. }
  54622. }
  54623. class Certificate extends _xfa_object.StringObject {
  54624. constructor(attributes) {
  54625. super(TEMPLATE_NS_ID, "certificate");
  54626. this.id = attributes.id || "";
  54627. this.name = attributes.name || "";
  54628. this.use = attributes.use || "";
  54629. this.usehref = attributes.usehref || "";
  54630. }
  54631. }
  54632. class Certificates extends _xfa_object.XFAObject {
  54633. constructor(attributes) {
  54634. super(TEMPLATE_NS_ID, "certificates", true);
  54635. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54636. this.id = attributes.id || "";
  54637. this.url = attributes.url || "";
  54638. this.urlPolicy = attributes.urlPolicy || "";
  54639. this.use = attributes.use || "";
  54640. this.usehref = attributes.usehref || "";
  54641. this.encryption = null;
  54642. this.issuers = null;
  54643. this.keyUsage = null;
  54644. this.oids = null;
  54645. this.signing = null;
  54646. this.subjectDNs = null;
  54647. }
  54648. }
  54649. class CheckButton extends _xfa_object.XFAObject {
  54650. constructor(attributes) {
  54651. super(TEMPLATE_NS_ID, "checkButton", true);
  54652. this.id = attributes.id || "";
  54653. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54654. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54655. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54656. this.use = attributes.use || "";
  54657. this.usehref = attributes.usehref || "";
  54658. this.border = null;
  54659. this.extras = null;
  54660. this.margin = null;
  54661. }
  54662. [_xfa_object.$toHTML](availableSpace) {
  54663. const style = (0, _html_utils.toStyle)("margin");
  54664. const size = (0, _html_utils.measureToString)(this.size);
  54665. style.width = style.height = size;
  54666. let type;
  54667. let className;
  54668. let groupId;
  54669. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54670. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54671. const exportedValue = {
  54672. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54673. off: (items[1] !== undefined ? items[1] : "off").toString()
  54674. };
  54675. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54676. const checked = value === exportedValue.on || undefined;
  54677. const container = field[_xfa_object.$getSubformParent]();
  54678. const fieldId = field[_xfa_object.$uid];
  54679. let dataId;
  54680. if (container instanceof ExclGroup) {
  54681. groupId = container[_xfa_object.$uid];
  54682. type = "radio";
  54683. className = "xfaRadio";
  54684. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54685. } else {
  54686. type = "checkbox";
  54687. className = "xfaCheckbox";
  54688. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54689. }
  54690. const input = {
  54691. name: "input",
  54692. attributes: {
  54693. class: [className],
  54694. style,
  54695. fieldId,
  54696. dataId,
  54697. type,
  54698. checked,
  54699. xfaOn: exportedValue.on,
  54700. xfaOff: exportedValue.off,
  54701. "aria-label": ariaLabel(field),
  54702. "aria-required": false
  54703. }
  54704. };
  54705. if (groupId) {
  54706. input.attributes.name = groupId;
  54707. }
  54708. if (isRequired(field)) {
  54709. input.attributes["aria-required"] = true;
  54710. input.attributes.required = true;
  54711. }
  54712. return _utils.HTMLResult.success({
  54713. name: "label",
  54714. attributes: {
  54715. class: ["xfaLabel"]
  54716. },
  54717. children: [input]
  54718. });
  54719. }
  54720. }
  54721. class ChoiceList extends _xfa_object.XFAObject {
  54722. constructor(attributes) {
  54723. super(TEMPLATE_NS_ID, "choiceList", true);
  54724. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54725. this.id = attributes.id || "";
  54726. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54727. this.textEntry = (0, _utils.getInteger)({
  54728. data: attributes.textEntry,
  54729. defaultValue: 0,
  54730. validate: x => x === 1
  54731. });
  54732. this.use = attributes.use || "";
  54733. this.usehref = attributes.usehref || "";
  54734. this.border = null;
  54735. this.extras = null;
  54736. this.margin = null;
  54737. }
  54738. [_xfa_object.$toHTML](availableSpace) {
  54739. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54740. const ui = this[_xfa_object.$getParent]();
  54741. const field = ui[_xfa_object.$getParent]();
  54742. const fontSize = field.font && field.font.size || 10;
  54743. const optionStyle = {
  54744. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54745. };
  54746. const children = [];
  54747. if (field.items.children.length > 0) {
  54748. const items = field.items;
  54749. let displayedIndex = 0;
  54750. let saveIndex = 0;
  54751. if (items.children.length === 2) {
  54752. displayedIndex = items.children[0].save;
  54753. saveIndex = 1 - displayedIndex;
  54754. }
  54755. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54756. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54757. let selected = false;
  54758. const value = field.value && field.value[_xfa_object.$text]() || "";
  54759. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54760. const option = {
  54761. name: "option",
  54762. attributes: {
  54763. value: values[i] || displayed[i],
  54764. style: optionStyle
  54765. },
  54766. value: displayed[i]
  54767. };
  54768. if (values[i] === value) {
  54769. option.attributes.selected = selected = true;
  54770. }
  54771. children.push(option);
  54772. }
  54773. if (!selected) {
  54774. children.splice(0, 0, {
  54775. name: "option",
  54776. attributes: {
  54777. hidden: true,
  54778. selected: true
  54779. },
  54780. value: " "
  54781. });
  54782. }
  54783. }
  54784. const selectAttributes = {
  54785. class: ["xfaSelect"],
  54786. fieldId: field[_xfa_object.$uid],
  54787. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54788. style,
  54789. "aria-label": ariaLabel(field),
  54790. "aria-required": false
  54791. };
  54792. if (isRequired(field)) {
  54793. selectAttributes["aria-required"] = true;
  54794. selectAttributes.required = true;
  54795. }
  54796. if (this.open === "multiSelect") {
  54797. selectAttributes.multiple = true;
  54798. }
  54799. return _utils.HTMLResult.success({
  54800. name: "label",
  54801. attributes: {
  54802. class: ["xfaLabel"]
  54803. },
  54804. children: [{
  54805. name: "select",
  54806. children,
  54807. attributes: selectAttributes
  54808. }]
  54809. });
  54810. }
  54811. }
  54812. class Color extends _xfa_object.XFAObject {
  54813. constructor(attributes) {
  54814. super(TEMPLATE_NS_ID, "color", true);
  54815. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54816. this.id = attributes.id || "";
  54817. this.use = attributes.use || "";
  54818. this.usehref = attributes.usehref || "";
  54819. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54820. this.extras = null;
  54821. }
  54822. [_xfa_object.$hasSettableValue]() {
  54823. return false;
  54824. }
  54825. [_xfa_object.$toStyle]() {
  54826. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54827. }
  54828. }
  54829. class Comb extends _xfa_object.XFAObject {
  54830. constructor(attributes) {
  54831. super(TEMPLATE_NS_ID, "comb");
  54832. this.id = attributes.id || "";
  54833. this.numberOfCells = (0, _utils.getInteger)({
  54834. data: attributes.numberOfCells,
  54835. defaultValue: 0,
  54836. validate: x => x >= 0
  54837. });
  54838. this.use = attributes.use || "";
  54839. this.usehref = attributes.usehref || "";
  54840. }
  54841. }
  54842. class Connect extends _xfa_object.XFAObject {
  54843. constructor(attributes) {
  54844. super(TEMPLATE_NS_ID, "connect", true);
  54845. this.connection = attributes.connection || "";
  54846. this.id = attributes.id || "";
  54847. this.ref = attributes.ref || "";
  54848. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54849. this.use = attributes.use || "";
  54850. this.usehref = attributes.usehref || "";
  54851. this.picture = null;
  54852. }
  54853. }
  54854. class ContentArea extends _xfa_object.XFAObject {
  54855. constructor(attributes) {
  54856. super(TEMPLATE_NS_ID, "contentArea", true);
  54857. this.h = (0, _utils.getMeasurement)(attributes.h);
  54858. this.id = attributes.id || "";
  54859. this.name = attributes.name || "";
  54860. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54861. this.use = attributes.use || "";
  54862. this.usehref = attributes.usehref || "";
  54863. this.w = (0, _utils.getMeasurement)(attributes.w);
  54864. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54865. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54866. this.desc = null;
  54867. this.extras = null;
  54868. }
  54869. [_xfa_object.$toHTML](availableSpace) {
  54870. const left = (0, _html_utils.measureToString)(this.x);
  54871. const top = (0, _html_utils.measureToString)(this.y);
  54872. const style = {
  54873. left,
  54874. top,
  54875. width: (0, _html_utils.measureToString)(this.w),
  54876. height: (0, _html_utils.measureToString)(this.h)
  54877. };
  54878. const classNames = ["xfaContentarea"];
  54879. if ((0, _html_utils.isPrintOnly)(this)) {
  54880. classNames.push("xfaPrintOnly");
  54881. }
  54882. return _utils.HTMLResult.success({
  54883. name: "div",
  54884. children: [],
  54885. attributes: {
  54886. style,
  54887. class: classNames,
  54888. id: this[_xfa_object.$uid]
  54889. }
  54890. });
  54891. }
  54892. }
  54893. class Corner extends _xfa_object.XFAObject {
  54894. constructor(attributes) {
  54895. super(TEMPLATE_NS_ID, "corner", true);
  54896. this.id = attributes.id || "";
  54897. this.inverted = (0, _utils.getInteger)({
  54898. data: attributes.inverted,
  54899. defaultValue: 0,
  54900. validate: x => x === 1
  54901. });
  54902. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54903. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54904. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54905. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54906. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54907. this.use = attributes.use || "";
  54908. this.usehref = attributes.usehref || "";
  54909. this.color = null;
  54910. this.extras = null;
  54911. }
  54912. [_xfa_object.$toStyle]() {
  54913. const style = (0, _html_utils.toStyle)(this, "visibility");
  54914. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54915. return style;
  54916. }
  54917. }
  54918. class DateElement extends _xfa_object.ContentObject {
  54919. constructor(attributes) {
  54920. super(TEMPLATE_NS_ID, "date");
  54921. this.id = attributes.id || "";
  54922. this.name = attributes.name || "";
  54923. this.use = attributes.use || "";
  54924. this.usehref = attributes.usehref || "";
  54925. }
  54926. [_xfa_object.$finalize]() {
  54927. const date = this[_xfa_object.$content].trim();
  54928. this[_xfa_object.$content] = date ? new Date(date) : null;
  54929. }
  54930. [_xfa_object.$toHTML](availableSpace) {
  54931. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54932. }
  54933. }
  54934. class DateTime extends _xfa_object.ContentObject {
  54935. constructor(attributes) {
  54936. super(TEMPLATE_NS_ID, "dateTime");
  54937. this.id = attributes.id || "";
  54938. this.name = attributes.name || "";
  54939. this.use = attributes.use || "";
  54940. this.usehref = attributes.usehref || "";
  54941. }
  54942. [_xfa_object.$finalize]() {
  54943. const date = this[_xfa_object.$content].trim();
  54944. this[_xfa_object.$content] = date ? new Date(date) : null;
  54945. }
  54946. [_xfa_object.$toHTML](availableSpace) {
  54947. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54948. }
  54949. }
  54950. class DateTimeEdit extends _xfa_object.XFAObject {
  54951. constructor(attributes) {
  54952. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54953. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54954. this.id = attributes.id || "";
  54955. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54956. this.use = attributes.use || "";
  54957. this.usehref = attributes.usehref || "";
  54958. this.border = null;
  54959. this.comb = null;
  54960. this.extras = null;
  54961. this.margin = null;
  54962. }
  54963. [_xfa_object.$toHTML](availableSpace) {
  54964. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54965. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54966. const html = {
  54967. name: "input",
  54968. attributes: {
  54969. type: "text",
  54970. fieldId: field[_xfa_object.$uid],
  54971. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54972. class: ["xfaTextfield"],
  54973. style,
  54974. "aria-label": ariaLabel(field),
  54975. "aria-required": false
  54976. }
  54977. };
  54978. if (isRequired(field)) {
  54979. html.attributes["aria-required"] = true;
  54980. html.attributes.required = true;
  54981. }
  54982. return _utils.HTMLResult.success({
  54983. name: "label",
  54984. attributes: {
  54985. class: ["xfaLabel"]
  54986. },
  54987. children: [html]
  54988. });
  54989. }
  54990. }
  54991. class Decimal extends _xfa_object.ContentObject {
  54992. constructor(attributes) {
  54993. super(TEMPLATE_NS_ID, "decimal");
  54994. this.fracDigits = (0, _utils.getInteger)({
  54995. data: attributes.fracDigits,
  54996. defaultValue: 2,
  54997. validate: x => true
  54998. });
  54999. this.id = attributes.id || "";
  55000. this.leadDigits = (0, _utils.getInteger)({
  55001. data: attributes.leadDigits,
  55002. defaultValue: -1,
  55003. validate: x => true
  55004. });
  55005. this.name = attributes.name || "";
  55006. this.use = attributes.use || "";
  55007. this.usehref = attributes.usehref || "";
  55008. }
  55009. [_xfa_object.$finalize]() {
  55010. const number = parseFloat(this[_xfa_object.$content].trim());
  55011. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55012. }
  55013. [_xfa_object.$toHTML](availableSpace) {
  55014. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55015. }
  55016. }
  55017. class DefaultUi extends _xfa_object.XFAObject {
  55018. constructor(attributes) {
  55019. super(TEMPLATE_NS_ID, "defaultUi", true);
  55020. this.id = attributes.id || "";
  55021. this.use = attributes.use || "";
  55022. this.usehref = attributes.usehref || "";
  55023. this.extras = null;
  55024. }
  55025. }
  55026. class Desc extends _xfa_object.XFAObject {
  55027. constructor(attributes) {
  55028. super(TEMPLATE_NS_ID, "desc", true);
  55029. this.id = attributes.id || "";
  55030. this.use = attributes.use || "";
  55031. this.usehref = attributes.usehref || "";
  55032. this.boolean = new _xfa_object.XFAObjectArray();
  55033. this.date = new _xfa_object.XFAObjectArray();
  55034. this.dateTime = new _xfa_object.XFAObjectArray();
  55035. this.decimal = new _xfa_object.XFAObjectArray();
  55036. this.exData = new _xfa_object.XFAObjectArray();
  55037. this.float = new _xfa_object.XFAObjectArray();
  55038. this.image = new _xfa_object.XFAObjectArray();
  55039. this.integer = new _xfa_object.XFAObjectArray();
  55040. this.text = new _xfa_object.XFAObjectArray();
  55041. this.time = new _xfa_object.XFAObjectArray();
  55042. }
  55043. }
  55044. class DigestMethod extends _xfa_object.OptionObject {
  55045. constructor(attributes) {
  55046. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  55047. this.id = attributes.id || "";
  55048. this.use = attributes.use || "";
  55049. this.usehref = attributes.usehref || "";
  55050. }
  55051. }
  55052. class DigestMethods extends _xfa_object.XFAObject {
  55053. constructor(attributes) {
  55054. super(TEMPLATE_NS_ID, "digestMethods", true);
  55055. this.id = attributes.id || "";
  55056. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55057. this.use = attributes.use || "";
  55058. this.usehref = attributes.usehref || "";
  55059. this.digestMethod = new _xfa_object.XFAObjectArray();
  55060. }
  55061. }
  55062. class Draw extends _xfa_object.XFAObject {
  55063. constructor(attributes) {
  55064. super(TEMPLATE_NS_ID, "draw", true);
  55065. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55066. this.colSpan = (0, _utils.getInteger)({
  55067. data: attributes.colSpan,
  55068. defaultValue: 1,
  55069. validate: n => n >= 1 || n === -1
  55070. });
  55071. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55072. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55073. this.id = attributes.id || "";
  55074. this.locale = attributes.locale || "";
  55075. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55076. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55077. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55078. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55079. this.name = attributes.name || "";
  55080. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55081. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55082. this.rotate = (0, _utils.getInteger)({
  55083. data: attributes.rotate,
  55084. defaultValue: 0,
  55085. validate: x => x % 90 === 0
  55086. });
  55087. this.use = attributes.use || "";
  55088. this.usehref = attributes.usehref || "";
  55089. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55090. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55091. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55092. this.assist = null;
  55093. this.border = null;
  55094. this.caption = null;
  55095. this.desc = null;
  55096. this.extras = null;
  55097. this.font = null;
  55098. this.keep = null;
  55099. this.margin = null;
  55100. this.para = null;
  55101. this.traversal = null;
  55102. this.ui = null;
  55103. this.value = null;
  55104. this.setProperty = new _xfa_object.XFAObjectArray();
  55105. }
  55106. [_xfa_object.$setValue](value) {
  55107. _setValue(this, value);
  55108. }
  55109. [_xfa_object.$toHTML](availableSpace) {
  55110. setTabIndex(this);
  55111. if (this.presence === "hidden" || this.presence === "inactive") {
  55112. return _utils.HTMLResult.EMPTY;
  55113. }
  55114. (0, _html_utils.fixDimensions)(this);
  55115. this[_xfa_object.$pushPara]();
  55116. const savedW = this.w;
  55117. const savedH = this.h;
  55118. const {
  55119. w,
  55120. h,
  55121. isBroken
  55122. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55123. if (w && this.w === "") {
  55124. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55125. this[_xfa_object.$popPara]();
  55126. return _utils.HTMLResult.FAILURE;
  55127. }
  55128. this.w = w;
  55129. }
  55130. if (h && this.h === "") {
  55131. this.h = h;
  55132. }
  55133. setFirstUnsplittable(this);
  55134. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55135. this.w = savedW;
  55136. this.h = savedH;
  55137. this[_xfa_object.$popPara]();
  55138. return _utils.HTMLResult.FAILURE;
  55139. }
  55140. unsetFirstUnsplittable(this);
  55141. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  55142. (0, _html_utils.setMinMaxDimensions)(this, style);
  55143. if (style.margin) {
  55144. style.padding = style.margin;
  55145. delete style.margin;
  55146. }
  55147. const classNames = ["xfaDraw"];
  55148. if (this.font) {
  55149. classNames.push("xfaFont");
  55150. }
  55151. if ((0, _html_utils.isPrintOnly)(this)) {
  55152. classNames.push("xfaPrintOnly");
  55153. }
  55154. const attributes = {
  55155. style,
  55156. id: this[_xfa_object.$uid],
  55157. class: classNames
  55158. };
  55159. if (this.name) {
  55160. attributes.xfaName = this.name;
  55161. }
  55162. const html = {
  55163. name: "div",
  55164. attributes,
  55165. children: []
  55166. };
  55167. applyAssist(this, attributes);
  55168. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55169. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  55170. if (value === null) {
  55171. this.w = savedW;
  55172. this.h = savedH;
  55173. this[_xfa_object.$popPara]();
  55174. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55175. }
  55176. html.children.push(value);
  55177. (0, _html_utils.setPara)(this, style, value);
  55178. this.w = savedW;
  55179. this.h = savedH;
  55180. this[_xfa_object.$popPara]();
  55181. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55182. }
  55183. }
  55184. class Edge extends _xfa_object.XFAObject {
  55185. constructor(attributes) {
  55186. super(TEMPLATE_NS_ID, "edge", true);
  55187. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  55188. this.id = attributes.id || "";
  55189. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55190. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  55191. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  55192. this.use = attributes.use || "";
  55193. this.usehref = attributes.usehref || "";
  55194. this.color = null;
  55195. this.extras = null;
  55196. }
  55197. [_xfa_object.$toStyle]() {
  55198. const style = (0, _html_utils.toStyle)(this, "visibility");
  55199. Object.assign(style, {
  55200. linecap: this.cap,
  55201. width: (0, _html_utils.measureToString)(this.thickness),
  55202. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  55203. style: ""
  55204. });
  55205. if (this.presence !== "visible") {
  55206. style.style = "none";
  55207. } else {
  55208. switch (this.stroke) {
  55209. case "solid":
  55210. style.style = "solid";
  55211. break;
  55212. case "dashDot":
  55213. style.style = "dashed";
  55214. break;
  55215. case "dashDotDot":
  55216. style.style = "dashed";
  55217. break;
  55218. case "dashed":
  55219. style.style = "dashed";
  55220. break;
  55221. case "dotted":
  55222. style.style = "dotted";
  55223. break;
  55224. case "embossed":
  55225. style.style = "ridge";
  55226. break;
  55227. case "etched":
  55228. style.style = "groove";
  55229. break;
  55230. case "lowered":
  55231. style.style = "inset";
  55232. break;
  55233. case "raised":
  55234. style.style = "outset";
  55235. break;
  55236. }
  55237. }
  55238. return style;
  55239. }
  55240. }
  55241. class Encoding extends _xfa_object.OptionObject {
  55242. constructor(attributes) {
  55243. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  55244. this.id = attributes.id || "";
  55245. this.use = attributes.use || "";
  55246. this.usehref = attributes.usehref || "";
  55247. }
  55248. }
  55249. class Encodings extends _xfa_object.XFAObject {
  55250. constructor(attributes) {
  55251. super(TEMPLATE_NS_ID, "encodings", true);
  55252. this.id = attributes.id || "";
  55253. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55254. this.use = attributes.use || "";
  55255. this.usehref = attributes.usehref || "";
  55256. this.encoding = new _xfa_object.XFAObjectArray();
  55257. }
  55258. }
  55259. class Encrypt extends _xfa_object.XFAObject {
  55260. constructor(attributes) {
  55261. super(TEMPLATE_NS_ID, "encrypt", true);
  55262. this.id = attributes.id || "";
  55263. this.use = attributes.use || "";
  55264. this.usehref = attributes.usehref || "";
  55265. this.certificate = null;
  55266. }
  55267. }
  55268. class EncryptData extends _xfa_object.XFAObject {
  55269. constructor(attributes) {
  55270. super(TEMPLATE_NS_ID, "encryptData", true);
  55271. this.id = attributes.id || "";
  55272. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  55273. this.target = attributes.target || "";
  55274. this.use = attributes.use || "";
  55275. this.usehref = attributes.usehref || "";
  55276. this.filter = null;
  55277. this.manifest = null;
  55278. }
  55279. }
  55280. class Encryption extends _xfa_object.XFAObject {
  55281. constructor(attributes) {
  55282. super(TEMPLATE_NS_ID, "encryption", true);
  55283. this.id = attributes.id || "";
  55284. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55285. this.use = attributes.use || "";
  55286. this.usehref = attributes.usehref || "";
  55287. this.certificate = new _xfa_object.XFAObjectArray();
  55288. }
  55289. }
  55290. class EncryptionMethod extends _xfa_object.OptionObject {
  55291. constructor(attributes) {
  55292. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  55293. this.id = attributes.id || "";
  55294. this.use = attributes.use || "";
  55295. this.usehref = attributes.usehref || "";
  55296. }
  55297. }
  55298. class EncryptionMethods extends _xfa_object.XFAObject {
  55299. constructor(attributes) {
  55300. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  55301. this.id = attributes.id || "";
  55302. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55303. this.use = attributes.use || "";
  55304. this.usehref = attributes.usehref || "";
  55305. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55306. }
  55307. }
  55308. class Event extends _xfa_object.XFAObject {
  55309. constructor(attributes) {
  55310. super(TEMPLATE_NS_ID, "event", true);
  55311. 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"]);
  55312. this.id = attributes.id || "";
  55313. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  55314. this.name = attributes.name || "";
  55315. this.ref = attributes.ref || "";
  55316. this.use = attributes.use || "";
  55317. this.usehref = attributes.usehref || "";
  55318. this.extras = null;
  55319. this.encryptData = null;
  55320. this.execute = null;
  55321. this.script = null;
  55322. this.signData = null;
  55323. this.submit = null;
  55324. }
  55325. }
  55326. class ExData extends _xfa_object.ContentObject {
  55327. constructor(attributes) {
  55328. super(TEMPLATE_NS_ID, "exData");
  55329. this.contentType = attributes.contentType || "";
  55330. this.href = attributes.href || "";
  55331. this.id = attributes.id || "";
  55332. this.maxLength = (0, _utils.getInteger)({
  55333. data: attributes.maxLength,
  55334. defaultValue: -1,
  55335. validate: x => x >= -1
  55336. });
  55337. this.name = attributes.name || "";
  55338. this.rid = attributes.rid || "";
  55339. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  55340. this.use = attributes.use || "";
  55341. this.usehref = attributes.usehref || "";
  55342. }
  55343. [_xfa_object.$isCDATAXml]() {
  55344. return this.contentType === "text/html";
  55345. }
  55346. [_xfa_object.$onChild](child) {
  55347. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55348. this[_xfa_object.$content] = child;
  55349. return true;
  55350. }
  55351. if (this.contentType === "text/xml") {
  55352. this[_xfa_object.$content] = child;
  55353. return true;
  55354. }
  55355. return false;
  55356. }
  55357. [_xfa_object.$toHTML](availableSpace) {
  55358. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  55359. return _utils.HTMLResult.EMPTY;
  55360. }
  55361. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  55362. }
  55363. }
  55364. class ExObject extends _xfa_object.XFAObject {
  55365. constructor(attributes) {
  55366. super(TEMPLATE_NS_ID, "exObject", true);
  55367. this.archive = attributes.archive || "";
  55368. this.classId = attributes.classId || "";
  55369. this.codeBase = attributes.codeBase || "";
  55370. this.codeType = attributes.codeType || "";
  55371. this.id = attributes.id || "";
  55372. this.name = attributes.name || "";
  55373. this.use = attributes.use || "";
  55374. this.usehref = attributes.usehref || "";
  55375. this.extras = null;
  55376. this.boolean = new _xfa_object.XFAObjectArray();
  55377. this.date = new _xfa_object.XFAObjectArray();
  55378. this.dateTime = new _xfa_object.XFAObjectArray();
  55379. this.decimal = new _xfa_object.XFAObjectArray();
  55380. this.exData = new _xfa_object.XFAObjectArray();
  55381. this.exObject = new _xfa_object.XFAObjectArray();
  55382. this.float = new _xfa_object.XFAObjectArray();
  55383. this.image = new _xfa_object.XFAObjectArray();
  55384. this.integer = new _xfa_object.XFAObjectArray();
  55385. this.text = new _xfa_object.XFAObjectArray();
  55386. this.time = new _xfa_object.XFAObjectArray();
  55387. }
  55388. }
  55389. class ExclGroup extends _xfa_object.XFAObject {
  55390. constructor(attributes) {
  55391. super(TEMPLATE_NS_ID, "exclGroup", true);
  55392. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55393. this.accessKey = attributes.accessKey || "";
  55394. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55395. this.colSpan = (0, _utils.getInteger)({
  55396. data: attributes.colSpan,
  55397. defaultValue: 1,
  55398. validate: n => n >= 1 || n === -1
  55399. });
  55400. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55401. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55402. this.id = attributes.id || "";
  55403. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55404. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55405. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55406. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55407. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55408. this.name = attributes.name || "";
  55409. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55410. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55411. this.use = attributes.use || "";
  55412. this.usehref = attributes.usehref || "";
  55413. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55414. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55415. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55416. this.assist = null;
  55417. this.bind = null;
  55418. this.border = null;
  55419. this.calculate = null;
  55420. this.caption = null;
  55421. this.desc = null;
  55422. this.extras = null;
  55423. this.margin = null;
  55424. this.para = null;
  55425. this.traversal = null;
  55426. this.validate = null;
  55427. this.connect = new _xfa_object.XFAObjectArray();
  55428. this.event = new _xfa_object.XFAObjectArray();
  55429. this.field = new _xfa_object.XFAObjectArray();
  55430. this.setProperty = new _xfa_object.XFAObjectArray();
  55431. }
  55432. [_xfa_object.$isBindable]() {
  55433. return true;
  55434. }
  55435. [_xfa_object.$hasSettableValue]() {
  55436. return true;
  55437. }
  55438. [_xfa_object.$setValue](value) {
  55439. for (const field of this.field.children) {
  55440. if (!field.value) {
  55441. const nodeValue = new Value({});
  55442. field[_xfa_object.$appendChild](nodeValue);
  55443. field.value = nodeValue;
  55444. }
  55445. field.value[_xfa_object.$setValue](value);
  55446. }
  55447. }
  55448. [_xfa_object.$isThereMoreWidth]() {
  55449. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55450. }
  55451. [_xfa_object.$isSplittable]() {
  55452. const parent = this[_xfa_object.$getSubformParent]();
  55453. if (!parent[_xfa_object.$isSplittable]()) {
  55454. return false;
  55455. }
  55456. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55457. return this[_xfa_object.$extra]._isSplittable;
  55458. }
  55459. if (this.layout === "position" || this.layout.includes("row")) {
  55460. this[_xfa_object.$extra]._isSplittable = false;
  55461. return false;
  55462. }
  55463. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55464. return false;
  55465. }
  55466. this[_xfa_object.$extra]._isSplittable = true;
  55467. return true;
  55468. }
  55469. [_xfa_object.$flushHTML]() {
  55470. return (0, _layout.flushHTML)(this);
  55471. }
  55472. [_xfa_object.$addHTML](html, bbox) {
  55473. (0, _layout.addHTML)(this, html, bbox);
  55474. }
  55475. [_xfa_object.$getAvailableSpace]() {
  55476. return (0, _layout.getAvailableSpace)(this);
  55477. }
  55478. [_xfa_object.$toHTML](availableSpace) {
  55479. setTabIndex(this);
  55480. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55481. return _utils.HTMLResult.EMPTY;
  55482. }
  55483. (0, _html_utils.fixDimensions)(this);
  55484. const children = [];
  55485. const attributes = {
  55486. id: this[_xfa_object.$uid],
  55487. class: []
  55488. };
  55489. (0, _html_utils.setAccess)(this, attributes.class);
  55490. if (!this[_xfa_object.$extra]) {
  55491. this[_xfa_object.$extra] = Object.create(null);
  55492. }
  55493. Object.assign(this[_xfa_object.$extra], {
  55494. children,
  55495. attributes,
  55496. attempt: 0,
  55497. line: null,
  55498. numberInLine: 0,
  55499. availableSpace: {
  55500. width: Math.min(this.w || Infinity, availableSpace.width),
  55501. height: Math.min(this.h || Infinity, availableSpace.height)
  55502. },
  55503. width: 0,
  55504. height: 0,
  55505. prevHeight: 0,
  55506. currentWidth: 0
  55507. });
  55508. const isSplittable = this[_xfa_object.$isSplittable]();
  55509. if (!isSplittable) {
  55510. setFirstUnsplittable(this);
  55511. }
  55512. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55513. return _utils.HTMLResult.FAILURE;
  55514. }
  55515. const filter = new Set(["field"]);
  55516. if (this.layout.includes("row")) {
  55517. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55518. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55519. this[_xfa_object.$extra].columnWidths = columnWidths;
  55520. this[_xfa_object.$extra].currentColumn = 0;
  55521. }
  55522. }
  55523. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55524. const classNames = ["xfaExclgroup"];
  55525. const cl = (0, _html_utils.layoutClass)(this);
  55526. if (cl) {
  55527. classNames.push(cl);
  55528. }
  55529. if ((0, _html_utils.isPrintOnly)(this)) {
  55530. classNames.push("xfaPrintOnly");
  55531. }
  55532. attributes.style = style;
  55533. attributes.class = classNames;
  55534. if (this.name) {
  55535. attributes.xfaName = this.name;
  55536. }
  55537. this[_xfa_object.$pushPara]();
  55538. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55539. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55540. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55541. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55542. this[_xfa_object.$extra].numberInLine = 0;
  55543. }
  55544. const result = this[_xfa_object.$childrenToHTML]({
  55545. filter,
  55546. include: true
  55547. });
  55548. if (result.success) {
  55549. break;
  55550. }
  55551. if (result.isBreak()) {
  55552. this[_xfa_object.$popPara]();
  55553. return result;
  55554. }
  55555. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55556. this[_xfa_object.$extra].attempt = maxRun;
  55557. break;
  55558. }
  55559. }
  55560. this[_xfa_object.$popPara]();
  55561. if (!isSplittable) {
  55562. unsetFirstUnsplittable(this);
  55563. }
  55564. if (this[_xfa_object.$extra].attempt === maxRun) {
  55565. if (!isSplittable) {
  55566. delete this[_xfa_object.$extra];
  55567. }
  55568. return _utils.HTMLResult.FAILURE;
  55569. }
  55570. let marginH = 0;
  55571. let marginV = 0;
  55572. if (this.margin) {
  55573. marginH = this.margin.leftInset + this.margin.rightInset;
  55574. marginV = this.margin.topInset + this.margin.bottomInset;
  55575. }
  55576. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55577. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55578. const bbox = [this.x, this.y, width, height];
  55579. if (this.w === "") {
  55580. style.width = (0, _html_utils.measureToString)(width);
  55581. }
  55582. if (this.h === "") {
  55583. style.height = (0, _html_utils.measureToString)(height);
  55584. }
  55585. const html = {
  55586. name: "div",
  55587. attributes,
  55588. children
  55589. };
  55590. applyAssist(this, attributes);
  55591. delete this[_xfa_object.$extra];
  55592. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55593. }
  55594. }
  55595. class Execute extends _xfa_object.XFAObject {
  55596. constructor(attributes) {
  55597. super(TEMPLATE_NS_ID, "execute");
  55598. this.connection = attributes.connection || "";
  55599. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55600. this.id = attributes.id || "";
  55601. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55602. this.use = attributes.use || "";
  55603. this.usehref = attributes.usehref || "";
  55604. }
  55605. }
  55606. class Extras extends _xfa_object.XFAObject {
  55607. constructor(attributes) {
  55608. super(TEMPLATE_NS_ID, "extras", true);
  55609. this.id = attributes.id || "";
  55610. this.name = attributes.name || "";
  55611. this.use = attributes.use || "";
  55612. this.usehref = attributes.usehref || "";
  55613. this.boolean = new _xfa_object.XFAObjectArray();
  55614. this.date = new _xfa_object.XFAObjectArray();
  55615. this.dateTime = new _xfa_object.XFAObjectArray();
  55616. this.decimal = new _xfa_object.XFAObjectArray();
  55617. this.exData = new _xfa_object.XFAObjectArray();
  55618. this.extras = new _xfa_object.XFAObjectArray();
  55619. this.float = new _xfa_object.XFAObjectArray();
  55620. this.image = new _xfa_object.XFAObjectArray();
  55621. this.integer = new _xfa_object.XFAObjectArray();
  55622. this.text = new _xfa_object.XFAObjectArray();
  55623. this.time = new _xfa_object.XFAObjectArray();
  55624. }
  55625. }
  55626. class Field extends _xfa_object.XFAObject {
  55627. constructor(attributes) {
  55628. super(TEMPLATE_NS_ID, "field", true);
  55629. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55630. this.accessKey = attributes.accessKey || "";
  55631. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55632. this.colSpan = (0, _utils.getInteger)({
  55633. data: attributes.colSpan,
  55634. defaultValue: 1,
  55635. validate: n => n >= 1 || n === -1
  55636. });
  55637. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55638. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55639. this.id = attributes.id || "";
  55640. this.locale = attributes.locale || "";
  55641. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55642. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55643. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55644. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55645. this.name = attributes.name || "";
  55646. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55647. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55648. this.rotate = (0, _utils.getInteger)({
  55649. data: attributes.rotate,
  55650. defaultValue: 0,
  55651. validate: x => x % 90 === 0
  55652. });
  55653. this.use = attributes.use || "";
  55654. this.usehref = attributes.usehref || "";
  55655. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55656. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55657. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55658. this.assist = null;
  55659. this.bind = null;
  55660. this.border = null;
  55661. this.calculate = null;
  55662. this.caption = null;
  55663. this.desc = null;
  55664. this.extras = null;
  55665. this.font = null;
  55666. this.format = null;
  55667. this.items = new _xfa_object.XFAObjectArray(2);
  55668. this.keep = null;
  55669. this.margin = null;
  55670. this.para = null;
  55671. this.traversal = null;
  55672. this.ui = null;
  55673. this.validate = null;
  55674. this.value = null;
  55675. this.bindItems = new _xfa_object.XFAObjectArray();
  55676. this.connect = new _xfa_object.XFAObjectArray();
  55677. this.event = new _xfa_object.XFAObjectArray();
  55678. this.setProperty = new _xfa_object.XFAObjectArray();
  55679. }
  55680. [_xfa_object.$isBindable]() {
  55681. return true;
  55682. }
  55683. [_xfa_object.$setValue](value) {
  55684. _setValue(this, value);
  55685. }
  55686. [_xfa_object.$toHTML](availableSpace) {
  55687. setTabIndex(this);
  55688. if (!this.ui) {
  55689. this.ui = new Ui({});
  55690. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55691. this[_xfa_object.$appendChild](this.ui);
  55692. let node;
  55693. switch (this.items.children.length) {
  55694. case 0:
  55695. node = new TextEdit({});
  55696. this.ui.textEdit = node;
  55697. break;
  55698. case 1:
  55699. node = new CheckButton({});
  55700. this.ui.checkButton = node;
  55701. break;
  55702. case 2:
  55703. node = new ChoiceList({});
  55704. this.ui.choiceList = node;
  55705. break;
  55706. }
  55707. this.ui[_xfa_object.$appendChild](node);
  55708. }
  55709. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55710. return _utils.HTMLResult.EMPTY;
  55711. }
  55712. if (this.caption) {
  55713. delete this.caption[_xfa_object.$extra];
  55714. }
  55715. this[_xfa_object.$pushPara]();
  55716. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55717. const savedW = this.w;
  55718. const savedH = this.h;
  55719. let marginH = 0;
  55720. let marginV = 0;
  55721. if (this.margin) {
  55722. marginH = this.margin.leftInset + this.margin.rightInset;
  55723. marginV = this.margin.topInset + this.margin.bottomInset;
  55724. }
  55725. let borderDims = null;
  55726. if (this.w === "" || this.h === "") {
  55727. let width = null;
  55728. let height = null;
  55729. let uiW = 0;
  55730. let uiH = 0;
  55731. if (this.ui.checkButton) {
  55732. uiW = uiH = this.ui.checkButton.size;
  55733. } else {
  55734. const {
  55735. w,
  55736. h
  55737. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55738. if (w !== null) {
  55739. uiW = w;
  55740. uiH = h;
  55741. } else {
  55742. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55743. }
  55744. }
  55745. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55746. uiW += borderDims.w;
  55747. uiH += borderDims.h;
  55748. if (this.caption) {
  55749. const {
  55750. w,
  55751. h,
  55752. isBroken
  55753. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55754. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55755. this[_xfa_object.$popPara]();
  55756. return _utils.HTMLResult.FAILURE;
  55757. }
  55758. width = w;
  55759. height = h;
  55760. switch (this.caption.placement) {
  55761. case "left":
  55762. case "right":
  55763. case "inline":
  55764. width += uiW;
  55765. break;
  55766. case "top":
  55767. case "bottom":
  55768. height += uiH;
  55769. break;
  55770. }
  55771. } else {
  55772. width = uiW;
  55773. height = uiH;
  55774. }
  55775. if (width && this.w === "") {
  55776. width += marginH;
  55777. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55778. }
  55779. if (height && this.h === "") {
  55780. height += marginV;
  55781. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55782. }
  55783. }
  55784. this[_xfa_object.$popPara]();
  55785. (0, _html_utils.fixDimensions)(this);
  55786. setFirstUnsplittable(this);
  55787. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55788. this.w = savedW;
  55789. this.h = savedH;
  55790. this[_xfa_object.$popPara]();
  55791. return _utils.HTMLResult.FAILURE;
  55792. }
  55793. unsetFirstUnsplittable(this);
  55794. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55795. (0, _html_utils.setMinMaxDimensions)(this, style);
  55796. const classNames = ["xfaField"];
  55797. if (this.font) {
  55798. classNames.push("xfaFont");
  55799. }
  55800. if ((0, _html_utils.isPrintOnly)(this)) {
  55801. classNames.push("xfaPrintOnly");
  55802. }
  55803. const attributes = {
  55804. style,
  55805. id: this[_xfa_object.$uid],
  55806. class: classNames
  55807. };
  55808. if (style.margin) {
  55809. style.padding = style.margin;
  55810. delete style.margin;
  55811. }
  55812. (0, _html_utils.setAccess)(this, classNames);
  55813. if (this.name) {
  55814. attributes.xfaName = this.name;
  55815. }
  55816. const children = [];
  55817. const html = {
  55818. name: "div",
  55819. attributes,
  55820. children
  55821. };
  55822. applyAssist(this, attributes);
  55823. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55824. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55825. const ui = this.ui[_xfa_object.$toHTML]().html;
  55826. if (!ui) {
  55827. Object.assign(style, borderStyle);
  55828. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55829. }
  55830. if (this[_xfa_object.$tabIndex]) {
  55831. if (ui.children && ui.children[0]) {
  55832. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55833. } else {
  55834. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55835. }
  55836. }
  55837. if (!ui.attributes.style) {
  55838. ui.attributes.style = Object.create(null);
  55839. }
  55840. let aElement = null;
  55841. if (this.ui.button) {
  55842. if (ui.children.length === 1) {
  55843. [aElement] = ui.children.splice(0, 1);
  55844. }
  55845. Object.assign(ui.attributes.style, borderStyle);
  55846. } else {
  55847. Object.assign(style, borderStyle);
  55848. }
  55849. children.push(ui);
  55850. if (this.value) {
  55851. if (this.ui.imageEdit) {
  55852. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55853. } else if (!this.ui.button) {
  55854. let value = "";
  55855. if (this.value.exData) {
  55856. value = this.value.exData[_xfa_object.$text]();
  55857. } else if (this.value.text) {
  55858. value = this.value.text[_xfa_object.$getExtra]();
  55859. } else {
  55860. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55861. if (htmlValue !== null) {
  55862. value = htmlValue.children[0].value;
  55863. }
  55864. }
  55865. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55866. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55867. }
  55868. if (value) {
  55869. if (this.ui.numericEdit) {
  55870. value = parseFloat(value);
  55871. value = isNaN(value) ? "" : value.toString();
  55872. }
  55873. if (ui.children[0].name === "textarea") {
  55874. ui.children[0].attributes.textContent = value;
  55875. } else {
  55876. ui.children[0].attributes.value = value;
  55877. }
  55878. }
  55879. }
  55880. }
  55881. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55882. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55883. let captionHeight = 0;
  55884. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55885. captionHeight = this.caption.reserve;
  55886. if (captionHeight <= 0) {
  55887. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55888. }
  55889. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55890. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55891. } else {
  55892. ui.children[0].attributes.style.height = "100%";
  55893. }
  55894. }
  55895. if (aElement) {
  55896. ui.children.push(aElement);
  55897. }
  55898. if (!caption) {
  55899. if (ui.attributes.class) {
  55900. ui.attributes.class.push("xfaLeft");
  55901. }
  55902. this.w = savedW;
  55903. this.h = savedH;
  55904. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55905. }
  55906. if (this.ui.button) {
  55907. if (style.padding) {
  55908. delete style.padding;
  55909. }
  55910. if (caption.name === "div") {
  55911. caption.name = "span";
  55912. }
  55913. ui.children.push(caption);
  55914. return _utils.HTMLResult.success(html, bbox);
  55915. } else if (this.ui.checkButton) {
  55916. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55917. }
  55918. if (!ui.attributes.class) {
  55919. ui.attributes.class = [];
  55920. }
  55921. ui.children.splice(0, 0, caption);
  55922. switch (this.caption.placement) {
  55923. case "left":
  55924. ui.attributes.class.push("xfaLeft");
  55925. break;
  55926. case "right":
  55927. ui.attributes.class.push("xfaRight");
  55928. break;
  55929. case "top":
  55930. ui.attributes.class.push("xfaTop");
  55931. break;
  55932. case "bottom":
  55933. ui.attributes.class.push("xfaBottom");
  55934. break;
  55935. case "inline":
  55936. ui.attributes.class.push("xfaLeft");
  55937. break;
  55938. }
  55939. this.w = savedW;
  55940. this.h = savedH;
  55941. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55942. }
  55943. }
  55944. exports.Field = Field;
  55945. class Fill extends _xfa_object.XFAObject {
  55946. constructor(attributes) {
  55947. super(TEMPLATE_NS_ID, "fill", true);
  55948. this.id = attributes.id || "";
  55949. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55950. this.use = attributes.use || "";
  55951. this.usehref = attributes.usehref || "";
  55952. this.color = null;
  55953. this.extras = null;
  55954. this.linear = null;
  55955. this.pattern = null;
  55956. this.radial = null;
  55957. this.solid = null;
  55958. this.stipple = null;
  55959. }
  55960. [_xfa_object.$toStyle]() {
  55961. const parent = this[_xfa_object.$getParent]();
  55962. const grandpa = parent[_xfa_object.$getParent]();
  55963. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55964. const style = Object.create(null);
  55965. let propName = "color";
  55966. let altPropName = propName;
  55967. if (parent instanceof Border) {
  55968. propName = "background-color";
  55969. altPropName = "background";
  55970. if (ggrandpa instanceof Ui) {
  55971. style.backgroundColor = "white";
  55972. }
  55973. }
  55974. if (parent instanceof Rectangle || parent instanceof Arc) {
  55975. propName = altPropName = "fill";
  55976. style.fill = "white";
  55977. }
  55978. for (const name of Object.getOwnPropertyNames(this)) {
  55979. if (name === "extras" || name === "color") {
  55980. continue;
  55981. }
  55982. const obj = this[name];
  55983. if (!(obj instanceof _xfa_object.XFAObject)) {
  55984. continue;
  55985. }
  55986. const color = obj[_xfa_object.$toStyle](this.color);
  55987. if (color) {
  55988. style[color.startsWith("#") ? propName : altPropName] = color;
  55989. }
  55990. return style;
  55991. }
  55992. if (this.color && this.color.value) {
  55993. const color = this.color[_xfa_object.$toStyle]();
  55994. style[color.startsWith("#") ? propName : altPropName] = color;
  55995. }
  55996. return style;
  55997. }
  55998. }
  55999. class Filter extends _xfa_object.XFAObject {
  56000. constructor(attributes) {
  56001. super(TEMPLATE_NS_ID, "filter", true);
  56002. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  56003. this.id = attributes.id || "";
  56004. this.name = attributes.name || "";
  56005. this.use = attributes.use || "";
  56006. this.usehref = attributes.usehref || "";
  56007. this.version = (0, _utils.getInteger)({
  56008. data: this.version,
  56009. defaultValue: 5,
  56010. validate: x => x >= 1 && x <= 5
  56011. });
  56012. this.appearanceFilter = null;
  56013. this.certificates = null;
  56014. this.digestMethods = null;
  56015. this.encodings = null;
  56016. this.encryptionMethods = null;
  56017. this.handler = null;
  56018. this.lockDocument = null;
  56019. this.mdp = null;
  56020. this.reasons = null;
  56021. this.timeStamp = null;
  56022. }
  56023. }
  56024. class Float extends _xfa_object.ContentObject {
  56025. constructor(attributes) {
  56026. super(TEMPLATE_NS_ID, "float");
  56027. this.id = attributes.id || "";
  56028. this.name = attributes.name || "";
  56029. this.use = attributes.use || "";
  56030. this.usehref = attributes.usehref || "";
  56031. }
  56032. [_xfa_object.$finalize]() {
  56033. const number = parseFloat(this[_xfa_object.$content].trim());
  56034. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56035. }
  56036. [_xfa_object.$toHTML](availableSpace) {
  56037. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56038. }
  56039. }
  56040. class Font extends _xfa_object.XFAObject {
  56041. constructor(attributes) {
  56042. super(TEMPLATE_NS_ID, "font", true);
  56043. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  56044. this.fontHorizontalScale = (0, _utils.getFloat)({
  56045. data: attributes.fontHorizontalScale,
  56046. defaultValue: 100,
  56047. validate: x => x >= 0
  56048. });
  56049. this.fontVerticalScale = (0, _utils.getFloat)({
  56050. data: attributes.fontVerticalScale,
  56051. defaultValue: 100,
  56052. validate: x => x >= 0
  56053. });
  56054. this.id = attributes.id || "";
  56055. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  56056. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  56057. this.lineThrough = (0, _utils.getInteger)({
  56058. data: attributes.lineThrough,
  56059. defaultValue: 0,
  56060. validate: x => x === 1 || x === 2
  56061. });
  56062. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  56063. this.overline = (0, _utils.getInteger)({
  56064. data: attributes.overline,
  56065. defaultValue: 0,
  56066. validate: x => x === 1 || x === 2
  56067. });
  56068. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  56069. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  56070. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  56071. this.typeface = attributes.typeface || "Courier";
  56072. this.underline = (0, _utils.getInteger)({
  56073. data: attributes.underline,
  56074. defaultValue: 0,
  56075. validate: x => x === 1 || x === 2
  56076. });
  56077. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  56078. this.use = attributes.use || "";
  56079. this.usehref = attributes.usehref || "";
  56080. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  56081. this.extras = null;
  56082. this.fill = null;
  56083. }
  56084. [_xfa_object.$clean](builder) {
  56085. super[_xfa_object.$clean](builder);
  56086. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  56087. }
  56088. [_xfa_object.$toStyle]() {
  56089. const style = (0, _html_utils.toStyle)(this, "fill");
  56090. const color = style.color;
  56091. if (color) {
  56092. if (color === "#000000") {
  56093. delete style.color;
  56094. } else if (!color.startsWith("#")) {
  56095. style.background = color;
  56096. style.backgroundClip = "text";
  56097. style.color = "transparent";
  56098. }
  56099. }
  56100. if (this.baselineShift) {
  56101. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  56102. }
  56103. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  56104. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  56105. if (this.lineThrough !== 0) {
  56106. style.textDecoration = "line-through";
  56107. if (this.lineThrough === 2) {
  56108. style.textDecorationStyle = "double";
  56109. }
  56110. }
  56111. if (this.overline !== 0) {
  56112. style.textDecoration = "overline";
  56113. if (this.overline === 2) {
  56114. style.textDecorationStyle = "double";
  56115. }
  56116. }
  56117. style.fontStyle = this.posture;
  56118. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  56119. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  56120. if (this.underline !== 0) {
  56121. style.textDecoration = "underline";
  56122. if (this.underline === 2) {
  56123. style.textDecorationStyle = "double";
  56124. }
  56125. }
  56126. style.fontWeight = this.weight;
  56127. return style;
  56128. }
  56129. }
  56130. class Format extends _xfa_object.XFAObject {
  56131. constructor(attributes) {
  56132. super(TEMPLATE_NS_ID, "format", true);
  56133. this.id = attributes.id || "";
  56134. this.use = attributes.use || "";
  56135. this.usehref = attributes.usehref || "";
  56136. this.extras = null;
  56137. this.picture = null;
  56138. }
  56139. }
  56140. class Handler extends _xfa_object.StringObject {
  56141. constructor(attributes) {
  56142. super(TEMPLATE_NS_ID, "handler");
  56143. this.id = attributes.id || "";
  56144. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56145. this.use = attributes.use || "";
  56146. this.usehref = attributes.usehref || "";
  56147. }
  56148. }
  56149. class Hyphenation extends _xfa_object.XFAObject {
  56150. constructor(attributes) {
  56151. super(TEMPLATE_NS_ID, "hyphenation");
  56152. this.excludeAllCaps = (0, _utils.getInteger)({
  56153. data: attributes.excludeAllCaps,
  56154. defaultValue: 0,
  56155. validate: x => x === 1
  56156. });
  56157. this.excludeInitialCap = (0, _utils.getInteger)({
  56158. data: attributes.excludeInitialCap,
  56159. defaultValue: 0,
  56160. validate: x => x === 1
  56161. });
  56162. this.hyphenate = (0, _utils.getInteger)({
  56163. data: attributes.hyphenate,
  56164. defaultValue: 0,
  56165. validate: x => x === 1
  56166. });
  56167. this.id = attributes.id || "";
  56168. this.pushCharacterCount = (0, _utils.getInteger)({
  56169. data: attributes.pushCharacterCount,
  56170. defaultValue: 3,
  56171. validate: x => x >= 0
  56172. });
  56173. this.remainCharacterCount = (0, _utils.getInteger)({
  56174. data: attributes.remainCharacterCount,
  56175. defaultValue: 3,
  56176. validate: x => x >= 0
  56177. });
  56178. this.use = attributes.use || "";
  56179. this.usehref = attributes.usehref || "";
  56180. this.wordCharacterCount = (0, _utils.getInteger)({
  56181. data: attributes.wordCharacterCount,
  56182. defaultValue: 7,
  56183. validate: x => x >= 0
  56184. });
  56185. }
  56186. }
  56187. class Image extends _xfa_object.StringObject {
  56188. constructor(attributes) {
  56189. super(TEMPLATE_NS_ID, "image");
  56190. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  56191. this.contentType = attributes.contentType || "";
  56192. this.href = attributes.href || "";
  56193. this.id = attributes.id || "";
  56194. this.name = attributes.name || "";
  56195. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  56196. this.use = attributes.use || "";
  56197. this.usehref = attributes.usehref || "";
  56198. }
  56199. [_xfa_object.$toHTML]() {
  56200. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  56201. return _utils.HTMLResult.EMPTY;
  56202. }
  56203. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  56204. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  56205. return _utils.HTMLResult.EMPTY;
  56206. }
  56207. if (!buffer && this.transferEncoding === "base64") {
  56208. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  56209. }
  56210. if (!buffer) {
  56211. return _utils.HTMLResult.EMPTY;
  56212. }
  56213. if (!this.contentType) {
  56214. for (const [header, type] of IMAGES_HEADERS) {
  56215. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  56216. this.contentType = type;
  56217. break;
  56218. }
  56219. }
  56220. if (!this.contentType) {
  56221. return _utils.HTMLResult.EMPTY;
  56222. }
  56223. }
  56224. const blob = new Blob([buffer], {
  56225. type: this.contentType
  56226. });
  56227. let style;
  56228. switch (this.aspect) {
  56229. case "fit":
  56230. case "actual":
  56231. break;
  56232. case "height":
  56233. style = {
  56234. height: "100%",
  56235. objectFit: "fill"
  56236. };
  56237. break;
  56238. case "none":
  56239. style = {
  56240. width: "100%",
  56241. height: "100%",
  56242. objectFit: "fill"
  56243. };
  56244. break;
  56245. case "width":
  56246. style = {
  56247. width: "100%",
  56248. objectFit: "fill"
  56249. };
  56250. break;
  56251. }
  56252. const parent = this[_xfa_object.$getParent]();
  56253. return _utils.HTMLResult.success({
  56254. name: "img",
  56255. attributes: {
  56256. class: ["xfaImage"],
  56257. style,
  56258. src: URL.createObjectURL(blob),
  56259. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  56260. }
  56261. });
  56262. }
  56263. }
  56264. class ImageEdit extends _xfa_object.XFAObject {
  56265. constructor(attributes) {
  56266. super(TEMPLATE_NS_ID, "imageEdit", true);
  56267. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  56268. this.id = attributes.id || "";
  56269. this.use = attributes.use || "";
  56270. this.usehref = attributes.usehref || "";
  56271. this.border = null;
  56272. this.extras = null;
  56273. this.margin = null;
  56274. }
  56275. [_xfa_object.$toHTML](availableSpace) {
  56276. if (this.data === "embed") {
  56277. return _utils.HTMLResult.success({
  56278. name: "div",
  56279. children: [],
  56280. attributes: {}
  56281. });
  56282. }
  56283. return _utils.HTMLResult.EMPTY;
  56284. }
  56285. }
  56286. class Integer extends _xfa_object.ContentObject {
  56287. constructor(attributes) {
  56288. super(TEMPLATE_NS_ID, "integer");
  56289. this.id = attributes.id || "";
  56290. this.name = attributes.name || "";
  56291. this.use = attributes.use || "";
  56292. this.usehref = attributes.usehref || "";
  56293. }
  56294. [_xfa_object.$finalize]() {
  56295. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  56296. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56297. }
  56298. [_xfa_object.$toHTML](availableSpace) {
  56299. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56300. }
  56301. }
  56302. class Issuers extends _xfa_object.XFAObject {
  56303. constructor(attributes) {
  56304. super(TEMPLATE_NS_ID, "issuers", true);
  56305. this.id = attributes.id || "";
  56306. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56307. this.use = attributes.use || "";
  56308. this.usehref = attributes.usehref || "";
  56309. this.certificate = new _xfa_object.XFAObjectArray();
  56310. }
  56311. }
  56312. class Items extends _xfa_object.XFAObject {
  56313. constructor(attributes) {
  56314. super(TEMPLATE_NS_ID, "items", true);
  56315. this.id = attributes.id || "";
  56316. this.name = attributes.name || "";
  56317. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56318. this.ref = attributes.ref || "";
  56319. this.save = (0, _utils.getInteger)({
  56320. data: attributes.save,
  56321. defaultValue: 0,
  56322. validate: x => x === 1
  56323. });
  56324. this.use = attributes.use || "";
  56325. this.usehref = attributes.usehref || "";
  56326. this.boolean = new _xfa_object.XFAObjectArray();
  56327. this.date = new _xfa_object.XFAObjectArray();
  56328. this.dateTime = new _xfa_object.XFAObjectArray();
  56329. this.decimal = new _xfa_object.XFAObjectArray();
  56330. this.exData = new _xfa_object.XFAObjectArray();
  56331. this.float = new _xfa_object.XFAObjectArray();
  56332. this.image = new _xfa_object.XFAObjectArray();
  56333. this.integer = new _xfa_object.XFAObjectArray();
  56334. this.text = new _xfa_object.XFAObjectArray();
  56335. this.time = new _xfa_object.XFAObjectArray();
  56336. }
  56337. [_xfa_object.$toHTML]() {
  56338. const output = [];
  56339. for (const child of this[_xfa_object.$getChildren]()) {
  56340. output.push(child[_xfa_object.$text]());
  56341. }
  56342. return _utils.HTMLResult.success(output);
  56343. }
  56344. }
  56345. exports.Items = Items;
  56346. class Keep extends _xfa_object.XFAObject {
  56347. constructor(attributes) {
  56348. super(TEMPLATE_NS_ID, "keep", true);
  56349. this.id = attributes.id || "";
  56350. const options = ["none", "contentArea", "pageArea"];
  56351. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  56352. this.next = (0, _utils.getStringOption)(attributes.next, options);
  56353. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  56354. this.use = attributes.use || "";
  56355. this.usehref = attributes.usehref || "";
  56356. this.extras = null;
  56357. }
  56358. }
  56359. class KeyUsage extends _xfa_object.XFAObject {
  56360. constructor(attributes) {
  56361. super(TEMPLATE_NS_ID, "keyUsage");
  56362. const options = ["", "yes", "no"];
  56363. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  56364. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  56365. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  56366. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  56367. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  56368. this.id = attributes.id || "";
  56369. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  56370. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  56371. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  56372. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  56373. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56374. this.use = attributes.use || "";
  56375. this.usehref = attributes.usehref || "";
  56376. }
  56377. }
  56378. class Line extends _xfa_object.XFAObject {
  56379. constructor(attributes) {
  56380. super(TEMPLATE_NS_ID, "line", true);
  56381. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56382. this.id = attributes.id || "";
  56383. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  56384. this.use = attributes.use || "";
  56385. this.usehref = attributes.usehref || "";
  56386. this.edge = null;
  56387. }
  56388. [_xfa_object.$toHTML]() {
  56389. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56390. const edge = this.edge || new Edge({});
  56391. const edgeStyle = edge[_xfa_object.$toStyle]();
  56392. const style = Object.create(null);
  56393. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  56394. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  56395. style.stroke = edgeStyle.color;
  56396. let x1, y1, x2, y2;
  56397. let width = "100%";
  56398. let height = "100%";
  56399. if (parent.w <= thickness) {
  56400. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  56401. width = style.strokeWidth;
  56402. } else if (parent.h <= thickness) {
  56403. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  56404. height = style.strokeWidth;
  56405. } else {
  56406. if (this.slope === "\\") {
  56407. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  56408. } else {
  56409. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  56410. }
  56411. }
  56412. const line = {
  56413. name: "line",
  56414. attributes: {
  56415. xmlns: SVG_NS,
  56416. x1,
  56417. y1,
  56418. x2,
  56419. y2,
  56420. style
  56421. }
  56422. };
  56423. const svg = {
  56424. name: "svg",
  56425. children: [line],
  56426. attributes: {
  56427. xmlns: SVG_NS,
  56428. width,
  56429. height,
  56430. style: {
  56431. overflow: "visible"
  56432. }
  56433. }
  56434. };
  56435. if (hasMargin(parent)) {
  56436. return _utils.HTMLResult.success({
  56437. name: "div",
  56438. attributes: {
  56439. style: {
  56440. display: "inline",
  56441. width: "100%",
  56442. height: "100%"
  56443. }
  56444. },
  56445. children: [svg]
  56446. });
  56447. }
  56448. svg.attributes.style.position = "absolute";
  56449. return _utils.HTMLResult.success(svg);
  56450. }
  56451. }
  56452. class Linear extends _xfa_object.XFAObject {
  56453. constructor(attributes) {
  56454. super(TEMPLATE_NS_ID, "linear", true);
  56455. this.id = attributes.id || "";
  56456. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  56457. this.use = attributes.use || "";
  56458. this.usehref = attributes.usehref || "";
  56459. this.color = null;
  56460. this.extras = null;
  56461. }
  56462. [_xfa_object.$toStyle](startColor) {
  56463. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56464. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  56465. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56466. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  56467. }
  56468. }
  56469. class LockDocument extends _xfa_object.ContentObject {
  56470. constructor(attributes) {
  56471. super(TEMPLATE_NS_ID, "lockDocument");
  56472. this.id = attributes.id || "";
  56473. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56474. this.use = attributes.use || "";
  56475. this.usehref = attributes.usehref || "";
  56476. }
  56477. [_xfa_object.$finalize]() {
  56478. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  56479. }
  56480. }
  56481. class Manifest extends _xfa_object.XFAObject {
  56482. constructor(attributes) {
  56483. super(TEMPLATE_NS_ID, "manifest", true);
  56484. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  56485. this.id = attributes.id || "";
  56486. this.name = attributes.name || "";
  56487. this.use = attributes.use || "";
  56488. this.usehref = attributes.usehref || "";
  56489. this.extras = null;
  56490. this.ref = new _xfa_object.XFAObjectArray();
  56491. }
  56492. }
  56493. class Margin extends _xfa_object.XFAObject {
  56494. constructor(attributes) {
  56495. super(TEMPLATE_NS_ID, "margin", true);
  56496. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  56497. this.id = attributes.id || "";
  56498. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  56499. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  56500. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  56501. this.use = attributes.use || "";
  56502. this.usehref = attributes.usehref || "";
  56503. this.extras = null;
  56504. }
  56505. [_xfa_object.$toStyle]() {
  56506. return {
  56507. 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)
  56508. };
  56509. }
  56510. }
  56511. class Mdp extends _xfa_object.XFAObject {
  56512. constructor(attributes) {
  56513. super(TEMPLATE_NS_ID, "mdp");
  56514. this.id = attributes.id || "";
  56515. this.permissions = (0, _utils.getInteger)({
  56516. data: attributes.permissions,
  56517. defaultValue: 2,
  56518. validate: x => x === 1 || x === 3
  56519. });
  56520. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  56521. this.use = attributes.use || "";
  56522. this.usehref = attributes.usehref || "";
  56523. }
  56524. }
  56525. class Medium extends _xfa_object.XFAObject {
  56526. constructor(attributes) {
  56527. super(TEMPLATE_NS_ID, "medium");
  56528. this.id = attributes.id || "";
  56529. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  56530. this.long = (0, _utils.getMeasurement)(attributes.long);
  56531. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  56532. this.short = (0, _utils.getMeasurement)(attributes.short);
  56533. this.stock = attributes.stock || "";
  56534. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56535. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56536. this.use = attributes.use || "";
  56537. this.usehref = attributes.usehref || "";
  56538. }
  56539. }
  56540. class Message extends _xfa_object.XFAObject {
  56541. constructor(attributes) {
  56542. super(TEMPLATE_NS_ID, "message", true);
  56543. this.id = attributes.id || "";
  56544. this.use = attributes.use || "";
  56545. this.usehref = attributes.usehref || "";
  56546. this.text = new _xfa_object.XFAObjectArray();
  56547. }
  56548. }
  56549. class NumericEdit extends _xfa_object.XFAObject {
  56550. constructor(attributes) {
  56551. super(TEMPLATE_NS_ID, "numericEdit", true);
  56552. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56553. this.id = attributes.id || "";
  56554. this.use = attributes.use || "";
  56555. this.usehref = attributes.usehref || "";
  56556. this.border = null;
  56557. this.comb = null;
  56558. this.extras = null;
  56559. this.margin = null;
  56560. }
  56561. [_xfa_object.$toHTML](availableSpace) {
  56562. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56563. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56564. const html = {
  56565. name: "input",
  56566. attributes: {
  56567. type: "text",
  56568. fieldId: field[_xfa_object.$uid],
  56569. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56570. class: ["xfaTextfield"],
  56571. style,
  56572. "aria-label": ariaLabel(field),
  56573. "aria-required": false
  56574. }
  56575. };
  56576. if (isRequired(field)) {
  56577. html.attributes["aria-required"] = true;
  56578. html.attributes.required = true;
  56579. }
  56580. return _utils.HTMLResult.success({
  56581. name: "label",
  56582. attributes: {
  56583. class: ["xfaLabel"]
  56584. },
  56585. children: [html]
  56586. });
  56587. }
  56588. }
  56589. class Occur extends _xfa_object.XFAObject {
  56590. constructor(attributes) {
  56591. super(TEMPLATE_NS_ID, "occur", true);
  56592. this.id = attributes.id || "";
  56593. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56594. data: attributes.initial,
  56595. defaultValue: "",
  56596. validate: x => true
  56597. }) : "";
  56598. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56599. data: attributes.max,
  56600. defaultValue: 1,
  56601. validate: x => true
  56602. }) : "";
  56603. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56604. data: attributes.min,
  56605. defaultValue: 1,
  56606. validate: x => true
  56607. }) : "";
  56608. this.use = attributes.use || "";
  56609. this.usehref = attributes.usehref || "";
  56610. this.extras = null;
  56611. }
  56612. [_xfa_object.$clean]() {
  56613. const parent = this[_xfa_object.$getParent]();
  56614. const originalMin = this.min;
  56615. if (this.min === "") {
  56616. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56617. }
  56618. if (this.max === "") {
  56619. if (originalMin === "") {
  56620. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56621. } else {
  56622. this.max = this.min;
  56623. }
  56624. }
  56625. if (this.max !== -1 && this.max < this.min) {
  56626. this.max = this.min;
  56627. }
  56628. if (this.initial === "") {
  56629. this.initial = parent instanceof Template ? 1 : this.min;
  56630. }
  56631. }
  56632. }
  56633. class Oid extends _xfa_object.StringObject {
  56634. constructor(attributes) {
  56635. super(TEMPLATE_NS_ID, "oid");
  56636. this.id = attributes.id || "";
  56637. this.name = attributes.name || "";
  56638. this.use = attributes.use || "";
  56639. this.usehref = attributes.usehref || "";
  56640. }
  56641. }
  56642. class Oids extends _xfa_object.XFAObject {
  56643. constructor(attributes) {
  56644. super(TEMPLATE_NS_ID, "oids", true);
  56645. this.id = attributes.id || "";
  56646. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56647. this.use = attributes.use || "";
  56648. this.usehref = attributes.usehref || "";
  56649. this.oid = new _xfa_object.XFAObjectArray();
  56650. }
  56651. }
  56652. class Overflow extends _xfa_object.XFAObject {
  56653. constructor(attributes) {
  56654. super(TEMPLATE_NS_ID, "overflow");
  56655. this.id = attributes.id || "";
  56656. this.leader = attributes.leader || "";
  56657. this.target = attributes.target || "";
  56658. this.trailer = attributes.trailer || "";
  56659. this.use = attributes.use || "";
  56660. this.usehref = attributes.usehref || "";
  56661. }
  56662. [_xfa_object.$getExtra]() {
  56663. if (!this[_xfa_object.$extra]) {
  56664. const parent = this[_xfa_object.$getParent]();
  56665. const root = this[_xfa_object.$getTemplateRoot]();
  56666. const target = root[_xfa_object.$searchNode](this.target, parent);
  56667. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56668. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56669. this[_xfa_object.$extra] = {
  56670. target: target && target[0] || null,
  56671. leader: leader && leader[0] || null,
  56672. trailer: trailer && trailer[0] || null,
  56673. addLeader: false,
  56674. addTrailer: false
  56675. };
  56676. }
  56677. return this[_xfa_object.$extra];
  56678. }
  56679. }
  56680. class PageArea extends _xfa_object.XFAObject {
  56681. constructor(attributes) {
  56682. super(TEMPLATE_NS_ID, "pageArea", true);
  56683. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56684. this.id = attributes.id || "";
  56685. this.initialNumber = (0, _utils.getInteger)({
  56686. data: attributes.initialNumber,
  56687. defaultValue: 1,
  56688. validate: x => true
  56689. });
  56690. this.name = attributes.name || "";
  56691. this.numbered = (0, _utils.getInteger)({
  56692. data: attributes.numbered,
  56693. defaultValue: 1,
  56694. validate: x => true
  56695. });
  56696. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56697. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56698. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56699. this.use = attributes.use || "";
  56700. this.usehref = attributes.usehref || "";
  56701. this.desc = null;
  56702. this.extras = null;
  56703. this.medium = null;
  56704. this.occur = null;
  56705. this.area = new _xfa_object.XFAObjectArray();
  56706. this.contentArea = new _xfa_object.XFAObjectArray();
  56707. this.draw = new _xfa_object.XFAObjectArray();
  56708. this.exclGroup = new _xfa_object.XFAObjectArray();
  56709. this.field = new _xfa_object.XFAObjectArray();
  56710. this.subform = new _xfa_object.XFAObjectArray();
  56711. }
  56712. [_xfa_object.$isUsable]() {
  56713. if (!this[_xfa_object.$extra]) {
  56714. this[_xfa_object.$extra] = {
  56715. numberOfUse: 0
  56716. };
  56717. return true;
  56718. }
  56719. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56720. }
  56721. [_xfa_object.$cleanPage]() {
  56722. delete this[_xfa_object.$extra];
  56723. }
  56724. [_xfa_object.$getNextPage]() {
  56725. if (!this[_xfa_object.$extra]) {
  56726. this[_xfa_object.$extra] = {
  56727. numberOfUse: 0
  56728. };
  56729. }
  56730. const parent = this[_xfa_object.$getParent]();
  56731. if (parent.relation === "orderedOccurrence") {
  56732. if (this[_xfa_object.$isUsable]()) {
  56733. this[_xfa_object.$extra].numberOfUse += 1;
  56734. return this;
  56735. }
  56736. }
  56737. return parent[_xfa_object.$getNextPage]();
  56738. }
  56739. [_xfa_object.$getAvailableSpace]() {
  56740. return this[_xfa_object.$extra].space || {
  56741. width: 0,
  56742. height: 0
  56743. };
  56744. }
  56745. [_xfa_object.$toHTML]() {
  56746. if (!this[_xfa_object.$extra]) {
  56747. this[_xfa_object.$extra] = {
  56748. numberOfUse: 1
  56749. };
  56750. }
  56751. const children = [];
  56752. this[_xfa_object.$extra].children = children;
  56753. const style = Object.create(null);
  56754. if (this.medium && this.medium.short && this.medium.long) {
  56755. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56756. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56757. this[_xfa_object.$extra].space = {
  56758. width: this.medium.short,
  56759. height: this.medium.long
  56760. };
  56761. if (this.medium.orientation === "landscape") {
  56762. const x = style.width;
  56763. style.width = style.height;
  56764. style.height = x;
  56765. this[_xfa_object.$extra].space = {
  56766. width: this.medium.long,
  56767. height: this.medium.short
  56768. };
  56769. }
  56770. } else {
  56771. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56772. }
  56773. this[_xfa_object.$childrenToHTML]({
  56774. filter: new Set(["area", "draw", "field", "subform"]),
  56775. include: true
  56776. });
  56777. this[_xfa_object.$childrenToHTML]({
  56778. filter: new Set(["contentArea"]),
  56779. include: true
  56780. });
  56781. return _utils.HTMLResult.success({
  56782. name: "div",
  56783. children,
  56784. attributes: {
  56785. class: ["xfaPage"],
  56786. id: this[_xfa_object.$uid],
  56787. style,
  56788. xfaName: this.name
  56789. }
  56790. });
  56791. }
  56792. }
  56793. class PageSet extends _xfa_object.XFAObject {
  56794. constructor(attributes) {
  56795. super(TEMPLATE_NS_ID, "pageSet", true);
  56796. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56797. this.id = attributes.id || "";
  56798. this.name = attributes.name || "";
  56799. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56800. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56801. this.use = attributes.use || "";
  56802. this.usehref = attributes.usehref || "";
  56803. this.extras = null;
  56804. this.occur = null;
  56805. this.pageArea = new _xfa_object.XFAObjectArray();
  56806. this.pageSet = new _xfa_object.XFAObjectArray();
  56807. }
  56808. [_xfa_object.$cleanPage]() {
  56809. for (const page of this.pageArea.children) {
  56810. page[_xfa_object.$cleanPage]();
  56811. }
  56812. for (const page of this.pageSet.children) {
  56813. page[_xfa_object.$cleanPage]();
  56814. }
  56815. }
  56816. [_xfa_object.$isUsable]() {
  56817. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56818. }
  56819. [_xfa_object.$getNextPage]() {
  56820. if (!this[_xfa_object.$extra]) {
  56821. this[_xfa_object.$extra] = {
  56822. numberOfUse: 1,
  56823. pageIndex: -1,
  56824. pageSetIndex: -1
  56825. };
  56826. }
  56827. if (this.relation === "orderedOccurrence") {
  56828. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56829. this[_xfa_object.$extra].pageIndex += 1;
  56830. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56831. return pageArea[_xfa_object.$getNextPage]();
  56832. }
  56833. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56834. this[_xfa_object.$extra].pageSetIndex += 1;
  56835. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56836. }
  56837. if (this[_xfa_object.$isUsable]()) {
  56838. this[_xfa_object.$extra].numberOfUse += 1;
  56839. this[_xfa_object.$extra].pageIndex = -1;
  56840. this[_xfa_object.$extra].pageSetIndex = -1;
  56841. return this[_xfa_object.$getNextPage]();
  56842. }
  56843. const parent = this[_xfa_object.$getParent]();
  56844. if (parent instanceof PageSet) {
  56845. return parent[_xfa_object.$getNextPage]();
  56846. }
  56847. this[_xfa_object.$cleanPage]();
  56848. return this[_xfa_object.$getNextPage]();
  56849. }
  56850. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56851. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56852. const position = pageNumber === 0 ? "first" : "rest";
  56853. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56854. if (page) {
  56855. return page;
  56856. }
  56857. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56858. if (page) {
  56859. return page;
  56860. }
  56861. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56862. if (page) {
  56863. return page;
  56864. }
  56865. return this.pageArea.children[0];
  56866. }
  56867. }
  56868. class Para extends _xfa_object.XFAObject {
  56869. constructor(attributes) {
  56870. super(TEMPLATE_NS_ID, "para", true);
  56871. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56872. this.id = attributes.id || "";
  56873. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56874. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56875. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56876. this.orphans = (0, _utils.getInteger)({
  56877. data: attributes.orphans,
  56878. defaultValue: 0,
  56879. validate: x => x >= 0
  56880. });
  56881. this.preserve = attributes.preserve || "";
  56882. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56883. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56884. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56885. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56886. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56887. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56888. this.use = attributes.use || "";
  56889. this.usehref = attributes.usehref || "";
  56890. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56891. this.widows = (0, _utils.getInteger)({
  56892. data: attributes.widows,
  56893. defaultValue: 0,
  56894. validate: x => x >= 0
  56895. });
  56896. this.hyphenation = null;
  56897. }
  56898. [_xfa_object.$toStyle]() {
  56899. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56900. if (this.marginLeft !== "") {
  56901. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56902. }
  56903. if (this.marginRight !== "") {
  56904. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56905. }
  56906. if (this.spaceAbove !== "") {
  56907. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56908. }
  56909. if (this.spaceBelow !== "") {
  56910. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56911. }
  56912. if (this.textIndent !== "") {
  56913. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56914. (0, _html_utils.fixTextIndent)(style);
  56915. }
  56916. if (this.lineHeight > 0) {
  56917. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56918. }
  56919. if (this.tabDefault !== "") {
  56920. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56921. }
  56922. if (this.tabStops.length > 0) {}
  56923. if (this.hyphenatation) {
  56924. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56925. }
  56926. return style;
  56927. }
  56928. }
  56929. class PasswordEdit extends _xfa_object.XFAObject {
  56930. constructor(attributes) {
  56931. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56932. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56933. this.id = attributes.id || "";
  56934. this.passwordChar = attributes.passwordChar || "*";
  56935. this.use = attributes.use || "";
  56936. this.usehref = attributes.usehref || "";
  56937. this.border = null;
  56938. this.extras = null;
  56939. this.margin = null;
  56940. }
  56941. }
  56942. class Pattern extends _xfa_object.XFAObject {
  56943. constructor(attributes) {
  56944. super(TEMPLATE_NS_ID, "pattern", true);
  56945. this.id = attributes.id || "";
  56946. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56947. this.use = attributes.use || "";
  56948. this.usehref = attributes.usehref || "";
  56949. this.color = null;
  56950. this.extras = null;
  56951. }
  56952. [_xfa_object.$toStyle](startColor) {
  56953. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56954. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56955. const width = 5;
  56956. const cmd = "repeating-linear-gradient";
  56957. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56958. switch (this.type) {
  56959. case "crossHatch":
  56960. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56961. case "crossDiagonal":
  56962. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56963. case "diagonalLeft":
  56964. return `${cmd}(45deg,${colors})`;
  56965. case "diagonalRight":
  56966. return `${cmd}(-45deg,${colors})`;
  56967. case "horizontal":
  56968. return `${cmd}(to top,${colors})`;
  56969. case "vertical":
  56970. return `${cmd}(to right,${colors})`;
  56971. }
  56972. return "";
  56973. }
  56974. }
  56975. class Picture extends _xfa_object.StringObject {
  56976. constructor(attributes) {
  56977. super(TEMPLATE_NS_ID, "picture");
  56978. this.id = attributes.id || "";
  56979. this.use = attributes.use || "";
  56980. this.usehref = attributes.usehref || "";
  56981. }
  56982. }
  56983. class Proto extends _xfa_object.XFAObject {
  56984. constructor(attributes) {
  56985. super(TEMPLATE_NS_ID, "proto", true);
  56986. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  56987. this.arc = new _xfa_object.XFAObjectArray();
  56988. this.area = new _xfa_object.XFAObjectArray();
  56989. this.assist = new _xfa_object.XFAObjectArray();
  56990. this.barcode = new _xfa_object.XFAObjectArray();
  56991. this.bindItems = new _xfa_object.XFAObjectArray();
  56992. this.bookend = new _xfa_object.XFAObjectArray();
  56993. this.boolean = new _xfa_object.XFAObjectArray();
  56994. this.border = new _xfa_object.XFAObjectArray();
  56995. this.break = new _xfa_object.XFAObjectArray();
  56996. this.breakAfter = new _xfa_object.XFAObjectArray();
  56997. this.breakBefore = new _xfa_object.XFAObjectArray();
  56998. this.button = new _xfa_object.XFAObjectArray();
  56999. this.calculate = new _xfa_object.XFAObjectArray();
  57000. this.caption = new _xfa_object.XFAObjectArray();
  57001. this.certificate = new _xfa_object.XFAObjectArray();
  57002. this.certificates = new _xfa_object.XFAObjectArray();
  57003. this.checkButton = new _xfa_object.XFAObjectArray();
  57004. this.choiceList = new _xfa_object.XFAObjectArray();
  57005. this.color = new _xfa_object.XFAObjectArray();
  57006. this.comb = new _xfa_object.XFAObjectArray();
  57007. this.connect = new _xfa_object.XFAObjectArray();
  57008. this.contentArea = new _xfa_object.XFAObjectArray();
  57009. this.corner = new _xfa_object.XFAObjectArray();
  57010. this.date = new _xfa_object.XFAObjectArray();
  57011. this.dateTime = new _xfa_object.XFAObjectArray();
  57012. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  57013. this.decimal = new _xfa_object.XFAObjectArray();
  57014. this.defaultUi = new _xfa_object.XFAObjectArray();
  57015. this.desc = new _xfa_object.XFAObjectArray();
  57016. this.digestMethod = new _xfa_object.XFAObjectArray();
  57017. this.digestMethods = new _xfa_object.XFAObjectArray();
  57018. this.draw = new _xfa_object.XFAObjectArray();
  57019. this.edge = new _xfa_object.XFAObjectArray();
  57020. this.encoding = new _xfa_object.XFAObjectArray();
  57021. this.encodings = new _xfa_object.XFAObjectArray();
  57022. this.encrypt = new _xfa_object.XFAObjectArray();
  57023. this.encryptData = new _xfa_object.XFAObjectArray();
  57024. this.encryption = new _xfa_object.XFAObjectArray();
  57025. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  57026. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  57027. this.event = new _xfa_object.XFAObjectArray();
  57028. this.exData = new _xfa_object.XFAObjectArray();
  57029. this.exObject = new _xfa_object.XFAObjectArray();
  57030. this.exclGroup = new _xfa_object.XFAObjectArray();
  57031. this.execute = new _xfa_object.XFAObjectArray();
  57032. this.extras = new _xfa_object.XFAObjectArray();
  57033. this.field = new _xfa_object.XFAObjectArray();
  57034. this.fill = new _xfa_object.XFAObjectArray();
  57035. this.filter = new _xfa_object.XFAObjectArray();
  57036. this.float = new _xfa_object.XFAObjectArray();
  57037. this.font = new _xfa_object.XFAObjectArray();
  57038. this.format = new _xfa_object.XFAObjectArray();
  57039. this.handler = new _xfa_object.XFAObjectArray();
  57040. this.hyphenation = new _xfa_object.XFAObjectArray();
  57041. this.image = new _xfa_object.XFAObjectArray();
  57042. this.imageEdit = new _xfa_object.XFAObjectArray();
  57043. this.integer = new _xfa_object.XFAObjectArray();
  57044. this.issuers = new _xfa_object.XFAObjectArray();
  57045. this.items = new _xfa_object.XFAObjectArray();
  57046. this.keep = new _xfa_object.XFAObjectArray();
  57047. this.keyUsage = new _xfa_object.XFAObjectArray();
  57048. this.line = new _xfa_object.XFAObjectArray();
  57049. this.linear = new _xfa_object.XFAObjectArray();
  57050. this.lockDocument = new _xfa_object.XFAObjectArray();
  57051. this.manifest = new _xfa_object.XFAObjectArray();
  57052. this.margin = new _xfa_object.XFAObjectArray();
  57053. this.mdp = new _xfa_object.XFAObjectArray();
  57054. this.medium = new _xfa_object.XFAObjectArray();
  57055. this.message = new _xfa_object.XFAObjectArray();
  57056. this.numericEdit = new _xfa_object.XFAObjectArray();
  57057. this.occur = new _xfa_object.XFAObjectArray();
  57058. this.oid = new _xfa_object.XFAObjectArray();
  57059. this.oids = new _xfa_object.XFAObjectArray();
  57060. this.overflow = new _xfa_object.XFAObjectArray();
  57061. this.pageArea = new _xfa_object.XFAObjectArray();
  57062. this.pageSet = new _xfa_object.XFAObjectArray();
  57063. this.para = new _xfa_object.XFAObjectArray();
  57064. this.passwordEdit = new _xfa_object.XFAObjectArray();
  57065. this.pattern = new _xfa_object.XFAObjectArray();
  57066. this.picture = new _xfa_object.XFAObjectArray();
  57067. this.radial = new _xfa_object.XFAObjectArray();
  57068. this.reason = new _xfa_object.XFAObjectArray();
  57069. this.reasons = new _xfa_object.XFAObjectArray();
  57070. this.rectangle = new _xfa_object.XFAObjectArray();
  57071. this.ref = new _xfa_object.XFAObjectArray();
  57072. this.script = new _xfa_object.XFAObjectArray();
  57073. this.setProperty = new _xfa_object.XFAObjectArray();
  57074. this.signData = new _xfa_object.XFAObjectArray();
  57075. this.signature = new _xfa_object.XFAObjectArray();
  57076. this.signing = new _xfa_object.XFAObjectArray();
  57077. this.solid = new _xfa_object.XFAObjectArray();
  57078. this.speak = new _xfa_object.XFAObjectArray();
  57079. this.stipple = new _xfa_object.XFAObjectArray();
  57080. this.subform = new _xfa_object.XFAObjectArray();
  57081. this.subformSet = new _xfa_object.XFAObjectArray();
  57082. this.subjectDN = new _xfa_object.XFAObjectArray();
  57083. this.subjectDNs = new _xfa_object.XFAObjectArray();
  57084. this.submit = new _xfa_object.XFAObjectArray();
  57085. this.text = new _xfa_object.XFAObjectArray();
  57086. this.textEdit = new _xfa_object.XFAObjectArray();
  57087. this.time = new _xfa_object.XFAObjectArray();
  57088. this.timeStamp = new _xfa_object.XFAObjectArray();
  57089. this.toolTip = new _xfa_object.XFAObjectArray();
  57090. this.traversal = new _xfa_object.XFAObjectArray();
  57091. this.traverse = new _xfa_object.XFAObjectArray();
  57092. this.ui = new _xfa_object.XFAObjectArray();
  57093. this.validate = new _xfa_object.XFAObjectArray();
  57094. this.value = new _xfa_object.XFAObjectArray();
  57095. this.variables = new _xfa_object.XFAObjectArray();
  57096. }
  57097. }
  57098. class Radial extends _xfa_object.XFAObject {
  57099. constructor(attributes) {
  57100. super(TEMPLATE_NS_ID, "radial", true);
  57101. this.id = attributes.id || "";
  57102. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  57103. this.use = attributes.use || "";
  57104. this.usehref = attributes.usehref || "";
  57105. this.color = null;
  57106. this.extras = null;
  57107. }
  57108. [_xfa_object.$toStyle](startColor) {
  57109. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57110. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  57111. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  57112. return `radial-gradient(circle at center, ${colors})`;
  57113. }
  57114. }
  57115. class Reason extends _xfa_object.StringObject {
  57116. constructor(attributes) {
  57117. super(TEMPLATE_NS_ID, "reason");
  57118. this.id = attributes.id || "";
  57119. this.name = attributes.name || "";
  57120. this.use = attributes.use || "";
  57121. this.usehref = attributes.usehref || "";
  57122. }
  57123. }
  57124. class Reasons extends _xfa_object.XFAObject {
  57125. constructor(attributes) {
  57126. super(TEMPLATE_NS_ID, "reasons", true);
  57127. this.id = attributes.id || "";
  57128. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57129. this.use = attributes.use || "";
  57130. this.usehref = attributes.usehref || "";
  57131. this.reason = new _xfa_object.XFAObjectArray();
  57132. }
  57133. }
  57134. class Rectangle extends _xfa_object.XFAObject {
  57135. constructor(attributes) {
  57136. super(TEMPLATE_NS_ID, "rectangle", true);
  57137. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57138. this.id = attributes.id || "";
  57139. this.use = attributes.use || "";
  57140. this.usehref = attributes.usehref || "";
  57141. this.corner = new _xfa_object.XFAObjectArray(4);
  57142. this.edge = new _xfa_object.XFAObjectArray(4);
  57143. this.fill = null;
  57144. }
  57145. [_xfa_object.$toHTML]() {
  57146. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  57147. const edgeStyle = edge[_xfa_object.$toStyle]();
  57148. const style = Object.create(null);
  57149. if (this.fill && this.fill.presence === "visible") {
  57150. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57151. } else {
  57152. style.fill = "transparent";
  57153. }
  57154. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57155. style.stroke = edgeStyle.color;
  57156. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  57157. const cornerStyle = corner[_xfa_object.$toStyle]();
  57158. const rect = {
  57159. name: "rect",
  57160. attributes: {
  57161. xmlns: SVG_NS,
  57162. width: "100%",
  57163. height: "100%",
  57164. x: 0,
  57165. y: 0,
  57166. rx: cornerStyle.radius,
  57167. ry: cornerStyle.radius,
  57168. style
  57169. }
  57170. };
  57171. const svg = {
  57172. name: "svg",
  57173. children: [rect],
  57174. attributes: {
  57175. xmlns: SVG_NS,
  57176. style: {
  57177. overflow: "visible"
  57178. },
  57179. width: "100%",
  57180. height: "100%"
  57181. }
  57182. };
  57183. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57184. if (hasMargin(parent)) {
  57185. return _utils.HTMLResult.success({
  57186. name: "div",
  57187. attributes: {
  57188. style: {
  57189. display: "inline",
  57190. width: "100%",
  57191. height: "100%"
  57192. }
  57193. },
  57194. children: [svg]
  57195. });
  57196. }
  57197. svg.attributes.style.position = "absolute";
  57198. return _utils.HTMLResult.success(svg);
  57199. }
  57200. }
  57201. class RefElement extends _xfa_object.StringObject {
  57202. constructor(attributes) {
  57203. super(TEMPLATE_NS_ID, "ref");
  57204. this.id = attributes.id || "";
  57205. this.use = attributes.use || "";
  57206. this.usehref = attributes.usehref || "";
  57207. }
  57208. }
  57209. class Script extends _xfa_object.StringObject {
  57210. constructor(attributes) {
  57211. super(TEMPLATE_NS_ID, "script");
  57212. this.binding = attributes.binding || "";
  57213. this.contentType = attributes.contentType || "";
  57214. this.id = attributes.id || "";
  57215. this.name = attributes.name || "";
  57216. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  57217. this.use = attributes.use || "";
  57218. this.usehref = attributes.usehref || "";
  57219. }
  57220. }
  57221. class SetProperty extends _xfa_object.XFAObject {
  57222. constructor(attributes) {
  57223. super(TEMPLATE_NS_ID, "setProperty");
  57224. this.connection = attributes.connection || "";
  57225. this.ref = attributes.ref || "";
  57226. this.target = attributes.target || "";
  57227. }
  57228. }
  57229. exports.SetProperty = SetProperty;
  57230. class SignData extends _xfa_object.XFAObject {
  57231. constructor(attributes) {
  57232. super(TEMPLATE_NS_ID, "signData", true);
  57233. this.id = attributes.id || "";
  57234. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  57235. this.ref = attributes.ref || "";
  57236. this.target = attributes.target || "";
  57237. this.use = attributes.use || "";
  57238. this.usehref = attributes.usehref || "";
  57239. this.filter = null;
  57240. this.manifest = null;
  57241. }
  57242. }
  57243. class Signature extends _xfa_object.XFAObject {
  57244. constructor(attributes) {
  57245. super(TEMPLATE_NS_ID, "signature", true);
  57246. this.id = attributes.id || "";
  57247. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  57248. this.use = attributes.use || "";
  57249. this.usehref = attributes.usehref || "";
  57250. this.border = null;
  57251. this.extras = null;
  57252. this.filter = null;
  57253. this.manifest = null;
  57254. this.margin = null;
  57255. }
  57256. }
  57257. class Signing extends _xfa_object.XFAObject {
  57258. constructor(attributes) {
  57259. super(TEMPLATE_NS_ID, "signing", true);
  57260. this.id = attributes.id || "";
  57261. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57262. this.use = attributes.use || "";
  57263. this.usehref = attributes.usehref || "";
  57264. this.certificate = new _xfa_object.XFAObjectArray();
  57265. }
  57266. }
  57267. class Solid extends _xfa_object.XFAObject {
  57268. constructor(attributes) {
  57269. super(TEMPLATE_NS_ID, "solid", true);
  57270. this.id = attributes.id || "";
  57271. this.use = attributes.use || "";
  57272. this.usehref = attributes.usehref || "";
  57273. this.extras = null;
  57274. }
  57275. [_xfa_object.$toStyle](startColor) {
  57276. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57277. }
  57278. }
  57279. class Speak extends _xfa_object.StringObject {
  57280. constructor(attributes) {
  57281. super(TEMPLATE_NS_ID, "speak");
  57282. this.disable = (0, _utils.getInteger)({
  57283. data: attributes.disable,
  57284. defaultValue: 0,
  57285. validate: x => x === 1
  57286. });
  57287. this.id = attributes.id || "";
  57288. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  57289. this.rid = attributes.rid || "";
  57290. this.use = attributes.use || "";
  57291. this.usehref = attributes.usehref || "";
  57292. }
  57293. }
  57294. class Stipple extends _xfa_object.XFAObject {
  57295. constructor(attributes) {
  57296. super(TEMPLATE_NS_ID, "stipple", true);
  57297. this.id = attributes.id || "";
  57298. this.rate = (0, _utils.getInteger)({
  57299. data: attributes.rate,
  57300. defaultValue: 50,
  57301. validate: x => x >= 0 && x <= 100
  57302. });
  57303. this.use = attributes.use || "";
  57304. this.usehref = attributes.usehref || "";
  57305. this.color = null;
  57306. this.extras = null;
  57307. }
  57308. [_xfa_object.$toStyle](bgColor) {
  57309. const alpha = this.rate / 100;
  57310. 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));
  57311. }
  57312. }
  57313. class Subform extends _xfa_object.XFAObject {
  57314. constructor(attributes) {
  57315. super(TEMPLATE_NS_ID, "subform", true);
  57316. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  57317. this.allowMacro = (0, _utils.getInteger)({
  57318. data: attributes.allowMacro,
  57319. defaultValue: 0,
  57320. validate: x => x === 1
  57321. });
  57322. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  57323. this.colSpan = (0, _utils.getInteger)({
  57324. data: attributes.colSpan,
  57325. defaultValue: 1,
  57326. validate: n => n >= 1 || n === -1
  57327. });
  57328. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  57329. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  57330. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  57331. this.id = attributes.id || "";
  57332. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  57333. this.locale = attributes.locale || "";
  57334. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  57335. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  57336. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  57337. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  57338. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  57339. this.name = attributes.name || "";
  57340. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57341. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57342. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  57343. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  57344. this.use = attributes.use || "";
  57345. this.usehref = attributes.usehref || "";
  57346. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  57347. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57348. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57349. this.assist = null;
  57350. this.bind = null;
  57351. this.bookend = null;
  57352. this.border = null;
  57353. this.break = null;
  57354. this.calculate = null;
  57355. this.desc = null;
  57356. this.extras = null;
  57357. this.keep = null;
  57358. this.margin = null;
  57359. this.occur = null;
  57360. this.overflow = null;
  57361. this.pageSet = null;
  57362. this.para = null;
  57363. this.traversal = null;
  57364. this.validate = null;
  57365. this.variables = null;
  57366. this.area = new _xfa_object.XFAObjectArray();
  57367. this.breakAfter = new _xfa_object.XFAObjectArray();
  57368. this.breakBefore = new _xfa_object.XFAObjectArray();
  57369. this.connect = new _xfa_object.XFAObjectArray();
  57370. this.draw = new _xfa_object.XFAObjectArray();
  57371. this.event = new _xfa_object.XFAObjectArray();
  57372. this.exObject = new _xfa_object.XFAObjectArray();
  57373. this.exclGroup = new _xfa_object.XFAObjectArray();
  57374. this.field = new _xfa_object.XFAObjectArray();
  57375. this.proto = new _xfa_object.XFAObjectArray();
  57376. this.setProperty = new _xfa_object.XFAObjectArray();
  57377. this.subform = new _xfa_object.XFAObjectArray();
  57378. this.subformSet = new _xfa_object.XFAObjectArray();
  57379. }
  57380. [_xfa_object.$getSubformParent]() {
  57381. const parent = this[_xfa_object.$getParent]();
  57382. if (parent instanceof SubformSet) {
  57383. return parent[_xfa_object.$getSubformParent]();
  57384. }
  57385. return parent;
  57386. }
  57387. [_xfa_object.$isBindable]() {
  57388. return true;
  57389. }
  57390. [_xfa_object.$isThereMoreWidth]() {
  57391. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  57392. }
  57393. *[_xfa_object.$getContainedChildren]() {
  57394. yield* getContainedChildren(this);
  57395. }
  57396. [_xfa_object.$flushHTML]() {
  57397. return (0, _layout.flushHTML)(this);
  57398. }
  57399. [_xfa_object.$addHTML](html, bbox) {
  57400. (0, _layout.addHTML)(this, html, bbox);
  57401. }
  57402. [_xfa_object.$getAvailableSpace]() {
  57403. return (0, _layout.getAvailableSpace)(this);
  57404. }
  57405. [_xfa_object.$isSplittable]() {
  57406. const parent = this[_xfa_object.$getSubformParent]();
  57407. if (!parent[_xfa_object.$isSplittable]()) {
  57408. return false;
  57409. }
  57410. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  57411. return this[_xfa_object.$extra]._isSplittable;
  57412. }
  57413. if (this.layout === "position" || this.layout.includes("row")) {
  57414. this[_xfa_object.$extra]._isSplittable = false;
  57415. return false;
  57416. }
  57417. if (this.keep && this.keep.intact !== "none") {
  57418. this[_xfa_object.$extra]._isSplittable = false;
  57419. return false;
  57420. }
  57421. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  57422. return false;
  57423. }
  57424. this[_xfa_object.$extra]._isSplittable = true;
  57425. return true;
  57426. }
  57427. [_xfa_object.$toHTML](availableSpace) {
  57428. setTabIndex(this);
  57429. if (this.break) {
  57430. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  57431. const node = new BreakAfter({
  57432. targetType: this.break.after,
  57433. target: this.break.afterTarget,
  57434. startNew: this.break.startNew.toString()
  57435. });
  57436. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57437. this[_xfa_object.$appendChild](node);
  57438. this.breakAfter.push(node);
  57439. }
  57440. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  57441. const node = new BreakBefore({
  57442. targetType: this.break.before,
  57443. target: this.break.beforeTarget,
  57444. startNew: this.break.startNew.toString()
  57445. });
  57446. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57447. this[_xfa_object.$appendChild](node);
  57448. this.breakBefore.push(node);
  57449. }
  57450. if (this.break.overflowTarget !== "") {
  57451. const node = new Overflow({
  57452. target: this.break.overflowTarget,
  57453. leader: this.break.overflowLeader,
  57454. trailer: this.break.overflowTrailer
  57455. });
  57456. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57457. this[_xfa_object.$appendChild](node);
  57458. this.overflow.push(node);
  57459. }
  57460. this[_xfa_object.$removeChild](this.break);
  57461. this.break = null;
  57462. }
  57463. if (this.presence === "hidden" || this.presence === "inactive") {
  57464. return _utils.HTMLResult.EMPTY;
  57465. }
  57466. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  57467. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  57468. }
  57469. if (this.breakBefore.children.length >= 1) {
  57470. const breakBefore = this.breakBefore.children[0];
  57471. if (handleBreak(breakBefore)) {
  57472. return _utils.HTMLResult.breakNode(breakBefore);
  57473. }
  57474. }
  57475. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  57476. return _utils.HTMLResult.EMPTY;
  57477. }
  57478. (0, _html_utils.fixDimensions)(this);
  57479. const children = [];
  57480. const attributes = {
  57481. id: this[_xfa_object.$uid],
  57482. class: []
  57483. };
  57484. (0, _html_utils.setAccess)(this, attributes.class);
  57485. if (!this[_xfa_object.$extra]) {
  57486. this[_xfa_object.$extra] = Object.create(null);
  57487. }
  57488. Object.assign(this[_xfa_object.$extra], {
  57489. children,
  57490. line: null,
  57491. attributes,
  57492. attempt: 0,
  57493. numberInLine: 0,
  57494. availableSpace: {
  57495. width: Math.min(this.w || Infinity, availableSpace.width),
  57496. height: Math.min(this.h || Infinity, availableSpace.height)
  57497. },
  57498. width: 0,
  57499. height: 0,
  57500. prevHeight: 0,
  57501. currentWidth: 0
  57502. });
  57503. const root = this[_xfa_object.$getTemplateRoot]();
  57504. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  57505. const isSplittable = this[_xfa_object.$isSplittable]();
  57506. if (!isSplittable) {
  57507. setFirstUnsplittable(this);
  57508. }
  57509. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57510. return _utils.HTMLResult.FAILURE;
  57511. }
  57512. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  57513. if (this.layout.includes("row")) {
  57514. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  57515. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  57516. this[_xfa_object.$extra].columnWidths = columnWidths;
  57517. this[_xfa_object.$extra].currentColumn = 0;
  57518. }
  57519. }
  57520. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  57521. const classNames = ["xfaSubform"];
  57522. const cl = (0, _html_utils.layoutClass)(this);
  57523. if (cl) {
  57524. classNames.push(cl);
  57525. }
  57526. attributes.style = style;
  57527. attributes.class = classNames;
  57528. if (this.name) {
  57529. attributes.xfaName = this.name;
  57530. }
  57531. if (this.overflow) {
  57532. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57533. if (overflowExtra.addLeader) {
  57534. overflowExtra.addLeader = false;
  57535. handleOverflow(this, overflowExtra.leader, availableSpace);
  57536. }
  57537. }
  57538. this[_xfa_object.$pushPara]();
  57539. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57540. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57541. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57542. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57543. this[_xfa_object.$extra].numberInLine = 0;
  57544. }
  57545. const result = this[_xfa_object.$childrenToHTML]({
  57546. filter,
  57547. include: true
  57548. });
  57549. if (result.success) {
  57550. break;
  57551. }
  57552. if (result.isBreak()) {
  57553. this[_xfa_object.$popPara]();
  57554. return result;
  57555. }
  57556. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57557. this[_xfa_object.$extra].attempt = maxRun;
  57558. break;
  57559. }
  57560. }
  57561. this[_xfa_object.$popPara]();
  57562. if (!isSplittable) {
  57563. unsetFirstUnsplittable(this);
  57564. }
  57565. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57566. if (this[_xfa_object.$extra].attempt === maxRun) {
  57567. if (this.overflow) {
  57568. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57569. }
  57570. if (!isSplittable) {
  57571. delete this[_xfa_object.$extra];
  57572. }
  57573. return _utils.HTMLResult.FAILURE;
  57574. }
  57575. if (this.overflow) {
  57576. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57577. if (overflowExtra.addTrailer) {
  57578. overflowExtra.addTrailer = false;
  57579. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57580. }
  57581. }
  57582. let marginH = 0;
  57583. let marginV = 0;
  57584. if (this.margin) {
  57585. marginH = this.margin.leftInset + this.margin.rightInset;
  57586. marginV = this.margin.topInset + this.margin.bottomInset;
  57587. }
  57588. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57589. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57590. const bbox = [this.x, this.y, width, height];
  57591. if (this.w === "") {
  57592. style.width = (0, _html_utils.measureToString)(width);
  57593. }
  57594. if (this.h === "") {
  57595. style.height = (0, _html_utils.measureToString)(height);
  57596. }
  57597. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57598. return _utils.HTMLResult.EMPTY;
  57599. }
  57600. const html = {
  57601. name: "div",
  57602. attributes,
  57603. children
  57604. };
  57605. applyAssist(this, attributes);
  57606. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57607. if (this.breakAfter.children.length >= 1) {
  57608. const breakAfter = this.breakAfter.children[0];
  57609. if (handleBreak(breakAfter)) {
  57610. this[_xfa_object.$extra].afterBreakAfter = result;
  57611. return _utils.HTMLResult.breakNode(breakAfter);
  57612. }
  57613. }
  57614. delete this[_xfa_object.$extra];
  57615. return result;
  57616. }
  57617. }
  57618. class SubformSet extends _xfa_object.XFAObject {
  57619. constructor(attributes) {
  57620. super(TEMPLATE_NS_ID, "subformSet", true);
  57621. this.id = attributes.id || "";
  57622. this.name = attributes.name || "";
  57623. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57624. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57625. this.use = attributes.use || "";
  57626. this.usehref = attributes.usehref || "";
  57627. this.bookend = null;
  57628. this.break = null;
  57629. this.desc = null;
  57630. this.extras = null;
  57631. this.occur = null;
  57632. this.overflow = null;
  57633. this.breakAfter = new _xfa_object.XFAObjectArray();
  57634. this.breakBefore = new _xfa_object.XFAObjectArray();
  57635. this.subform = new _xfa_object.XFAObjectArray();
  57636. this.subformSet = new _xfa_object.XFAObjectArray();
  57637. }
  57638. *[_xfa_object.$getContainedChildren]() {
  57639. yield* getContainedChildren(this);
  57640. }
  57641. [_xfa_object.$getSubformParent]() {
  57642. let parent = this[_xfa_object.$getParent]();
  57643. while (!(parent instanceof Subform)) {
  57644. parent = parent[_xfa_object.$getParent]();
  57645. }
  57646. return parent;
  57647. }
  57648. [_xfa_object.$isBindable]() {
  57649. return true;
  57650. }
  57651. }
  57652. class SubjectDN extends _xfa_object.ContentObject {
  57653. constructor(attributes) {
  57654. super(TEMPLATE_NS_ID, "subjectDN");
  57655. this.delimiter = attributes.delimiter || ",";
  57656. this.id = attributes.id || "";
  57657. this.name = attributes.name || "";
  57658. this.use = attributes.use || "";
  57659. this.usehref = attributes.usehref || "";
  57660. }
  57661. [_xfa_object.$finalize]() {
  57662. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57663. kv = kv.split("=", 2);
  57664. kv[0] = kv[0].trim();
  57665. return kv;
  57666. }));
  57667. }
  57668. }
  57669. class SubjectDNs extends _xfa_object.XFAObject {
  57670. constructor(attributes) {
  57671. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57672. this.id = attributes.id || "";
  57673. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57674. this.use = attributes.use || "";
  57675. this.usehref = attributes.usehref || "";
  57676. this.subjectDN = new _xfa_object.XFAObjectArray();
  57677. }
  57678. }
  57679. class Submit extends _xfa_object.XFAObject {
  57680. constructor(attributes) {
  57681. super(TEMPLATE_NS_ID, "submit", true);
  57682. this.embedPDF = (0, _utils.getInteger)({
  57683. data: attributes.embedPDF,
  57684. defaultValue: 0,
  57685. validate: x => x === 1
  57686. });
  57687. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57688. this.id = attributes.id || "";
  57689. this.target = attributes.target || "";
  57690. this.textEncoding = (0, _utils.getKeyword)({
  57691. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57692. defaultValue: "",
  57693. 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}/)
  57694. });
  57695. this.use = attributes.use || "";
  57696. this.usehref = attributes.usehref || "";
  57697. this.xdpContent = attributes.xdpContent || "";
  57698. this.encrypt = null;
  57699. this.encryptData = new _xfa_object.XFAObjectArray();
  57700. this.signData = new _xfa_object.XFAObjectArray();
  57701. }
  57702. }
  57703. class Template extends _xfa_object.XFAObject {
  57704. constructor(attributes) {
  57705. super(TEMPLATE_NS_ID, "template", true);
  57706. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57707. this.extras = null;
  57708. this.subform = new _xfa_object.XFAObjectArray();
  57709. }
  57710. [_xfa_object.$finalize]() {
  57711. if (this.subform.children.length === 0) {
  57712. (0, _util.warn)("XFA - No subforms in template node.");
  57713. }
  57714. if (this.subform.children.length >= 2) {
  57715. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57716. }
  57717. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57718. }
  57719. [_xfa_object.$isSplittable]() {
  57720. return true;
  57721. }
  57722. [_xfa_object.$searchNode](expr, container) {
  57723. if (expr.startsWith("#")) {
  57724. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57725. }
  57726. return (0, _som.searchNode)(this, container, expr, true, true);
  57727. }
  57728. *[_xfa_object.$toPages]() {
  57729. if (!this.subform.children.length) {
  57730. return _utils.HTMLResult.success({
  57731. name: "div",
  57732. children: []
  57733. });
  57734. }
  57735. this[_xfa_object.$extra] = {
  57736. overflowNode: null,
  57737. firstUnsplittable: null,
  57738. currentContentArea: null,
  57739. currentPageArea: null,
  57740. noLayoutFailure: false,
  57741. pageNumber: 1,
  57742. pagePosition: "first",
  57743. oddOrEven: "odd",
  57744. blankOrNotBlank: "nonBlank",
  57745. paraStack: []
  57746. };
  57747. const root = this.subform.children[0];
  57748. root.pageSet[_xfa_object.$cleanPage]();
  57749. const pageAreas = root.pageSet.pageArea.children;
  57750. const mainHtml = {
  57751. name: "div",
  57752. children: []
  57753. };
  57754. let pageArea = null;
  57755. let breakBefore = null;
  57756. let breakBeforeTarget = null;
  57757. if (root.breakBefore.children.length >= 1) {
  57758. breakBefore = root.breakBefore.children[0];
  57759. breakBeforeTarget = breakBefore.target;
  57760. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57761. breakBefore = root.subform.children[0].breakBefore.children[0];
  57762. breakBeforeTarget = breakBefore.target;
  57763. } else if (root.break && root.break.beforeTarget) {
  57764. breakBefore = root.break;
  57765. breakBeforeTarget = breakBefore.beforeTarget;
  57766. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57767. breakBefore = root.subform.children[0].break;
  57768. breakBeforeTarget = breakBefore.beforeTarget;
  57769. }
  57770. if (breakBefore) {
  57771. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57772. if (target instanceof PageArea) {
  57773. pageArea = target;
  57774. breakBefore[_xfa_object.$extra] = {};
  57775. }
  57776. }
  57777. if (!pageArea) {
  57778. pageArea = pageAreas[0];
  57779. }
  57780. pageArea[_xfa_object.$extra] = {
  57781. numberOfUse: 1
  57782. };
  57783. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57784. pageAreaParent[_xfa_object.$extra] = {
  57785. numberOfUse: 1,
  57786. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57787. pageSetIndex: 0
  57788. };
  57789. let targetPageArea;
  57790. let leader = null;
  57791. let trailer = null;
  57792. let hasSomething = true;
  57793. let hasSomethingCounter = 0;
  57794. let startIndex = 0;
  57795. while (true) {
  57796. if (!hasSomething) {
  57797. mainHtml.children.pop();
  57798. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57799. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57800. return mainHtml;
  57801. }
  57802. } else {
  57803. hasSomethingCounter = 0;
  57804. }
  57805. targetPageArea = null;
  57806. this[_xfa_object.$extra].currentPageArea = pageArea;
  57807. const page = pageArea[_xfa_object.$toHTML]().html;
  57808. mainHtml.children.push(page);
  57809. if (leader) {
  57810. this[_xfa_object.$extra].noLayoutFailure = true;
  57811. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57812. leader = null;
  57813. }
  57814. if (trailer) {
  57815. this[_xfa_object.$extra].noLayoutFailure = true;
  57816. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57817. trailer = null;
  57818. }
  57819. const contentAreas = pageArea.contentArea.children;
  57820. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57821. hasSomething = false;
  57822. this[_xfa_object.$extra].firstUnsplittable = null;
  57823. this[_xfa_object.$extra].noLayoutFailure = false;
  57824. const flush = index => {
  57825. const html = root[_xfa_object.$flushHTML]();
  57826. if (html) {
  57827. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57828. htmlContentAreas[index].children.push(html);
  57829. }
  57830. };
  57831. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57832. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57833. const space = {
  57834. width: contentArea.w,
  57835. height: contentArea.h
  57836. };
  57837. startIndex = 0;
  57838. if (leader) {
  57839. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57840. leader = null;
  57841. }
  57842. if (trailer) {
  57843. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57844. trailer = null;
  57845. }
  57846. const html = root[_xfa_object.$toHTML](space);
  57847. if (html.success) {
  57848. if (html.html) {
  57849. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57850. htmlContentAreas[i].children.push(html.html);
  57851. } else if (!hasSomething && mainHtml.children.length > 1) {
  57852. mainHtml.children.pop();
  57853. }
  57854. return mainHtml;
  57855. }
  57856. if (html.isBreak()) {
  57857. const node = html.breakNode;
  57858. flush(i);
  57859. if (node.targetType === "auto") {
  57860. continue;
  57861. }
  57862. if (node.leader) {
  57863. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57864. leader = leader ? leader[0] : null;
  57865. }
  57866. if (node.trailer) {
  57867. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57868. trailer = trailer ? trailer[0] : null;
  57869. }
  57870. if (node.targetType === "pageArea") {
  57871. targetPageArea = node[_xfa_object.$extra].target;
  57872. i = Infinity;
  57873. } else if (!node[_xfa_object.$extra].target) {
  57874. i = node[_xfa_object.$extra].index;
  57875. } else {
  57876. targetPageArea = node[_xfa_object.$extra].target;
  57877. startIndex = node[_xfa_object.$extra].index + 1;
  57878. i = Infinity;
  57879. }
  57880. continue;
  57881. }
  57882. if (this[_xfa_object.$extra].overflowNode) {
  57883. const node = this[_xfa_object.$extra].overflowNode;
  57884. this[_xfa_object.$extra].overflowNode = null;
  57885. const overflowExtra = node[_xfa_object.$getExtra]();
  57886. const target = overflowExtra.target;
  57887. overflowExtra.addLeader = overflowExtra.leader !== null;
  57888. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57889. flush(i);
  57890. const currentIndex = i;
  57891. i = Infinity;
  57892. if (target instanceof PageArea) {
  57893. targetPageArea = target;
  57894. } else if (target instanceof ContentArea) {
  57895. const index = contentAreas.indexOf(target);
  57896. if (index !== -1) {
  57897. if (index > currentIndex) {
  57898. i = index - 1;
  57899. } else {
  57900. startIndex = index;
  57901. }
  57902. } else {
  57903. targetPageArea = target[_xfa_object.$getParent]();
  57904. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57905. }
  57906. }
  57907. continue;
  57908. }
  57909. flush(i);
  57910. }
  57911. this[_xfa_object.$extra].pageNumber += 1;
  57912. if (targetPageArea) {
  57913. if (targetPageArea[_xfa_object.$isUsable]()) {
  57914. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57915. } else {
  57916. targetPageArea = null;
  57917. }
  57918. }
  57919. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57920. yield null;
  57921. }
  57922. }
  57923. }
  57924. exports.Template = Template;
  57925. class Text extends _xfa_object.ContentObject {
  57926. constructor(attributes) {
  57927. super(TEMPLATE_NS_ID, "text");
  57928. this.id = attributes.id || "";
  57929. this.maxChars = (0, _utils.getInteger)({
  57930. data: attributes.maxChars,
  57931. defaultValue: 0,
  57932. validate: x => x >= 0
  57933. });
  57934. this.name = attributes.name || "";
  57935. this.rid = attributes.rid || "";
  57936. this.use = attributes.use || "";
  57937. this.usehref = attributes.usehref || "";
  57938. }
  57939. [_xfa_object.$acceptWhitespace]() {
  57940. return true;
  57941. }
  57942. [_xfa_object.$onChild](child) {
  57943. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57944. this[_xfa_object.$content] = child;
  57945. return true;
  57946. }
  57947. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57948. return false;
  57949. }
  57950. [_xfa_object.$onText](str) {
  57951. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57952. return;
  57953. }
  57954. super[_xfa_object.$onText](str);
  57955. }
  57956. [_xfa_object.$finalize]() {
  57957. if (typeof this[_xfa_object.$content] === "string") {
  57958. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57959. }
  57960. }
  57961. [_xfa_object.$getExtra]() {
  57962. if (typeof this[_xfa_object.$content] === "string") {
  57963. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57964. if (line) {
  57965. acc.push(line);
  57966. }
  57967. return acc;
  57968. }, []).join("\n");
  57969. }
  57970. return this[_xfa_object.$content][_xfa_object.$text]();
  57971. }
  57972. [_xfa_object.$toHTML](availableSpace) {
  57973. if (typeof this[_xfa_object.$content] === "string") {
  57974. const html = valueToHtml(this[_xfa_object.$content]).html;
  57975. if (this[_xfa_object.$content].includes("\u2029")) {
  57976. html.name = "div";
  57977. html.children = [];
  57978. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  57979. acc.push({
  57980. name: "span",
  57981. value: line
  57982. }, {
  57983. name: "br"
  57984. });
  57985. return acc;
  57986. }, [])).forEach(lines => {
  57987. html.children.push({
  57988. name: "p",
  57989. children: lines
  57990. });
  57991. });
  57992. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  57993. html.name = "div";
  57994. html.children = [];
  57995. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  57996. html.children.push({
  57997. name: "span",
  57998. value: line
  57999. }, {
  58000. name: "br"
  58001. });
  58002. });
  58003. }
  58004. return _utils.HTMLResult.success(html);
  58005. }
  58006. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58007. }
  58008. }
  58009. exports.Text = Text;
  58010. class TextEdit extends _xfa_object.XFAObject {
  58011. constructor(attributes) {
  58012. super(TEMPLATE_NS_ID, "textEdit", true);
  58013. this.allowRichText = (0, _utils.getInteger)({
  58014. data: attributes.allowRichText,
  58015. defaultValue: 0,
  58016. validate: x => x === 1
  58017. });
  58018. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58019. this.id = attributes.id || "";
  58020. this.multiLine = (0, _utils.getInteger)({
  58021. data: attributes.multiLine,
  58022. defaultValue: "",
  58023. validate: x => x === 0 || x === 1
  58024. });
  58025. this.use = attributes.use || "";
  58026. this.usehref = attributes.usehref || "";
  58027. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  58028. this.border = null;
  58029. this.comb = null;
  58030. this.extras = null;
  58031. this.margin = null;
  58032. }
  58033. [_xfa_object.$toHTML](availableSpace) {
  58034. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58035. let html;
  58036. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58037. if (this.multiLine === "") {
  58038. this.multiLine = field instanceof Draw ? 1 : 0;
  58039. }
  58040. if (this.multiLine === 1) {
  58041. html = {
  58042. name: "textarea",
  58043. attributes: {
  58044. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58045. fieldId: field[_xfa_object.$uid],
  58046. class: ["xfaTextfield"],
  58047. style,
  58048. "aria-label": ariaLabel(field),
  58049. "aria-required": false
  58050. }
  58051. };
  58052. } else {
  58053. html = {
  58054. name: "input",
  58055. attributes: {
  58056. type: "text",
  58057. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58058. fieldId: field[_xfa_object.$uid],
  58059. class: ["xfaTextfield"],
  58060. style,
  58061. "aria-label": ariaLabel(field),
  58062. "aria-required": false
  58063. }
  58064. };
  58065. }
  58066. if (isRequired(field)) {
  58067. html.attributes["aria-required"] = true;
  58068. html.attributes.required = true;
  58069. }
  58070. return _utils.HTMLResult.success({
  58071. name: "label",
  58072. attributes: {
  58073. class: ["xfaLabel"]
  58074. },
  58075. children: [html]
  58076. });
  58077. }
  58078. }
  58079. class Time extends _xfa_object.StringObject {
  58080. constructor(attributes) {
  58081. super(TEMPLATE_NS_ID, "time");
  58082. this.id = attributes.id || "";
  58083. this.name = attributes.name || "";
  58084. this.use = attributes.use || "";
  58085. this.usehref = attributes.usehref || "";
  58086. }
  58087. [_xfa_object.$finalize]() {
  58088. const date = this[_xfa_object.$content].trim();
  58089. this[_xfa_object.$content] = date ? new Date(date) : null;
  58090. }
  58091. [_xfa_object.$toHTML](availableSpace) {
  58092. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58093. }
  58094. }
  58095. class TimeStamp extends _xfa_object.XFAObject {
  58096. constructor(attributes) {
  58097. super(TEMPLATE_NS_ID, "timeStamp");
  58098. this.id = attributes.id || "";
  58099. this.server = attributes.server || "";
  58100. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58101. this.use = attributes.use || "";
  58102. this.usehref = attributes.usehref || "";
  58103. }
  58104. }
  58105. class ToolTip extends _xfa_object.StringObject {
  58106. constructor(attributes) {
  58107. super(TEMPLATE_NS_ID, "toolTip");
  58108. this.id = attributes.id || "";
  58109. this.rid = attributes.rid || "";
  58110. this.use = attributes.use || "";
  58111. this.usehref = attributes.usehref || "";
  58112. }
  58113. }
  58114. class Traversal extends _xfa_object.XFAObject {
  58115. constructor(attributes) {
  58116. super(TEMPLATE_NS_ID, "traversal", true);
  58117. this.id = attributes.id || "";
  58118. this.use = attributes.use || "";
  58119. this.usehref = attributes.usehref || "";
  58120. this.extras = null;
  58121. this.traverse = new _xfa_object.XFAObjectArray();
  58122. }
  58123. }
  58124. class Traverse extends _xfa_object.XFAObject {
  58125. constructor(attributes) {
  58126. super(TEMPLATE_NS_ID, "traverse", true);
  58127. this.id = attributes.id || "";
  58128. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  58129. this.ref = attributes.ref || "";
  58130. this.use = attributes.use || "";
  58131. this.usehref = attributes.usehref || "";
  58132. this.extras = null;
  58133. this.script = null;
  58134. }
  58135. get name() {
  58136. return this.operation;
  58137. }
  58138. [_xfa_object.$isTransparent]() {
  58139. return false;
  58140. }
  58141. }
  58142. class Ui extends _xfa_object.XFAObject {
  58143. constructor(attributes) {
  58144. super(TEMPLATE_NS_ID, "ui", true);
  58145. this.id = attributes.id || "";
  58146. this.use = attributes.use || "";
  58147. this.usehref = attributes.usehref || "";
  58148. this.extras = null;
  58149. this.picture = null;
  58150. this.barcode = null;
  58151. this.button = null;
  58152. this.checkButton = null;
  58153. this.choiceList = null;
  58154. this.dateTimeEdit = null;
  58155. this.defaultUi = null;
  58156. this.imageEdit = null;
  58157. this.numericEdit = null;
  58158. this.passwordEdit = null;
  58159. this.signature = null;
  58160. this.textEdit = null;
  58161. }
  58162. [_xfa_object.$getExtra]() {
  58163. if (this[_xfa_object.$extra] === undefined) {
  58164. for (const name of Object.getOwnPropertyNames(this)) {
  58165. if (name === "extras" || name === "picture") {
  58166. continue;
  58167. }
  58168. const obj = this[name];
  58169. if (!(obj instanceof _xfa_object.XFAObject)) {
  58170. continue;
  58171. }
  58172. this[_xfa_object.$extra] = obj;
  58173. return obj;
  58174. }
  58175. this[_xfa_object.$extra] = null;
  58176. }
  58177. return this[_xfa_object.$extra];
  58178. }
  58179. [_xfa_object.$toHTML](availableSpace) {
  58180. const obj = this[_xfa_object.$getExtra]();
  58181. if (obj) {
  58182. return obj[_xfa_object.$toHTML](availableSpace);
  58183. }
  58184. return _utils.HTMLResult.EMPTY;
  58185. }
  58186. }
  58187. class Validate extends _xfa_object.XFAObject {
  58188. constructor(attributes) {
  58189. super(TEMPLATE_NS_ID, "validate", true);
  58190. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  58191. this.id = attributes.id || "";
  58192. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  58193. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  58194. this.use = attributes.use || "";
  58195. this.usehref = attributes.usehref || "";
  58196. this.extras = null;
  58197. this.message = null;
  58198. this.picture = null;
  58199. this.script = null;
  58200. }
  58201. }
  58202. class Value extends _xfa_object.XFAObject {
  58203. constructor(attributes) {
  58204. super(TEMPLATE_NS_ID, "value", true);
  58205. this.id = attributes.id || "";
  58206. this.override = (0, _utils.getInteger)({
  58207. data: attributes.override,
  58208. defaultValue: 0,
  58209. validate: x => x === 1
  58210. });
  58211. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58212. this.use = attributes.use || "";
  58213. this.usehref = attributes.usehref || "";
  58214. this.arc = null;
  58215. this.boolean = null;
  58216. this.date = null;
  58217. this.dateTime = null;
  58218. this.decimal = null;
  58219. this.exData = null;
  58220. this.float = null;
  58221. this.image = null;
  58222. this.integer = null;
  58223. this.line = null;
  58224. this.rectangle = null;
  58225. this.text = null;
  58226. this.time = null;
  58227. }
  58228. [_xfa_object.$setValue](value) {
  58229. const parent = this[_xfa_object.$getParent]();
  58230. if (parent instanceof Field) {
  58231. if (parent.ui && parent.ui.imageEdit) {
  58232. if (!this.image) {
  58233. this.image = new Image({});
  58234. this[_xfa_object.$appendChild](this.image);
  58235. }
  58236. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  58237. return;
  58238. }
  58239. }
  58240. const valueName = value[_xfa_object.$nodeName];
  58241. if (this[valueName] !== null) {
  58242. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  58243. return;
  58244. }
  58245. for (const name of Object.getOwnPropertyNames(this)) {
  58246. const obj = this[name];
  58247. if (obj instanceof _xfa_object.XFAObject) {
  58248. this[name] = null;
  58249. this[_xfa_object.$removeChild](obj);
  58250. }
  58251. }
  58252. this[value[_xfa_object.$nodeName]] = value;
  58253. this[_xfa_object.$appendChild](value);
  58254. }
  58255. [_xfa_object.$text]() {
  58256. if (this.exData) {
  58257. if (typeof this.exData[_xfa_object.$content] === "string") {
  58258. return this.exData[_xfa_object.$content].trim();
  58259. }
  58260. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  58261. }
  58262. for (const name of Object.getOwnPropertyNames(this)) {
  58263. if (name === "image") {
  58264. continue;
  58265. }
  58266. const obj = this[name];
  58267. if (obj instanceof _xfa_object.XFAObject) {
  58268. return (obj[_xfa_object.$content] || "").toString().trim();
  58269. }
  58270. }
  58271. return null;
  58272. }
  58273. [_xfa_object.$toHTML](availableSpace) {
  58274. for (const name of Object.getOwnPropertyNames(this)) {
  58275. const obj = this[name];
  58276. if (!(obj instanceof _xfa_object.XFAObject)) {
  58277. continue;
  58278. }
  58279. return obj[_xfa_object.$toHTML](availableSpace);
  58280. }
  58281. return _utils.HTMLResult.EMPTY;
  58282. }
  58283. }
  58284. exports.Value = Value;
  58285. class Variables extends _xfa_object.XFAObject {
  58286. constructor(attributes) {
  58287. super(TEMPLATE_NS_ID, "variables", true);
  58288. this.id = attributes.id || "";
  58289. this.use = attributes.use || "";
  58290. this.usehref = attributes.usehref || "";
  58291. this.boolean = new _xfa_object.XFAObjectArray();
  58292. this.date = new _xfa_object.XFAObjectArray();
  58293. this.dateTime = new _xfa_object.XFAObjectArray();
  58294. this.decimal = new _xfa_object.XFAObjectArray();
  58295. this.exData = new _xfa_object.XFAObjectArray();
  58296. this.float = new _xfa_object.XFAObjectArray();
  58297. this.image = new _xfa_object.XFAObjectArray();
  58298. this.integer = new _xfa_object.XFAObjectArray();
  58299. this.manifest = new _xfa_object.XFAObjectArray();
  58300. this.script = new _xfa_object.XFAObjectArray();
  58301. this.text = new _xfa_object.XFAObjectArray();
  58302. this.time = new _xfa_object.XFAObjectArray();
  58303. }
  58304. [_xfa_object.$isTransparent]() {
  58305. return true;
  58306. }
  58307. }
  58308. class TemplateNamespace {
  58309. static [_namespaces.$buildXFAObject](name, attributes) {
  58310. if (TemplateNamespace.hasOwnProperty(name)) {
  58311. const node = TemplateNamespace[name](attributes);
  58312. node[_xfa_object.$setSetAttributes](attributes);
  58313. return node;
  58314. }
  58315. return undefined;
  58316. }
  58317. static appearanceFilter(attrs) {
  58318. return new AppearanceFilter(attrs);
  58319. }
  58320. static arc(attrs) {
  58321. return new Arc(attrs);
  58322. }
  58323. static area(attrs) {
  58324. return new Area(attrs);
  58325. }
  58326. static assist(attrs) {
  58327. return new Assist(attrs);
  58328. }
  58329. static barcode(attrs) {
  58330. return new Barcode(attrs);
  58331. }
  58332. static bind(attrs) {
  58333. return new Bind(attrs);
  58334. }
  58335. static bindItems(attrs) {
  58336. return new BindItems(attrs);
  58337. }
  58338. static bookend(attrs) {
  58339. return new Bookend(attrs);
  58340. }
  58341. static boolean(attrs) {
  58342. return new BooleanElement(attrs);
  58343. }
  58344. static border(attrs) {
  58345. return new Border(attrs);
  58346. }
  58347. static break(attrs) {
  58348. return new Break(attrs);
  58349. }
  58350. static breakAfter(attrs) {
  58351. return new BreakAfter(attrs);
  58352. }
  58353. static breakBefore(attrs) {
  58354. return new BreakBefore(attrs);
  58355. }
  58356. static button(attrs) {
  58357. return new Button(attrs);
  58358. }
  58359. static calculate(attrs) {
  58360. return new Calculate(attrs);
  58361. }
  58362. static caption(attrs) {
  58363. return new Caption(attrs);
  58364. }
  58365. static certificate(attrs) {
  58366. return new Certificate(attrs);
  58367. }
  58368. static certificates(attrs) {
  58369. return new Certificates(attrs);
  58370. }
  58371. static checkButton(attrs) {
  58372. return new CheckButton(attrs);
  58373. }
  58374. static choiceList(attrs) {
  58375. return new ChoiceList(attrs);
  58376. }
  58377. static color(attrs) {
  58378. return new Color(attrs);
  58379. }
  58380. static comb(attrs) {
  58381. return new Comb(attrs);
  58382. }
  58383. static connect(attrs) {
  58384. return new Connect(attrs);
  58385. }
  58386. static contentArea(attrs) {
  58387. return new ContentArea(attrs);
  58388. }
  58389. static corner(attrs) {
  58390. return new Corner(attrs);
  58391. }
  58392. static date(attrs) {
  58393. return new DateElement(attrs);
  58394. }
  58395. static dateTime(attrs) {
  58396. return new DateTime(attrs);
  58397. }
  58398. static dateTimeEdit(attrs) {
  58399. return new DateTimeEdit(attrs);
  58400. }
  58401. static decimal(attrs) {
  58402. return new Decimal(attrs);
  58403. }
  58404. static defaultUi(attrs) {
  58405. return new DefaultUi(attrs);
  58406. }
  58407. static desc(attrs) {
  58408. return new Desc(attrs);
  58409. }
  58410. static digestMethod(attrs) {
  58411. return new DigestMethod(attrs);
  58412. }
  58413. static digestMethods(attrs) {
  58414. return new DigestMethods(attrs);
  58415. }
  58416. static draw(attrs) {
  58417. return new Draw(attrs);
  58418. }
  58419. static edge(attrs) {
  58420. return new Edge(attrs);
  58421. }
  58422. static encoding(attrs) {
  58423. return new Encoding(attrs);
  58424. }
  58425. static encodings(attrs) {
  58426. return new Encodings(attrs);
  58427. }
  58428. static encrypt(attrs) {
  58429. return new Encrypt(attrs);
  58430. }
  58431. static encryptData(attrs) {
  58432. return new EncryptData(attrs);
  58433. }
  58434. static encryption(attrs) {
  58435. return new Encryption(attrs);
  58436. }
  58437. static encryptionMethod(attrs) {
  58438. return new EncryptionMethod(attrs);
  58439. }
  58440. static encryptionMethods(attrs) {
  58441. return new EncryptionMethods(attrs);
  58442. }
  58443. static event(attrs) {
  58444. return new Event(attrs);
  58445. }
  58446. static exData(attrs) {
  58447. return new ExData(attrs);
  58448. }
  58449. static exObject(attrs) {
  58450. return new ExObject(attrs);
  58451. }
  58452. static exclGroup(attrs) {
  58453. return new ExclGroup(attrs);
  58454. }
  58455. static execute(attrs) {
  58456. return new Execute(attrs);
  58457. }
  58458. static extras(attrs) {
  58459. return new Extras(attrs);
  58460. }
  58461. static field(attrs) {
  58462. return new Field(attrs);
  58463. }
  58464. static fill(attrs) {
  58465. return new Fill(attrs);
  58466. }
  58467. static filter(attrs) {
  58468. return new Filter(attrs);
  58469. }
  58470. static float(attrs) {
  58471. return new Float(attrs);
  58472. }
  58473. static font(attrs) {
  58474. return new Font(attrs);
  58475. }
  58476. static format(attrs) {
  58477. return new Format(attrs);
  58478. }
  58479. static handler(attrs) {
  58480. return new Handler(attrs);
  58481. }
  58482. static hyphenation(attrs) {
  58483. return new Hyphenation(attrs);
  58484. }
  58485. static image(attrs) {
  58486. return new Image(attrs);
  58487. }
  58488. static imageEdit(attrs) {
  58489. return new ImageEdit(attrs);
  58490. }
  58491. static integer(attrs) {
  58492. return new Integer(attrs);
  58493. }
  58494. static issuers(attrs) {
  58495. return new Issuers(attrs);
  58496. }
  58497. static items(attrs) {
  58498. return new Items(attrs);
  58499. }
  58500. static keep(attrs) {
  58501. return new Keep(attrs);
  58502. }
  58503. static keyUsage(attrs) {
  58504. return new KeyUsage(attrs);
  58505. }
  58506. static line(attrs) {
  58507. return new Line(attrs);
  58508. }
  58509. static linear(attrs) {
  58510. return new Linear(attrs);
  58511. }
  58512. static lockDocument(attrs) {
  58513. return new LockDocument(attrs);
  58514. }
  58515. static manifest(attrs) {
  58516. return new Manifest(attrs);
  58517. }
  58518. static margin(attrs) {
  58519. return new Margin(attrs);
  58520. }
  58521. static mdp(attrs) {
  58522. return new Mdp(attrs);
  58523. }
  58524. static medium(attrs) {
  58525. return new Medium(attrs);
  58526. }
  58527. static message(attrs) {
  58528. return new Message(attrs);
  58529. }
  58530. static numericEdit(attrs) {
  58531. return new NumericEdit(attrs);
  58532. }
  58533. static occur(attrs) {
  58534. return new Occur(attrs);
  58535. }
  58536. static oid(attrs) {
  58537. return new Oid(attrs);
  58538. }
  58539. static oids(attrs) {
  58540. return new Oids(attrs);
  58541. }
  58542. static overflow(attrs) {
  58543. return new Overflow(attrs);
  58544. }
  58545. static pageArea(attrs) {
  58546. return new PageArea(attrs);
  58547. }
  58548. static pageSet(attrs) {
  58549. return new PageSet(attrs);
  58550. }
  58551. static para(attrs) {
  58552. return new Para(attrs);
  58553. }
  58554. static passwordEdit(attrs) {
  58555. return new PasswordEdit(attrs);
  58556. }
  58557. static pattern(attrs) {
  58558. return new Pattern(attrs);
  58559. }
  58560. static picture(attrs) {
  58561. return new Picture(attrs);
  58562. }
  58563. static proto(attrs) {
  58564. return new Proto(attrs);
  58565. }
  58566. static radial(attrs) {
  58567. return new Radial(attrs);
  58568. }
  58569. static reason(attrs) {
  58570. return new Reason(attrs);
  58571. }
  58572. static reasons(attrs) {
  58573. return new Reasons(attrs);
  58574. }
  58575. static rectangle(attrs) {
  58576. return new Rectangle(attrs);
  58577. }
  58578. static ref(attrs) {
  58579. return new RefElement(attrs);
  58580. }
  58581. static script(attrs) {
  58582. return new Script(attrs);
  58583. }
  58584. static setProperty(attrs) {
  58585. return new SetProperty(attrs);
  58586. }
  58587. static signData(attrs) {
  58588. return new SignData(attrs);
  58589. }
  58590. static signature(attrs) {
  58591. return new Signature(attrs);
  58592. }
  58593. static signing(attrs) {
  58594. return new Signing(attrs);
  58595. }
  58596. static solid(attrs) {
  58597. return new Solid(attrs);
  58598. }
  58599. static speak(attrs) {
  58600. return new Speak(attrs);
  58601. }
  58602. static stipple(attrs) {
  58603. return new Stipple(attrs);
  58604. }
  58605. static subform(attrs) {
  58606. return new Subform(attrs);
  58607. }
  58608. static subformSet(attrs) {
  58609. return new SubformSet(attrs);
  58610. }
  58611. static subjectDN(attrs) {
  58612. return new SubjectDN(attrs);
  58613. }
  58614. static subjectDNs(attrs) {
  58615. return new SubjectDNs(attrs);
  58616. }
  58617. static submit(attrs) {
  58618. return new Submit(attrs);
  58619. }
  58620. static template(attrs) {
  58621. return new Template(attrs);
  58622. }
  58623. static text(attrs) {
  58624. return new Text(attrs);
  58625. }
  58626. static textEdit(attrs) {
  58627. return new TextEdit(attrs);
  58628. }
  58629. static time(attrs) {
  58630. return new Time(attrs);
  58631. }
  58632. static timeStamp(attrs) {
  58633. return new TimeStamp(attrs);
  58634. }
  58635. static toolTip(attrs) {
  58636. return new ToolTip(attrs);
  58637. }
  58638. static traversal(attrs) {
  58639. return new Traversal(attrs);
  58640. }
  58641. static traverse(attrs) {
  58642. return new Traverse(attrs);
  58643. }
  58644. static ui(attrs) {
  58645. return new Ui(attrs);
  58646. }
  58647. static validate(attrs) {
  58648. return new Validate(attrs);
  58649. }
  58650. static value(attrs) {
  58651. return new Value(attrs);
  58652. }
  58653. static variables(attrs) {
  58654. return new Variables(attrs);
  58655. }
  58656. }
  58657. exports.TemplateNamespace = TemplateNamespace;
  58658. /***/ }),
  58659. /* 81 */
  58660. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58661. Object.defineProperty(exports, "__esModule", ({
  58662. value: true
  58663. }));
  58664. exports.addHTML = addHTML;
  58665. exports.checkDimensions = checkDimensions;
  58666. exports.flushHTML = flushHTML;
  58667. exports.getAvailableSpace = getAvailableSpace;
  58668. var _xfa_object = __w_pdfjs_require__(75);
  58669. var _html_utils = __w_pdfjs_require__(82);
  58670. function createLine(node, children) {
  58671. return {
  58672. name: "div",
  58673. attributes: {
  58674. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58675. },
  58676. children
  58677. };
  58678. }
  58679. function flushHTML(node) {
  58680. if (!node[_xfa_object.$extra]) {
  58681. return null;
  58682. }
  58683. const attributes = node[_xfa_object.$extra].attributes;
  58684. const html = {
  58685. name: "div",
  58686. attributes,
  58687. children: node[_xfa_object.$extra].children
  58688. };
  58689. if (node[_xfa_object.$extra].failingNode) {
  58690. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58691. if (htmlFromFailing) {
  58692. if (node.layout.endsWith("-tb")) {
  58693. html.children.push(createLine(node, [htmlFromFailing]));
  58694. } else {
  58695. html.children.push(htmlFromFailing);
  58696. }
  58697. }
  58698. }
  58699. if (html.children.length === 0) {
  58700. return null;
  58701. }
  58702. return html;
  58703. }
  58704. function addHTML(node, html, bbox) {
  58705. const extra = node[_xfa_object.$extra];
  58706. const availableSpace = extra.availableSpace;
  58707. const [x, y, w, h] = bbox;
  58708. switch (node.layout) {
  58709. case "position":
  58710. {
  58711. extra.width = Math.max(extra.width, x + w);
  58712. extra.height = Math.max(extra.height, y + h);
  58713. extra.children.push(html);
  58714. break;
  58715. }
  58716. case "lr-tb":
  58717. case "rl-tb":
  58718. if (!extra.line || extra.attempt === 1) {
  58719. extra.line = createLine(node, []);
  58720. extra.children.push(extra.line);
  58721. extra.numberInLine = 0;
  58722. }
  58723. extra.numberInLine += 1;
  58724. extra.line.children.push(html);
  58725. if (extra.attempt === 0) {
  58726. extra.currentWidth += w;
  58727. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58728. } else {
  58729. extra.currentWidth = w;
  58730. extra.prevHeight = extra.height;
  58731. extra.height += h;
  58732. extra.attempt = 0;
  58733. }
  58734. extra.width = Math.max(extra.width, extra.currentWidth);
  58735. break;
  58736. case "rl-row":
  58737. case "row":
  58738. {
  58739. extra.children.push(html);
  58740. extra.width += w;
  58741. extra.height = Math.max(extra.height, h);
  58742. const height = (0, _html_utils.measureToString)(extra.height);
  58743. for (const child of extra.children) {
  58744. child.attributes.style.height = height;
  58745. }
  58746. break;
  58747. }
  58748. case "table":
  58749. {
  58750. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58751. extra.height += h;
  58752. extra.children.push(html);
  58753. break;
  58754. }
  58755. case "tb":
  58756. {
  58757. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58758. extra.height += h;
  58759. extra.children.push(html);
  58760. break;
  58761. }
  58762. }
  58763. }
  58764. function getAvailableSpace(node) {
  58765. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58766. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58767. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58768. switch (node.layout) {
  58769. case "lr-tb":
  58770. case "rl-tb":
  58771. if (node[_xfa_object.$extra].attempt === 0) {
  58772. return {
  58773. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58774. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58775. };
  58776. }
  58777. return {
  58778. width: availableSpace.width - marginH,
  58779. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58780. };
  58781. case "rl-row":
  58782. case "row":
  58783. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58784. return {
  58785. width,
  58786. height: availableSpace.height - marginH
  58787. };
  58788. case "table":
  58789. case "tb":
  58790. return {
  58791. width: availableSpace.width - marginH,
  58792. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58793. };
  58794. case "position":
  58795. default:
  58796. return availableSpace;
  58797. }
  58798. }
  58799. function getTransformedBBox(node) {
  58800. let w = node.w === "" ? NaN : node.w;
  58801. let h = node.h === "" ? NaN : node.h;
  58802. let [centerX, centerY] = [0, 0];
  58803. switch (node.anchorType || "") {
  58804. case "bottomCenter":
  58805. [centerX, centerY] = [w / 2, h];
  58806. break;
  58807. case "bottomLeft":
  58808. [centerX, centerY] = [0, h];
  58809. break;
  58810. case "bottomRight":
  58811. [centerX, centerY] = [w, h];
  58812. break;
  58813. case "middleCenter":
  58814. [centerX, centerY] = [w / 2, h / 2];
  58815. break;
  58816. case "middleLeft":
  58817. [centerX, centerY] = [0, h / 2];
  58818. break;
  58819. case "middleRight":
  58820. [centerX, centerY] = [w, h / 2];
  58821. break;
  58822. case "topCenter":
  58823. [centerX, centerY] = [w / 2, 0];
  58824. break;
  58825. case "topRight":
  58826. [centerX, centerY] = [w, 0];
  58827. break;
  58828. }
  58829. let x, y;
  58830. switch (node.rotate || 0) {
  58831. case 0:
  58832. [x, y] = [-centerX, -centerY];
  58833. break;
  58834. case 90:
  58835. [x, y] = [-centerY, centerX];
  58836. [w, h] = [h, -w];
  58837. break;
  58838. case 180:
  58839. [x, y] = [centerX, centerY];
  58840. [w, h] = [-w, -h];
  58841. break;
  58842. case 270:
  58843. [x, y] = [centerY, -centerX];
  58844. [w, h] = [-h, w];
  58845. break;
  58846. }
  58847. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58848. }
  58849. function checkDimensions(node, space) {
  58850. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58851. return true;
  58852. }
  58853. if (node.w === 0 || node.h === 0) {
  58854. return true;
  58855. }
  58856. const ERROR = 2;
  58857. const parent = node[_xfa_object.$getSubformParent]();
  58858. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58859. const [, y, w, h] = getTransformedBBox(node);
  58860. switch (parent.layout) {
  58861. case "lr-tb":
  58862. case "rl-tb":
  58863. if (attempt === 0) {
  58864. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58865. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58866. return false;
  58867. }
  58868. if (node.w !== "") {
  58869. if (Math.round(w - space.width) <= ERROR) {
  58870. return true;
  58871. }
  58872. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58873. return space.height > ERROR;
  58874. }
  58875. return false;
  58876. }
  58877. return space.width > ERROR;
  58878. }
  58879. if (node.w !== "") {
  58880. return Math.round(w - space.width) <= ERROR;
  58881. }
  58882. return space.width > ERROR;
  58883. }
  58884. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58885. return true;
  58886. }
  58887. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58888. return false;
  58889. }
  58890. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58891. return space.height > ERROR;
  58892. }
  58893. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58894. return false;
  58895. }
  58896. return space.height > ERROR;
  58897. case "table":
  58898. case "tb":
  58899. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58900. return true;
  58901. }
  58902. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58903. return Math.round(h - space.height) <= ERROR;
  58904. }
  58905. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58906. return space.height > ERROR;
  58907. }
  58908. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58909. return false;
  58910. }
  58911. return space.height > ERROR;
  58912. case "position":
  58913. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58914. return true;
  58915. }
  58916. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58917. return true;
  58918. }
  58919. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58920. return h + y > area.h;
  58921. case "rl-row":
  58922. case "row":
  58923. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58924. return true;
  58925. }
  58926. if (node.h !== "") {
  58927. return Math.round(h - space.height) <= ERROR;
  58928. }
  58929. return true;
  58930. default:
  58931. return true;
  58932. }
  58933. }
  58934. /***/ }),
  58935. /* 82 */
  58936. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58937. Object.defineProperty(exports, "__esModule", ({
  58938. value: true
  58939. }));
  58940. exports.computeBbox = computeBbox;
  58941. exports.createWrapper = createWrapper;
  58942. exports.fixDimensions = fixDimensions;
  58943. exports.fixTextIndent = fixTextIndent;
  58944. exports.fixURL = fixURL;
  58945. exports.isPrintOnly = isPrintOnly;
  58946. exports.layoutClass = layoutClass;
  58947. exports.layoutNode = layoutNode;
  58948. exports.measureToString = measureToString;
  58949. exports.setAccess = setAccess;
  58950. exports.setFontFamily = setFontFamily;
  58951. exports.setMinMaxDimensions = setMinMaxDimensions;
  58952. exports.setPara = setPara;
  58953. exports.toStyle = toStyle;
  58954. var _xfa_object = __w_pdfjs_require__(75);
  58955. var _util = __w_pdfjs_require__(2);
  58956. var _utils = __w_pdfjs_require__(76);
  58957. var _fonts = __w_pdfjs_require__(83);
  58958. var _text = __w_pdfjs_require__(84);
  58959. function measureToString(m) {
  58960. if (typeof m === "string") {
  58961. return "0px";
  58962. }
  58963. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58964. }
  58965. const converters = {
  58966. anchorType(node, style) {
  58967. const parent = node[_xfa_object.$getSubformParent]();
  58968. if (!parent || parent.layout && parent.layout !== "position") {
  58969. return;
  58970. }
  58971. if (!("transform" in style)) {
  58972. style.transform = "";
  58973. }
  58974. switch (node.anchorType) {
  58975. case "bottomCenter":
  58976. style.transform += "translate(-50%, -100%)";
  58977. break;
  58978. case "bottomLeft":
  58979. style.transform += "translate(0,-100%)";
  58980. break;
  58981. case "bottomRight":
  58982. style.transform += "translate(-100%,-100%)";
  58983. break;
  58984. case "middleCenter":
  58985. style.transform += "translate(-50%,-50%)";
  58986. break;
  58987. case "middleLeft":
  58988. style.transform += "translate(0,-50%)";
  58989. break;
  58990. case "middleRight":
  58991. style.transform += "translate(-100%,-50%)";
  58992. break;
  58993. case "topCenter":
  58994. style.transform += "translate(-50%,0)";
  58995. break;
  58996. case "topRight":
  58997. style.transform += "translate(-100%,0)";
  58998. break;
  58999. }
  59000. },
  59001. dimensions(node, style) {
  59002. const parent = node[_xfa_object.$getSubformParent]();
  59003. let width = node.w;
  59004. const height = node.h;
  59005. if (parent.layout && parent.layout.includes("row")) {
  59006. const extra = parent[_xfa_object.$extra];
  59007. const colSpan = node.colSpan;
  59008. let w;
  59009. if (colSpan === -1) {
  59010. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  59011. extra.currentColumn = 0;
  59012. } else {
  59013. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  59014. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  59015. }
  59016. if (!isNaN(w)) {
  59017. width = node.w = w;
  59018. }
  59019. }
  59020. if (width !== "") {
  59021. style.width = measureToString(width);
  59022. } else {
  59023. style.width = "auto";
  59024. }
  59025. if (height !== "") {
  59026. style.height = measureToString(height);
  59027. } else {
  59028. style.height = "auto";
  59029. }
  59030. },
  59031. position(node, style) {
  59032. const parent = node[_xfa_object.$getSubformParent]();
  59033. if (parent && parent.layout && parent.layout !== "position") {
  59034. return;
  59035. }
  59036. style.position = "absolute";
  59037. style.left = measureToString(node.x);
  59038. style.top = measureToString(node.y);
  59039. },
  59040. rotate(node, style) {
  59041. if (node.rotate) {
  59042. if (!("transform" in style)) {
  59043. style.transform = "";
  59044. }
  59045. style.transform += `rotate(-${node.rotate}deg)`;
  59046. style.transformOrigin = "top left";
  59047. }
  59048. },
  59049. presence(node, style) {
  59050. switch (node.presence) {
  59051. case "invisible":
  59052. style.visibility = "hidden";
  59053. break;
  59054. case "hidden":
  59055. case "inactive":
  59056. style.display = "none";
  59057. break;
  59058. }
  59059. },
  59060. hAlign(node, style) {
  59061. if (node[_xfa_object.$nodeName] === "para") {
  59062. switch (node.hAlign) {
  59063. case "justifyAll":
  59064. style.textAlign = "justify-all";
  59065. break;
  59066. case "radix":
  59067. style.textAlign = "left";
  59068. break;
  59069. default:
  59070. style.textAlign = node.hAlign;
  59071. }
  59072. } else {
  59073. switch (node.hAlign) {
  59074. case "left":
  59075. style.alignSelf = "start";
  59076. break;
  59077. case "center":
  59078. style.alignSelf = "center";
  59079. break;
  59080. case "right":
  59081. style.alignSelf = "end";
  59082. break;
  59083. }
  59084. }
  59085. },
  59086. margin(node, style) {
  59087. if (node.margin) {
  59088. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  59089. }
  59090. }
  59091. };
  59092. function setMinMaxDimensions(node, style) {
  59093. const parent = node[_xfa_object.$getSubformParent]();
  59094. if (parent.layout === "position") {
  59095. if (node.minW > 0) {
  59096. style.minWidth = measureToString(node.minW);
  59097. }
  59098. if (node.maxW > 0) {
  59099. style.maxWidth = measureToString(node.maxW);
  59100. }
  59101. if (node.minH > 0) {
  59102. style.minHeight = measureToString(node.minH);
  59103. }
  59104. if (node.maxH > 0) {
  59105. style.maxHeight = measureToString(node.maxH);
  59106. }
  59107. }
  59108. }
  59109. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  59110. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  59111. if (typeof text === "string") {
  59112. measure.addString(text);
  59113. } else {
  59114. text[_xfa_object.$pushGlyphs](measure);
  59115. }
  59116. return measure.compute(width);
  59117. }
  59118. function layoutNode(node, availableSpace) {
  59119. let height = null;
  59120. let width = null;
  59121. let isBroken = false;
  59122. if ((!node.w || !node.h) && node.value) {
  59123. let marginH = 0;
  59124. let marginV = 0;
  59125. if (node.margin) {
  59126. marginH = node.margin.leftInset + node.margin.rightInset;
  59127. marginV = node.margin.topInset + node.margin.bottomInset;
  59128. }
  59129. let lineHeight = null;
  59130. let margin = null;
  59131. if (node.para) {
  59132. margin = Object.create(null);
  59133. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  59134. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  59135. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  59136. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  59137. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  59138. }
  59139. let font = node.font;
  59140. if (!font) {
  59141. const root = node[_xfa_object.$getTemplateRoot]();
  59142. let parent = node[_xfa_object.$getParent]();
  59143. while (parent && parent !== root) {
  59144. if (parent.font) {
  59145. font = parent.font;
  59146. break;
  59147. }
  59148. parent = parent[_xfa_object.$getParent]();
  59149. }
  59150. }
  59151. const maxWidth = (node.w || availableSpace.width) - marginH;
  59152. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  59153. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  59154. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  59155. width = res.width;
  59156. height = res.height;
  59157. isBroken = res.isBroken;
  59158. } else {
  59159. const text = node.value[_xfa_object.$text]();
  59160. if (text) {
  59161. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  59162. width = res.width;
  59163. height = res.height;
  59164. isBroken = res.isBroken;
  59165. }
  59166. }
  59167. if (width !== null && !node.w) {
  59168. width += marginH;
  59169. }
  59170. if (height !== null && !node.h) {
  59171. height += marginV;
  59172. }
  59173. }
  59174. return {
  59175. w: width,
  59176. h: height,
  59177. isBroken
  59178. };
  59179. }
  59180. function computeBbox(node, html, availableSpace) {
  59181. let bbox;
  59182. if (node.w !== "" && node.h !== "") {
  59183. bbox = [node.x, node.y, node.w, node.h];
  59184. } else {
  59185. if (!availableSpace) {
  59186. return null;
  59187. }
  59188. let width = node.w;
  59189. if (width === "") {
  59190. if (node.maxW === 0) {
  59191. const parent = node[_xfa_object.$getSubformParent]();
  59192. if (parent.layout === "position" && parent.w !== "") {
  59193. width = 0;
  59194. } else {
  59195. width = node.minW;
  59196. }
  59197. } else {
  59198. width = Math.min(node.maxW, availableSpace.width);
  59199. }
  59200. html.attributes.style.width = measureToString(width);
  59201. }
  59202. let height = node.h;
  59203. if (height === "") {
  59204. if (node.maxH === 0) {
  59205. const parent = node[_xfa_object.$getSubformParent]();
  59206. if (parent.layout === "position" && parent.h !== "") {
  59207. height = 0;
  59208. } else {
  59209. height = node.minH;
  59210. }
  59211. } else {
  59212. height = Math.min(node.maxH, availableSpace.height);
  59213. }
  59214. html.attributes.style.height = measureToString(height);
  59215. }
  59216. bbox = [node.x, node.y, width, height];
  59217. }
  59218. return bbox;
  59219. }
  59220. function fixDimensions(node) {
  59221. const parent = node[_xfa_object.$getSubformParent]();
  59222. if (parent.layout && parent.layout.includes("row")) {
  59223. const extra = parent[_xfa_object.$extra];
  59224. const colSpan = node.colSpan;
  59225. let width;
  59226. if (colSpan === -1) {
  59227. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  59228. } else {
  59229. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  59230. }
  59231. if (!isNaN(width)) {
  59232. node.w = width;
  59233. }
  59234. }
  59235. if (parent.layout && parent.layout !== "position") {
  59236. node.x = node.y = 0;
  59237. }
  59238. if (node.layout === "table") {
  59239. if (node.w === "" && Array.isArray(node.columnWidths)) {
  59240. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  59241. }
  59242. }
  59243. }
  59244. function layoutClass(node) {
  59245. switch (node.layout) {
  59246. case "position":
  59247. return "xfaPosition";
  59248. case "lr-tb":
  59249. return "xfaLrTb";
  59250. case "rl-row":
  59251. return "xfaRlRow";
  59252. case "rl-tb":
  59253. return "xfaRlTb";
  59254. case "row":
  59255. return "xfaRow";
  59256. case "table":
  59257. return "xfaTable";
  59258. case "tb":
  59259. return "xfaTb";
  59260. default:
  59261. return "xfaPosition";
  59262. }
  59263. }
  59264. function toStyle(node, ...names) {
  59265. const style = Object.create(null);
  59266. for (const name of names) {
  59267. const value = node[name];
  59268. if (value === null) {
  59269. continue;
  59270. }
  59271. if (converters.hasOwnProperty(name)) {
  59272. converters[name](node, style);
  59273. continue;
  59274. }
  59275. if (value instanceof _xfa_object.XFAObject) {
  59276. const newStyle = value[_xfa_object.$toStyle]();
  59277. if (newStyle) {
  59278. Object.assign(style, newStyle);
  59279. } else {
  59280. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  59281. }
  59282. }
  59283. }
  59284. return style;
  59285. }
  59286. function createWrapper(node, html) {
  59287. const {
  59288. attributes
  59289. } = html;
  59290. const {
  59291. style
  59292. } = attributes;
  59293. const wrapper = {
  59294. name: "div",
  59295. attributes: {
  59296. class: ["xfaWrapper"],
  59297. style: Object.create(null)
  59298. },
  59299. children: []
  59300. };
  59301. attributes.class.push("xfaWrapped");
  59302. if (node.border) {
  59303. const {
  59304. widths,
  59305. insets
  59306. } = node.border[_xfa_object.$extra];
  59307. let width, height;
  59308. let top = insets[0];
  59309. let left = insets[3];
  59310. const insetsH = insets[0] + insets[2];
  59311. const insetsW = insets[1] + insets[3];
  59312. switch (node.border.hand) {
  59313. case "even":
  59314. top -= widths[0] / 2;
  59315. left -= widths[3] / 2;
  59316. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  59317. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  59318. break;
  59319. case "left":
  59320. top -= widths[0];
  59321. left -= widths[3];
  59322. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  59323. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  59324. break;
  59325. case "right":
  59326. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  59327. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  59328. break;
  59329. }
  59330. const classNames = ["xfaBorder"];
  59331. if (isPrintOnly(node.border)) {
  59332. classNames.push("xfaPrintOnly");
  59333. }
  59334. const border = {
  59335. name: "div",
  59336. attributes: {
  59337. class: classNames,
  59338. style: {
  59339. top: `${top}px`,
  59340. left: `${left}px`,
  59341. width,
  59342. height
  59343. }
  59344. },
  59345. children: []
  59346. };
  59347. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  59348. if (style[key] !== undefined) {
  59349. border.attributes.style[key] = style[key];
  59350. delete style[key];
  59351. }
  59352. }
  59353. wrapper.children.push(border, html);
  59354. } else {
  59355. wrapper.children.push(html);
  59356. }
  59357. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  59358. if (style[key] !== undefined) {
  59359. wrapper.attributes.style[key] = style[key];
  59360. delete style[key];
  59361. }
  59362. }
  59363. if (style.position === "absolute") {
  59364. wrapper.attributes.style.position = "absolute";
  59365. } else {
  59366. wrapper.attributes.style.position = "relative";
  59367. }
  59368. delete style.position;
  59369. if (style.alignSelf) {
  59370. wrapper.attributes.style.alignSelf = style.alignSelf;
  59371. delete style.alignSelf;
  59372. }
  59373. return wrapper;
  59374. }
  59375. function fixTextIndent(styles) {
  59376. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  59377. if (indent >= 0) {
  59378. return;
  59379. }
  59380. const align = styles.textAlign === "right" ? "right" : "left";
  59381. const name = "padding" + (align === "left" ? "Left" : "Right");
  59382. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  59383. styles[name] = `${padding - indent}px`;
  59384. }
  59385. function setAccess(node, classNames) {
  59386. switch (node.access) {
  59387. case "nonInteractive":
  59388. classNames.push("xfaNonInteractive");
  59389. break;
  59390. case "readOnly":
  59391. classNames.push("xfaReadOnly");
  59392. break;
  59393. case "protected":
  59394. classNames.push("xfaDisabled");
  59395. break;
  59396. }
  59397. }
  59398. function isPrintOnly(node) {
  59399. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  59400. }
  59401. function getCurrentPara(node) {
  59402. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  59403. return stack.length ? stack.at(-1) : null;
  59404. }
  59405. function setPara(node, nodeStyle, value) {
  59406. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  59407. if (nodeStyle) {
  59408. if (node.h === "") {
  59409. nodeStyle.height = "auto";
  59410. }
  59411. if (node.w === "") {
  59412. nodeStyle.width = "auto";
  59413. }
  59414. }
  59415. const para = getCurrentPara(node);
  59416. if (para) {
  59417. const valueStyle = value.attributes.style;
  59418. valueStyle.display = "flex";
  59419. valueStyle.flexDirection = "column";
  59420. switch (para.vAlign) {
  59421. case "top":
  59422. valueStyle.justifyContent = "start";
  59423. break;
  59424. case "bottom":
  59425. valueStyle.justifyContent = "end";
  59426. break;
  59427. case "middle":
  59428. valueStyle.justifyContent = "center";
  59429. break;
  59430. }
  59431. const paraStyle = para[_xfa_object.$toStyle]();
  59432. for (const [key, val] of Object.entries(paraStyle)) {
  59433. if (!(key in valueStyle)) {
  59434. valueStyle[key] = val;
  59435. }
  59436. }
  59437. }
  59438. }
  59439. }
  59440. function setFontFamily(xfaFont, node, fontFinder, style) {
  59441. if (!fontFinder) {
  59442. delete style.fontFamily;
  59443. return;
  59444. }
  59445. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59446. style.fontFamily = `"${name}"`;
  59447. const typeface = fontFinder.find(name);
  59448. if (typeface) {
  59449. const {
  59450. fontFamily
  59451. } = typeface.regular.cssFontInfo;
  59452. if (fontFamily !== name) {
  59453. style.fontFamily = `"${fontFamily}"`;
  59454. }
  59455. const para = getCurrentPara(node);
  59456. if (para && para.lineHeight !== "") {
  59457. return;
  59458. }
  59459. if (style.lineHeight) {
  59460. return;
  59461. }
  59462. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59463. if (pdfFont) {
  59464. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  59465. }
  59466. }
  59467. }
  59468. function fixURL(str) {
  59469. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  59470. addDefaultProtocol: true,
  59471. tryConvertEncoding: true
  59472. });
  59473. return absoluteUrl ? absoluteUrl.href : null;
  59474. }
  59475. /***/ }),
  59476. /* 83 */
  59477. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59478. Object.defineProperty(exports, "__esModule", ({
  59479. value: true
  59480. }));
  59481. exports.FontFinder = void 0;
  59482. exports.getMetrics = getMetrics;
  59483. exports.selectFont = selectFont;
  59484. var _xfa_object = __w_pdfjs_require__(75);
  59485. var _utils = __w_pdfjs_require__(76);
  59486. var _util = __w_pdfjs_require__(2);
  59487. class FontFinder {
  59488. constructor(pdfFonts) {
  59489. this.fonts = new Map();
  59490. this.cache = new Map();
  59491. this.warned = new Set();
  59492. this.defaultFont = null;
  59493. this.add(pdfFonts);
  59494. }
  59495. add(pdfFonts, reallyMissingFonts = null) {
  59496. for (const pdfFont of pdfFonts) {
  59497. this.addPdfFont(pdfFont);
  59498. }
  59499. for (const pdfFont of this.fonts.values()) {
  59500. if (!pdfFont.regular) {
  59501. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  59502. }
  59503. }
  59504. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  59505. return;
  59506. }
  59507. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  59508. for (const missing of reallyMissingFonts) {
  59509. this.fonts.set(missing, myriad);
  59510. }
  59511. }
  59512. addPdfFont(pdfFont) {
  59513. const cssFontInfo = pdfFont.cssFontInfo;
  59514. const name = cssFontInfo.fontFamily;
  59515. let font = this.fonts.get(name);
  59516. if (!font) {
  59517. font = Object.create(null);
  59518. this.fonts.set(name, font);
  59519. if (!this.defaultFont) {
  59520. this.defaultFont = font;
  59521. }
  59522. }
  59523. let property = "";
  59524. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  59525. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  59526. property = fontWeight >= 700 ? "bolditalic" : "italic";
  59527. } else if (fontWeight >= 700) {
  59528. property = "bold";
  59529. }
  59530. if (!property) {
  59531. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  59532. property = "bold";
  59533. }
  59534. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59535. property += "italic";
  59536. }
  59537. }
  59538. if (!property) {
  59539. property = "regular";
  59540. }
  59541. font[property] = pdfFont;
  59542. }
  59543. getDefault() {
  59544. return this.defaultFont;
  59545. }
  59546. find(fontName, mustWarn = true) {
  59547. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59548. if (font) {
  59549. return font;
  59550. }
  59551. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59552. let name = fontName.replace(pattern, "");
  59553. font = this.fonts.get(name);
  59554. if (font) {
  59555. this.cache.set(fontName, font);
  59556. return font;
  59557. }
  59558. name = name.toLowerCase();
  59559. const maybe = [];
  59560. for (const [family, pdfFont] of this.fonts.entries()) {
  59561. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59562. maybe.push(pdfFont);
  59563. }
  59564. }
  59565. if (maybe.length === 0) {
  59566. for (const [, pdfFont] of this.fonts.entries()) {
  59567. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59568. maybe.push(pdfFont);
  59569. }
  59570. }
  59571. }
  59572. if (maybe.length === 0) {
  59573. name = name.replace(/psmt|mt/gi, "");
  59574. for (const [family, pdfFont] of this.fonts.entries()) {
  59575. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59576. maybe.push(pdfFont);
  59577. }
  59578. }
  59579. }
  59580. if (maybe.length === 0) {
  59581. for (const pdfFont of this.fonts.values()) {
  59582. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59583. maybe.push(pdfFont);
  59584. }
  59585. }
  59586. }
  59587. if (maybe.length >= 1) {
  59588. if (maybe.length !== 1 && mustWarn) {
  59589. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59590. }
  59591. this.cache.set(fontName, maybe[0]);
  59592. return maybe[0];
  59593. }
  59594. if (mustWarn && !this.warned.has(fontName)) {
  59595. this.warned.add(fontName);
  59596. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59597. }
  59598. return null;
  59599. }
  59600. }
  59601. exports.FontFinder = FontFinder;
  59602. function selectFont(xfaFont, typeface) {
  59603. if (xfaFont.posture === "italic") {
  59604. if (xfaFont.weight === "bold") {
  59605. return typeface.bolditalic;
  59606. }
  59607. return typeface.italic;
  59608. } else if (xfaFont.weight === "bold") {
  59609. return typeface.bold;
  59610. }
  59611. return typeface.regular;
  59612. }
  59613. function getMetrics(xfaFont, real = false) {
  59614. let pdfFont = null;
  59615. if (xfaFont) {
  59616. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59617. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59618. pdfFont = selectFont(xfaFont, typeface);
  59619. }
  59620. if (!pdfFont) {
  59621. return {
  59622. lineHeight: 12,
  59623. lineGap: 2,
  59624. lineNoGap: 10
  59625. };
  59626. }
  59627. const size = xfaFont.size || 10;
  59628. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59629. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59630. return {
  59631. lineHeight: lineHeight * size,
  59632. lineGap: lineGap * size,
  59633. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59634. };
  59635. }
  59636. /***/ }),
  59637. /* 84 */
  59638. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59639. Object.defineProperty(exports, "__esModule", ({
  59640. value: true
  59641. }));
  59642. exports.TextMeasure = void 0;
  59643. var _fonts = __w_pdfjs_require__(83);
  59644. const WIDTH_FACTOR = 1.02;
  59645. class FontInfo {
  59646. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59647. this.lineHeight = lineHeight;
  59648. this.paraMargin = margin || {
  59649. top: 0,
  59650. bottom: 0,
  59651. left: 0,
  59652. right: 0
  59653. };
  59654. if (!xfaFont) {
  59655. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59656. return;
  59657. }
  59658. this.xfaFont = {
  59659. typeface: xfaFont.typeface,
  59660. posture: xfaFont.posture,
  59661. weight: xfaFont.weight,
  59662. size: xfaFont.size,
  59663. letterSpacing: xfaFont.letterSpacing
  59664. };
  59665. const typeface = fontFinder.find(xfaFont.typeface);
  59666. if (!typeface) {
  59667. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59668. return;
  59669. }
  59670. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59671. if (!this.pdfFont) {
  59672. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59673. }
  59674. }
  59675. defaultFont(fontFinder) {
  59676. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59677. if (font && font.regular) {
  59678. const pdfFont = font.regular;
  59679. const info = pdfFont.cssFontInfo;
  59680. const xfaFont = {
  59681. typeface: info.fontFamily,
  59682. posture: "normal",
  59683. weight: "normal",
  59684. size: 10,
  59685. letterSpacing: 0
  59686. };
  59687. return [pdfFont, xfaFont];
  59688. }
  59689. const xfaFont = {
  59690. typeface: "Courier",
  59691. posture: "normal",
  59692. weight: "normal",
  59693. size: 10,
  59694. letterSpacing: 0
  59695. };
  59696. return [null, xfaFont];
  59697. }
  59698. }
  59699. class FontSelector {
  59700. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59701. this.fontFinder = fontFinder;
  59702. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59703. }
  59704. pushData(xfaFont, margin, lineHeight) {
  59705. const lastFont = this.stack.at(-1);
  59706. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59707. if (!xfaFont[name]) {
  59708. xfaFont[name] = lastFont.xfaFont[name];
  59709. }
  59710. }
  59711. for (const name of ["top", "bottom", "left", "right"]) {
  59712. if (isNaN(margin[name])) {
  59713. margin[name] = lastFont.paraMargin[name];
  59714. }
  59715. }
  59716. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59717. if (!fontInfo.pdfFont) {
  59718. fontInfo.pdfFont = lastFont.pdfFont;
  59719. }
  59720. this.stack.push(fontInfo);
  59721. }
  59722. popFont() {
  59723. this.stack.pop();
  59724. }
  59725. topFont() {
  59726. return this.stack.at(-1);
  59727. }
  59728. }
  59729. class TextMeasure {
  59730. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59731. this.glyphs = [];
  59732. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59733. this.extraHeight = 0;
  59734. }
  59735. pushData(xfaFont, margin, lineHeight) {
  59736. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59737. }
  59738. popFont(xfaFont) {
  59739. return this.fontSelector.popFont();
  59740. }
  59741. addPara() {
  59742. const lastFont = this.fontSelector.topFont();
  59743. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59744. }
  59745. addString(str) {
  59746. if (!str) {
  59747. return;
  59748. }
  59749. const lastFont = this.fontSelector.topFont();
  59750. const fontSize = lastFont.xfaFont.size;
  59751. if (lastFont.pdfFont) {
  59752. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59753. const pdfFont = lastFont.pdfFont;
  59754. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59755. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59756. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59757. const noGap = fontLineHeight - lineGap;
  59758. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59759. const scale = fontSize / 1000;
  59760. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59761. for (const line of str.split(/[\u2029\n]/)) {
  59762. const encodedLine = pdfFont.encodeString(line).join("");
  59763. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59764. for (const glyph of glyphs) {
  59765. const width = glyph.width || fallbackWidth;
  59766. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59767. }
  59768. this.glyphs.push([0, 0, 0, "\n", true]);
  59769. }
  59770. this.glyphs.pop();
  59771. return;
  59772. }
  59773. for (const line of str.split(/[\u2029\n]/)) {
  59774. for (const char of line.split("")) {
  59775. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59776. }
  59777. this.glyphs.push([0, 0, 0, "\n", true]);
  59778. }
  59779. this.glyphs.pop();
  59780. }
  59781. compute(maxWidth) {
  59782. let lastSpacePos = -1,
  59783. lastSpaceWidth = 0,
  59784. width = 0,
  59785. height = 0,
  59786. currentLineWidth = 0,
  59787. currentLineHeight = 0;
  59788. let isBroken = false;
  59789. let isFirstLine = true;
  59790. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59791. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59792. const isSpace = char === " ";
  59793. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59794. if (isEOL) {
  59795. width = Math.max(width, currentLineWidth);
  59796. currentLineWidth = 0;
  59797. height += currentLineHeight;
  59798. currentLineHeight = glyphHeight;
  59799. lastSpacePos = -1;
  59800. lastSpaceWidth = 0;
  59801. isFirstLine = false;
  59802. continue;
  59803. }
  59804. if (isSpace) {
  59805. if (currentLineWidth + glyphWidth > maxWidth) {
  59806. width = Math.max(width, currentLineWidth);
  59807. currentLineWidth = 0;
  59808. height += currentLineHeight;
  59809. currentLineHeight = glyphHeight;
  59810. lastSpacePos = -1;
  59811. lastSpaceWidth = 0;
  59812. isBroken = true;
  59813. isFirstLine = false;
  59814. } else {
  59815. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59816. lastSpaceWidth = currentLineWidth;
  59817. currentLineWidth += glyphWidth;
  59818. lastSpacePos = i;
  59819. }
  59820. continue;
  59821. }
  59822. if (currentLineWidth + glyphWidth > maxWidth) {
  59823. height += currentLineHeight;
  59824. currentLineHeight = glyphHeight;
  59825. if (lastSpacePos !== -1) {
  59826. i = lastSpacePos;
  59827. width = Math.max(width, lastSpaceWidth);
  59828. currentLineWidth = 0;
  59829. lastSpacePos = -1;
  59830. lastSpaceWidth = 0;
  59831. } else {
  59832. width = Math.max(width, currentLineWidth);
  59833. currentLineWidth = glyphWidth;
  59834. }
  59835. isBroken = true;
  59836. isFirstLine = false;
  59837. continue;
  59838. }
  59839. currentLineWidth += glyphWidth;
  59840. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59841. }
  59842. width = Math.max(width, currentLineWidth);
  59843. height += currentLineHeight + this.extraHeight;
  59844. return {
  59845. width: WIDTH_FACTOR * width,
  59846. height,
  59847. isBroken
  59848. };
  59849. }
  59850. }
  59851. exports.TextMeasure = TextMeasure;
  59852. /***/ }),
  59853. /* 85 */
  59854. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59855. Object.defineProperty(exports, "__esModule", ({
  59856. value: true
  59857. }));
  59858. exports.DataHandler = void 0;
  59859. var _xfa_object = __w_pdfjs_require__(75);
  59860. class DataHandler {
  59861. constructor(root, data) {
  59862. this.data = data;
  59863. this.dataset = root.datasets || null;
  59864. }
  59865. serialize(storage) {
  59866. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59867. while (stack.length > 0) {
  59868. const last = stack.at(-1);
  59869. const [i, children] = last;
  59870. if (i + 1 === children.length) {
  59871. stack.pop();
  59872. continue;
  59873. }
  59874. const child = children[++last[0]];
  59875. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59876. if (storageEntry) {
  59877. child[_xfa_object.$setValue](storageEntry);
  59878. } else {
  59879. const attributes = child[_xfa_object.$getAttributes]();
  59880. for (const value of attributes.values()) {
  59881. const entry = storage.get(value[_xfa_object.$uid]);
  59882. if (entry) {
  59883. value[_xfa_object.$setValue](entry);
  59884. break;
  59885. }
  59886. }
  59887. }
  59888. const nodes = child[_xfa_object.$getChildren]();
  59889. if (nodes.length > 0) {
  59890. stack.push([-1, nodes]);
  59891. }
  59892. }
  59893. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59894. if (this.dataset) {
  59895. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59896. if (child[_xfa_object.$nodeName] !== "data") {
  59897. child[_xfa_object.$toString](buf);
  59898. }
  59899. }
  59900. }
  59901. this.data[_xfa_object.$toString](buf);
  59902. buf.push("</xfa:datasets>");
  59903. return buf.join("");
  59904. }
  59905. }
  59906. exports.DataHandler = DataHandler;
  59907. /***/ }),
  59908. /* 86 */
  59909. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59910. Object.defineProperty(exports, "__esModule", ({
  59911. value: true
  59912. }));
  59913. exports.XFAParser = void 0;
  59914. var _xfa_object = __w_pdfjs_require__(75);
  59915. var _xml_parser = __w_pdfjs_require__(64);
  59916. var _builder = __w_pdfjs_require__(87);
  59917. var _util = __w_pdfjs_require__(2);
  59918. class XFAParser extends _xml_parser.XMLParserBase {
  59919. constructor(rootNameSpace = null, richText = false) {
  59920. super();
  59921. this._builder = new _builder.Builder(rootNameSpace);
  59922. this._stack = [];
  59923. this._globalData = {
  59924. usedTypefaces: new Set()
  59925. };
  59926. this._ids = new Map();
  59927. this._current = this._builder.buildRoot(this._ids);
  59928. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59929. this._whiteRegex = /^\s+$/;
  59930. this._nbsps = /\xa0+/g;
  59931. this._richText = richText;
  59932. }
  59933. parse(data) {
  59934. this.parseXml(data);
  59935. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59936. return undefined;
  59937. }
  59938. this._current[_xfa_object.$finalize]();
  59939. return this._current.element;
  59940. }
  59941. onText(text) {
  59942. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59943. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59944. this._current[_xfa_object.$onText](text, this._richText);
  59945. return;
  59946. }
  59947. if (this._whiteRegex.test(text)) {
  59948. return;
  59949. }
  59950. this._current[_xfa_object.$onText](text.trim());
  59951. }
  59952. onCdata(text) {
  59953. this._current[_xfa_object.$onText](text);
  59954. }
  59955. _mkAttributes(attributes, tagName) {
  59956. let namespace = null;
  59957. let prefixes = null;
  59958. const attributeObj = Object.create({});
  59959. for (const {
  59960. name,
  59961. value
  59962. } of attributes) {
  59963. if (name === "xmlns") {
  59964. if (!namespace) {
  59965. namespace = value;
  59966. } else {
  59967. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59968. }
  59969. } else if (name.startsWith("xmlns:")) {
  59970. const prefix = name.substring("xmlns:".length);
  59971. if (!prefixes) {
  59972. prefixes = [];
  59973. }
  59974. prefixes.push({
  59975. prefix,
  59976. value
  59977. });
  59978. } else {
  59979. const i = name.indexOf(":");
  59980. if (i === -1) {
  59981. attributeObj[name] = value;
  59982. } else {
  59983. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  59984. if (!nsAttrs) {
  59985. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  59986. }
  59987. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  59988. let attrs = nsAttrs[ns];
  59989. if (!attrs) {
  59990. attrs = nsAttrs[ns] = Object.create(null);
  59991. }
  59992. attrs[attrName] = value;
  59993. }
  59994. }
  59995. }
  59996. return [namespace, prefixes, attributeObj];
  59997. }
  59998. _getNameAndPrefix(name, nsAgnostic) {
  59999. const i = name.indexOf(":");
  60000. if (i === -1) {
  60001. return [name, null];
  60002. }
  60003. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  60004. }
  60005. onBeginElement(tagName, attributes, isEmpty) {
  60006. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  60007. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  60008. const node = this._builder.build({
  60009. nsPrefix,
  60010. name,
  60011. attributes: attributesObj,
  60012. namespace,
  60013. prefixes
  60014. });
  60015. node[_xfa_object.$globalData] = this._globalData;
  60016. if (isEmpty) {
  60017. node[_xfa_object.$finalize]();
  60018. if (this._current[_xfa_object.$onChild](node)) {
  60019. node[_xfa_object.$setId](this._ids);
  60020. }
  60021. node[_xfa_object.$clean](this._builder);
  60022. return;
  60023. }
  60024. this._stack.push(this._current);
  60025. this._current = node;
  60026. }
  60027. onEndElement(name) {
  60028. const node = this._current;
  60029. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  60030. const parser = new XFAParser();
  60031. parser._globalData = this._globalData;
  60032. const root = parser.parse(node[_xfa_object.$content]);
  60033. node[_xfa_object.$content] = null;
  60034. node[_xfa_object.$onChild](root);
  60035. }
  60036. node[_xfa_object.$finalize]();
  60037. this._current = this._stack.pop();
  60038. if (this._current[_xfa_object.$onChild](node)) {
  60039. node[_xfa_object.$setId](this._ids);
  60040. }
  60041. node[_xfa_object.$clean](this._builder);
  60042. }
  60043. onError(code) {
  60044. this._errorCode = code;
  60045. }
  60046. }
  60047. exports.XFAParser = XFAParser;
  60048. /***/ }),
  60049. /* 87 */
  60050. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60051. Object.defineProperty(exports, "__esModule", ({
  60052. value: true
  60053. }));
  60054. exports.Builder = void 0;
  60055. var _namespaces = __w_pdfjs_require__(77);
  60056. var _xfa_object = __w_pdfjs_require__(75);
  60057. var _setup = __w_pdfjs_require__(88);
  60058. var _template = __w_pdfjs_require__(80);
  60059. var _unknown = __w_pdfjs_require__(97);
  60060. var _util = __w_pdfjs_require__(2);
  60061. class Root extends _xfa_object.XFAObject {
  60062. constructor(ids) {
  60063. super(-1, "root", Object.create(null));
  60064. this.element = null;
  60065. this[_xfa_object.$ids] = ids;
  60066. }
  60067. [_xfa_object.$onChild](child) {
  60068. this.element = child;
  60069. return true;
  60070. }
  60071. [_xfa_object.$finalize]() {
  60072. super[_xfa_object.$finalize]();
  60073. if (this.element.template instanceof _template.Template) {
  60074. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  60075. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  60076. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  60077. }
  60078. }
  60079. }
  60080. class Empty extends _xfa_object.XFAObject {
  60081. constructor() {
  60082. super(-1, "", Object.create(null));
  60083. }
  60084. [_xfa_object.$onChild](_) {
  60085. return false;
  60086. }
  60087. }
  60088. class Builder {
  60089. constructor(rootNameSpace = null) {
  60090. this._namespaceStack = [];
  60091. this._nsAgnosticLevel = 0;
  60092. this._namespacePrefixes = new Map();
  60093. this._namespaces = new Map();
  60094. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  60095. id
  60096. }) => id));
  60097. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  60098. }
  60099. buildRoot(ids) {
  60100. return new Root(ids);
  60101. }
  60102. build({
  60103. nsPrefix,
  60104. name,
  60105. attributes,
  60106. namespace,
  60107. prefixes
  60108. }) {
  60109. const hasNamespaceDef = namespace !== null;
  60110. if (hasNamespaceDef) {
  60111. this._namespaceStack.push(this._currentNamespace);
  60112. this._currentNamespace = this._searchNamespace(namespace);
  60113. }
  60114. if (prefixes) {
  60115. this._addNamespacePrefix(prefixes);
  60116. }
  60117. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  60118. const dataTemplate = _setup.NamespaceSetUp.datasets;
  60119. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  60120. let xfaAttrs = null;
  60121. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  60122. const nsToUse = this._getNamespaceToUse(ns);
  60123. if (nsToUse === dataTemplate) {
  60124. xfaAttrs = {
  60125. xfa: attrs
  60126. };
  60127. break;
  60128. }
  60129. }
  60130. if (xfaAttrs) {
  60131. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  60132. } else {
  60133. delete attributes[_xfa_object.$nsAttributes];
  60134. }
  60135. }
  60136. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  60137. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  60138. if (node[_xfa_object.$isNsAgnostic]()) {
  60139. this._nsAgnosticLevel++;
  60140. }
  60141. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  60142. node[_xfa_object.$cleanup] = {
  60143. hasNamespace: hasNamespaceDef,
  60144. prefixes,
  60145. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  60146. };
  60147. }
  60148. return node;
  60149. }
  60150. isNsAgnostic() {
  60151. return this._nsAgnosticLevel > 0;
  60152. }
  60153. _searchNamespace(nsName) {
  60154. let ns = this._namespaces.get(nsName);
  60155. if (ns) {
  60156. return ns;
  60157. }
  60158. for (const [name, {
  60159. check
  60160. }] of Object.entries(_namespaces.NamespaceIds)) {
  60161. if (check(nsName)) {
  60162. ns = _setup.NamespaceSetUp[name];
  60163. if (ns) {
  60164. this._namespaces.set(nsName, ns);
  60165. return ns;
  60166. }
  60167. break;
  60168. }
  60169. }
  60170. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  60171. this._namespaces.set(nsName, ns);
  60172. return ns;
  60173. }
  60174. _addNamespacePrefix(prefixes) {
  60175. for (const {
  60176. prefix,
  60177. value
  60178. } of prefixes) {
  60179. const namespace = this._searchNamespace(value);
  60180. let prefixStack = this._namespacePrefixes.get(prefix);
  60181. if (!prefixStack) {
  60182. prefixStack = [];
  60183. this._namespacePrefixes.set(prefix, prefixStack);
  60184. }
  60185. prefixStack.push(namespace);
  60186. }
  60187. }
  60188. _getNamespaceToUse(prefix) {
  60189. if (!prefix) {
  60190. return this._currentNamespace;
  60191. }
  60192. const prefixStack = this._namespacePrefixes.get(prefix);
  60193. if (prefixStack && prefixStack.length > 0) {
  60194. return prefixStack.at(-1);
  60195. }
  60196. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  60197. return null;
  60198. }
  60199. clean(data) {
  60200. const {
  60201. hasNamespace,
  60202. prefixes,
  60203. nsAgnostic
  60204. } = data;
  60205. if (hasNamespace) {
  60206. this._currentNamespace = this._namespaceStack.pop();
  60207. }
  60208. if (prefixes) {
  60209. prefixes.forEach(({
  60210. prefix
  60211. }) => {
  60212. this._namespacePrefixes.get(prefix).pop();
  60213. });
  60214. }
  60215. if (nsAgnostic) {
  60216. this._nsAgnosticLevel--;
  60217. }
  60218. }
  60219. }
  60220. exports.Builder = Builder;
  60221. /***/ }),
  60222. /* 88 */
  60223. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60224. Object.defineProperty(exports, "__esModule", ({
  60225. value: true
  60226. }));
  60227. exports.NamespaceSetUp = void 0;
  60228. var _config = __w_pdfjs_require__(89);
  60229. var _connection_set = __w_pdfjs_require__(90);
  60230. var _datasets = __w_pdfjs_require__(91);
  60231. var _locale_set = __w_pdfjs_require__(92);
  60232. var _signature = __w_pdfjs_require__(93);
  60233. var _stylesheet = __w_pdfjs_require__(94);
  60234. var _template = __w_pdfjs_require__(80);
  60235. var _xdp = __w_pdfjs_require__(95);
  60236. var _xhtml = __w_pdfjs_require__(96);
  60237. const NamespaceSetUp = {
  60238. config: _config.ConfigNamespace,
  60239. connection: _connection_set.ConnectionSetNamespace,
  60240. datasets: _datasets.DatasetsNamespace,
  60241. localeSet: _locale_set.LocaleSetNamespace,
  60242. signature: _signature.SignatureNamespace,
  60243. stylesheet: _stylesheet.StylesheetNamespace,
  60244. template: _template.TemplateNamespace,
  60245. xdp: _xdp.XdpNamespace,
  60246. xhtml: _xhtml.XhtmlNamespace
  60247. };
  60248. exports.NamespaceSetUp = NamespaceSetUp;
  60249. /***/ }),
  60250. /* 89 */
  60251. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60252. Object.defineProperty(exports, "__esModule", ({
  60253. value: true
  60254. }));
  60255. exports.ConfigNamespace = void 0;
  60256. var _namespaces = __w_pdfjs_require__(77);
  60257. var _xfa_object = __w_pdfjs_require__(75);
  60258. var _utils = __w_pdfjs_require__(76);
  60259. var _util = __w_pdfjs_require__(2);
  60260. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  60261. class Acrobat extends _xfa_object.XFAObject {
  60262. constructor(attributes) {
  60263. super(CONFIG_NS_ID, "acrobat", true);
  60264. this.acrobat7 = null;
  60265. this.autoSave = null;
  60266. this.common = null;
  60267. this.validate = null;
  60268. this.validateApprovalSignatures = null;
  60269. this.submitUrl = new _xfa_object.XFAObjectArray();
  60270. }
  60271. }
  60272. class Acrobat7 extends _xfa_object.XFAObject {
  60273. constructor(attributes) {
  60274. super(CONFIG_NS_ID, "acrobat7", true);
  60275. this.dynamicRender = null;
  60276. }
  60277. }
  60278. class ADBE_JSConsole extends _xfa_object.OptionObject {
  60279. constructor(attributes) {
  60280. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  60281. }
  60282. }
  60283. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  60284. constructor(attributes) {
  60285. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  60286. }
  60287. }
  60288. class AddSilentPrint extends _xfa_object.Option01 {
  60289. constructor(attributes) {
  60290. super(CONFIG_NS_ID, "addSilentPrint");
  60291. }
  60292. }
  60293. class AddViewerPreferences extends _xfa_object.Option01 {
  60294. constructor(attributes) {
  60295. super(CONFIG_NS_ID, "addViewerPreferences");
  60296. }
  60297. }
  60298. class AdjustData extends _xfa_object.Option10 {
  60299. constructor(attributes) {
  60300. super(CONFIG_NS_ID, "adjustData");
  60301. }
  60302. }
  60303. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  60304. constructor(attributes) {
  60305. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  60306. }
  60307. }
  60308. class Agent extends _xfa_object.XFAObject {
  60309. constructor(attributes) {
  60310. super(CONFIG_NS_ID, "agent", true);
  60311. this.name = attributes.name ? attributes.name.trim() : "";
  60312. this.common = new _xfa_object.XFAObjectArray();
  60313. }
  60314. }
  60315. class AlwaysEmbed extends _xfa_object.ContentObject {
  60316. constructor(attributes) {
  60317. super(CONFIG_NS_ID, "alwaysEmbed");
  60318. }
  60319. }
  60320. class Amd extends _xfa_object.StringObject {
  60321. constructor(attributes) {
  60322. super(CONFIG_NS_ID, "amd");
  60323. }
  60324. }
  60325. class Area extends _xfa_object.XFAObject {
  60326. constructor(attributes) {
  60327. super(CONFIG_NS_ID, "area");
  60328. this.level = (0, _utils.getInteger)({
  60329. data: attributes.level,
  60330. defaultValue: 0,
  60331. validate: n => n >= 1 && n <= 3
  60332. });
  60333. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  60334. }
  60335. }
  60336. class Attributes extends _xfa_object.OptionObject {
  60337. constructor(attributes) {
  60338. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  60339. }
  60340. }
  60341. class AutoSave extends _xfa_object.OptionObject {
  60342. constructor(attributes) {
  60343. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  60344. }
  60345. }
  60346. class Base extends _xfa_object.StringObject {
  60347. constructor(attributes) {
  60348. super(CONFIG_NS_ID, "base");
  60349. }
  60350. }
  60351. class BatchOutput extends _xfa_object.XFAObject {
  60352. constructor(attributes) {
  60353. super(CONFIG_NS_ID, "batchOutput");
  60354. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  60355. }
  60356. }
  60357. class BehaviorOverride extends _xfa_object.ContentObject {
  60358. constructor(attributes) {
  60359. super(CONFIG_NS_ID, "behaviorOverride");
  60360. }
  60361. [_xfa_object.$finalize]() {
  60362. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  60363. }
  60364. }
  60365. class Cache extends _xfa_object.XFAObject {
  60366. constructor(attributes) {
  60367. super(CONFIG_NS_ID, "cache", true);
  60368. this.templateCache = null;
  60369. }
  60370. }
  60371. class Change extends _xfa_object.Option01 {
  60372. constructor(attributes) {
  60373. super(CONFIG_NS_ID, "change");
  60374. }
  60375. }
  60376. class Common extends _xfa_object.XFAObject {
  60377. constructor(attributes) {
  60378. super(CONFIG_NS_ID, "common", true);
  60379. this.data = null;
  60380. this.locale = null;
  60381. this.localeSet = null;
  60382. this.messaging = null;
  60383. this.suppressBanner = null;
  60384. this.template = null;
  60385. this.validationMessaging = null;
  60386. this.versionControl = null;
  60387. this.log = new _xfa_object.XFAObjectArray();
  60388. }
  60389. }
  60390. class Compress extends _xfa_object.XFAObject {
  60391. constructor(attributes) {
  60392. super(CONFIG_NS_ID, "compress");
  60393. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  60394. }
  60395. }
  60396. class CompressLogicalStructure extends _xfa_object.Option01 {
  60397. constructor(attributes) {
  60398. super(CONFIG_NS_ID, "compressLogicalStructure");
  60399. }
  60400. }
  60401. class CompressObjectStream extends _xfa_object.Option10 {
  60402. constructor(attributes) {
  60403. super(CONFIG_NS_ID, "compressObjectStream");
  60404. }
  60405. }
  60406. class Compression extends _xfa_object.XFAObject {
  60407. constructor(attributes) {
  60408. super(CONFIG_NS_ID, "compression", true);
  60409. this.compressLogicalStructure = null;
  60410. this.compressObjectStream = null;
  60411. this.level = null;
  60412. this.type = null;
  60413. }
  60414. }
  60415. class Config extends _xfa_object.XFAObject {
  60416. constructor(attributes) {
  60417. super(CONFIG_NS_ID, "config", true);
  60418. this.acrobat = null;
  60419. this.present = null;
  60420. this.trace = null;
  60421. this.agent = new _xfa_object.XFAObjectArray();
  60422. }
  60423. }
  60424. class Conformance extends _xfa_object.OptionObject {
  60425. constructor(attributes) {
  60426. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  60427. }
  60428. }
  60429. class ContentCopy extends _xfa_object.Option01 {
  60430. constructor(attributes) {
  60431. super(CONFIG_NS_ID, "contentCopy");
  60432. }
  60433. }
  60434. class Copies extends _xfa_object.IntegerObject {
  60435. constructor(attributes) {
  60436. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  60437. }
  60438. }
  60439. class Creator extends _xfa_object.StringObject {
  60440. constructor(attributes) {
  60441. super(CONFIG_NS_ID, "creator");
  60442. }
  60443. }
  60444. class CurrentPage extends _xfa_object.IntegerObject {
  60445. constructor(attributes) {
  60446. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  60447. }
  60448. }
  60449. class Data extends _xfa_object.XFAObject {
  60450. constructor(attributes) {
  60451. super(CONFIG_NS_ID, "data", true);
  60452. this.adjustData = null;
  60453. this.attributes = null;
  60454. this.incrementalLoad = null;
  60455. this.outputXSL = null;
  60456. this.range = null;
  60457. this.record = null;
  60458. this.startNode = null;
  60459. this.uri = null;
  60460. this.window = null;
  60461. this.xsl = null;
  60462. this.excludeNS = new _xfa_object.XFAObjectArray();
  60463. this.transform = new _xfa_object.XFAObjectArray();
  60464. }
  60465. }
  60466. class Debug extends _xfa_object.XFAObject {
  60467. constructor(attributes) {
  60468. super(CONFIG_NS_ID, "debug", true);
  60469. this.uri = null;
  60470. }
  60471. }
  60472. class DefaultTypeface extends _xfa_object.ContentObject {
  60473. constructor(attributes) {
  60474. super(CONFIG_NS_ID, "defaultTypeface");
  60475. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  60476. }
  60477. }
  60478. class Destination extends _xfa_object.OptionObject {
  60479. constructor(attributes) {
  60480. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  60481. }
  60482. }
  60483. class DocumentAssembly extends _xfa_object.Option01 {
  60484. constructor(attributes) {
  60485. super(CONFIG_NS_ID, "documentAssembly");
  60486. }
  60487. }
  60488. class Driver extends _xfa_object.XFAObject {
  60489. constructor(attributes) {
  60490. super(CONFIG_NS_ID, "driver", true);
  60491. this.name = attributes.name ? attributes.name.trim() : "";
  60492. this.fontInfo = null;
  60493. this.xdc = null;
  60494. }
  60495. }
  60496. class DuplexOption extends _xfa_object.OptionObject {
  60497. constructor(attributes) {
  60498. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  60499. }
  60500. }
  60501. class DynamicRender extends _xfa_object.OptionObject {
  60502. constructor(attributes) {
  60503. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  60504. }
  60505. }
  60506. class Embed extends _xfa_object.Option01 {
  60507. constructor(attributes) {
  60508. super(CONFIG_NS_ID, "embed");
  60509. }
  60510. }
  60511. class Encrypt extends _xfa_object.Option01 {
  60512. constructor(attributes) {
  60513. super(CONFIG_NS_ID, "encrypt");
  60514. }
  60515. }
  60516. class Encryption extends _xfa_object.XFAObject {
  60517. constructor(attributes) {
  60518. super(CONFIG_NS_ID, "encryption", true);
  60519. this.encrypt = null;
  60520. this.encryptionLevel = null;
  60521. this.permissions = null;
  60522. }
  60523. }
  60524. class EncryptionLevel extends _xfa_object.OptionObject {
  60525. constructor(attributes) {
  60526. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  60527. }
  60528. }
  60529. class Enforce extends _xfa_object.StringObject {
  60530. constructor(attributes) {
  60531. super(CONFIG_NS_ID, "enforce");
  60532. }
  60533. }
  60534. class Equate extends _xfa_object.XFAObject {
  60535. constructor(attributes) {
  60536. super(CONFIG_NS_ID, "equate");
  60537. this.force = (0, _utils.getInteger)({
  60538. data: attributes.force,
  60539. defaultValue: 1,
  60540. validate: n => n === 0
  60541. });
  60542. this.from = attributes.from || "";
  60543. this.to = attributes.to || "";
  60544. }
  60545. }
  60546. class EquateRange extends _xfa_object.XFAObject {
  60547. constructor(attributes) {
  60548. super(CONFIG_NS_ID, "equateRange");
  60549. this.from = attributes.from || "";
  60550. this.to = attributes.to || "";
  60551. this._unicodeRange = attributes.unicodeRange || "";
  60552. }
  60553. get unicodeRange() {
  60554. const ranges = [];
  60555. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60556. const unicodeRange = this._unicodeRange;
  60557. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60558. range = range.split("-", 2).map(x => {
  60559. const found = x.match(unicodeRegex);
  60560. if (!found) {
  60561. return 0;
  60562. }
  60563. return parseInt(found[1], 16);
  60564. });
  60565. if (range.length === 1) {
  60566. range.push(range[0]);
  60567. }
  60568. ranges.push(range);
  60569. }
  60570. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60571. }
  60572. }
  60573. class Exclude extends _xfa_object.ContentObject {
  60574. constructor(attributes) {
  60575. super(CONFIG_NS_ID, "exclude");
  60576. }
  60577. [_xfa_object.$finalize]() {
  60578. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60579. }
  60580. }
  60581. class ExcludeNS extends _xfa_object.StringObject {
  60582. constructor(attributes) {
  60583. super(CONFIG_NS_ID, "excludeNS");
  60584. }
  60585. }
  60586. class FlipLabel extends _xfa_object.OptionObject {
  60587. constructor(attributes) {
  60588. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60589. }
  60590. }
  60591. class FontInfo extends _xfa_object.XFAObject {
  60592. constructor(attributes) {
  60593. super(CONFIG_NS_ID, "fontInfo", true);
  60594. this.embed = null;
  60595. this.map = null;
  60596. this.subsetBelow = null;
  60597. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60598. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60599. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60600. }
  60601. }
  60602. class FormFieldFilling extends _xfa_object.Option01 {
  60603. constructor(attributes) {
  60604. super(CONFIG_NS_ID, "formFieldFilling");
  60605. }
  60606. }
  60607. class GroupParent extends _xfa_object.StringObject {
  60608. constructor(attributes) {
  60609. super(CONFIG_NS_ID, "groupParent");
  60610. }
  60611. }
  60612. class IfEmpty extends _xfa_object.OptionObject {
  60613. constructor(attributes) {
  60614. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60615. }
  60616. }
  60617. class IncludeXDPContent extends _xfa_object.StringObject {
  60618. constructor(attributes) {
  60619. super(CONFIG_NS_ID, "includeXDPContent");
  60620. }
  60621. }
  60622. class IncrementalLoad extends _xfa_object.OptionObject {
  60623. constructor(attributes) {
  60624. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60625. }
  60626. }
  60627. class IncrementalMerge extends _xfa_object.Option01 {
  60628. constructor(attributes) {
  60629. super(CONFIG_NS_ID, "incrementalMerge");
  60630. }
  60631. }
  60632. class Interactive extends _xfa_object.Option01 {
  60633. constructor(attributes) {
  60634. super(CONFIG_NS_ID, "interactive");
  60635. }
  60636. }
  60637. class Jog extends _xfa_object.OptionObject {
  60638. constructor(attributes) {
  60639. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60640. }
  60641. }
  60642. class LabelPrinter extends _xfa_object.XFAObject {
  60643. constructor(attributes) {
  60644. super(CONFIG_NS_ID, "labelPrinter", true);
  60645. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60646. this.batchOutput = null;
  60647. this.flipLabel = null;
  60648. this.fontInfo = null;
  60649. this.xdc = null;
  60650. }
  60651. }
  60652. class Layout extends _xfa_object.OptionObject {
  60653. constructor(attributes) {
  60654. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60655. }
  60656. }
  60657. class Level extends _xfa_object.IntegerObject {
  60658. constructor(attributes) {
  60659. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60660. }
  60661. }
  60662. class Linearized extends _xfa_object.Option01 {
  60663. constructor(attributes) {
  60664. super(CONFIG_NS_ID, "linearized");
  60665. }
  60666. }
  60667. class Locale extends _xfa_object.StringObject {
  60668. constructor(attributes) {
  60669. super(CONFIG_NS_ID, "locale");
  60670. }
  60671. }
  60672. class LocaleSet extends _xfa_object.StringObject {
  60673. constructor(attributes) {
  60674. super(CONFIG_NS_ID, "localeSet");
  60675. }
  60676. }
  60677. class Log extends _xfa_object.XFAObject {
  60678. constructor(attributes) {
  60679. super(CONFIG_NS_ID, "log", true);
  60680. this.mode = null;
  60681. this.threshold = null;
  60682. this.to = null;
  60683. this.uri = null;
  60684. }
  60685. }
  60686. class MapElement extends _xfa_object.XFAObject {
  60687. constructor(attributes) {
  60688. super(CONFIG_NS_ID, "map", true);
  60689. this.equate = new _xfa_object.XFAObjectArray();
  60690. this.equateRange = new _xfa_object.XFAObjectArray();
  60691. }
  60692. }
  60693. class MediumInfo extends _xfa_object.XFAObject {
  60694. constructor(attributes) {
  60695. super(CONFIG_NS_ID, "mediumInfo", true);
  60696. this.map = null;
  60697. }
  60698. }
  60699. class Message extends _xfa_object.XFAObject {
  60700. constructor(attributes) {
  60701. super(CONFIG_NS_ID, "message", true);
  60702. this.msgId = null;
  60703. this.severity = null;
  60704. }
  60705. }
  60706. class Messaging extends _xfa_object.XFAObject {
  60707. constructor(attributes) {
  60708. super(CONFIG_NS_ID, "messaging", true);
  60709. this.message = new _xfa_object.XFAObjectArray();
  60710. }
  60711. }
  60712. class Mode extends _xfa_object.OptionObject {
  60713. constructor(attributes) {
  60714. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60715. }
  60716. }
  60717. class ModifyAnnots extends _xfa_object.Option01 {
  60718. constructor(attributes) {
  60719. super(CONFIG_NS_ID, "modifyAnnots");
  60720. }
  60721. }
  60722. class MsgId extends _xfa_object.IntegerObject {
  60723. constructor(attributes) {
  60724. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60725. }
  60726. }
  60727. class NameAttr extends _xfa_object.StringObject {
  60728. constructor(attributes) {
  60729. super(CONFIG_NS_ID, "nameAttr");
  60730. }
  60731. }
  60732. class NeverEmbed extends _xfa_object.ContentObject {
  60733. constructor(attributes) {
  60734. super(CONFIG_NS_ID, "neverEmbed");
  60735. }
  60736. }
  60737. class NumberOfCopies extends _xfa_object.IntegerObject {
  60738. constructor(attributes) {
  60739. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60740. }
  60741. }
  60742. class OpenAction extends _xfa_object.XFAObject {
  60743. constructor(attributes) {
  60744. super(CONFIG_NS_ID, "openAction", true);
  60745. this.destination = null;
  60746. }
  60747. }
  60748. class Output extends _xfa_object.XFAObject {
  60749. constructor(attributes) {
  60750. super(CONFIG_NS_ID, "output", true);
  60751. this.to = null;
  60752. this.type = null;
  60753. this.uri = null;
  60754. }
  60755. }
  60756. class OutputBin extends _xfa_object.StringObject {
  60757. constructor(attributes) {
  60758. super(CONFIG_NS_ID, "outputBin");
  60759. }
  60760. }
  60761. class OutputXSL extends _xfa_object.XFAObject {
  60762. constructor(attributes) {
  60763. super(CONFIG_NS_ID, "outputXSL", true);
  60764. this.uri = null;
  60765. }
  60766. }
  60767. class Overprint extends _xfa_object.OptionObject {
  60768. constructor(attributes) {
  60769. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60770. }
  60771. }
  60772. class Packets extends _xfa_object.StringObject {
  60773. constructor(attributes) {
  60774. super(CONFIG_NS_ID, "packets");
  60775. }
  60776. [_xfa_object.$finalize]() {
  60777. if (this[_xfa_object.$content] === "*") {
  60778. return;
  60779. }
  60780. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60781. }
  60782. }
  60783. class PageOffset extends _xfa_object.XFAObject {
  60784. constructor(attributes) {
  60785. super(CONFIG_NS_ID, "pageOffset");
  60786. this.x = (0, _utils.getInteger)({
  60787. data: attributes.x,
  60788. defaultValue: "useXDCSetting",
  60789. validate: n => true
  60790. });
  60791. this.y = (0, _utils.getInteger)({
  60792. data: attributes.y,
  60793. defaultValue: "useXDCSetting",
  60794. validate: n => true
  60795. });
  60796. }
  60797. }
  60798. class PageRange extends _xfa_object.StringObject {
  60799. constructor(attributes) {
  60800. super(CONFIG_NS_ID, "pageRange");
  60801. }
  60802. [_xfa_object.$finalize]() {
  60803. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60804. const ranges = [];
  60805. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60806. ranges.push(numbers.slice(i, i + 2));
  60807. }
  60808. this[_xfa_object.$content] = ranges;
  60809. }
  60810. }
  60811. class Pagination extends _xfa_object.OptionObject {
  60812. constructor(attributes) {
  60813. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60814. }
  60815. }
  60816. class PaginationOverride extends _xfa_object.OptionObject {
  60817. constructor(attributes) {
  60818. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60819. }
  60820. }
  60821. class Part extends _xfa_object.IntegerObject {
  60822. constructor(attributes) {
  60823. super(CONFIG_NS_ID, "part", 1, n => false);
  60824. }
  60825. }
  60826. class Pcl extends _xfa_object.XFAObject {
  60827. constructor(attributes) {
  60828. super(CONFIG_NS_ID, "pcl", true);
  60829. this.name = attributes.name || "";
  60830. this.batchOutput = null;
  60831. this.fontInfo = null;
  60832. this.jog = null;
  60833. this.mediumInfo = null;
  60834. this.outputBin = null;
  60835. this.pageOffset = null;
  60836. this.staple = null;
  60837. this.xdc = null;
  60838. }
  60839. }
  60840. class Pdf extends _xfa_object.XFAObject {
  60841. constructor(attributes) {
  60842. super(CONFIG_NS_ID, "pdf", true);
  60843. this.name = attributes.name || "";
  60844. this.adobeExtensionLevel = null;
  60845. this.batchOutput = null;
  60846. this.compression = null;
  60847. this.creator = null;
  60848. this.encryption = null;
  60849. this.fontInfo = null;
  60850. this.interactive = null;
  60851. this.linearized = null;
  60852. this.openAction = null;
  60853. this.pdfa = null;
  60854. this.producer = null;
  60855. this.renderPolicy = null;
  60856. this.scriptModel = null;
  60857. this.silentPrint = null;
  60858. this.submitFormat = null;
  60859. this.tagged = null;
  60860. this.version = null;
  60861. this.viewerPreferences = null;
  60862. this.xdc = null;
  60863. }
  60864. }
  60865. class Pdfa extends _xfa_object.XFAObject {
  60866. constructor(attributes) {
  60867. super(CONFIG_NS_ID, "pdfa", true);
  60868. this.amd = null;
  60869. this.conformance = null;
  60870. this.includeXDPContent = null;
  60871. this.part = null;
  60872. }
  60873. }
  60874. class Permissions extends _xfa_object.XFAObject {
  60875. constructor(attributes) {
  60876. super(CONFIG_NS_ID, "permissions", true);
  60877. this.accessibleContent = null;
  60878. this.change = null;
  60879. this.contentCopy = null;
  60880. this.documentAssembly = null;
  60881. this.formFieldFilling = null;
  60882. this.modifyAnnots = null;
  60883. this.plaintextMetadata = null;
  60884. this.print = null;
  60885. this.printHighQuality = null;
  60886. }
  60887. }
  60888. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60889. constructor(attributes) {
  60890. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60891. }
  60892. }
  60893. class Picture extends _xfa_object.StringObject {
  60894. constructor(attributes) {
  60895. super(CONFIG_NS_ID, "picture");
  60896. }
  60897. }
  60898. class PlaintextMetadata extends _xfa_object.Option01 {
  60899. constructor(attributes) {
  60900. super(CONFIG_NS_ID, "plaintextMetadata");
  60901. }
  60902. }
  60903. class Presence extends _xfa_object.OptionObject {
  60904. constructor(attributes) {
  60905. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60906. }
  60907. }
  60908. class Present extends _xfa_object.XFAObject {
  60909. constructor(attributes) {
  60910. super(CONFIG_NS_ID, "present", true);
  60911. this.behaviorOverride = null;
  60912. this.cache = null;
  60913. this.common = null;
  60914. this.copies = null;
  60915. this.destination = null;
  60916. this.incrementalMerge = null;
  60917. this.layout = null;
  60918. this.output = null;
  60919. this.overprint = null;
  60920. this.pagination = null;
  60921. this.paginationOverride = null;
  60922. this.script = null;
  60923. this.validate = null;
  60924. this.xdp = null;
  60925. this.driver = new _xfa_object.XFAObjectArray();
  60926. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60927. this.pcl = new _xfa_object.XFAObjectArray();
  60928. this.pdf = new _xfa_object.XFAObjectArray();
  60929. this.ps = new _xfa_object.XFAObjectArray();
  60930. this.submitUrl = new _xfa_object.XFAObjectArray();
  60931. this.webClient = new _xfa_object.XFAObjectArray();
  60932. this.zpl = new _xfa_object.XFAObjectArray();
  60933. }
  60934. }
  60935. class Print extends _xfa_object.Option01 {
  60936. constructor(attributes) {
  60937. super(CONFIG_NS_ID, "print");
  60938. }
  60939. }
  60940. class PrintHighQuality extends _xfa_object.Option01 {
  60941. constructor(attributes) {
  60942. super(CONFIG_NS_ID, "printHighQuality");
  60943. }
  60944. }
  60945. class PrintScaling extends _xfa_object.OptionObject {
  60946. constructor(attributes) {
  60947. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60948. }
  60949. }
  60950. class PrinterName extends _xfa_object.StringObject {
  60951. constructor(attributes) {
  60952. super(CONFIG_NS_ID, "printerName");
  60953. }
  60954. }
  60955. class Producer extends _xfa_object.StringObject {
  60956. constructor(attributes) {
  60957. super(CONFIG_NS_ID, "producer");
  60958. }
  60959. }
  60960. class Ps extends _xfa_object.XFAObject {
  60961. constructor(attributes) {
  60962. super(CONFIG_NS_ID, "ps", true);
  60963. this.name = attributes.name || "";
  60964. this.batchOutput = null;
  60965. this.fontInfo = null;
  60966. this.jog = null;
  60967. this.mediumInfo = null;
  60968. this.outputBin = null;
  60969. this.staple = null;
  60970. this.xdc = null;
  60971. }
  60972. }
  60973. class Range extends _xfa_object.ContentObject {
  60974. constructor(attributes) {
  60975. super(CONFIG_NS_ID, "range");
  60976. }
  60977. [_xfa_object.$finalize]() {
  60978. 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 => {
  60979. if (range.length === 1) {
  60980. range.push(range[0]);
  60981. }
  60982. return range;
  60983. });
  60984. }
  60985. }
  60986. class Record extends _xfa_object.ContentObject {
  60987. constructor(attributes) {
  60988. super(CONFIG_NS_ID, "record");
  60989. }
  60990. [_xfa_object.$finalize]() {
  60991. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60992. const n = parseInt(this[_xfa_object.$content], 10);
  60993. if (!isNaN(n) && n >= 0) {
  60994. this[_xfa_object.$content] = n;
  60995. }
  60996. }
  60997. }
  60998. class Relevant extends _xfa_object.ContentObject {
  60999. constructor(attributes) {
  61000. super(CONFIG_NS_ID, "relevant");
  61001. }
  61002. [_xfa_object.$finalize]() {
  61003. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  61004. }
  61005. }
  61006. class Rename extends _xfa_object.ContentObject {
  61007. constructor(attributes) {
  61008. super(CONFIG_NS_ID, "rename");
  61009. }
  61010. [_xfa_object.$finalize]() {
  61011. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  61012. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  61013. (0, _util.warn)("XFA - Rename: invalid XFA name");
  61014. }
  61015. }
  61016. }
  61017. class RenderPolicy extends _xfa_object.OptionObject {
  61018. constructor(attributes) {
  61019. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  61020. }
  61021. }
  61022. class RunScripts extends _xfa_object.OptionObject {
  61023. constructor(attributes) {
  61024. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  61025. }
  61026. }
  61027. class Script extends _xfa_object.XFAObject {
  61028. constructor(attributes) {
  61029. super(CONFIG_NS_ID, "script", true);
  61030. this.currentPage = null;
  61031. this.exclude = null;
  61032. this.runScripts = null;
  61033. }
  61034. }
  61035. class ScriptModel extends _xfa_object.OptionObject {
  61036. constructor(attributes) {
  61037. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  61038. }
  61039. }
  61040. class Severity extends _xfa_object.OptionObject {
  61041. constructor(attributes) {
  61042. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  61043. }
  61044. }
  61045. class SilentPrint extends _xfa_object.XFAObject {
  61046. constructor(attributes) {
  61047. super(CONFIG_NS_ID, "silentPrint", true);
  61048. this.addSilentPrint = null;
  61049. this.printerName = null;
  61050. }
  61051. }
  61052. class Staple extends _xfa_object.XFAObject {
  61053. constructor(attributes) {
  61054. super(CONFIG_NS_ID, "staple");
  61055. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  61056. }
  61057. }
  61058. class StartNode extends _xfa_object.StringObject {
  61059. constructor(attributes) {
  61060. super(CONFIG_NS_ID, "startNode");
  61061. }
  61062. }
  61063. class StartPage extends _xfa_object.IntegerObject {
  61064. constructor(attributes) {
  61065. super(CONFIG_NS_ID, "startPage", 0, n => true);
  61066. }
  61067. }
  61068. class SubmitFormat extends _xfa_object.OptionObject {
  61069. constructor(attributes) {
  61070. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  61071. }
  61072. }
  61073. class SubmitUrl extends _xfa_object.StringObject {
  61074. constructor(attributes) {
  61075. super(CONFIG_NS_ID, "submitUrl");
  61076. }
  61077. }
  61078. class SubsetBelow extends _xfa_object.IntegerObject {
  61079. constructor(attributes) {
  61080. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  61081. }
  61082. }
  61083. class SuppressBanner extends _xfa_object.Option01 {
  61084. constructor(attributes) {
  61085. super(CONFIG_NS_ID, "suppressBanner");
  61086. }
  61087. }
  61088. class Tagged extends _xfa_object.Option01 {
  61089. constructor(attributes) {
  61090. super(CONFIG_NS_ID, "tagged");
  61091. }
  61092. }
  61093. class Template extends _xfa_object.XFAObject {
  61094. constructor(attributes) {
  61095. super(CONFIG_NS_ID, "template", true);
  61096. this.base = null;
  61097. this.relevant = null;
  61098. this.startPage = null;
  61099. this.uri = null;
  61100. this.xsl = null;
  61101. }
  61102. }
  61103. class Threshold extends _xfa_object.OptionObject {
  61104. constructor(attributes) {
  61105. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  61106. }
  61107. }
  61108. class To extends _xfa_object.OptionObject {
  61109. constructor(attributes) {
  61110. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  61111. }
  61112. }
  61113. class TemplateCache extends _xfa_object.XFAObject {
  61114. constructor(attributes) {
  61115. super(CONFIG_NS_ID, "templateCache");
  61116. this.maxEntries = (0, _utils.getInteger)({
  61117. data: attributes.maxEntries,
  61118. defaultValue: 5,
  61119. validate: n => n >= 0
  61120. });
  61121. }
  61122. }
  61123. class Trace extends _xfa_object.XFAObject {
  61124. constructor(attributes) {
  61125. super(CONFIG_NS_ID, "trace", true);
  61126. this.area = new _xfa_object.XFAObjectArray();
  61127. }
  61128. }
  61129. class Transform extends _xfa_object.XFAObject {
  61130. constructor(attributes) {
  61131. super(CONFIG_NS_ID, "transform", true);
  61132. this.groupParent = null;
  61133. this.ifEmpty = null;
  61134. this.nameAttr = null;
  61135. this.picture = null;
  61136. this.presence = null;
  61137. this.rename = null;
  61138. this.whitespace = null;
  61139. }
  61140. }
  61141. class Type extends _xfa_object.OptionObject {
  61142. constructor(attributes) {
  61143. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  61144. }
  61145. }
  61146. class Uri extends _xfa_object.StringObject {
  61147. constructor(attributes) {
  61148. super(CONFIG_NS_ID, "uri");
  61149. }
  61150. }
  61151. class Validate extends _xfa_object.OptionObject {
  61152. constructor(attributes) {
  61153. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  61154. }
  61155. }
  61156. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  61157. constructor(attributes) {
  61158. super(CONFIG_NS_ID, "validateApprovalSignatures");
  61159. }
  61160. [_xfa_object.$finalize]() {
  61161. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  61162. }
  61163. }
  61164. class ValidationMessaging extends _xfa_object.OptionObject {
  61165. constructor(attributes) {
  61166. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  61167. }
  61168. }
  61169. class Version extends _xfa_object.OptionObject {
  61170. constructor(attributes) {
  61171. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  61172. }
  61173. }
  61174. class VersionControl extends _xfa_object.XFAObject {
  61175. constructor(attributes) {
  61176. super(CONFIG_NS_ID, "VersionControl");
  61177. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  61178. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  61179. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  61180. }
  61181. }
  61182. class ViewerPreferences extends _xfa_object.XFAObject {
  61183. constructor(attributes) {
  61184. super(CONFIG_NS_ID, "viewerPreferences", true);
  61185. this.ADBE_JSConsole = null;
  61186. this.ADBE_JSDebugger = null;
  61187. this.addViewerPreferences = null;
  61188. this.duplexOption = null;
  61189. this.enforce = null;
  61190. this.numberOfCopies = null;
  61191. this.pageRange = null;
  61192. this.pickTrayByPDFSize = null;
  61193. this.printScaling = null;
  61194. }
  61195. }
  61196. class WebClient extends _xfa_object.XFAObject {
  61197. constructor(attributes) {
  61198. super(CONFIG_NS_ID, "webClient", true);
  61199. this.name = attributes.name ? attributes.name.trim() : "";
  61200. this.fontInfo = null;
  61201. this.xdc = null;
  61202. }
  61203. }
  61204. class Whitespace extends _xfa_object.OptionObject {
  61205. constructor(attributes) {
  61206. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  61207. }
  61208. }
  61209. class Window extends _xfa_object.ContentObject {
  61210. constructor(attributes) {
  61211. super(CONFIG_NS_ID, "window");
  61212. }
  61213. [_xfa_object.$finalize]() {
  61214. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  61215. if (pair.some(x => isNaN(x))) {
  61216. this[_xfa_object.$content] = [0, 0];
  61217. return;
  61218. }
  61219. if (pair.length === 1) {
  61220. pair.push(pair[0]);
  61221. }
  61222. this[_xfa_object.$content] = pair;
  61223. }
  61224. }
  61225. class Xdc extends _xfa_object.XFAObject {
  61226. constructor(attributes) {
  61227. super(CONFIG_NS_ID, "xdc", true);
  61228. this.uri = new _xfa_object.XFAObjectArray();
  61229. this.xsl = new _xfa_object.XFAObjectArray();
  61230. }
  61231. }
  61232. class Xdp extends _xfa_object.XFAObject {
  61233. constructor(attributes) {
  61234. super(CONFIG_NS_ID, "xdp", true);
  61235. this.packets = null;
  61236. }
  61237. }
  61238. class Xsl extends _xfa_object.XFAObject {
  61239. constructor(attributes) {
  61240. super(CONFIG_NS_ID, "xsl", true);
  61241. this.debug = null;
  61242. this.uri = null;
  61243. }
  61244. }
  61245. class Zpl extends _xfa_object.XFAObject {
  61246. constructor(attributes) {
  61247. super(CONFIG_NS_ID, "zpl", true);
  61248. this.name = attributes.name ? attributes.name.trim() : "";
  61249. this.batchOutput = null;
  61250. this.flipLabel = null;
  61251. this.fontInfo = null;
  61252. this.xdc = null;
  61253. }
  61254. }
  61255. class ConfigNamespace {
  61256. static [_namespaces.$buildXFAObject](name, attributes) {
  61257. if (ConfigNamespace.hasOwnProperty(name)) {
  61258. return ConfigNamespace[name](attributes);
  61259. }
  61260. return undefined;
  61261. }
  61262. static acrobat(attrs) {
  61263. return new Acrobat(attrs);
  61264. }
  61265. static acrobat7(attrs) {
  61266. return new Acrobat7(attrs);
  61267. }
  61268. static ADBE_JSConsole(attrs) {
  61269. return new ADBE_JSConsole(attrs);
  61270. }
  61271. static ADBE_JSDebugger(attrs) {
  61272. return new ADBE_JSDebugger(attrs);
  61273. }
  61274. static addSilentPrint(attrs) {
  61275. return new AddSilentPrint(attrs);
  61276. }
  61277. static addViewerPreferences(attrs) {
  61278. return new AddViewerPreferences(attrs);
  61279. }
  61280. static adjustData(attrs) {
  61281. return new AdjustData(attrs);
  61282. }
  61283. static adobeExtensionLevel(attrs) {
  61284. return new AdobeExtensionLevel(attrs);
  61285. }
  61286. static agent(attrs) {
  61287. return new Agent(attrs);
  61288. }
  61289. static alwaysEmbed(attrs) {
  61290. return new AlwaysEmbed(attrs);
  61291. }
  61292. static amd(attrs) {
  61293. return new Amd(attrs);
  61294. }
  61295. static area(attrs) {
  61296. return new Area(attrs);
  61297. }
  61298. static attributes(attrs) {
  61299. return new Attributes(attrs);
  61300. }
  61301. static autoSave(attrs) {
  61302. return new AutoSave(attrs);
  61303. }
  61304. static base(attrs) {
  61305. return new Base(attrs);
  61306. }
  61307. static batchOutput(attrs) {
  61308. return new BatchOutput(attrs);
  61309. }
  61310. static behaviorOverride(attrs) {
  61311. return new BehaviorOverride(attrs);
  61312. }
  61313. static cache(attrs) {
  61314. return new Cache(attrs);
  61315. }
  61316. static change(attrs) {
  61317. return new Change(attrs);
  61318. }
  61319. static common(attrs) {
  61320. return new Common(attrs);
  61321. }
  61322. static compress(attrs) {
  61323. return new Compress(attrs);
  61324. }
  61325. static compressLogicalStructure(attrs) {
  61326. return new CompressLogicalStructure(attrs);
  61327. }
  61328. static compressObjectStream(attrs) {
  61329. return new CompressObjectStream(attrs);
  61330. }
  61331. static compression(attrs) {
  61332. return new Compression(attrs);
  61333. }
  61334. static config(attrs) {
  61335. return new Config(attrs);
  61336. }
  61337. static conformance(attrs) {
  61338. return new Conformance(attrs);
  61339. }
  61340. static contentCopy(attrs) {
  61341. return new ContentCopy(attrs);
  61342. }
  61343. static copies(attrs) {
  61344. return new Copies(attrs);
  61345. }
  61346. static creator(attrs) {
  61347. return new Creator(attrs);
  61348. }
  61349. static currentPage(attrs) {
  61350. return new CurrentPage(attrs);
  61351. }
  61352. static data(attrs) {
  61353. return new Data(attrs);
  61354. }
  61355. static debug(attrs) {
  61356. return new Debug(attrs);
  61357. }
  61358. static defaultTypeface(attrs) {
  61359. return new DefaultTypeface(attrs);
  61360. }
  61361. static destination(attrs) {
  61362. return new Destination(attrs);
  61363. }
  61364. static documentAssembly(attrs) {
  61365. return new DocumentAssembly(attrs);
  61366. }
  61367. static driver(attrs) {
  61368. return new Driver(attrs);
  61369. }
  61370. static duplexOption(attrs) {
  61371. return new DuplexOption(attrs);
  61372. }
  61373. static dynamicRender(attrs) {
  61374. return new DynamicRender(attrs);
  61375. }
  61376. static embed(attrs) {
  61377. return new Embed(attrs);
  61378. }
  61379. static encrypt(attrs) {
  61380. return new Encrypt(attrs);
  61381. }
  61382. static encryption(attrs) {
  61383. return new Encryption(attrs);
  61384. }
  61385. static encryptionLevel(attrs) {
  61386. return new EncryptionLevel(attrs);
  61387. }
  61388. static enforce(attrs) {
  61389. return new Enforce(attrs);
  61390. }
  61391. static equate(attrs) {
  61392. return new Equate(attrs);
  61393. }
  61394. static equateRange(attrs) {
  61395. return new EquateRange(attrs);
  61396. }
  61397. static exclude(attrs) {
  61398. return new Exclude(attrs);
  61399. }
  61400. static excludeNS(attrs) {
  61401. return new ExcludeNS(attrs);
  61402. }
  61403. static flipLabel(attrs) {
  61404. return new FlipLabel(attrs);
  61405. }
  61406. static fontInfo(attrs) {
  61407. return new FontInfo(attrs);
  61408. }
  61409. static formFieldFilling(attrs) {
  61410. return new FormFieldFilling(attrs);
  61411. }
  61412. static groupParent(attrs) {
  61413. return new GroupParent(attrs);
  61414. }
  61415. static ifEmpty(attrs) {
  61416. return new IfEmpty(attrs);
  61417. }
  61418. static includeXDPContent(attrs) {
  61419. return new IncludeXDPContent(attrs);
  61420. }
  61421. static incrementalLoad(attrs) {
  61422. return new IncrementalLoad(attrs);
  61423. }
  61424. static incrementalMerge(attrs) {
  61425. return new IncrementalMerge(attrs);
  61426. }
  61427. static interactive(attrs) {
  61428. return new Interactive(attrs);
  61429. }
  61430. static jog(attrs) {
  61431. return new Jog(attrs);
  61432. }
  61433. static labelPrinter(attrs) {
  61434. return new LabelPrinter(attrs);
  61435. }
  61436. static layout(attrs) {
  61437. return new Layout(attrs);
  61438. }
  61439. static level(attrs) {
  61440. return new Level(attrs);
  61441. }
  61442. static linearized(attrs) {
  61443. return new Linearized(attrs);
  61444. }
  61445. static locale(attrs) {
  61446. return new Locale(attrs);
  61447. }
  61448. static localeSet(attrs) {
  61449. return new LocaleSet(attrs);
  61450. }
  61451. static log(attrs) {
  61452. return new Log(attrs);
  61453. }
  61454. static map(attrs) {
  61455. return new MapElement(attrs);
  61456. }
  61457. static mediumInfo(attrs) {
  61458. return new MediumInfo(attrs);
  61459. }
  61460. static message(attrs) {
  61461. return new Message(attrs);
  61462. }
  61463. static messaging(attrs) {
  61464. return new Messaging(attrs);
  61465. }
  61466. static mode(attrs) {
  61467. return new Mode(attrs);
  61468. }
  61469. static modifyAnnots(attrs) {
  61470. return new ModifyAnnots(attrs);
  61471. }
  61472. static msgId(attrs) {
  61473. return new MsgId(attrs);
  61474. }
  61475. static nameAttr(attrs) {
  61476. return new NameAttr(attrs);
  61477. }
  61478. static neverEmbed(attrs) {
  61479. return new NeverEmbed(attrs);
  61480. }
  61481. static numberOfCopies(attrs) {
  61482. return new NumberOfCopies(attrs);
  61483. }
  61484. static openAction(attrs) {
  61485. return new OpenAction(attrs);
  61486. }
  61487. static output(attrs) {
  61488. return new Output(attrs);
  61489. }
  61490. static outputBin(attrs) {
  61491. return new OutputBin(attrs);
  61492. }
  61493. static outputXSL(attrs) {
  61494. return new OutputXSL(attrs);
  61495. }
  61496. static overprint(attrs) {
  61497. return new Overprint(attrs);
  61498. }
  61499. static packets(attrs) {
  61500. return new Packets(attrs);
  61501. }
  61502. static pageOffset(attrs) {
  61503. return new PageOffset(attrs);
  61504. }
  61505. static pageRange(attrs) {
  61506. return new PageRange(attrs);
  61507. }
  61508. static pagination(attrs) {
  61509. return new Pagination(attrs);
  61510. }
  61511. static paginationOverride(attrs) {
  61512. return new PaginationOverride(attrs);
  61513. }
  61514. static part(attrs) {
  61515. return new Part(attrs);
  61516. }
  61517. static pcl(attrs) {
  61518. return new Pcl(attrs);
  61519. }
  61520. static pdf(attrs) {
  61521. return new Pdf(attrs);
  61522. }
  61523. static pdfa(attrs) {
  61524. return new Pdfa(attrs);
  61525. }
  61526. static permissions(attrs) {
  61527. return new Permissions(attrs);
  61528. }
  61529. static pickTrayByPDFSize(attrs) {
  61530. return new PickTrayByPDFSize(attrs);
  61531. }
  61532. static picture(attrs) {
  61533. return new Picture(attrs);
  61534. }
  61535. static plaintextMetadata(attrs) {
  61536. return new PlaintextMetadata(attrs);
  61537. }
  61538. static presence(attrs) {
  61539. return new Presence(attrs);
  61540. }
  61541. static present(attrs) {
  61542. return new Present(attrs);
  61543. }
  61544. static print(attrs) {
  61545. return new Print(attrs);
  61546. }
  61547. static printHighQuality(attrs) {
  61548. return new PrintHighQuality(attrs);
  61549. }
  61550. static printScaling(attrs) {
  61551. return new PrintScaling(attrs);
  61552. }
  61553. static printerName(attrs) {
  61554. return new PrinterName(attrs);
  61555. }
  61556. static producer(attrs) {
  61557. return new Producer(attrs);
  61558. }
  61559. static ps(attrs) {
  61560. return new Ps(attrs);
  61561. }
  61562. static range(attrs) {
  61563. return new Range(attrs);
  61564. }
  61565. static record(attrs) {
  61566. return new Record(attrs);
  61567. }
  61568. static relevant(attrs) {
  61569. return new Relevant(attrs);
  61570. }
  61571. static rename(attrs) {
  61572. return new Rename(attrs);
  61573. }
  61574. static renderPolicy(attrs) {
  61575. return new RenderPolicy(attrs);
  61576. }
  61577. static runScripts(attrs) {
  61578. return new RunScripts(attrs);
  61579. }
  61580. static script(attrs) {
  61581. return new Script(attrs);
  61582. }
  61583. static scriptModel(attrs) {
  61584. return new ScriptModel(attrs);
  61585. }
  61586. static severity(attrs) {
  61587. return new Severity(attrs);
  61588. }
  61589. static silentPrint(attrs) {
  61590. return new SilentPrint(attrs);
  61591. }
  61592. static staple(attrs) {
  61593. return new Staple(attrs);
  61594. }
  61595. static startNode(attrs) {
  61596. return new StartNode(attrs);
  61597. }
  61598. static startPage(attrs) {
  61599. return new StartPage(attrs);
  61600. }
  61601. static submitFormat(attrs) {
  61602. return new SubmitFormat(attrs);
  61603. }
  61604. static submitUrl(attrs) {
  61605. return new SubmitUrl(attrs);
  61606. }
  61607. static subsetBelow(attrs) {
  61608. return new SubsetBelow(attrs);
  61609. }
  61610. static suppressBanner(attrs) {
  61611. return new SuppressBanner(attrs);
  61612. }
  61613. static tagged(attrs) {
  61614. return new Tagged(attrs);
  61615. }
  61616. static template(attrs) {
  61617. return new Template(attrs);
  61618. }
  61619. static templateCache(attrs) {
  61620. return new TemplateCache(attrs);
  61621. }
  61622. static threshold(attrs) {
  61623. return new Threshold(attrs);
  61624. }
  61625. static to(attrs) {
  61626. return new To(attrs);
  61627. }
  61628. static trace(attrs) {
  61629. return new Trace(attrs);
  61630. }
  61631. static transform(attrs) {
  61632. return new Transform(attrs);
  61633. }
  61634. static type(attrs) {
  61635. return new Type(attrs);
  61636. }
  61637. static uri(attrs) {
  61638. return new Uri(attrs);
  61639. }
  61640. static validate(attrs) {
  61641. return new Validate(attrs);
  61642. }
  61643. static validateApprovalSignatures(attrs) {
  61644. return new ValidateApprovalSignatures(attrs);
  61645. }
  61646. static validationMessaging(attrs) {
  61647. return new ValidationMessaging(attrs);
  61648. }
  61649. static version(attrs) {
  61650. return new Version(attrs);
  61651. }
  61652. static versionControl(attrs) {
  61653. return new VersionControl(attrs);
  61654. }
  61655. static viewerPreferences(attrs) {
  61656. return new ViewerPreferences(attrs);
  61657. }
  61658. static webClient(attrs) {
  61659. return new WebClient(attrs);
  61660. }
  61661. static whitespace(attrs) {
  61662. return new Whitespace(attrs);
  61663. }
  61664. static window(attrs) {
  61665. return new Window(attrs);
  61666. }
  61667. static xdc(attrs) {
  61668. return new Xdc(attrs);
  61669. }
  61670. static xdp(attrs) {
  61671. return new Xdp(attrs);
  61672. }
  61673. static xsl(attrs) {
  61674. return new Xsl(attrs);
  61675. }
  61676. static zpl(attrs) {
  61677. return new Zpl(attrs);
  61678. }
  61679. }
  61680. exports.ConfigNamespace = ConfigNamespace;
  61681. /***/ }),
  61682. /* 90 */
  61683. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61684. Object.defineProperty(exports, "__esModule", ({
  61685. value: true
  61686. }));
  61687. exports.ConnectionSetNamespace = void 0;
  61688. var _namespaces = __w_pdfjs_require__(77);
  61689. var _xfa_object = __w_pdfjs_require__(75);
  61690. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61691. class ConnectionSet extends _xfa_object.XFAObject {
  61692. constructor(attributes) {
  61693. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61694. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61695. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61696. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61697. }
  61698. }
  61699. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61700. constructor(attributes) {
  61701. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61702. this.id = attributes.id || "";
  61703. this.name = attributes.name || "";
  61704. this.use = attributes.use || "";
  61705. this.usehref = attributes.usehref || "";
  61706. }
  61707. }
  61708. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61709. constructor(attributes) {
  61710. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61711. this.id = attributes.id || "";
  61712. this.name = attributes.name || "";
  61713. this.use = attributes.use || "";
  61714. this.usehref = attributes.usehref || "";
  61715. }
  61716. }
  61717. class Operation extends _xfa_object.StringObject {
  61718. constructor(attributes) {
  61719. super(CONNECTION_SET_NS_ID, "operation");
  61720. this.id = attributes.id || "";
  61721. this.input = attributes.input || "";
  61722. this.name = attributes.name || "";
  61723. this.output = attributes.output || "";
  61724. this.use = attributes.use || "";
  61725. this.usehref = attributes.usehref || "";
  61726. }
  61727. }
  61728. class RootElement extends _xfa_object.StringObject {
  61729. constructor(attributes) {
  61730. super(CONNECTION_SET_NS_ID, "rootElement");
  61731. this.id = attributes.id || "";
  61732. this.name = attributes.name || "";
  61733. this.use = attributes.use || "";
  61734. this.usehref = attributes.usehref || "";
  61735. }
  61736. }
  61737. class SoapAction extends _xfa_object.StringObject {
  61738. constructor(attributes) {
  61739. super(CONNECTION_SET_NS_ID, "soapAction");
  61740. this.id = attributes.id || "";
  61741. this.name = attributes.name || "";
  61742. this.use = attributes.use || "";
  61743. this.usehref = attributes.usehref || "";
  61744. }
  61745. }
  61746. class SoapAddress extends _xfa_object.StringObject {
  61747. constructor(attributes) {
  61748. super(CONNECTION_SET_NS_ID, "soapAddress");
  61749. this.id = attributes.id || "";
  61750. this.name = attributes.name || "";
  61751. this.use = attributes.use || "";
  61752. this.usehref = attributes.usehref || "";
  61753. }
  61754. }
  61755. class Uri extends _xfa_object.StringObject {
  61756. constructor(attributes) {
  61757. super(CONNECTION_SET_NS_ID, "uri");
  61758. this.id = attributes.id || "";
  61759. this.name = attributes.name || "";
  61760. this.use = attributes.use || "";
  61761. this.usehref = attributes.usehref || "";
  61762. }
  61763. }
  61764. class WsdlAddress extends _xfa_object.StringObject {
  61765. constructor(attributes) {
  61766. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61767. this.id = attributes.id || "";
  61768. this.name = attributes.name || "";
  61769. this.use = attributes.use || "";
  61770. this.usehref = attributes.usehref || "";
  61771. }
  61772. }
  61773. class WsdlConnection extends _xfa_object.XFAObject {
  61774. constructor(attributes) {
  61775. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61776. this.dataDescription = attributes.dataDescription || "";
  61777. this.name = attributes.name || "";
  61778. this.effectiveInputPolicy = null;
  61779. this.effectiveOutputPolicy = null;
  61780. this.operation = null;
  61781. this.soapAction = null;
  61782. this.soapAddress = null;
  61783. this.wsdlAddress = null;
  61784. }
  61785. }
  61786. class XmlConnection extends _xfa_object.XFAObject {
  61787. constructor(attributes) {
  61788. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61789. this.dataDescription = attributes.dataDescription || "";
  61790. this.name = attributes.name || "";
  61791. this.uri = null;
  61792. }
  61793. }
  61794. class XsdConnection extends _xfa_object.XFAObject {
  61795. constructor(attributes) {
  61796. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61797. this.dataDescription = attributes.dataDescription || "";
  61798. this.name = attributes.name || "";
  61799. this.rootElement = null;
  61800. this.uri = null;
  61801. }
  61802. }
  61803. class ConnectionSetNamespace {
  61804. static [_namespaces.$buildXFAObject](name, attributes) {
  61805. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61806. return ConnectionSetNamespace[name](attributes);
  61807. }
  61808. return undefined;
  61809. }
  61810. static connectionSet(attrs) {
  61811. return new ConnectionSet(attrs);
  61812. }
  61813. static effectiveInputPolicy(attrs) {
  61814. return new EffectiveInputPolicy(attrs);
  61815. }
  61816. static effectiveOutputPolicy(attrs) {
  61817. return new EffectiveOutputPolicy(attrs);
  61818. }
  61819. static operation(attrs) {
  61820. return new Operation(attrs);
  61821. }
  61822. static rootElement(attrs) {
  61823. return new RootElement(attrs);
  61824. }
  61825. static soapAction(attrs) {
  61826. return new SoapAction(attrs);
  61827. }
  61828. static soapAddress(attrs) {
  61829. return new SoapAddress(attrs);
  61830. }
  61831. static uri(attrs) {
  61832. return new Uri(attrs);
  61833. }
  61834. static wsdlAddress(attrs) {
  61835. return new WsdlAddress(attrs);
  61836. }
  61837. static wsdlConnection(attrs) {
  61838. return new WsdlConnection(attrs);
  61839. }
  61840. static xmlConnection(attrs) {
  61841. return new XmlConnection(attrs);
  61842. }
  61843. static xsdConnection(attrs) {
  61844. return new XsdConnection(attrs);
  61845. }
  61846. }
  61847. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61848. /***/ }),
  61849. /* 91 */
  61850. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61851. Object.defineProperty(exports, "__esModule", ({
  61852. value: true
  61853. }));
  61854. exports.DatasetsNamespace = void 0;
  61855. var _xfa_object = __w_pdfjs_require__(75);
  61856. var _namespaces = __w_pdfjs_require__(77);
  61857. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61858. class Data extends _xfa_object.XmlObject {
  61859. constructor(attributes) {
  61860. super(DATASETS_NS_ID, "data", attributes);
  61861. }
  61862. [_xfa_object.$isNsAgnostic]() {
  61863. return true;
  61864. }
  61865. }
  61866. class Datasets extends _xfa_object.XFAObject {
  61867. constructor(attributes) {
  61868. super(DATASETS_NS_ID, "datasets", true);
  61869. this.data = null;
  61870. this.Signature = null;
  61871. }
  61872. [_xfa_object.$onChild](child) {
  61873. const name = child[_xfa_object.$nodeName];
  61874. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61875. this[name] = child;
  61876. }
  61877. this[_xfa_object.$appendChild](child);
  61878. }
  61879. }
  61880. class DatasetsNamespace {
  61881. static [_namespaces.$buildXFAObject](name, attributes) {
  61882. if (DatasetsNamespace.hasOwnProperty(name)) {
  61883. return DatasetsNamespace[name](attributes);
  61884. }
  61885. return undefined;
  61886. }
  61887. static datasets(attributes) {
  61888. return new Datasets(attributes);
  61889. }
  61890. static data(attributes) {
  61891. return new Data(attributes);
  61892. }
  61893. }
  61894. exports.DatasetsNamespace = DatasetsNamespace;
  61895. /***/ }),
  61896. /* 92 */
  61897. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61898. Object.defineProperty(exports, "__esModule", ({
  61899. value: true
  61900. }));
  61901. exports.LocaleSetNamespace = void 0;
  61902. var _namespaces = __w_pdfjs_require__(77);
  61903. var _xfa_object = __w_pdfjs_require__(75);
  61904. var _utils = __w_pdfjs_require__(76);
  61905. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61906. class CalendarSymbols extends _xfa_object.XFAObject {
  61907. constructor(attributes) {
  61908. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61909. this.name = "gregorian";
  61910. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61911. this.eraNames = null;
  61912. this.meridiemNames = null;
  61913. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61914. }
  61915. }
  61916. class CurrencySymbol extends _xfa_object.StringObject {
  61917. constructor(attributes) {
  61918. super(LOCALE_SET_NS_ID, "currencySymbol");
  61919. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61920. }
  61921. }
  61922. class CurrencySymbols extends _xfa_object.XFAObject {
  61923. constructor(attributes) {
  61924. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61925. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61926. }
  61927. }
  61928. class DatePattern extends _xfa_object.StringObject {
  61929. constructor(attributes) {
  61930. super(LOCALE_SET_NS_ID, "datePattern");
  61931. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61932. }
  61933. }
  61934. class DatePatterns extends _xfa_object.XFAObject {
  61935. constructor(attributes) {
  61936. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61937. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61938. }
  61939. }
  61940. class DateTimeSymbols extends _xfa_object.ContentObject {
  61941. constructor(attributes) {
  61942. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61943. }
  61944. }
  61945. class Day extends _xfa_object.StringObject {
  61946. constructor(attributes) {
  61947. super(LOCALE_SET_NS_ID, "day");
  61948. }
  61949. }
  61950. class DayNames extends _xfa_object.XFAObject {
  61951. constructor(attributes) {
  61952. super(LOCALE_SET_NS_ID, "dayNames", true);
  61953. this.abbr = (0, _utils.getInteger)({
  61954. data: attributes.abbr,
  61955. defaultValue: 0,
  61956. validate: x => x === 1
  61957. });
  61958. this.day = new _xfa_object.XFAObjectArray(7);
  61959. }
  61960. }
  61961. class Era extends _xfa_object.StringObject {
  61962. constructor(attributes) {
  61963. super(LOCALE_SET_NS_ID, "era");
  61964. }
  61965. }
  61966. class EraNames extends _xfa_object.XFAObject {
  61967. constructor(attributes) {
  61968. super(LOCALE_SET_NS_ID, "eraNames", true);
  61969. this.era = new _xfa_object.XFAObjectArray(2);
  61970. }
  61971. }
  61972. class Locale extends _xfa_object.XFAObject {
  61973. constructor(attributes) {
  61974. super(LOCALE_SET_NS_ID, "locale", true);
  61975. this.desc = attributes.desc || "";
  61976. this.name = "isoname";
  61977. this.calendarSymbols = null;
  61978. this.currencySymbols = null;
  61979. this.datePatterns = null;
  61980. this.dateTimeSymbols = null;
  61981. this.numberPatterns = null;
  61982. this.numberSymbols = null;
  61983. this.timePatterns = null;
  61984. this.typeFaces = null;
  61985. }
  61986. }
  61987. class LocaleSet extends _xfa_object.XFAObject {
  61988. constructor(attributes) {
  61989. super(LOCALE_SET_NS_ID, "localeSet", true);
  61990. this.locale = new _xfa_object.XFAObjectArray();
  61991. }
  61992. }
  61993. class Meridiem extends _xfa_object.StringObject {
  61994. constructor(attributes) {
  61995. super(LOCALE_SET_NS_ID, "meridiem");
  61996. }
  61997. }
  61998. class MeridiemNames extends _xfa_object.XFAObject {
  61999. constructor(attributes) {
  62000. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  62001. this.meridiem = new _xfa_object.XFAObjectArray(2);
  62002. }
  62003. }
  62004. class Month extends _xfa_object.StringObject {
  62005. constructor(attributes) {
  62006. super(LOCALE_SET_NS_ID, "month");
  62007. }
  62008. }
  62009. class MonthNames extends _xfa_object.XFAObject {
  62010. constructor(attributes) {
  62011. super(LOCALE_SET_NS_ID, "monthNames", true);
  62012. this.abbr = (0, _utils.getInteger)({
  62013. data: attributes.abbr,
  62014. defaultValue: 0,
  62015. validate: x => x === 1
  62016. });
  62017. this.month = new _xfa_object.XFAObjectArray(12);
  62018. }
  62019. }
  62020. class NumberPattern extends _xfa_object.StringObject {
  62021. constructor(attributes) {
  62022. super(LOCALE_SET_NS_ID, "numberPattern");
  62023. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62024. }
  62025. }
  62026. class NumberPatterns extends _xfa_object.XFAObject {
  62027. constructor(attributes) {
  62028. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  62029. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  62030. }
  62031. }
  62032. class NumberSymbol extends _xfa_object.StringObject {
  62033. constructor(attributes) {
  62034. super(LOCALE_SET_NS_ID, "numberSymbol");
  62035. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  62036. }
  62037. }
  62038. class NumberSymbols extends _xfa_object.XFAObject {
  62039. constructor(attributes) {
  62040. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  62041. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  62042. }
  62043. }
  62044. class TimePattern extends _xfa_object.StringObject {
  62045. constructor(attributes) {
  62046. super(LOCALE_SET_NS_ID, "timePattern");
  62047. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62048. }
  62049. }
  62050. class TimePatterns extends _xfa_object.XFAObject {
  62051. constructor(attributes) {
  62052. super(LOCALE_SET_NS_ID, "timePatterns", true);
  62053. this.timePattern = new _xfa_object.XFAObjectArray(4);
  62054. }
  62055. }
  62056. class TypeFace extends _xfa_object.XFAObject {
  62057. constructor(attributes) {
  62058. super(LOCALE_SET_NS_ID, "typeFace", true);
  62059. this.name = attributes.name | "";
  62060. }
  62061. }
  62062. class TypeFaces extends _xfa_object.XFAObject {
  62063. constructor(attributes) {
  62064. super(LOCALE_SET_NS_ID, "typeFaces", true);
  62065. this.typeFace = new _xfa_object.XFAObjectArray();
  62066. }
  62067. }
  62068. class LocaleSetNamespace {
  62069. static [_namespaces.$buildXFAObject](name, attributes) {
  62070. if (LocaleSetNamespace.hasOwnProperty(name)) {
  62071. return LocaleSetNamespace[name](attributes);
  62072. }
  62073. return undefined;
  62074. }
  62075. static calendarSymbols(attrs) {
  62076. return new CalendarSymbols(attrs);
  62077. }
  62078. static currencySymbol(attrs) {
  62079. return new CurrencySymbol(attrs);
  62080. }
  62081. static currencySymbols(attrs) {
  62082. return new CurrencySymbols(attrs);
  62083. }
  62084. static datePattern(attrs) {
  62085. return new DatePattern(attrs);
  62086. }
  62087. static datePatterns(attrs) {
  62088. return new DatePatterns(attrs);
  62089. }
  62090. static dateTimeSymbols(attrs) {
  62091. return new DateTimeSymbols(attrs);
  62092. }
  62093. static day(attrs) {
  62094. return new Day(attrs);
  62095. }
  62096. static dayNames(attrs) {
  62097. return new DayNames(attrs);
  62098. }
  62099. static era(attrs) {
  62100. return new Era(attrs);
  62101. }
  62102. static eraNames(attrs) {
  62103. return new EraNames(attrs);
  62104. }
  62105. static locale(attrs) {
  62106. return new Locale(attrs);
  62107. }
  62108. static localeSet(attrs) {
  62109. return new LocaleSet(attrs);
  62110. }
  62111. static meridiem(attrs) {
  62112. return new Meridiem(attrs);
  62113. }
  62114. static meridiemNames(attrs) {
  62115. return new MeridiemNames(attrs);
  62116. }
  62117. static month(attrs) {
  62118. return new Month(attrs);
  62119. }
  62120. static monthNames(attrs) {
  62121. return new MonthNames(attrs);
  62122. }
  62123. static numberPattern(attrs) {
  62124. return new NumberPattern(attrs);
  62125. }
  62126. static numberPatterns(attrs) {
  62127. return new NumberPatterns(attrs);
  62128. }
  62129. static numberSymbol(attrs) {
  62130. return new NumberSymbol(attrs);
  62131. }
  62132. static numberSymbols(attrs) {
  62133. return new NumberSymbols(attrs);
  62134. }
  62135. static timePattern(attrs) {
  62136. return new TimePattern(attrs);
  62137. }
  62138. static timePatterns(attrs) {
  62139. return new TimePatterns(attrs);
  62140. }
  62141. static typeFace(attrs) {
  62142. return new TypeFace(attrs);
  62143. }
  62144. static typeFaces(attrs) {
  62145. return new TypeFaces(attrs);
  62146. }
  62147. }
  62148. exports.LocaleSetNamespace = LocaleSetNamespace;
  62149. /***/ }),
  62150. /* 93 */
  62151. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62152. Object.defineProperty(exports, "__esModule", ({
  62153. value: true
  62154. }));
  62155. exports.SignatureNamespace = void 0;
  62156. var _namespaces = __w_pdfjs_require__(77);
  62157. var _xfa_object = __w_pdfjs_require__(75);
  62158. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  62159. class Signature extends _xfa_object.XFAObject {
  62160. constructor(attributes) {
  62161. super(SIGNATURE_NS_ID, "signature", true);
  62162. }
  62163. }
  62164. class SignatureNamespace {
  62165. static [_namespaces.$buildXFAObject](name, attributes) {
  62166. if (SignatureNamespace.hasOwnProperty(name)) {
  62167. return SignatureNamespace[name](attributes);
  62168. }
  62169. return undefined;
  62170. }
  62171. static signature(attributes) {
  62172. return new Signature(attributes);
  62173. }
  62174. }
  62175. exports.SignatureNamespace = SignatureNamespace;
  62176. /***/ }),
  62177. /* 94 */
  62178. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62179. Object.defineProperty(exports, "__esModule", ({
  62180. value: true
  62181. }));
  62182. exports.StylesheetNamespace = void 0;
  62183. var _namespaces = __w_pdfjs_require__(77);
  62184. var _xfa_object = __w_pdfjs_require__(75);
  62185. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  62186. class Stylesheet extends _xfa_object.XFAObject {
  62187. constructor(attributes) {
  62188. super(STYLESHEET_NS_ID, "stylesheet", true);
  62189. }
  62190. }
  62191. class StylesheetNamespace {
  62192. static [_namespaces.$buildXFAObject](name, attributes) {
  62193. if (StylesheetNamespace.hasOwnProperty(name)) {
  62194. return StylesheetNamespace[name](attributes);
  62195. }
  62196. return undefined;
  62197. }
  62198. static stylesheet(attributes) {
  62199. return new Stylesheet(attributes);
  62200. }
  62201. }
  62202. exports.StylesheetNamespace = StylesheetNamespace;
  62203. /***/ }),
  62204. /* 95 */
  62205. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62206. Object.defineProperty(exports, "__esModule", ({
  62207. value: true
  62208. }));
  62209. exports.XdpNamespace = void 0;
  62210. var _namespaces = __w_pdfjs_require__(77);
  62211. var _xfa_object = __w_pdfjs_require__(75);
  62212. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  62213. class Xdp extends _xfa_object.XFAObject {
  62214. constructor(attributes) {
  62215. super(XDP_NS_ID, "xdp", true);
  62216. this.uuid = attributes.uuid || "";
  62217. this.timeStamp = attributes.timeStamp || "";
  62218. this.config = null;
  62219. this.connectionSet = null;
  62220. this.datasets = null;
  62221. this.localeSet = null;
  62222. this.stylesheet = new _xfa_object.XFAObjectArray();
  62223. this.template = null;
  62224. }
  62225. [_xfa_object.$onChildCheck](child) {
  62226. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  62227. return ns && child[_xfa_object.$namespaceId] === ns.id;
  62228. }
  62229. }
  62230. class XdpNamespace {
  62231. static [_namespaces.$buildXFAObject](name, attributes) {
  62232. if (XdpNamespace.hasOwnProperty(name)) {
  62233. return XdpNamespace[name](attributes);
  62234. }
  62235. return undefined;
  62236. }
  62237. static xdp(attributes) {
  62238. return new Xdp(attributes);
  62239. }
  62240. }
  62241. exports.XdpNamespace = XdpNamespace;
  62242. /***/ }),
  62243. /* 96 */
  62244. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62245. Object.defineProperty(exports, "__esModule", ({
  62246. value: true
  62247. }));
  62248. exports.XhtmlNamespace = void 0;
  62249. var _xfa_object = __w_pdfjs_require__(75);
  62250. var _namespaces = __w_pdfjs_require__(77);
  62251. var _html_utils = __w_pdfjs_require__(82);
  62252. var _utils = __w_pdfjs_require__(76);
  62253. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  62254. const $richText = Symbol();
  62255. 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"]);
  62256. 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) => {
  62257. value = original.fontSize = (0, _utils.getMeasurement)(value);
  62258. return (0, _html_utils.measureToString)(0.99 * value);
  62259. }], ["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))]]);
  62260. const spacesRegExp = /\s+/g;
  62261. const crlfRegExp = /[\r\n]+/g;
  62262. const crlfForRichTextRegExp = /\r\n?/g;
  62263. function mapStyle(styleStr, node, richText) {
  62264. const style = Object.create(null);
  62265. if (!styleStr) {
  62266. return style;
  62267. }
  62268. const original = Object.create(null);
  62269. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  62270. const mapping = StyleMapping.get(key);
  62271. if (mapping === "") {
  62272. continue;
  62273. }
  62274. let newValue = value;
  62275. if (mapping) {
  62276. if (typeof mapping === "string") {
  62277. newValue = mapping;
  62278. } else {
  62279. newValue = mapping(value, original);
  62280. }
  62281. }
  62282. if (key.endsWith("scale")) {
  62283. if (style.transform) {
  62284. style.transform = `${style[key]} ${newValue}`;
  62285. } else {
  62286. style.transform = newValue;
  62287. }
  62288. } else {
  62289. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  62290. }
  62291. }
  62292. if (style.fontFamily) {
  62293. (0, _html_utils.setFontFamily)({
  62294. typeface: style.fontFamily,
  62295. weight: style.fontWeight || "normal",
  62296. posture: style.fontStyle || "normal",
  62297. size: original.fontSize || 0
  62298. }, node, node[_xfa_object.$globalData].fontFinder, style);
  62299. }
  62300. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  62301. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  62302. const VERTICAL_FACTOR = 0.333;
  62303. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  62304. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  62305. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  62306. }
  62307. if (richText && style.fontSize) {
  62308. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  62309. }
  62310. (0, _html_utils.fixTextIndent)(style);
  62311. return style;
  62312. }
  62313. function checkStyle(node) {
  62314. if (!node.style) {
  62315. return "";
  62316. }
  62317. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  62318. if (key === "font-family") {
  62319. node[_xfa_object.$globalData].usedTypefaces.add(value);
  62320. }
  62321. return VALID_STYLES.has(key);
  62322. }).map(kv => kv.join(":")).join(";");
  62323. }
  62324. const NoWhites = new Set(["body", "html"]);
  62325. class XhtmlObject extends _xfa_object.XmlObject {
  62326. constructor(attributes, name) {
  62327. super(XHTML_NS_ID, name);
  62328. this[$richText] = false;
  62329. this.style = attributes.style || "";
  62330. }
  62331. [_xfa_object.$clean](builder) {
  62332. super[_xfa_object.$clean](builder);
  62333. this.style = checkStyle(this);
  62334. }
  62335. [_xfa_object.$acceptWhitespace]() {
  62336. return !NoWhites.has(this[_xfa_object.$nodeName]);
  62337. }
  62338. [_xfa_object.$onText](str, richText = false) {
  62339. if (!richText) {
  62340. str = str.replace(crlfRegExp, "");
  62341. if (!this.style.includes("xfa-spacerun:yes")) {
  62342. str = str.replace(spacesRegExp, " ");
  62343. }
  62344. } else {
  62345. this[$richText] = true;
  62346. }
  62347. if (str) {
  62348. this[_xfa_object.$content] += str;
  62349. }
  62350. }
  62351. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  62352. const xfaFont = Object.create(null);
  62353. const margin = {
  62354. top: NaN,
  62355. bottom: NaN,
  62356. left: NaN,
  62357. right: NaN
  62358. };
  62359. let lineHeight = null;
  62360. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  62361. switch (key) {
  62362. case "font-family":
  62363. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  62364. break;
  62365. case "font-size":
  62366. xfaFont.size = (0, _utils.getMeasurement)(value);
  62367. break;
  62368. case "font-weight":
  62369. xfaFont.weight = value;
  62370. break;
  62371. case "font-style":
  62372. xfaFont.posture = value;
  62373. break;
  62374. case "letter-spacing":
  62375. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  62376. break;
  62377. case "margin":
  62378. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  62379. switch (values.length) {
  62380. case 1:
  62381. margin.top = margin.bottom = margin.left = margin.right = values[0];
  62382. break;
  62383. case 2:
  62384. margin.top = margin.bottom = values[0];
  62385. margin.left = margin.right = values[1];
  62386. break;
  62387. case 3:
  62388. margin.top = values[0];
  62389. margin.bottom = values[2];
  62390. margin.left = margin.right = values[1];
  62391. break;
  62392. case 4:
  62393. margin.top = values[0];
  62394. margin.left = values[1];
  62395. margin.bottom = values[2];
  62396. margin.right = values[3];
  62397. break;
  62398. }
  62399. break;
  62400. case "margin-top":
  62401. margin.top = (0, _utils.getMeasurement)(value);
  62402. break;
  62403. case "margin-bottom":
  62404. margin.bottom = (0, _utils.getMeasurement)(value);
  62405. break;
  62406. case "margin-left":
  62407. margin.left = (0, _utils.getMeasurement)(value);
  62408. break;
  62409. case "margin-right":
  62410. margin.right = (0, _utils.getMeasurement)(value);
  62411. break;
  62412. case "line-height":
  62413. lineHeight = (0, _utils.getMeasurement)(value);
  62414. break;
  62415. }
  62416. }
  62417. measure.pushData(xfaFont, margin, lineHeight);
  62418. if (this[_xfa_object.$content]) {
  62419. measure.addString(this[_xfa_object.$content]);
  62420. } else {
  62421. for (const child of this[_xfa_object.$getChildren]()) {
  62422. if (child[_xfa_object.$nodeName] === "#text") {
  62423. measure.addString(child[_xfa_object.$content]);
  62424. continue;
  62425. }
  62426. child[_xfa_object.$pushGlyphs](measure);
  62427. }
  62428. }
  62429. if (mustPop) {
  62430. measure.popFont();
  62431. }
  62432. }
  62433. [_xfa_object.$toHTML](availableSpace) {
  62434. const children = [];
  62435. this[_xfa_object.$extra] = {
  62436. children
  62437. };
  62438. this[_xfa_object.$childrenToHTML]({});
  62439. if (children.length === 0 && !this[_xfa_object.$content]) {
  62440. return _utils.HTMLResult.EMPTY;
  62441. }
  62442. let value;
  62443. if (this[$richText]) {
  62444. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  62445. } else {
  62446. value = this[_xfa_object.$content] || undefined;
  62447. }
  62448. return _utils.HTMLResult.success({
  62449. name: this[_xfa_object.$nodeName],
  62450. attributes: {
  62451. href: this.href,
  62452. style: mapStyle(this.style, this, this[$richText])
  62453. },
  62454. children,
  62455. value
  62456. });
  62457. }
  62458. }
  62459. class A extends XhtmlObject {
  62460. constructor(attributes) {
  62461. super(attributes, "a");
  62462. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  62463. }
  62464. }
  62465. class B extends XhtmlObject {
  62466. constructor(attributes) {
  62467. super(attributes, "b");
  62468. }
  62469. [_xfa_object.$pushGlyphs](measure) {
  62470. measure.pushFont({
  62471. weight: "bold"
  62472. });
  62473. super[_xfa_object.$pushGlyphs](measure);
  62474. measure.popFont();
  62475. }
  62476. }
  62477. class Body extends XhtmlObject {
  62478. constructor(attributes) {
  62479. super(attributes, "body");
  62480. }
  62481. [_xfa_object.$toHTML](availableSpace) {
  62482. const res = super[_xfa_object.$toHTML](availableSpace);
  62483. const {
  62484. html
  62485. } = res;
  62486. if (!html) {
  62487. return _utils.HTMLResult.EMPTY;
  62488. }
  62489. html.name = "div";
  62490. html.attributes.class = ["xfaRich"];
  62491. return res;
  62492. }
  62493. }
  62494. class Br extends XhtmlObject {
  62495. constructor(attributes) {
  62496. super(attributes, "br");
  62497. }
  62498. [_xfa_object.$text]() {
  62499. return "\n";
  62500. }
  62501. [_xfa_object.$pushGlyphs](measure) {
  62502. measure.addString("\n");
  62503. }
  62504. [_xfa_object.$toHTML](availableSpace) {
  62505. return _utils.HTMLResult.success({
  62506. name: "br"
  62507. });
  62508. }
  62509. }
  62510. class Html extends XhtmlObject {
  62511. constructor(attributes) {
  62512. super(attributes, "html");
  62513. }
  62514. [_xfa_object.$toHTML](availableSpace) {
  62515. const children = [];
  62516. this[_xfa_object.$extra] = {
  62517. children
  62518. };
  62519. this[_xfa_object.$childrenToHTML]({});
  62520. if (children.length === 0) {
  62521. return _utils.HTMLResult.success({
  62522. name: "div",
  62523. attributes: {
  62524. class: ["xfaRich"],
  62525. style: {}
  62526. },
  62527. value: this[_xfa_object.$content] || ""
  62528. });
  62529. }
  62530. if (children.length === 1) {
  62531. const child = children[0];
  62532. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62533. return _utils.HTMLResult.success(child);
  62534. }
  62535. }
  62536. return _utils.HTMLResult.success({
  62537. name: "div",
  62538. attributes: {
  62539. class: ["xfaRich"],
  62540. style: {}
  62541. },
  62542. children
  62543. });
  62544. }
  62545. }
  62546. class I extends XhtmlObject {
  62547. constructor(attributes) {
  62548. super(attributes, "i");
  62549. }
  62550. [_xfa_object.$pushGlyphs](measure) {
  62551. measure.pushFont({
  62552. posture: "italic"
  62553. });
  62554. super[_xfa_object.$pushGlyphs](measure);
  62555. measure.popFont();
  62556. }
  62557. }
  62558. class Li extends XhtmlObject {
  62559. constructor(attributes) {
  62560. super(attributes, "li");
  62561. }
  62562. }
  62563. class Ol extends XhtmlObject {
  62564. constructor(attributes) {
  62565. super(attributes, "ol");
  62566. }
  62567. }
  62568. class P extends XhtmlObject {
  62569. constructor(attributes) {
  62570. super(attributes, "p");
  62571. }
  62572. [_xfa_object.$pushGlyphs](measure) {
  62573. super[_xfa_object.$pushGlyphs](measure, false);
  62574. measure.addString("\n");
  62575. measure.addPara();
  62576. measure.popFont();
  62577. }
  62578. [_xfa_object.$text]() {
  62579. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62580. if (siblings.at(-1) === this) {
  62581. return super[_xfa_object.$text]();
  62582. }
  62583. return super[_xfa_object.$text]() + "\n";
  62584. }
  62585. }
  62586. class Span extends XhtmlObject {
  62587. constructor(attributes) {
  62588. super(attributes, "span");
  62589. }
  62590. }
  62591. class Sub extends XhtmlObject {
  62592. constructor(attributes) {
  62593. super(attributes, "sub");
  62594. }
  62595. }
  62596. class Sup extends XhtmlObject {
  62597. constructor(attributes) {
  62598. super(attributes, "sup");
  62599. }
  62600. }
  62601. class Ul extends XhtmlObject {
  62602. constructor(attributes) {
  62603. super(attributes, "ul");
  62604. }
  62605. }
  62606. class XhtmlNamespace {
  62607. static [_namespaces.$buildXFAObject](name, attributes) {
  62608. if (XhtmlNamespace.hasOwnProperty(name)) {
  62609. return XhtmlNamespace[name](attributes);
  62610. }
  62611. return undefined;
  62612. }
  62613. static a(attributes) {
  62614. return new A(attributes);
  62615. }
  62616. static b(attributes) {
  62617. return new B(attributes);
  62618. }
  62619. static body(attributes) {
  62620. return new Body(attributes);
  62621. }
  62622. static br(attributes) {
  62623. return new Br(attributes);
  62624. }
  62625. static html(attributes) {
  62626. return new Html(attributes);
  62627. }
  62628. static i(attributes) {
  62629. return new I(attributes);
  62630. }
  62631. static li(attributes) {
  62632. return new Li(attributes);
  62633. }
  62634. static ol(attributes) {
  62635. return new Ol(attributes);
  62636. }
  62637. static p(attributes) {
  62638. return new P(attributes);
  62639. }
  62640. static span(attributes) {
  62641. return new Span(attributes);
  62642. }
  62643. static sub(attributes) {
  62644. return new Sub(attributes);
  62645. }
  62646. static sup(attributes) {
  62647. return new Sup(attributes);
  62648. }
  62649. static ul(attributes) {
  62650. return new Ul(attributes);
  62651. }
  62652. }
  62653. exports.XhtmlNamespace = XhtmlNamespace;
  62654. /***/ }),
  62655. /* 97 */
  62656. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62657. Object.defineProperty(exports, "__esModule", ({
  62658. value: true
  62659. }));
  62660. exports.UnknownNamespace = void 0;
  62661. var _namespaces = __w_pdfjs_require__(77);
  62662. var _xfa_object = __w_pdfjs_require__(75);
  62663. class UnknownNamespace {
  62664. constructor(nsId) {
  62665. this.namespaceId = nsId;
  62666. }
  62667. [_namespaces.$buildXFAObject](name, attributes) {
  62668. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62669. }
  62670. }
  62671. exports.UnknownNamespace = UnknownNamespace;
  62672. /***/ }),
  62673. /* 98 */
  62674. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62675. Object.defineProperty(exports, "__esModule", ({
  62676. value: true
  62677. }));
  62678. exports.DatasetReader = void 0;
  62679. var _util = __w_pdfjs_require__(2);
  62680. var _core_utils = __w_pdfjs_require__(4);
  62681. var _xml_parser = __w_pdfjs_require__(64);
  62682. function decodeString(str) {
  62683. try {
  62684. return (0, _util.stringToUTF8String)(str);
  62685. } catch (ex) {
  62686. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62687. return str;
  62688. }
  62689. }
  62690. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62691. constructor(options) {
  62692. super(options);
  62693. this.node = null;
  62694. }
  62695. onEndElement(name) {
  62696. const node = super.onEndElement(name);
  62697. if (node && name === "xfa:datasets") {
  62698. this.node = node;
  62699. throw new Error("Aborting DatasetXMLParser.");
  62700. }
  62701. }
  62702. }
  62703. class DatasetReader {
  62704. constructor(data) {
  62705. if (data.datasets) {
  62706. this.node = new _xml_parser.SimpleXMLParser({
  62707. hasAttributes: true
  62708. }).parseFromString(data.datasets).documentElement;
  62709. } else {
  62710. const parser = new DatasetXMLParser({
  62711. hasAttributes: true
  62712. });
  62713. try {
  62714. parser.parseFromString(data["xdp:xdp"]);
  62715. } catch (_) {}
  62716. this.node = parser.node;
  62717. }
  62718. }
  62719. getValue(path) {
  62720. if (!this.node || !path) {
  62721. return "";
  62722. }
  62723. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62724. if (!node) {
  62725. return "";
  62726. }
  62727. const first = node.firstChild;
  62728. if (first && first.nodeName === "value") {
  62729. return node.children.map(child => decodeString(child.textContent));
  62730. }
  62731. return decodeString(node.textContent);
  62732. }
  62733. }
  62734. exports.DatasetReader = DatasetReader;
  62735. /***/ }),
  62736. /* 99 */
  62737. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62738. Object.defineProperty(exports, "__esModule", ({
  62739. value: true
  62740. }));
  62741. exports.XRef = void 0;
  62742. var _util = __w_pdfjs_require__(2);
  62743. var _primitives = __w_pdfjs_require__(3);
  62744. var _core_utils = __w_pdfjs_require__(4);
  62745. var _parser = __w_pdfjs_require__(15);
  62746. var _base_stream = __w_pdfjs_require__(5);
  62747. var _crypto = __w_pdfjs_require__(65);
  62748. class XRef {
  62749. constructor(stream, pdfManager) {
  62750. this.stream = stream;
  62751. this.pdfManager = pdfManager;
  62752. this.entries = [];
  62753. this.xrefstms = Object.create(null);
  62754. this._cacheMap = new Map();
  62755. this._pendingRefs = new _primitives.RefSet();
  62756. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  62757. this._newPersistentRefNum = null;
  62758. this._newTemporaryRefNum = null;
  62759. }
  62760. getNewPersistentRef(obj) {
  62761. if (this._newPersistentRefNum === null) {
  62762. this._newPersistentRefNum = this.entries.length || 1;
  62763. }
  62764. const num = this._newPersistentRefNum++;
  62765. this._cacheMap.set(num, obj);
  62766. return _primitives.Ref.get(num, 0);
  62767. }
  62768. getNewTemporaryRef() {
  62769. if (this._newTemporaryRefNum === null) {
  62770. this._newTemporaryRefNum = this.entries.length || 1;
  62771. }
  62772. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  62773. }
  62774. resetNewTemporaryRef() {
  62775. this._newTemporaryRefNum = null;
  62776. }
  62777. setStartXRef(startXRef) {
  62778. this.startXRefQueue = [startXRef];
  62779. }
  62780. parse(recoveryMode = false) {
  62781. let trailerDict;
  62782. if (!recoveryMode) {
  62783. trailerDict = this.readXRef();
  62784. } else {
  62785. (0, _util.warn)("Indexing all PDF objects");
  62786. trailerDict = this.indexObjects();
  62787. }
  62788. trailerDict.assignXref(this);
  62789. this.trailer = trailerDict;
  62790. let encrypt;
  62791. try {
  62792. encrypt = trailerDict.get("Encrypt");
  62793. } catch (ex) {
  62794. if (ex instanceof _core_utils.MissingDataException) {
  62795. throw ex;
  62796. }
  62797. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62798. }
  62799. if (encrypt instanceof _primitives.Dict) {
  62800. const ids = trailerDict.get("ID");
  62801. const fileId = ids && ids.length ? ids[0] : "";
  62802. encrypt.suppressEncryption = true;
  62803. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62804. }
  62805. let root;
  62806. try {
  62807. root = trailerDict.get("Root");
  62808. } catch (ex) {
  62809. if (ex instanceof _core_utils.MissingDataException) {
  62810. throw ex;
  62811. }
  62812. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62813. }
  62814. if (root instanceof _primitives.Dict) {
  62815. try {
  62816. const pages = root.get("Pages");
  62817. if (pages instanceof _primitives.Dict) {
  62818. this.root = root;
  62819. return;
  62820. }
  62821. } catch (ex) {
  62822. if (ex instanceof _core_utils.MissingDataException) {
  62823. throw ex;
  62824. }
  62825. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62826. }
  62827. }
  62828. if (!recoveryMode) {
  62829. throw new _core_utils.XRefParseException();
  62830. }
  62831. throw new _util.InvalidPDFException("Invalid Root reference.");
  62832. }
  62833. processXRefTable(parser) {
  62834. if (!("tableState" in this)) {
  62835. this.tableState = {
  62836. entryNum: 0,
  62837. streamPos: parser.lexer.stream.pos,
  62838. parserBuf1: parser.buf1,
  62839. parserBuf2: parser.buf2
  62840. };
  62841. }
  62842. const obj = this.readXRefTable(parser);
  62843. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62844. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62845. }
  62846. let dict = parser.getObj();
  62847. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62848. dict = dict.dict;
  62849. }
  62850. if (!(dict instanceof _primitives.Dict)) {
  62851. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62852. }
  62853. delete this.tableState;
  62854. return dict;
  62855. }
  62856. readXRefTable(parser) {
  62857. const stream = parser.lexer.stream;
  62858. const tableState = this.tableState;
  62859. stream.pos = tableState.streamPos;
  62860. parser.buf1 = tableState.parserBuf1;
  62861. parser.buf2 = tableState.parserBuf2;
  62862. let obj;
  62863. while (true) {
  62864. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62865. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62866. break;
  62867. }
  62868. tableState.firstEntryNum = obj;
  62869. tableState.entryCount = parser.getObj();
  62870. }
  62871. let first = tableState.firstEntryNum;
  62872. const count = tableState.entryCount;
  62873. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62874. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62875. }
  62876. for (let i = tableState.entryNum; i < count; i++) {
  62877. tableState.streamPos = stream.pos;
  62878. tableState.entryNum = i;
  62879. tableState.parserBuf1 = parser.buf1;
  62880. tableState.parserBuf2 = parser.buf2;
  62881. const entry = {};
  62882. entry.offset = parser.getObj();
  62883. entry.gen = parser.getObj();
  62884. const type = parser.getObj();
  62885. if (type instanceof _primitives.Cmd) {
  62886. switch (type.cmd) {
  62887. case "f":
  62888. entry.free = true;
  62889. break;
  62890. case "n":
  62891. entry.uncompressed = true;
  62892. break;
  62893. }
  62894. }
  62895. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62896. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62897. }
  62898. if (i === 0 && entry.free && first === 1) {
  62899. first = 0;
  62900. }
  62901. if (!this.entries[i + first]) {
  62902. this.entries[i + first] = entry;
  62903. }
  62904. }
  62905. tableState.entryNum = 0;
  62906. tableState.streamPos = stream.pos;
  62907. tableState.parserBuf1 = parser.buf1;
  62908. tableState.parserBuf2 = parser.buf2;
  62909. delete tableState.firstEntryNum;
  62910. delete tableState.entryCount;
  62911. }
  62912. if (this.entries[0] && !this.entries[0].free) {
  62913. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62914. }
  62915. return obj;
  62916. }
  62917. processXRefStream(stream) {
  62918. if (!("streamState" in this)) {
  62919. const streamParameters = stream.dict;
  62920. const byteWidths = streamParameters.get("W");
  62921. let range = streamParameters.get("Index");
  62922. if (!range) {
  62923. range = [0, streamParameters.get("Size")];
  62924. }
  62925. this.streamState = {
  62926. entryRanges: range,
  62927. byteWidths,
  62928. entryNum: 0,
  62929. streamPos: stream.pos
  62930. };
  62931. }
  62932. this.readXRefStream(stream);
  62933. delete this.streamState;
  62934. return stream.dict;
  62935. }
  62936. readXRefStream(stream) {
  62937. const streamState = this.streamState;
  62938. stream.pos = streamState.streamPos;
  62939. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62940. const entryRanges = streamState.entryRanges;
  62941. while (entryRanges.length > 0) {
  62942. const [first, n] = entryRanges;
  62943. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62944. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62945. }
  62946. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62947. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62948. }
  62949. for (let i = streamState.entryNum; i < n; ++i) {
  62950. streamState.entryNum = i;
  62951. streamState.streamPos = stream.pos;
  62952. let type = 0,
  62953. offset = 0,
  62954. generation = 0;
  62955. for (let j = 0; j < typeFieldWidth; ++j) {
  62956. const typeByte = stream.getByte();
  62957. if (typeByte === -1) {
  62958. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62959. }
  62960. type = type << 8 | typeByte;
  62961. }
  62962. if (typeFieldWidth === 0) {
  62963. type = 1;
  62964. }
  62965. for (let j = 0; j < offsetFieldWidth; ++j) {
  62966. const offsetByte = stream.getByte();
  62967. if (offsetByte === -1) {
  62968. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62969. }
  62970. offset = offset << 8 | offsetByte;
  62971. }
  62972. for (let j = 0; j < generationFieldWidth; ++j) {
  62973. const generationByte = stream.getByte();
  62974. if (generationByte === -1) {
  62975. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  62976. }
  62977. generation = generation << 8 | generationByte;
  62978. }
  62979. const entry = {};
  62980. entry.offset = offset;
  62981. entry.gen = generation;
  62982. switch (type) {
  62983. case 0:
  62984. entry.free = true;
  62985. break;
  62986. case 1:
  62987. entry.uncompressed = true;
  62988. break;
  62989. case 2:
  62990. break;
  62991. default:
  62992. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  62993. }
  62994. if (!this.entries[first + i]) {
  62995. this.entries[first + i] = entry;
  62996. }
  62997. }
  62998. streamState.entryNum = 0;
  62999. streamState.streamPos = stream.pos;
  63000. entryRanges.splice(0, 2);
  63001. }
  63002. }
  63003. indexObjects() {
  63004. const TAB = 0x9,
  63005. LF = 0xa,
  63006. CR = 0xd,
  63007. SPACE = 0x20;
  63008. const PERCENT = 0x25,
  63009. LT = 0x3c;
  63010. function readToken(data, offset) {
  63011. let token = "",
  63012. ch = data[offset];
  63013. while (ch !== LF && ch !== CR && ch !== LT) {
  63014. if (++offset >= data.length) {
  63015. break;
  63016. }
  63017. token += String.fromCharCode(ch);
  63018. ch = data[offset];
  63019. }
  63020. return token;
  63021. }
  63022. function skipUntil(data, offset, what) {
  63023. const length = what.length,
  63024. dataLength = data.length;
  63025. let skipped = 0;
  63026. while (offset < dataLength) {
  63027. let i = 0;
  63028. while (i < length && data[offset + i] === what[i]) {
  63029. ++i;
  63030. }
  63031. if (i >= length) {
  63032. break;
  63033. }
  63034. offset++;
  63035. skipped++;
  63036. }
  63037. return skipped;
  63038. }
  63039. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  63040. const endobjRegExp = /\bendobj[\b\s]$/;
  63041. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  63042. const CHECK_CONTENT_LENGTH = 25;
  63043. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  63044. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  63045. const objBytes = new Uint8Array([111, 98, 106]);
  63046. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  63047. this.entries.length = 0;
  63048. this._cacheMap.clear();
  63049. const stream = this.stream;
  63050. stream.pos = 0;
  63051. const buffer = stream.getBytes(),
  63052. length = buffer.length;
  63053. let position = stream.start;
  63054. const trailers = [],
  63055. xrefStms = [];
  63056. while (position < length) {
  63057. let ch = buffer[position];
  63058. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  63059. ++position;
  63060. continue;
  63061. }
  63062. if (ch === PERCENT) {
  63063. do {
  63064. ++position;
  63065. if (position >= length) {
  63066. break;
  63067. }
  63068. ch = buffer[position];
  63069. } while (ch !== LF && ch !== CR);
  63070. continue;
  63071. }
  63072. const token = readToken(buffer, position);
  63073. let m;
  63074. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  63075. position += skipUntil(buffer, position, trailerBytes);
  63076. trailers.push(position);
  63077. position += skipUntil(buffer, position, startxrefBytes);
  63078. } else if (m = objRegExp.exec(token)) {
  63079. const num = m[1] | 0,
  63080. gen = m[2] | 0;
  63081. let contentLength,
  63082. startPos = position + token.length,
  63083. updateEntries = false;
  63084. if (!this.entries[num]) {
  63085. updateEntries = true;
  63086. } else if (this.entries[num].gen === gen) {
  63087. try {
  63088. const parser = new _parser.Parser({
  63089. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  63090. });
  63091. parser.getObj();
  63092. updateEntries = true;
  63093. } catch (ex) {
  63094. if (ex instanceof _core_utils.ParserEOFException) {
  63095. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  63096. } else {
  63097. updateEntries = true;
  63098. }
  63099. }
  63100. }
  63101. if (updateEntries) {
  63102. this.entries[num] = {
  63103. offset: position - stream.start,
  63104. gen,
  63105. uncompressed: true
  63106. };
  63107. }
  63108. while (startPos < length) {
  63109. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  63110. contentLength = endPos - position;
  63111. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  63112. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  63113. if (endobjRegExp.test(tokenStr)) {
  63114. break;
  63115. } else {
  63116. const objToken = nestedObjRegExp.exec(tokenStr);
  63117. if (objToken && objToken[1]) {
  63118. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  63119. contentLength -= objToken[1].length;
  63120. break;
  63121. }
  63122. }
  63123. startPos = endPos;
  63124. }
  63125. const content = buffer.subarray(position, position + contentLength);
  63126. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  63127. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  63128. xrefStms.push(position - stream.start);
  63129. this.xrefstms[position - stream.start] = 1;
  63130. }
  63131. position += contentLength;
  63132. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  63133. trailers.push(position);
  63134. const contentLength = skipUntil(buffer, position, startxrefBytes);
  63135. if (position + contentLength >= length) {
  63136. const endPos = position + skipUntil(buffer, position, objBytes) + 4;
  63137. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, position);
  63138. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  63139. const objToken = nestedObjRegExp.exec(tokenStr);
  63140. if (objToken && objToken[1]) {
  63141. (0, _util.warn)('indexObjects: Found first "obj" after "trailer", ' + 'caused by missing "startxref" -- trying to recover.');
  63142. position = endPos - objToken[1].length;
  63143. continue;
  63144. }
  63145. }
  63146. position += contentLength;
  63147. } else {
  63148. position += token.length + 1;
  63149. }
  63150. }
  63151. for (const xrefStm of xrefStms) {
  63152. this.startXRefQueue.push(xrefStm);
  63153. this.readXRef(true);
  63154. }
  63155. let trailerDict, trailerError;
  63156. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  63157. if (trailer === "generationFallback") {
  63158. if (!trailerError) {
  63159. break;
  63160. }
  63161. this._generationFallback = true;
  63162. continue;
  63163. }
  63164. stream.pos = trailer;
  63165. const parser = new _parser.Parser({
  63166. lexer: new _parser.Lexer(stream),
  63167. xref: this,
  63168. allowStreams: true,
  63169. recoveryMode: true
  63170. });
  63171. const obj = parser.getObj();
  63172. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  63173. continue;
  63174. }
  63175. const dict = parser.getObj();
  63176. if (!(dict instanceof _primitives.Dict)) {
  63177. continue;
  63178. }
  63179. let validPagesDict = false;
  63180. try {
  63181. const rootDict = dict.get("Root");
  63182. if (!(rootDict instanceof _primitives.Dict)) {
  63183. continue;
  63184. }
  63185. const pagesDict = rootDict.get("Pages");
  63186. if (!(pagesDict instanceof _primitives.Dict)) {
  63187. continue;
  63188. }
  63189. const pagesCount = pagesDict.get("Count");
  63190. if (Number.isInteger(pagesCount)) {
  63191. validPagesDict = true;
  63192. }
  63193. } catch (ex) {
  63194. trailerError = ex;
  63195. continue;
  63196. }
  63197. if (validPagesDict && dict.has("ID")) {
  63198. return dict;
  63199. }
  63200. trailerDict = dict;
  63201. }
  63202. if (trailerDict) {
  63203. return trailerDict;
  63204. }
  63205. if (this.topDict) {
  63206. return this.topDict;
  63207. }
  63208. throw new _util.InvalidPDFException("Invalid PDF structure.");
  63209. }
  63210. readXRef(recoveryMode = false) {
  63211. const stream = this.stream;
  63212. const startXRefParsedCache = new Set();
  63213. try {
  63214. while (this.startXRefQueue.length) {
  63215. const startXRef = this.startXRefQueue[0];
  63216. if (startXRefParsedCache.has(startXRef)) {
  63217. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  63218. this.startXRefQueue.shift();
  63219. continue;
  63220. }
  63221. startXRefParsedCache.add(startXRef);
  63222. stream.pos = startXRef + stream.start;
  63223. const parser = new _parser.Parser({
  63224. lexer: new _parser.Lexer(stream),
  63225. xref: this,
  63226. allowStreams: true
  63227. });
  63228. let obj = parser.getObj();
  63229. let dict;
  63230. if ((0, _primitives.isCmd)(obj, "xref")) {
  63231. dict = this.processXRefTable(parser);
  63232. if (!this.topDict) {
  63233. this.topDict = dict;
  63234. }
  63235. obj = dict.get("XRefStm");
  63236. if (Number.isInteger(obj)) {
  63237. const pos = obj;
  63238. if (!(pos in this.xrefstms)) {
  63239. this.xrefstms[pos] = 1;
  63240. this.startXRefQueue.push(pos);
  63241. }
  63242. }
  63243. } else if (Number.isInteger(obj)) {
  63244. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  63245. throw new _util.FormatError("Invalid XRef stream");
  63246. }
  63247. dict = this.processXRefStream(obj);
  63248. if (!this.topDict) {
  63249. this.topDict = dict;
  63250. }
  63251. if (!dict) {
  63252. throw new _util.FormatError("Failed to read XRef stream");
  63253. }
  63254. } else {
  63255. throw new _util.FormatError("Invalid XRef stream header");
  63256. }
  63257. obj = dict.get("Prev");
  63258. if (Number.isInteger(obj)) {
  63259. this.startXRefQueue.push(obj);
  63260. } else if (obj instanceof _primitives.Ref) {
  63261. this.startXRefQueue.push(obj.num);
  63262. }
  63263. this.startXRefQueue.shift();
  63264. }
  63265. return this.topDict;
  63266. } catch (e) {
  63267. if (e instanceof _core_utils.MissingDataException) {
  63268. throw e;
  63269. }
  63270. (0, _util.info)("(while reading XRef): " + e);
  63271. this.startXRefQueue.shift();
  63272. }
  63273. if (recoveryMode) {
  63274. return undefined;
  63275. }
  63276. throw new _core_utils.XRefParseException();
  63277. }
  63278. getEntry(i) {
  63279. const xrefEntry = this.entries[i];
  63280. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  63281. return xrefEntry;
  63282. }
  63283. return null;
  63284. }
  63285. fetchIfRef(obj, suppressEncryption = false) {
  63286. if (obj instanceof _primitives.Ref) {
  63287. return this.fetch(obj, suppressEncryption);
  63288. }
  63289. return obj;
  63290. }
  63291. fetch(ref, suppressEncryption = false) {
  63292. if (!(ref instanceof _primitives.Ref)) {
  63293. throw new Error("ref object is not a reference");
  63294. }
  63295. const num = ref.num;
  63296. const cacheEntry = this._cacheMap.get(num);
  63297. if (cacheEntry !== undefined) {
  63298. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  63299. cacheEntry.objId = ref.toString();
  63300. }
  63301. return cacheEntry;
  63302. }
  63303. let xrefEntry = this.getEntry(num);
  63304. if (xrefEntry === null) {
  63305. this._cacheMap.set(num, xrefEntry);
  63306. return xrefEntry;
  63307. }
  63308. if (this._pendingRefs.has(ref)) {
  63309. this._pendingRefs.remove(ref);
  63310. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  63311. return _primitives.CIRCULAR_REF;
  63312. }
  63313. this._pendingRefs.put(ref);
  63314. try {
  63315. if (xrefEntry.uncompressed) {
  63316. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  63317. } else {
  63318. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  63319. }
  63320. this._pendingRefs.remove(ref);
  63321. } catch (ex) {
  63322. this._pendingRefs.remove(ref);
  63323. throw ex;
  63324. }
  63325. if (xrefEntry instanceof _primitives.Dict) {
  63326. xrefEntry.objId = ref.toString();
  63327. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  63328. xrefEntry.dict.objId = ref.toString();
  63329. }
  63330. return xrefEntry;
  63331. }
  63332. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  63333. const gen = ref.gen;
  63334. let num = ref.num;
  63335. if (xrefEntry.gen !== gen) {
  63336. const msg = `Inconsistent generation in XRef: ${ref}`;
  63337. if (this._generationFallback && xrefEntry.gen < gen) {
  63338. (0, _util.warn)(msg);
  63339. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  63340. }
  63341. throw new _core_utils.XRefEntryException(msg);
  63342. }
  63343. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  63344. const parser = new _parser.Parser({
  63345. lexer: new _parser.Lexer(stream),
  63346. xref: this,
  63347. allowStreams: true
  63348. });
  63349. const obj1 = parser.getObj();
  63350. const obj2 = parser.getObj();
  63351. const obj3 = parser.getObj();
  63352. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  63353. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63354. }
  63355. if (obj3.cmd !== "obj") {
  63356. if (obj3.cmd.startsWith("obj")) {
  63357. num = parseInt(obj3.cmd.substring(3), 10);
  63358. if (!Number.isNaN(num)) {
  63359. return num;
  63360. }
  63361. }
  63362. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63363. }
  63364. if (this.encrypt && !suppressEncryption) {
  63365. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  63366. } else {
  63367. xrefEntry = parser.getObj();
  63368. }
  63369. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  63370. this._cacheMap.set(num, xrefEntry);
  63371. }
  63372. return xrefEntry;
  63373. }
  63374. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  63375. const tableOffset = xrefEntry.offset;
  63376. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  63377. if (!(stream instanceof _base_stream.BaseStream)) {
  63378. throw new _util.FormatError("bad ObjStm stream");
  63379. }
  63380. const first = stream.dict.get("First");
  63381. const n = stream.dict.get("N");
  63382. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  63383. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  63384. }
  63385. let parser = new _parser.Parser({
  63386. lexer: new _parser.Lexer(stream),
  63387. xref: this,
  63388. allowStreams: true
  63389. });
  63390. const nums = new Array(n);
  63391. const offsets = new Array(n);
  63392. for (let i = 0; i < n; ++i) {
  63393. const num = parser.getObj();
  63394. if (!Number.isInteger(num)) {
  63395. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  63396. }
  63397. const offset = parser.getObj();
  63398. if (!Number.isInteger(offset)) {
  63399. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  63400. }
  63401. nums[i] = num;
  63402. offsets[i] = offset;
  63403. }
  63404. const start = (stream.start || 0) + first;
  63405. const entries = new Array(n);
  63406. for (let i = 0; i < n; ++i) {
  63407. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  63408. if (length < 0) {
  63409. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  63410. }
  63411. parser = new _parser.Parser({
  63412. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  63413. xref: this,
  63414. allowStreams: true
  63415. });
  63416. const obj = parser.getObj();
  63417. entries[i] = obj;
  63418. if (obj instanceof _base_stream.BaseStream) {
  63419. continue;
  63420. }
  63421. const num = nums[i],
  63422. entry = this.entries[num];
  63423. if (entry && entry.offset === tableOffset && entry.gen === i) {
  63424. this._cacheMap.set(num, obj);
  63425. }
  63426. }
  63427. xrefEntry = entries[xrefEntry.gen];
  63428. if (xrefEntry === undefined) {
  63429. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  63430. }
  63431. return xrefEntry;
  63432. }
  63433. async fetchIfRefAsync(obj, suppressEncryption) {
  63434. if (obj instanceof _primitives.Ref) {
  63435. return this.fetchAsync(obj, suppressEncryption);
  63436. }
  63437. return obj;
  63438. }
  63439. async fetchAsync(ref, suppressEncryption) {
  63440. try {
  63441. return this.fetch(ref, suppressEncryption);
  63442. } catch (ex) {
  63443. if (!(ex instanceof _core_utils.MissingDataException)) {
  63444. throw ex;
  63445. }
  63446. await this.pdfManager.requestRange(ex.begin, ex.end);
  63447. return this.fetchAsync(ref, suppressEncryption);
  63448. }
  63449. }
  63450. getCatalogObj() {
  63451. return this.root;
  63452. }
  63453. }
  63454. exports.XRef = XRef;
  63455. /***/ }),
  63456. /* 100 */
  63457. /***/ ((__unused_webpack_module, exports) => {
  63458. Object.defineProperty(exports, "__esModule", ({
  63459. value: true
  63460. }));
  63461. exports.isNodeJS = void 0;
  63462. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  63463. exports.isNodeJS = isNodeJS;
  63464. /***/ }),
  63465. /* 101 */
  63466. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63467. Object.defineProperty(exports, "__esModule", ({
  63468. value: true
  63469. }));
  63470. exports.MessageHandler = void 0;
  63471. var _util = __w_pdfjs_require__(2);
  63472. const CallbackKind = {
  63473. UNKNOWN: 0,
  63474. DATA: 1,
  63475. ERROR: 2
  63476. };
  63477. const StreamKind = {
  63478. UNKNOWN: 0,
  63479. CANCEL: 1,
  63480. CANCEL_COMPLETE: 2,
  63481. CLOSE: 3,
  63482. ENQUEUE: 4,
  63483. ERROR: 5,
  63484. PULL: 6,
  63485. PULL_COMPLETE: 7,
  63486. START_COMPLETE: 8
  63487. };
  63488. function wrapReason(reason) {
  63489. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  63490. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  63491. }
  63492. switch (reason.name) {
  63493. case "AbortException":
  63494. return new _util.AbortException(reason.message);
  63495. case "MissingPDFException":
  63496. return new _util.MissingPDFException(reason.message);
  63497. case "PasswordException":
  63498. return new _util.PasswordException(reason.message, reason.code);
  63499. case "UnexpectedResponseException":
  63500. return new _util.UnexpectedResponseException(reason.message, reason.status);
  63501. case "UnknownErrorException":
  63502. return new _util.UnknownErrorException(reason.message, reason.details);
  63503. default:
  63504. return new _util.UnknownErrorException(reason.message, reason.toString());
  63505. }
  63506. }
  63507. class MessageHandler {
  63508. constructor(sourceName, targetName, comObj) {
  63509. this.sourceName = sourceName;
  63510. this.targetName = targetName;
  63511. this.comObj = comObj;
  63512. this.callbackId = 1;
  63513. this.streamId = 1;
  63514. this.streamSinks = Object.create(null);
  63515. this.streamControllers = Object.create(null);
  63516. this.callbackCapabilities = Object.create(null);
  63517. this.actionHandler = Object.create(null);
  63518. this._onComObjOnMessage = event => {
  63519. const data = event.data;
  63520. if (data.targetName !== this.sourceName) {
  63521. return;
  63522. }
  63523. if (data.stream) {
  63524. this._processStreamMessage(data);
  63525. return;
  63526. }
  63527. if (data.callback) {
  63528. const callbackId = data.callbackId;
  63529. const capability = this.callbackCapabilities[callbackId];
  63530. if (!capability) {
  63531. throw new Error(`Cannot resolve callback ${callbackId}`);
  63532. }
  63533. delete this.callbackCapabilities[callbackId];
  63534. if (data.callback === CallbackKind.DATA) {
  63535. capability.resolve(data.data);
  63536. } else if (data.callback === CallbackKind.ERROR) {
  63537. capability.reject(wrapReason(data.reason));
  63538. } else {
  63539. throw new Error("Unexpected callback case");
  63540. }
  63541. return;
  63542. }
  63543. const action = this.actionHandler[data.action];
  63544. if (!action) {
  63545. throw new Error(`Unknown action from worker: ${data.action}`);
  63546. }
  63547. if (data.callbackId) {
  63548. const cbSourceName = this.sourceName;
  63549. const cbTargetName = data.sourceName;
  63550. new Promise(function (resolve) {
  63551. resolve(action(data.data));
  63552. }).then(function (result) {
  63553. comObj.postMessage({
  63554. sourceName: cbSourceName,
  63555. targetName: cbTargetName,
  63556. callback: CallbackKind.DATA,
  63557. callbackId: data.callbackId,
  63558. data: result
  63559. });
  63560. }, function (reason) {
  63561. comObj.postMessage({
  63562. sourceName: cbSourceName,
  63563. targetName: cbTargetName,
  63564. callback: CallbackKind.ERROR,
  63565. callbackId: data.callbackId,
  63566. reason: wrapReason(reason)
  63567. });
  63568. });
  63569. return;
  63570. }
  63571. if (data.streamId) {
  63572. this._createStreamSink(data);
  63573. return;
  63574. }
  63575. action(data.data);
  63576. };
  63577. comObj.addEventListener("message", this._onComObjOnMessage);
  63578. }
  63579. on(actionName, handler) {
  63580. const ah = this.actionHandler;
  63581. if (ah[actionName]) {
  63582. throw new Error(`There is already an actionName called "${actionName}"`);
  63583. }
  63584. ah[actionName] = handler;
  63585. }
  63586. send(actionName, data, transfers) {
  63587. this.comObj.postMessage({
  63588. sourceName: this.sourceName,
  63589. targetName: this.targetName,
  63590. action: actionName,
  63591. data
  63592. }, transfers);
  63593. }
  63594. sendWithPromise(actionName, data, transfers) {
  63595. const callbackId = this.callbackId++;
  63596. const capability = (0, _util.createPromiseCapability)();
  63597. this.callbackCapabilities[callbackId] = capability;
  63598. try {
  63599. this.comObj.postMessage({
  63600. sourceName: this.sourceName,
  63601. targetName: this.targetName,
  63602. action: actionName,
  63603. callbackId,
  63604. data
  63605. }, transfers);
  63606. } catch (ex) {
  63607. capability.reject(ex);
  63608. }
  63609. return capability.promise;
  63610. }
  63611. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63612. const streamId = this.streamId++,
  63613. sourceName = this.sourceName,
  63614. targetName = this.targetName,
  63615. comObj = this.comObj;
  63616. return new ReadableStream({
  63617. start: controller => {
  63618. const startCapability = (0, _util.createPromiseCapability)();
  63619. this.streamControllers[streamId] = {
  63620. controller,
  63621. startCall: startCapability,
  63622. pullCall: null,
  63623. cancelCall: null,
  63624. isClosed: false
  63625. };
  63626. comObj.postMessage({
  63627. sourceName,
  63628. targetName,
  63629. action: actionName,
  63630. streamId,
  63631. data,
  63632. desiredSize: controller.desiredSize
  63633. }, transfers);
  63634. return startCapability.promise;
  63635. },
  63636. pull: controller => {
  63637. const pullCapability = (0, _util.createPromiseCapability)();
  63638. this.streamControllers[streamId].pullCall = pullCapability;
  63639. comObj.postMessage({
  63640. sourceName,
  63641. targetName,
  63642. stream: StreamKind.PULL,
  63643. streamId,
  63644. desiredSize: controller.desiredSize
  63645. });
  63646. return pullCapability.promise;
  63647. },
  63648. cancel: reason => {
  63649. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63650. const cancelCapability = (0, _util.createPromiseCapability)();
  63651. this.streamControllers[streamId].cancelCall = cancelCapability;
  63652. this.streamControllers[streamId].isClosed = true;
  63653. comObj.postMessage({
  63654. sourceName,
  63655. targetName,
  63656. stream: StreamKind.CANCEL,
  63657. streamId,
  63658. reason: wrapReason(reason)
  63659. });
  63660. return cancelCapability.promise;
  63661. }
  63662. }, queueingStrategy);
  63663. }
  63664. _createStreamSink(data) {
  63665. const streamId = data.streamId,
  63666. sourceName = this.sourceName,
  63667. targetName = data.sourceName,
  63668. comObj = this.comObj;
  63669. const self = this,
  63670. action = this.actionHandler[data.action];
  63671. const streamSink = {
  63672. enqueue(chunk, size = 1, transfers) {
  63673. if (this.isCancelled) {
  63674. return;
  63675. }
  63676. const lastDesiredSize = this.desiredSize;
  63677. this.desiredSize -= size;
  63678. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63679. this.sinkCapability = (0, _util.createPromiseCapability)();
  63680. this.ready = this.sinkCapability.promise;
  63681. }
  63682. comObj.postMessage({
  63683. sourceName,
  63684. targetName,
  63685. stream: StreamKind.ENQUEUE,
  63686. streamId,
  63687. chunk
  63688. }, transfers);
  63689. },
  63690. close() {
  63691. if (this.isCancelled) {
  63692. return;
  63693. }
  63694. this.isCancelled = true;
  63695. comObj.postMessage({
  63696. sourceName,
  63697. targetName,
  63698. stream: StreamKind.CLOSE,
  63699. streamId
  63700. });
  63701. delete self.streamSinks[streamId];
  63702. },
  63703. error(reason) {
  63704. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63705. if (this.isCancelled) {
  63706. return;
  63707. }
  63708. this.isCancelled = true;
  63709. comObj.postMessage({
  63710. sourceName,
  63711. targetName,
  63712. stream: StreamKind.ERROR,
  63713. streamId,
  63714. reason: wrapReason(reason)
  63715. });
  63716. },
  63717. sinkCapability: (0, _util.createPromiseCapability)(),
  63718. onPull: null,
  63719. onCancel: null,
  63720. isCancelled: false,
  63721. desiredSize: data.desiredSize,
  63722. ready: null
  63723. };
  63724. streamSink.sinkCapability.resolve();
  63725. streamSink.ready = streamSink.sinkCapability.promise;
  63726. this.streamSinks[streamId] = streamSink;
  63727. new Promise(function (resolve) {
  63728. resolve(action(data.data, streamSink));
  63729. }).then(function () {
  63730. comObj.postMessage({
  63731. sourceName,
  63732. targetName,
  63733. stream: StreamKind.START_COMPLETE,
  63734. streamId,
  63735. success: true
  63736. });
  63737. }, function (reason) {
  63738. comObj.postMessage({
  63739. sourceName,
  63740. targetName,
  63741. stream: StreamKind.START_COMPLETE,
  63742. streamId,
  63743. reason: wrapReason(reason)
  63744. });
  63745. });
  63746. }
  63747. _processStreamMessage(data) {
  63748. const streamId = data.streamId,
  63749. sourceName = this.sourceName,
  63750. targetName = data.sourceName,
  63751. comObj = this.comObj;
  63752. const streamController = this.streamControllers[streamId],
  63753. streamSink = this.streamSinks[streamId];
  63754. switch (data.stream) {
  63755. case StreamKind.START_COMPLETE:
  63756. if (data.success) {
  63757. streamController.startCall.resolve();
  63758. } else {
  63759. streamController.startCall.reject(wrapReason(data.reason));
  63760. }
  63761. break;
  63762. case StreamKind.PULL_COMPLETE:
  63763. if (data.success) {
  63764. streamController.pullCall.resolve();
  63765. } else {
  63766. streamController.pullCall.reject(wrapReason(data.reason));
  63767. }
  63768. break;
  63769. case StreamKind.PULL:
  63770. if (!streamSink) {
  63771. comObj.postMessage({
  63772. sourceName,
  63773. targetName,
  63774. stream: StreamKind.PULL_COMPLETE,
  63775. streamId,
  63776. success: true
  63777. });
  63778. break;
  63779. }
  63780. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63781. streamSink.sinkCapability.resolve();
  63782. }
  63783. streamSink.desiredSize = data.desiredSize;
  63784. new Promise(function (resolve) {
  63785. resolve(streamSink.onPull && streamSink.onPull());
  63786. }).then(function () {
  63787. comObj.postMessage({
  63788. sourceName,
  63789. targetName,
  63790. stream: StreamKind.PULL_COMPLETE,
  63791. streamId,
  63792. success: true
  63793. });
  63794. }, function (reason) {
  63795. comObj.postMessage({
  63796. sourceName,
  63797. targetName,
  63798. stream: StreamKind.PULL_COMPLETE,
  63799. streamId,
  63800. reason: wrapReason(reason)
  63801. });
  63802. });
  63803. break;
  63804. case StreamKind.ENQUEUE:
  63805. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63806. if (streamController.isClosed) {
  63807. break;
  63808. }
  63809. streamController.controller.enqueue(data.chunk);
  63810. break;
  63811. case StreamKind.CLOSE:
  63812. (0, _util.assert)(streamController, "close should have stream controller");
  63813. if (streamController.isClosed) {
  63814. break;
  63815. }
  63816. streamController.isClosed = true;
  63817. streamController.controller.close();
  63818. this._deleteStreamController(streamController, streamId);
  63819. break;
  63820. case StreamKind.ERROR:
  63821. (0, _util.assert)(streamController, "error should have stream controller");
  63822. streamController.controller.error(wrapReason(data.reason));
  63823. this._deleteStreamController(streamController, streamId);
  63824. break;
  63825. case StreamKind.CANCEL_COMPLETE:
  63826. if (data.success) {
  63827. streamController.cancelCall.resolve();
  63828. } else {
  63829. streamController.cancelCall.reject(wrapReason(data.reason));
  63830. }
  63831. this._deleteStreamController(streamController, streamId);
  63832. break;
  63833. case StreamKind.CANCEL:
  63834. if (!streamSink) {
  63835. break;
  63836. }
  63837. new Promise(function (resolve) {
  63838. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63839. }).then(function () {
  63840. comObj.postMessage({
  63841. sourceName,
  63842. targetName,
  63843. stream: StreamKind.CANCEL_COMPLETE,
  63844. streamId,
  63845. success: true
  63846. });
  63847. }, function (reason) {
  63848. comObj.postMessage({
  63849. sourceName,
  63850. targetName,
  63851. stream: StreamKind.CANCEL_COMPLETE,
  63852. streamId,
  63853. reason: wrapReason(reason)
  63854. });
  63855. });
  63856. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63857. streamSink.isCancelled = true;
  63858. delete this.streamSinks[streamId];
  63859. break;
  63860. default:
  63861. throw new Error("Unexpected stream case");
  63862. }
  63863. }
  63864. async _deleteStreamController(streamController, streamId) {
  63865. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63866. delete this.streamControllers[streamId];
  63867. }
  63868. destroy() {
  63869. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63870. }
  63871. }
  63872. exports.MessageHandler = MessageHandler;
  63873. /***/ }),
  63874. /* 102 */
  63875. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63876. Object.defineProperty(exports, "__esModule", ({
  63877. value: true
  63878. }));
  63879. exports.PDFWorkerStream = void 0;
  63880. var _util = __w_pdfjs_require__(2);
  63881. class PDFWorkerStream {
  63882. constructor(msgHandler) {
  63883. this._msgHandler = msgHandler;
  63884. this._contentLength = null;
  63885. this._fullRequestReader = null;
  63886. this._rangeRequestReaders = [];
  63887. }
  63888. getFullReader() {
  63889. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63890. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63891. return this._fullRequestReader;
  63892. }
  63893. getRangeReader(begin, end) {
  63894. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63895. this._rangeRequestReaders.push(reader);
  63896. return reader;
  63897. }
  63898. cancelAllRequests(reason) {
  63899. if (this._fullRequestReader) {
  63900. this._fullRequestReader.cancel(reason);
  63901. }
  63902. for (const reader of this._rangeRequestReaders.slice(0)) {
  63903. reader.cancel(reason);
  63904. }
  63905. }
  63906. }
  63907. exports.PDFWorkerStream = PDFWorkerStream;
  63908. class PDFWorkerStreamReader {
  63909. constructor(msgHandler) {
  63910. this._msgHandler = msgHandler;
  63911. this.onProgress = null;
  63912. this._contentLength = null;
  63913. this._isRangeSupported = false;
  63914. this._isStreamingSupported = false;
  63915. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63916. this._reader = readableStream.getReader();
  63917. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63918. this._isStreamingSupported = data.isStreamingSupported;
  63919. this._isRangeSupported = data.isRangeSupported;
  63920. this._contentLength = data.contentLength;
  63921. });
  63922. }
  63923. get headersReady() {
  63924. return this._headersReady;
  63925. }
  63926. get contentLength() {
  63927. return this._contentLength;
  63928. }
  63929. get isStreamingSupported() {
  63930. return this._isStreamingSupported;
  63931. }
  63932. get isRangeSupported() {
  63933. return this._isRangeSupported;
  63934. }
  63935. async read() {
  63936. const {
  63937. value,
  63938. done
  63939. } = await this._reader.read();
  63940. if (done) {
  63941. return {
  63942. value: undefined,
  63943. done: true
  63944. };
  63945. }
  63946. return {
  63947. value: value.buffer,
  63948. done: false
  63949. };
  63950. }
  63951. cancel(reason) {
  63952. this._reader.cancel(reason);
  63953. }
  63954. }
  63955. class PDFWorkerStreamRangeReader {
  63956. constructor(begin, end, msgHandler) {
  63957. this._msgHandler = msgHandler;
  63958. this.onProgress = null;
  63959. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63960. begin,
  63961. end
  63962. });
  63963. this._reader = readableStream.getReader();
  63964. }
  63965. get isStreamingSupported() {
  63966. return false;
  63967. }
  63968. async read() {
  63969. const {
  63970. value,
  63971. done
  63972. } = await this._reader.read();
  63973. if (done) {
  63974. return {
  63975. value: undefined,
  63976. done: true
  63977. };
  63978. }
  63979. return {
  63980. value: value.buffer,
  63981. done: false
  63982. };
  63983. }
  63984. cancel(reason) {
  63985. this._reader.cancel(reason);
  63986. }
  63987. }
  63988. /***/ })
  63989. /******/ ]);
  63990. /************************************************************************/
  63991. /******/ // The module cache
  63992. /******/ var __webpack_module_cache__ = {};
  63993. /******/
  63994. /******/ // The require function
  63995. /******/ function __w_pdfjs_require__(moduleId) {
  63996. /******/ // Check if module is in cache
  63997. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  63998. /******/ if (cachedModule !== undefined) {
  63999. /******/ return cachedModule.exports;
  64000. /******/ }
  64001. /******/ // Create a new module (and put it into the cache)
  64002. /******/ var module = __webpack_module_cache__[moduleId] = {
  64003. /******/ // no module.id needed
  64004. /******/ // no module.loaded needed
  64005. /******/ exports: {}
  64006. /******/ };
  64007. /******/
  64008. /******/ // Execute the module function
  64009. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  64010. /******/
  64011. /******/ // Return the exports of the module
  64012. /******/ return module.exports;
  64013. /******/ }
  64014. /******/
  64015. /************************************************************************/
  64016. /******/ /* webpack/runtime/define property getters */
  64017. /******/ (() => {
  64018. /******/ // define getter functions for harmony exports
  64019. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  64020. /******/ for(var key in definition) {
  64021. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  64022. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  64023. /******/ }
  64024. /******/ }
  64025. /******/ };
  64026. /******/ })();
  64027. /******/
  64028. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  64029. /******/ (() => {
  64030. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  64031. /******/ })();
  64032. /******/
  64033. /******/ /* webpack/runtime/make namespace object */
  64034. /******/ (() => {
  64035. /******/ // define __esModule on exports
  64036. /******/ __w_pdfjs_require__.r = (exports) => {
  64037. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  64038. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  64039. /******/ }
  64040. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  64041. /******/ };
  64042. /******/ })();
  64043. /******/
  64044. /************************************************************************/
  64045. var __webpack_exports__ = {};
  64046. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  64047. (() => {
  64048. var exports = __webpack_exports__;
  64049. Object.defineProperty(exports, "__esModule", ({
  64050. value: true
  64051. }));
  64052. Object.defineProperty(exports, "WorkerMessageHandler", ({
  64053. enumerable: true,
  64054. get: function () {
  64055. return _worker.WorkerMessageHandler;
  64056. }
  64057. }));
  64058. var _worker = __w_pdfjs_require__(1);
  64059. const pdfjsVersion = '3.1.81';
  64060. const pdfjsBuild = '0766898d5';
  64061. })();
  64062. /******/ return __webpack_exports__;
  64063. /******/ })()
  64064. ;
  64065. });
  64066. //# sourceMappingURL=pdf.worker.js.map